diff --git a/spring-batch-samples/.springBeans b/spring-batch-samples/.springBeans index 77ce05a70..99c64a722 100644 --- a/spring-batch-samples/.springBeans +++ b/spring-batch-samples/.springBeans @@ -38,8 +38,6 @@ src/main/resources/jobs/customerFilterJob.xml src/main/resources/skipSample-job-launcher-context.xml src/main/resources/jobs/ioSampleJob.xml - src/main/resources/jobs/multiResourceJob.xml - src/main/resources/jobs/xmlStaxJob.xml src/main/resources/jobs/iosample/delimited.xml src/main/resources/jobs/iosample/fixedLength.xml src/main/resources/jobs/iosample/jdbcCursor.xml @@ -48,6 +46,7 @@ src/main/resources/jobs/iosample/multiResource.xml src/main/resources/jobs/iosample/xml.xml src/main/resources/jobs/iosample/hibernate.xml + src/main/resources/jobs/hibernateJob.xml @@ -186,17 +185,6 @@ src/main/resources/org/springframework/batch/sample/config/common-context.xml - - - true - false - - src/main/resources/data-source-context.xml - src/main/resources/data-source-context-init.xml - src/main/resources/simple-job-launcher-context.xml - src/main/resources/org/springframework/batch/sample/config/common-context.xml - - true @@ -219,19 +207,6 @@ src/main/resources/org/springframework/batch/sample/config/common-context.xml - - - true - false - - src/main/resources/data-source-context.xml - src/main/resources/jobs/skipSampleJob.xml - src/main/resources/simple-job-launcher-context.xml - src/main/resources/org/springframework/batch/sample/config/common-context.xml - src/main/resources/data-source-context-init.xml - src/main/resources/jobs/tradeJobIo.xml - - true @@ -259,17 +234,6 @@ src/main/resources/jobs/compositeItemWriterSampleJob.xml - - - true - false - - src/main/resources/data-source-context.xml - src/main/resources/data-source-context-init.xml - src/main/resources/simple-job-launcher-context.xml - src/main/resources/org/springframework/batch/sample/config/common-context.xml - - true @@ -281,17 +245,6 @@ src/main/resources/org/springframework/batch/sample/config/common-context.xml - - - true - false - - src/main/resources/data-source-context.xml - src/main/resources/simple-job-launcher-context.xml - src/main/resources/org/springframework/batch/sample/config/common-context.xml - src/main/resources/hibernate-context.xml - - true @@ -390,5 +343,92 @@ src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/hibernate-context.xml + src/main/resources/jobs/hibernateJob.xml + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/data-source-context-init.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/jobs/skipSampleJob.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/data-source-context-init.xml + src/main/resources/jobs/tradeJobIo.xml + src/main/resources/skipSample-job-launcher-context.xml + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/data-source-context-init.xml + src/main/resources/jobs/ioSampleJob.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/simple-job-launcher-context.xml + src/main/resources/hibernate-context.xml + src/main/resources/jobs/iosample/hibernate.xml + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/data-source-context-init.xml + src/main/resources/jobs/iosample/jdbcCursor.xml + src/main/resources/jobs/ioSampleJob.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/simple-job-launcher-context.xml + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/data-source-context-init.xml + src/main/resources/jobs/iosample/multiLine.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/simple-job-launcher-context.xml + + + + + true + false + + src/main/resources/data-source-context.xml + src/main/resources/data-source-context-init.xml + src/main/resources/jobs/iosample/multiRecordType.xml + src/main/resources/org/springframework/batch/sample/config/common-context.xml + src/main/resources/simple-job-launcher-context.xml + + diff --git a/spring-batch-samples/src/main/resources/jobs/multiResourceJob.xml b/spring-batch-samples/src/main/resources/jobs/multiResourceJob.xml deleted file mode 100644 index ac7599c59..000000000 --- a/spring-batch-samples/src/main/resources/jobs/multiResourceJob.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-samples/src/main/resources/jobs/xmlStaxJob.xml b/spring-batch-samples/src/main/resources/jobs/xmlStaxJob.xml deleted file mode 100644 index 1746685fa..000000000 --- a/spring-batch-samples/src/main/resources/jobs/xmlStaxJob.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/MultiResourceJobFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/MultiResourceJobFunctionalTests.java deleted file mode 100644 index 526e651ab..000000000 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/MultiResourceJobFunctionalTests.java +++ /dev/null @@ -1,113 +0,0 @@ -package org.springframework.batch.sample; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; - -import javax.sql.DataSource; - -import static org.junit.Assert.*; - -import org.junit.Before; -import org.junit.runner.RunWith; -import org.springframework.batch.core.Job; -import org.springframework.batch.item.ExecutionContext; -import org.springframework.batch.item.file.FlatFileItemReader; -import org.springframework.batch.item.file.mapping.DefaultLineMapper; -import org.springframework.batch.item.file.mapping.FieldSetMapper; -import org.springframework.batch.item.file.transform.LineTokenizer; -import org.springframework.batch.sample.domain.trade.Trade; -import org.springframework.batch.sample.domain.trade.internal.TradeFieldSetMapper; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; -import org.springframework.jdbc.core.simple.SimpleJdbcTemplate; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration() -public class MultiResourceJobFunctionalTests extends AbstractValidatingBatchLauncherTests { - - // expected line length in input file (sum of pattern lengths + 2, because - // the counter is appended twice) - private static final int LINE_LENGTH = 29; - - // auto-injected attributes - private SimpleJdbcTemplate simpleJdbcTemplate; - private Resource fileLocator; - protected FlatFileItemReader itemReader; - private LineTokenizer lineTokenizer; - - @Autowired - public void setDataSource(DataSource dataSource) { - this.simpleJdbcTemplate = new SimpleJdbcTemplate(dataSource); - } - - @Autowired - public void setLineTokenizer(LineTokenizer lineTokenizer) { - this.lineTokenizer = lineTokenizer; - } - - @Before - public void onSetUp() throws Exception { - simpleJdbcTemplate.update("delete from TRADE"); - fileLocator = new ClassPathResource( - "data/multiResourceJob/input/20070122.teststream.ImportTradeDataStep.txt"); - itemReader = new FlatFileItemReader(); - - FieldSetMapper mapper = new TradeFieldSetMapper(); - DefaultLineMapper lineMapper = new DefaultLineMapper(); - lineMapper.setLineTokenizer(lineTokenizer); - lineMapper.setFieldSetMapper(mapper); - itemReader.setLineMapper(lineMapper); - - itemReader.setResource(fileLocator); - itemReader.open(new ExecutionContext()); - } - - /* - * fixed-length file is expected on input - */ - protected void validatePreConditions() throws Exception { - BufferedReader reader; - - reader = new BufferedReader(new FileReader(fileLocator.getFile())); - String line; - while ((line = reader.readLine()) != null) { - assertEquals(LINE_LENGTH, line.length()); - } - } - - /** - * Context: 5 items overall, min. 2 items per output file, commitInterval=3, => - * two files created, with 3 items in the first and two in second. - */ - @Override - protected void validatePostConditions() throws Exception { - File file1 = new File("target/test-outputs/multiResourceOutput.txt.1"); - File file2 = new File("target/test-outputs/multiResourceOutput.txt.2"); - assertTrue(file1.exists()); - assertTrue(file2.exists()); - - BufferedReader reader1 = new BufferedReader(new FileReader(file1)); - for (int i = 1; i <= 3; i++) { - assertEquals(itemReader.read().toString(), reader1.readLine()); - } - assertNull(reader1.readLine()); - - BufferedReader reader2 = new BufferedReader(new FileReader(file2)); - for (int i = 1; i <= 2; i++) { - assertEquals(itemReader.read().toString(), reader2.readLine()); - } - assertNull(reader2.readLine()); - - } - - @Autowired - public void setJob(@Qualifier("multiResourceJob") - Job job) { - super.setJob(job); - } -} diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/XmlStaxJobFunctionalTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/XmlStaxJobFunctionalTests.java deleted file mode 100644 index 1eb58fa69..000000000 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/XmlStaxJobFunctionalTests.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2006-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.batch.sample; - -import java.io.FileReader; - -import org.custommonkey.xmlunit.XMLAssert; -import org.custommonkey.xmlunit.XMLUnit; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration() -public class XmlStaxJobFunctionalTests extends AbstractValidatingBatchLauncherTests { - - private static final String OUTPUT_FILE = "target/test-outputs/20070918.testStream.xmlFileStep.output.xml"; - private static final String EXPECTED_OUTPUT_FILE = "src/main/resources/data/staxJob/output/expected-output.xml"; - - /** - * Output should be the same as input - */ - protected void validatePostConditions() throws Exception { - XMLUnit.setIgnoreWhitespace(true); - XMLAssert.assertXMLEqual(new FileReader(EXPECTED_OUTPUT_FILE), new FileReader(OUTPUT_FILE)); - } - -} diff --git a/spring-batch-samples/src/test/resources/org/springframework/batch/sample/MultiResourceJobFunctionalTests-context.xml b/spring-batch-samples/src/test/resources/org/springframework/batch/sample/MultiResourceJobFunctionalTests-context.xml deleted file mode 100644 index c37363d7f..000000000 --- a/spring-batch-samples/src/test/resources/org/springframework/batch/sample/MultiResourceJobFunctionalTests-context.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/spring-batch-samples/src/test/resources/org/springframework/batch/sample/XmlStaxJobFunctionalTests-context.xml b/spring-batch-samples/src/test/resources/org/springframework/batch/sample/XmlStaxJobFunctionalTests-context.xml deleted file mode 100644 index 763aeaca5..000000000 --- a/spring-batch-samples/src/test/resources/org/springframework/batch/sample/XmlStaxJobFunctionalTests-context.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -