Fix tests some more
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
<config>src/test/resources/org/springframework/batch/core/launch/support/test-environment.xml</config>
|
||||
<config>src/test/resources/org/springframework/batch/core/launch/support/2jobs.xml</config>
|
||||
<config>src/test/resources/org/springframework/batch/core/repository/dao/data-source-context.xml</config>
|
||||
<config>src/test/resources/org/springframework/batch/core/launch/support/job-with-environment.xml</config>
|
||||
<config>src/test/resources/org/springframework/batch/core/launch/support/job2.xml</config>
|
||||
<config>src/test/resources/org/springframework/batch/core/repository/dao/sql-dao-test.xml</config>
|
||||
<config>src/test/resources/org/springframework/batch/core/launch/support/test-environment-with-registry.xml</config>
|
||||
|
||||
@@ -20,6 +20,8 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import javax.print.attribute.standard.JobName;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.core.Job;
|
||||
@@ -79,6 +81,10 @@ public class ClassPathXmlJobRegistry implements ListableJobRegistry, Application
|
||||
jobRegistry.register(jobFactory);
|
||||
}
|
||||
}
|
||||
|
||||
if (jobRegistry.getJobNames().isEmpty()) {
|
||||
throw new NoSuchJobException("Could not locate any jobs in resources provided.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public class ClassPathXmlJobRegistryContextTests {
|
||||
public void testLocateJob() throws Exception{
|
||||
|
||||
Collection<String> names = registry.getJobNames();
|
||||
assertEquals(1, names.size());
|
||||
assertEquals(2, names.size());
|
||||
assertTrue(names.contains("test-job"));
|
||||
|
||||
Job job = registry.getJob("test-job");
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.Collection;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.configuration.DuplicateJobException;
|
||||
import org.springframework.batch.core.launch.NoSuchJobException;
|
||||
import org.springframework.context.support.GenericApplicationContext;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
@@ -59,7 +58,7 @@ public class ClassPathXmlJobRegistryTests {
|
||||
registry.afterPropertiesSet();
|
||||
}
|
||||
|
||||
@Test(expected = DuplicateJobException.class)
|
||||
@Test
|
||||
public void testDuplicateJobsInFile() throws Exception {
|
||||
|
||||
Resource[] jobPaths = new Resource[] { new ClassPathResource(
|
||||
@@ -69,5 +68,6 @@ public class ClassPathXmlJobRegistryTests {
|
||||
applicationContext.refresh();
|
||||
registry.setApplicationContext(applicationContext);
|
||||
registry.afterPropertiesSet();
|
||||
assertEquals(2, registry.getJobNames().size());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ import org.springframework.util.ClassUtils;
|
||||
public class CommandLineJobRunnerTests {
|
||||
|
||||
private String jobPath = ClassUtils.addResourcePathToPackagePath(CommandLineJobRunnerTests.class,
|
||||
"job-with-environment.xml");
|
||||
"launcher-with-environment.xml");
|
||||
|
||||
private String jobName = "test-job";
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<bean class="org.springframework.batch.core.configuration.support.ClassPathXmlJobRegistry">
|
||||
<property name="jobPaths" value="classpath*:org/springframework/batch/core/launch/support/job-*.xml"/>
|
||||
<property name="jobPaths" value="classpath*:org/springframework/batch/core/launch/support/job*.xml"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
||||
Reference in New Issue
Block a user