use of org.springframework.batch.core.ExitStatus in project hub-alert by blackducksoftware.
the class CommonConfigTest method testRun.
@Test
public void testRun() throws Exception {
final SimpleJobLauncher simpleJobLauncher = Mockito.mock(SimpleJobLauncher.class);
C config = getConfigWithSimpleJobLauncher(simpleJobLauncher);
final JobExecution jobExecution = Mockito.mock(JobExecution.class);
final ExitStatus exitStatus = Mockito.mock(ExitStatus.class);
Mockito.when(exitStatus.getExitCode()).thenReturn("exit");
Mockito.when(exitStatus.getExitDescription()).thenReturn("description");
Mockito.when(jobExecution.getExitStatus()).thenReturn(exitStatus);
Mockito.when(simpleJobLauncher.run(Mockito.any(), Mockito.any())).thenReturn(jobExecution);
config = Mockito.spy(config);
final Job job = Mockito.mock(Job.class);
Mockito.doReturn(job).when(config).createJob(Mockito.any(), Mockito.any(), Mockito.any());
config.run();
final boolean successfulRun = outputLogger.isLineContainingText("Job finished with status");
assertTrue(successfulRun);
}
use of org.springframework.batch.core.ExitStatus in project nixmash-blog by mintster.
the class GithubJobListener method afterJob.
@Override
public void afterJob(JobExecution jobExecution) {
if (jobExecution.getStatus() == BatchStatus.COMPLETED) {
long statId = (long) jobExecution.getExecutionContext().get("statId");
logger.info("!!! GITHUB JOB FINISHED! CURRENT STATID: " + statId);
ExitStatus es = jobExecution.getExitStatus();
jobExecution.setExitStatus(new ExitStatus(es.getExitCode(), String.valueOf(statId)));
}
}
Aggregations