diff --git a/spring-batch-core/.settings/com.springsource.sts.config.flow.prefs b/spring-batch-core/.settings/com.springsource.sts.config.flow.prefs index 7fd2dae1e..f16242a6c 100644 --- a/spring-batch-core/.settings/com.springsource.sts.config.flow.prefs +++ b/spring-batch-core/.settings/com.springsource.sts.config.flow.prefs @@ -1,9 +1,10 @@ -#Wed May 04 11:15:42 BST 2011 +#Wed May 04 11:51:55 BST 2011 +//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementLateBindingParserTests-context.xml=\n\n\n\n\n\n //com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/JobExecutionListenerMethodAttributeParserTests-context.xml=\n\n\n\n\n\n //com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/JobRepositoryDefaultParserTests-context.xml=\n -//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentRetryableLateBindingStepFactoryBeanParserTests-context.xml=\n\n\n\n\n\n\n\n\n\n +//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentRetryableLateBindingStepFactoryBeanParserTests-context.xml=\n\n\n\n\n\n\n\n\n\n //com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentRetryableStepFactoryBeanParserTests-context.xml=\n\n\n\n\n\n\n\n\n\n -//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentSkippableLateBindingStepFactoryBeanParserTests-context.xml=\n\n\n\n\n\n\n\n\n\n +//com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentSkippableLateBindingStepFactoryBeanParserTests-context.xml=\n\n\n\n\n\n\n\n\n\n //com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentSkippableStepFactoryBeanParserTests-context.xml=\n\n\n\n\n\n\n\n\n\n //com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/PartitionStepParserTests-context.xml=\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n //com.springsource.sts.config.flow.coordinates\:http\://www.springframework.org/schema/batch\:/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/StepListenerInStepParserTests-context.xml=\n\n\n\n\n\n diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/ChunkElementParser.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/ChunkElementParser.java index bc6b43a1c..547c05df0 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/ChunkElementParser.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/xml/ChunkElementParser.java @@ -19,9 +19,7 @@ import java.util.List; import org.springframework.batch.core.listener.StepListenerMetaData; import org.springframework.batch.core.step.item.ForceRollbackForWriteSkipException; -import org.springframework.batch.core.step.skip.LimitCheckingItemSkipPolicy; import org.springframework.batch.repeat.policy.SimpleCompletionPolicy; -import org.springframework.batch.retry.policy.SimpleRetryPolicy; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanDefinitionHolder; @@ -122,70 +120,32 @@ public class ChunkElementParser { String skipLimit = element.getAttribute("skip-limit"); ManagedMap skippableExceptions = handleExceptionElement(element, parserContext, "skippable-exception-classes"); - boolean hasSkipPolicy = false; if (StringUtils.hasText(skipLimit)) { - if (skipLimit.startsWith("#")) { - if (skippableExceptions == null) { - parserContext.getReaderContext().error( - "The element must have skippable-exceptions if a skip-limit is specified.", element); - } - // It's a late binding expression, so we need step scope... - BeanDefinitionBuilder skipPolicy = BeanDefinitionBuilder - .genericBeanDefinition(LimitCheckingItemSkipPolicy.class); - skipPolicy.setScope("step"); - skipPolicy.addPropertyValue("skippableExceptionMap", skippableExceptions); - skipPolicy.addPropertyValue("skipLimit", skipLimit); - propertyValues.addPropertyValue("skipPolicy", skipPolicy.getBeanDefinition()); - hasSkipPolicy = true; - } - else { - if (skippableExceptions == null) { - skippableExceptions = new ManagedMap(); - skippableExceptions.setMergeEnabled(true); - } - propertyValues.addPropertyValue("skipLimit", skipLimit); + if (skippableExceptions == null) { + skippableExceptions = new ManagedMap(); + skippableExceptions.setMergeEnabled(true); } + propertyValues.addPropertyValue("skipLimit", skipLimit); } - if (!hasSkipPolicy) { - // Even if there is no retryLimit, we can still accept exception - // classes for an abstract parent bean definition - propertyValues.addPropertyValue("skippableExceptionClasses", skippableExceptions); - } + // Even if there is no retryLimit, we can still accept exception + // classes for an abstract parent bean definition + propertyValues.addPropertyValue("skippableExceptionClasses", skippableExceptions); handleItemHandler("skip-policy", "skipPolicy", null, false, element, parserContext, propertyValues, underspecified); String retryLimit = element.getAttribute("retry-limit"); ManagedMap retryableExceptions = handleExceptionElement(element, parserContext, "retryable-exception-classes"); - boolean hasRetryPolicy = false; if (StringUtils.hasText(retryLimit)) { - if (retryLimit.startsWith("#")) { - if (retryableExceptions == null) { - parserContext.getReaderContext().error( - "The element must have retryable-exceptions if a retry-limit is specified.", element); - } - // It's a late binding expression, so we need step scope... - BeanDefinitionBuilder retryPolicy = BeanDefinitionBuilder - .genericBeanDefinition(SimpleRetryPolicy.class); - retryPolicy.setScope("step"); - retryPolicy.addPropertyValue("maxAttempts", retryLimit); - retryPolicy.addPropertyValue("retryableExceptions", retryableExceptions); - propertyValues.addPropertyValue("retryPolicy", retryPolicy.getBeanDefinition()); - hasRetryPolicy = true; - } - else { - if (retryableExceptions == null) { - retryableExceptions = new ManagedMap(); - retryableExceptions.setMergeEnabled(true); - } - propertyValues.addPropertyValue("retryLimit", retryLimit); + if (retryableExceptions == null) { + retryableExceptions = new ManagedMap(); + retryableExceptions.setMergeEnabled(true); } + propertyValues.addPropertyValue("retryLimit", retryLimit); } - if (!hasRetryPolicy) { - // Even if there is no retryLimit, we can still accept exception - // classes for an abstract parent bean definition - propertyValues.addPropertyValue("retryableExceptionClasses", retryableExceptions); - } + // Even if there is no retryLimit, we can still accept exception + // classes for an abstract parent bean definition + propertyValues.addPropertyValue("retryableExceptionClasses", retryableExceptions); handleItemHandler("retry-policy", "retryPolicy", null, false, element, parserContext, propertyValues, underspecified); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ParentStepFactoryBeanParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ParentStepFactoryBeanParserTests.java index c0d1cc961..648628a7b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ParentStepFactoryBeanParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ParentStepFactoryBeanParserTests.java @@ -18,7 +18,6 @@ package org.springframework.batch.core.configuration.xml; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import org.junit.Ignore; import org.junit.Test; import org.springframework.batch.core.Step; import org.springframework.batch.core.step.item.FaultTolerantChunkProcessor; @@ -40,7 +39,7 @@ public class ParentStepFactoryBeanParserTests { assertNotNull("Step not parsed", step); Object tasklet = ReflectionTestUtils.getField(step, "tasklet"); Object chunkProcessor = ReflectionTestUtils.getField(tasklet, "chunkProcessor"); - assertTrue("Wrong processor type", chunkProcessor instanceof FaultTolerantChunkProcessor); + assertTrue("Wrong processor type", chunkProcessor instanceof FaultTolerantChunkProcessor); } @Test @@ -51,7 +50,7 @@ public class ParentStepFactoryBeanParserTests { assertNotNull("Step not parsed", step); Object tasklet = ReflectionTestUtils.getField(step, "tasklet"); Object chunkProcessor = ReflectionTestUtils.getField(tasklet, "chunkProcessor"); - assertTrue("Wrong processor type", chunkProcessor instanceof FaultTolerantChunkProcessor); + assertTrue("Wrong processor type", chunkProcessor instanceof FaultTolerantChunkProcessor); } @Test @@ -62,11 +61,11 @@ public class ParentStepFactoryBeanParserTests { assertNotNull("Step not parsed", step); Object tasklet = ReflectionTestUtils.getField(step, "tasklet"); Object chunkProcessor = ReflectionTestUtils.getField(tasklet, "chunkProcessor"); - assertTrue("Wrong processor type", chunkProcessor instanceof FaultTolerantChunkProcessor); + assertTrue("Wrong processor type", chunkProcessor instanceof FaultTolerantChunkProcessor); } + // BATCH-1396 @Test - @Ignore // Fix this BATCH-1739 public void testRetryableLateBindingAttributes() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ParentRetryableLateBindingStepFactoryBeanParserTests-context.xml"); @@ -74,11 +73,11 @@ public class ParentStepFactoryBeanParserTests { assertNotNull("Step not parsed", step); Object tasklet = ReflectionTestUtils.getField(step, "tasklet"); Object chunkProcessor = ReflectionTestUtils.getField(tasklet, "chunkProcessor"); - assertTrue("Wrong processor type", chunkProcessor instanceof FaultTolerantChunkProcessor); + assertTrue("Wrong processor type", chunkProcessor instanceof FaultTolerantChunkProcessor); } + // BATCH-1396 @Test - @Ignore // Fix this BATCH-1739 public void testSkippableLateBindingAttributes() throws Exception { ConfigurableApplicationContext context = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/ParentSkippableLateBindingStepFactoryBeanParserTests-context.xml"); @@ -86,7 +85,7 @@ public class ParentStepFactoryBeanParserTests { assertNotNull("Step not parsed", step); Object tasklet = ReflectionTestUtils.getField(step, "tasklet"); Object chunkProcessor = ReflectionTestUtils.getField(tasklet, "chunkProcessor"); - assertTrue("Wrong processor type", chunkProcessor instanceof FaultTolerantChunkProcessor); + assertTrue("Wrong processor type", chunkProcessor instanceof FaultTolerantChunkProcessor); } } diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementLateBindingParserTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementLateBindingParserTests-context.xml index a5facdb82..207bec09d 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementLateBindingParserTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ChunkElementLateBindingParserTests-context.xml @@ -14,14 +14,19 @@ - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentRetryableLateBindingStepFactoryBeanParserTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentRetryableLateBindingStepFactoryBeanParserTests-context.xml index dedc7f117..db949c000 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentRetryableLateBindingStepFactoryBeanParserTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentRetryableLateBindingStepFactoryBeanParserTests-context.xml @@ -8,11 +8,7 @@ - - - - - + @@ -20,9 +16,19 @@ + retry-policy="retryPolicy"/> + + + + + + + + + \ No newline at end of file diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentSkippableLateBindingStepFactoryBeanParserTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentSkippableLateBindingStepFactoryBeanParserTests-context.xml index 90e264ff1..8c079ed2d 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentSkippableLateBindingStepFactoryBeanParserTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/xml/ParentSkippableLateBindingStepFactoryBeanParserTests-context.xml @@ -20,9 +20,19 @@ + skip-policy="skipPolicy"/> + + + + + + + + + \ No newline at end of file