IN PROGRESS - issue BATCH-267: Re-organise I/O (io) packages
http://jira.springframework.org/browse/BATCH-267 Remove package cycles
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
class="org.springframework.batch.execution.tasklet.RestartableItemOrientedTasklet">
|
||||
<property name="itemReader">
|
||||
<bean
|
||||
class="org.springframework.batch.io.xml.StaxEventReaderItemReader"
|
||||
class="org.springframework.batch.io.xml.StaxEventItemReader"
|
||||
scope="step">
|
||||
<aop:scoped-proxy />
|
||||
<property name="fragmentRootElementName"
|
||||
@@ -56,7 +56,7 @@
|
||||
</bean>
|
||||
|
||||
<bean
|
||||
class="org.springframework.batch.io.xml.StaxEventWriterItemWriter"
|
||||
class="org.springframework.batch.io.xml.StaxEventItemWriter"
|
||||
id="tradeStaxWriter">
|
||||
<property name="resource"
|
||||
value="file:target/test-outputs/20070918.testStream.xmlFileStep.output.xml" />
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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"})));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user