RESOLVED - BATCH-1144: Create top-level element <job-listener/>

This commit is contained in:
dhgarrette
2009-03-13 06:33:50 +00:00
parent 4de7d5ec2d
commit 1204ec62fc
5 changed files with 114 additions and 48 deletions

View File

@@ -74,6 +74,26 @@ public class JobParserTests {
assertTrue(c);
}
@Test
public void testStandaloneListener() throws Exception {
ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext(
"org/springframework/batch/core/configuration/xml/JobParserParentAttributeTests-context.xml");
List<?> jobListeners = getListeners("job3", ctx);
assertEquals(2, jobListeners.size());
boolean a = false;
boolean b = false;
for (Object l : jobListeners) {
if (l instanceof DummyAnnotationJobExecutionListener) {
a = true;
}
else if (l instanceof JobExecutionListenerSupport) {
b = true;
}
}
assertTrue(a);
assertTrue(b);
}
@SuppressWarnings("unchecked")
private List<?> getListeners(String jobName, ApplicationContext ctx) throws Exception {
Map<String, Object> beans = ctx.getBeansOfType(Job.class);