mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-08 10:19:13 +00:00
Polish "Start building against Spring Batch 6.0.0-RC1 snapshots"
See gh-47477
This commit is contained in:
+2
-3
@@ -179,9 +179,8 @@ public class JobLauncherApplicationRunner
|
||||
if (this.jobRegistry != null && StringUtils.hasText(this.jobName)) {
|
||||
if (!isLocalJob(this.jobName)) {
|
||||
Job job = this.jobRegistry.getJob(this.jobName);
|
||||
if (job != null) {
|
||||
execute(job, jobParameters);
|
||||
}
|
||||
Assert.notNull(job, () -> "No job found with name '" + this.jobName + "'");
|
||||
execute(job, jobParameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
-12
@@ -29,7 +29,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* Tests for {@link JobExecutionExitCodeGenerator}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
class JobExecutionExitCodeGeneratorTests {
|
||||
|
||||
@@ -37,28 +36,29 @@ class JobExecutionExitCodeGeneratorTests {
|
||||
|
||||
@Test
|
||||
void testExitCodeForRunning() {
|
||||
JobInstance jobInstance = new JobInstance(1L, "job");
|
||||
JobExecution jobExecution = new JobExecution(1L, jobInstance, new JobParameters());
|
||||
this.generator.onApplicationEvent(new JobExecutionEvent(jobExecution));
|
||||
this.generator.onApplicationEvent(new JobExecutionEvent(testJobExecution()));
|
||||
assertThat(this.generator.getExitCode()).isOne();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExitCodeForCompleted() {
|
||||
JobInstance jobInstance = new JobInstance(1L, "job");
|
||||
JobExecution jobExecution = new JobExecution(1L, jobInstance, new JobParameters());
|
||||
jobExecution.setStatus(BatchStatus.COMPLETED);
|
||||
this.generator.onApplicationEvent(new JobExecutionEvent(jobExecution));
|
||||
JobExecution execution = testJobExecution();
|
||||
execution.setStatus(BatchStatus.COMPLETED);
|
||||
this.generator.onApplicationEvent(new JobExecutionEvent(execution));
|
||||
assertThat(this.generator.getExitCode()).isZero();
|
||||
}
|
||||
|
||||
@Test
|
||||
void testExitCodeForFailed() {
|
||||
JobInstance jobInstance = new JobInstance(1L, "job");
|
||||
JobExecution jobExecution = new JobExecution(1L, jobInstance, new JobParameters());
|
||||
jobExecution.setStatus(BatchStatus.FAILED);
|
||||
this.generator.onApplicationEvent(new JobExecutionEvent(jobExecution));
|
||||
JobExecution execution = testJobExecution();
|
||||
execution.setStatus(BatchStatus.FAILED);
|
||||
this.generator.onApplicationEvent(new JobExecutionEvent(execution));
|
||||
assertThat(this.generator.getExitCode()).isEqualTo(5);
|
||||
}
|
||||
|
||||
private static JobExecution testJobExecution() {
|
||||
JobInstance jobInstance = new JobInstance(1L, "job");
|
||||
return new JobExecution(0L, jobInstance, new JobParameters());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user