RESOLVED - issue BATCH-1338: Allow segregation of jobs by type or origin

Add extra test for JobRegistryBackground*
This commit is contained in:
dsyer
2009-09-09 11:46:46 +00:00
parent def829f87a
commit f3cec725f0
3 changed files with 29 additions and 5 deletions

View File

@@ -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

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
<import resource="test-environment-with-registry.xml" />
<bean class="org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor">
<property name="jobRegistry" ref="jobRegistry"/>
</bean>
</beans>

View File

@@ -9,6 +9,6 @@
<import resource="test-environment.xml" />
<bean class="org.springframework.batch.core.configuration.support.MapJobRegistry" />
<bean id="jobRegistry" class="org.springframework.batch.core.configuration.support.MapJobRegistry" />
</beans>