diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/tasklet/ItemOrientedTasklet.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/tasklet/ItemOrientedTasklet.java
index 6e989c61d..ecf50d302 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/tasklet/ItemOrientedTasklet.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/tasklet/ItemOrientedTasklet.java
@@ -18,7 +18,6 @@ package org.springframework.batch.execution.tasklet;
import org.springframework.batch.core.tasklet.Tasklet;
import org.springframework.batch.io.Skippable;
-import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemRecoverer;
import org.springframework.batch.item.ItemWriter;
@@ -34,16 +33,16 @@ import org.springframework.util.Assert;
* A concrete implementation of the {@link Tasklet} interface that provides
* 'split processing'. This type of processing is characterized by separating
* the reading and processing of batch data into two separate classes:
- * {@link ItemReader} and {@link ItemProcessor}. The {@link ItemReader} class
+ * {@link ItemReader} and {@link ItemWriter}. The {@link ItemReader} class
* provides a solid means for re-usability and enforces good architecture
* practices. Because an object must be returned by the
* {@link ItemReader} to continue processing, (returning null indicates
* processing should end) a developer is forced to read in all relevant data,
* place it into a domain object, and return that object. The
- * {@link ItemProcessor} will then use this object for calculations and output.
+ * {@link ItemWriter} will then use this object for calculations and output.
*
* If a {@link RetryPolicy} is provided it will be used to construct a stateful
- * retry around the {@link ItemProcessor}, delegating identity concerns to the
+ * retry around the {@link ItemWriter}, delegating identity concerns to the
* {@link ItemReader} and recovery concerns to the {@link ItemRecoverer} (if
* present). In this case clients of this class do not need to take any
* additional action at runtime to take advantage of the retry and recovery,
@@ -60,7 +59,7 @@ import org.springframework.util.Assert;
* transactional recover method.
*
* @see ItemReader
- * @see ItemProcessor
+ * @see ItemWriter
* @see RetryPolicy
* @see Recoverable
*
@@ -120,7 +119,7 @@ public class ItemOrientedTasklet implements Tasklet, Skippable, InitializingBean
/**
* Read from the {@link ItemReader} and process (if not null) with the
- * {@link ItemProcessor}. The call to {@link ItemProcessor} is wrapped in a
+ * {@link ItemWriter}. The call to {@link ItemWriter} is wrapped in a
* stateful retry, if a {@link RetryPolicy} is provided. The
* {@link ItemRecoverer} is used (if provided) in the case of an exception
* to apply alternate processing to the item. If the stateful retry is in
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/tasklet/RestartableItemOrientedTasklet.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/tasklet/RestartableItemOrientedTasklet.java
index dcfed738c..7b2244d7e 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/tasklet/RestartableItemOrientedTasklet.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/tasklet/RestartableItemOrientedTasklet.java
@@ -18,8 +18,8 @@ package org.springframework.batch.execution.tasklet;
import java.util.Properties;
-import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.ItemReader;
+import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.restart.GenericRestartData;
import org.springframework.batch.restart.RestartData;
import org.springframework.batch.restart.Restartable;
@@ -30,7 +30,7 @@ import org.springframework.batch.support.PropertiesConverter;
* {@link Restartable} to the provider and processor.
*
* @see ItemReader
- * @see ItemProcessor
+ * @see ItemWriter
* @see Restartable
*
* @author Lucas Ward
diff --git a/spring-batch-infrastructure/.springBeans b/spring-batch-infrastructure/.springBeans
index 8b7328766..588810304 100644
--- a/spring-batch-infrastructure/.springBeans
+++ b/spring-batch-infrastructure/.springBeans
@@ -7,8 +7,6 @@
src/test/resources/org/springframework/batch/io/sql/data-source-context.xml
- src/test/resources/org/springframework/batch/item/processor/delegating-item-processor.xml
- src/test/resources/org/springframework/batch/item/processor/pe-delegating-item-processor.xml
src/test/resources/org/springframework/batch/retry/aop/retry-transaction-test.xml
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java
index 443b4ec19..137384479 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FlatFileItemWriter.java
@@ -30,10 +30,10 @@ import java.util.Properties;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.io.exception.BatchEnvironmentException;
-import org.springframework.batch.io.file.transform.Converter;
import org.springframework.batch.io.support.AbstractTransactionalIoSource;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.ResourceLifecycle;
+import org.springframework.batch.item.writer.ItemTransformer;
import org.springframework.batch.restart.GenericRestartData;
import org.springframework.batch.restart.RestartData;
import org.springframework.batch.restart.Restartable;
@@ -64,16 +64,6 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements
ItemWriter, ResourceLifecycle, Restartable, StatisticsProvider, InitializingBean,
DisposableBean {
- /**
- * @author dsyer
- *
- */
- public static class BooleanHolder {
-
- public boolean value;
-
- }
-
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
public static final String WRITTEN_STATISTICS_NAME = "written";
@@ -90,12 +80,20 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements
private OutputState state = new OutputState();
- private Converter converter = new Converter() {
- public Object convert(Object input) {
+ private ItemTransformer transformer = new ItemTransformer() {
+ public Object transform(Object input) {
return "" + input;
}
};
+ private static class BooleanHolder {
+ public boolean value;
+ }
+
+ /**
+ * Assert that mandatory properties (resource) are set.
+ * @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
+ */
public void afterPropertiesSet() throws Exception {
Assert.notNull(resource);
File file = resource.getFile();
@@ -106,10 +104,10 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements
* Public setter for the converter. If not-null this will be used to convert
* the input data before it is output.
*
- * @param converter the converter to set
+ * @param transformer the converter to set
*/
- public void setConverter(Converter converter) {
- this.converter = converter;
+ public void setTransformer(ItemTransformer transformer) {
+ this.transformer = transformer;
}
/**
@@ -152,17 +150,19 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements
*
* @param data Object (a String or Object that can be converted) to be
* written to output stream
+ * @throws Exception if the transformer or file output fail
*/
- public void write(Object data) {
- convertAndWrite(data, new BooleanHolder());
+ public void write(Object data) throws Exception {
+ transformAndWrite(data, new BooleanHolder());
}
/**
* Convert the date to a format that can be output and then write it out.
* @param data
* @param converted
+ * @throws Exception
*/
- private void convertAndWrite(Object data, BooleanHolder converted) {
+ private void transformAndWrite(Object data, BooleanHolder converted) throws Exception {
if (data instanceof Collection) {
converted.value = false;
@@ -190,7 +190,7 @@ public class FlatFileItemWriter extends AbstractTransactionalIoSource implements
else if (!converted.value) {
// (recursive)
converted.value = true;
- convertAndWrite(converter.convert(data), converted);
+ transformAndWrite(transformer.transform(data), converted);
return;
}
else {
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/Converter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/Converter.java
index 71c7eea03..94d06dac6 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/Converter.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/Converter.java
@@ -19,6 +19,8 @@ package org.springframework.batch.io.file.transform;
* Generic converter interface for transforming an object into another form for
* output or after input.
*
+ * TODO: replace with ItemTransformer
+ *
* @author Dave Syer
*
*/
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemProcessor.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemProcessor.java
deleted file mode 100644
index 2f50da9d5..000000000
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemProcessor.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2006-2007 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.batch.item;
-
-/**
- * @author Dave Syer
- *
- */
-public interface ItemProcessor {
-
- /**
- * Process the supplied data element. Will be called multiple times during a
- * larger batch operation. Will not be called with null data in normal
- * operation.
- *
- * @throws Exception if there are errors. If the processor is used inside a
- * retry or a batch the framework will catch the exception and convert or
- * rethrow it as appropriate.
- */
- void process(Object data) throws Exception;
-
-}
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemWriter.java
index 6c41cab9f..8e84e047c 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemWriter.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/ItemWriter.java
@@ -18,20 +18,22 @@ package org.springframework.batch.item;
/**
* Basic interface for generic output operations. Class implementing this
- * interface will be responsible for serializing objects. Generally, it is
- * responsibility of implementing class to decide which technology to use for
- * mapping and how it should be configured.
+ * interface will be responsible for serializing objects ias necessary.
+ * Generally, it is responsibility of implementing class to decide which
+ * technology to use for mapping and how it should be configured.
*
* @author Dave Syer
*/
public interface ItemWriter {
/**
- * Writes provided object to an output stream or similar.
+ * Process the supplied data element. Will be called multiple times during a
+ * larger batch operation. Will not be called with null data in normal
+ * operation.
*
- * @param item
- * the object to write.
- * @throws Exception if something goes wrong
+ * @throws Exception if there are errors. If the processor is used inside a
+ * retry or a batch the framework will catch the exception and convert or
+ * rethrow it as appropriate.
*/
public void write(Object item) throws Exception;
}
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/CompositeItemTransformer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/CompositeItemTransformer.java
similarity index 96%
rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/CompositeItemTransformer.java
rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/CompositeItemTransformer.java
index 63542a0d1..b68116404 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/CompositeItemTransformer.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/CompositeItemTransformer.java
@@ -1,4 +1,4 @@
-package org.springframework.batch.item.processor;
+package org.springframework.batch.item.writer;
import java.util.Iterator;
import java.util.List;
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/CompositeItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/CompositeItemWriter.java
similarity index 89%
rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/CompositeItemWriter.java
rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/CompositeItemWriter.java
index af33e3a86..92acfad93 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/CompositeItemWriter.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/CompositeItemWriter.java
@@ -1,4 +1,4 @@
-package org.springframework.batch.item.processor;
+package org.springframework.batch.item.writer;
import java.util.ArrayList;
import java.util.Iterator;
@@ -6,7 +6,6 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
-import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.restart.GenericRestartData;
@@ -100,14 +99,13 @@ public class CompositeItemWriter implements ItemWriter, Restartable {
/**
* @param extractor used to extract Properties from {@link ItemReader}s
* @return compound Properties containing all the Properties from injected
- * {@link ItemProcessor}s with property keys prefixed by list index.
+ * {@link ItemWriter}s with property keys prefixed by list index.
*/
private Properties createCompoundProperties(PropertiesExtractor extractor) {
Properties stats = new Properties();
int index = 0;
for (Iterator iterator = delegates.listIterator(); iterator.hasNext();) {
- ItemProcessor processor = (ItemProcessor) iterator.next();
- Properties processorStats = extractor.extractProperties(processor);
+ Properties processorStats = extractor.extractProperties(iterator.next());
if (processorStats != null) {
for (Iterator iterator2 = processorStats.entrySet().iterator(); iterator2.hasNext();) {
Map.Entry entry = (Map.Entry) iterator2.next();
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/DelegatingItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/DelegatingItemWriter.java
similarity index 90%
rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/DelegatingItemWriter.java
rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/DelegatingItemWriter.java
index 827d9e7a0..22832ccc8 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/DelegatingItemWriter.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/DelegatingItemWriter.java
@@ -1,4 +1,4 @@
-package org.springframework.batch.item.processor;
+package org.springframework.batch.item.writer;
import java.util.Properties;
@@ -26,7 +26,7 @@ public class DelegatingItemWriter implements ItemWriter, Restartable, Skippable,
* delegate {@link ItemWriter}.
* @throws Exception
*
- * @see org.springframework.batch.item.ItemProcessor#process(java.lang.Object)
+ * @see ItemWriter#process(java.lang.Object)
*/
final public void write(Object item) throws Exception {
Object result = doProcess(item);
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/ItemTransformer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/ItemTransformer.java
similarity index 79%
rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/ItemTransformer.java
rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/ItemTransformer.java
index 0b6c62a92..0c2946be9 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/ItemTransformer.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/ItemTransformer.java
@@ -1,4 +1,4 @@
-package org.springframework.batch.item.processor;
+package org.springframework.batch.item.writer;
/**
* Interface for item transformations during processing phase.
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/ItemTransformerItemWriterr.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/ItemTransformerItemWriterr.java
similarity index 94%
rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/ItemTransformerItemWriterr.java
rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/ItemTransformerItemWriterr.java
index 072fd95b5..cd19d2c16 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/ItemTransformerItemWriterr.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/ItemTransformerItemWriterr.java
@@ -1,4 +1,4 @@
-package org.springframework.batch.item.processor;
+package org.springframework.batch.item.writer;
import org.springframework.batch.item.ItemWriter;
import org.springframework.util.Assert;
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/ItemProcessorAdapter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/ItemWriterAdapter.java
similarity index 76%
rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/ItemProcessorAdapter.java
rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/ItemWriterAdapter.java
index a782413d4..de5e8a3f5 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/ItemProcessorAdapter.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/ItemWriterAdapter.java
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-package org.springframework.batch.item.processor;
+package org.springframework.batch.item.writer;
-import org.springframework.batch.item.ItemProcessor;
+import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.support.AbstractMethodInvokingDelegator;
@@ -28,9 +28,9 @@ import org.springframework.batch.support.AbstractMethodInvokingDelegator;
*
* @author Robert Kasanicky
*/
-public class ItemProcessorAdapter extends AbstractMethodInvokingDelegator implements ItemProcessor {
+public class ItemWriterAdapter extends AbstractMethodInvokingDelegator implements ItemWriter {
- public void process(Object item) throws Exception {
+ public void write(Object item) throws Exception {
invokeDelegateMethodWithArgument(item);
}
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/PropertyExtractingDelegatingItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/PropertyExtractingDelegatingItemWriter.java
similarity index 94%
rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/PropertyExtractingDelegatingItemWriter.java
rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/PropertyExtractingDelegatingItemWriter.java
index 8cb701492..e0a434f02 100644
--- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/PropertyExtractingDelegatingItemWriter.java
+++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/PropertyExtractingDelegatingItemWriter.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.springframework.batch.item.processor;
+package org.springframework.batch.item.writer;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.support.AbstractMethodInvokingDelegator;
@@ -26,7 +26,7 @@ import org.springframework.util.Assert;
* Delegates processing to a custom method - extracts property values
* from item object and uses them as arguments for the delegate method.
*
- * @see ItemProcessorAdapter
+ * @see ItemWriterAdapter
*
* @author Robert Kasanicky
*/
diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/package.html b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/package.html
similarity index 100%
rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/item/processor/package.html
rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/item/writer/package.html
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java
index 3c35cc9cf..b4f5584f7 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FlatFileItemWriterTests.java
@@ -25,8 +25,7 @@ import java.util.Properties;
import junit.framework.TestCase;
-import org.springframework.batch.io.file.FlatFileItemWriter;
-import org.springframework.batch.io.file.transform.Converter;
+import org.springframework.batch.item.writer.ItemTransformer;
import org.springframework.batch.restart.RestartData;
import org.springframework.core.io.FileSystemResource;
import org.springframework.transaction.support.TransactionSynchronization;
@@ -103,8 +102,9 @@ public class FlatFileItemWriterTests extends TestCase {
/**
* Regular usage of write(String) method
+ * @throws Exception
*/
- public void testWriteString() throws IOException {
+ public void testWriteString() throws Exception {
inputSource.write(TEST_STRING);
inputSource.close();
String lineFromFile = readLine();
@@ -114,8 +114,9 @@ public class FlatFileItemWriterTests extends TestCase {
/**
* Regular usage of write(String) method
+ * @throws Exception
*/
- public void testWriteCollection() throws IOException {
+ public void testWriteCollection() throws Exception {
inputSource.write(Collections.singleton(TEST_STRING));
inputSource.close();
String lineFromFile = readLine();
@@ -124,10 +125,11 @@ public class FlatFileItemWriterTests extends TestCase {
/**
* Regular usage of write(String) method
+ * @throws Exception
*/
- public void testWriteWithConverter() throws IOException {
- inputSource.setConverter(new Converter() {
- public Object convert(Object input) {
+ public void testWriteWithConverter() throws Exception {
+ inputSource.setTransformer(new ItemTransformer() {
+ public Object transform(Object input) {
return "FOO:" + input;
}
});
@@ -141,10 +143,11 @@ public class FlatFileItemWriterTests extends TestCase {
/**
* Regular usage of write(String) method
+ * @throws Exception
*/
- public void testWriteWithConverterAndInfiniteLoop() throws IOException {
- inputSource.setConverter(new Converter() {
- public Object convert(Object input) {
+ public void testWriteWithConverterAndInfiniteLoop() throws Exception {
+ inputSource.setTransformer(new ItemTransformer() {
+ public Object transform(Object input) {
return "FOO:" + input;
}
});
@@ -158,10 +161,11 @@ public class FlatFileItemWriterTests extends TestCase {
/**
* Regular usage of write(String) method
+ * @throws Exception
*/
- public void testWriteWithConverterAndInfiniteLoopInCollection() throws IOException {
- inputSource.setConverter(new Converter() {
- public Object convert(Object input) {
+ public void testWriteWithConverterAndInfiniteLoopInCollection() throws Exception {
+ inputSource.setTransformer(new ItemTransformer() {
+ public Object transform(Object input) {
return "FOO:" + input;
}
});
@@ -176,12 +180,13 @@ public class FlatFileItemWriterTests extends TestCase {
/**
* Regular usage of write(String) method
+ * @throws Exception
*/
- public void testWriteWithConverterAndInfiniteLoopInConvertedCollection() throws IOException {
- inputSource.setConverter(new Converter() {
+ public void testWriteWithConverterAndInfiniteLoopInConvertedCollection() throws Exception {
+ inputSource.setTransformer(new ItemTransformer() {
boolean converted = false;
- public Object convert(Object input) {
+ public Object transform(Object input) {
if (converted) {
return input;
}
@@ -205,10 +210,11 @@ public class FlatFileItemWriterTests extends TestCase {
/**
* Regular usage of write(String) method
+ * @throws Exception
*/
- public void testWriteWithConverterAndString() throws IOException {
- inputSource.setConverter(new Converter() {
- public Object convert(Object input) {
+ public void testWriteWithConverterAndString() throws Exception {
+ inputSource.setTransformer(new ItemTransformer() {
+ public Object transform(Object input) {
return "FOO:" + input;
}
});
@@ -221,10 +227,11 @@ public class FlatFileItemWriterTests extends TestCase {
/**
* Regular usage of write(String) method
+ * @throws Exception
*/
- public void testWriteWithConverterAndCollectionOfString() throws IOException {
- inputSource.setConverter(new Converter() {
- public Object convert(Object input) {
+ public void testWriteWithConverterAndCollectionOfString() throws Exception {
+ inputSource.setTransformer(new ItemTransformer() {
+ public Object transform(Object input) {
return "FOO:" + input;
}
});
@@ -237,8 +244,9 @@ public class FlatFileItemWriterTests extends TestCase {
/**
* Regular usage of write(String) method
+ * @throws Exception
*/
- public void testWriteArray() throws IOException {
+ public void testWriteArray() throws Exception {
inputSource.write(new String[] { TEST_STRING, TEST_STRING });
inputSource.close();
String lineFromFile = readLine();
@@ -249,8 +257,9 @@ public class FlatFileItemWriterTests extends TestCase {
/**
* Regular usage of write(String[], LineDescriptor) method
+ * @throws Exception
*/
- public void testWriteRecord() throws IOException {
+ public void testWriteRecord() throws Exception {
String args = "1";
// AggregatorStub ignores the LineDescriptor, so we pass null
@@ -287,7 +296,7 @@ public class FlatFileItemWriterTests extends TestCase {
assertEquals("testLine1", lineFromFile);
}
- public void testRestart() throws IOException {
+ public void testRestart() throws Exception {
// write some lines
inputSource.write("testLine1");
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/CompositeItemTransformerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/CompositeItemTransformerTests.java
similarity index 89%
rename from spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/CompositeItemTransformerTests.java
rename to spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/CompositeItemTransformerTests.java
index 1168a3d57..1852fd7b7 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/CompositeItemTransformerTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/CompositeItemTransformerTests.java
@@ -1,10 +1,12 @@
-package org.springframework.batch.item.processor;
+package org.springframework.batch.item.writer;
import java.util.ArrayList;
import junit.framework.TestCase;
import org.easymock.MockControl;
+import org.springframework.batch.item.writer.CompositeItemTransformer;
+import org.springframework.batch.item.writer.ItemTransformer;
/**
* Tests for {@link CompositeItemTransformer}.
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/CompositeItemProcessorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/CompositeItemWriterTests.java
similarity index 77%
rename from spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/CompositeItemProcessorTests.java
rename to spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/CompositeItemWriterTests.java
index 2a0811a73..d36a0f2c7 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/CompositeItemProcessorTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/CompositeItemWriterTests.java
@@ -1,4 +1,4 @@
-package org.springframework.batch.item.processor;
+package org.springframework.batch.item.writer;
import java.util.ArrayList;
import java.util.Iterator;
@@ -8,9 +8,8 @@ import java.util.Properties;
import junit.framework.TestCase;
import org.easymock.MockControl;
-import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.ItemWriter;
-import org.springframework.batch.item.processor.CompositeItemWriter;
+import org.springframework.batch.item.writer.CompositeItemWriter;
import org.springframework.batch.restart.GenericRestartData;
import org.springframework.batch.restart.RestartData;
import org.springframework.batch.restart.Restartable;
@@ -21,7 +20,7 @@ import org.springframework.batch.statistics.StatisticsProvider;
*
* @author Robert Kasanicky
*/
-public class CompositeItemProcessorTests extends TestCase {
+public class CompositeItemWriterTests extends TestCase {
// object under test
private CompositeItemWriter itemProcessor = new CompositeItemWriter();
@@ -64,11 +63,11 @@ public class CompositeItemProcessorTests extends TestCase {
*/
public void testRestart() {
//this mock with undefined behavior makes sure not-Restartable processor is ignored
- MockControl p1c = MockControl.createStrictControl(ItemProcessor.class);
- final ItemProcessor p1 = (ItemProcessor) p1c.getMock();
+ MockControl p1c = MockControl.createStrictControl(ItemWriter.class);
+ final ItemWriter p1 = (ItemWriter) p1c.getMock();
- final ItemProcessor p2 = new ItemProcessorStub();
- final ItemProcessor p3 = new ItemProcessorStub();
+ final ItemWriter p2 = new ItemWriterStub();
+ final ItemWriter p3 = new ItemWriterStub();
List itemProcessors = new ArrayList(){{
add(p1);
add(p2);
@@ -80,10 +79,10 @@ public class CompositeItemProcessorTests extends TestCase {
itemProcessor.restoreFrom(rd);
for (Iterator iterator = itemProcessors.iterator(); iterator.hasNext();) {
- ItemProcessor processor = (ItemProcessor) iterator.next();
- if (processor instanceof ItemProcessorStub) {
+ ItemWriter processor = (ItemWriter) iterator.next();
+ if (processor instanceof ItemWriterStub) {
assertTrue("Injected processors are restarted",
- ((ItemProcessorStub)processor).restarted);
+ ((ItemWriterStub)processor).restarted);
}
}
@@ -93,7 +92,7 @@ public class CompositeItemProcessorTests extends TestCase {
* Stub for testing restart. Checks the restart data received is the same that was returned by
* getRestartData()
*/
- private static class ItemProcessorStub implements ItemProcessor, Restartable, StatisticsProvider {
+ private static class ItemWriterStub implements ItemWriter, Restartable, StatisticsProvider {
private static final String RESTART_KEY = "restartData";
private static final String STATS_KEY = "stats";
@@ -117,7 +116,7 @@ public class CompositeItemProcessorTests extends TestCase {
restarted = true;
}
- public void process(Object data) throws Exception {
+ public void write(Object data) throws Exception {
// do nothing
}
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/ItemProcessorAdapterIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterAdapterIntegrationTests.java
similarity index 71%
rename from spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/ItemProcessorAdapterIntegrationTests.java
rename to spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterAdapterIntegrationTests.java
index 090a52828..45ff8e1e6 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/ItemProcessorAdapterIntegrationTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterAdapterIntegrationTests.java
@@ -1,19 +1,20 @@
-package org.springframework.batch.item.processor;
+package org.springframework.batch.item.writer;
import java.util.List;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.io.sample.domain.FooService;
+import org.springframework.batch.item.writer.ItemWriterAdapter;
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
/**
- * Tests for {@link ItemProcessorAdapter}.
+ * Tests for {@link ItemWriterAdapter}.
*
* @author Robert Kasanicky
*/
-public class ItemProcessorAdapterIntegrationTests extends AbstractDependencyInjectionSpringContextTests {
+public class ItemWriterAdapterIntegrationTests extends AbstractDependencyInjectionSpringContextTests {
- private ItemProcessorAdapter processor;
+ private ItemWriterAdapter processor;
private FooService fooService;
@@ -29,7 +30,7 @@ public class ItemProcessorAdapterIntegrationTests extends AbstractDependencyInje
public void testProcess() throws Exception {
Foo foo;
while ((foo = fooService.generateFoo()) != null) {
- processor.process(foo);
+ processor.write(foo);
}
List input = fooService.getGeneratedFoos();
@@ -44,7 +45,7 @@ public class ItemProcessorAdapterIntegrationTests extends AbstractDependencyInje
}
//setter for auto-injection
- public void setProcessor(ItemProcessorAdapter processor) {
+ public void setProcessor(ItemWriterAdapter processor) {
this.processor = processor;
}
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/ItemWriterItemProcessorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterItemProcessorTests.java
similarity index 93%
rename from spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/ItemWriterItemProcessorTests.java
rename to spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterItemProcessorTests.java
index 3d75df171..b2aac6e77 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/ItemWriterItemProcessorTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/ItemWriterItemProcessorTests.java
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.springframework.batch.item.processor;
+package org.springframework.batch.item.writer;
import java.util.ArrayList;
import java.util.List;
@@ -23,6 +23,7 @@ import junit.framework.TestCase;
import org.springframework.batch.io.Skippable;
import org.springframework.batch.item.ItemWriter;
+import org.springframework.batch.item.writer.DelegatingItemWriter;
import org.springframework.batch.restart.GenericRestartData;
import org.springframework.batch.restart.RestartData;
import org.springframework.batch.restart.Restartable;
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/PropertyExtractingDelegatingItemProccessorIntegrationTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/PropertyExtractingDelegatingItemProccessorIntegrationTests.java
similarity index 89%
rename from spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/PropertyExtractingDelegatingItemProccessorIntegrationTests.java
rename to spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/PropertyExtractingDelegatingItemProccessorIntegrationTests.java
index e52a6a64f..7ed038020 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/PropertyExtractingDelegatingItemProccessorIntegrationTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/PropertyExtractingDelegatingItemProccessorIntegrationTests.java
@@ -1,9 +1,10 @@
-package org.springframework.batch.item.processor;
+package org.springframework.batch.item.writer;
import java.util.List;
import org.springframework.batch.io.sample.domain.Foo;
import org.springframework.batch.io.sample.domain.FooService;
+import org.springframework.batch.item.writer.PropertyExtractingDelegatingItemWriter;
import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
/**
diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/TransformerWriterItemProcessorTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/TransformerWriterItemProcessorTests.java
similarity index 86%
rename from spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/TransformerWriterItemProcessorTests.java
rename to spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/TransformerWriterItemProcessorTests.java
index 8473f7ebc..80cdf950f 100644
--- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/processor/TransformerWriterItemProcessorTests.java
+++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/writer/TransformerWriterItemProcessorTests.java
@@ -1,9 +1,11 @@
-package org.springframework.batch.item.processor;
+package org.springframework.batch.item.writer;
import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.item.ItemWriter;
+import org.springframework.batch.item.writer.ItemTransformer;
+import org.springframework.batch.item.writer.ItemTransformerItemWriterr;
/**
* Tests for {@link ItemTransformerItemWriterr}.
diff --git a/spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/processor/delegating-item-processor.xml b/spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/writer/delegating-item-processor.xml
similarity index 82%
rename from spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/processor/delegating-item-processor.xml
rename to spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/writer/delegating-item-processor.xml
index 9aaab0e0a..8cc5f837f 100644
--- a/spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/processor/delegating-item-processor.xml
+++ b/spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/writer/delegating-item-processor.xml
@@ -2,7 +2,7 @@
-
+
diff --git a/spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/processor/pe-delegating-item-processor.xml b/spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/writer/pe-delegating-item-processor.xml
similarity index 82%
rename from spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/processor/pe-delegating-item-processor.xml
rename to spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/writer/pe-delegating-item-processor.xml
index 4aaf42567..fb862ca68 100644
--- a/spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/processor/pe-delegating-item-processor.xml
+++ b/spring-batch-infrastructure/src/test/resources/org/springframework/batch/item/writer/pe-delegating-item-processor.xml
@@ -2,7 +2,7 @@
-
diff --git a/spring-batch-samples/src/main/resources/jobs/compositeProcessorSampleJob.xml b/spring-batch-samples/src/main/resources/jobs/compositeProcessorSampleJob.xml
index 1023cdcfd..45a762e10 100644
--- a/spring-batch-samples/src/main/resources/jobs/compositeProcessorSampleJob.xml
+++ b/spring-batch-samples/src/main/resources/jobs/compositeProcessorSampleJob.xml
@@ -24,14 +24,14 @@
-
+
-
+
-
+
diff --git a/spring-batch-samples/src/main/resources/jobs/delegatingJob.xml b/spring-batch-samples/src/main/resources/jobs/delegatingJob.xml
index 6685851ad..d69d77a1c 100644
--- a/spring-batch-samples/src/main/resources/jobs/delegatingJob.xml
+++ b/spring-batch-samples/src/main/resources/jobs/delegatingJob.xml
@@ -30,7 +30,7 @@
-
-
+
diff --git a/spring-batch-samples/src/main/resources/jobs/footballJob.xml b/spring-batch-samples/src/main/resources/jobs/footballJob.xml
index 3691fa413..ec745f784 100644
--- a/spring-batch-samples/src/main/resources/jobs/footballJob.xml
+++ b/spring-batch-samples/src/main/resources/jobs/footballJob.xml
@@ -31,7 +31,7 @@
ref="playerFileItemReader" />
+ class="org.springframework.batch.sample.item.writer.PlayerItemWriter">
@@ -151,7 +151,7 @@
diff --git a/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml b/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml
index bdb8b936f..c6c08de7a 100644
--- a/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml
+++ b/spring-batch-samples/src/main/resources/jobs/hibernateJob.xml
@@ -64,7 +64,7 @@
+ class="org.springframework.batch.sample.item.writer.CustomerCreditIncreaseWriter">
diff --git a/spring-batch-samples/src/main/resources/jobs/ibatisJob.xml b/spring-batch-samples/src/main/resources/jobs/ibatisJob.xml
index 3d9f65a9f..b80d058e9 100644
--- a/spring-batch-samples/src/main/resources/jobs/ibatisJob.xml
+++ b/spring-batch-samples/src/main/resources/jobs/ibatisJob.xml
@@ -22,7 +22,7 @@
class="org.springframework.batch.execution.tasklet.RestartableItemOrientedTasklet">
-
+
diff --git a/spring-batch-samples/src/main/resources/jobs/multilineOrderJob.xml b/spring-batch-samples/src/main/resources/jobs/multilineOrderJob.xml
index 209e50682..86a7c3567 100644
--- a/spring-batch-samples/src/main/resources/jobs/multilineOrderJob.xml
+++ b/spring-batch-samples/src/main/resources/jobs/multilineOrderJob.xml
@@ -32,12 +32,12 @@
-
+
-
-
+
+
diff --git a/spring-batch-samples/src/main/resources/jobs/parallelJob.xml b/spring-batch-samples/src/main/resources/jobs/parallelJob.xml
index c3496f207..a5dfc606c 100644
--- a/spring-batch-samples/src/main/resources/jobs/parallelJob.xml
+++ b/spring-batch-samples/src/main/resources/jobs/parallelJob.xml
@@ -30,7 +30,7 @@
+ class="org.springframework.batch.sample.item.writer.TradeWriter">
@@ -163,7 +163,7 @@
diff --git a/spring-batch-samples/src/main/resources/jobs/restartSample.xml b/spring-batch-samples/src/main/resources/jobs/restartSample.xml
index 7cf89e776..97cfd80d1 100644
--- a/spring-batch-samples/src/main/resources/jobs/restartSample.xml
+++ b/spring-batch-samples/src/main/resources/jobs/restartSample.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml b/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml
index 9c57d3374..5ace2ab62 100644
--- a/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml
+++ b/spring-batch-samples/src/main/resources/jobs/rollbackJob.xml
@@ -55,7 +55,7 @@
diff --git a/spring-batch-samples/src/main/resources/jobs/tradeJob.xml b/spring-batch-samples/src/main/resources/jobs/tradeJob.xml
index c8f99690f..83dbb8706 100644
--- a/spring-batch-samples/src/main/resources/jobs/tradeJob.xml
+++ b/spring-batch-samples/src/main/resources/jobs/tradeJob.xml
@@ -31,7 +31,7 @@
@@ -44,7 +44,7 @@
@@ -57,7 +57,7 @@
diff --git a/spring-batch-samples/src/main/resources/log4j.properties b/spring-batch-samples/src/main/resources/log4j.properties
index d68007ff3..54da719b9 100644
--- a/spring-batch-samples/src/main/resources/log4j.properties
+++ b/spring-batch-samples/src/main/resources/log4j.properties
@@ -29,6 +29,6 @@ log4j.logger.org.springframework.batch.sample=debug
#log4j.logger.org.springframework.orm=debug
### debug your specific package or classes with the following example
-log4j.logger.org.springframework.batch.io=debug
+log4j.logger.org.springframework.batch=debug
log4j.logger.org.springframework.batch.sample.module.OrderDataProvider=debug
log4j.logger.org.springframework.batch.container.common.module.process.support.DefaultXmlDataProvider=debug
diff --git a/spring-batch-samples/src/main/resources/simple-container-definition.xml b/spring-batch-samples/src/main/resources/simple-container-definition.xml
index e555cd3e0..71463babf 100644
--- a/spring-batch-samples/src/main/resources/simple-container-definition.xml
+++ b/spring-batch-samples/src/main/resources/simple-container-definition.xml
@@ -151,7 +151,7 @@
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/AbstractCustomerCreditIncreaseTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/AbstractCustomerCreditIncreaseTests.java
index a889322ed..1c2fd6ef5 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/AbstractCustomerCreditIncreaseTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/AbstractCustomerCreditIncreaseTests.java
@@ -6,7 +6,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
-import org.springframework.batch.sample.item.processor.CustomerCreditIncreaseWriter;
+import org.springframework.batch.sample.item.writer.CustomerCreditIncreaseWriter;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.transaction.PlatformTransactionManager;
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/ParallelJobFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/ParallelJobFunctionalTests.java
index 86f802d10..1ae515a7e 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/ParallelJobFunctionalTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/ParallelJobFunctionalTests.java
@@ -2,7 +2,7 @@ package org.springframework.batch.sample;
import javax.sql.DataSource;
-import org.springframework.batch.sample.item.processor.StagingItemWriter;
+import org.springframework.batch.sample.item.writer.StagingItemWriter;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.core.JdbcTemplate;
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/dao/FlatFileOrderWriterTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/dao/FlatFileOrderWriterTests.java
index 298528c66..f08771921 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/dao/FlatFileOrderWriterTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/dao/FlatFileOrderWriterTests.java
@@ -60,7 +60,7 @@ public class FlatFileOrderWriterTests extends TestCase {
//create map of aggregators and set it to writer
Map aggregators = new HashMap();
- OrderConverter converter = new OrderConverter();
+ OrderTransformer converter = new OrderTransformer();
aggregators.put("header", aggregator);
aggregators.put("customer", aggregator);
aggregators.put("address", aggregator);
@@ -68,7 +68,7 @@ public class FlatFileOrderWriterTests extends TestCase {
aggregators.put("item", aggregator);
aggregators.put("footer", aggregator);
converter.setAggregators(aggregators);
- writer.setConverter(converter);
+ writer.setTransformer(converter);
//call tested method
writer.write(order);
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/dao/OrderConverterTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/dao/OrderTransformerTests.java
similarity index 89%
rename from spring-batch-samples/src/test/java/org/springframework/batch/sample/dao/OrderConverterTests.java
rename to spring-batch-samples/src/test/java/org/springframework/batch/sample/dao/OrderTransformerTests.java
index 700003fd0..7ed5ec678 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/dao/OrderConverterTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/dao/OrderTransformerTests.java
@@ -33,9 +33,9 @@ import org.springframework.batch.sample.domain.Order;
* @author Dave Syer
*
*/
-public class OrderConverterTests extends TestCase {
+public class OrderTransformerTests extends TestCase {
- private OrderConverter converter = new OrderConverter();
+ private OrderTransformer converter = new OrderTransformer();
public void testConvert() throws Exception {
converter.setAggregators(new HashMap() {
@@ -55,7 +55,7 @@ public class OrderConverterTests extends TestCase {
order.setBilling(new BillingInfo());
order.setLineItems(Collections.EMPTY_LIST);
order.setTotalPrice(BigDecimal.TEN);
- Object result = converter.convert(order);
+ Object result = converter.transform(order);
assertTrue(result instanceof Collection);
}
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/CustomerCreditIncreaseProcessorTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/CustomerCreditIncreaseProcessorTests.java
index 8ad54c960..773441fc8 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/CustomerCreditIncreaseProcessorTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/CustomerCreditIncreaseProcessorTests.java
@@ -7,6 +7,7 @@ import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.sample.dao.CustomerCreditDao;
import org.springframework.batch.sample.domain.CustomerCredit;
+import org.springframework.batch.sample.item.writer.CustomerCreditIncreaseWriter;
/**
* Tests for {@link CustomerCreditIncreaseWriter}.
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/CustomerCreditUpdateProcessorTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/CustomerCreditUpdateProcessorTests.java
index 7281253c7..b44a3e6de 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/CustomerCreditUpdateProcessorTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/CustomerCreditUpdateProcessorTests.java
@@ -7,7 +7,7 @@ import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.sample.dao.CustomerCreditDao;
import org.springframework.batch.sample.domain.CustomerCredit;
-import org.springframework.batch.sample.item.processor.CustomerCreditUpdateWriter;
+import org.springframework.batch.sample.item.writer.CustomerCreditUpdateWriter;
public class CustomerCreditUpdateProcessorTests extends TestCase {
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/CustomerUpdateProcessorTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/CustomerUpdateProcessorTests.java
index d2a361f01..052c68a09 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/CustomerUpdateProcessorTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/CustomerUpdateProcessorTests.java
@@ -7,7 +7,7 @@ import junit.framework.TestCase;
import org.springframework.batch.sample.dao.JdbcCustomerDebitWriter;
import org.springframework.batch.sample.domain.CustomerDebit;
import org.springframework.batch.sample.domain.Trade;
-import org.springframework.batch.sample.item.processor.CustomerUpdateWriter;
+import org.springframework.batch.sample.item.writer.CustomerUpdateWriter;
public class CustomerUpdateProcessorTests extends TestCase {
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/OrderWriterTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/OrderWriterTests.java
index 99c693fcc..ced99cf4e 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/OrderWriterTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/OrderWriterTests.java
@@ -6,6 +6,7 @@ import org.easymock.MockControl;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.sample.domain.Order;
+import org.springframework.batch.sample.item.writer.OrderWriter;
public class OrderWriterTests extends TestCase {
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/StagingItemProcessorTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/StagingItemProcessorTests.java
index 1db1c0989..d15098bfb 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/StagingItemProcessorTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/StagingItemProcessorTests.java
@@ -8,6 +8,7 @@ import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
import org.springframework.batch.execution.scope.SimpleStepContext;
import org.springframework.batch.execution.scope.StepSynchronizationManager;
+import org.springframework.batch.sample.item.writer.StagingItemWriter;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
import org.springframework.util.ClassUtils;
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/TradeProcessorTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/TradeProcessorTests.java
index df4e2de82..a6c03bc59 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/TradeProcessorTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/processor/TradeProcessorTests.java
@@ -5,6 +5,7 @@ import junit.framework.TestCase;
import org.easymock.MockControl;
import org.springframework.batch.sample.dao.TradeDao;
import org.springframework.batch.sample.domain.Trade;
+import org.springframework.batch.sample.item.writer.TradeWriter;
public class TradeProcessorTests extends TestCase {
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/reader/StagingItemReaderTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/reader/StagingItemReaderTests.java
index 431558891..b1f42d407 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/reader/StagingItemReaderTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/reader/StagingItemReaderTests.java
@@ -11,7 +11,7 @@ import org.springframework.batch.execution.scope.StepSynchronizationManager;
import org.springframework.batch.repeat.context.RepeatContextSupport;
import org.springframework.batch.repeat.synch.BatchTransactionSynchronizationManager;
import org.springframework.batch.repeat.synch.RepeatSynchronizationManager;
-import org.springframework.batch.sample.item.processor.StagingItemWriter;
+import org.springframework.batch.sample.item.writer.StagingItemWriter;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
import org.springframework.util.ClassUtils;
diff --git a/spring-batch-samples/src/test/resources/org/springframework/batch/sample/item/processor/staging-test-context.xml b/spring-batch-samples/src/test/resources/org/springframework/batch/sample/item/writer/staging-test-context.xml
similarity index 91%
rename from spring-batch-samples/src/test/resources/org/springframework/batch/sample/item/processor/staging-test-context.xml
rename to spring-batch-samples/src/test/resources/org/springframework/batch/sample/item/writer/staging-test-context.xml
index 3793b1095..7a1613d02 100644
--- a/spring-batch-samples/src/test/resources/org/springframework/batch/sample/item/processor/staging-test-context.xml
+++ b/spring-batch-samples/src/test/resources/org/springframework/batch/sample/item/writer/staging-test-context.xml
@@ -12,7 +12,7 @@
class="org.springframework.batch.execution.scope.StepScope" />