[BATCH-63] Move namespace to sandbox

This commit is contained in:
nebhale
2008-03-03 16:06:54 +00:00
parent 2ee372a0b3
commit 760b0405fb
32 changed files with 0 additions and 1446 deletions

View File

@@ -1,37 +0,0 @@
/*
* Copyright 2002-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.execution.configuration;
import org.springframework.beans.factory.xml.BeanDefinitionParser;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
/**
* <code>NamespaceHandler</code> for the <code>batch</code> namespace.
*
* <p>
* Provides a {@link BeanDefinitionParser} for the <code>&lt;batch:config&gt;</code> tag. A <code>config</code> tag
* must include nested <code>job-repository</code> and <code>job</code> tags.
*
* @author Ben Hale
*/
public class BatchNamespaceHandler extends NamespaceHandlerSupport {
public void init() {
registerBeanDefinitionParser("config", new ConfigBeanDefinitionParser());
}
}

View File

@@ -1,352 +0,0 @@
/*
* Copyright 2002-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.execution.configuration;
import java.util.ArrayList;
import java.util.List;
import org.springframework.batch.execution.job.SimpleJob;
import org.springframework.batch.execution.repository.SimpleJobRepository;
import org.springframework.batch.execution.repository.dao.JdbcJobExecutionDao;
import org.springframework.batch.execution.repository.dao.JdbcJobInstanceDao;
import org.springframework.batch.execution.repository.dao.JdbcStepExecutionDao;
import org.springframework.batch.execution.step.TaskletStep;
import org.springframework.batch.execution.step.support.LimitCheckingItemSkipPolicy;
import org.springframework.batch.execution.step.support.SimpleStepFactoryBean;
import org.springframework.beans.MutablePropertyValues;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.config.RuntimeBeanReference;
import org.springframework.beans.factory.parsing.BeanComponentDefinition;
import org.springframework.beans.factory.parsing.CompositeComponentDefinition;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.factory.xml.BeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.incrementer.DB2SequenceMaxValueIncrementer;
import org.springframework.jdbc.support.incrementer.DerbyMaxValueIncrementer;
import org.springframework.jdbc.support.incrementer.HsqlMaxValueIncrementer;
import org.springframework.jdbc.support.incrementer.MySQLMaxValueIncrementer;
import org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer;
import org.springframework.jdbc.support.incrementer.PostgreSQLSequenceMaxValueIncrementer;
import org.springframework.util.StringUtils;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
/**
* @author Ben Hale
*/
public class ConfigBeanDefinitionParser implements BeanDefinitionParser {
private static final String JOB_REPOSITORY_ELEMENT = "job-repository";
private static final String JOB_REPOSITORY_BEAN_NAME = "_jobRepository";
private static final String DATA_SOURCE_ATT = "data-source";
private static final String DB_TYPE_ATT = "db-type";
private static final String DB_TYPE_DB2 = "db2";
private static final String DB_TYPE_DERBY = "derby";
private static final String DB_TYPE_HSQL = "hsql";
private static final String DB_TYPE_MYSQL = "mysql";
private static final String DB_TYPE_ORACLE = "oracle";
private static final String DB_TYPE_POSTGRES = "postgres";
private static final String JOB_ELEMENT = "job";
private static final String ID_ATT = "id";
private static final String RERUN_ATT = "rerun";
private static final String RERUN_ALWAYS = "always";
private static final String RERUN_NEVER = "never";
private static final String RERUN_INCOMPLETE = "incomplete";
private static final String STEP_ELEMENT = "step";
private static final String SIZE_ATT = "size";
private static final String TRANSACTION_MANAGER_ATT = "transaction-manager";
private static final String ITEM_READER_ATT = "item-reader";
private static final String ITEM_WRITER_ATT = "item-writer";
private static final String SKIP_LIMIT_ATT = "skip-limit";
private static final String TASKLET_STEP_ELEMENT = "tasklet-step";
private static final String TASKLET_ATT = "tasklet";
public BeanDefinition parse(Element element, ParserContext parserContext) {
CompositeComponentDefinition compositeDef = new CompositeComponentDefinition(element.getTagName(),
parserContext.extractSource(element));
parserContext.pushContainingComponent(compositeDef);
NodeList childNodes = element.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node child = childNodes.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
String localName = child.getLocalName();
if (JOB_REPOSITORY_ELEMENT.equals(localName)) {
parseJobRepository((Element) child, parserContext);
} else if (JOB_ELEMENT.equals(localName)) {
parseJob((Element) child, parserContext);
}
}
}
parserContext.popAndRegisterContainingComponent();
return null;
}
private void parseJobRepository(Element jobRepoEle, ParserContext parserContext) {
RootBeanDefinition jobRepoDef = new RootBeanDefinition(SimpleJobRepository.class);
jobRepoDef.setSource(parserContext.extractSource(jobRepoEle));
String dataSourceId = jobRepoEle.getAttribute(DATA_SOURCE_ATT);
if (!StringUtils.hasText(dataSourceId)) {
parserContext.getReaderContext().error("'data-source' attribute contains empty value", jobRepoEle);
} else {
String dbType = jobRepoEle.getAttribute(DB_TYPE_ATT);
ConstructorArgumentValues constructorArgumentValues = jobRepoDef.getConstructorArgumentValues();
String templateId = createJdbcTemplateDefinition(dataSourceId, parserContext);
constructorArgumentValues.addGenericArgumentValue(createJobInstanceDao(templateId, dataSourceId, dbType,
parserContext));
constructorArgumentValues.addGenericArgumentValue(createJobExecutionDao(templateId, dataSourceId, dbType,
parserContext));
constructorArgumentValues.addGenericArgumentValue(createStepExecutionDao(templateId, dataSourceId, dbType,
parserContext));
}
parserContext.registerBeanComponent(new BeanComponentDefinition(jobRepoDef, JOB_REPOSITORY_BEAN_NAME));
}
private String createJdbcTemplateDefinition(String dataSourceId, ParserContext parserContext) {
RootBeanDefinition templateDef = new RootBeanDefinition(JdbcTemplate.class);
templateDef.getConstructorArgumentValues().addGenericArgumentValue(new RuntimeBeanReference(dataSourceId));
return parserContext.getReaderContext().registerWithGeneratedName(templateDef);
}
private BeanDefinition createJobInstanceDao(String templateId, String dataSourceId, String dbType,
ParserContext parserContext) {
RootBeanDefinition daoDef = new RootBeanDefinition(JdbcJobInstanceDao.class);
MutablePropertyValues propertyValues = daoDef.getPropertyValues();
propertyValues.addPropertyValue("jdbcTemplate", new RuntimeBeanReference(templateId));
propertyValues.addPropertyValue("jobIncrementer", getIncrementer(dbType, dataSourceId, "BATCH_JOB_SEQ"));
return daoDef;
}
private BeanDefinition createJobExecutionDao(String templateId, String dataSourceId, String dbType,
ParserContext parserContext) {
RootBeanDefinition daoDef = new RootBeanDefinition(JdbcJobExecutionDao.class);
MutablePropertyValues propertyValues = daoDef.getPropertyValues();
propertyValues.addPropertyValue("jdbcTemplate", new RuntimeBeanReference(templateId));
propertyValues.addPropertyValue("jobExecutionIncrementer", getIncrementer(dbType, dataSourceId,
"BATCH_JOB_EXECUTION_SEQ"));
return daoDef;
}
private BeanDefinition createStepExecutionDao(String templateId, String dataSourceId, String dbType,
ParserContext parserContext) {
RootBeanDefinition daoDef = new RootBeanDefinition(JdbcStepExecutionDao.class);
MutablePropertyValues propertyValues = daoDef.getPropertyValues();
propertyValues.addPropertyValue("jdbcTemplate", new RuntimeBeanReference(templateId));
propertyValues.addPropertyValue("stepExecutionIncrementer", getIncrementer(dbType, dataSourceId,
"BATCH_STEP_EXECUTION_SEQ"));
return daoDef;
}
private BeanDefinition getIncrementer(String dbType, String dataSourceId, String incrementerName) {
RootBeanDefinition incrementerDef = new RootBeanDefinition();
if (DB_TYPE_DB2.equals(dbType)) {
incrementerDef.setBeanClass(DB2SequenceMaxValueIncrementer.class);
addSequenceIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues());
} else if (DB_TYPE_DERBY.equals(dbType)) {
incrementerDef.setBeanClass(DerbyMaxValueIncrementer.class);
addTableIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues());
} else if (DB_TYPE_HSQL.equals(dbType)) {
incrementerDef.setBeanClass(HsqlMaxValueIncrementer.class);
addTableIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues());
} else if (DB_TYPE_MYSQL.equals(dbType)) {
incrementerDef.setBeanClass(MySQLMaxValueIncrementer.class);
addTableIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues());
} else if (DB_TYPE_ORACLE.equals(dbType)) {
incrementerDef.setBeanClass(OracleSequenceMaxValueIncrementer.class);
addSequenceIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues());
} else if (DB_TYPE_POSTGRES.equals(dbType)) {
incrementerDef.setBeanClass(PostgreSQLSequenceMaxValueIncrementer.class);
addSequenceIncrementer(dataSourceId, incrementerName, incrementerDef.getConstructorArgumentValues());
}
return incrementerDef;
}
private void addSequenceIncrementer(String dataSourceId, String incrementerName,
ConstructorArgumentValues constructorArgumentValues) {
constructorArgumentValues.addGenericArgumentValue(new RuntimeBeanReference(dataSourceId));
constructorArgumentValues.addGenericArgumentValue(incrementerName);
}
private void addTableIncrementer(String dataSourceId, String incrementerName,
ConstructorArgumentValues constructorArgumentValues) {
constructorArgumentValues.addGenericArgumentValue(new RuntimeBeanReference(dataSourceId));
constructorArgumentValues.addGenericArgumentValue(incrementerName);
constructorArgumentValues.addGenericArgumentValue("id");
}
private void parseJob(Element jobEle, ParserContext parserContext) {
AbstractBeanDefinition jobDef = createJobBeanDefinition(jobEle, parserContext);
List steps = new ArrayList();
NodeList childNodes = jobEle.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node child = childNodes.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
String localName = child.getLocalName();
if (STEP_ELEMENT.equals(localName)) {
String id = parseStep((Element) child, parserContext);
steps.add(new RuntimeBeanReference(id));
} else if (TASKLET_STEP_ELEMENT.equals(localName)) {
String id = parseTaskletStep((Element) child, parserContext);
steps.add(new RuntimeBeanReference(id));
}
}
}
jobDef.getPropertyValues().addPropertyValue("steps", steps);
}
private AbstractBeanDefinition createJobBeanDefinition(Element jobEle, ParserContext parserContext) {
RootBeanDefinition jobDef = new RootBeanDefinition(SimpleJob.class);
jobDef.setSource(parserContext.extractSource(jobEle));
jobDef.getPropertyValues().addPropertyValue("jobRepository", JOB_REPOSITORY_BEAN_NAME);
return jobDef;
}
private String parseStep(Element stepEle, ParserContext parserContext) {
AbstractBeanDefinition stepDef = createStepBeanDefinition(stepEle, parserContext);
String id = stepEle.getAttribute(ID_ATT);
if (StringUtils.hasText(id)) {
parserContext.getRegistry().registerBeanDefinition(id, stepDef);
return id;
} else {
return parserContext.getReaderContext().registerWithGeneratedName(stepDef);
}
}
private AbstractBeanDefinition createStepBeanDefinition(Element stepElement, ParserContext parserContext) {
RootBeanDefinition stepDef = new RootBeanDefinition(SimpleStepFactoryBean.class);
stepDef.setSource(parserContext.extractSource(stepElement));
MutablePropertyValues propertyValues = stepDef.getPropertyValues();
String size = stepElement.getAttribute(SIZE_ATT);
propertyValues.addPropertyValue("commitInterval", Integer.valueOf(size));
String transactionManager = stepElement.getAttribute(TRANSACTION_MANAGER_ATT);
if (!StringUtils.hasText(transactionManager)) {
parserContext.getReaderContext().error("'transaction-manager' attribute contains empty value", stepElement);
} else {
propertyValues.addPropertyValue("transactionManager", new RuntimeBeanReference(transactionManager));
}
String itemReader = stepElement.getAttribute(ITEM_READER_ATT);
if (!StringUtils.hasText(itemReader)) {
parserContext.getReaderContext().error("'item-reader' attribute contains empty value", stepElement);
} else {
propertyValues.addPropertyValue("itemReader", new RuntimeBeanReference(itemReader));
}
String itemWriter = stepElement.getAttribute(ITEM_WRITER_ATT);
if (!StringUtils.hasText(itemWriter)) {
parserContext.getReaderContext().error("'item-writer' attribute contains empty value", stepElement);
} else {
propertyValues.addPropertyValue("itemWriter", new RuntimeBeanReference(itemWriter));
}
if (stepElement.hasAttribute(SKIP_LIMIT_ATT)) {
String skipLimit = stepElement.getAttribute(SKIP_LIMIT_ATT);
propertyValues.addPropertyValue("skipLimit", createSkipLimitBeanDefinition(Integer.valueOf(skipLimit)));
}
String rerun = stepElement.getAttribute(RERUN_ATT);
setPropertiesForRerun(rerun, propertyValues);
propertyValues.addPropertyValue("jobRepository", new RuntimeBeanReference(JOB_REPOSITORY_BEAN_NAME));
return stepDef;
}
private AbstractBeanDefinition createSkipLimitBeanDefinition(Integer skipLimit) {
RootBeanDefinition skipLimitDef = new RootBeanDefinition(LimitCheckingItemSkipPolicy.class);
skipLimitDef.getConstructorArgumentValues().addGenericArgumentValue(skipLimit);
return skipLimitDef;
}
private String parseTaskletStep(Element taskletStepEle, ParserContext parserContext) {
AbstractBeanDefinition stepDef = createTaskletStepBeanDefinition(taskletStepEle, parserContext);
String id = taskletStepEle.getAttribute(ID_ATT);
if (StringUtils.hasText(id)) {
parserContext.getRegistry().registerBeanDefinition(id, stepDef);
return id;
} else {
return parserContext.getReaderContext().registerWithGeneratedName(stepDef);
}
}
private AbstractBeanDefinition createTaskletStepBeanDefinition(Element taskletElement, ParserContext parserContext) {
RootBeanDefinition stepDef = new RootBeanDefinition(TaskletStep.class);
stepDef.setSource(parserContext.extractSource(taskletElement));
MutablePropertyValues propertyValues = stepDef.getPropertyValues();
String tasklet = taskletElement.getAttribute(TASKLET_ATT);
if (!StringUtils.hasText(tasklet)) {
parserContext.getReaderContext().error("'tasklet' attribute contains empty value", taskletElement);
} else {
propertyValues.addPropertyValue("tasklet", new RuntimeBeanReference(tasklet));
}
String rerun = taskletElement.getAttribute(RERUN_ATT);
setPropertiesForRerun(rerun, propertyValues);
propertyValues.addPropertyValue("jobRepository", new RuntimeBeanReference(JOB_REPOSITORY_BEAN_NAME));
return stepDef;
}
private void setPropertiesForRerun(String rerun, MutablePropertyValues propertyValues) {
if (RERUN_ALWAYS.equals(rerun)) {
propertyValues.addPropertyValue("allowStartIfComplete", Boolean.TRUE);
propertyValues.addPropertyValue("startLimit", new Integer(Integer.MAX_VALUE));
} else if (RERUN_NEVER.equals(rerun)) {
propertyValues.addPropertyValue("allowStartIfComplete", Boolean.FALSE);
propertyValues.addPropertyValue("startLimit", Integer.valueOf(1));
} else if (RERUN_INCOMPLETE.equals(rerun)) {
propertyValues.addPropertyValue("allowStartIfComplete", Boolean.FALSE);
propertyValues.addPropertyValue("startLimit", new Integer(Integer.MAX_VALUE));
}
}
}

View File

@@ -1,138 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.springframework.org/schema/batch"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.springframework.org/schema/batch"
elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
<xs:element name="config">
<xs:annotation>
<xs:documentation><![CDATA[Defines a configuration for a batch job or a group of batch jobs. This encapsulating element sets the default configuration for all jobs and steps defined inside.]]></xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="job-repository" type="jobRepositoryType" minOccurs="1" maxOccurs="1">
<xs:annotation>
<xs:documentation><![CDATA[Defines a repository for storing and retrieving metadata for jobs and steps.]]></xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="job" type="jobType" minOccurs="1" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation><![CDATA[Defines a uniquely identified job that is referenced at runtime.]]></xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<!-- Types -->
<xs:complexType name="jobRepositoryType">
<xs:attribute name="data-source" type="xs:token" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The datasource to use to back this repository.]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="db-type" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The type of database this job repository will be communicating with.]]></xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="db2"/>
<xs:enumeration value="derby"/>
<xs:enumeration value="hsql"/>
<xs:enumeration value="mysql"/>
<xs:enumeration value="oracle"/>
<xs:enumeration value="postgres"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="jobType">
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element name="step" type="stepType">
<xs:annotation>
<xs:documentation><![CDATA[Defines a step that supports chunking]]></xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="tasklet-step" type="taskletStepType">
<xs:annotation>
<xs:documentation><![CDATA[Defines a step that executes a tasklet]]></xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>
<xs:attribute name="id" type="xs:token" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The unique identifier to use in this step. The id must be unique within the context of this job.]]></xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="stepType">
<xs:attribute name="id" type="xs:token" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The unique identifier to use in this step. The id must be unique within the context of this job.]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="size" type="xs:positiveInteger" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The number of elements to be processed per chunk. This must be a number greater than 0.]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="item-reader" type="xs:token" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The id of the ItemReader implementation to read from in this step]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="item-writer" type="xs:token" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The id of the ItemWriter implementation to write to in this step]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="transaction-manager" type="xs:token" use="optional"
default="transactionManager">
<xs:annotation>
<xs:documentation><![CDATA[The id of the transaction manager to use in this step. This should be an implementation of Spring's PlatformTransactionManager.]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup ref="rerun.enum"/>
<xs:attribute name="skip-limit" type="xs:nonNegativeInteger" use="optional">
<xs:annotation>
<xs:documentation><![CDATA[The maximum number of items the ItemReader can skip before this step is marked as a failure. The default is no limit.]]></xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="taskletStepType">
<xs:attribute name="id" type="xs:token" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The unique identifier to use in this step. The id must be unique within the context of this job.]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="tasklet" type="xs:token" use="required">
<xs:annotation>
<xs:documentation><![CDATA[The id of the Tasklet implementation to execute in this step.]]></xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attributeGroup ref="rerun.enum"/>
</xs:complexType>
<!-- Enumerations -->
<xs:attributeGroup name="rerun.enum">
<xs:attribute name="rerun" use="optional" default="incomplete">
<xs:annotation>
<xs:documentation><![CDATA[When to re-run this step. The default is 'incomplete.
* always: Always re-run this step
* never: Never re-run this step
* incomplete: Re-run this step whenever a previous execution was incomplete]]></xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="always"/>
<xs:enumeration value="never"/>
<xs:enumeration value="incomplete"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:attributeGroup>
</xs:schema>

View File

@@ -1,63 +0,0 @@
/*
* Copyright 2002-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.execution.configuration;
import junit.framework.TestCase;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class JobRepositoryBeanDefinitionParserTests extends TestCase {
private static final String PACKAGE = "org/springframework/batch/execution/configuration/";
public void testJobRepoOk() {
new ClassPathXmlApplicationContext(PACKAGE + "JobRepoOk.xml");
}
public void testJobRepoMissingDataSource() {
try {
new ClassPathXmlApplicationContext(PACKAGE + "JobRepoMissingDataSource.xml");
fail("Expected BeanDefinitionParsingException");
} catch (BeanDefinitionParsingException e) {
}
}
public void testJobRepoDb2() {
new ClassPathXmlApplicationContext(PACKAGE + "JobRepoDb2.xml");
}
public void testJobRepoDerby() {
new ClassPathXmlApplicationContext(PACKAGE + "JobRepoDerby.xml");
}
public void testJobRepoHsql() {
new ClassPathXmlApplicationContext(PACKAGE + "JobRepoHsql.xml");
}
public void testJobRepoMySql() {
new ClassPathXmlApplicationContext(PACKAGE + "JobRepoMySql.xml");
}
public void testJobRepoOracle() {
new ClassPathXmlApplicationContext(PACKAGE + "JobRepoOracle.xml");
}
public void testJobRepoPostgres() {
new ClassPathXmlApplicationContext(PACKAGE + "JobRepoPostgres.xml");
}
}

View File

@@ -1,84 +0,0 @@
/*
* Copyright 2002-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.execution.configuration;
import junit.framework.TestCase;
import org.springframework.batch.execution.step.ItemOrientedStep;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class StepBeanDefinitionParserTests extends TestCase {
private static final String PACKAGE = "org/springframework/batch/execution/configuration/";
public void testStepOk() {
new ClassPathXmlApplicationContext(PACKAGE + "StepOk.xml");
}
public void testStepMissingIteamReader() {
try {
new ClassPathXmlApplicationContext(PACKAGE + "StepMissingItemReader.xml");
fail("Expected BeanDefinitionParsingException");
} catch (BeanDefinitionParsingException e) {
}
}
public void testStepMissingItemWriter() {
try {
new ClassPathXmlApplicationContext(PACKAGE + "StepMissingItemWriter.xml");
fail("Expected BeanDefinitionParsingException");
} catch (BeanDefinitionParsingException e) {
}
}
public void testStepMissingTransactionManager() {
try {
new ClassPathXmlApplicationContext(PACKAGE + "StepMissingTransactionManager.xml");
fail("Expected BeanDefinitionParsingException");
} catch (BeanDefinitionParsingException e) {
}
}
public void testStepSpecificTransactionManager() {
new ClassPathXmlApplicationContext(PACKAGE + "StepSpecificTransactionManager.xml");
}
public void testStepRerunAlways() {
ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE
+ "StepRerunAlways.xml");
ItemOrientedStep step = (ItemOrientedStep) ctx.getBean("process");
assertEquals(Integer.MAX_VALUE, step.getStartLimit());
assertTrue(step.isAllowStartIfComplete());
}
public void testStepRerunNever() {
ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "StepRerunNever.xml");
ItemOrientedStep step = (ItemOrientedStep) ctx.getBean("process");
assertEquals(1, step.getStartLimit());
assertFalse(step.isAllowStartIfComplete());
}
public void testStepRerunIncomplete() {
ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE
+ "StepRerunIncomplete.xml");
ItemOrientedStep step = (ItemOrientedStep) ctx.getBean("process");
assertEquals(Integer.MAX_VALUE, step.getStartLimit());
assertFalse(step.isAllowStartIfComplete());
}
}

View File

@@ -1,65 +0,0 @@
/*
* Copyright 2002-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.execution.configuration;
import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import javax.sql.DataSource;
public class StubDataSource implements DataSource {
public Connection getConnection() throws SQLException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public Connection getConnection(String username, String password) throws SQLException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public PrintWriter getLogWriter() throws SQLException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public int getLoginTimeout() throws SQLException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public void setLogWriter(PrintWriter out) throws SQLException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public void setLoginTimeout(int seconds) throws SQLException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public boolean isWrapperFor(Class arg0) throws SQLException {
return false;
}
public Object unwrap(Class arg0) throws SQLException {
return null;
}
}

View File

@@ -1,40 +0,0 @@
/*
* Copyright 2002-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.execution.configuration;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.exception.MarkFailedException;
import org.springframework.batch.item.exception.ResetFailedException;
public class StubItemReader implements ItemReader {
public void mark() throws MarkFailedException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public Object read() throws Exception {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public void reset() throws ResetFailedException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
}

View File

@@ -1,40 +0,0 @@
/*
* Copyright 2002-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.execution.configuration;
import org.springframework.batch.item.ItemWriter;
import org.springframework.batch.item.exception.ClearFailedException;
import org.springframework.batch.item.exception.FlushFailedException;
public class StubItemWriter implements ItemWriter {
public void clear() throws ClearFailedException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public void flush() throws FlushFailedException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public void write(Object item) throws Exception {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
}

View File

@@ -1,41 +0,0 @@
/*
* Copyright 2002-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.execution.configuration;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionException;
import org.springframework.transaction.TransactionStatus;
public class StubTransactionManager implements PlatformTransactionManager {
public void commit(TransactionStatus status) throws TransactionException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
public void rollback(TransactionStatus status) throws TransactionException {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
}

View File

@@ -1,61 +0,0 @@
/*
* Copyright 2002-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.execution.configuration;
import junit.framework.TestCase;
import org.springframework.batch.execution.step.TaskletStep;
import org.springframework.beans.factory.parsing.BeanDefinitionParsingException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class TaskletStepBeanDefinitionParserTests extends TestCase {
private static final String PACKAGE = "org/springframework/batch/execution/configuration/";
public void testTaskletStepOk() {
new ClassPathXmlApplicationContext(PACKAGE + "TaskletStepOk.xml");
}
public void testTaskletStepMissingTasklet() {
try {
new ClassPathXmlApplicationContext(PACKAGE + "TaskletStepMissingTasklet.xml");
fail("Expected BeanDefinitionParsingException");
} catch (BeanDefinitionParsingException e) { }
}
public void testTaskletStepRerunAlways() {
ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "TaskletStepRerunAlways.xml");
TaskletStep step = (TaskletStep) ctx.getBean("process");
assertEquals(Integer.MAX_VALUE, step.getStartLimit());
assertTrue(step.isAllowStartIfComplete());
}
public void testTaskletStepRerunNever() {
ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "TaskletStepRerunNever.xml");
TaskletStep step = (TaskletStep) ctx.getBean("process");
assertEquals(1, step.getStartLimit());
assertFalse(step.isAllowStartIfComplete());
}
public void testTaskletStepRerunIncomplete() {
ApplicationContext ctx = new ClassPathXmlApplicationContext(PACKAGE + "TaskletStepRerunIncomplete.xml");
TaskletStep step = (TaskletStep) ctx.getBean("process");
assertEquals(Integer.MAX_VALUE, step.getStartLimit());
assertFalse(step.isAllowStartIfComplete());
}
}

View File

@@ -1,29 +0,0 @@
/*
* Copyright 2002-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.execution.configuration;
import org.springframework.batch.core.tasklet.Tasklet;
import org.springframework.batch.repeat.ExitStatus;
public class TaskletTestBean implements Tasklet {
public ExitStatus execute() throws Exception {
// TODO Auto-generated method stub
throw new UnsupportedOperationException();
}
}

View File

@@ -1,22 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet"/>
</job>
</config>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
</beans:beans>

View File

@@ -1,22 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="derby"/>
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet"/>
</job>
</config>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
</beans:beans>

View File

@@ -1,22 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="hsql" />
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet"/>
</job>
</config>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
</beans:beans>

View File

@@ -1,19 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="" db-type="db2" />
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet"/>
</job>
</config>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
</beans:beans>

View File

@@ -1,22 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="mysql"/>
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet"/>
</job>
</config>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
</beans:beans>

View File

@@ -1,22 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet"/>
</job>
</config>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
</beans:beans>

View File

@@ -1,22 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="oracle"/>
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet"/>
</job>
</config>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
</beans:beans>

View File

@@ -1,22 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="postgres" />
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet"/>
</job>
</config>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
</beans:beans>

View File

@@ -1,25 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<step id="process" size="10" item-reader="" item-writer="itemWriter"/>
</job>
</config>
<beans:bean id="itemWriter"
class="org.springframework.batch.execution.configuration.StubItemWriter"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
<beans:bean id="transactionManager"
class="org.springframework.batch.execution.configuration.StubTransactionManager"/>
</beans:beans>

View File

@@ -1,25 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<step id="process" size="10" item-reader="itemReader" item-writer=""/>
</job>
</config>
<beans:bean id="itemReader"
class="org.springframework.batch.execution.configuration.StubItemReader"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
<beans:bean id="transactionManager"
class="org.springframework.batch.execution.configuration.StubTransactionManager"/>
</beans:beans>

View File

@@ -1,25 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<step id="process" size="10" item-reader="itemReader" item-writer="itemWriter" transaction-manager=""/>
</job>
</config>
<beans:bean id="itemReader"
class="org.springframework.batch.execution.configuration.StubItemReader"/>
<beans:bean id="itemWriter"
class="org.springframework.batch.execution.configuration.StubItemWriter"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
</beans:beans>

View File

@@ -1,28 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<step id="process" size="10" item-reader="itemReader" item-writer="itemWriter"/>
</job>
</config>
<beans:bean id="itemReader"
class="org.springframework.batch.execution.configuration.StubItemReader"/>
<beans:bean id="itemWriter"
class="org.springframework.batch.execution.configuration.StubItemWriter"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
<beans:bean id="transactionManager"
class="org.springframework.batch.execution.configuration.StubTransactionManager"/>
</beans:beans>

View File

@@ -1,28 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<step id="process" size="10" item-reader="itemReader" item-writer="itemWriter" rerun="always"/>
</job>
</config>
<beans:bean id="itemReader"
class="org.springframework.batch.execution.configuration.StubItemReader"/>
<beans:bean id="itemWriter"
class="org.springframework.batch.execution.configuration.StubItemWriter"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
<beans:bean id="transactionManager"
class="org.springframework.batch.execution.configuration.StubTransactionManager"/>
</beans:beans>

View File

@@ -1,28 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<step id="process" size="10" item-reader="itemReader" item-writer="itemWriter" rerun="incomplete"/>
</job>
</config>
<beans:bean id="itemReader"
class="org.springframework.batch.execution.configuration.StubItemReader"/>
<beans:bean id="itemWriter"
class="org.springframework.batch.execution.configuration.StubItemWriter"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
<beans:bean id="transactionManager"
class="org.springframework.batch.execution.configuration.StubTransactionManager"/>
</beans:beans>

View File

@@ -1,28 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<step id="process" size="10" item-reader="itemReader" item-writer="itemWriter" rerun="never"/>
</job>
</config>
<beans:bean id="itemReader"
class="org.springframework.batch.execution.configuration.StubItemReader"/>
<beans:bean id="itemWriter"
class="org.springframework.batch.execution.configuration.StubItemWriter"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
<beans:bean id="transactionManager"
class="org.springframework.batch.execution.configuration.StubTransactionManager"/>
</beans:beans>

View File

@@ -1,28 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<step id="process" size="10" item-reader="itemReader" item-writer="itemWriter"/>
</job>
</config>
<beans:bean id="itemReader"
class="org.springframework.batch.execution.configuration.StubItemReader"/>
<beans:bean id="itemWriter"
class="org.springframework.batch.execution.configuration.StubItemWriter"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
<beans:bean id="transactionManager"
class="org.springframework.batch.execution.configuration.StubTransactionManager"/>
</beans:beans>

View File

@@ -1,19 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<tasklet-step id="process" tasklet=""/>
</job>
</config>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
</beans:beans>

View File

@@ -1,22 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet"/>
</job>
</config>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
</beans:beans>

View File

@@ -1,22 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet" rerun="always"/>
</job>
</config>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
</beans:beans>

View File

@@ -1,22 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet" rerun="incomplete"/>
</job>
</config>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
</beans:beans>

View File

@@ -1,23 +0,0 @@
<beans:beans xmlns="http://www.springframework.org/schema/batch"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-1.0.xsd">
<config>
<job-repository data-source="dataSource" db-type="db2"/>
<job id="processJob">
<tasklet-step id="process" tasklet="processorTasklet" rerun="never"/>
</job>
</config>
<beans:bean id="processorTasklet"
class="org.springframework.batch.execution.configuration.TaskletTestBean"/>
<beans:bean id="dataSource"
class="org.springframework.batch.execution.configuration.StubDataSource"/>
</beans:beans>