Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cargotracker-dev] UploadDirectoryScanner source code change, ArquillianServletRunner

Thanks, I'll clean up and submit a PR today. All that should be necessary to replicate the Arquillian issue would be to clone the repo and run "mvn clean package cargo:run". If you're able to start the app without issue it's likely a problem on my end. 

Best,

Chanun

On Tue, Jul 5, 2022 at 2:39 PM Reza Rahman <reza_rahman@xxxxxxxxx> wrote:

Yes, it's fine to add the additional security annotation. I will double check with Payara.

With regards to the Arquillian issue, I am happy to look at it if it is reproducible.

On 7/5/2022 5:32 PM, Chanun Ong wrote:
Hi Reza and Cargo Tracker mailing list,

Open Liberty's built in user authentication requires role assignments in order to operate batch jobs. So far I haven't been able to figure out a way around it without modifying the UploadDirectoryScanner class file. My change is simply to add the @PermitAll tag in the class file, which doesn't seem to have any issues with Payara. Do you think that would be a reasonable PR? The updated file would look like this: 

package org.eclipse.cargotracker.interfaces.handling.file;

import javax.annotation.security.PermitAll;
import javax.batch.operations.JobOperator;
import javax.batch.runtime.BatchRuntime;
import javax.ejb.Schedule;
import javax.ejb.Stateless;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;

/**
 * Periodically scans a certain directory for files and attempts to parse handling event
 * registrations from the contents by calling a batch job.
 *
 * <p>Files that fail to parse are moved into a separate directory, successful files are deleted.
 */
@Stateless
@PermitAll
@TransactionManagement(TransactionManagementType.BEAN) // Batch steps manage their own transactions.
public class UploadDirectoryScanner {

  @Schedule(minute = "*/2", hour = "*") // In production, run every fifteen minutes
  public void processFiles() {
    JobOperator jobOperator = BatchRuntime.getJobOperator();
    jobOperator.start("EventFilesProcessorJob", null);
  }
}
Let me know what you think about that. Finally, I've recently encountered an issue running the app on Payara where the BookingServiceTest fails after running "mvn clean package cargo:run" due to an error where the ArquillianServletRunner is not found. Is that something you've experienced before? This is happening for me on a fresh clone of the Payara repository so it's possible that it might be an issue with my machine as well. 

Thanks.

Chanun
_______________________________________________
cargotracker-dev mailing list
cargotracker-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://dev.eclipse.org/mailman/listinfo/cargotracker-dev

Back to the top