Allows users to set spring.batch.job.enabled with fail-on-job-failure.

resolves #525
This commit is contained in:
Glenn Renfro
2019-06-25 11:55:30 -04:00
committed by Michael Minella
parent 7490f8b820
commit 0a179aae61
3 changed files with 62 additions and 3 deletions

View File

@@ -32,6 +32,7 @@ import org.springframework.batch.core.configuration.annotation.DefaultBatchConfi
import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
import org.springframework.batch.core.configuration.annotation.JobBuilderFactory;
import org.springframework.batch.core.configuration.annotation.StepBuilderFactory;
import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.launch.support.SimpleJobLauncher;
import org.springframework.batch.core.scope.context.ChunkContext;
@@ -112,6 +113,19 @@ public class TaskJobLauncherCommandLineRunnerTests {
enabledArgs);
}
@Test
public void testNoTaskJobLauncher() {
String[] enabledArgs = new String[] {
"--spring.cloud.task.batch.failOnJobFailure=true",
"--spring.cloud.task.batch.failOnJobFailurePollInterval=500",
"--spring.batch.job.enabled=false" };
this.applicationContext = SpringApplication.run(new Class[] {
TaskJobLauncherCommandLineRunnerTests.JobWithFailureConfiguration.class },
enabledArgs);
JobExplorer jobExplorer = this.applicationContext.getBean(JobExplorer.class);
assertThat(jobExplorer.getJobNames().size()).isEqualTo(0);
}
@Test
public void testTaskJobLauncherPickOneJob() {
String[] enabledArgs = new String[] {