BATCH-1739: add test (passes now showing workaround)

This commit is contained in:
Dave Syer
2011-05-03 08:09:25 +01:00
parent 30d1e9fe38
commit a61a9842ae
2 changed files with 37 additions and 0 deletions

View File

@@ -42,4 +42,15 @@ public class ParentStepFactoryBeanParserTests {
assertTrue("Wrong processor type", chunkProcessor instanceof FaultTolerantChunkProcessor<?,?>);
}
@Test
public void testSkippableAttributes() throws Exception {
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext(
"org/springframework/batch/core/configuration/xml/ParentSkippableStepFactoryBeanParserTests-context.xml");
Object step = context.getBean("s1", Step.class);
assertNotNull("Step not parsed", step);
Object tasklet = ReflectionTestUtils.getField(step, "tasklet");
Object chunkProcessor = ReflectionTestUtils.getField(tasklet, "chunkProcessor");
assertTrue("Wrong processor type", chunkProcessor instanceof FaultTolerantChunkProcessor<?,?>);
}
}

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<import resource="common-context.xml" />
<bean id="stepParent" class="org.springframework.batch.core.step.item.FaultTolerantStepFactoryBean" abstract="true">
<property name="skippableExceptionClasses">
<map merge="true">
<entry key="java.lang.Exception" value="true" />
</map>
</property>
</bean>
<job id="job" xmlns="http://www.springframework.org/schema/batch">
<step id="s1" parent="stepParent">
<tasklet>
<chunk reader="reader" writer="writer" processor="processor" commit-interval="5" skip-limit="1">
<skippable-exception-classes merge="true"/>
</chunk>
</tasklet>
</step>
</job>
</beans>