diff --git a/samples/.springBeans b/samples/.springBeans
index b50e802f7..e5728c0c6 100644
--- a/samples/.springBeans
+++ b/samples/.springBeans
@@ -1,8 +1,10 @@
-
- xml
-
+ 1
+
+
+
+
src/main/resources/jobs/fixedLengthImportJob.xml
src/main/resources/jobs/multilineJob.xml
@@ -25,7 +27,7 @@
src/main/resources/jobs/compositeProcessorSampleJob.xml
src/main/resources/jobs/nflJob.xml
src/main/resources/jobs/simpleTaskletJob.xml
- src/main/resources/beanRefContext.xml
+ src/main/resources/beanRefContext.xml
@@ -151,5 +153,15 @@
src/main/resources/jobs/nflJob.xml
+
+
+ true
+ false
+
+ src/main/resources/data-source-context.xml
+ src/main/resources/jobs/simpleTaskletJob.xml
+ src/main/resources/simple-container-definition.xml
+
+
diff --git a/samples/src/main/resources/jobs/adhocLoopJob.xml b/samples/src/main/resources/jobs/adhocLoopJob.xml
index ac1d6624d..bd945ca33 100644
--- a/samples/src/main/resources/jobs/adhocLoopJob.xml
+++ b/samples/src/main/resources/jobs/adhocLoopJob.xml
@@ -7,50 +7,22 @@
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
@@ -118,4 +90,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml b/samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml
index 521ad6087..a2e30703b 100644
--- a/samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml
+++ b/samples/src/main/resources/jobs/beanWrapperMapperSampleJob.xml
@@ -7,15 +7,14 @@
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
-
-
-
+
+
-
+
@@ -31,10 +30,10 @@
-
+
-
+
@@ -47,7 +46,7 @@
-
+
diff --git a/samples/src/main/resources/jobs/compositeProcessorSampleJob.xml b/samples/src/main/resources/jobs/compositeProcessorSampleJob.xml
index 3be252acf..caf5f053a 100644
--- a/samples/src/main/resources/jobs/compositeProcessorSampleJob.xml
+++ b/samples/src/main/resources/jobs/compositeProcessorSampleJob.xml
@@ -7,14 +7,13 @@
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
-
-
-
+
+
-
+
@@ -40,7 +39,7 @@
-
+
diff --git a/samples/src/main/resources/jobs/fixedLengthImportJob.xml b/samples/src/main/resources/jobs/fixedLengthImportJob.xml
index 7e2836bee..27557ee94 100644
--- a/samples/src/main/resources/jobs/fixedLengthImportJob.xml
+++ b/samples/src/main/resources/jobs/fixedLengthImportJob.xml
@@ -7,9 +7,8 @@
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
-
-
-
+
+
diff --git a/samples/src/main/resources/jobs/hibernateJob.xml b/samples/src/main/resources/jobs/hibernateJob.xml
index e97fbcc64..6975e84e7 100644
--- a/samples/src/main/resources/jobs/hibernateJob.xml
+++ b/samples/src/main/resources/jobs/hibernateJob.xml
@@ -11,9 +11,8 @@
Example for Hibernate integration.
-
-
-
+
+
diff --git a/samples/src/main/resources/jobs/ibatisJob.xml b/samples/src/main/resources/jobs/ibatisJob.xml
index a997709ae..1be1d4c27 100644
--- a/samples/src/main/resources/jobs/ibatisJob.xml
+++ b/samples/src/main/resources/jobs/ibatisJob.xml
@@ -11,12 +11,10 @@
Example for iBATIS integration.
+
+
-
-
-
-
-
+
diff --git a/samples/src/main/resources/jobs/infiniteLoopJob.xml b/samples/src/main/resources/jobs/infiniteLoopJob.xml
index b46d4de62..ee178e579 100644
--- a/samples/src/main/resources/jobs/infiniteLoopJob.xml
+++ b/samples/src/main/resources/jobs/infiniteLoopJob.xml
@@ -6,12 +6,11 @@
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
-
-
-
-
+
+
@@ -29,9 +28,9 @@
-
+
-
+
diff --git a/samples/src/main/resources/jobs/multilineJob.xml b/samples/src/main/resources/jobs/multilineJob.xml
index c474b4841..3fb673489 100644
--- a/samples/src/main/resources/jobs/multilineJob.xml
+++ b/samples/src/main/resources/jobs/multilineJob.xml
@@ -7,16 +7,13 @@
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
-
-
-
+
+
-
+
@@ -41,7 +38,7 @@
-
+
diff --git a/samples/src/main/resources/jobs/multilineOrderJob.xml b/samples/src/main/resources/jobs/multilineOrderJob.xml
index 9f5fe3405..2b1ab1ce1 100644
--- a/samples/src/main/resources/jobs/multilineOrderJob.xml
+++ b/samples/src/main/resources/jobs/multilineOrderJob.xml
@@ -10,12 +10,10 @@
-
-
-
+
+
-
+
diff --git a/samples/src/main/resources/jobs/nflJob.xml b/samples/src/main/resources/jobs/nflJob.xml
index 958160400..f6384ba51 100644
--- a/samples/src/main/resources/jobs/nflJob.xml
+++ b/samples/src/main/resources/jobs/nflJob.xml
@@ -1,15 +1,18 @@
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
-
-
-
+
+
-
@@ -37,7 +40,8 @@
-
+
@@ -169,4 +173,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/samples/src/main/resources/jobs/restartSample.xml b/samples/src/main/resources/jobs/restartSample.xml
index f8e1cb7b0..4d45c57eb 100644
--- a/samples/src/main/resources/jobs/restartSample.xml
+++ b/samples/src/main/resources/jobs/restartSample.xml
@@ -7,9 +7,9 @@
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
-
-
-
+
+
+
@@ -36,8 +36,6 @@
-
-
-
\ No newline at end of file
diff --git a/samples/src/main/resources/jobs/simpleTaskletJob.xml b/samples/src/main/resources/jobs/simpleTaskletJob.xml
index 67731eece..e9cc97f6e 100644
--- a/samples/src/main/resources/jobs/simpleTaskletJob.xml
+++ b/samples/src/main/resources/jobs/simpleTaskletJob.xml
@@ -7,24 +7,21 @@
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
-
-
-
+
+
-
+
-
+
-
+
diff --git a/samples/src/main/resources/jobs/tradeJob.xml b/samples/src/main/resources/jobs/tradeJob.xml
index 4f33170ff..1aee2415d 100644
--- a/samples/src/main/resources/jobs/tradeJob.xml
+++ b/samples/src/main/resources/jobs/tradeJob.xml
@@ -9,13 +9,9 @@
http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
-
-
-
-
+
+
diff --git a/samples/src/main/resources/jobs/xmlStaxJob.xml b/samples/src/main/resources/jobs/xmlStaxJob.xml
index d4c2f95fd..cd88b3bed 100644
--- a/samples/src/main/resources/jobs/xmlStaxJob.xml
+++ b/samples/src/main/resources/jobs/xmlStaxJob.xml
@@ -9,14 +9,13 @@
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
-
-
-
+
+
-
+
@@ -45,7 +44,7 @@
p:outputSource-ref="tradeStaxWriter" />
-
+
diff --git a/samples/src/main/resources/simple-container-definition.xml b/samples/src/main/resources/simple-container-definition.xml
index 23c4b2ef0..fb2c405ff 100644
--- a/samples/src/main/resources/simple-container-definition.xml
+++ b/samples/src/main/resources/simple-container-definition.xml
@@ -1,6 +1,8 @@
-
-
+
-
+
+
+
+
+
-
+
-
+
-
@@ -31,37 +44,45 @@
-
+
-
+
-
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
-
@@ -88,23 +112,28 @@
-
+
-
+
-
+
diff --git a/samples/src/test/java/org/springframework/batch/sample/AbstractBatchBootstrapSpringContextTests.java b/samples/src/test/java/org/springframework/batch/sample/AbstractBatchBootstrapSpringContextTests.java
deleted file mode 100644
index 8708034d5..000000000
--- a/samples/src/test/java/org/springframework/batch/sample/AbstractBatchBootstrapSpringContextTests.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2006-2007 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.springframework.batch.sample;
-
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.execution.launch.JobLauncher;
-import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
-
-/**
- * Abstract unit test for running functional tests by getting context locations for
- * both the container and configuration separately and having them auto wired in
- * by type. This allows the two to be completely separated, and remove any
- * 'configuration coupling' between the two. However, it is still purely
- * theoretical until a decision is made as to how job configuration and container
- * configuration files are pulled together.
- *
- * @author Lucas Ward
- *
- */
-public abstract class AbstractBatchBootstrapSpringContextTests extends AbstractDependencyInjectionSpringContextTests {
-
- private static final String CONTAINER_DEFINITION_LOCATION = "simple-container-definition.xml";
-
- JobLauncher launcher;
- JobConfiguration jobConfiguration;
-
- protected String[] getConfigLocations() {
- return new String[]{CONTAINER_DEFINITION_LOCATION, getJobConfigurationContextLocation()};
- }
-
- public void testLifecycle() throws Exception {
- launcher.run();
- }
-
- public void setLauncher(JobLauncher bootstrap){
- this.launcher = bootstrap;
- }
-
- protected abstract String getJobConfigurationContextLocation();
-}
diff --git a/samples/src/test/java/org/springframework/batch/sample/AbstractBatchLauncherTests.java b/samples/src/test/java/org/springframework/batch/sample/AbstractBatchLauncherTests.java
index dd9b0dc93..13219427f 100644
--- a/samples/src/test/java/org/springframework/batch/sample/AbstractBatchLauncherTests.java
+++ b/samples/src/test/java/org/springframework/batch/sample/AbstractBatchLauncherTests.java
@@ -1,64 +1,69 @@
-/*
- * Copyright 2006-2007 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.batch.sample;
-
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.execution.launch.JobLauncher;
-import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
-
-/**
- * @author Dave Syer
- *
- */
-public abstract class AbstractBatchLauncherTests extends AbstractDependencyInjectionSpringContextTests {
-
- protected JobLauncher launcher;
- private JobConfiguration jobConfiguration;
-
- protected ConfigurableApplicationContext createApplicationContext(
- String[] locations) {
- String[] allLocations = new String[locations.length+1];
- System.arraycopy(locations, 0, allLocations, 1, locations.length);
- allLocations[0] = "simple-container-definition.xml";
- return super.createApplicationContext(allLocations);
- }
-
- /**
- * Subclasses can provide name of job to run. We guess it by looking at the
- * unique job configuration name.
- */
- protected String getJobName() {
- return jobConfiguration.getName();
- }
-
- /**
- * @param jobConfiguration the jobConfiguration to set
- */
- public void setJobConfiguration(JobConfiguration jobConfiguration) {
- this.jobConfiguration = jobConfiguration;
- }
-
- /**
- * Public setter for the {@link JobLauncher} property.
- *
- * @param launcher the launcher to set
- */
- public void setLauncher(JobLauncher launcher) {
- this.launcher = launcher;
- }
-
-}
+/*
+ * Copyright 2006-2007 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.springframework.batch.sample;
+
+import org.springframework.batch.core.configuration.JobConfiguration;
+import org.springframework.batch.execution.launch.JobLauncher;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.test.AbstractDependencyInjectionSpringContextTests;
+
+/**
+ * Abstract unit test for running functional tests by getting context locations for
+ * both the container and configuration separately and having them auto wired in
+ * by type. This allows the two to be completely separated, and remove any
+ * 'configuration coupling' between the two. However, it is still purely
+ * theoretical until a decision is made as to how job configuration and container
+ * configuration files are pulled together.
+ *
+ * @author Lucas Ward
+ *
+ */
+public abstract class AbstractBatchLauncherTests extends AbstractDependencyInjectionSpringContextTests {
+
+ private static final String CONTAINER_DEFINITION_LOCATION = "simple-container-definition.xml";
+
+ JobLauncher launcher;
+ JobConfiguration jobConfiguration;
+
+ /* (non-Javadoc)
+ * @see org.springframework.test.AbstractSingleSpringContextTests#createApplicationContext(java.lang.String[])
+ */
+ protected ConfigurableApplicationContext createApplicationContext(
+ String[] locations) {
+ ApplicationContext parent = new ClassPathXmlApplicationContext(CONTAINER_DEFINITION_LOCATION);
+ return new ClassPathXmlApplicationContext(locations, parent);
+ }
+
+ public void setLauncher(JobLauncher bootstrap){
+ this.launcher = bootstrap;
+ }
+
+ /**
+ * Public setter for the {@link JobConfiguration} property.
+ *
+ * @param jobConfiguration the jobConfiguration to set
+ */
+ public void setJobConfiguration(JobConfiguration jobConfiguration) {
+ this.jobConfiguration = jobConfiguration;
+ }
+
+ protected String getJobName() {
+ return jobConfiguration.getName();
+ }
+}
diff --git a/samples/src/test/java/org/springframework/batch/sample/TaskExecutorLauncher.java b/samples/src/test/java/org/springframework/batch/sample/TaskExecutorLauncher.java
index e1ee5f435..92ddc6732 100644
--- a/samples/src/test/java/org/springframework/batch/sample/TaskExecutorLauncher.java
+++ b/samples/src/test/java/org/springframework/batch/sample/TaskExecutorLauncher.java
@@ -15,21 +15,43 @@
*/
package org.springframework.batch.sample;
+import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
* @author Dave Syer
- *
+ *
*/
public class TaskExecutorLauncher {
public static void main(String[] args) throws Exception {
- final String path = "jobs/adhocLoopJob.xml";
+
+ // Paths to individual job configurations. Each one must include the
+ // step scope and the jobConfigurationRegistryBeanPostProcessor.
+ final String[] paths = new String[] { "jobs/adhocLoopJob.xml",
+ "jobs/nflJob.xml" };
+
+ // The simple execution environment will be used as a parent
+ // context for each of the job contexts. The standard version of this
+ // from the Spring Batch samples does not have an MBean for the
+ // JobLauncher, nor does the JobLauncher have an asynchronous
+ // TaskExecutor. The adhocLoopJob has both, which is why it has to be
+ // included in the paths above.
+ final ApplicationContext parent = new ClassPathXmlApplicationContext(
+ "simple-container-definition.xml");
+
new Thread(new Runnable() {
public void run() {
- new ClassPathXmlApplicationContext(path);
+ for (int i = 0; i < paths.length; i++) {
+ String path = paths[i];
+ new ClassPathXmlApplicationContext(new String[] { path },
+ parent);
+ }
};
}).start();
+
+ System.out.println("Started application. Please connect using JMX.");
System.in.read();
+
}
}