BATCH-173 Misc Bug fixes.
This commit is contained in:
@@ -1,10 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" output="bin/test-classes" path="src/test/java"/>
|
||||
<classpathentry kind="src" path="src/main/resources"/>
|
||||
<classpathentry kind="src" output="bin/test-classes" path="src/test/resources"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="src" path="src/main/resources"/>
|
||||
<classpathentry kind="src" path="src/test/java" output="target/test-classes"/>
|
||||
<classpathentry kind="src" path="src/test/resources" output="target/test-classes"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar" sourcepath="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar" sourcepath="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.1/commons-lang-2.1.jar" sourcepath="M2_REPO/commons-lang/commons-lang/2.1/commons-lang-2.1-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/commons-digester/commons-digester/1.7/commons-digester-1.7.jar" sourcepath="M2_REPO/commons-digester/commons-digester/1.7/commons-digester-1.7-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/geronimo-spec/geronimo-spec-j2ee/1.4-rc4/geronimo-spec-j2ee-1.4-rc4.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar" sourcepath="M2_REPO/junit/junit/3.8.1/junit-3.8.1-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/org/springmodules/spring-modules-validation/0.8/spring-modules-validation-0.8.jar" sourcepath="M2_REPO/org/springmodules/spring-modules-validation/0.8/spring-modules-validation-0.8-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/2.1.1/commons-collections-2.1.1.jar" sourcepath="M2_REPO/commons-collections/commons-collections/2.1.1/commons-collections-2.1.1-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/aspectj/aspectjrt/1.5.3/aspectjrt-1.5.3.jar">
|
||||
<attributes>
|
||||
<attribute value="jar:file:/D:/Documents and Settings/lucas.l.ward/.m2/repository/aspectj/aspectjrt/1.5.3/aspectjrt-1.5.3-javadoc.jar!/" name="javadoc_location"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="var" path="M2_REPO/xpp3/xpp3_min/1.1.3.4.O/xpp3_min-1.1.3.4.O.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/quartz/quartz/1.5.1/quartz-1.5.1.jar" sourcepath="M2_REPO/quartz/quartz/1.5.1/quartz-1.5.1-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/commons-io/commons-io/1.2/commons-io-1.2.jar" sourcepath="M2_REPO/commons-io/commons-io/1.2/commons-io-1.2-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/org/springframework/spring-test/2.1-m4/spring-test-2.1-m4.jar" sourcepath="M2_REPO/org/springframework/spring-test/2.1-m4/spring-test-2.1-m4-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/commons-dbcp/commons-dbcp/1.2.1/commons-dbcp-1.2.1.jar" sourcepath="M2_REPO/commons-dbcp/commons-dbcp/1.2.1/commons-dbcp-1.2.1-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/org/springframework/batch/spring-batch-infrastructure/1.0-m3-SNAPSHOT/spring-batch-infrastructure-1.0-m3-SNAPSHOT.jar" sourcepath="M2_REPO/org/springframework/batch/spring-batch-infrastructure/1.0-m3-SNAPSHOT/spring-batch-infrastructure-1.0-m3-SNAPSHOT-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/com/thoughtworks/xstream/xstream/1.2.1/xstream-1.2.1.jar" sourcepath="M2_REPO/com/thoughtworks/xstream/xstream/1.2.1/xstream-1.2.1-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/org/springframework/batch/spring-batch-execution/1.0-m3-SNAPSHOT/spring-batch-execution-1.0-m3-SNAPSHOT.jar" sourcepath="M2_REPO/org/springframework/batch/spring-batch-execution/1.0-m3-SNAPSHOT/spring-batch-execution-1.0-m3-SNAPSHOT-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/org/springframework/batch/spring-batch-core/1.0-m3-SNAPSHOT/spring-batch-core-1.0-m3-SNAPSHOT.jar" sourcepath="M2_REPO/org/springframework/batch/spring-batch-core/1.0-m3-SNAPSHOT/spring-batch-core-1.0-m3-SNAPSHOT-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/aspectj/aspectjweaver/1.5.3/aspectjweaver-1.5.3.jar">
|
||||
<attributes>
|
||||
<attribute value="jar:file:/D:/Documents and Settings/lucas.l.ward/.m2/repository/aspectj/aspectjweaver/1.5.3/aspectjweaver-1.5.3-javadoc.jar!/" name="javadoc_location"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="var" path="M2_REPO/org/springframework/ws/spring-xml/1.0.0/spring-xml-1.0.0.jar" sourcepath="M2_REPO/org/springframework/ws/spring-xml/1.0.0/spring-xml-1.0.0-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/commons-pool/commons-pool/1.2/commons-pool-1.2.jar" sourcepath="M2_REPO/commons-pool/commons-pool/1.2/commons-pool-1.2-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1/geronimo-jta_1.1_spec-1.1.jar" sourcepath="M2_REPO/org/apache/geronimo/specs/geronimo-jta_1.1_spec/1.1/geronimo-jta_1.1_spec-1.1-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6.jar" sourcepath="M2_REPO/antlr/antlr/2.7.6/antlr-2.7.6-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/easymock/easymock/1.1/easymock-1.1.jar" sourcepath="M2_REPO/easymock/easymock/1.1/easymock-1.1-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/org/springframework/ws/spring-oxm/1.0.0/spring-oxm-1.0.0.jar" sourcepath="M2_REPO/org/springframework/ws/spring-oxm/1.0.0/spring-oxm-1.0.0-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.12/log4j-1.2.12.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate/3.2.3.ga/hibernate-3.2.3.ga.jar" sourcepath="M2_REPO/org/hibernate/hibernate/3.2.3.ga/hibernate-3.2.3.ga-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar" sourcepath="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/xerces/xercesImpl/2.0.2/xercesImpl-2.0.2.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/asm/asm-all/2.2.3/asm-all-2.2.3.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/xmlunit/xmlunit/1.1/xmlunit-1.1.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar" sourcepath="M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/stax/stax/1.2.0/stax-1.2.0.jar" sourcepath="M2_REPO/stax/stax/1.2.0/stax-1.2.0-sources.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/stax/stax-api/1.0.1/stax-api-1.0.1.jar"/>
|
||||
<classpathentry kind="var" path="M2_REPO/org/springframework/spring/2.1-m4/spring-2.1-m4.jar" sourcepath="M2_REPO/org/springframework/spring/2.1-m4/spring-2.1-m4-sources.jar"/>
|
||||
</classpath>
|
||||
@@ -1,47 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>batch-samples</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.ibm.etools.common.migration.MigrationBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.springframework.ide.eclipse.core.springbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
<nature>org.springframework.ide.eclipse.core.springnature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
<projectDescription>
|
||||
<name>spring-batch-samples</name>
|
||||
<comment>Example batch jobs using Spring Batch Core and Execution.</comment>
|
||||
<projects/>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.ibm.etools.common.migration.MigrationBuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.springframework.ide.eclipse.core.springbuilder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.maven.ide.eclipse.maven2Builder</name>
|
||||
<arguments/>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.maven.ide.eclipse.maven2Nature</nature>
|
||||
<nature>org.springframework.ide.eclipse.core.springnature</nature>
|
||||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -1,120 +1,120 @@
|
||||
/*
|
||||
* 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.item.provider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.io.InputSource;
|
||||
import org.springframework.batch.io.file.FieldSet;
|
||||
import org.springframework.batch.io.file.FieldSetMapper;
|
||||
import org.springframework.batch.item.ItemProvider;
|
||||
import org.springframework.batch.item.provider.AbstractItemProvider;
|
||||
|
||||
/**
|
||||
* An {@link ItemProvider} that delivers a list as its item, storing up objects
|
||||
* from the injected {@link InputSource} until they are ready to be packed out
|
||||
* as a collection.<br/>
|
||||
*
|
||||
* This class is thread safe (it can be used concurrently by multiple threads) as
|
||||
* long as the {@link InputSource} is also thread safe.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class CollectionItemProvider extends AbstractItemProvider {
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(CollectionItemProvider.class);
|
||||
|
||||
private InputSource inputSource;
|
||||
|
||||
// maps a single line to a simple record
|
||||
private FieldSetMapper fieldSetMapper;
|
||||
|
||||
/**
|
||||
* Get the next list of records.
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemProvider#next()
|
||||
*/
|
||||
public Object next() {
|
||||
ResultHolder holder = new ResultHolder();
|
||||
|
||||
while (process((FieldSet)inputSource.read(), holder)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!holder.exhausted) {
|
||||
return holder.records;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean process(FieldSet fieldSet, ResultHolder holder) {
|
||||
// finish processing if we hit the end of file
|
||||
if (fieldSet == null) {
|
||||
log.debug("Exhausted InputSource");
|
||||
holder.exhausted = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// start a new collection
|
||||
if (fieldSet.readString(0).equals("BEGIN")) {
|
||||
log.debug("Start of new record detected");
|
||||
return true;
|
||||
}
|
||||
|
||||
// mark we are finished with current collection
|
||||
if (fieldSet.readString(0).equals("END")) {
|
||||
log.debug("End of record detected");
|
||||
return false;
|
||||
}
|
||||
|
||||
// add a simple record to the current collection
|
||||
log.debug("Mapping: " + fieldSet);
|
||||
holder.records.add(fieldSetMapper.mapLine(fieldSet));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection setter for {@link InputSource}.
|
||||
* @param inputSource an {@link InputSource}.
|
||||
*/
|
||||
public void setInputSource(InputSource inputSource) {
|
||||
this.inputSource = inputSource;
|
||||
}
|
||||
|
||||
public void setFieldSetMapper(FieldSetMapper mapper) {
|
||||
this.fieldSetMapper = mapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private class for temporary state management while item is being
|
||||
* collected.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
private class ResultHolder {
|
||||
Collection records = new ArrayList();
|
||||
boolean exhausted = false;
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* 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.item.provider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.batch.io.InputSource;
|
||||
import org.springframework.batch.io.file.FieldSet;
|
||||
import org.springframework.batch.io.file.FieldSetMapper;
|
||||
import org.springframework.batch.item.ItemProvider;
|
||||
import org.springframework.batch.item.provider.AbstractItemProvider;
|
||||
|
||||
/**
|
||||
* An {@link ItemProvider} that delivers a list as its item, storing up objects
|
||||
* from the injected {@link InputSource} until they are ready to be packed out
|
||||
* as a collection.<br/>
|
||||
*
|
||||
* This class is thread safe (it can be used concurrently by multiple threads) as
|
||||
* long as the {@link InputSource} is also thread safe.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
public class CollectionItemProvider extends AbstractItemProvider {
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(CollectionItemProvider.class);
|
||||
|
||||
private InputSource inputSource;
|
||||
|
||||
// maps a single line to a simple record
|
||||
private FieldSetMapper fieldSetMapper;
|
||||
|
||||
/**
|
||||
* Get the next list of records.
|
||||
*
|
||||
* @see org.springframework.batch.item.ItemProvider#next()
|
||||
*/
|
||||
public Object next() {
|
||||
ResultHolder holder = new ResultHolder();
|
||||
|
||||
while (process((FieldSet)inputSource.read(), holder)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!holder.exhausted) {
|
||||
return holder.records;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean process(FieldSet fieldSet, ResultHolder holder) {
|
||||
// finish processing if we hit the end of file
|
||||
if (fieldSet == null) {
|
||||
log.debug("Exhausted InputSource");
|
||||
holder.exhausted = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// start a new collection
|
||||
if (fieldSet.readString(0).equals("BEGIN")) {
|
||||
log.debug("Start of new record detected");
|
||||
return true;
|
||||
}
|
||||
|
||||
// mark we are finished with current collection
|
||||
if (fieldSet.readString(0).equals("END")) {
|
||||
log.debug("End of record detected");
|
||||
return false;
|
||||
}
|
||||
|
||||
// add a simple record to the current collection
|
||||
log.debug("Mapping: " + fieldSet);
|
||||
holder.records.add(fieldSetMapper.mapLine(fieldSet));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Injection setter for {@link InputSource}.
|
||||
* @param inputSource an {@link InputSource}.
|
||||
*/
|
||||
public void setInputSource(InputSource inputSource) {
|
||||
this.inputSource = inputSource;
|
||||
}
|
||||
|
||||
public void setFieldSetMapper(FieldSetMapper mapper) {
|
||||
this.fieldSetMapper = mapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private class for temporary state management while item is being
|
||||
* collected.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
*/
|
||||
private static class ResultHolder {
|
||||
Collection records = new ArrayList();
|
||||
boolean exhausted = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
xsi:schemaLocation="
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
|
||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd" >
|
||||
|
||||
<description>
|
||||
Example for iBATIS integration.
|
||||
</description>
|
||||
|
||||
|
||||
<bean class="org.springframework.batch.execution.configuration.JobConfigurationRegistryBeanPostProcessor">
|
||||
<property name="jobConfigurationRegistry" ref="jobConfigurationRegistry"/>
|
||||
</bean>
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
<aop:advisor pointcut="execution(* org.springframework.batch.execution..*Repository+.*(..))"
|
||||
advice-ref="txAdvice" />
|
||||
</aop:config>
|
||||
|
||||
<tx:advice id="txAdvice" transaction-manager="transactionManager">
|
||||
<tx:attributes>
|
||||
<tx:method name="*" />
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
/*
|
||||
* 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 org.apache.commons.io.IOUtils;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
public class MultilineJobFunctionalTests extends AbstractLifecycleSpringContextTests {
|
||||
|
||||
private final String EXPECTED_RESULT =
|
||||
"[Trade: [isin=UK21341EAH45,quantity=978,price=98.34,customer=customer1], Trade: [isin=UK21341EAH46,quantity=112,price=18.12,customer=customer2]]" +
|
||||
"[Trade: [isin=UK21341EAH47,quantity=245,price=12.78,customer=customer2], Trade: [isin=UK21341EAH48,quantity=108,price=9.25,customer=customer3], Trade: [isin=UK21341EAH49,quantity=854,price=23.39,customer=customer4]]";
|
||||
|
||||
private Resource output = new FileSystemResource("20070122.testStream.multilineStep.txt");
|
||||
|
||||
// @Override
|
||||
protected String[] getConfigLocations() {
|
||||
return new String[] {"jobs/multilineJob.xml"};
|
||||
}
|
||||
|
||||
protected void validatePostConditions() throws Exception {
|
||||
assertEquals(EXPECTED_RESULT, StringUtils.replace(IOUtils.toString(output.getInputStream()), System.getProperty("line.separator"), ""));
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 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 org.apache.commons.io.IOUtils;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
public class MultilineJobFunctionalTests extends AbstractLifecycleSpringContextTests {
|
||||
|
||||
private static final String EXPECTED_RESULT =
|
||||
"[Trade: [isin=UK21341EAH45,quantity=978,price=98.34,customer=customer1], Trade: [isin=UK21341EAH46,quantity=112,price=18.12,customer=customer2]]" +
|
||||
"[Trade: [isin=UK21341EAH47,quantity=245,price=12.78,customer=customer2], Trade: [isin=UK21341EAH48,quantity=108,price=9.25,customer=customer3], Trade: [isin=UK21341EAH49,quantity=854,price=23.39,customer=customer4]]";
|
||||
|
||||
private Resource output = new FileSystemResource("20070122.testStream.multilineStep.txt");
|
||||
|
||||
// @Override
|
||||
protected String[] getConfigLocations() {
|
||||
return new String[] {"jobs/multilineJob.xml"};
|
||||
}
|
||||
|
||||
protected void validatePostConditions() throws Exception {
|
||||
assertEquals(EXPECTED_RESULT, StringUtils.replace(IOUtils.toString(output.getInputStream()), System.getProperty("line.separator"), ""));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ public class TradeJobFunctionalTests extends AbstractLifecycleSpringContextTests
|
||||
assertTrue(((Resource)applicationContext.getBean("fileLocator")).exists());
|
||||
}
|
||||
|
||||
private class Customer {
|
||||
private static class Customer {
|
||||
private String name;
|
||||
private double credit;
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ public class SqlNflGameDaoIntegrationTests extends
|
||||
assertEquals(tempGame, game);
|
||||
}
|
||||
|
||||
public class NflGameRowMapper implements RowMapper {
|
||||
public static class NflGameRowMapper implements RowMapper {
|
||||
|
||||
public Object mapRow(ResultSet rs, int arg1) throws SQLException{
|
||||
|
||||
|
||||
Reference in New Issue
Block a user