diff --git a/pom.xml b/pom.xml index f3d6ed067..04d208a59 100644 --- a/pom.xml +++ b/pom.xml @@ -289,7 +289,6 @@ samples spring-batch-infrastructure-tests - spring-batch-core-tests spring-batch-samples archetypes diff --git a/spring-batch-core-tests/.classpath b/spring-batch-core-tests/.classpath deleted file mode 100644 index 575d9eaf5..000000000 --- a/spring-batch-core-tests/.classpath +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/spring-batch-core-tests/.project b/spring-batch-core-tests/.project deleted file mode 100644 index ac5013e29..000000000 --- a/spring-batch-core-tests/.project +++ /dev/null @@ -1,30 +0,0 @@ - - - spring-batch-core-tests - This plugin is an archetype that creates a command line batch sample from Spring Batch. Once installed you can create the archetype project using<br/><pre>$ mvn archetype:create -DgroupId=com.mycompany -DartifactId=batch \ -DarchetypeGroupId=org.springframework.batch \ -DarchetypeArtifactId=spring-batch-cli -DarchetypeVersion=1.0-m3-SNAPSHOT</pre><br/> Then you should be able to "cd batch; mvn package exec:exec", and see the app run. - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.springframework.ide.eclipse.core.springbuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.springframework.ide.eclipse.core.springnature - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/spring-batch-core-tests/.settings/org.eclipse.jdt.core.prefs b/spring-batch-core-tests/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 58040bb0e..000000000 --- a/spring-batch-core-tests/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Wed Jul 16 12:19:00 CEST 2008 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.5 diff --git a/spring-batch-core-tests/.settings/org.springframework.ide.eclipse.beans.core.prefs b/spring-batch-core-tests/.settings/org.springframework.ide.eclipse.beans.core.prefs deleted file mode 100644 index 9430d30f6..000000000 --- a/spring-batch-core-tests/.settings/org.springframework.ide.eclipse.beans.core.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Wed Apr 15 09:55:29 BST 2009 -eclipse.preferences.version=1 -org.springframework.ide.eclipse.beans.core.ignoreMissingNamespaceHandler=false diff --git a/spring-batch-core-tests/.settings/org.springframework.ide.eclipse.core.prefs b/spring-batch-core-tests/.settings/org.springframework.ide.eclipse.core.prefs deleted file mode 100644 index ddf8310c9..000000000 --- a/spring-batch-core-tests/.settings/org.springframework.ide.eclipse.core.prefs +++ /dev/null @@ -1,82 +0,0 @@ -#Wed Apr 15 09:55:29 BST 2009 -eclipse.preferences.version=1 -org.springframework.ide.eclipse.core.builders.enable.aopreferencemodelbuilder=true -org.springframework.ide.eclipse.core.builders.enable.beanmetadatabuilder=false -org.springframework.ide.eclipse.core.builders.enable.osgibundleupdater=true -org.springframework.ide.eclipse.core.enable.project.preferences=false -org.springframework.ide.eclipse.core.validator.enable.com.springsource.platform.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.enable.com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.enable.com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.enable.com.springsource.sts.bestpractices.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.enable.com.springsource.sts.server.quickfix.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.core.springvalidator=false -org.springframework.ide.eclipse.core.validator.enable.org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.platform.ide.manifest.core.applicationSymbolicNameRule-com.springsource.platform.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.platform.ide.manifest.core.applicationVersionRule-com.springsource.platform.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.platform.ide.manifest.core.bundleActivationPolicyRule-com.springsource.platform.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.platform.ide.manifest.core.bundleActivatorRule-com.springsource.platform.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.platform.ide.manifest.core.bundleManifestVersionRule-com.springsource.platform.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.platform.ide.manifest.core.bundleNameRule-com.springsource.platform.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.platform.ide.manifest.core.bundleSymbolicNameRule-com.springsource.platform.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.platform.ide.manifest.core.bundleVersionRule-com.springsource.platform.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.platform.ide.manifest.core.exportPackageRule-com.springsource.platform.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.platform.ide.manifest.core.importRule-com.springsource.platform.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.platform.ide.manifest.core.parsingProblemsRule-com.springsource.platform.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.platform.ide.manifest.core.requireBundleRule-com.springsource.platform.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.applicationSymbolicNameRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.applicationVersionRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleActivationPolicyRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleActivatorRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleManifestVersionRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleNameRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleSymbolicNameRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.bundleVersionRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.exportPackageRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.importRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.parsingProblemsRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.server.ide.manifest.core.requireBundleRule-com.springsource.server.ide.manifest.core.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.AvoidDriverManagerDataSource-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.ImportElementsAtTopRulee-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.ParentBeanSpecifiesAbstractClassRule-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.RefElementRule-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.TooManyBeansInFileRule-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.UnnecessaryValueElementRule-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.com.springsource.sts.bestpractices.UseBeanInheritance-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.importPackageVersionRule-com.springsource.sts.bestpractices.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.bestpractices.legacyxmlusage.jndiobjectfactory-com.springsource.sts.bestpractices.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.importBundleVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.importLibraryVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.importPackageVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.com.springsource.sts.server.quickfix.requireBundleVersionRule-com.springsource.sts.server.quickfix.manifestvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanAlias-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanClass-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanConstructorArgument-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanDefinition-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanDefinitionHolder-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanFactory-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanInitDestroyMethod-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.beanReference-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.methodOverride-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.parsingProblems-org.springframework.ide.eclipse.beans.core.beansvalidator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.beans.core.requiredProperty-org.springframework.ide.eclipse.beans.core.beansvalidator=false -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.core.springClasspath-org.springframework.ide.eclipse.core.springvalidator=false -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.action-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.actionstate-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.attribute-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.attributemapper-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.beanaction-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.evaluationaction-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.evaluationresult-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.exceptionhandler-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.import-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.inputattribute-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.mapping-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.outputattribute-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.set-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.state-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.subflowstate-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.transition-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.variable-org.springframework.ide.eclipse.webflow.core.validator=true -org.springframework.ide.eclipse.core.validator.rule.enable.org.springframework.ide.eclipse.webflow.core.validation.webflowstate-org.springframework.ide.eclipse.webflow.core.validator=true diff --git a/spring-batch-core-tests/.springBeans b/spring-batch-core-tests/.springBeans deleted file mode 100644 index 20353ceac..000000000 --- a/spring-batch-core-tests/.springBeans +++ /dev/null @@ -1,20 +0,0 @@ - - - 1 - - - - - - - - - - - true - false - - - - - diff --git a/spring-batch-core-tests/pom.xml b/spring-batch-core-tests/pom.xml deleted file mode 100644 index 13983ab61..000000000 --- a/spring-batch-core-tests/pom.xml +++ /dev/null @@ -1,229 +0,0 @@ - - - 4.0.0 - spring-batch-core-tests - jar - Tests for Spring Batch Core against Spring 3.0 - - org.springframework.batch - spring-batch-parent - 2.0.2.CI-SNAPSHOT - - - true - false - 3.0.0.BUILD-SNAPSHOT - - - - strict - - false - - - - tiger - - 1.5 - - - - stax - stax - - - javax.annotation - jsr250-api - - - - - staging - - - staging - file:///${user.dir}/target/staging - - - staging - file:///${user.dir}/target/staging - - - - - - - junit - junit - 4.5 - test - - - org.springframework - spring-test - ${spring.framework.version} - test - - - org.springframework - spring-expression - ${spring.framework.version} - - - org.springframework - spring-jdbc - ${spring.framework.version} - - - org.springframework.batch - spring-batch-core - ${pom.version} - - - org.springframework - spring-context - - - org.springframework - spring-aop - - - - - cglib - cglib-nodep - - - commons-dbcp - commons-dbcp - - - commons-io - commons-io - - - log4j - log4j - - - hsqldb - hsqldb - - - org.aspectj - aspectjrt - - - org.aspectj - aspectjweaver - - - - - - org.springframework.build.aws - org.springframework.build.aws.maven - 2.0.0.RELEASE - - - - - - com.springsource.bundlor - com.springsource.bundlor.maven - 1.0.0.M1B - - ${project.basedir}/src/main/resources/META-INF/MANIFEST.MF - - - - maven-assembly-plugin - false - - - project - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - com.springsource.bundlor - com.springsource.bundlor.maven - - - bundlor-transform - package - - transform - - - - - - org.apache.maven.plugins - maven-surefire-plugin - - - **/*Tests.java - - - **/Abstract*.java - - junit:junit - - - - org.codehaus.mojo - exec-maven-plugin - 1.1 - - org.springframework.batch.core.launch.support.CommandLineJobRunner - - classpath:/launch-context.xml - job1 - - - - - - - http://www.springframework.org/download - - staging - file:///${user.dir}/target/staging/org.springframework.batch.archetype/${pom.artifactId} - - - spring-milestone - Spring Milestone Repository - file:///${user.dir}/target/staging/milestone - - - spring-snapshot - Spring Snapshot Repository - file:///${user.dir}/target/staging/snapshot - - - - - spring-snapshots - http://s3.amazonaws.com/maven.springframework.org/snapshot - - false - - - true - - - - diff --git a/spring-batch-core-tests/src/site/site.xml b/spring-batch-core-tests/src/site/site.xml deleted file mode 100644 index 4bba09c7c..000000000 --- a/spring-batch-core-tests/src/site/site.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - Spring Batch: ${project.name} - index.html - - - - org.springframework.maven.skins - maven-spring-skin - 1.0.5 - - - - - - - - - - - - - diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests.java deleted file mode 100644 index ad2552cc2..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests.java +++ /dev/null @@ -1,151 +0,0 @@ -package org.springframework.batch.core.scope; - -import static org.junit.Assert.assertEquals; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.FutureTask; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.StepExecution; -import org.springframework.batch.core.scope.context.StepContext; -import org.springframework.batch.core.scope.context.StepSynchronizationManager; -import org.springframework.batch.item.ExecutionContext; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.ListableBeanFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.core.task.SimpleAsyncTaskExecutor; -import org.springframework.core.task.TaskExecutor; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) -public class AsyncStepScopeIntegrationTests implements BeanFactoryAware { - - private Log logger = LogFactory.getLog(getClass()); - - @Autowired - @Qualifier("simple") - private Collaborator simple; - - private TaskExecutor taskExecutor = new SimpleAsyncTaskExecutor(); - - private ListableBeanFactory beanFactory; - - private int beanCount; - - public void setBeanFactory(BeanFactory beanFactory) throws BeansException { - this.beanFactory = (ListableBeanFactory) beanFactory; - } - - @Before - public void countBeans() { - StepSynchronizationManager.release(); - beanCount = beanFactory.getBeanDefinitionCount(); - } - - @After - public void cleanUp() { - StepSynchronizationManager.close(); - // Check that all temporary bean definitions are cleaned up - assertEquals(beanCount, beanFactory.getBeanDefinitionCount()); - } - - @Test - public void testSimpleProperty() throws Exception { - StepExecution stepExecution = new StepExecution("step", new JobExecution(0L), 123L); - ExecutionContext executionContext = stepExecution.getExecutionContext(); - executionContext.put("foo", "bar"); - StepSynchronizationManager.register(stepExecution); - assertEquals("bar", simple.getName()); - } - - @Test - public void testGetMultipleInMultipleThreads() throws Exception { - - List> tasks = new ArrayList>(); - - for (int i = 0; i < 12; i++) { - final String value = "foo" + i; - final Long id = 123L + i; - FutureTask task = new FutureTask(new Callable() { - public String call() throws Exception { - StepExecution stepExecution = new StepExecution(value, new JobExecution(0L), id); - ExecutionContext executionContext = stepExecution.getExecutionContext(); - executionContext.put("foo", value); - StepContext context = StepSynchronizationManager.register(stepExecution); - logger.debug("Registered: " + context.getStepExecutionContext()); - try { - return simple.getName(); - } - finally { - StepSynchronizationManager.close(); - } - } - }); - tasks.add(task); - taskExecutor.execute(task); - } - - int i = 0; - for (FutureTask task : tasks) { - assertEquals("foo" + i, task.get()); - i++; - } - - } - - @Test - public void testGetSameInMultipleThreads() throws Exception { - - List> tasks = new ArrayList>(); - final StepExecution stepExecution = new StepExecution("foo", new JobExecution(0L), 123L); - ExecutionContext executionContext = stepExecution.getExecutionContext(); - executionContext.put("foo", "foo"); - StepSynchronizationManager.register(stepExecution); - assertEquals("foo", simple.getName()); - - for (int i = 0; i < 12; i++) { - final String value = "foo" + i; - FutureTask task = new FutureTask(new Callable() { - public String call() throws Exception { - ExecutionContext executionContext = stepExecution.getExecutionContext(); - executionContext.put("foo", value); - StepContext context = StepSynchronizationManager.register(stepExecution); - logger.debug("Registered: " + context.getStepExecutionContext()); - try { - return simple.getName(); - } - finally { - StepSynchronizationManager.close(); - } - } - }); - tasks.add(task); - taskExecutor.execute(task); - } - - int i = 0; - for (FutureTask task : tasks) { - assertEquals("foo", task.get()); - i++; - } - - // Don't close the outer scope until all tasks are finished. This should - // always be the case if using an AbstractStep - StepSynchronizationManager.close(); - - } - -} diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/Collaborator.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/Collaborator.java deleted file mode 100644 index 2bfc6759c..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/Collaborator.java +++ /dev/null @@ -1,9 +0,0 @@ -package org.springframework.batch.core.scope; - -public interface Collaborator { - - String getName(); - - Collaborator getParent(); - -} \ No newline at end of file diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/JobStartupRunner.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/JobStartupRunner.java deleted file mode 100644 index c02a5ed38..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/JobStartupRunner.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.springframework.batch.core.scope; - -import javax.annotation.PostConstruct; - -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.Step; -import org.springframework.batch.core.StepExecution; - -public class JobStartupRunner { - - private Step step; - - public void setStep(Step step) { - this.step = step; - } - - @PostConstruct - public void launch() throws Exception { - StepExecution stepExecution = new StepExecution("step", new JobExecution(1L), 0L); - step.execute(stepExecution); - // expect no errors - } - -} diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/PlaceholderTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/PlaceholderTests.java deleted file mode 100644 index 43bf79f4c..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/PlaceholderTests.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2006-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.batch.core.scope; - -import static org.junit.Assert.assertEquals; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -/** - * @author Dave Syer - * - */ -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) -public class PlaceholderTests { - - @Autowired - private TestBean bean; - - @Test - public void testString() throws Exception { - assertEquals("foo", bean.getName()); - } - - @Test - public void testInteger() throws Exception { - assertEquals(100, bean.getValue()); - } - - @Test - public void testStrings() throws Exception { - assertEquals(3, bean.getValues().length); - } - - public static class TestBean { - private int value; - - private String[] values; - - private String name; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String[] getValues() { - return values; - } - - public void setValues(String[] values) { - this.values = values; - } - - public int getValue() { - return value; - } - - public void setValue(int value) { - this.value = value; - } - - } - -} diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeDestructionCallbackIntegrationTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeDestructionCallbackIntegrationTests.java deleted file mode 100644 index 00a86b51b..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeDestructionCallbackIntegrationTests.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.springframework.batch.core.scope; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.Step; -import org.springframework.batch.core.StepExecution; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) -public class StepScopeDestructionCallbackIntegrationTests { - - @Autowired - @Qualifier("proxied") - private Step proxied; - - @Autowired - @Qualifier("nested") - private Step nested; - - @Autowired - @Qualifier("foo") - private Collaborator foo; - - @Before - @After - public void resetMessage() throws Exception { - TestDisposableCollaborator.message = "none"; - TestAdvice.names.clear(); - } - - @Test - public void testDisposableScopedProxy() throws Exception { - assertNotNull(proxied); - proxied.execute(new StepExecution("step", new JobExecution(0L), 1L)); - assertEquals("destroyed", TestDisposableCollaborator.message); - } - - @Test - public void testDisposableInnerScopedProxy() throws Exception { - assertNotNull(nested); - nested.execute(new StepExecution("step", new JobExecution(0L), 1L)); - assertEquals("destroyed", TestDisposableCollaborator.message); - } - - @Test - public void testProxiedScopedProxy() throws Exception { - assertNotNull(nested); - nested.execute(new StepExecution("step", new JobExecution(0L), 1L)); - assertEquals(4, TestAdvice.names.size()); - assertEquals("bar", TestAdvice.names.get(0)); - assertEquals("destroyed", TestDisposableCollaborator.message); - } - - @Test - public void testProxiedNormalBean() throws Exception { - assertNotNull(nested); - String name = foo.getName(); - assertEquals(1, TestAdvice.names.size()); - assertEquals(name, TestAdvice.names.get(0)); - } - -} diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeIntegrationTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeIntegrationTests.java deleted file mode 100644 index 099d668eb..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeIntegrationTests.java +++ /dev/null @@ -1,116 +0,0 @@ -package org.springframework.batch.core.scope; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.Step; -import org.springframework.batch.core.StepExecution; -import org.springframework.batch.core.scope.context.StepSynchronizationManager; -import org.springframework.batch.item.ExecutionContext; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) -public class StepScopeIntegrationTests { - - @Autowired - @Qualifier("vanilla") - private Step vanilla; - - @Autowired - @Qualifier("proxied") - private Step proxied; - - @Autowired - @Qualifier("nested") - private Step nested; - - @Autowired - @Qualifier("enhanced") - private Step enhanced; - - @Autowired - @Qualifier("double") - private Step doubleEnhanced; - - @Before - @After - public void start() { - StepSynchronizationManager.close(); - TestStep.reset(); - } - - @Test - public void testScopeCreation() throws Exception { - vanilla.execute(new StepExecution("foo", new JobExecution(11L), 12L)); - assertNotNull(TestStep.getContext()); - assertNull(StepSynchronizationManager.getContext()); - } - - @Test - public void testScopedProxy() throws Exception { - proxied.execute(new StepExecution("foo", new JobExecution(11L), 31L)); - assertTrue(TestStep.getContext().attributeNames().length > 0); - String collaborator = (String) TestStep.getContext().getAttribute("collaborator"); - assertNotNull(collaborator); - assertEquals("bar", collaborator); - assertTrue("Scoped proxy not created", ((String) TestStep.getContext().getAttribute("collaborator.class")) - .startsWith("class $Proxy")); - } - - @Test - public void testNestedScopedProxy() throws Exception { - nested.execute(new StepExecution("foo", new JobExecution(11L), 31L)); - assertTrue(TestStep.getContext().attributeNames().length > 0); - String collaborator = (String) TestStep.getContext().getAttribute("collaborator"); - assertNotNull(collaborator); - assertEquals("foo", collaborator); - String parent = (String) TestStep.getContext().getAttribute("parent"); - assertNotNull(parent); - assertEquals("bar", parent); - assertTrue("Scoped proxy not created", ((String) TestStep.getContext().getAttribute("parent.class")) - .startsWith("class $Proxy")); - } - - @Test - public void testExecutionContext() throws Exception { - StepExecution stepExecution = new StepExecution("foo", new JobExecution(11L), 1L); - ExecutionContext executionContext = new ExecutionContext(); - executionContext.put("name", "spam"); - stepExecution.setExecutionContext(executionContext); - proxied.execute(stepExecution); - assertTrue(TestStep.getContext().attributeNames().length > 0); - String collaborator = (String) TestStep.getContext().getAttribute("collaborator"); - assertNotNull(collaborator); - assertEquals("bar", collaborator); - } - - @Test - public void testScopedProxyForReference() throws Exception { - enhanced.execute(new StepExecution("foo", new JobExecution(11L), 123L)); - assertTrue(TestStep.getContext().attributeNames().length > 0); - String collaborator = (String) TestStep.getContext().getAttribute("collaborator"); - assertNotNull(collaborator); - assertEquals("bar", collaborator); - } - - @Test - public void testScopedProxyForSecondReference() throws Exception { - doubleEnhanced.execute(new StepExecution("foo", new JobExecution(11L), 321L)); - assertTrue(TestStep.getContext().attributeNames().length > 0); - String collaborator = (String) TestStep.getContext().getAttribute("collaborator"); - assertNotNull(collaborator); - assertEquals("bar", collaborator); - } - -} diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeNestedIntegrationTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeNestedIntegrationTests.java deleted file mode 100644 index 66438ccb3..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeNestedIntegrationTests.java +++ /dev/null @@ -1,106 +0,0 @@ -package org.springframework.batch.core.scope; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.Arrays; -import java.util.List; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.Step; -import org.springframework.batch.core.StepExecution; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - - -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) -public class StepScopeNestedIntegrationTests implements BeanFactoryAware { - - @Autowired - @Qualifier("step1") - private Step step1; - - @Autowired - @Qualifier("step2") - private Step step2; - - @Autowired - @Qualifier("step3") - private Step step3; - - @Autowired - @Qualifier("parent") - private Collaborator parent; - - private StepExecution stepExecution; - - private ConfigurableListableBeanFactory beanFactory; - - private List names; - - /** - * {@inheritDoc} - */ - public void setBeanFactory(BeanFactory beanFactory) throws BeansException { - this.beanFactory = (ConfigurableListableBeanFactory) beanFactory; - } - - @Before - public void setUp() { - TestStep.reset(); - stepExecution = new StepExecution("step", new JobExecution(11L), 12L); - names = Arrays.asList(beanFactory.getBeanDefinitionNames()); - } - - @Test - public void testNestedScopedProxy() throws Exception { - assertNotNull(step1); - assertEquals("foo", parent.getName()); - assertTrue("Proxy was not created for explicitly scoped bean", names.contains("lazyBindingProxy.bar")); - assertFalse("Proxy was created for unscoped bean", names.contains("foo")); - stepExecution.getExecutionContext().putString("bar", "bar"); - step1.execute(stepExecution); - assertNotNull(stepExecution.getExecutionContext().getString("foo")); - assertEquals("bar", TestStep.getContext().getAttribute("collaborator")); - assertEquals("foo", TestStep.getContext().getAttribute("parent")); - } - - @Test - public void testNestedUnScoped() throws Exception { - assertNotNull(step2); - assertTrue("Proxy was not created for explicitly scoped bean", names.contains("lazyBindingProxy.spam")); - assertFalse("Proxy was created for unscoped bean", names.contains("bucket")); - stepExecution.getExecutionContext().putString("spam", "spam"); - step2.execute(stepExecution); - assertNotNull(stepExecution.getExecutionContext().getString("foo")); - assertEquals("spam", TestStep.getContext().getAttribute("collaborator")); - assertEquals("bucket", TestStep.getContext().getAttribute("parent")); - } - - @Test - public void testTwiceNestedScopedProxy() throws Exception { - assertNotNull(step3); - assertTrue("Proxy was not created for explicitly scoped bean", names.contains("lazyBindingProxy.maps")); - assertFalse("Proxy was created for implicitly scoped bean", names.contains("lazyBindingProxy.rab")); - assertEquals("foo", parent.getName()); - stepExecution.getExecutionContext().putString("maps", "maps"); - stepExecution.getExecutionContext().putString("rab", "rab"); - step3.execute(stepExecution); - assertNotNull(stepExecution.getExecutionContext().getString("foo")); - assertEquals("maps", TestStep.getContext().getAttribute("collaborator")); - assertEquals("rab", TestStep.getContext().getAttribute("parent")); - } - -} diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopePerformanceTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopePerformanceTests.java deleted file mode 100644 index 52baeb436..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopePerformanceTests.java +++ /dev/null @@ -1,77 +0,0 @@ -package org.springframework.batch.core.scope; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.StepExecution; -import org.springframework.batch.core.scope.context.StepSynchronizationManager; -import org.springframework.batch.item.ExecutionContext; -import org.springframework.batch.item.ItemStreamReader; -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.util.StopWatch; - -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) -public class StepScopePerformanceTests implements ApplicationContextAware { - - private Log logger = LogFactory.getLog(getClass()); - - private ApplicationContext applicationContext; - - public void setApplicationContext(ApplicationContext applicationContext) - throws BeansException { - this.applicationContext = applicationContext; - - } - - @Before - public void start() throws Exception { - int count = doTest("vanilla", "warmup"); - logger.info("Item count: "+count); - StepSynchronizationManager.register(new StepExecution("step", new JobExecution(0L),1L)); - } - - @Before - @After - public void cleanup() { - StepSynchronizationManager.close(); - } - - @Test - public void testVanilla() throws Exception { - int count = doTest("vanilla", "vanilla"); - logger.info("Item count: "+count); - } - - @Test - public void testProxied() throws Exception { - int count = doTest("proxied", "proxied"); - logger.info("Item count: "+count); - } - - private int doTest(String name, String test) throws Exception { - @SuppressWarnings("unchecked") - ItemStreamReader reader = (ItemStreamReader) applicationContext.getBean(name); - reader.open(new ExecutionContext()); - StopWatch stopWatch = new StopWatch(test); - stopWatch.start(); - int count = 0; - while (reader.read() != null) { - // do nothing - count++; - } - stopWatch.stop(); - reader.close(); - logger.info(stopWatch.shortSummary()); - return count; - } - -} diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopePlaceholderIntegrationTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopePlaceholderIntegrationTests.java deleted file mode 100644 index a526767bf..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopePlaceholderIntegrationTests.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.springframework.batch.core.scope; - -import static org.junit.Assert.assertEquals; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.StepExecution; -import org.springframework.batch.core.scope.context.StepSynchronizationManager; -import org.springframework.batch.item.ExecutionContext; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.ListableBeanFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) -public class StepScopePlaceholderIntegrationTests implements BeanFactoryAware { - - @Autowired - @Qualifier("simple") - private Collaborator simple; - - @Autowired - @Qualifier("compound") - private Collaborator compound; - - @Autowired - @Qualifier("value") - private Collaborator value; - - @Autowired - @Qualifier("ref") - private Collaborator ref; - - @Autowired - @Qualifier("bar") - private Collaborator bar; - - private StepExecution stepExecution; - - private ListableBeanFactory beanFactory; - - private int beanCount; - - public void setBeanFactory(BeanFactory beanFactory) throws BeansException { - this.beanFactory = (ListableBeanFactory) beanFactory; - } - - @Before - public void start() { - - StepSynchronizationManager.close(); - stepExecution = new StepExecution("foo", new JobExecution(11L), 123L); - - ExecutionContext executionContext = new ExecutionContext(); - executionContext.put("foo", "bar"); - executionContext.put("parent", bar); - - stepExecution.setExecutionContext(executionContext); - StepSynchronizationManager.register(stepExecution); - - beanCount = beanFactory.getBeanDefinitionCount(); - - } - - @After - public void cleanUp() { - StepSynchronizationManager.close(); - // Check that all temporary bean definitions are cleaned up - assertEquals(beanCount, beanFactory.getBeanDefinitionCount()); - } - - @Test - public void testSimpleProperty() throws Exception { - assertEquals("bar", simple.getName()); - // Once the step context is set up it should be baked into the proxies - // so changing it now should have no effect - stepExecution.getExecutionContext().put("foo", "wrong!"); - assertEquals("bar", simple.getName()); - } - - @Test - public void testCompoundProperty() throws Exception { - assertEquals("bar-bar", compound.getName()); - } - - @Test - public void testParentByRef() throws Exception { - assertEquals("bar", ref.getParent().getName()); - } - - @Test - public void testParentByValue() throws Exception { - assertEquals("bar", value.getParent().getName()); - } - -} diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeProxyTargetClassIntegrationTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeProxyTargetClassIntegrationTests.java deleted file mode 100644 index 8c1432819..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeProxyTargetClassIntegrationTests.java +++ /dev/null @@ -1,72 +0,0 @@ -package org.springframework.batch.core.scope; - -import static org.junit.Assert.assertEquals; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.StepExecution; -import org.springframework.batch.core.scope.context.StepSynchronizationManager; -import org.springframework.batch.item.ExecutionContext; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.BeanFactoryAware; -import org.springframework.beans.factory.ListableBeanFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) -public class StepScopeProxyTargetClassIntegrationTests implements BeanFactoryAware { - - @Autowired - @Qualifier("simple") - private TestCollaborator simple; - - private StepExecution stepExecution; - - private ListableBeanFactory beanFactory; - - private int beanCount; - - public void setBeanFactory(BeanFactory beanFactory) throws BeansException { - this.beanFactory = (ListableBeanFactory) beanFactory; - } - - @Before - public void start() { - - StepSynchronizationManager.close(); - stepExecution = new StepExecution("foo", new JobExecution(11L), 123L); - - ExecutionContext executionContext = new ExecutionContext(); - executionContext.put("foo", "bar"); - - stepExecution.setExecutionContext(executionContext); - StepSynchronizationManager.register(stepExecution); - - beanCount = beanFactory.getBeanDefinitionCount(); - - } - - @After - public void cleanUp() { - StepSynchronizationManager.close(); - // Check that all temporary bean definitions are cleaned up - assertEquals(beanCount, beanFactory.getBeanDefinitionCount()); - } - - @Test - public void testSimpleProperty() throws Exception { - assertEquals("bar", simple.getName()); - // Once the step context is set up it should be baked into the proxies - // so changing it now should have no effect - stepExecution.getExecutionContext().put("foo", "wrong!"); - assertEquals("bar", simple.getName()); - } - -} diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeStartupIntegrationTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeStartupIntegrationTests.java deleted file mode 100644 index fab5e2a69..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeStartupIntegrationTests.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.springframework.batch.core.scope; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - - -@ContextConfiguration -@RunWith(SpringJUnit4ClassRunner.class) -public class StepScopeStartupIntegrationTests { - - @Test - public void testScopedProxyDuringStartup() throws Exception { - } - -} diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeTests.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeTests.java deleted file mode 100644 index f32d5efff..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/StepScopeTests.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * Copyright 2006-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.batch.core.scope; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.springframework.batch.core.JobExecution; -import org.springframework.batch.core.StepExecution; -import org.springframework.batch.core.scope.context.StepContext; -import org.springframework.batch.core.scope.context.StepSynchronizationManager; -import org.springframework.beans.BeansException; -import org.springframework.beans.factory.ObjectFactory; -import org.springframework.context.support.StaticApplicationContext; - -/** - * @author Dave Syer - * - */ -public class StepScopeTests { - - private StepScope scope = new StepScope(); - - private StepExecution stepExecution = new StepExecution("foo", new JobExecution(0L), 123L); - - private StepContext context; - - @Before - public void setUp() throws Exception { - context = StepSynchronizationManager.register(stepExecution); - } - - @After - public void tearDown() throws Exception { - StepSynchronizationManager.close(); - } - - @Test - public void testGetWithNoContext() throws Exception { - final String foo = "bar"; - StepSynchronizationManager.close(); - try { - scope.get("foo", new ObjectFactory() { - public String getObject() throws BeansException { - return foo; - } - }); - fail("Expected IllegalStateException"); - } - catch (IllegalStateException e) { - // expected - } - - } - - @Test - public void testGetWithNothingAlreadyThere() { - final String foo = "bar"; - Object value = scope.get("foo", new ObjectFactory() { - public String getObject() throws BeansException { - return foo; - } - }); - assertEquals(foo, value); - assertTrue(context.hasAttribute("foo")); - } - - @Test - public void testGetWithSomethingAlreadyThere() { - context.setAttribute("foo", "bar"); - Object value = scope.get("foo", new ObjectFactory() { - public Object getObject() throws BeansException { - return null; - } - }); - assertEquals("bar", value); - assertTrue(context.hasAttribute("foo")); - } - - @Test - public void testGetWithSomethingAlreadyInParentContext() { - context.setAttribute("foo", "bar"); - StepContext context = StepSynchronizationManager.register(new StepExecution("bar", new JobExecution(0L))); - Object value = scope.get("foo", new ObjectFactory() { - public String getObject() throws BeansException { - return "spam"; - } - }); - assertEquals("spam", value); - assertTrue(context.hasAttribute("foo")); - StepSynchronizationManager.close(); - assertEquals("bar", scope.get("foo", null)); - } - - @Test - public void testParentContextWithSameStepExecution() { - context.setAttribute("foo", "bar"); - StepContext other = StepSynchronizationManager.register(stepExecution); - assertSame(other, context); - } - - @Test - public void testGetConversationId() { - String id = scope.getConversationId(); - assertNotNull(id); - } - - @Test - public void testRegisterDestructionCallback() { - final List list = new ArrayList(); - context.setAttribute("foo", "bar"); - scope.registerDestructionCallback("foo", new Runnable() { - public void run() { - list.add("foo"); - } - }); - assertEquals(0, list.size()); - // When the context is closed, provided the attribute exists the - // callback is called... - context.close(); - assertEquals(1, list.size()); - } - - @Test - public void testRegisterAnotherDestructionCallback() { - final List list = new ArrayList(); - context.setAttribute("foo", "bar"); - scope.registerDestructionCallback("foo", new Runnable() { - public void run() { - list.add("foo"); - } - }); - scope.registerDestructionCallback("foo", new Runnable() { - public void run() { - list.add("bar"); - } - }); - assertEquals(0, list.size()); - // When the context is closed, provided the attribute exists the - // callback is called... - context.close(); - assertEquals(2, list.size()); - } - - @Test - public void testRemove() { - context.setAttribute("foo", "bar"); - scope.remove("foo"); - assertFalse(context.hasAttribute("foo")); - } - - @Test - public void testOrder() throws Exception { - assertEquals(Integer.MAX_VALUE, scope.getOrder()); - scope.setOrder(11); - assertEquals(11, scope.getOrder()); - } - - @Test - public void testName() throws Exception { - scope.setName("foo"); - StaticApplicationContext beanFactory = new StaticApplicationContext(); - scope.postProcessBeanFactory(beanFactory.getDefaultListableBeanFactory()); - String[] scopes = beanFactory.getDefaultListableBeanFactory().getRegisteredScopeNames(); - assertEquals(1, scopes.length); - assertEquals("foo", scopes[0]); - } - -} diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/TestAdvice.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/TestAdvice.java deleted file mode 100644 index e434c363b..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/TestAdvice.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.springframework.batch.core.scope; - -import java.util.ArrayList; -import java.util.List; - -import org.aspectj.lang.annotation.AfterReturning; -import org.aspectj.lang.annotation.Aspect; - -@Aspect -public class TestAdvice { - - public static final List names = new ArrayList(); - - @AfterReturning(pointcut="execution(String org.springframework.batch.core.scope.Collaborator+.getName(..))", returning="name") - public void registerCollaborator(String name) { - names.add(name); - } - - -} diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/TestCollaborator.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/TestCollaborator.java deleted file mode 100644 index aa525ec99..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/TestCollaborator.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.springframework.batch.core.scope; - -import java.io.Serializable; - - -public class TestCollaborator implements Collaborator, Serializable { - - private String name; - - private Collaborator parent; - - public Collaborator getParent() { - return parent; - } - - public void setParent(Collaborator parent) { - this.parent = parent; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - -} diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/TestDisposableCollaborator.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/TestDisposableCollaborator.java deleted file mode 100644 index 70596dfd3..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/TestDisposableCollaborator.java +++ /dev/null @@ -1,14 +0,0 @@ -package org.springframework.batch.core.scope; - -import org.springframework.beans.factory.DisposableBean; - - -public class TestDisposableCollaborator extends TestCollaborator implements DisposableBean { - - public static volatile String message = "none"; - - public void destroy() throws Exception { - message = "destroyed"; - } - -} diff --git a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/TestStep.java b/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/TestStep.java deleted file mode 100644 index a9bb84ebf..000000000 --- a/spring-batch-core-tests/src/test/java/org/springframework/batch/core/scope/TestStep.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.springframework.batch.core.scope; - -import org.springframework.batch.core.JobInterruptedException; -import org.springframework.batch.core.Step; -import org.springframework.batch.core.StepExecution; -import org.springframework.batch.core.scope.context.StepContext; -import org.springframework.batch.core.scope.context.StepSynchronizationManager; - -public class TestStep implements Step { - - private static StepContext context; - - private Collaborator collaborator; - - public void setCollaborator(Collaborator collaborator) { - this.collaborator = collaborator; - } - - public static StepContext getContext() { - return context; - } - - public static void reset() { - context = null; - } - - public void execute(StepExecution stepExecution) throws JobInterruptedException { - context = StepSynchronizationManager.getContext(); - setContextFromCollaborator(); - stepExecution.getExecutionContext().put("foo", "changed but it shouldn't affect the collaborator"); - setContextFromCollaborator(); - } - - private void setContextFromCollaborator() { - if (context != null) { - context.setAttribute("collaborator", collaborator.getName()); - context.setAttribute("collaborator.class", collaborator.getClass().toString()); - if (collaborator.getParent()!=null) { - context.setAttribute("parent", collaborator.getParent().getName()); - context.setAttribute("parent.class", collaborator.getParent().getClass().toString()); - } - } - } - - public String getName() { - return "foo"; - } - - public int getStartLimit() { - return Integer.MAX_VALUE; - } - - public boolean isAllowStartIfComplete() { - return false; - } - -} diff --git a/spring-batch-core-tests/src/test/resources/log4j.properties b/spring-batch-core-tests/src/test/resources/log4j.properties deleted file mode 100644 index 6d5422d74..000000000 --- a/spring-batch-core-tests/src/test/resources/log4j.properties +++ /dev/null @@ -1,13 +0,0 @@ -log4j.rootCategory=INFO, stdout - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout -log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n - -log4j.category.org.apache.activemq=ERROR -log4j.category.org.springframework.batch=DEBUG -log4j.category.org.springframework.transaction=INFO - -log4j.category.org.hibernate.SQL=DEBUG -# for debugging datasource initialization -# log4j.category.test.jdbc=DEBUG diff --git a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests-context.xml b/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests-context.xml deleted file mode 100644 index 723774353..000000000 --- a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/AsyncStepScopeIntegrationTests-context.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/PlaceholderTests-context.xml b/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/PlaceholderTests-context.xml deleted file mode 100644 index af7afe9c2..000000000 --- a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/PlaceholderTests-context.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - foo - 100 - a,b,c - - - diff --git a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeDestructionCallbackIntegrationTests-context.xml b/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeDestructionCallbackIntegrationTests-context.xml deleted file mode 100644 index 039312d0d..000000000 --- a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeDestructionCallbackIntegrationTests-context.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeIntegrationTests-context.xml b/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeIntegrationTests-context.xml deleted file mode 100644 index dc92521e1..000000000 --- a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeIntegrationTests-context.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeNestedIntegrationTests-context.xml b/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeNestedIntegrationTests-context.xml deleted file mode 100644 index cb1a6088e..000000000 --- a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeNestedIntegrationTests-context.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bucket - - - - - - - \ No newline at end of file diff --git a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopePerformanceTests-context.xml b/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopePerformanceTests-context.xml deleted file mode 100644 index a7692b249..000000000 --- a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopePerformanceTests-context.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopePerformanceTests-input.txt b/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopePerformanceTests-input.txt deleted file mode 100644 index f3307e99c..000000000 --- a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopePerformanceTests-input.txt +++ /dev/null @@ -1,660 +0,0 @@ -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spamfoo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spamfoo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spamfoo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spamfoo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spamfoo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spamfoo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spamfoo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spamfoo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spamfoo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spamfoo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spamfoo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spamfoo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam -foo bar spam diff --git a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopePlaceholderIntegrationTests-context.xml b/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopePlaceholderIntegrationTests-context.xml deleted file mode 100644 index bb82623c7..000000000 --- a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopePlaceholderIntegrationTests-context.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeProxyTargetClassIntegrationTests-context.xml b/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeProxyTargetClassIntegrationTests-context.xml deleted file mode 100644 index 56b52816c..000000000 --- a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeProxyTargetClassIntegrationTests-context.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeStartupIntegrationTests-context.xml b/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeStartupIntegrationTests-context.xml deleted file mode 100644 index 3162bba5b..000000000 --- a/spring-batch-core-tests/src/test/resources/org/springframework/batch/core/scope/StepScopeStartupIntegrationTests-context.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-core/.settings/org.maven.ide.eclipse.prefs b/spring-batch-core/.settings/org.maven.ide.eclipse.prefs index b49152cf9..1c714f57f 100644 --- a/spring-batch-core/.settings/org.maven.ide.eclipse.prefs +++ b/spring-batch-core/.settings/org.maven.ide.eclipse.prefs @@ -1,5 +1,5 @@ -#Sat Jun 20 14:28:54 BST 2009 -activeProfiles= +#Tue Jul 07 12:34:28 BST 2009 +activeProfiles=spring3 eclipse.preferences.version=1 fullBuildGoals=process-test-resources includeModules=false diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/StepScope.java b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/StepScope.java index 8dde3ca72..1283eb28e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/scope/StepScope.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/scope/StepScope.java @@ -111,6 +111,12 @@ public class StepScope implements Scope, BeanFactoryPostProcessor, Ordered { public void setProxyTargetClass(boolean proxyTargetClass) { this.proxyTargetClass = proxyTargetClass; } + + // Implement missing method from Spring 3.0 SPI. + public Object resolveContextualObject(String key) { + StepContext context = getContext(); + return context.getAttribute(key); + } /** * @see Scope#get(String, ObjectFactory) diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeTests.java index facdd69bc..216eefce0 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeTests.java @@ -30,21 +30,21 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; */ public class AutoRegisteringStepScopeTests { - @SuppressWarnings("unchecked") @Test public void testJobElement() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeForJobElementTests-context.xml"); - Map beans = ctx.getBeansOfType(StepScope.class); + @SuppressWarnings("unchecked") + Map beans = ctx.getBeansOfType(StepScope.class); assertTrue("StepScope not defined properly", beans.size() == 1); } - @SuppressWarnings("unchecked") @Test public void testStepElement() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("org/springframework/batch/core/configuration/xml/AutoRegisteringStepScopeForStepElementTests-context.xml"); - Map beans = ctx.getBeansOfType(StepScope.class); + @SuppressWarnings("unchecked") + Map beans = ctx.getBeansOfType(StepScope.class); assertTrue("StepScope not defined properly", beans.size() == 1); } diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java index c0f230a67..40c97b7b5 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/ChunkElementParserTests.java @@ -174,7 +174,7 @@ public class ChunkElementParserTests { @SuppressWarnings("unchecked") private Set> getExceptionClasses(String stepName, String type, ApplicationContext ctx) throws Exception { - Map beans = ctx.getBeansOfType(Step.class); + Map beans = ctx.getBeansOfType(Step.class); assertTrue(beans.containsKey(stepName)); Object step = ctx.getBean(stepName); assertTrue(step instanceof TaskletStep); @@ -190,7 +190,7 @@ public class ChunkElementParserTests { @SuppressWarnings("unchecked") private Collection getStreams(String stepName, ApplicationContext ctx) throws Exception { - Map beans = ctx.getBeansOfType(Step.class); + Map beans = ctx.getBeansOfType(Step.class); assertTrue(beans.containsKey(stepName)); Object step = ctx.getBean(stepName); assertTrue(step instanceof TaskletStep); @@ -201,7 +201,7 @@ public class ChunkElementParserTests { @SuppressWarnings("unchecked") private Collection getRetryListeners(String stepName, ApplicationContext ctx) throws Exception { - Map beans = ctx.getBeansOfType(Step.class); + Map beans = ctx.getBeansOfType(Step.class); assertTrue(beans.containsKey(stepName)); Object step = ctx.getBean(stepName); assertTrue(step instanceof TaskletStep); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerParserTests.java index c8a873112..6a42584d1 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepListenerParserTests.java @@ -89,7 +89,7 @@ public class StepListenerParserTests { @SuppressWarnings("unchecked") private List getListeners(String stepName, ApplicationContext ctx) throws Exception { - Map beans = ctx.getBeansOfType(Step.class); + Map beans = ctx.getBeansOfType(Step.class); assertTrue(beans.containsKey(stepName)); Object step = ctx.getBean(stepName); assertTrue(step instanceof TaskletStep); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java index 23dcd739e..52091d7ac 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/xml/StepParserTests.java @@ -61,25 +61,26 @@ public class StepParserTests { "org/springframework/batch/core/configuration/xml/StepParserParentAttributeTests-context.xml"); } - @SuppressWarnings("unchecked") @Test public void testTaskletStepAttributes() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/StepParserTaskletAttributesTests-context.xml"); - Map beans = ctx.getBeansOfType(StepParserStepFactoryBean.class); + @SuppressWarnings("unchecked") + Map beans = ctx.getBeansOfType(StepParserStepFactoryBean.class); String factoryName = (String) beans.keySet().toArray()[0]; + @SuppressWarnings("unchecked") StepParserStepFactoryBean factory = (StepParserStepFactoryBean) beans .get(factoryName); TaskletStep bean = (TaskletStep) factory.getObject(); assertEquals("wrong start-limit:", 25, bean.getStartLimit()); } - @SuppressWarnings("unchecked") @Test public void testStepParserBeanName() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/StepParserBeanNameTests-context.xml"); - Map beans = ctx.getBeansOfType(Step.class); + @SuppressWarnings("unchecked") + Map beans = ctx.getBeansOfType(Step.class); assertTrue("'s1' bean not found", beans.containsKey("s1")); Step s1 = (Step) ctx.getBean("s1"); assertEquals("wrong name", "s1", s1.getName()); @@ -91,12 +92,12 @@ public class StepParserTests { "org/springframework/batch/core/configuration/xml/StepParserCommitIntervalCompletionPolicyTests-context.xml"); } - @SuppressWarnings("unchecked") @Test public void testStepParserCommitInterval() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/StepParserCommitIntervalTests-context.xml"); - Map beans = ctx.getBeansOfType(Step.class); + @SuppressWarnings("unchecked") + Map beans = ctx.getBeansOfType(Step.class); assertTrue("'s1' bean not found", beans.containsKey("s1")); Step s1 = (Step) ctx.getBean("s1"); CompletionPolicy completionPolicy = getCompletionPolicy(s1); @@ -104,12 +105,12 @@ public class StepParserTests { assertEquals(25, ReflectionTestUtils.getField(completionPolicy, "chunkSize")); } - @SuppressWarnings("unchecked") @Test public void testStepParserCompletionPolicy() throws Exception { ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext( "org/springframework/batch/core/configuration/xml/StepParserCompletionPolicyTests-context.xml"); - Map beans = ctx.getBeansOfType(Step.class); + @SuppressWarnings("unchecked") + Map beans = ctx.getBeansOfType(Step.class); assertTrue("'s1' bean not found", beans.containsKey("s1")); Step s1 = (Step) ctx.getBean("s1"); CompletionPolicy completionPolicy = getCompletionPolicy(s1); diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceErrorTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceErrorTests-context.xml index 44b47ea6b..f3e809972 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceErrorTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceErrorTests-context.xml @@ -23,19 +23,25 @@ - - - - - - - + + + + + + + + + + + + - - - - - + + + + diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceTests-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceTests-context.xml index bf9e8c67a..565df2acb 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceTests-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/scope/util/PlaceholderTargetSourceTests-context.xml @@ -160,19 +160,25 @@ - - - - - - - + + + + + + + + + + + + - - - - - + + + + diff --git a/spring-batch-infrastructure/.settings/org.maven.ide.eclipse.prefs b/spring-batch-infrastructure/.settings/org.maven.ide.eclipse.prefs index 99ef11e30..8ef675f47 100644 --- a/spring-batch-infrastructure/.settings/org.maven.ide.eclipse.prefs +++ b/spring-batch-infrastructure/.settings/org.maven.ide.eclipse.prefs @@ -1,5 +1,5 @@ -#Sat Jun 20 14:28:53 BST 2009 -activeProfiles= +#Tue Jul 07 11:35:38 BST 2009 +activeProfiles=spring3 eclipse.preferences.version=1 fullBuildGoals=process-test-resources includeModules=false diff --git a/spring-batch-parent/.classpath b/spring-batch-parent/.classpath index a225f00db..d0bec0f76 100644 --- a/spring-batch-parent/.classpath +++ b/spring-batch-parent/.classpath @@ -1,6 +1,6 @@ - + diff --git a/spring-batch-parent/.settings/org.maven.ide.eclipse.prefs b/spring-batch-parent/.settings/org.maven.ide.eclipse.prefs index 0fda837c8..a2aa11b5e 100644 --- a/spring-batch-parent/.settings/org.maven.ide.eclipse.prefs +++ b/spring-batch-parent/.settings/org.maven.ide.eclipse.prefs @@ -1,4 +1,4 @@ -#Sun Jun 21 09:14:45 BST 2009 +#Tue Jul 07 11:37:24 BST 2009 activeProfiles= eclipse.preferences.version=1 fullBuildGoals=process-test-resources diff --git a/spring-batch-parent/pom.xml b/spring-batch-parent/pom.xml index b6751c7ff..45ff8d7fc 100644 --- a/spring-batch-parent/pom.xml +++ b/spring-batch-parent/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 org.springframework.batch spring-batch-parent @@ -11,6 +12,7 @@ true 2.5.6 + 4.4 1.0.0.M2 @@ -27,6 +29,25 @@ true + + spring3 + + 3.0.0.BUILD-SNAPSHOT + 4.6 + + + + spring-snapshots + http://s3.amazonaws.com/maven.springframework.org/snapshot + + false + + + true + + + + staging @@ -213,7 +234,7 @@ junit junit - 4.4 + ${junit.version} test @@ -428,6 +449,12 @@ org.springframework spring-context-support ${spring.framework.version} + + + quartz + quartz + + org.springframework diff --git a/spring-batch-samples/.settings/org.maven.ide.eclipse.prefs b/spring-batch-samples/.settings/org.maven.ide.eclipse.prefs index b49152cf9..c1c86bd81 100644 --- a/spring-batch-samples/.settings/org.maven.ide.eclipse.prefs +++ b/spring-batch-samples/.settings/org.maven.ide.eclipse.prefs @@ -1,5 +1,5 @@ -#Sat Jun 20 14:28:54 BST 2009 -activeProfiles= +#Tue Jul 07 12:57:17 BST 2009 +activeProfiles=spring3 eclipse.preferences.version=1 fullBuildGoals=process-test-resources includeModules=false diff --git a/spring-batch-samples/pom.xml b/spring-batch-samples/pom.xml index 98403ec01..200ae9b96 100644 --- a/spring-batch-samples/pom.xml +++ b/spring-batch-samples/pom.xml @@ -93,9 +93,9 @@ - opensymphony - quartz-all - 1.6.0 + org.opensymphony.quartz + quartz + 1.6.1 mysql diff --git a/spring-batch-samples/src/main/resources/jobs/groovyJob.xml b/spring-batch-samples/src/main/resources/jobs/groovyJob.xml index 8540812fb..fafa0ff7f 100644 --- a/spring-batch-samples/src/main/resources/jobs/groovyJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/groovyJob.xml @@ -6,7 +6,7 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd"> - + diff --git a/spring-batch-samples/src/main/resources/org/springframework/batch/sample/config/common-context.xml b/spring-batch-samples/src/main/resources/org/springframework/batch/sample/config/common-context.xml index c67c7a91c..50c791c91 100644 --- a/spring-batch-samples/src/main/resources/org/springframework/batch/sample/config/common-context.xml +++ b/spring-batch-samples/src/main/resources/org/springframework/batch/sample/config/common-context.xml @@ -10,19 +10,7 @@ - - - - - - - - - - - - - + diff --git a/spring-batch-test/src/test/resources/simple-job-launcher-context.xml b/spring-batch-test/src/test/resources/simple-job-launcher-context.xml index db5dc6951..2eaf89b29 100755 --- a/spring-batch-test/src/test/resources/simple-job-launcher-context.xml +++ b/spring-batch-test/src/test/resources/simple-job-launcher-context.xml @@ -1,9 +1,7 @@ - + - + - + - - + + - - + + - - + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + \ No newline at end of file