BATCH-2204: Updated StepParserStepFactoryBean to set the buffered flag correctly when building a fault tolerant step

This commit is contained in:
Michael Minella
2014-04-10 17:17:57 -05:00
parent a49d591d12
commit 0a58fdf84f
2 changed files with 19 additions and 13 deletions

View File

@@ -16,13 +16,6 @@
package org.springframework.batch.core.configuration.xml;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import org.springframework.batch.core.ChunkListener;
import org.springframework.batch.core.ItemProcessListener;
import org.springframework.batch.core.ItemReadListener;
@@ -76,6 +69,13 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.interceptor.DefaultTransactionAttribute;
import org.springframework.util.Assert;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
/**
* This {@link FactoryBean} is used by the batch namespace parser to create {@link Step} objects. Stores all of the
* properties that are configurable on the <step/> (and its inner <tasklet/>). Based on which properties are
@@ -312,6 +312,10 @@ class StepParserStepFactoryBean<I, O> implements FactoryBean, BeanNameAware {
builder.processorNonTransactional();
}
if (readerTransactionalQueue!=null && readerTransactionalQueue==true) {
builder.readerIsTransactionalQueue();
}
for (SkipListener<I, O> listener : skipListeners) {
builder.listener(listener);
}

View File

@@ -16,12 +16,6 @@
package org.springframework.batch.core.configuration.xml;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
import org.springframework.aop.framework.Advised;
import org.springframework.aop.framework.ProxyFactory;
@@ -50,6 +44,13 @@ import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import java.util.HashMap;
import java.util.Map;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
/**
* @author Dan Garrette
* @since 2.0
@@ -248,6 +249,7 @@ public class StepParserStepFactoryBeanTests {
assertEquals(new Integer(10), throttleLimit);
Object tasklet = ReflectionTestUtils.getField(step, "tasklet");
assertTrue(tasklet instanceof ChunkOrientedTasklet<?>);
assertFalse((Boolean) ReflectionTestUtils.getField(tasklet, "buffering"));
Object chunkProvider = ReflectionTestUtils.getField(tasklet, "chunkProvider");
Object repeatOperations = ReflectionTestUtils.getField(chunkProvider, "repeatOperations");
Object completionPolicy = ReflectionTestUtils.getField(repeatOperations, "completionPolicy");