OPEN - issue BATCH-398: That old stateful / stateless thing again....
http://jira.springframework.org/browse/BATCH-398 Fix delegate job (duplicate job regsitry).
This commit is contained in:
@@ -88,9 +88,9 @@ public class MapJobRegistry implements ListableJobRegistry {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.container.common.configuration.ListableJobConfigurationRegistry#getJobConfigurations()
|
||||
*/
|
||||
public Collection getJobConfigurations() {
|
||||
public Collection getJobNames() {
|
||||
synchronized (map) {
|
||||
return Collections.unmodifiableCollection(new HashSet(map.values()));
|
||||
return Collections.unmodifiableCollection(new HashSet(map.keySet()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ public class JobRegistryBeanPostProcessorTests extends TestCase {
|
||||
"test-context.xml", getClass());
|
||||
MapJobRegistry registry = (MapJobRegistry) context
|
||||
.getBean("registry");
|
||||
Collection configurations = registry.getJobConfigurations();
|
||||
Collection configurations = registry.getJobNames();
|
||||
// System.err.println(configurations);
|
||||
String[] names = context.getBeanNamesForType(JobSupport.class);
|
||||
int count = names.length;
|
||||
|
||||
@@ -81,16 +81,16 @@ public class MapJobRegistryTests extends TestCase {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link org.springframework.batch.execution.configuration.MapJobRegistry#getJobConfigurations()}.
|
||||
* Test method for {@link org.springframework.batch.execution.configuration.MapJobRegistry#getJobNames()}.
|
||||
* @throws Exception
|
||||
*/
|
||||
public void testGetJobConfigurations() throws Exception {
|
||||
Job configuration = new JobSupport("foo");
|
||||
registry.register(configuration);
|
||||
registry.register(new JobSupport("bar"));
|
||||
Collection configurations = registry.getJobConfigurations();
|
||||
Collection configurations = registry.getJobNames();
|
||||
assertEquals(2, configurations.size());
|
||||
assertTrue(configurations.contains(configuration));
|
||||
assertTrue(configurations.contains(configuration.getName()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user