From f3cec725f0fdf88959e7ebaa5b0cadabac9122ee Mon Sep 17 00:00:00 2001 From: dsyer Date: Wed, 9 Sep 2009 11:46:46 +0000 Subject: [PATCH] RESOLVED - issue BATCH-1338: Allow segregation of jobs by type or origin Add extra test for JobRegistryBackground* --- .../JobRegistryBackgroundJobRunnerTests.java | 16 ++++++++++++---- ...vironment-with-registry-and-auto-register.xml | 16 ++++++++++++++++ .../support/test-environment-with-registry.xml | 2 +- 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry-and-auto-register.xml diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunnerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunnerTests.java index 66eb4ba52..f2d817698 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunnerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/JobRegistryBackgroundJobRunnerTests.java @@ -33,7 +33,18 @@ public class JobRegistryBackgroundJobRunnerTests { * {@link org.springframework.batch.core.launch.support.JobRegistryBackgroundJobRunner#main(java.lang.String[])}. */ @Test - public void testMain() { + public void testMain() throws Exception { + JobRegistryBackgroundJobRunner.main( + ClassUtils.addResourcePathToPackagePath(getClass(), "test-environment-with-registry.xml"), ClassUtils + .addResourcePathToPackagePath(getClass(), "job.xml")); + assertEquals(0, JobRegistryBackgroundJobRunner.getErrors().size()); + } + + @Test + public void testMainWithAutoRegister() throws Exception { + JobRegistryBackgroundJobRunner.main( + ClassUtils.addResourcePathToPackagePath(getClass(), "test-environment-with-registry-and-auto-register.xml"), ClassUtils + .addResourcePathToPackagePath(getClass(), "job.xml")); assertEquals(0, JobRegistryBackgroundJobRunner.getErrors().size()); } @@ -41,9 +52,6 @@ public class JobRegistryBackgroundJobRunnerTests { public void setUp() throws Exception { JobRegistryBackgroundJobRunner.getErrors().clear(); System.setProperty(JobRegistryBackgroundJobRunner.EMBEDDED, ""); - JobRegistryBackgroundJobRunner.main( - ClassUtils.addResourcePathToPackagePath(getClass(), "test-environment-with-registry.xml"), ClassUtils - .addResourcePathToPackagePath(getClass(), "job.xml")); } @After diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry-and-auto-register.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry-and-auto-register.xml new file mode 100644 index 000000000..683d4809b --- /dev/null +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry-and-auto-register.xml @@ -0,0 +1,16 @@ + + + + + + + + + + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry.xml index b26bab52a..3243eb0ec 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry.xml @@ -9,6 +9,6 @@ - +