BATCH-1181: Changed <chunk-tasklet/> to <chunk/>
This commit is contained in:
@@ -53,7 +53,7 @@ public abstract class AbstractStepParser {
|
||||
|
||||
private static final String TASKLET_ELE = "tasklet";
|
||||
|
||||
private static final String CHUNK_TASKLET_ELE = "chunk-tasklet";
|
||||
private static final String CHUNK_ELE = "chunk";
|
||||
|
||||
private static final String LISTENERS_ELE = "listeners";
|
||||
|
||||
@@ -63,7 +63,7 @@ public abstract class AbstractStepParser {
|
||||
|
||||
private static final String JOB_REPO_ATTR = "job-repository";
|
||||
|
||||
private static final ChunkTaskletParser chunkTaskletParser = new ChunkTaskletParser();
|
||||
private static final ChunkElementParser chunkTaskletParser = new ChunkElementParser();
|
||||
|
||||
private static final StepListenerParser stepListenerParser = new StepListenerParser();
|
||||
|
||||
@@ -109,11 +109,11 @@ public abstract class AbstractStepParser {
|
||||
String taskletRef = taskletElement.getAttribute(TASKLET_REF_ATTR);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Element> chunkTaskletElements = (List<Element>) DomUtils.getChildElementsByTagName(taskletElement,
|
||||
CHUNK_TASKLET_ELE);
|
||||
CHUNK_ELE);
|
||||
if (StringUtils.hasText(taskletRef)) {
|
||||
if (chunkTaskletElements.size() > 0) {
|
||||
parserContext.getReaderContext().error(
|
||||
"The <" + CHUNK_TASKLET_ELE + "/> element can't be combined with the '" + TASKLET_REF_ATTR
|
||||
"The <" + CHUNK_ELE + "/> element can't be combined with the '" + TASKLET_REF_ATTR
|
||||
+ "=\"" + taskletRef + "\"' attribute specification for <"
|
||||
+ taskletElement.getNodeName() + "/>", taskletElement);
|
||||
}
|
||||
@@ -124,12 +124,12 @@ public abstract class AbstractStepParser {
|
||||
}
|
||||
else if (chunkTaskletElements.size() > 1) {
|
||||
parserContext.getReaderContext().error(
|
||||
"The '<" + CHUNK_TASKLET_ELE + "/>' element may not appear more than once in a single <"
|
||||
"The '<" + CHUNK_ELE + "/>' element may not appear more than once in a single <"
|
||||
+ taskletElement.getNodeName() + "/>.", taskletElement);
|
||||
}
|
||||
else if (!stepUnderspecified) {
|
||||
parserContext.getReaderContext().error(
|
||||
"Step [" + taskletElement.getAttribute(ID_ATTR) + "] has neither a <" + CHUNK_TASKLET_ELE
|
||||
"Step [" + taskletElement.getAttribute(ID_ATTR) + "] has neither a <" + CHUNK_ELE
|
||||
+ "/> element nor a '" + TASKLET_REF_ATTR + "' attribute.", taskletElement);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,12 +33,12 @@ import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
|
||||
/**
|
||||
* Internal parser for the <chunk-tasklet/> element either inside a step.
|
||||
* Internal parser for the <chunk/> element inside a step.
|
||||
*
|
||||
* @author Thomas Risberg
|
||||
* @since 2.0
|
||||
*/
|
||||
public class ChunkTaskletParser {
|
||||
public class ChunkElementParser {
|
||||
|
||||
private static final String ID_ATTR = "id";
|
||||
|
||||
@@ -137,7 +137,7 @@ class StepParserStepFactoryBean<I, O> implements FactoryBean, BeanNameAware {
|
||||
public final Object getObject() throws Exception {
|
||||
if (hasChunkTaskletElement) {
|
||||
Assert.isNull(tasklet, "Step [" + name
|
||||
+ "] has both a <chunk-tasklet/> element and a 'ref' attribute referencing a Tasklet.");
|
||||
+ "] has both a <chunk/> element and a 'ref' attribute referencing a Tasklet.");
|
||||
|
||||
if (isFaultTolerant()) {
|
||||
FaultTolerantStepFactoryBean<I, O> fb = new FaultTolerantStepFactoryBean<I, O>();
|
||||
@@ -159,7 +159,7 @@ class StepParserStepFactoryBean<I, O> implements FactoryBean, BeanNameAware {
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException("Step [" + name
|
||||
+ "] has neither a <chunk-tasklet/> element nor a 'ref' attribute referencing a Tasklet.");
|
||||
+ "] has neither a <chunk/> element nor a 'ref' attribute referencing a Tasklet.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@
|
||||
<xsd:documentation>
|
||||
Defines a stage in job processing backed by a
|
||||
Step. The id attribute must be specified. The
|
||||
step requires either a chunk-tasklet definition,
|
||||
step requires either a chunk definition,
|
||||
a tasklet reference, or a reference to a
|
||||
(possibly abstract) parent step.
|
||||
</xsd:documentation>
|
||||
@@ -265,7 +265,7 @@
|
||||
|
||||
<xsd:complexType name="taskletType">
|
||||
<xsd:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xsd:element name="chunk-tasklet" type="chunkTaskletType" />
|
||||
<xsd:element name="chunk" type="chunkTaskletType" />
|
||||
<xsd:element name="transaction-attributes" type="transaction-attributesType" />
|
||||
<xsd:element name="no-rollback-exception-classes">
|
||||
<xsd:annotation>
|
||||
|
||||
@@ -41,15 +41,15 @@ import org.springframework.test.util.ReflectionTestUtils;
|
||||
* @author Dan Garrette
|
||||
* @since 2.0
|
||||
*/
|
||||
public class ChunkTaskletParserTests {
|
||||
public class ChunkElementParserTests {
|
||||
|
||||
private ConfigurableApplicationContext chunkTaskletParentAttributeParserTestsContext = new ClassPathXmlApplicationContext(
|
||||
"org/springframework/batch/core/configuration/xml/ChunkTaskletParentAttributeParserTests-context.xml");
|
||||
private ConfigurableApplicationContext chunkElementParentAttributeParserTestsContext = new ClassPathXmlApplicationContext(
|
||||
"org/springframework/batch/core/configuration/xml/ChunkElementParentAttributeParserTests-context.xml");
|
||||
|
||||
@Test
|
||||
public void testInheritSkippable() throws Exception {
|
||||
Collection<Class<?>> skippable = getExceptionClasses("s1", "skippable",
|
||||
chunkTaskletParentAttributeParserTestsContext);
|
||||
chunkElementParentAttributeParserTestsContext);
|
||||
assertEquals(2, skippable.size());
|
||||
boolean e = false;
|
||||
boolean f = false;
|
||||
@@ -67,7 +67,7 @@ public class ChunkTaskletParserTests {
|
||||
|
||||
@Test
|
||||
public void testInheritFatal() throws Exception {
|
||||
Collection<Class<?>> fatal = getExceptionClasses("s1", "fatal", chunkTaskletParentAttributeParserTestsContext);
|
||||
Collection<Class<?>> fatal = getExceptionClasses("s1", "fatal", chunkElementParentAttributeParserTestsContext);
|
||||
boolean a = false;
|
||||
boolean b = false;
|
||||
for (Class<?> cls : fatal) {
|
||||
@@ -84,7 +84,7 @@ public class ChunkTaskletParserTests {
|
||||
|
||||
@Test
|
||||
public void testInheritStreams() throws Exception {
|
||||
Collection<ItemStream> streams = getStreams("s1", chunkTaskletParentAttributeParserTestsContext);
|
||||
Collection<ItemStream> streams = getStreams("s1", chunkElementParentAttributeParserTestsContext);
|
||||
assertEquals(2, streams.size());
|
||||
boolean c = false;
|
||||
for (ItemStream o : streams) {
|
||||
@@ -98,7 +98,7 @@ public class ChunkTaskletParserTests {
|
||||
@Test
|
||||
public void testInheritRetryListeners() throws Exception {
|
||||
Collection<RetryListener> retryListeners = getRetryListeners("s1",
|
||||
chunkTaskletParentAttributeParserTestsContext);
|
||||
chunkElementParentAttributeParserTestsContext);
|
||||
assertEquals(2, retryListeners.size());
|
||||
boolean g = false;
|
||||
boolean h = false;
|
||||
@@ -117,7 +117,7 @@ public class ChunkTaskletParserTests {
|
||||
@Test
|
||||
public void testInheritSkippable_NoMerge() throws Exception {
|
||||
Collection<Class<?>> skippable = getExceptionClasses("s2", "skippable",
|
||||
chunkTaskletParentAttributeParserTestsContext);
|
||||
chunkElementParentAttributeParserTestsContext);
|
||||
assertEquals(1, skippable.size());
|
||||
boolean e = false;
|
||||
for (Class<?> cls : skippable) {
|
||||
@@ -130,7 +130,7 @@ public class ChunkTaskletParserTests {
|
||||
|
||||
@Test
|
||||
public void testInheritFatal_NoMerge() throws Exception {
|
||||
Collection<Class<?>> fatal = getExceptionClasses("s2", "fatal", chunkTaskletParentAttributeParserTestsContext);
|
||||
Collection<Class<?>> fatal = getExceptionClasses("s2", "fatal", chunkElementParentAttributeParserTestsContext);
|
||||
boolean a = false;
|
||||
boolean b = false;
|
||||
for (Class<?> cls : fatal) {
|
||||
@@ -147,7 +147,7 @@ public class ChunkTaskletParserTests {
|
||||
|
||||
@Test
|
||||
public void testInheritStreams_NoMerge() throws Exception {
|
||||
Collection<ItemStream> streams = getStreams("s2", chunkTaskletParentAttributeParserTestsContext);
|
||||
Collection<ItemStream> streams = getStreams("s2", chunkElementParentAttributeParserTestsContext);
|
||||
assertEquals(1, streams.size());
|
||||
boolean c = false;
|
||||
for (ItemStream o : streams) {
|
||||
@@ -161,7 +161,7 @@ public class ChunkTaskletParserTests {
|
||||
@Test
|
||||
public void testInheritRetryListeners_NoMerge() throws Exception {
|
||||
Collection<RetryListener> retryListeners = getRetryListeners("s2",
|
||||
chunkTaskletParentAttributeParserTestsContext);
|
||||
chunkElementParentAttributeParserTestsContext);
|
||||
assertEquals(1, retryListeners.size());
|
||||
boolean h = false;
|
||||
for (RetryListener o : retryListeners) {
|
||||
@@ -9,7 +9,7 @@
|
||||
<job id="job">
|
||||
<step id="s1" parent="baseStep">
|
||||
<tasklet>
|
||||
<chunk-tasklet reader="reader" writer="writer" commit-interval="5" skip-limit="5">
|
||||
<chunk reader="reader" writer="writer" commit-interval="5" skip-limit="5">
|
||||
<skippable-exception-classes merge="true">
|
||||
java.lang.NullPointerException
|
||||
</skippable-exception-classes>
|
||||
@@ -22,13 +22,13 @@
|
||||
<retry-listeners merge="true">
|
||||
<listener class="org.springframework.batch.core.configuration.xml.DummyRetryListener"/>
|
||||
</retry-listeners>
|
||||
</chunk-tasklet>
|
||||
</chunk>
|
||||
</tasklet>
|
||||
</step>
|
||||
|
||||
<step id="s2" parent="baseStep">
|
||||
<tasklet>
|
||||
<chunk-tasklet reader="reader" writer="writer" commit-interval="5" skip-limit="5">
|
||||
<chunk reader="reader" writer="writer" commit-interval="5" skip-limit="5">
|
||||
<skippable-exception-classes>
|
||||
java.lang.NullPointerException
|
||||
</skippable-exception-classes>
|
||||
@@ -41,14 +41,14 @@
|
||||
<retry-listeners>
|
||||
<listener class="org.springframework.batch.core.configuration.xml.DummyRetryListener"/>
|
||||
</retry-listeners>
|
||||
</chunk-tasklet>
|
||||
</chunk>
|
||||
</tasklet>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
<step id="baseStep" abstract="true">
|
||||
<tasklet>
|
||||
<chunk-tasklet>
|
||||
<chunk>
|
||||
<skippable-exception-classes>
|
||||
java.lang.ArithmeticException
|
||||
</skippable-exception-classes>
|
||||
@@ -61,7 +61,7 @@
|
||||
<retry-listeners>
|
||||
<listener class="org.springframework.batch.retry.listener.RetryListenerSupport"/>
|
||||
</retry-listeners>
|
||||
</chunk-tasklet>
|
||||
</chunk>
|
||||
</tasklet>
|
||||
</step>
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
<job id="job">
|
||||
<step id="step">
|
||||
<tasklet>
|
||||
<chunk-tasklet reader="reader" processor="processor" writer="writer" commit-interval="10" skip-limit="20"
|
||||
retry-limit="3" cache-capacity="100" is-reader-transactional-queue="true"
|
||||
task-executor="taskExecutor">
|
||||
<chunk reader="reader" processor="processor" writer="writer" commit-interval="10" skip-limit="20"
|
||||
retry-limit="3" cache-capacity="100" is-reader-transactional-queue="true"
|
||||
task-executor="taskExecutor">
|
||||
<retry-listeners>
|
||||
<listener class="org.springframework.batch.core.configuration.xml.TestRetryListener" ref="retryListener" />
|
||||
</retry-listeners>
|
||||
@@ -21,7 +21,7 @@
|
||||
<skippable-exception-classes>
|
||||
org.springframework.dao.DataIntegrityViolationException,
|
||||
</skippable-exception-classes>
|
||||
</chunk-tasklet>
|
||||
</chunk>
|
||||
<transaction-attributes propagation="REQUIRED" isolation="DEFAULT" timeout="10" />
|
||||
<no-rollback-exception-classes>
|
||||
org.springframework.dao.DataIntegrityViolationException
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<job id="job">
|
||||
<step id="s1">
|
||||
<tasklet>
|
||||
<chunk-tasklet reader="reader" writer="writer"
|
||||
commit-interval="25" chunk-completion-policy="completionPolicy"/>
|
||||
<chunk reader="reader" writer="writer"
|
||||
commit-interval="25" chunk-completion-policy="completionPolicy"/>
|
||||
</tasklet>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<job id="job">
|
||||
<step id="s1">
|
||||
<tasklet>
|
||||
<chunk-tasklet reader="reader" writer="writer" commit-interval="25"/>
|
||||
<chunk reader="reader" writer="writer" commit-interval="25"/>
|
||||
</tasklet>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<job id="job">
|
||||
<step id="s1">
|
||||
<tasklet>
|
||||
<chunk-tasklet reader="reader" writer="writer" chunk-completion-policy="completionPolicy"/>
|
||||
<chunk reader="reader" writer="writer" chunk-completion-policy="completionPolicy"/>
|
||||
</tasklet>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<job id="job">
|
||||
<step id="s1">
|
||||
<tasklet>
|
||||
<chunk-tasklet reader="reader" writer="writer"/>
|
||||
<chunk reader="reader" writer="writer"/>
|
||||
</tasklet>
|
||||
</step>
|
||||
</job>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<job id="job">
|
||||
<step id="s1" parent="baseStep" next="s2">
|
||||
<tasklet>
|
||||
<chunk-tasklet reader="reader" writer="writer" commit-interval="5" />
|
||||
<chunk reader="reader" writer="writer" commit-interval="5" />
|
||||
<transaction-attributes propagation="REQUIRED" isolation="DEFAULT" />
|
||||
</tasklet>
|
||||
</step>
|
||||
@@ -22,7 +22,7 @@
|
||||
<step id="s4" parent="standalone4" next="s5" />
|
||||
<step id="s5" parent="baseStep" next="s6">
|
||||
<tasklet>
|
||||
<chunk-tasklet reader="reader" writer="writer" commit-interval="5" />
|
||||
<chunk reader="reader" writer="writer" commit-interval="5" />
|
||||
<transaction-attributes propagation="REQUIRED" isolation="DEFAULT" />
|
||||
</tasklet>
|
||||
</step>
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
<step id="standalone2" parent="baseStep">
|
||||
<tasklet>
|
||||
<chunk-tasklet reader="reader" writer="writer" commit-interval="5" />
|
||||
<chunk reader="reader" writer="writer" commit-interval="5" />
|
||||
<transaction-attributes propagation="REQUIRED" isolation="DEFAULT" />
|
||||
</tasklet>
|
||||
</step>
|
||||
@@ -50,7 +50,7 @@
|
||||
|
||||
<step id="standalone6" parent="baseStep">
|
||||
<tasklet>
|
||||
<chunk-tasklet reader="reader" writer="writer" commit-interval="5" />
|
||||
<chunk reader="reader" writer="writer" commit-interval="5" />
|
||||
<transaction-attributes propagation="REQUIRED" isolation="DEFAULT" />
|
||||
</tasklet>
|
||||
</step>
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
<job id="job">
|
||||
<step id="step">
|
||||
<tasklet start-limit="25" allow-start-if-complete="true">
|
||||
<chunk-tasklet reader="reader" processor="processor" writer="writer" commit-interval="10" skip-limit="20"
|
||||
retry-limit="3" cache-capacity="100" is-reader-transactional-queue="true"
|
||||
task-executor="taskExecutor">
|
||||
<chunk reader="reader" processor="processor" writer="writer" commit-interval="10" skip-limit="20"
|
||||
retry-limit="3" cache-capacity="100" is-reader-transactional-queue="true"
|
||||
task-executor="taskExecutor">
|
||||
<retry-listeners>
|
||||
<listener class="org.springframework.batch.core.configuration.xml.TestRetryListener" />
|
||||
</retry-listeners>
|
||||
@@ -22,7 +22,7 @@
|
||||
<skippable-exception-classes>
|
||||
org.springframework.dao.DataIntegrityViolationException
|
||||
</skippable-exception-classes>
|
||||
</chunk-tasklet>
|
||||
</chunk>
|
||||
<transaction-attributes propagation="REQUIRED" isolation="DEFAULT" timeout="10" />
|
||||
<no-rollback-exception-classes>
|
||||
org.springframework.dao.DataIntegrityViolationException
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
<job id="job">
|
||||
<step id="ft-step">
|
||||
<tasklet>
|
||||
<chunk-tasklet reader="reader" processor="processor" writer="writer"
|
||||
commit-interval="10">
|
||||
<chunk reader="reader" processor="processor" writer="writer"
|
||||
commit-interval="10">
|
||||
<streams>
|
||||
<stream ref="reader"/>
|
||||
</streams>
|
||||
</chunk-tasklet>
|
||||
</chunk>
|
||||
<listeners>
|
||||
<listener class="org.springframework.batch.core.configuration.xml.TestListener"
|
||||
after-step-method="destroy"/>
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
<job id="job">
|
||||
<step id="step">
|
||||
<tasklet>
|
||||
<chunk-tasklet reader="reader" processor="processor" writer="writer" commit-interval="10" skip-limit="20"
|
||||
retry-limit="3" cache-capacity="100" is-reader-transactional-queue="true" task-executor="taskExecutor">
|
||||
<chunk reader="reader" processor="processor" writer="writer" commit-interval="10" skip-limit="20"
|
||||
retry-limit="3" cache-capacity="100" is-reader-transactional-queue="true" task-executor="taskExecutor">
|
||||
<retry-listeners>
|
||||
<listener ref="retryListener" />
|
||||
<listener class="org.springframework.batch.core.configuration.xml.TestRetryListener" />
|
||||
@@ -21,7 +21,7 @@
|
||||
<skippable-exception-classes>
|
||||
org.springframework.dao.DataIntegrityViolationException
|
||||
</skippable-exception-classes>
|
||||
</chunk-tasklet>
|
||||
</chunk>
|
||||
<transaction-attributes propagation="REQUIRED" isolation="DEFAULT" timeout="10" />
|
||||
<no-rollback-exception-classes>
|
||||
org.springframework.dao.DataIntegrityViolationException
|
||||
|
||||
Reference in New Issue
Block a user