List of usage examples for org.springframework.batch.core BatchStatus equals
public boolean equals(Object obj)
From source file:org.seedstack.spring.batch.internal.SpringBatchCommandLineHandler.java
@Override public Integer call() throws JobExecutionException { Integer batchExitStatus = 0;// w w w .j ava 2 s . c om JobLauncher jobLauncher = getJobLauncher(); Job job = getJob(); JobParameters jobParameters = getJobParameters(); JobExecution jobExecution = jobLauncher.run(job, jobParameters); BatchStatus batchStatus = jobExecution.getStatus(); if (!batchStatus.equals(BatchStatus.COMPLETED)) { batchExitStatus = 1; } LOGGER.info("Exit with status : " + batchStatus); return batchExitStatus; }
From source file:prototypes.batches.chunks.jobs.BatchJobIT.java
private void launchTest(Job job, BatchStatus expectedStatus) { // Prepare parameters for the job Map<String, JobParameter> parameters = new HashMap<String, JobParameter>(); parameters.put("currentDate", new JobParameter(Calendar.getInstance().getTime())); // Launch the job try {/*from w w w . j a v a2 s .co m*/ JobParameters jobParameters = new JobParameters(parameters); LOGGER.info("Launch Batch chunksJob for test"); JobExecution jobExecution = jobLauncher.run(job, jobParameters); Assert.assertTrue("Job execution status " + jobExecution.getStatus() + " should be " + expectedStatus, expectedStatus.equals(jobExecution.getStatus())); } catch (JobExecutionAlreadyRunningException e) { LOGGER.error("Job Already Running", e); } catch (JobRestartException e) { LOGGER.error("Job Restart", e); } catch (JobInstanceAlreadyCompleteException e) { LOGGER.error("Job Already Complete", e); } catch (JobParametersInvalidException e) { LOGGER.error("Job Invalid Parameters", e); } }
From source file:org.springframework.cloud.task.batch.partition.DeployerPartitionHandler.java
private boolean isComplete(BatchStatus status) { return status.equals(BatchStatus.COMPLETED) || status.isGreaterThan(BatchStatus.STARTED); }