From 03ea1e38265ca671867205cf534c443ffca03a72 Mon Sep 17 00:00:00 2001 From: dsyer Date: Mon, 31 Dec 2007 17:13:40 +0000 Subject: [PATCH] IN PROGRESS - issue BATCH-267: Re-organise I/O (io) packages http://jira.springframework.org/browse/BATCH-267 Remove package cycles --- .../io/file/{transform => }/Converter.java | 2 +- .../io/file/DefaultFlatFileItemReader.java | 9 ++-- .../batch/io/file/FlatFileItemWriter.java | 1 - .../io/file/SimpleFlatFileItemReader.java | 26 ++++++++---- .../mapping/BeanWrapperFieldSetMapper.java | 4 +- .../batch/io/file/{ => mapping}/FieldSet.java | 2 +- .../io/file/{ => mapping}/FieldSetMapper.java | 12 +----- .../batch/io/file/separator/LineReader.java | 42 +++++++++++++++++++ .../{ => separator}/ResourceLineReader.java | 6 +-- .../file/transform/AbstractLineTokenizer.java | 2 +- .../io/file/transform/LineTokenizer.java | 3 +- .../PrefixMatchingCompositeLineTokenizer.java | 2 +- .../xml/{stax => }/FragmentDeserializer.java | 2 +- .../xml/{stax => }/ObjectToXmlSerializer.java | 2 +- ...emReader.java => StaxEventItemReader.java} | 3 +- ...emWriter.java => StaxEventItemWriter.java} | 3 +- .../oxm/MarshallingObjectToXmlSerializer.java | 2 +- .../UnmarshallingFragmentDeserializer.java | 2 +- .../item/provider/AggregateItemReader.java | 20 ++++++--- .../file/DefaultFlatFileItemReaderTests.java | 10 ++--- .../batch/io/file/FieldSetTests.java | 2 +- .../io/file/FlatFileItemWriterTests.java | 1 - .../io/file/ResourceLineReaderTests.java | 2 +- .../file/SimpleFlatFileItemReaderTests.java | 12 +++--- .../BeanWrapperFieldSetMapperTests.java | 1 - .../DelimitedLineTokenizerTests.java | 2 +- .../transform/FixedLengthTokenizerTests.java | 2 +- ...ixMatchingCompositeLineTokenizerTests.java | 3 +- .../xml/StaxEventReaderItemReaderTests.java | 15 ++++--- .../xml/StaxEventWriterItemWriterTests.java | 10 ++--- .../stax/DefaultFragmentEventReaderTests.java | 1 - .../DefaultTransactionalEventReaderTests.java | 1 - .../provider/AggregateItemReaderTests.java | 5 +-- .../support/AbstractTradeBatchTests.java | 4 +- .../batch/repeat/support/Trade.java | 2 +- ...bstractStaxEventReaderItemReaderTests.java | 4 +- ...bstractStaxEventWriterItemWriterTests.java | 4 +- .../sample/FieldSetResultSetExtractor.java | 2 +- .../batch/sample/dao/FlatFileOrderWriter.java | 2 +- .../batch/sample/dao/OrderConverter.java | 2 +- .../sample/item/provider/OrderItemReader.java | 4 +- .../sample/mapping/AddressFieldSetMapper.java | 4 +- .../sample/mapping/BillingFieldSetMapper.java | 4 +- .../mapping/CustomerFieldSetMapper.java | 4 +- .../batch/sample/mapping/GameMapper.java | 4 +- .../sample/mapping/HeaderFieldSetMapper.java | 4 +- .../mapping/OrderItemFieldSetMapper.java | 4 +- .../mapping/PassThroughFieldSetMapper.java | 4 +- .../batch/sample/mapping/PlayerMapper.java | 4 +- .../mapping/ShippingFieldSetMapper.java | 4 +- .../sample/mapping/TradeFieldSetMapper.java | 9 ++-- .../src/main/resources/jobs/xmlStaxJob.xml | 4 +- .../FixedLengthImportJobFunctionalTests.java | 11 ++++- .../item/provider/OrderItemReaderTests.java | 4 +- .../mapping/AbstractFieldSetMapperTests.java | 4 +- .../mapping/AddressFieldSetMapperTests.java | 4 +- .../mapping/BillingFieldSetMapperTests.java | 4 +- .../mapping/CustomerFieldSetMapperTests.java | 4 +- .../mapping/HeaderFieldSetMapperTests.java | 4 +- .../mapping/OrderItemFieldSetMapperTests.java | 4 +- .../mapping/ShippingFieldSetMapperTests.java | 4 +- .../mapping/TradeFieldSetMapperTests.java | 9 ++-- 62 files changed, 194 insertions(+), 143 deletions(-) rename spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/{transform => }/Converter.java (91%) rename spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/{ => mapping}/FieldSet.java (96%) rename spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/{ => mapping}/FieldSetMapper.java (78%) create mode 100644 spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/separator/LineReader.java rename spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/{ => separator}/ResourceLineReader.java (93%) rename spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/{stax => }/FragmentDeserializer.java (83%) rename spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/{stax => }/ObjectToXmlSerializer.java (87%) rename spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/{StaxEventReaderItemReader.java => StaxEventItemReader.java} (95%) rename spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/{StaxEventWriterItemWriter.java => StaxEventItemWriter.java} (95%) 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/Converter.java similarity index 91% rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/Converter.java rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/Converter.java index 71c7eea03..3ef305fac 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/Converter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.io.file.transform; +package org.springframework.batch.io.file; /** * Generic converter interface for transforming an object into another form for diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/DefaultFlatFileItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/DefaultFlatFileItemReader.java index c823c5aa4..94e662dc4 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/DefaultFlatFileItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/DefaultFlatFileItemReader.java @@ -23,6 +23,7 @@ import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.batch.io.Skippable; +import org.springframework.batch.io.file.separator.LineReader; import org.springframework.batch.repeat.synch.BatchTransactionSynchronizationManager; import org.springframework.batch.restart.GenericRestartData; import org.springframework.batch.restart.RestartData; @@ -56,7 +57,7 @@ public class DefaultFlatFileItemReader extends SimpleFlatFileItemReader implemen private Properties statistics = new Properties(); /** - * Initialize the input source. + * Initialize the input source. */ public void open() { registerSynchronization(); @@ -88,11 +89,11 @@ public class DefaultFlatFileItemReader extends SimpleFlatFileItemReader implemen int lineCount = Integer.parseInt(data.getProperties().getProperty(READ_STATISTICS_NAME)); - ResourceLineReader reader = getReader(); + LineReader reader = getReader(); Object record = ""; while (reader.getCurrentLineCount() < lineCount && record != null) { - record = reader.read(); + record = readLine(); } } @@ -111,7 +112,7 @@ public class DefaultFlatFileItemReader extends SimpleFlatFileItemReader implemen * @see org.springframework.batch.statistics.StatisticsProvider#getStatistics() */ public Properties getStatistics() { - ResourceLineReader is = getReader(); + LineReader is = getReader(); statistics.setProperty(READ_STATISTICS_NAME, String.valueOf(is.getCurrentLineCount())); return statistics; } 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 ba92a996a..80b8d1051 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,7 +30,6 @@ 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; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/SimpleFlatFileItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/SimpleFlatFileItemReader.java index c2300d730..a231bf7b9 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/SimpleFlatFileItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/SimpleFlatFileItemReader.java @@ -19,7 +19,11 @@ package org.springframework.batch.io.file; import java.io.IOException; import org.springframework.batch.io.exception.FlatFileParsingException; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; +import org.springframework.batch.io.file.separator.LineReader; import org.springframework.batch.io.file.separator.RecordSeparatorPolicy; +import org.springframework.batch.io.file.separator.ResourceLineReader; import org.springframework.batch.io.file.transform.AbstractLineTokenizer; import org.springframework.batch.io.file.transform.DelimitedLineTokenizer; import org.springframework.batch.io.file.transform.LineTokenizer; @@ -59,7 +63,7 @@ public class SimpleFlatFileItemReader extends AbstractItemReader implements Item * Encapsulates the state of the input source. If it is null then we are * uninitialized. */ - private ResourceLineReader reader; + private LineReader reader; private RecordSeparatorPolicy recordSeparatorPolicy; @@ -126,10 +130,11 @@ public class SimpleFlatFileItemReader extends AbstractItemReader implements Item /** * Initialize the reader if necessary. + * @throws IllegalStateException if the resource cannot be opened */ - public void open() { - if (reader == null) { - reader = new ResourceLineReader(resource, encoding); + public void open() throws IllegalStateException { + if (this.reader == null) { + ResourceLineReader reader = new ResourceLineReader(resource, encoding); if (recordSeparatorPolicy != null) { reader.setRecordSeparatorPolicy(recordSeparatorPolicy); } @@ -137,6 +142,7 @@ public class SimpleFlatFileItemReader extends AbstractItemReader implements Item reader.setComments(comments); } reader.open(); + this.reader = reader; } for (int i = 0; i < linesToSkip; i++) { @@ -182,16 +188,22 @@ public class SimpleFlatFileItemReader extends AbstractItemReader implements Item // Reads first valid line. protected String readLine() { - return (String) getReader().read(); + try { + return (String) getReader().read(); + } + catch (Exception e) { + throw new IllegalStateException(e); + } } /** * A wrapper for {@link #readFieldSet()} to make this into a real * {@link ItemReader}. + * @throws Exception * * @see org.springframework.batch.io.ItemReader#read() */ - public Object read() { + public Object read() throws Exception { String line = readLine(); if (line != null) { @@ -237,7 +249,7 @@ public class SimpleFlatFileItemReader extends AbstractItemReader implements Item } // Returns object representing state of the input template. - protected ResourceLineReader getReader() { + protected LineReader getReader() { if (reader == null) { open(); // reader is now not null, or else an exception is thrown diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/BeanWrapperFieldSetMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/BeanWrapperFieldSetMapper.java index 8964aa894..72f038144 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/BeanWrapperFieldSetMapper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/BeanWrapperFieldSetMapper.java @@ -26,8 +26,6 @@ import java.util.Map; import java.util.Properties; import java.util.Set; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; import org.springframework.beans.BeanWrapperImpl; import org.springframework.beans.MutablePropertyValues; import org.springframework.beans.NotWritablePropertyException; @@ -156,7 +154,7 @@ public class BeanWrapperFieldSetMapper implements FieldSetMapper, BeanFactoryAwa * the {@link DataBinder} from {@link #createBinder(Object)} has errors * after binding). * - * @see org.springframework.batch.io.file.FieldSetMapper#mapLine(org.springframework.batch.io.file.FieldSet) + * @see org.springframework.batch.io.file.mapping.FieldSetMapper#mapLine(org.springframework.batch.io.file.mapping.FieldSet) */ public Object mapLine(FieldSet fs) { Object copy = getBean(); diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FieldSet.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/FieldSet.java similarity index 96% rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FieldSet.java rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/FieldSet.java index ea299b7f0..51fb0f33f 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FieldSet.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/FieldSet.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.io.file; +package org.springframework.batch.io.file.mapping; import java.math.BigDecimal; import java.text.ParseException; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FieldSetMapper.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/FieldSetMapper.java similarity index 78% rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FieldSetMapper.java rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/FieldSetMapper.java index c6b913a80..5f1a43358 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/FieldSetMapper.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/mapping/FieldSetMapper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.io.file; +package org.springframework.batch.io.file.mapping; /** @@ -26,16 +26,6 @@ package org.springframework.batch.io.file; */ public interface FieldSetMapper { - /** - * Marker for the beginning of a multi-object record. - */ - static Object BEGIN_RECORD = new Object(); - - /** - * Marker for the end of a multi-object record. - */ - static Object END_RECORD = new Object(); - /** * Method used to map data obtained from a file into an object. */ diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/separator/LineReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/separator/LineReader.java new file mode 100644 index 000000000..65ba5e27d --- /dev/null +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/separator/LineReader.java @@ -0,0 +1,42 @@ +/* + * 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.io.file.separator; + +import org.springframework.batch.item.ItemReader; +import org.springframework.batch.item.ResourceLifecycle; + +/** + * @author Dave Syer + * + */ +public interface LineReader extends ResourceLifecycle, ItemReader { + + /** + * @return + */ + int getCurrentLineCount(); + + /** + * + */ + void mark(); + + /** + * + */ + void reset(); + +} diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/ResourceLineReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/separator/ResourceLineReader.java similarity index 93% rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/ResourceLineReader.java rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/separator/ResourceLineReader.java index 4a0f39803..8f9bea8b4 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/ResourceLineReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/separator/ResourceLineReader.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.io.file; +package org.springframework.batch.io.file.separator; import java.io.BufferedReader; import java.io.IOException; @@ -26,8 +26,6 @@ import java.util.HashSet; import java.util.Iterator; import org.springframework.batch.io.exception.BatchEnvironmentException; -import org.springframework.batch.io.file.separator.DefaultRecordSeparatorPolicy; -import org.springframework.batch.io.file.separator.RecordSeparatorPolicy; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ResourceLifecycle; import org.springframework.batch.item.provider.AbstractItemReader; @@ -58,7 +56,7 @@ import org.springframework.util.Assert; * @author Dave Syer * @author Rob Harrop */ -class ResourceLineReader extends AbstractItemReader implements ResourceLifecycle, ItemReader, +public class ResourceLineReader extends AbstractItemReader implements LineReader, ResourceLifecycle, ItemReader, DisposableBean { private static final Collection DEFAULT_COMMENTS = Collections diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/AbstractLineTokenizer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/AbstractLineTokenizer.java index 49d9371db..7d096e9ae 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/AbstractLineTokenizer.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/AbstractLineTokenizer.java @@ -19,7 +19,7 @@ package org.springframework.batch.io.file.transform; import java.util.ArrayList; import java.util.List; -import org.springframework.batch.io.file.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSet; /** diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/LineTokenizer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/LineTokenizer.java index e12303840..736048e41 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/LineTokenizer.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/LineTokenizer.java @@ -16,7 +16,8 @@ package org.springframework.batch.io.file.transform; -import org.springframework.batch.io.file.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSet; + /** * Interface that is used by framework to split string obtained typically from a diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/PrefixMatchingCompositeLineTokenizer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/PrefixMatchingCompositeLineTokenizer.java index 86c29ddec..80830abce 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/PrefixMatchingCompositeLineTokenizer.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/file/transform/PrefixMatchingCompositeLineTokenizer.java @@ -21,7 +21,7 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; -import org.springframework.batch.io.file.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSet; public class PrefixMatchingCompositeLineTokenizer implements LineTokenizer { diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/stax/FragmentDeserializer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/FragmentDeserializer.java similarity index 83% rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/stax/FragmentDeserializer.java rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/FragmentDeserializer.java index 49d90b949..b7d849886 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/stax/FragmentDeserializer.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/FragmentDeserializer.java @@ -1,4 +1,4 @@ -package org.springframework.batch.io.xml.stax; +package org.springframework.batch.io.xml; import javax.xml.stream.XMLEventReader; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/stax/ObjectToXmlSerializer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/ObjectToXmlSerializer.java similarity index 87% rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/stax/ObjectToXmlSerializer.java rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/ObjectToXmlSerializer.java index fec350b4e..1dce19163 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/stax/ObjectToXmlSerializer.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/ObjectToXmlSerializer.java @@ -1,4 +1,4 @@ -package org.springframework.batch.io.xml.stax; +package org.springframework.batch.io.xml; import javax.xml.stream.XMLEventWriter; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventReaderItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemReader.java similarity index 95% rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventReaderItemReader.java rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemReader.java index 5f50595b0..c5dda4ce4 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventReaderItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemReader.java @@ -15,7 +15,6 @@ import javax.xml.stream.events.StartElement; import org.springframework.batch.io.Skippable; import org.springframework.batch.io.xml.stax.DefaultFragmentEventReader; import org.springframework.batch.io.xml.stax.DefaultTransactionalEventReader; -import org.springframework.batch.io.xml.stax.FragmentDeserializer; import org.springframework.batch.io.xml.stax.FragmentEventReader; import org.springframework.batch.io.xml.stax.TransactionalEventReader; import org.springframework.batch.item.ItemReader; @@ -44,7 +43,7 @@ import org.springframework.util.Assert; * * @author Robert Kasanicky */ -public class StaxEventReaderItemReader extends AbstractItemReader implements ItemReader, ResourceLifecycle, +public class StaxEventItemReader extends AbstractItemReader implements ItemReader, ResourceLifecycle, Skippable, Restartable, StatisticsProvider, InitializingBean, DisposableBean { public static final String READ_COUNT_STATISTICS_NAME = "StaxEventReaderItemReader.readCount"; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventWriterItemWriter.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemWriter.java similarity index 95% rename from spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventWriterItemWriter.java rename to spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemWriter.java index 5e483540f..06e3ff4fa 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventWriterItemWriter.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/StaxEventItemWriter.java @@ -16,7 +16,6 @@ import javax.xml.stream.XMLStreamException; import org.springframework.batch.io.support.FileUtils; import org.springframework.batch.io.xml.stax.NoStartEndDocumentStreamWriter; -import org.springframework.batch.io.xml.stax.ObjectToXmlSerializer; import org.springframework.batch.item.ItemWriter; import org.springframework.batch.item.ResourceLifecycle; import org.springframework.batch.repeat.synch.BatchTransactionSynchronizationManager; @@ -43,7 +42,7 @@ import org.springframework.util.CollectionUtils; * @author Peter Zozom * */ -public class StaxEventWriterItemWriter implements ItemWriter, ResourceLifecycle, Restartable, +public class StaxEventItemWriter implements ItemWriter, ResourceLifecycle, Restartable, StatisticsProvider, InitializingBean, DisposableBean { // default encoding diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/oxm/MarshallingObjectToXmlSerializer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/oxm/MarshallingObjectToXmlSerializer.java index 04f040b52..2ad6a2e67 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/oxm/MarshallingObjectToXmlSerializer.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/oxm/MarshallingObjectToXmlSerializer.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.xml.stream.XMLEventWriter; import javax.xml.transform.Result; -import org.springframework.batch.io.xml.stax.ObjectToXmlSerializer; +import org.springframework.batch.io.xml.ObjectToXmlSerializer; import org.springframework.dao.DataAccessResourceFailureException; import org.springframework.oxm.Marshaller; import org.springframework.xml.transform.StaxResult; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/oxm/UnmarshallingFragmentDeserializer.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/oxm/UnmarshallingFragmentDeserializer.java index 25ac31a31..49f63aef3 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/oxm/UnmarshallingFragmentDeserializer.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/io/xml/oxm/UnmarshallingFragmentDeserializer.java @@ -4,7 +4,7 @@ import java.io.IOException; import javax.xml.stream.XMLEventReader; -import org.springframework.batch.io.xml.stax.FragmentDeserializer; +import org.springframework.batch.io.xml.FragmentDeserializer; import org.springframework.dao.DataAccessResourceFailureException; import org.springframework.oxm.Unmarshaller; import org.springframework.util.Assert; diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/provider/AggregateItemReader.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/provider/AggregateItemReader.java index eb8a3667b..96a3eac38 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/provider/AggregateItemReader.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/provider/AggregateItemReader.java @@ -21,15 +21,15 @@ import java.util.Collection; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.item.ItemReader; /** * An {@link ItemReader} that delivers a list as its item, storing up objects * from the injected {@link ItemReader} until they are ready to be packed out * as a collection. The {@link ItemReader} should mark the beginning and end of - * records with the constant values in {@link FieldSetMapper} ({@link FieldSetMapper#BEGIN_RECORD} - * and {@link FieldSetMapper#END_RECORD}).
+ * records with the constant values in {@link FieldSetMapper} ({@link AggregateItemReader#BEGIN_RECORD} + * and {@link AggregateItemReader#END_RECORD}).
* * This class is thread safe (it can be used concurrently by multiple threads) * as long as the {@link ItemReader} is also thread safe. @@ -44,6 +44,16 @@ public class AggregateItemReader extends AbstractItemReader { private ItemReader inputSource; + /** + * Marker for the end of a multi-object record. + */ + public static final Object END_RECORD = new Object(); + + /** + * Marker for the beginning of a multi-object record. + */ + public static final Object BEGIN_RECORD = new Object(); + /** * Get the next list of records. * @throws Exception @@ -73,13 +83,13 @@ public class AggregateItemReader extends AbstractItemReader { } // start a new collection - if (value == FieldSetMapper.BEGIN_RECORD) { + if (value == AggregateItemReader.BEGIN_RECORD) { log.debug("Start of new record detected"); return true; } // mark we are finished with current collection - if (value == FieldSetMapper.END_RECORD) { + if (value == AggregateItemReader.END_RECORD) { log.debug("End of record detected"); return false; } diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/DefaultFlatFileItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/DefaultFlatFileItemReaderTests.java index 4950c481f..4989247d9 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/DefaultFlatFileItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/DefaultFlatFileItemReaderTests.java @@ -21,8 +21,8 @@ import java.io.IOException; import junit.framework.TestCase; import org.springframework.batch.io.file.DefaultFlatFileItemReader; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.io.file.transform.LineTokenizer; import org.springframework.batch.restart.RestartData; import org.springframework.core.io.ByteArrayResource; @@ -87,7 +87,7 @@ public class DefaultFlatFileItemReaderTests extends TestCase { * Test skip and skipRollback functionality * @throws IOException */ - public void testSkip() throws IOException { + public void testSkip() throws Exception { inputSource.close(); inputSource.setResource(getInputResource("testLine1\ntestLine2\ntestLine3\ntestLine4\ntestLine5\ntestLine6")); @@ -122,7 +122,7 @@ public class DefaultFlatFileItemReaderTests extends TestCase { * Test skip and skipRollback functionality * @throws IOException */ - public void testTransactionSynchronizationUnknown() throws IOException { + public void testTransactionSynchronizationUnknown() throws Exception { inputSource.close(); inputSource.setResource(getInputResource("testLine1\ntestLine2\ntestLine3\ntestLine4\ntestLine5\ntestLine6")); @@ -164,7 +164,7 @@ public class DefaultFlatFileItemReaderTests extends TestCase { assertEquals("[FlatFileInputTemplate-TestData]", inputSource.read().toString()); } - public void testRestart() throws IOException { + public void testRestart() throws Exception { inputSource.close(); inputSource.setResource(getInputResource("testLine1\ntestLine2\ntestLine3\ntestLine4\ntestLine5\ntestLine6")); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FieldSetTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FieldSetTests.java index b4242bf39..ea7ff35b0 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FieldSetTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/FieldSetTests.java @@ -21,7 +21,7 @@ import java.text.ParseException; import junit.framework.TestCase; -import org.springframework.batch.io.file.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSet; public class FieldSetTests extends TestCase { FieldSet fieldSet; 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 5018eaf68..e0e3ab690 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,7 +25,6 @@ import java.util.Collections; import junit.framework.TestCase; import org.springframework.batch.io.file.FlatFileItemWriter; -import org.springframework.batch.io.file.transform.Converter; import org.springframework.batch.restart.RestartData; import org.springframework.core.io.FileSystemResource; import org.springframework.transaction.support.TransactionSynchronization; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/ResourceLineReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/ResourceLineReaderTests.java index 1284c5577..b12972ebd 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/ResourceLineReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/ResourceLineReaderTests.java @@ -22,7 +22,7 @@ import java.io.InputStream; import junit.framework.TestCase; import org.springframework.batch.io.exception.BatchEnvironmentException; -import org.springframework.batch.io.file.ResourceLineReader; +import org.springframework.batch.io.file.separator.ResourceLineReader; import org.springframework.batch.io.file.separator.SuffixRecordSeparatorPolicy; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.InputStreamResource; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/SimpleFlatFileItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/SimpleFlatFileItemReaderTests.java index 9fbdc8193..05e5e8fa9 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/SimpleFlatFileItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/SimpleFlatFileItemReaderTests.java @@ -25,9 +25,9 @@ import junit.framework.TestCase; import org.springframework.batch.io.exception.BatchEnvironmentException; import org.springframework.batch.io.exception.FlatFileParsingException; import org.springframework.batch.io.file.DefaultFlatFileItemReader; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; import org.springframework.batch.io.file.SimpleFlatFileItemReader; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.io.file.separator.DefaultRecordSeparatorPolicy; import org.springframework.batch.io.file.transform.DelimitedLineTokenizer; import org.springframework.batch.io.file.transform.LineTokenizer; @@ -90,14 +90,14 @@ public class SimpleFlatFileItemReaderTests extends TestCase { /** * Regular usage of read method */ - public void testRead() throws IOException { + public void testRead() throws Exception { assertEquals("[FlatFileInputTemplate-TestData]", inputSource.read().toString()); } /** * Regular usage of read method */ - public void testReadExhausted() throws IOException { + public void testReadExhausted() throws Exception { assertEquals("[FlatFileInputTemplate-TestData]", inputSource.read().toString()); assertEquals(null, inputSource.read()); } @@ -105,7 +105,7 @@ public class SimpleFlatFileItemReaderTests extends TestCase { /** * Regular usage of read method */ - public void testReadWithTokenizerError() throws IOException { + public void testReadWithTokenizerError() throws Exception { inputSource.setTokenizer(new LineTokenizer() { public FieldSet tokenize(String line) { throw new RuntimeException("foo"); @@ -120,7 +120,7 @@ public class SimpleFlatFileItemReaderTests extends TestCase { } } - public void testReadWithMapperError() throws IOException { + public void testReadWithMapperError() throws Exception { inputSource.setFieldSetMapper(new FieldSetMapper(){ public Object mapLine(FieldSet fs) { throw new RuntimeException("foo"); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/mapping/BeanWrapperFieldSetMapperTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/mapping/BeanWrapperFieldSetMapperTests.java index 8190b2a8a..998c5baa4 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/mapping/BeanWrapperFieldSetMapperTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/mapping/BeanWrapperFieldSetMapperTests.java @@ -24,7 +24,6 @@ import java.util.Properties; import junit.framework.TestCase; -import org.springframework.batch.io.file.FieldSet; import org.springframework.batch.io.file.mapping.BeanWrapperFieldSetMapper; import org.springframework.batch.io.file.mapping.BindingException; import org.springframework.batch.support.IntArrayPropertyEditor; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/transform/DelimitedLineTokenizerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/transform/DelimitedLineTokenizerTests.java index dfe9be666..74811dc86 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/transform/DelimitedLineTokenizerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/transform/DelimitedLineTokenizerTests.java @@ -18,7 +18,7 @@ package org.springframework.batch.io.file.transform; import junit.framework.TestCase; -import org.springframework.batch.io.file.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSet; import org.springframework.batch.io.file.transform.AbstractLineTokenizer; import org.springframework.batch.io.file.transform.DelimitedLineTokenizer; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/transform/FixedLengthTokenizerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/transform/FixedLengthTokenizerTests.java index dcb80576e..6fc194c6a 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/transform/FixedLengthTokenizerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/transform/FixedLengthTokenizerTests.java @@ -18,7 +18,7 @@ package org.springframework.batch.io.file.transform; import junit.framework.TestCase; -import org.springframework.batch.io.file.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSet; import org.springframework.batch.io.file.transform.FixedLengthTokenizer; import org.springframework.batch.io.file.transform.Range; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/transform/PrefixMatchingCompositeLineTokenizerTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/transform/PrefixMatchingCompositeLineTokenizerTests.java index 1a8f3e17e..3013b8f9e 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/transform/PrefixMatchingCompositeLineTokenizerTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/file/transform/PrefixMatchingCompositeLineTokenizerTests.java @@ -23,9 +23,8 @@ import java.util.Map; import junit.framework.TestCase; -import org.springframework.batch.io.file.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSet; import org.springframework.batch.io.file.transform.DelimitedLineTokenizer; -import org.springframework.batch.io.file.transform.LineTokenizer; import org.springframework.batch.io.file.transform.PrefixMatchingCompositeLineTokenizer; public class PrefixMatchingCompositeLineTokenizerTests extends TestCase { diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventReaderItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventReaderItemReaderTests.java index d27dedcca..60747f69f 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventReaderItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventReaderItemReaderTests.java @@ -15,8 +15,7 @@ import javax.xml.stream.events.XMLEvent; import junit.framework.TestCase; -import org.springframework.batch.io.xml.StaxEventReaderItemReader; -import org.springframework.batch.io.xml.stax.FragmentDeserializer; +import org.springframework.batch.io.xml.StaxEventItemReader; import org.springframework.batch.restart.GenericRestartData; import org.springframework.batch.restart.RestartData; import org.springframework.core.io.AbstractResource; @@ -26,14 +25,14 @@ import org.springframework.dao.DataAccessResourceFailureException; import org.springframework.transaction.support.TransactionSynchronization; /** - * Tests for {@link StaxEventReaderItemReader}. + * Tests for {@link StaxEventItemReader}. * * @author Robert Kasanicky */ public class StaxEventReaderItemReaderTests extends TestCase { // object under test - private StaxEventReaderItemReader source; + private StaxEventItemReader source; // test xml input private String xml = " testString "; @@ -258,13 +257,13 @@ public class StaxEventReaderItemReaderTests extends TestCase { private int extractRecordCountFrom(Properties statistics) { return Integer.valueOf( - source.getStatistics().getProperty(StaxEventReaderItemReader.READ_COUNT_STATISTICS_NAME)).intValue(); + source.getStatistics().getProperty(StaxEventItemReader.READ_COUNT_STATISTICS_NAME)).intValue(); } - private StaxEventReaderItemReader createNewInputSouce() { + private StaxEventItemReader createNewInputSouce() { Resource resource = new ByteArrayResource(xml.getBytes()); - StaxEventReaderItemReader newSource = new StaxEventReaderItemReader(); + StaxEventItemReader newSource = new StaxEventItemReader(); newSource.setResource(resource); newSource.setFragmentRootElementName(FRAGMENT_ROOT_ELEMENT); @@ -349,7 +348,7 @@ public class StaxEventReaderItemReaderTests extends TestCase { } - private static class MockStaxEventReaderItemReader extends StaxEventReaderItemReader { + private static class MockStaxEventReaderItemReader extends StaxEventItemReader { private boolean openCalled = false; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventWriterItemWriterTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventWriterItemWriterTests.java index 9cf0e92da..900262e6a 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventWriterItemWriterTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/StaxEventWriterItemWriterTests.java @@ -11,7 +11,7 @@ import javax.xml.transform.Result; import junit.framework.TestCase; import org.apache.commons.io.FileUtils; -import org.springframework.batch.io.xml.StaxEventWriterItemWriter; +import org.springframework.batch.io.xml.StaxEventItemWriter; import org.springframework.batch.io.xml.oxm.MarshallingObjectToXmlSerializer; import org.springframework.batch.restart.RestartData; import org.springframework.core.io.FileSystemResource; @@ -28,7 +28,7 @@ import org.springframework.xml.transform.StaxResult; public class StaxEventWriterItemWriterTests extends TestCase { // object under test - private StaxEventWriterItemWriter writer; + private StaxEventItemWriter writer; // output file private Resource resource; @@ -119,7 +119,7 @@ public class StaxEventWriterItemWriterTests extends TestCase { final int NUMBER_OF_RECORDS = 10; for (int i = 0; i < NUMBER_OF_RECORDS; i++) { String writeStatistics = - writer.getStatistics().getProperty(StaxEventWriterItemWriter.WRITE_STATISTICS_NAME); + writer.getStatistics().getProperty(StaxEventItemWriter.WRITE_STATISTICS_NAME); assertEquals(String.valueOf(i), writeStatistics); writer.write(record); @@ -188,8 +188,8 @@ public class StaxEventWriterItemWriterTests extends TestCase { /** * @return new instance of fully configured writer */ - private StaxEventWriterItemWriter createItemWriter() throws Exception { - StaxEventWriterItemWriter source = new StaxEventWriterItemWriter(); + private StaxEventItemWriter createItemWriter() throws Exception { + StaxEventItemWriter source = new StaxEventItemWriter(); source.setResource(resource); Marshaller marshaller = new SimpleMarshaller(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/stax/DefaultFragmentEventReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/stax/DefaultFragmentEventReaderTests.java index d49a80468..b3f810af5 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/stax/DefaultFragmentEventReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/stax/DefaultFragmentEventReaderTests.java @@ -12,7 +12,6 @@ import junit.framework.TestCase; import org.springframework.batch.io.xml.EventHelper; import org.springframework.batch.io.xml.stax.DefaultFragmentEventReader; import org.springframework.batch.io.xml.stax.DefaultTransactionalEventReader; -import org.springframework.batch.io.xml.stax.FragmentEventReader; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.Resource; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/stax/DefaultTransactionalEventReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/stax/DefaultTransactionalEventReaderTests.java index f15868289..b42534844 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/stax/DefaultTransactionalEventReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/io/xml/stax/DefaultTransactionalEventReaderTests.java @@ -7,7 +7,6 @@ import junit.framework.TestCase; import org.springframework.batch.io.xml.EventHelper; import org.springframework.batch.io.xml.stax.DefaultTransactionalEventReader; -import org.springframework.batch.io.xml.stax.TransactionalEventReader; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.Resource; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/provider/AggregateItemReaderTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/provider/AggregateItemReaderTests.java index 46d89814b..c3d245210 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/provider/AggregateItemReaderTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/item/provider/AggregateItemReaderTests.java @@ -6,7 +6,6 @@ import java.util.Iterator; import junit.framework.TestCase; import org.easymock.MockControl; -import org.springframework.batch.io.file.FieldSetMapper; import org.springframework.batch.item.ItemReader; public class AggregateItemReaderTests extends TestCase { @@ -30,11 +29,11 @@ public class AggregateItemReaderTests extends TestCase { //set-up mock input input.read(); - inputControl.setReturnValue(FieldSetMapper.BEGIN_RECORD); + inputControl.setReturnValue(AggregateItemReader.BEGIN_RECORD); input.read(); inputControl.setReturnValue("line",3); input.read(); - inputControl.setReturnValue(FieldSetMapper.END_RECORD); + inputControl.setReturnValue(AggregateItemReader.END_RECORD); input.read(); inputControl.setReturnValue(null); inputControl.replay(); diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/AbstractTradeBatchTests.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/AbstractTradeBatchTests.java index f6c92e6c0..a2c3f68f3 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/AbstractTradeBatchTests.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/AbstractTradeBatchTests.java @@ -18,9 +18,9 @@ package org.springframework.batch.repeat.support; import junit.framework.TestCase; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; import org.springframework.batch.io.file.SimpleFlatFileItemReader; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.item.ItemProcessor; import org.springframework.batch.item.provider.DelegatingItemReader; import org.springframework.core.io.ClassPathResource; diff --git a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/Trade.java b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/Trade.java index 5aead930e..8c5beec73 100644 --- a/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/Trade.java +++ b/spring-batch-infrastructure/src/test/java/org/springframework/batch/repeat/support/Trade.java @@ -18,7 +18,7 @@ package org.springframework.batch.repeat.support; import java.math.BigDecimal; -import org.springframework.batch.io.file.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSet; /** * @author Rob Harrop diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/io/oxm/AbstractStaxEventReaderItemReaderTests.java b/spring-batch-integration/src/test/java/org/springframework/batch/io/oxm/AbstractStaxEventReaderItemReaderTests.java index 8f5c37d00..f685c31e8 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/io/oxm/AbstractStaxEventReaderItemReaderTests.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/io/oxm/AbstractStaxEventReaderItemReaderTests.java @@ -7,7 +7,7 @@ import java.util.List; import junit.framework.TestCase; import org.springframework.batch.io.oxm.domain.Trade; -import org.springframework.batch.io.xml.StaxEventReaderItemReader; +import org.springframework.batch.io.xml.StaxEventItemReader; import org.springframework.batch.io.xml.oxm.UnmarshallingFragmentDeserializer; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.Resource; @@ -15,7 +15,7 @@ import org.springframework.oxm.Unmarshaller; public abstract class AbstractStaxEventReaderItemReaderTests extends TestCase { - private StaxEventReaderItemReader source = new StaxEventReaderItemReader(); + private StaxEventItemReader source = new StaxEventItemReader(); protected Resource resource = new ClassPathResource( "org/springframework/batch/io/oxm/input.xml"); diff --git a/spring-batch-integration/src/test/java/org/springframework/batch/io/oxm/AbstractStaxEventWriterItemWriterTests.java b/spring-batch-integration/src/test/java/org/springframework/batch/io/oxm/AbstractStaxEventWriterItemWriterTests.java index c10a637d3..bc77425ea 100644 --- a/spring-batch-integration/src/test/java/org/springframework/batch/io/oxm/AbstractStaxEventWriterItemWriterTests.java +++ b/spring-batch-integration/src/test/java/org/springframework/batch/io/oxm/AbstractStaxEventWriterItemWriterTests.java @@ -12,7 +12,7 @@ import junit.framework.TestCase; import org.custommonkey.xmlunit.XMLAssert; import org.custommonkey.xmlunit.XMLUnit; import org.springframework.batch.io.oxm.domain.Trade; -import org.springframework.batch.io.xml.StaxEventWriterItemWriter; +import org.springframework.batch.io.xml.StaxEventItemWriter; import org.springframework.batch.io.xml.oxm.MarshallingObjectToXmlSerializer; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.FileSystemResource; @@ -21,7 +21,7 @@ import org.springframework.oxm.Marshaller; public abstract class AbstractStaxEventWriterItemWriterTests extends TestCase { - private StaxEventWriterItemWriter writer = new StaxEventWriterItemWriter(); + private StaxEventItemWriter writer = new StaxEventItemWriter(); private Resource resource; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/FieldSetResultSetExtractor.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/FieldSetResultSetExtractor.java index 22e97352a..f3c5c0aed 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/FieldSetResultSetExtractor.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/FieldSetResultSetExtractor.java @@ -22,7 +22,7 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; -import org.springframework.batch.io.file.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSet; /** * ResultSetExtractor implementation that returns list of FieldSets diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/dao/FlatFileOrderWriter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/dao/FlatFileOrderWriter.java index 69e361a0d..8036129b8 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/dao/FlatFileOrderWriter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/dao/FlatFileOrderWriter.java @@ -16,7 +16,7 @@ package org.springframework.batch.sample.dao; -import org.springframework.batch.io.file.transform.Converter; +import org.springframework.batch.io.file.Converter; import org.springframework.batch.item.ItemWriter; import org.springframework.batch.sample.domain.Order; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/dao/OrderConverter.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/dao/OrderConverter.java index ab74f7f57..929f83935 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/dao/OrderConverter.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/dao/OrderConverter.java @@ -21,7 +21,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.springframework.batch.io.file.transform.Converter; +import org.springframework.batch.io.file.Converter; import org.springframework.batch.io.file.transform.LineAggregator; import org.springframework.batch.sample.domain.Address; import org.springframework.batch.sample.domain.BillingInfo; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/provider/OrderItemReader.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/provider/OrderItemReader.java index d8881a460..27ac45cc4 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/provider/OrderItemReader.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/item/provider/OrderItemReader.java @@ -22,8 +22,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.batch.core.configuration.StepConfiguration; import org.springframework.batch.core.domain.StepExecution; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.provider.AbstractItemReader; import org.springframework.batch.item.validator.Validator; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/AddressFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/AddressFieldSetMapper.java index 286aa6afe..2c3d8e7d9 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/AddressFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/AddressFieldSetMapper.java @@ -16,8 +16,8 @@ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.sample.domain.Address; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/BillingFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/BillingFieldSetMapper.java index b9899ae03..87c4da93f 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/BillingFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/BillingFieldSetMapper.java @@ -16,8 +16,8 @@ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.sample.domain.BillingInfo; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/CustomerFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/CustomerFieldSetMapper.java index 3e2aa019e..6e174c308 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/CustomerFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/CustomerFieldSetMapper.java @@ -16,8 +16,8 @@ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.sample.domain.Customer; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/GameMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/GameMapper.java index 176b757a8..568fa7616 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/GameMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/GameMapper.java @@ -1,7 +1,7 @@ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.sample.domain.Game; public class GameMapper implements FieldSetMapper { diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/HeaderFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/HeaderFieldSetMapper.java index 2c3d45bce..6bb809440 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/HeaderFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/HeaderFieldSetMapper.java @@ -16,8 +16,8 @@ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.sample.domain.Order; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/OrderItemFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/OrderItemFieldSetMapper.java index 15fc5ec04..794c7677a 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/OrderItemFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/OrderItemFieldSetMapper.java @@ -16,8 +16,8 @@ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.sample.domain.LineItem; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/PassThroughFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/PassThroughFieldSetMapper.java index 653bd9e91..44c8d5a3b 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/PassThroughFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/PassThroughFieldSetMapper.java @@ -15,8 +15,8 @@ */ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; /** * Pass through {@link FieldSetMapper} useful for diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/PlayerMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/PlayerMapper.java index 353089e60..5bf65ffa0 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/PlayerMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/PlayerMapper.java @@ -1,7 +1,7 @@ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.sample.domain.Player; public class PlayerMapper implements FieldSetMapper { diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/ShippingFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/ShippingFieldSetMapper.java index 23fdb6f1e..59c06a898 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/ShippingFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/ShippingFieldSetMapper.java @@ -16,8 +16,8 @@ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.sample.domain.ShippingInfo; diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/TradeFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/TradeFieldSetMapper.java index 88522e56a..0ab3c18d9 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/TradeFieldSetMapper.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/mapping/TradeFieldSetMapper.java @@ -16,8 +16,9 @@ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; +import org.springframework.batch.item.provider.AggregateItemReader; import org.springframework.batch.sample.domain.Trade; @@ -32,11 +33,11 @@ public class TradeFieldSetMapper implements FieldSetMapper { public Object mapLine(FieldSet fieldSet) { if ("BEGIN".equals(fieldSet.readString(0))) { - return FieldSetMapper.BEGIN_RECORD; + return AggregateItemReader.BEGIN_RECORD; } if ("END".equals(fieldSet.readString(0))) { - return FieldSetMapper.END_RECORD; + return AggregateItemReader.END_RECORD; } Trade trade = new Trade(); diff --git a/spring-batch-samples/src/main/resources/jobs/xmlStaxJob.xml b/spring-batch-samples/src/main/resources/jobs/xmlStaxJob.xml index 2b4829352..3c769192d 100644 --- a/spring-batch-samples/src/main/resources/jobs/xmlStaxJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/xmlStaxJob.xml @@ -22,7 +22,7 @@ class="org.springframework.batch.execution.tasklet.RestartableItemOrientedTasklet"> diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/FixedLengthImportJobFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/FixedLengthImportJobFunctionalTests.java index fb881760c..e18191c0c 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/FixedLengthImportJobFunctionalTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/FixedLengthImportJobFunctionalTests.java @@ -48,15 +48,22 @@ public class FixedLengthImportJobFunctionalTests extends AbstractValidatingBatch /** * check that records have been correctly written to database + * @throws Exception */ - protected void validatePostConditions() { + protected void validatePostConditions() throws Exception { inputSource.open(); jdbcTemplate.query("SELECT ID, ISIN, QUANTITY, PRICE, CUSTOMER FROM trade ORDER BY id", new RowCallbackHandler() { public void processRow(ResultSet rs) throws SQLException { - Trade trade = (Trade)inputSource.read(); + Trade trade; + try { + trade = (Trade)inputSource.read(); + } + catch (Exception e) { + throw new IllegalStateException(e); + } assertEquals(trade.getIsin(), rs.getString(2)); assertEquals(trade.getQuantity(),rs.getLong(3)); assertEquals(trade.getPrice(), rs.getBigDecimal(4)); diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/provider/OrderItemReaderTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/provider/OrderItemReaderTests.java index 813dee49a..9c9f6127f 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/provider/OrderItemReaderTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/item/provider/OrderItemReaderTests.java @@ -5,8 +5,8 @@ import java.util.Iterator; import junit.framework.TestCase; import org.easymock.MockControl; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.validator.Validator; import org.springframework.batch.sample.domain.Address; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/AbstractFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/AbstractFieldSetMapperTests.java index 66d6130af..bc2972d7f 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/AbstractFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/AbstractFieldSetMapperTests.java @@ -1,7 +1,7 @@ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import junit.framework.TestCase; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/AddressFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/AddressFieldSetMapperTests.java index 09ed96511..907649e9c 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/AddressFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/AddressFieldSetMapperTests.java @@ -1,7 +1,7 @@ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.sample.domain.Address; import org.springframework.batch.sample.mapping.AddressFieldSetMapper; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/BillingFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/BillingFieldSetMapperTests.java index a3c37f974..e4370dc8d 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/BillingFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/BillingFieldSetMapperTests.java @@ -1,7 +1,7 @@ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.sample.domain.BillingInfo; import org.springframework.batch.sample.mapping.BillingFieldSetMapper; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/CustomerFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/CustomerFieldSetMapperTests.java index 5fa711806..708c2113e 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/CustomerFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/CustomerFieldSetMapperTests.java @@ -1,7 +1,7 @@ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.sample.domain.Customer; import org.springframework.batch.sample.mapping.CustomerFieldSetMapper; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/HeaderFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/HeaderFieldSetMapperTests.java index 6d3c2733a..4895e938c 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/HeaderFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/HeaderFieldSetMapperTests.java @@ -2,8 +2,8 @@ package org.springframework.batch.sample.mapping; import java.util.Calendar; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.sample.domain.Order; import org.springframework.batch.sample.mapping.HeaderFieldSetMapper; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/OrderItemFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/OrderItemFieldSetMapperTests.java index 5005fc560..e9512e011 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/OrderItemFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/OrderItemFieldSetMapperTests.java @@ -2,8 +2,8 @@ package org.springframework.batch.sample.mapping; import java.math.BigDecimal; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.sample.domain.LineItem; import org.springframework.batch.sample.mapping.OrderItemFieldSetMapper; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/ShippingFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/ShippingFieldSetMapperTests.java index 526d621b4..d7b3af4e5 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/ShippingFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/ShippingFieldSetMapperTests.java @@ -1,7 +1,7 @@ package org.springframework.batch.sample.mapping; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; import org.springframework.batch.sample.domain.ShippingInfo; import org.springframework.batch.sample.mapping.ShippingFieldSetMapper; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/TradeFieldSetMapperTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/TradeFieldSetMapperTests.java index 0d1a1c477..25f1a2373 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/TradeFieldSetMapperTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/mapping/TradeFieldSetMapperTests.java @@ -2,8 +2,9 @@ package org.springframework.batch.sample.mapping; import java.math.BigDecimal; -import org.springframework.batch.io.file.FieldSet; -import org.springframework.batch.io.file.FieldSetMapper; +import org.springframework.batch.io.file.mapping.FieldSet; +import org.springframework.batch.io.file.mapping.FieldSetMapper; +import org.springframework.batch.item.provider.AggregateItemReader; import org.springframework.batch.sample.domain.Trade; import org.springframework.batch.sample.mapping.TradeFieldSetMapper; @@ -38,11 +39,11 @@ public class TradeFieldSetMapperTests extends AbstractFieldSetMapperTests{ } public void testBeginRecord() throws Exception { - assertEquals(FieldSetMapper.BEGIN_RECORD, fieldSetMapper().mapLine(new FieldSet(new String[] {"BEGIN"}))); + assertEquals(AggregateItemReader.BEGIN_RECORD, fieldSetMapper().mapLine(new FieldSet(new String[] {"BEGIN"}))); } public void testEndRecord() throws Exception { - assertEquals(FieldSetMapper.END_RECORD, fieldSetMapper().mapLine(new FieldSet(new String[] {"END"}))); + assertEquals(AggregateItemReader.END_RECORD, fieldSetMapper().mapLine(new FieldSet(new String[] {"END"}))); } }