Updated to add metadata for Conditionals

Also renamed camel-cased properties to cononical format.

resolves #442
This commit is contained in:
Glenn Renfro
2018-10-16 16:38:08 -04:00
committed by Janne Valkealahti
parent c719f8b1f9
commit d2c90c5256
15 changed files with 103 additions and 19 deletions

View File

@@ -38,7 +38,7 @@ public class TaskBatchProperties {
/**
* The order for the {@coce CommandLineRunner} used to run batch jobs when
* {@code spring.cloud.task.batch.failOnJobFailure=true}. Defaults to 0 (same as the
* {@code spring.cloud.task.batch.fail-on-job-failure=true}. Defaults to 0 (same as the
* {@link org.springframework.boot.autoconfigure.batch.JobLauncherCommandLineRunner}).
*/
private int commandLineRunnerOrder = 0;

View File

@@ -35,7 +35,7 @@ import org.springframework.context.annotation.Configuration;
* @author Glenn Renfro
*/
@Configuration
@ConditionalOnProperty(name = "spring.cloud.task.batch.failOnJobFailure", havingValue = "true", matchIfMissing = false)
@ConditionalOnProperty(name = "spring.cloud.task.batch.fail-on-job-failure", havingValue = "true", matchIfMissing = false)
@EnableConfigurationProperties(TaskBatchProperties.class)
public class TaskJobLauncherAutoConfiguration {

View File

@@ -0,0 +1,64 @@
{
"properties": [
{
"defaultValue": "true",
"name": "spring.cloud.task.batch.listener.enabled",
"description": "This property is used to determine if a task will be linked to the batch jobs that are run.",
"type": "java.lang.Boolean"
},
{
"defaultValue": "false",
"name": "spring.cloud.task.batch.fail-on-job-failure",
"description": "This property is used to determine if a task app should return with a non zero exit code if a batch job fails.",
"type": "java.lang.Boolean"
},
{
"defaultValue": "true",
"name": "spring.cloud.task.batch.events.enabled",
"description": "This property is used to determine if a task should listen for batch events.",
"type": "java.lang.Boolean"
},
{
"defaultValue": "true",
"name": "spring.cloud.task.batch.events.chunk.enabled",
"description": "This property is used to determine if a task should listen for batch chunk events.",
"type": "java.lang.Boolean"
},
{
"defaultValue": "true",
"name": "spring.cloud.task.batch.events.item-process.enabled",
"description": "This property is used to determine if a task should listen for batch item processed events.",
"type": "java.lang.Boolean"
},
{
"defaultValue": "true",
"name": "spring.cloud.task.batch.events.item-read.enabled",
"description": "This property is used to determine if a task should listen for batch item read events.",
"type": "java.lang.Boolean"
},
{
"defaultValue": "true",
"name": "spring.cloud.task.batch.events.item-write.enabled",
"description": "This property is used to determine if a task should listen for batch item write events.",
"type": "java.lang.Boolean"
},
{
"defaultValue": "true",
"name": "spring.cloud.task.batch.events.job-execution.enabled",
"description": "This property is used to determine if a task should listen for batch job execution events.",
"type": "java.lang.Boolean"
},
{
"defaultValue": "true",
"name": "spring.cloud.task.batch.events.skip.enabled",
"description": "This property is used to determine if a task should listen for batch skip events.",
"type": "java.lang.Boolean"
},
{
"defaultValue": "true",
"name": "spring.cloud.task.batch.events.step-execution.enabled",
"description": "This property is used to determine if a task should listen for batch step execution events.",
"type": "java.lang.Boolean"
}
]
}

View File

@@ -43,7 +43,7 @@ public class TaskJobLauncherAutoConfigurationTests {
@Test
public void testAutoBuiltDataSourceWithTaskJobLauncherCLR() {
this.contextRunner.
withPropertyValues("spring.cloud.task.batch.failOnJobFailure=true").
withPropertyValues("spring.cloud.task.batch.fail-on-job-failure=true").
run(context -> {
assertThat(context).hasSingleBean(TaskJobLauncherCommandLineRunner.class);
assertThat(context).doesNotHaveBean(JobLauncherCommandLineRunner.class);
@@ -56,7 +56,7 @@ public class TaskJobLauncherAutoConfigurationTests {
@Test
public void testAutoBuiltDataSourceWithTaskJobLauncherCLROrder() {
this.contextRunner.
withPropertyValues("spring.cloud.task.batch.failOnJobFailure=true",
withPropertyValues("spring.cloud.task.batch.fail-on-job-failure=true",
"spring.cloud.task.batch.commandLineRunnerOrder=100").
run(context -> {
assertThat(context.getBean(TaskJobLauncherCommandLineRunner.class)

View File

@@ -65,7 +65,7 @@ public class TaskJobLauncherCommandLineRunnerTests {
@Test
public void testTaskJobLauncherCLRSuccessFail() {
String[] enabledArgs = new String[] { "--spring.cloud.task.batch.failOnJobFailure=true" };
String[] enabledArgs = new String[] { "--spring.cloud.task.batch.fail-on-job-failure=true" };
boolean isExceptionThrown = false;
try {
this.applicationContext = SpringApplication
@@ -85,7 +85,7 @@ public class TaskJobLauncherCommandLineRunnerTests {
@Test
public void testTaskJobLauncherPickOneJob() {
String[] enabledArgs = new String[] {
"--spring.cloud.task.batch.failOnJobFailure=true",
"--spring.cloud.task.batch.fail-on-job-failure=true",
"--spring.cloud.task.batch.jobNames=jobSucceed" };
boolean isExceptionThrown = false;
try {