diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/BatchNamespaceHandler.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/BatchNamespaceHandler.java deleted file mode 100644 index 698963345..000000000 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/BatchNamespaceHandler.java +++ /dev/null @@ -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; - -/** - * NamespaceHandler for the batch namespace. - * - *

- * Provides a {@link BeanDefinitionParser} for the <batch:config> tag. A config tag - * must include nested job-repository and job tags. - * - * @author Ben Hale - */ -public class BatchNamespaceHandler extends NamespaceHandlerSupport { - - public void init() { - registerBeanDefinitionParser("config", new ConfigBeanDefinitionParser()); - } - -} diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/ConfigBeanDefinitionParser.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/ConfigBeanDefinitionParser.java deleted file mode 100644 index f40910fd2..000000000 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/ConfigBeanDefinitionParser.java +++ /dev/null @@ -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)); - } - } -} diff --git a/spring-batch-execution/src/main/resources/org/springframework/batch/execution/configuration/spring-batch-1.0.xsd b/spring-batch-execution/src/main/resources/org/springframework/batch/execution/configuration/spring-batch-1.0.xsd deleted file mode 100644 index d22f1f310..000000000 --- a/spring-batch-execution/src/main/resources/org/springframework/batch/execution/configuration/spring-batch-1.0.xsd +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobRepositoryBeanDefinitionParserTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobRepositoryBeanDefinitionParserTests.java deleted file mode 100644 index c21122b8c..000000000 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobRepositoryBeanDefinitionParserTests.java +++ /dev/null @@ -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"); - } -} diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StepBeanDefinitionParserTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StepBeanDefinitionParserTests.java deleted file mode 100644 index 606783aeb..000000000 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StepBeanDefinitionParserTests.java +++ /dev/null @@ -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()); - } -} diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StubDataSource.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StubDataSource.java deleted file mode 100644 index f193a2332..000000000 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StubDataSource.java +++ /dev/null @@ -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; - } - -} \ No newline at end of file diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StubItemReader.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StubItemReader.java deleted file mode 100644 index db13f5331..000000000 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StubItemReader.java +++ /dev/null @@ -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(); - } - -} diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StubItemWriter.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StubItemWriter.java deleted file mode 100644 index 64d28a2ca..000000000 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StubItemWriter.java +++ /dev/null @@ -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(); - } - -} diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StubTransactionManager.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StubTransactionManager.java deleted file mode 100644 index 9c5c70e2e..000000000 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/StubTransactionManager.java +++ /dev/null @@ -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(); - } - -} diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/TaskletStepBeanDefinitionParserTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/TaskletStepBeanDefinitionParserTests.java deleted file mode 100644 index df0aec212..000000000 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/TaskletStepBeanDefinitionParserTests.java +++ /dev/null @@ -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()); - } -} diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/TaskletTestBean.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/TaskletTestBean.java deleted file mode 100644 index 1d1bf7f4d..000000000 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/TaskletTestBean.java +++ /dev/null @@ -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(); - } - -} diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoDb2.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoDb2.xml deleted file mode 100644 index 2a29711b4..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoDb2.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoDerby.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoDerby.xml deleted file mode 100644 index 9bc7748dc..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoDerby.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoHsql.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoHsql.xml deleted file mode 100644 index dafa5127e..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoHsql.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoMissingDataSource.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoMissingDataSource.xml deleted file mode 100644 index f40efa5eb..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoMissingDataSource.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoMySql.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoMySql.xml deleted file mode 100644 index 2c4fb2f71..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoMySql.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoOk.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoOk.xml deleted file mode 100644 index 2a29711b4..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoOk.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoOracle.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoOracle.xml deleted file mode 100644 index 4ccd4aea4..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoOracle.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoPostgres.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoPostgres.xml deleted file mode 100644 index 6447b5ded..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/JobRepoPostgres.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemReader.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemReader.xml deleted file mode 100644 index 491fb560e..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemReader.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemWriter.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemWriter.xml deleted file mode 100644 index a93f658ee..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingItemWriter.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingTransactionManager.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingTransactionManager.xml deleted file mode 100644 index 0456f7fbf..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepMissingTransactionManager.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepOk.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepOk.xml deleted file mode 100644 index 83f6e98a4..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepOk.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunAlways.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunAlways.xml deleted file mode 100644 index e2772305e..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunAlways.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunIncomplete.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunIncomplete.xml deleted file mode 100644 index 0264fed64..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunIncomplete.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunNever.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunNever.xml deleted file mode 100644 index 41f367d1f..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepRerunNever.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepSpecificTransactionManager.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepSpecificTransactionManager.xml deleted file mode 100644 index 83f6e98a4..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/StepSpecificTransactionManager.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepMissingTasklet.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepMissingTasklet.xml deleted file mode 100644 index 2a34ec9e7..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepMissingTasklet.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepOk.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepOk.xml deleted file mode 100644 index 56a9b6e65..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepOk.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunAlways.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunAlways.xml deleted file mode 100644 index 830326e6e..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunAlways.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunIncomplete.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunIncomplete.xml deleted file mode 100644 index 47f5ad4a7..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunIncomplete.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunNever.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunNever.xml deleted file mode 100644 index 10cfa3fb7..000000000 --- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/TaskletStepRerunNever.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file