diff --git a/spring-batch-samples/.springBeans b/spring-batch-samples/.springBeans
index 49a0d166a..ac5980a3c 100644
--- a/spring-batch-samples/.springBeans
+++ b/spring-batch-samples/.springBeans
@@ -18,7 +18,6 @@
src/main/resources/jobs/adhocLoopJob.xmlsrc/main/resources/jobs/infiniteLoopJob.xmlsrc/main/resources/data-source-context-init.xml
- src/main/resources/jobs/xmlStaxJob.xmlsrc/main/resources/jobs/hibernateJob.xmlsrc/main/resources/jobs/ibatisJob.xmlsrc/main/resources/jobs/footballJob.xml
@@ -34,7 +33,6 @@
src/main/resources/jobs/multilineOrderInputTokenizers.xmlsrc/main/resources/jobs/multilineOrderOutputAggregators.xmlsrc/main/resources/jobs/compositeItemWriterSampleJob.xml
- src/main/resources/jobs/multiResourceJob.xmlsrc/main/resources/hibernate-context.xmlsrc/main/resources/staging-test-context.xmlsrc/main/resources/org/springframework/batch/sample/config/common-context.xml
@@ -186,7 +184,6 @@
src/main/resources/data-source-context.xmlsrc/main/resources/data-source-context-init.xml
- src/main/resources/jobs/xmlStaxJob.xmlsrc/main/resources/simple-job-launcher-context.xmlsrc/main/resources/org/springframework/batch/sample/config/common-context.xml
@@ -261,7 +258,6 @@
src/main/resources/data-source-context.xmlsrc/main/resources/data-source-context-init.xml
- src/main/resources/jobs/multiResourceJob.xmlsrc/main/resources/simple-job-launcher-context.xmlsrc/main/resources/org/springframework/batch/sample/config/common-context.xml
diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerCredit.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerCredit.java
index 6750cc230..38bd5d166 100644
--- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerCredit.java
+++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/CustomerCredit.java
@@ -23,8 +23,17 @@ public class CustomerCredit {
private int id;
private String name;
private BigDecimal credit;
+
+ public CustomerCredit(){
+ }
+
+ public CustomerCredit(int id, String name, BigDecimal credit){
+ this.id = id;
+ this.name = name;
+ this.credit = credit;
+ }
- public String toString() {
+ public String toString() {
return "CustomerCredit [id=" + id +",name=" + name + ", credit=" + credit + "]";
}
diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditFieldSetMapper.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditFieldSetMapper.java
new file mode 100644
index 000000000..e4a9eec8b
--- /dev/null
+++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/trade/internal/CustomerCreditFieldSetMapper.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.sample.domain.trade.internal;
+
+import org.springframework.batch.item.file.mapping.FieldSet;
+import org.springframework.batch.item.file.mapping.FieldSetMapper;
+import org.springframework.batch.sample.domain.trade.CustomerCredit;
+
+/**
+ * @author Dan Garrette
+ * @since 2.0
+ */
+public class CustomerCreditFieldSetMapper implements FieldSetMapper {
+
+ public static final int ID_COLUMN = 0;
+ public static final int NAME_COLUMN = 1;
+ public static final int CREDIT_COLUMN = 2;
+
+ public CustomerCredit mapFieldSet(FieldSet fieldSet) {
+
+ CustomerCredit trade = new CustomerCredit();
+ trade.setId(fieldSet.readInt(ID_COLUMN));
+ trade.setName(fieldSet.readString(NAME_COLUMN));
+ trade.setCredit(fieldSet.readBigDecimal(CREDIT_COLUMN));
+
+ return trade;
+ }
+}
diff --git a/spring-batch-samples/src/main/resources/data/iosample/input/delimited.csv b/spring-batch-samples/src/main/resources/data/iosample/input/delimited.csv
new file mode 100644
index 000000000..a39b2d4b8
--- /dev/null
+++ b/spring-batch-samples/src/main/resources/data/iosample/input/delimited.csv
@@ -0,0 +1,6 @@
+UK21341EAH45,978,98.34,customer1
+UK21341EAH46,112,18.12,customer2
+UK21341EAH47,245,12.78,customer3
+UK21341EAH48,108,109.25,customer4
+UK21341EAH49,854,123.39,customer5
+UK21341EAH50,234,32.45,customer6
diff --git a/spring-batch-samples/src/main/resources/data/iosample/input/delimited2.csv b/spring-batch-samples/src/main/resources/data/iosample/input/delimited2.csv
new file mode 100644
index 000000000..d1d68d574
--- /dev/null
+++ b/spring-batch-samples/src/main/resources/data/iosample/input/delimited2.csv
@@ -0,0 +1,2 @@
+UK21341EAH51,643,594.23,customer7
+UK21341EAH52,393,65.21,customer8
diff --git a/spring-batch-samples/src/main/resources/data/iosample/input/fixedLength.txt b/spring-batch-samples/src/main/resources/data/iosample/input/fixedLength.txt
new file mode 100644
index 000000000..c31971514
--- /dev/null
+++ b/spring-batch-samples/src/main/resources/data/iosample/input/fixedLength.txt
@@ -0,0 +1,6 @@
+UK21341EAH45978 98.34customer1
+UK21341EAH46112 18.12customer2
+UK21341EAH47245 12.78customer3
+UK21341EAH48108109.25customer4
+UK21341EAH49854123.39customer5
+UK21341EAH50234 32.45customer6
diff --git a/spring-batch-samples/src/main/resources/data/iosample/input/input.xml b/spring-batch-samples/src/main/resources/data/iosample/input/input.xml
new file mode 100644
index 000000000..8330402e8
--- /dev/null
+++ b/spring-batch-samples/src/main/resources/data/iosample/input/input.xml
@@ -0,0 +1,39 @@
+
+
+
+ UK21341EAH45
+ 978
+ 98.34
+ customer1
+
+
+ UK21341EAH46
+ 112
+ 18.12
+ customer2
+
+
+ UK21341EAH47
+ 245
+ 12.78
+ customer3
+
+
+ UK21341EAH48
+ 108
+ 109.25
+ customer4
+
+
+ UK21341EAH49
+ 854
+ 123.39
+ customer5
+
+
+ UK21341EAH50
+ 234
+ 32.45
+ customer6
+
+
diff --git a/spring-batch-samples/src/main/resources/data/iosample/input/multiLine.txt b/spring-batch-samples/src/main/resources/data/iosample/input/multiLine.txt
new file mode 100644
index 000000000..96f8db03e
--- /dev/null
+++ b/spring-batch-samples/src/main/resources/data/iosample/input/multiLine.txt
@@ -0,0 +1,24 @@
+BEGIN
+INFO,UK21341EAH45,customer1
+AMNT,978,98.34
+END
+BEGIN
+INFO,UK21341EAH46,customer2
+AMNT,112,18.12
+END
+BEGIN
+INFO,UK21341EAH47,customer3
+AMNT,245,12.78
+END
+BEGIN
+INFO,UK21341EAH48,customer4
+AMNT,108,109.25
+END
+BEGIN
+INFO,UK21341EAH49,customer5
+AMNT,854,123.39
+END
+BEGIN
+INFO,UK21341EAH50,customer6
+AMNT,234,32.45
+END
diff --git a/spring-batch-samples/src/main/resources/data/iosample/input/multiRecordType.txt b/spring-batch-samples/src/main/resources/data/iosample/input/multiRecordType.txt
new file mode 100644
index 000000000..2ca8d4a76
--- /dev/null
+++ b/spring-batch-samples/src/main/resources/data/iosample/input/multiRecordType.txt
@@ -0,0 +1,12 @@
+CUST42001customer100012000
+CUST42002customer200022000
+CUST42003customer300032000
+TRADUK21341EAH45978 98.34customer1
+TRADUK21341EAH46112 18.12customer2
+CUST42004customer400042000
+CUST42005customer500052000
+TRADUK21341EAH47245 12.78customer3
+TRADUK21341EAH48108109.25customer4
+TRADUK21341EAH49854123.39customer5
+CUST42006customer600062000
+TRADUK21341EAH50234 32.45customer6
diff --git a/spring-batch-samples/src/main/resources/jobs/ioSampleJob.xml b/spring-batch-samples/src/main/resources/jobs/ioSampleJob.xml
new file mode 100644
index 000000000..39237c544
--- /dev/null
+++ b/spring-batch-samples/src/main/resources/jobs/ioSampleJob.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-batch-samples/src/main/resources/jobs/iosample/delimited.xml b/spring-batch-samples/src/main/resources/jobs/iosample/delimited.xml
new file mode 100644
index 000000000..a38f98f8b
--- /dev/null
+++ b/spring-batch-samples/src/main/resources/jobs/iosample/delimited.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-batch-samples/src/main/resources/jobs/iosample/fixedLength.xml b/spring-batch-samples/src/main/resources/jobs/iosample/fixedLength.xml
new file mode 100644
index 000000000..815b9f8ac
--- /dev/null
+++ b/spring-batch-samples/src/main/resources/jobs/iosample/fixedLength.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-batch-samples/src/main/resources/jobs/iosample/jdbcCursor.xml b/spring-batch-samples/src/main/resources/jobs/iosample/jdbcCursor.xml
new file mode 100644
index 000000000..e83ce038f
--- /dev/null
+++ b/spring-batch-samples/src/main/resources/jobs/iosample/jdbcCursor.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-batch-samples/src/main/resources/jobs/iosample/multiLine.xml b/spring-batch-samples/src/main/resources/jobs/iosample/multiLine.xml
new file mode 100644
index 000000000..53f3e435a
--- /dev/null
+++ b/spring-batch-samples/src/main/resources/jobs/iosample/multiLine.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-batch-samples/src/main/resources/jobs/iosample/multiRecordType.xml b/spring-batch-samples/src/main/resources/jobs/iosample/multiRecordType.xml
new file mode 100644
index 000000000..da6ad91d3
--- /dev/null
+++ b/spring-batch-samples/src/main/resources/jobs/iosample/multiRecordType.xml
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-batch-samples/src/main/resources/jobs/iosample/multiResource.xml b/spring-batch-samples/src/main/resources/jobs/iosample/multiResource.xml
new file mode 100644
index 000000000..2cfedd7c8
--- /dev/null
+++ b/spring-batch-samples/src/main/resources/jobs/iosample/multiResource.xml
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-batch-samples/src/main/resources/jobs/iosample/xml.xml b/spring-batch-samples/src/main/resources/jobs/iosample/xml.xml
new file mode 100644
index 000000000..c3eef37e9
--- /dev/null
+++ b/spring-batch-samples/src/main/resources/jobs/iosample/xml.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/SkipSampleFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/SkipSampleFunctionalTests.java
index 94373d524..137c21743 100644
--- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/SkipSampleFunctionalTests.java
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/SkipSampleFunctionalTests.java
@@ -153,9 +153,6 @@ public class SkipSampleFunctionalTests {
assertTrue(!execution1.get("JOB_INSTANCE_ID").equals(execution2.get("JOB_INSTANCE_ID")));
}
- /**
- *
- */
private void validateLaunchWithSkips() {
// Step1: 5 input records, 1 skipped => 4 written to output
assertEquals(4, SimpleJdbcTestUtils.countRowsInTable(simpleJdbcTemplate, "TRADE"));
@@ -163,12 +160,6 @@ public class SkipSampleFunctionalTests {
// Step2: 4 input records, 1 skipped => 3 written to output
assertEquals(3, itemTrackingWriter.getItems().size());
- for(Object o : simpleJdbcTemplate.queryForList(
- "SELECT * from ERROR_LOG"))
- {
- System.err.println("DHG > "+o);
- }
-
// Both steps contained skips
assertEquals(2, SimpleJdbcTestUtils.countRowsInTable(simpleJdbcTemplate, "ERROR_LOG"));
assertEquals(1, simpleJdbcTemplate.queryForInt(
@@ -177,9 +168,6 @@ public class SkipSampleFunctionalTests {
"SELECT Count(*) from ERROR_LOG where JOB_NAME = ? and STEP_NAME = ?", "skipJob", "step2"));
}
- /**
- *
- */
private void validateLaunchWithoutSkips() {
// Step1: 5 input records => 5 written to output
assertEquals(5, SimpleJdbcTestUtils.countRowsInTable(simpleJdbcTemplate, "TRADE"));
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/DelimitedFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/DelimitedFunctionalTests.java
new file mode 100644
index 000000000..4832170c5
--- /dev/null
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/DelimitedFunctionalTests.java
@@ -0,0 +1,47 @@
+/*
+ * 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.sample.iosample;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.batch.test.AbstractJobTests;
+import org.springframework.batch.test.AssertFile;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * @author Dan Garrette
+ * @since 2.0
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = { "/simple-job-launcher-context.xml", "/jobs/ioSampleJob.xml",
+ "/jobs/ioSample/delimited.xml" })
+public class DelimitedFunctionalTests extends AbstractJobTests {
+
+ private static final String OUTPUT_FILE = "target/test-outputs/delimitedOutput.csv";
+ private static final String INPUT_FILE = "src/main/resources/data/ioSample/input/delimited.csv";
+
+ /**
+ * Output should be the same as input
+ */
+ @Test
+ public void testJob() throws Exception {
+ this.launchJob();
+ AssertFile.assertFileEquals(new FileSystemResource(OUTPUT_FILE), new FileSystemResource(INPUT_FILE));
+ }
+}
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/FixedLengthFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/FixedLengthFunctionalTests.java
new file mode 100644
index 000000000..c4802abca
--- /dev/null
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/FixedLengthFunctionalTests.java
@@ -0,0 +1,43 @@
+/*
+ * 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.sample.iosample;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.batch.test.AbstractJobTests;
+import org.springframework.batch.test.AssertFile;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = { "/simple-job-launcher-context.xml", "/jobs/ioSampleJob.xml",
+ "/jobs/ioSample/fixedLength.xml" })
+public class FixedLengthFunctionalTests extends AbstractJobTests {
+
+ private static final String OUTPUT_FILE = "target/test-outputs/fixedLengthOutput.txt";
+ private static final String INPUT_FILE = "src/main/resources/data/ioSample/input/fixedLength.txt";
+
+ /**
+ * Output should be the same as input
+ */
+ @Test
+ public void testJob() throws Exception {
+ this.launchJob();
+ AssertFile.assertFileEquals(new FileSystemResource(OUTPUT_FILE), new FileSystemResource(INPUT_FILE));
+ }
+}
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/JdbcCursorFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/JdbcCursorFunctionalTests.java
new file mode 100644
index 000000000..d44922c17
--- /dev/null
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/JdbcCursorFunctionalTests.java
@@ -0,0 +1,63 @@
+/*
+ * 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.sample.iosample;
+
+import static org.junit.Assert.assertEquals;
+
+import javax.sql.DataSource;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.batch.test.AbstractJobTests;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.simple.SimpleJdbcTemplate;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.jdbc.SimpleJdbcTestUtils;
+
+/**
+ * @author Dan Garrette
+ * @since 2.0
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = { "/simple-job-launcher-context.xml", "/jobs/ioSampleJob.xml",
+ "/jobs/ioSample/jdbcCursor.xml" })
+public class JdbcCursorFunctionalTests extends AbstractJobTests {
+
+ private SimpleJdbcTemplate simpleJdbcTemplate;
+
+ @Autowired
+ public void setDataSource(DataSource dataSource) {
+ this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource);
+ }
+
+ /**
+ * Output should be the same as input
+ */
+ @Test
+ public void testJob() throws Exception {
+ this.simpleJdbcTemplate.update("delete from TRADE");
+
+ this.launchJob();
+
+ assertEquals(4, SimpleJdbcTestUtils.countRowsInTable(simpleJdbcTemplate, "TRADE"));
+ for (int i = 1; i <= 4; i++) {
+ String sql = "select count(*) from TRADE where CUSTOMER = ?";
+ assertEquals(1, simpleJdbcTemplate.queryForInt(sql, "customer" + i));
+ }
+ }
+}
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/MultiLineFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/MultiLineFunctionalTests.java
new file mode 100644
index 000000000..d016cf771
--- /dev/null
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/MultiLineFunctionalTests.java
@@ -0,0 +1,47 @@
+/*
+ * 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.sample.iosample;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.batch.test.AbstractJobTests;
+import org.springframework.batch.test.AssertFile;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * @author Dan Garrette
+ * @since 2.0
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = { "/simple-job-launcher-context.xml", "/jobs/ioSampleJob.xml",
+ "/jobs/ioSample/multiLine.xml" })
+public class MultiLineFunctionalTests extends AbstractJobTests {
+
+ private static final String OUTPUT_FILE = "target/test-outputs/multiLineOutput.txt";
+ private static final String INPUT_FILE = "src/main/resources/data/ioSample/input/multiLine.txt";
+
+ /**
+ * Output should be the same as input
+ */
+ @Test
+ public void testJob() throws Exception {
+ this.launchJob();
+ AssertFile.assertFileEquals(new FileSystemResource(OUTPUT_FILE), new FileSystemResource(INPUT_FILE));
+ }
+}
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/MultiRecordTypeFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/MultiRecordTypeFunctionalTests.java
new file mode 100644
index 000000000..372ebd914
--- /dev/null
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/MultiRecordTypeFunctionalTests.java
@@ -0,0 +1,47 @@
+/*
+ * 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.sample.iosample;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.batch.test.AbstractJobTests;
+import org.springframework.batch.test.AssertFile;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * @author Dan Garrette
+ * @since 2.0
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = { "/simple-job-launcher-context.xml", "/jobs/ioSampleJob.xml",
+ "/jobs/ioSample/multiRecordType.xml" })
+public class MultiRecordTypeFunctionalTests extends AbstractJobTests {
+
+ private static final String OUTPUT_FILE = "target/test-outputs/multiRecordTypeOutput.txt";
+ private static final String INPUT_FILE = "src/main/resources/data/ioSample/input/multiRecordType.txt";
+
+ /**
+ * Output should be the same as input
+ */
+ @Test
+ public void testJob() throws Exception {
+ this.launchJob();
+ AssertFile.assertFileEquals(new FileSystemResource(OUTPUT_FILE), new FileSystemResource(INPUT_FILE));
+ }
+}
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/MultiResourceFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/MultiResourceFunctionalTests.java
new file mode 100644
index 000000000..5552c1afb
--- /dev/null
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/MultiResourceFunctionalTests.java
@@ -0,0 +1,48 @@
+/*
+ * 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.sample.iosample;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.batch.test.AbstractJobTests;
+import org.springframework.batch.test.AssertFile;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * @author Dan Garrette
+ * @since 2.0
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = { "/simple-job-launcher-context.xml", "/jobs/ioSampleJob.xml",
+ "/jobs/ioSample/multiResource.xml" })
+public class MultiResourceFunctionalTests extends AbstractJobTests {
+
+ /**
+ * Output should be the same as input
+ */
+ @Test
+ public void testJob() throws Exception {
+ this.launchJob();
+
+ AssertFile.assertFileEquals(new FileSystemResource("target/test-outputs/multiResourceOutput.csv.1"),
+ new FileSystemResource("src/main/resources/data/ioSample/input/delimited.csv"));
+ AssertFile.assertFileEquals(new FileSystemResource("target/test-outputs/multiResourceOutput.csv.2"),
+ new FileSystemResource("src/main/resources/data/ioSample/input/delimited2.csv"));
+ }
+}
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/XmlFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/XmlFunctionalTests.java
new file mode 100644
index 000000000..c4d423980
--- /dev/null
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/XmlFunctionalTests.java
@@ -0,0 +1,50 @@
+/*
+ * 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.sample.iosample;
+
+import java.io.FileReader;
+
+import org.custommonkey.xmlunit.XMLAssert;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.batch.test.AbstractJobTests;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+
+/**
+ * @author Dan Garrette
+ * @since 2.0
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(locations = { "/simple-job-launcher-context.xml", "/jobs/ioSampleJob.xml",
+ "/jobs/ioSample/xml.xml" })
+public class XmlFunctionalTests extends AbstractJobTests {
+
+ private static final String OUTPUT_FILE = "target/test-outputs/output.xml";
+ private static final String INPUT_FILE = "src/main/resources/data/ioSample/input/input.xml";
+
+ /**
+ * Output should be the same as input
+ */
+ @Test
+ public void testJob() throws Exception {
+ this.launchJob();
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLAssert.assertXMLEqual(new FileReader(INPUT_FILE), new FileReader(OUTPUT_FILE));
+ }
+}
diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/internal/DelegatingTradeLineAggregator.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/internal/DelegatingTradeLineAggregator.java
new file mode 100644
index 000000000..2ee5cd3df
--- /dev/null
+++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/iosample/internal/DelegatingTradeLineAggregator.java
@@ -0,0 +1,50 @@
+/*
+ * 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.sample.iosample.internal;
+
+import org.springframework.batch.item.file.transform.LineAggregator;
+import org.springframework.batch.sample.domain.trade.CustomerCredit;
+import org.springframework.batch.sample.domain.trade.Trade;
+
+/**
+ * @author Dan Garrette
+ * @since 2.0
+ */
+public class DelegatingTradeLineAggregator implements LineAggregator