BATCH-1181: <step/> element always assumes the step is a TaskletStep

This commit is contained in:
dhgarrette
2009-03-26 04:42:19 +00:00
parent 69a6bf0751
commit 93b2754b7c
48 changed files with 654 additions and 505 deletions

View File

@@ -41,15 +41,15 @@ import org.springframework.test.util.ReflectionTestUtils;
* @author Dan Garrette
* @since 2.0
*/
public class TaskletElementParserTests {
public class ChunkTaskletParserTests {
private ConfigurableApplicationContext taskletElementParentAttributeParserTestsContext = new ClassPathXmlApplicationContext(
"org/springframework/batch/core/configuration/xml/TaskletElementParentAttributeParserTests-context.xml");
private ConfigurableApplicationContext chunkTaskletParentAttributeParserTestsContext = new ClassPathXmlApplicationContext(
"org/springframework/batch/core/configuration/xml/ChunkTaskletParentAttributeParserTests-context.xml");
@Test
public void testInheritSkippable() throws Exception {
Collection<Class<?>> skippable = getExceptionClasses("s1", "skippable",
taskletElementParentAttributeParserTestsContext);
chunkTaskletParentAttributeParserTestsContext);
assertEquals(2, skippable.size());
boolean e = false;
boolean f = false;
@@ -67,7 +67,7 @@ public class TaskletElementParserTests {
@Test
public void testInheritFatal() throws Exception {
Collection<Class<?>> fatal = getExceptionClasses("s1", "fatal", taskletElementParentAttributeParserTestsContext);
Collection<Class<?>> fatal = getExceptionClasses("s1", "fatal", chunkTaskletParentAttributeParserTestsContext);
boolean a = false;
boolean b = false;
for (Class<?> cls : fatal) {
@@ -84,7 +84,7 @@ public class TaskletElementParserTests {
@Test
public void testInheritStreams() throws Exception {
Collection<ItemStream> streams = getStreams("s1", taskletElementParentAttributeParserTestsContext);
Collection<ItemStream> streams = getStreams("s1", chunkTaskletParentAttributeParserTestsContext);
assertEquals(2, streams.size());
boolean c = false;
for (ItemStream o : streams) {
@@ -98,7 +98,7 @@ public class TaskletElementParserTests {
@Test
public void testInheritRetryListeners() throws Exception {
Collection<RetryListener> retryListeners = getRetryListeners("s1",
taskletElementParentAttributeParserTestsContext);
chunkTaskletParentAttributeParserTestsContext);
assertEquals(2, retryListeners.size());
boolean g = false;
boolean h = false;
@@ -117,7 +117,7 @@ public class TaskletElementParserTests {
@Test
public void testInheritSkippable_NoMerge() throws Exception {
Collection<Class<?>> skippable = getExceptionClasses("s2", "skippable",
taskletElementParentAttributeParserTestsContext);
chunkTaskletParentAttributeParserTestsContext);
assertEquals(1, skippable.size());
boolean e = false;
for (Class<?> cls : skippable) {
@@ -130,7 +130,7 @@ public class TaskletElementParserTests {
@Test
public void testInheritFatal_NoMerge() throws Exception {
Collection<Class<?>> fatal = getExceptionClasses("s2", "fatal", taskletElementParentAttributeParserTestsContext);
Collection<Class<?>> fatal = getExceptionClasses("s2", "fatal", chunkTaskletParentAttributeParserTestsContext);
boolean a = false;
boolean b = false;
for (Class<?> cls : fatal) {
@@ -147,7 +147,7 @@ public class TaskletElementParserTests {
@Test
public void testInheritStreams_NoMerge() throws Exception {
Collection<ItemStream> streams = getStreams("s2", taskletElementParentAttributeParserTestsContext);
Collection<ItemStream> streams = getStreams("s2", chunkTaskletParentAttributeParserTestsContext);
assertEquals(1, streams.size());
boolean c = false;
for (ItemStream o : streams) {
@@ -161,7 +161,7 @@ public class TaskletElementParserTests {
@Test
public void testInheritRetryListeners_NoMerge() throws Exception {
Collection<RetryListener> retryListeners = getRetryListeners("s2",
taskletElementParentAttributeParserTestsContext);
chunkTaskletParentAttributeParserTestsContext);
assertEquals(1, retryListeners.size());
boolean h = false;
for (RetryListener o : retryListeners) {

View File

@@ -146,7 +146,7 @@ public class StepParserStepFactoryBeanTests {
@Test
public void testSimpleStep() throws Exception {
StepParserStepFactoryBean<Object, Object> fb = new StepParserStepFactoryBean<Object, Object>();
fb.setHasTaskletElement(true);
fb.setHasChunkTaskletElement(true);
fb.setBeanName("step1");
fb.setAllowStartIfComplete(true);
fb.setJobRepository(new JobRepositorySupport());
@@ -162,7 +162,7 @@ public class StepParserStepFactoryBeanTests {
fb.setItemProcessor(new PassThroughItemProcessor<Object>());
fb.setItemWriter(new DummyItemWriter());
fb.setStreams(new ItemStream[] { new FlatFileItemReader<Object>() });
Object step = fb.getObject();
assertTrue(step instanceof TaskletStep);
Object tasklet = ReflectionTestUtils.getField(step, "tasklet");
@@ -172,7 +172,7 @@ public class StepParserStepFactoryBeanTests {
@Test
public void testFaultTolerantStep() throws Exception {
StepParserStepFactoryBean<Object, Object> fb = new StepParserStepFactoryBean<Object, Object>();
fb.setHasTaskletElement(true);
fb.setHasChunkTaskletElement(true);
fb.setBeanName("step1");
fb.setAllowStartIfComplete(true);
fb.setJobRepository(new JobRepositorySupport());