From aeab6a219f0c9ab9d94b001ea47d5433275ab80f Mon Sep 17 00:00:00 2001
From: lucasward
Date: Mon, 14 Jan 2008 22:58:24 +0000
Subject: [PATCH] BATCH-273: JobConfiguration renamed to Job
---
.../support/BatchCommandLineLauncher.java | 14 +--
.../bootstrap/support/ExitCodeMapper.java | 6 +-
.../support/ExportedJobLauncher.java | 2 +-
.../support/SimpleJvmExitCodeMapper.java | 8 +-
...java => JobRegistryBeanPostProcessor.java} | 38 ++++----
...ationRegistry.java => MapJobRegistry.java} | 26 ++---
.../execution/job/DefaultJobExecutor.java | 46 ++++-----
.../execution/launch/JobExecutorFacade.java | 12 +--
.../batch/execution/launch/JobLauncher.java | 12 +--
.../launch/SimpleJobExecutorFacade.java | 56 +++++------
.../execution/launch/SimpleJobLauncher.java | 78 +++++++--------
.../repository/SimpleJobRepository.java | 94 +++++++++----------
...epConfiguration.java => AbstractStep.java} | 12 +--
.../PrototypeBeanStepExecutorFactory.java | 20 ++--
.../step/RepeatOperationsHolder.java | 4 +-
...uration.java => RepeatOperationsStep.java} | 6 +-
...StepConfiguration.java => SimpleStep.java} | 12 +--
.../step/simple/SimpleStepExecutor.java | 48 +++++-----
.../simple/SimpleStepExecutorFactory.java | 20 ++--
.../support/SimpleJvmExitCodeMapperTests.java | 16 ++--
.../bootstrap/support/StubJobLauncher.java | 8 +-
...=> JobRegistryBeanPostProcessorTests.java} | 50 +++++-----
...tryTests.java => MapJobRegistryTests.java} | 44 ++++-----
.../job/DefaultJobExecutorTests.java | 38 ++++----
.../execution/launch/InterruptJobTests.java | 16 ++--
.../launch/SimpleJobExecutorFacadeTests.java | 26 ++---
.../launch/SimpleJobLauncherTests.java | 12 +--
.../execution/launch/SimpleJobTests.java | 22 ++---
.../launch/TaskExecutorJobLauncherTests.java | 16 ++--
.../repository/SimpleJobRepositoryTests.java | 28 +++---
.../dao/JdbcStepDaoPrefixTests.java | 2 +-
...PrototypeBeanStepExecutorFactoryTests.java | 10 +-
.../step/simple/DefaultStepExecutorTests.java | 14 +--
.../step/simple/JobRepositorySupport.java | 4 +-
...ts.java => RepeatOperationsStepTests.java} | 10 +-
.../simple/SimpleStepConfigurationTests.java | 22 ++---
.../SimpleStepExecutorFactoryTests.java | 14 +--
.../simple/StepExecutorInterruptionTests.java | 14 +--
.../src/test/resources/job-configuration.xml | 6 +-
.../test-batch-environment-no-launcher.xml | 2 +-
.../support/test-batch-environment.xml | 2 +-
.../execution/configuration/test-context.xml | 16 ++--
.../resources/simple-container-definition.xml | 8 +-
43 files changed, 457 insertions(+), 457 deletions(-)
rename spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/{JobConfigurationRegistryBeanPostProcessor.java => JobRegistryBeanPostProcessor.java} (65%)
rename spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/{MapJobConfigurationRegistry.java => MapJobRegistry.java} (68%)
rename spring-batch-execution/src/main/java/org/springframework/batch/execution/step/{AbstractStepConfiguration.java => AbstractStep.java} (77%)
rename spring-batch-execution/src/main/java/org/springframework/batch/execution/step/{RepeatOperationsStepConfiguration.java => RepeatOperationsStep.java} (87%)
rename spring-batch-execution/src/main/java/org/springframework/batch/execution/step/{SimpleStepConfiguration.java => SimpleStep.java} (76%)
rename spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/{JobConfigurationRegistryBeanPostProcessorTests.java => JobRegistryBeanPostProcessorTests.java} (69%)
rename spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/{MapJobConfigurationRegistryTests.java => MapJobRegistryTests.java} (56%)
rename spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/{RepeatOperationsStepConfigurationTests.java => RepeatOperationsStepTests.java} (81%)
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/BatchCommandLineLauncher.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/BatchCommandLineLauncher.java
index e9d7aaeb8..0c5c11026 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/BatchCommandLineLauncher.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/BatchCommandLineLauncher.java
@@ -18,7 +18,7 @@ package org.springframework.batch.execution.bootstrap.support;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.batch.core.configuration.NoSuchJobConfigurationException;
+import org.springframework.batch.core.domain.NoSuchJobException;
import org.springframework.batch.core.executor.ExitCodeExceptionClassifier;
import org.springframework.batch.execution.launch.JobLauncher;
import org.springframework.batch.execution.step.simple.SimpleExitCodeExceptionClassifier;
@@ -45,14 +45,14 @@ import org.springframework.util.Assert;
*
*
* With any launch of a batch job within Spring Batch, a minimum of two contexts
- * must be loaded. One is the context containing the JobConfiguration, the other
+ * must be loaded. One is the context containing the Job, the other
* contains the 'Execution Environment'. That is, the JobExecutorFacade (which
* contains all the executors, plus the repository), the JobIdentifierFactory,
* and a normal JobLauncher. This command line launcher loads these application
* contexts by first loading the execution environment context via a
* {@link ContextSingletonBeanFactoryLocator}, which will search for the
* default key from classpath*:beanRefContext.xml to return the context. This
- * will then be used as the parent to the JobConfiguration context. All required
+ * will then be used as the parent to the Job context. All required
* dependencies of the launcher will then be satisfied by autowiring by type
* from the combined application context. Default values are provided for all
* fields except the JobLauncher. Therefore, if autowiring fails to set it (it
@@ -76,7 +76,7 @@ import org.springframework.util.Assert;
* method are optional, VM arguments are used:
*
*
- * - -Djob.configuration.path: the classpath location of the JobConfiguration
+ *
- -Djob.configuration.path: the classpath location of the Job
* to use
*
- -Djob.name: job name to be passed to the {@link JobLauncher}
*
- -Dbatch.execution.environment.key: the key in beanRefContext.xml used to
@@ -180,7 +180,7 @@ public class BatchCommandLineLauncher {
* the name of the job execution to use
* @parm parentKey the key to be loaded by
* ContextSingletonBeanFactoryLocator and used as the parent context.
- * @throws NoSuchJobConfigurationException
+ * @throws NoSuchJobException
* @throws IllegalStateException
* if JobLauncher is not autowired by the ApplicationContext
*/
@@ -220,11 +220,11 @@ public class BatchCommandLineLauncher {
status = launcher.run(jobName).getExitStatus();
}
}
- } catch (NoSuchJobConfigurationException e) {
+ } catch (NoSuchJobException e) {
logger.fatal("Could not locate JobConfiguration \"" + jobName
+ "\"", e);
status = new ExitStatus(false,
- ExitCodeMapper.NO_SUCH_JOB_CONFIGURATION);
+ ExitCodeMapper.NO_SUCH_JOB);
} catch (Throwable t) {
logger.fatal(t);
status = exceptionClassifier.classifyForExitCode(t);
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/ExitCodeMapper.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/ExitCodeMapper.java
index 8f92659b0..41d74e7bd 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/ExitCodeMapper.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/ExitCodeMapper.java
@@ -15,9 +15,9 @@ public interface ExitCodeMapper {
static int JVM_EXITCODE_COMPLETED = 0;
static int JVM_EXITCODE_GENERIC_ERROR = 1;
- static int JVM_EXITCODE_JOB_CONFIGURATION_ERROR = 2;
- public static final String NO_SUCH_JOB_CONFIGURATION = "NO_SUCH_JOB_CONFIGURATION";
- public static final String JOB_CONFIGURATION_NOT_PROVIDED = "JOB_CONFIGURATION_NOT_PROVIDED";
+ static int JVM_EXITCODE_JOB_ERROR = 2;
+ public static final String NO_SUCH_JOB = "NO_SUCH_JOB";
+ public static final String JOB_NOT_PROVIDED = "JOB_NOT_PROVIDED";
/**
* Transform the exitcode known by the batchframework into an exitcode in the
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/ExportedJobLauncher.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/ExportedJobLauncher.java
index 1f63fbb14..1afbc2859 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/ExportedJobLauncher.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/ExportedJobLauncher.java
@@ -44,7 +44,7 @@ public interface ExportedJobLauncher {
String run();
/**
- * Launch a job configuration with the given name.
+ * Launch a job with the given name.
*
* @param name the name of the job to launch
* @return a representation of the {@link ExitStatus} returned by a
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/SimpleJvmExitCodeMapper.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/SimpleJvmExitCodeMapper.java
index 74c546625..54938e9de 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/SimpleJvmExitCodeMapper.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/SimpleJvmExitCodeMapper.java
@@ -45,10 +45,10 @@ public class SimpleJvmExitCodeMapper implements ExitCodeMapper {
new Integer(JVM_EXITCODE_COMPLETED));
mapping.put(ExitStatus.FAILED.getExitCode(),
new Integer(JVM_EXITCODE_GENERIC_ERROR));
- mapping.put(ExitCodeMapper.JOB_CONFIGURATION_NOT_PROVIDED,
- new Integer(JVM_EXITCODE_JOB_CONFIGURATION_ERROR));
- mapping.put(ExitCodeMapper.NO_SUCH_JOB_CONFIGURATION,
- new Integer(JVM_EXITCODE_JOB_CONFIGURATION_ERROR));
+ mapping.put(ExitCodeMapper.JOB_NOT_PROVIDED,
+ new Integer(JVM_EXITCODE_JOB_ERROR));
+ mapping.put(ExitCodeMapper.NO_SUCH_JOB,
+ new Integer(JVM_EXITCODE_JOB_ERROR));
}
public Map getMapping() {
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobConfigurationRegistryBeanPostProcessor.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessor.java
similarity index 65%
rename from spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobConfigurationRegistryBeanPostProcessor.java
rename to spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessor.java
index 63fbae4fd..22cf81c24 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobConfigurationRegistryBeanPostProcessor.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessor.java
@@ -19,10 +19,10 @@ import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
-import org.springframework.batch.core.configuration.DuplicateJobConfigurationException;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.JobConfigurationLocator;
-import org.springframework.batch.core.configuration.JobConfigurationRegistry;
+import org.springframework.batch.core.domain.DuplicateJobException;
+import org.springframework.batch.core.domain.Job;
+import org.springframework.batch.core.domain.JobLocator;
+import org.springframework.batch.core.domain.JobRegistry;
import org.springframework.beans.BeansException;
import org.springframework.beans.FatalBeanException;
import org.springframework.beans.factory.DisposableBean;
@@ -31,28 +31,28 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.util.Assert;
/**
- * A {@link BeanPostProcessor} that registers {@link JobConfiguration} beans
- * with a {@link JobConfigurationRegistry}. Include a bean of this type along
+ * A {@link BeanPostProcessor} that registers {@link Job} beans
+ * with a {@link JobRegistry}. Include a bean of this type along
* with your job configuration, and use the same
- * {@link JobConfigurationRegistry} as a {@link JobConfigurationLocator} when
- * you need to locate a {@link JobConfigurationLocator} to launch.
+ * {@link JobRegistry} as a {@link JobLocator} when
+ * you need to locate a {@link JobLocator} to launch.
*
* @author Dave Syer
*
*/
-public class JobConfigurationRegistryBeanPostProcessor implements BeanPostProcessor, InitializingBean, DisposableBean {
+public class JobRegistryBeanPostProcessor implements BeanPostProcessor, InitializingBean, DisposableBean {
// It doesn't make sense for this to have a default value...
- private JobConfigurationRegistry jobConfigurationRegistry = null;
+ private JobRegistry jobConfigurationRegistry = null;
private Collection jobConfigurations = new HashSet();
/**
- * Injection setter for {@link JobConfigurationRegistry}.
+ * Injection setter for {@link JobRegistry}.
*
* @param jobConfigurationRegistry the jobConfigurationRegistry to set
*/
- public void setJobConfigurationRegistry(JobConfigurationRegistry jobConfigurationRegistry) {
+ public void setJobConfigurationRegistry(JobRegistry jobConfigurationRegistry) {
this.jobConfigurationRegistry = jobConfigurationRegistry;
}
@@ -66,34 +66,34 @@ public class JobConfigurationRegistryBeanPostProcessor implements BeanPostProces
}
/**
- * De-register all the {@link JobConfiguration} instances that were
+ * De-register all the {@link Job} instances that were
* regsistered by this post processor.
* @see org.springframework.beans.factory.DisposableBean#destroy()
*/
public void destroy() throws Exception {
for (Iterator iter = jobConfigurations.iterator(); iter.hasNext();) {
- JobConfiguration jobConfiguration = (JobConfiguration) iter.next();
+ Job jobConfiguration = (Job) iter.next();
jobConfigurationRegistry.unregister(jobConfiguration);
}
jobConfigurations.clear();
}
/**
- * If the bean is an instance of {@link JobConfiguration} then register it.
+ * If the bean is an instance of {@link Job} then register it.
* @throws FatalBeanException if there is a
- * {@link DuplicateJobConfigurationException}.
+ * {@link DuplicateJobException}.
*
* @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object,
* java.lang.String)
*/
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
- if (bean instanceof JobConfiguration) {
- JobConfiguration jobConfiguration = (JobConfiguration) bean;
+ if (bean instanceof Job) {
+ Job jobConfiguration = (Job) bean;
try {
jobConfigurationRegistry.register(jobConfiguration);
jobConfigurations.add(jobConfiguration);
}
- catch (DuplicateJobConfigurationException e) {
+ catch (DuplicateJobException e) {
throw new FatalBeanException("Cannot register job configuration", e);
}
}
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/MapJobConfigurationRegistry.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/MapJobRegistry.java
similarity index 68%
rename from spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/MapJobConfigurationRegistry.java
rename to spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/MapJobRegistry.java
index f0958a8ae..2482c9390 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/MapJobConfigurationRegistry.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/MapJobRegistry.java
@@ -21,21 +21,21 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
-import org.springframework.batch.core.configuration.DuplicateJobConfigurationException;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.JobConfigurationRegistry;
-import org.springframework.batch.core.configuration.ListableJobConfigurationRegistry;
-import org.springframework.batch.core.configuration.NoSuchJobConfigurationException;
+import org.springframework.batch.core.domain.DuplicateJobException;
+import org.springframework.batch.core.domain.Job;
+import org.springframework.batch.core.domain.JobRegistry;
+import org.springframework.batch.core.domain.ListableJobRegistry;
+import org.springframework.batch.core.domain.NoSuchJobException;
import org.springframework.util.Assert;
/**
- * Simple map-based implementation of {@link JobConfigurationRegistry}. Access
+ * Simple map-based implementation of {@link JobRegistry}. Access
* to the map is synchronized, guarded by an internal lock.
*
* @author Dave Syer
*
*/
-public class MapJobConfigurationRegistry implements ListableJobConfigurationRegistry {
+public class MapJobRegistry implements ListableJobRegistry {
private Map map = new HashMap();
@@ -43,13 +43,13 @@ public class MapJobConfigurationRegistry implements ListableJobConfigurationRegi
* (non-Javadoc)
* @see org.springframework.batch.container.common.configuration.JobConfigurationRegistry#registerJobConfiguration(org.springframework.batch.container.common.configuration.JobConfiguration)
*/
- public void register(JobConfiguration jobConfiguration) throws DuplicateJobConfigurationException {
+ public void register(Job jobConfiguration) throws DuplicateJobException {
Assert.notNull(jobConfiguration);
String name = jobConfiguration.getName();
Assert.notNull(name, "Job configuration must have a name.");
synchronized (map) {
if (map.containsKey(name) && jobConfiguration.equals(map.get(name))) {
- throw new DuplicateJobConfigurationException("A job configuration with this name [" + name
+ throw new DuplicateJobException("A job configuration with this name [" + name
+ "] was already registered");
}
// allow replacing job configuration with new instance
@@ -61,7 +61,7 @@ public class MapJobConfigurationRegistry implements ListableJobConfigurationRegi
* (non-Javadoc)
* @see org.springframework.batch.container.common.configuration.JobConfigurationRegistry#unregister(org.springframework.batch.container.common.configuration.JobConfiguration)
*/
- public void unregister(JobConfiguration jobConfiguration) {
+ public void unregister(Job jobConfiguration) {
String name = jobConfiguration.getName();
Assert.notNull(name, "Job configuration must have a name.");
synchronized (map) {
@@ -74,13 +74,13 @@ public class MapJobConfigurationRegistry implements ListableJobConfigurationRegi
* (non-Javadoc)
* @see org.springframework.batch.container.common.configuration.JobConfigurationLocator#getJobConfiguration(java.lang.String)
*/
- public JobConfiguration getJobConfiguration(String name) throws NoSuchJobConfigurationException {
+ public Job getJob(String name) throws NoSuchJobException {
synchronized (map) {
if (!map.containsKey(name)) {
- throw new NoSuchJobConfigurationException("No job configuration with the name [" + name
+ throw new NoSuchJobException("No job configuration with the name [" + name
+ "] was registered");
}
- return (JobConfiguration) map.get(name);
+ return (Job) map.get(name);
}
}
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/DefaultJobExecutor.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/DefaultJobExecutor.java
index a5dca5603..9e09d9abb 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/DefaultJobExecutor.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/job/DefaultJobExecutor.java
@@ -21,11 +21,11 @@ import java.util.Iterator;
import java.util.List;
import org.springframework.batch.common.ExceptionClassifier;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.StepConfiguration;
import org.springframework.batch.core.domain.BatchStatus;
+import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobInstance;
+import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
import org.springframework.batch.core.executor.ExitCodeExceptionClassifier;
@@ -61,16 +61,16 @@ public class DefaultJobExecutor implements JobExecutor {
* Run the specified job by looping through the steps and delegating to the
* {@link StepExecutor}.
*
- * @see org.springframework.batch.core.executor.JobExecutor#run(org.springframework.batch.core.configuration.JobConfiguration,
+ * @see org.springframework.batch.core.executor.JobExecutor#run(org.springframework.batch.core.domain.Job,
* org.springframework.batch.core.domain.JobExecution)
*/
- public ExitStatus run(JobConfiguration configuration, JobExecution execution)
+ public ExitStatus run(Job job, JobExecution execution)
throws BatchCriticalException {
- JobInstance job = execution.getJob();
+ JobInstance jobInstance = execution.getJob();
updateStatus(execution, BatchStatus.STARTING);
- List steps = job.getSteps();
+ List stepInstances = jobInstance.getStepInstances();
ExitStatus status = ExitStatus.FAILED;
@@ -78,29 +78,29 @@ public class DefaultJobExecutor implements JobExecutor {
int startedCount = 0;
- List stepConfigurations = configuration
- .getStepConfigurations();
- for (Iterator i = steps.iterator(), j = stepConfigurations.iterator(); i.hasNext()
+ List steps = job
+ .getSteps();
+ for (Iterator i = stepInstances.iterator(), j = steps.iterator(); i.hasNext()
&& j.hasNext();) {
- StepInstance step = (StepInstance) i.next();
- StepConfiguration stepConfiguration = (StepConfiguration) j
+ StepInstance stepInstance = (StepInstance) i.next();
+ Step step = (Step) j
.next();
- if (shouldStart(step, stepConfiguration)) {
+ if (shouldStart(stepInstance, step)) {
startedCount++;
updateStatus(execution, BatchStatus.STARTED);
StepExecutor stepExecutor = stepExecutorFactory
- .getExecutor(stepConfiguration);
- StepExecution stepExecution = new StepExecution(step,
+ .getExecutor(step);
+ StepExecution stepExecution = new StepExecution(stepInstance,
execution);
- status = stepExecutor.process(stepConfiguration,
+ status = stepExecutor.process(step,
stepExecution);
}
}
if (startedCount==0) {
- if (stepConfigurations.size()>0) {
+ if (steps.size()>0) {
status = ExitStatus.NOOP.addExitDescription("All steps already completed. No processing was done.");
} else {
status = ExitStatus.NOOP.addExitDescription("No steps configured for this job.");
@@ -143,25 +143,25 @@ public class DefaultJobExecutor implements JobExecutor {
* Given a step and configuration, return true if the step should start,
* false if it should not, and throw an exception if the job should finish.
*/
- private boolean shouldStart(StepInstance step,
- StepConfiguration stepConfiguration) {
+ private boolean shouldStart(StepInstance stepInstance,
+ Step step) {
- if (step.getStatus() == BatchStatus.COMPLETED
- && stepConfiguration.isAllowStartIfComplete() == false) {
+ if (stepInstance.getStatus() == BatchStatus.COMPLETED
+ && step.isAllowStartIfComplete() == false) {
// step is complete, false should be returned, indicated that the
// step should
// not be started
return false;
}
- if (step.getStepExecutionCount() < stepConfiguration.getStartLimit()) {
+ if (stepInstance.getStepExecutionCount() < step.getStartLimit()) {
// step start count is less than start max, return true
return true;
} else {
// start max has been exceeded, throw an exception.
throw new BatchCriticalException(
- "Maximum start limit exceeded for step: " + step.getName()
- + "StartMax: " + stepConfiguration.getStartLimit());
+ "Maximum start limit exceeded for step: " + stepInstance.getName()
+ + "StartMax: " + step.getStartLimit());
}
}
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/JobExecutorFacade.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/JobExecutorFacade.java
index dfa2a0de2..7633d289f 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/JobExecutorFacade.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/JobExecutorFacade.java
@@ -16,9 +16,9 @@
package org.springframework.batch.execution.launch;
-import org.springframework.batch.core.configuration.NoSuchJobConfigurationException;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobIdentifier;
+import org.springframework.batch.core.domain.NoSuchJobException;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
/**
@@ -34,27 +34,27 @@ interface JobExecutorFacade {
/**
* Prepare a job execution identifiable by the {@link JobIdentifier}. THis
* can then be used to run the job with the {@link #start(JobExecution)}
- * method. Implementations normally require a job configuration to be
+ * method. Implementations normally require a job to be
* locatable corresponding to the {@link JobIdentifier}, matching them at
* least by name.
*
* @param jobIdentifier
* the identifier of the job to start
*
- * @throws NoSuchJobConfigurationException
+ * @throws NoSuchJobException
* @throws JobExecutionAlreadyRunningException
*/
JobExecution createExecutionFrom(JobIdentifier jobIdentifier)
- throws NoSuchJobConfigurationException, JobExecutionAlreadyRunningException;
+ throws NoSuchJobException, JobExecutionAlreadyRunningException;
/**
* Start a job execution.
*
* @param execution
* the execution of the job to start
- * @throws NoSuchJobConfigurationException
+ * @throws NoSuchJobException
*/
- void start(JobExecution execution) throws NoSuchJobConfigurationException;
+ void start(JobExecution execution) throws NoSuchJobException;
/**
* Stop the job execution that was started with this runtime information.
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/JobLauncher.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/JobLauncher.java
index 2f9dd8bd0..f224360a7 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/JobLauncher.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/JobLauncher.java
@@ -15,9 +15,9 @@
*/
package org.springframework.batch.execution.launch;
-import org.springframework.batch.core.configuration.NoSuchJobConfigurationException;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobIdentifier;
+import org.springframework.batch.core.domain.NoSuchJobException;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
/**
@@ -39,7 +39,7 @@ public interface JobLauncher {
* @throws JobExecutionAlreadyRunningException
*
*/
- public JobExecution run() throws NoSuchJobConfigurationException, JobExecutionAlreadyRunningException;
+ public JobExecution run() throws NoSuchJobException, JobExecutionAlreadyRunningException;
/**
* Start a job execution with the given name and other runtime information
@@ -51,11 +51,11 @@ public interface JobLauncher {
* @return the exit code from the job if it returns synchronously. If the
* implementation is asynchronous, the status might well be unknown.
*
- * @throws NoSuchJobConfigurationException
+ * @throws NoSuchJobException
* @throws JobExecutionAlreadyRunningException
*/
public JobExecution run(String jobName)
- throws NoSuchJobConfigurationException, JobExecutionAlreadyRunningException;
+ throws NoSuchJobException, JobExecutionAlreadyRunningException;
/**
* Start a job execution with the given runtime information.
@@ -63,10 +63,10 @@ public interface JobLauncher {
* @return the exit code from the job if it returns synchronously. If the
* implementation is asynchronous, the status might well be unknown.
*
- * @throws NoSuchJobConfigurationException
+ * @throws NoSuchJobException
*/
public JobExecution run(JobIdentifier jobIdentifier)
- throws NoSuchJobConfigurationException, JobExecutionAlreadyRunningException;
+ throws NoSuchJobException, JobExecutionAlreadyRunningException;
/**
* Stop the current job executions if there are any. If not, no action will
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/SimpleJobExecutorFacade.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/SimpleJobExecutorFacade.java
index 5dff00a56..bc4d97b40 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/SimpleJobExecutorFacade.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/SimpleJobExecutorFacade.java
@@ -24,11 +24,11 @@ import java.util.List;
import java.util.Map;
import java.util.Properties;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.JobConfigurationLocator;
-import org.springframework.batch.core.configuration.NoSuchJobConfigurationException;
+import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobIdentifier;
+import org.springframework.batch.core.domain.JobLocator;
+import org.springframework.batch.core.domain.NoSuchJobException;
import org.springframework.batch.core.executor.JobExecutor;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobRepository;
@@ -66,7 +66,7 @@ class SimpleJobExecutorFacade implements JobExecutorFacade,
private JobRepository jobRepository;
// there is no sensible default for this
- private JobConfigurationLocator jobConfigurationLocator;
+ private JobLocator jobLocator;
private List listeners = new ArrayList();
@@ -85,14 +85,14 @@ class SimpleJobExecutorFacade implements JobExecutorFacade,
}
/**
- * Check mandatory properties (jobConfigurationLocator, jobRepository).
+ * Check mandatory properties (jobLocator, jobRepository).
*
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
*/
public void afterPropertiesSet() throws Exception {
Assert.notNull(jobRepository, "JobRepository must be provided.");
- Assert.notNull(jobConfigurationLocator,
- "JobConfigurationLocator must be provided.");
+ Assert.notNull(jobLocator,
+ "JobLocator must be provided.");
}
/**
@@ -107,14 +107,14 @@ class SimpleJobExecutorFacade implements JobExecutorFacade,
}
/**
- * Setter for injection of {@link JobConfigurationLocator}.
+ * Setter for injection of {@link JobLocator}.
*
- * @param jobConfigurationLocator
+ * @param jobLocator
* the jobConfigurationLocator to set
*/
- public void setJobConfigurationLocator(
- JobConfigurationLocator jobConfigurationLocator) {
- this.jobConfigurationLocator = jobConfigurationLocator;
+ public void setJobLocator(
+ JobLocator jobLocator) {
+ this.jobLocator = jobLocator;
}
/**
@@ -136,22 +136,22 @@ class SimpleJobExecutorFacade implements JobExecutorFacade,
}
/**
- * Locates a {@link JobConfiguration} by using the name of the provided
- * {@link JobIdentifier} and the {@link JobConfigurationLocator}.
+ * Locates a {@link Job} by using the name of the provided
+ * {@link JobIdentifier} and the {@link JobLocator}.
*
* @param jobIdentifier
* the identifier of the job that is being prepared.
*
* @throws IllegalArgumentException
* if the {@link JobIdentifier} is null or its name is null
- * @throws NoSuchJobConfigurationException
- * if the {@link JobConfigurationLocator} does not contain a
- * {@link JobConfiguration} with the name provided.
+ * @throws NoSuchJobException
+ * if the {@link JobLocator} does not contain a
+ * {@link Job} with the name provided.
*
* @see org.springframework.batch.execution.launch.JobExecutorFacade#createExecutionFrom(org.springframework.batch.core.domain.JobIdentifier)
*/
public JobExecution createExecutionFrom(JobIdentifier jobIdentifier)
- throws NoSuchJobConfigurationException, JobExecutionAlreadyRunningException {
+ throws NoSuchJobException, JobExecutionAlreadyRunningException {
Assert.notNull(jobIdentifier, "JobIdentifier must not be null.");
Assert.notNull(jobIdentifier.getName(),
"JobIdentifier name must not be null.");
@@ -161,10 +161,10 @@ class SimpleJobExecutorFacade implements JobExecutorFacade,
"A job with this JobIdentifier is already executing in this container: "+jobIdentifier);
};
- JobConfiguration jobConfiguration = jobConfigurationLocator
- .getJobConfiguration(jobIdentifier.getName());
+ Job job = jobLocator
+ .getJob(jobIdentifier.getName());
- return jobRepository.findOrCreateJob(jobConfiguration,
+ return jobRepository.findOrCreateJob(job,
jobIdentifier);
}
@@ -175,22 +175,22 @@ class SimpleJobExecutorFacade implements JobExecutorFacade,
*
* @see org.springframework.batch.execution.launch.JobExecutorFacade#start(JobExecution)
*
- * @throws NoSuchJobConfigurationException
- * if the {@link JobConfigurationLocator} does not contain a
- * {@link JobConfiguration} with the name provided by the
+ * @throws NoSuchJobException
+ * if the {@link JobLocator} does not contain a
+ * {@link Job} with the name provided by the
* enclosed {@link JobIdentifier}.
*
*/
public void start(JobExecution execution)
- throws NoSuchJobConfigurationException {
+ throws NoSuchJobException {
- JobConfiguration jobConfiguration = jobConfigurationLocator
- .getJobConfiguration(execution.getJob().getIdentifier()
+ Job job = jobLocator
+ .getJob(execution.getJob().getIdentifier()
.getName());
this.before(execution);
try {
- jobExecutor.run(jobConfiguration, execution);
+ jobExecutor.run(job, execution);
} finally {
this.after(execution);
}
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/SimpleJobLauncher.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/SimpleJobLauncher.java
index 74af6b791..aa419b01a 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/SimpleJobLauncher.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/SimpleJobLauncher.java
@@ -27,11 +27,11 @@ import java.util.Properties;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.JobConfigurationLocator;
-import org.springframework.batch.core.configuration.NoSuchJobConfigurationException;
+import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobIdentifier;
+import org.springframework.batch.core.domain.JobLocator;
+import org.springframework.batch.core.domain.NoSuchJobException;
import org.springframework.batch.core.executor.JobExecutor;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobRepository;
@@ -70,7 +70,7 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean,
private JobRepository jobRepository;
// there is no sensible default for this
- private JobConfigurationLocator jobConfigurationLocator;
+ private JobLocator jobLocator;
// this can be defaulted from some other properties (see
// afterPropertiesSet())
@@ -80,9 +80,9 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean,
private List listeners = new ArrayList();
- private String jobConfigurationName;
+ private String jobName;
- // Do not autostart by default - allow user to set job configuration
+ // Do not autostart by default - allow user to set a job
// later and then manually start:
private volatile boolean autoStart = false;
@@ -107,13 +107,13 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean,
}
/**
- * Setter for the {@link JobConfiguration} that this launcher will run.
+ * Setter for the {@link Job} that this launcher will run.
*
- * @param jobConfiguration
- * the jobConfiguration to set
+ * @param jobName
+ * the job name to set
*/
- public void setJobConfigurationName(String jobConfiguration) {
- this.jobConfigurationName = jobConfiguration;
+ public void setJobName(String jobName) {
+ this.jobName = jobName;
}
/**
@@ -137,15 +137,15 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean,
}
/**
- * Setter for injection of {@link JobConfigurationLocator}. Mandatory with
+ * Setter for injection of {@link JobLocator}. Mandatory with
* no default.
*
- * @param jobConfigurationLocator
- * the jobConfigurationLocator to set
+ * @param jobLocator
+ * the jobLocator to set
*/
- public void setJobConfigurationLocator(
- JobConfigurationLocator jobConfigurationLocator) {
- this.jobConfigurationLocator = jobConfigurationLocator;
+ public void setJobLocator(
+ JobLocator jobLocator) {
+ this.jobLocator = jobLocator;
}
/**
@@ -184,12 +184,12 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean,
public void afterPropertiesSet() throws Exception {
if (jobExecutorFacade == null) {
logger.debug("Using SimpleJobExecutorFacade");
- Assert.notNull(jobConfigurationLocator);
+ Assert.notNull(jobLocator);
Assert.notNull(jobExecutor);
Assert.notNull(jobRepository);
SimpleJobExecutorFacade jobExecutorFacade = new SimpleJobExecutorFacade();
jobExecutorFacade
- .setJobConfigurationLocator(jobConfigurationLocator);
+ .setJobLocator(jobLocator);
jobExecutorFacade.setJobExecutionListeners(listeners);
jobExecutorFacade.setJobExecutor(jobExecutor);
jobExecutorFacade.setJobRepository(jobRepository);
@@ -203,7 +203,7 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean,
*
* @throws BatchConfigurationException
* if the job tries to but cannot start because of a
- * {@link NoSuchJobConfigurationException}.
+ * {@link NoSuchJobException}.
*
* @see org.springframework.context.ApplicationListener#onApplicationEvent(org.springframework.context.ApplicationEvent)
*
@@ -213,7 +213,7 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean,
&& !isRunning()) {
try {
run();
- } catch (NoSuchJobConfigurationException e) {
+ } catch (NoSuchJobException e) {
throw new BatchConfigurationException(
"Cannot start job on context refresh because it does not exist",
e);
@@ -232,10 +232,10 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean,
*
* @param jobIdentifier
* @return
- * @throws NoSuchJobConfigurationException
+ * @throws NoSuchJobException
*/
protected final void runInternal(JobExecution execution)
- throws NoSuchJobConfigurationException {
+ throws NoSuchJobException {
JobIdentifier jobIdentifier = execution.getJob().getIdentifier();
@@ -257,14 +257,14 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean,
/**
* Start the job using the task executor provided.
*
- * @throws NoSuchJobConfigurationException
+ * @throws NoSuchJobException
* if the identifier cannot be used to locate a
- * {@link JobConfiguration}.
+ * {@link Job}.
*
* @see org.springframework.batch.execution.launch.SimpleJobLauncher#run(org.springframework.batch.core.domain.JobIdentifier)
*/
public JobExecution run(final JobIdentifier jobIdentifier)
- throws NoSuchJobConfigurationException,
+ throws NoSuchJobException,
JobExecutionAlreadyRunningException {
if (getJobExecution(jobIdentifier) != null) {
@@ -292,13 +292,13 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean,
holder.start();
runInternal(execution);
- } catch (NoSuchJobConfigurationException e) {
+ } catch (NoSuchJobException e) {
applicationEventPublisher
.publishEvent(new RepeatOperationsApplicationEvent(
jobIdentifier, "No such job",
RepeatOperationsApplicationEvent.ERROR));
logger.error(
- "JobConfiguration could not be located inside Runnable for identifier: ["
+ "Job could not be located inside Runnable for identifier: ["
+ jobIdentifier + "]", e);
} finally {
holder.stop();
@@ -316,14 +316,14 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean,
*
* @param name
* the name to assign to the job
- * @throws NoSuchJobConfigurationException
+ * @throws NoSuchJobException
* @throws JobExecutionAlreadyRunningException
*/
public JobExecution run(String name)
- throws NoSuchJobConfigurationException,
+ throws NoSuchJobException,
JobExecutionAlreadyRunningException {
if (name == null) {
- throw new NoSuchJobConfigurationException(
+ throw new NoSuchJobException(
"Null job name cannot be located.");
}
JobIdentifier runtimeInformation = jobIdentifierFactory
@@ -334,23 +334,23 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean,
/**
* Start a job execution with default name and other runtime information
* provided by the factory. If a job is already running has no effect. The
- * default name is taken from the enclosed {@link JobConfiguration}.
+ * default name is taken from the enclosed {@link Job}.
*
- * @throws NoSuchJobConfigurationException
+ * @throws NoSuchJobException
*
- * @throws NoSuchJobConfigurationException
- * if the job configuration cannot be located
+ * @throws NoSuchJobException
+ * if the job cannot be located
* @throws JobExecutionAlreadyRunningException
*
* @see #setJobIdentifierFactory(JobIdentifierFactory)
* @see org.springframework.context.Lifecycle#start()
*/
- public JobExecution run() throws NoSuchJobConfigurationException,
+ public JobExecution run() throws NoSuchJobException,
JobExecutionAlreadyRunningException {
- if (jobConfigurationName != null) {
- return this.run(jobConfigurationName);
+ if (jobName != null) {
+ return this.run(jobName);
}
- throw new NoSuchJobConfigurationException(
+ throw new NoSuchJobException(
"Null default job name cannot be located.");
}
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java
index 85dcfe178..e31a98797 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java
@@ -21,11 +21,11 @@ import java.util.Iterator;
import java.util.List;
import java.util.Properties;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.StepConfiguration;
+import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobIdentifier;
import org.springframework.batch.core.domain.JobInstance;
+import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
import org.springframework.batch.core.repository.BatchRestartException;
@@ -66,7 +66,7 @@ public class SimpleJobRepository implements JobRepository {
/**
*
* Find or Create a (@link {@link JobExecution}) based on the passed in
- * {@link JobIdentifier} and {@link JobConfiguration}. However, unique
+ * {@link JobIdentifier} and {@link Job}. However, unique
* identification of a job can only come from the database, and therefore
* must come from JobDao by either creating a new job or finding an existing
* one, which will ensure that the id of the job is populated with the
@@ -76,13 +76,13 @@ public class SimpleJobRepository implements JobRepository {
*
* There are two ways in which the method determines if a job should be
* created or an existing one should be returned. The first is
- * restartability. The {@link JobConfiguration} restartable property will be
+ * restartability. The {@link Job} restartable property will be
* checked first. If it is not false, a new job will be created, regardless
* of whether or not one exists. If it is true, the {@link JobDao} will be
* checked to determine if the job already exists, if it does, it's steps
* will be populated (there must be at least 1) and a new
* {@link JobExecution} will be returned. If no job is found, a new one will
- * be created based on the configuration.
+ * be created based on the job.
*
*
*
@@ -94,9 +94,9 @@ public class SimpleJobRepository implements JobRepository {
*
- What happens then depends on how many existing job instances we
* find:
*
- * - If there are none, or the {@link JobConfiguration} is marked
+ *
- If there are none, or the {@link Job} is marked
* restartable, then we create a new {@link JobInstance}
- * - If there is more than one and the {@link JobConfiguration} is not
+ *
- If there is more than one and the {@link Job} is not
* marked as restartable, it is an error. This could be caused by a job
* whose restartable flag has changed to be more strict (true not false)
* after it has been executed at least once.
@@ -118,26 +118,26 @@ public class SimpleJobRepository implements JobRepository {
* platform does not support the higher isolation levels).
*
*
- * @see JobRepository#findOrCreateJob(JobConfiguration, JobIdentifier)
+ * @see JobRepository#findOrCreateJob(Job, JobIdentifier)
*
* @throws BatchRestartException
* if more than one JobInstance if found or if
* JobInstance.getJobExecutionCount() is greater than
- * JobConfiguration.getStartLimit()
+ * Job.getStartLimit()
* @throws JobExecutionAlreadyRunningException
* if a job execution is found for the given
* {@link JobIdentifier} that is already running
*
*/
- public JobExecution findOrCreateJob(JobConfiguration jobConfiguration,
+ public JobExecution findOrCreateJob(Job job,
JobIdentifier jobIdentifier)
throws JobExecutionAlreadyRunningException {
List jobs = new ArrayList();
- JobInstance job;
+ JobInstance jobInstance;
// Check if a job is restartable, if not, create and return a new job
- if (jobConfiguration.isRestartable()) {
+ if (job.isRestartable()) {
/*
* Find all jobs matching the runtime information.
@@ -153,34 +153,34 @@ public class SimpleJobRepository implements JobRepository {
if (jobs.size() == 1) {
// One job was found
- job = (JobInstance) jobs.get(0);
- job.setSteps(findSteps(jobConfiguration.getStepConfigurations(),
- job));
- job.setJobExecutionCount(jobDao.getJobExecutionCount(job.getId()));
- if (job.getJobExecutionCount() > jobConfiguration.getStartLimit()) {
+ jobInstance = (JobInstance) jobs.get(0);
+ jobInstance.setStepInstances(findStepInstances(job.getSteps(),
+ jobInstance));
+ jobInstance.setJobExecutionCount(jobDao.getJobExecutionCount(jobInstance.getId()));
+ if (jobInstance.getJobExecutionCount() > job.getStartLimit()) {
throw new BatchRestartException(
- "Restart Max exceeded for Job: " + job.toString());
+ "Restart Max exceeded for Job: " + jobInstance.toString());
}
- List executions = jobDao.findJobExecutions(job);
+ List executions = jobDao.findJobExecutions(jobInstance);
for (Iterator iterator = executions.iterator(); iterator.hasNext();) {
JobExecution execution = (JobExecution) iterator.next();
if (execution.isRunning()) {
throw new JobExecutionAlreadyRunningException(
"A job execution for this job is already running: "
- + job);
+ + jobInstance);
}
}
} else if (jobs.size() == 0) {
// no job found, create one
- job = createJob(jobConfiguration, jobIdentifier);
+ jobInstance = createJob(job, jobIdentifier);
} else {
// More than one job found, throw exception
throw new BatchRestartException(
"Error restarting job, more than one JobInstance found for: "
- + jobConfiguration.toString());
+ + job.toString());
}
- return generateJobExecution(job);
+ return generateJobExecution(jobInstance);
}
@@ -294,47 +294,47 @@ public class SimpleJobRepository implements JobRepository {
* calling {@link JobDao#createJob(JobRuntimeInformation)} and then it's
* list of StepConfigurations is passed to the createSteps method.
*/
- private JobInstance createJob(JobConfiguration jobConfiguration,
+ private JobInstance createJob(Job job,
JobIdentifier runtimeInformation) {
- JobInstance job = jobDao.createJob(runtimeInformation);
- job
- .setSteps(createSteps(job, jobConfiguration
- .getStepConfigurations()));
- return job;
+ JobInstance jobInstance = jobDao.createJob(runtimeInformation);
+ jobInstance
+ .setStepInstances(createStepInstances(jobInstance, job
+ .getSteps()));
+ return jobInstance;
}
/*
- * Create steps based on the given Job and list of StepConfigurations.
+ * Create steps based on the given Job and list of Steps.
*/
- private List createSteps(JobInstance job, List stepConfigurations) {
+ private List createStepInstances(JobInstance job, List steps) {
- List steps = new ArrayList();
- Iterator i = stepConfigurations.iterator();
+ List stepInstances = new ArrayList();
+ Iterator i = steps.iterator();
while (i.hasNext()) {
- StepConfiguration stepConfiguration = (StepConfiguration) i.next();
- StepInstance step = stepDao.createStep(job, stepConfiguration
+ Step step = (Step) i.next();
+ StepInstance stepInstance = stepDao.createStep(job, step
.getName());
// Ensure valid restart data is being returned.
- if (step.getRestartData() == null
- || step.getRestartData().getProperties() == null) {
- step.setRestartData(new GenericRestartData(new Properties()));
+ if (stepInstance.getRestartData() == null
+ || stepInstance.getRestartData().getProperties() == null) {
+ stepInstance.setRestartData(new GenericRestartData(new Properties()));
}
- steps.add(step);
+ stepInstances.add(stepInstance);
}
- return steps;
+ return stepInstances;
}
/*
- * Find Steps for the given list of StepConfiguration's with a given JobId
+ * Find Steps for the given list of Steps with a given JobId
*/
- protected List findSteps(List stepConfigurations, JobInstance job) {
- List steps = new ArrayList();
- Iterator i = stepConfigurations.iterator();
+ protected List findStepInstances(List steps, JobInstance job) {
+ List stepInstances = new ArrayList();
+ Iterator i = steps.iterator();
while (i.hasNext()) {
- StepConfiguration stepConfiguration = (StepConfiguration) i.next();
+ Step stepConfiguration = (Step) i.next();
StepInstance step = stepDao.findStep(job, stepConfiguration
.getName());
if (step != null) {
@@ -348,10 +348,10 @@ public class SimpleJobRepository implements JobRepository {
.setRestartData(new GenericRestartData(
new Properties()));
}
- steps.add(step);
+ stepInstances.add(step);
}
}
- return steps;
+ return stepInstances;
}
}
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/AbstractStepConfiguration.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/AbstractStep.java
similarity index 77%
rename from spring-batch-execution/src/main/java/org/springframework/batch/execution/step/AbstractStepConfiguration.java
rename to spring-batch-execution/src/main/java/org/springframework/batch/execution/step/AbstractStep.java
index 5b88a1d28..16e584275 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/AbstractStepConfiguration.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/AbstractStep.java
@@ -15,13 +15,13 @@
*/
package org.springframework.batch.execution.step;
-import org.springframework.batch.core.configuration.StepConfiguration;
-import org.springframework.batch.core.configuration.StepConfigurationSupport;
+import org.springframework.batch.core.domain.Step;
+import org.springframework.batch.core.domain.StepSupport;
import org.springframework.batch.repeat.exception.handler.ExceptionHandler;
import org.springframework.beans.factory.BeanNameAware;
/**
- * A {@link StepConfiguration} implementation that provides common behaviour to
+ * A {@link Step} implementation that provides common behaviour to
* subclasses. Implements {@link BeanNameAware} so that if no name is provided
* explicitly it will be inferred from the bean definition in Spring
* configuration.
@@ -29,7 +29,7 @@ import org.springframework.beans.factory.BeanNameAware;
* @author Dave Syer
*
*/
-public class AbstractStepConfiguration extends StepConfigurationSupport {
+public class AbstractStep extends StepSupport {
private int skipLimit = 0;
@@ -38,7 +38,7 @@ public class AbstractStepConfiguration extends StepConfigurationSupport {
/**
* Default constructor.
*/
- public AbstractStepConfiguration() {
+ public AbstractStep() {
super();
}
@@ -46,7 +46,7 @@ public class AbstractStepConfiguration extends StepConfigurationSupport {
* Convenient constructor for setting only the name property.
* @param name
*/
- public AbstractStepConfiguration(String name) {
+ public AbstractStep(String name) {
super(name);
}
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/PrototypeBeanStepExecutorFactory.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/PrototypeBeanStepExecutorFactory.java
index 0d7346b6f..7c34d2cac 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/PrototypeBeanStepExecutorFactory.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/PrototypeBeanStepExecutorFactory.java
@@ -15,7 +15,7 @@
*/
package org.springframework.batch.execution.step;
-import org.springframework.batch.core.configuration.StepConfiguration;
+import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.executor.StepExecutor;
import org.springframework.batch.core.executor.StepExecutorFactory;
import org.springframework.batch.execution.step.simple.SimpleStepExecutor;
@@ -29,12 +29,12 @@ import org.springframework.util.Assert;
/**
* A {@link StepExecutorFactory} that uses a prototype bean in the application
* context to satisfy the factory contract. If the prototype bean and
- * {@link StepConfiguration} are of known (simple) type, they can be combined to
- * add the commit interval information from the configuration.
+ * {@link Step} are of known (simple) type, they can be combined to
+ * add the commit interval information from the step.
*
* The nominated bean has to be a prototype because its state may be changed
* before it is used, applying values for things like commit interval from the
- * {@link StepConfiguration}.
+ * {@link Step}.
*
* @author Dave Syer
*
@@ -81,7 +81,7 @@ public class PrototypeBeanStepExecutorFactory implements StepExecutorFactory,
*
*
* - If the {@link StepExecutor} refers to a {@link SimpleStepExecutor},
- * and {@link StepConfiguration} is an instance of
+ * and {@link Step} is an instance of
* {@link RepeatOperationsHolder}, then the {@link RepeatOperations} for
* the chunk will be pulled from there directly. This gives maximum
* flexibility for clients to control the properties of the iteration. For
@@ -89,7 +89,7 @@ public class PrototypeBeanStepExecutorFactory implements StepExecutorFactory,
* execution, like the commit interval, this is not necessary.
*
* - If the {@link StepExecutor} is a {@link SimpleStepExecutor} and the
- * configuration is a {@link SimpleStepConfiguration} then this
+ * step is a {@link SimpleStep} then this
* implementation modifies the state of the {@link StepExecutor} to set the
* completion policy of the chunk operations. In this case the chunk
* operations cannot be set by the client of this factory.
@@ -102,18 +102,18 @@ public class PrototypeBeanStepExecutorFactory implements StepExecutorFactory,
* @throws IllegalStateException
* if no {@link StepExecutor} can be located.
*
- * @see StepExecutorFactory#getExecutor(StepConfiguration)
+ * @see StepExecutorFactory#getExecutor(Step)
*/
- public StepExecutor getExecutor(StepConfiguration configuration) {
+ public StepExecutor getExecutor(Step step) {
StepExecutor executor = getStepExecutor();
- executor.applyConfiguration(configuration);
+ executor.applyConfiguration(step);
return executor;
}
/**
* Setter for the bean name of the {@link StepExecutor} to use. The
* corresponding bean must be prototype scoped, so that its properties can
- * be overridden per execution by the {@link StepConfiguration}.
+ * be overridden per execution by the {@link Step}.
*
* @param stepExecutor
* the stepExecutor to set
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/RepeatOperationsHolder.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/RepeatOperationsHolder.java
index 0c164b992..d34d93115 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/RepeatOperationsHolder.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/RepeatOperationsHolder.java
@@ -15,7 +15,7 @@
*/
package org.springframework.batch.execution.step;
-import org.springframework.batch.core.configuration.StepConfiguration;
+import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.executor.StepExecutor;
import org.springframework.batch.repeat.RepeatOperations;
@@ -24,7 +24,7 @@ import org.springframework.batch.repeat.RepeatOperations;
* available for the inner loop (chunk operations) and outer loop (step
* operations) in a {@link StepExecutor}. The inner loop is normally going to
* be in-process and thread-bound so it makes sense for
- * {@link StepConfiguration} implementations to be able to override the
+ * {@link Step} implementations to be able to override the
* strategies that control that loop.
*
* @author Dave Syer
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/RepeatOperationsStepConfiguration.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/RepeatOperationsStep.java
similarity index 87%
rename from spring-batch-execution/src/main/java/org/springframework/batch/execution/step/RepeatOperationsStepConfiguration.java
rename to spring-batch-execution/src/main/java/org/springframework/batch/execution/step/RepeatOperationsStep.java
index e986a1b5a..5f97f0522 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/RepeatOperationsStepConfiguration.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/RepeatOperationsStep.java
@@ -16,18 +16,18 @@
package org.springframework.batch.execution.step;
-import org.springframework.batch.core.configuration.StepConfiguration;
+import org.springframework.batch.core.domain.Step;
import org.springframework.batch.repeat.RepeatOperations;
/**
- * {@link StepConfiguration} implementation that allows full configuration of
+ * {@link Step} implementation that allows full step of
* the {@link RepeatOperations} that will be used in the chunk (inner loop).
*
* @author Lucas Ward
* @author Dave Syer
*
*/
-public class RepeatOperationsStepConfiguration extends AbstractStepConfiguration implements RepeatOperationsHolder {
+public class RepeatOperationsStep extends AbstractStep implements RepeatOperationsHolder {
// default chunkOperations is null
private RepeatOperations chunkOperations;
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/SimpleStepConfiguration.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/SimpleStep.java
similarity index 76%
rename from spring-batch-execution/src/main/java/org/springframework/batch/execution/step/SimpleStepConfiguration.java
rename to spring-batch-execution/src/main/java/org/springframework/batch/execution/step/SimpleStep.java
index ed04388f2..273b4e6a7 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/SimpleStepConfiguration.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/SimpleStep.java
@@ -16,31 +16,31 @@
package org.springframework.batch.execution.step;
-import org.springframework.batch.core.configuration.StepConfiguration;
+import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.tasklet.Tasklet;
/**
- * Simple {@link StepConfiguration} good enough for most purposes and easy to
+ * Simple {@link Step} good enough for most purposes and easy to
* configure simple properties, principally the commit interval.
*
* @author Lucas Ward
* @author Dave Syer
*
*/
-public class SimpleStepConfiguration extends AbstractStepConfiguration {
+public class SimpleStep extends AbstractStep {
// default commit interval is one
private int commitInterval = 1;
- public SimpleStepConfiguration() {
+ public SimpleStep() {
super();
}
- public SimpleStepConfiguration(String name) {
+ public SimpleStep(String name) {
super(name);
}
- public SimpleStepConfiguration(Tasklet module) {
+ public SimpleStep(Tasklet module) {
this();
setTasklet(module);
}
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutor.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutor.java
index 61c4cdb0d..3b33288e4 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutor.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutor.java
@@ -20,8 +20,8 @@ import java.util.Date;
import java.util.Iterator;
import java.util.Properties;
-import org.springframework.batch.core.configuration.StepConfiguration;
import org.springframework.batch.core.domain.BatchStatus;
+import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.domain.StepContribution;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
@@ -34,7 +34,7 @@ import org.springframework.batch.execution.scope.SimpleStepContext;
import org.springframework.batch.execution.scope.StepScope;
import org.springframework.batch.execution.scope.StepSynchronizationManager;
import org.springframework.batch.execution.step.RepeatOperationsHolder;
-import org.springframework.batch.execution.step.SimpleStepConfiguration;
+import org.springframework.batch.execution.step.SimpleStep;
import org.springframework.batch.io.Skippable;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.repeat.ExitStatus;
@@ -141,16 +141,16 @@ public class SimpleStepExecutor implements StepExecutor {
* @throws StepInterruptedException if the step or a chunk is interrupted
* @throws RuntimeException if there is an exception during a chunk
* execution
- * @see StepExecutor#process(StepConfiguration, StepExecution)
+ * @see StepExecutor#process(Step, StepExecution)
*/
- public ExitStatus process(final StepConfiguration configuration, final StepExecution stepExecution)
+ public ExitStatus process(final Step step, final StepExecution stepExecution)
throws BatchCriticalException, StepInterruptedException {
- final StepInstance step = stepExecution.getStep();
- boolean isRestart = step.getStepExecutionCount() > 0 ? true : false;
- Assert.notNull(step);
+ final StepInstance stepInstance = stepExecution.getStep();
+ boolean isRestart = stepInstance.getStepExecutionCount() > 0 ? true : false;
+ Assert.notNull(stepInstance);
- final Tasklet module = configuration.getTasklet();
+ final Tasklet module = step.getTasklet();
ExitStatus status = ExitStatus.FAILED;
@@ -164,10 +164,10 @@ public class SimpleStepExecutor implements StepExecutor {
stepExecution.setStartTime(new Date(System.currentTimeMillis()));
updateStatus(stepExecution, BatchStatus.STARTED);
- final boolean saveRestartData = configuration.isSaveRestartData();
+ final boolean saveRestartData = step.isSaveRestartData();
if (saveRestartData && isRestart) {
- restoreFromRestartData(module, step.getRestartData());
+ restoreFromRestartData(module, stepInstance.getRestartData());
}
status = stepOperations.iterate(new RepeatCallback() {
@@ -196,7 +196,7 @@ public class SimpleStepExecutor implements StepExecutor {
BatchTransactionSynchronizationManager.resynchronize();
ExitStatus result;
- result = processChunk(configuration, contribution);
+ result = processChunk(step, contribution);
// TODO: Statistics are not thread safe
// - we cannot guarantee that they are
@@ -209,8 +209,8 @@ public class SimpleStepExecutor implements StepExecutor {
stepExecution.apply(contribution);
if (saveRestartData) {
- step.setRestartData(getRestartData(module));
- jobRepository.update(step);
+ stepInstance.setRestartData(getRestartData(module));
+ jobRepository.update(stepInstance);
}
jobRepository.saveOrUpdate(stepExecution);
return result;
@@ -307,18 +307,18 @@ public class SimpleStepExecutor implements StepExecutor {
* outside this method, so subclasses that override do not need to create a
* transaction.
*
- * @param configuration the current step configuration
+ * @param step the current step
* @param stepExecution the current step, containing the {@link Tasklet}
* with the business logic.
* @return true if there is more data to process.
*/
- protected final ExitStatus processChunk(final StepConfiguration configuration, final StepContribution contribution) {
+ protected final ExitStatus processChunk(final Step step, final StepContribution contribution) {
ExitStatus result = chunkOperations.iterate(new RepeatCallback() {
public ExitStatus doInIteration(final RepeatContext context) throws Exception {
contribution.registerChunkContext(context);
// check for interruption before each item as well
interruptionPolicy.checkInterrupted(context);
- ExitStatus exitStatus = doTaskletProcessing(configuration.getTasklet(), contribution);
+ ExitStatus exitStatus = doTaskletProcessing(step.getTasklet(), contribution);
contribution.incrementTaskCount();
// check for interruption after each item as well
interruptionPolicy.checkInterrupted(context);
@@ -419,7 +419,7 @@ public class SimpleStepExecutor implements StepExecutor {
*
* - If the configuration is a {@link RepeatOperationsHolder} then we use
* the provided {@link RepeatOperations} instances for chunk and step.
- * - If the configuration is a {@link SimpleStepConfiguration} then we
+ *
- If the configuration is a {@link SimpleStep} then we
* apply the commit interval at the chunk level and the exception handler at
* the step level, provided the existing repeat operations are instances of
* {@link RepeatTemplate}. In addition if there is a non-zero skip limit
@@ -427,18 +427,18 @@ public class SimpleStepExecutor implements StepExecutor {
* {@link SimpleLimitExceptionHandler} with that limit.
*
*
- * @param configuration a step configuration
+ * @param step a step
*/
- public void applyConfiguration(StepConfiguration configuration) {
+ public void applyConfiguration(Step step) {
- if (configuration instanceof RepeatOperationsHolder) {
+ if (step instanceof RepeatOperationsHolder) {
- RepeatOperationsHolder holder = (RepeatOperationsHolder) configuration;
+ RepeatOperationsHolder holder = (RepeatOperationsHolder) step;
RepeatOperations chunkOperations = holder.getChunkOperations();
RepeatOperations stepOperations = holder.getStepOperations();
Assert
.state(chunkOperations != null,
- "Chunk operations obtained from step configuration must be non-null.");
+ "Chunk operations obtained from step must be non-null.");
if (chunkOperations != null) {
setChunkOperations(chunkOperations);
@@ -448,9 +448,9 @@ public class SimpleStepExecutor implements StepExecutor {
}
}
- else if (configuration instanceof SimpleStepConfiguration) {
+ else if (step instanceof SimpleStep) {
- SimpleStepConfiguration simpleConfiguation = (SimpleStepConfiguration) configuration;
+ SimpleStep simpleConfiguation = (SimpleStep) step;
if (this.chunkOperations instanceof RepeatTemplate) {
RepeatTemplate template = (RepeatTemplate) this.chunkOperations;
template.setCompletionPolicy(new SimpleCompletionPolicy(simpleConfiguation.getCommitInterval()));
diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorFactory.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorFactory.java
index c76559d15..e1e02dd62 100644
--- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorFactory.java
+++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorFactory.java
@@ -15,11 +15,11 @@
*/
package org.springframework.batch.execution.step.simple;
-import org.springframework.batch.core.configuration.StepConfiguration;
+import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.executor.StepExecutor;
import org.springframework.batch.core.executor.StepExecutorFactory;
import org.springframework.batch.core.repository.JobRepository;
-import org.springframework.batch.execution.step.SimpleStepConfiguration;
+import org.springframework.batch.execution.step.SimpleStep;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
@@ -37,28 +37,28 @@ public class SimpleStepExecutorFactory implements StepExecutorFactory,
/**
* Create a {@link SimpleStepExecutor} for this configuration. If the
- * configuration is a {@link SimpleStepConfiguration} then a
+ * configuration is a {@link SimpleStep} then a
* {@link StepExecutor} is created with policies matching the commit
* interval of the configuration.
*
* @throws IllegalStateException
- * if the configuration is not a {@link SimpleStepConfiguration}.
+ * if the configuration is not a {@link SimpleStep}.
* @throws IllegalStateException
* if the {@link JobRepository} is null.
*
- * @see StepExecutorFactory#getExecutor(StepConfiguration)
+ * @see StepExecutorFactory#getExecutor(Step)
*/
- public StepExecutor getExecutor(StepConfiguration configuration) {
+ public StepExecutor getExecutor(Step step) {
Assert.notNull(jobRepository, "JobRepository cannot be null");
- Assert.state(configuration instanceof SimpleStepConfiguration,
- "StepConfiguration must be instance of SimpleStepConfiguration - found: ["
- + (configuration == null ? null : configuration
+ Assert.state(step instanceof SimpleStep,
+ "Step must be instance of SimpleStep - found: ["
+ + (step == null ? null : step
.getClass()) + "]");
SimpleStepExecutor executor = new SimpleStepExecutor();
executor.setRepository(jobRepository);
- executor.applyConfiguration(configuration);
+ executor.applyConfiguration(step);
return executor;
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/SimpleJvmExitCodeMapperTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/SimpleJvmExitCodeMapperTests.java
index 60e35fd38..2b6ea3116 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/SimpleJvmExitCodeMapperTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/SimpleJvmExitCodeMapperTests.java
@@ -38,8 +38,8 @@ public class SimpleJvmExitCodeMapperTests extends TestCase {
Map ecm2Map = new HashMap();
ecm2Map.put(ExitStatus.FINISHED.getExitCode(), new Integer(-1));
ecm2Map.put(ExitStatus.FAILED.getExitCode(), new Integer(-2));
- ecm2Map.put(ExitCodeMapper.JOB_CONFIGURATION_NOT_PROVIDED, new Integer(-3));
- ecm2Map.put(ExitCodeMapper.NO_SUCH_JOB_CONFIGURATION, new Integer(-3));
+ ecm2Map.put(ExitCodeMapper.JOB_NOT_PROVIDED, new Integer(-3));
+ ecm2Map.put(ExitCodeMapper.NO_SUCH_JOB, new Integer(-3));
ecm2.setMapping(ecm2Map);
}
@@ -55,11 +55,11 @@ public class SimpleJvmExitCodeMapperTests extends TestCase {
ecm.getExitCode(ExitStatus.FAILED.getExitCode()),
ExitCodeMapper.JVM_EXITCODE_GENERIC_ERROR);
assertEquals(
- ecm.getExitCode(ExitCodeMapper.JOB_CONFIGURATION_NOT_PROVIDED),
- ExitCodeMapper.JVM_EXITCODE_JOB_CONFIGURATION_ERROR);
+ ecm.getExitCode(ExitCodeMapper.JOB_NOT_PROVIDED),
+ ExitCodeMapper.JVM_EXITCODE_JOB_ERROR);
assertEquals(
- ecm.getExitCode(ExitCodeMapper.NO_SUCH_JOB_CONFIGURATION),
- ExitCodeMapper.JVM_EXITCODE_JOB_CONFIGURATION_ERROR);
+ ecm.getExitCode(ExitCodeMapper.NO_SUCH_JOB),
+ ExitCodeMapper.JVM_EXITCODE_JOB_ERROR);
}
public void testGetExitCodeWithPredefinedCodesOverridden() {
@@ -69,9 +69,9 @@ public class SimpleJvmExitCodeMapperTests extends TestCase {
assertEquals(
ecm2.getExitCode(ExitStatus.FAILED.getExitCode()), -2);
assertEquals(
- ecm2.getExitCode(ExitCodeMapper.JOB_CONFIGURATION_NOT_PROVIDED), -3);
+ ecm2.getExitCode(ExitCodeMapper.JOB_NOT_PROVIDED), -3);
assertEquals(
- ecm2.getExitCode(ExitCodeMapper.NO_SUCH_JOB_CONFIGURATION), -3);
+ ecm2.getExitCode(ExitCodeMapper.NO_SUCH_JOB), -3);
}
public void testGetExitCodeWithCustomCode() {
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/StubJobLauncher.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/StubJobLauncher.java
index 72dfebc78..a0f4a6cd0 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/StubJobLauncher.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/StubJobLauncher.java
@@ -1,8 +1,8 @@
package org.springframework.batch.execution.bootstrap.support;
-import org.springframework.batch.core.configuration.NoSuchJobConfigurationException;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobIdentifier;
+import org.springframework.batch.core.domain.NoSuchJobException;
import org.springframework.batch.execution.launch.JobLauncher;
/**
@@ -29,19 +29,19 @@ public class StubJobLauncher implements JobLauncher {
return isRunning;
}
- public JobExecution run() throws NoSuchJobConfigurationException {
+ public JobExecution run() throws NoSuchJobException {
lastRunCalled = RUN_NO_ARGS;
return returnValue;
}
public JobExecution run(String jobName)
- throws NoSuchJobConfigurationException {
+ throws NoSuchJobException {
lastRunCalled = RUN_JOB_NAME;
return returnValue;
}
public JobExecution run(JobIdentifier jobIdentifier)
- throws NoSuchJobConfigurationException {
+ throws NoSuchJobException {
lastRunCalled = RUN_JOB_IDENTIFIER;
return returnValue;
}
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobConfigurationRegistryBeanPostProcessorTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessorTests.java
similarity index 69%
rename from spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobConfigurationRegistryBeanPostProcessorTests.java
rename to spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessorTests.java
index ebc24ecef..2c85b9cd1 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobConfigurationRegistryBeanPostProcessorTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessorTests.java
@@ -19,9 +19,9 @@ import java.util.Collection;
import junit.framework.TestCase;
-import org.springframework.batch.core.configuration.DuplicateJobConfigurationException;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.NoSuchJobConfigurationException;
+import org.springframework.batch.core.domain.DuplicateJobException;
+import org.springframework.batch.core.domain.Job;
+import org.springframework.batch.core.domain.NoSuchJobException;
import org.springframework.beans.FatalBeanException;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -29,9 +29,9 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
* @author Dave Syer
*
*/
-public class JobConfigurationRegistryBeanPostProcessorTests extends TestCase {
+public class JobRegistryBeanPostProcessorTests extends TestCase {
- private JobConfigurationRegistryBeanPostProcessor processor = new JobConfigurationRegistryBeanPostProcessor();
+ private JobRegistryBeanPostProcessor processor = new JobRegistryBeanPostProcessor();
public void testInitialization() throws Exception {
try {
@@ -56,19 +56,19 @@ public class JobConfigurationRegistryBeanPostProcessorTests extends TestCase {
}
public void testAfterInitializationWithCorrectType() throws Exception {
- MapJobConfigurationRegistry registry = new MapJobConfigurationRegistry();
+ MapJobRegistry registry = new MapJobRegistry();
processor.setJobConfigurationRegistry(registry);
- JobConfiguration configuration = new JobConfiguration();
+ Job configuration = new Job();
configuration.setBeanName("foo");
assertEquals(configuration, processor.postProcessAfterInitialization(
configuration, "bar"));
- assertEquals(configuration, registry.getJobConfiguration("foo"));
+ assertEquals(configuration, registry.getJob("foo"));
}
public void testAfterInitializationWithDuplicate() throws Exception {
- MapJobConfigurationRegistry registry = new MapJobConfigurationRegistry();
+ MapJobRegistry registry = new MapJobRegistry();
processor.setJobConfigurationRegistry(registry);
- JobConfiguration configuration = new JobConfiguration();
+ Job configuration = new Job();
configuration.setBeanName("foo");
processor.postProcessAfterInitialization(configuration, "bar");
try {
@@ -76,22 +76,22 @@ public class JobConfigurationRegistryBeanPostProcessorTests extends TestCase {
fail("Expected FatalBeanException");
} catch (FatalBeanException e) {
// Expected
- assertTrue(e.getCause() instanceof DuplicateJobConfigurationException);
+ assertTrue(e.getCause() instanceof DuplicateJobException);
}
}
public void testUnregisterOnDestroy() throws Exception {
- MapJobConfigurationRegistry registry = new MapJobConfigurationRegistry();
+ MapJobRegistry registry = new MapJobRegistry();
processor.setJobConfigurationRegistry(registry);
- JobConfiguration configuration = new JobConfiguration();
+ Job configuration = new Job();
configuration.setBeanName("foo");
assertEquals(configuration, processor.postProcessAfterInitialization(
configuration, "bar"));
processor.destroy();
try {
- assertEquals(null, registry.getJobConfiguration("foo"));
+ assertEquals(null, registry.getJob("foo"));
fail("Expected NoSuchJobConfigurationException");
- } catch (NoSuchJobConfigurationException e) {
+ } catch (NoSuchJobException e) {
// expected
}
}
@@ -99,11 +99,11 @@ public class JobConfigurationRegistryBeanPostProcessorTests extends TestCase {
public void testExecutionWithApplicationContext() throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
"test-context.xml", getClass());
- MapJobConfigurationRegistry registry = (MapJobConfigurationRegistry) context
+ MapJobRegistry registry = (MapJobRegistry) context
.getBean("registry");
Collection configurations = registry.getJobConfigurations();
// System.err.println(configurations);
- String[] names = context.getBeanNamesForType(JobConfiguration.class);
+ String[] names = context.getBeanNamesForType(Job.class);
int count = names.length;
// Each concrete bean of type JobConfiguration is registered...
assertEquals(count, configurations.size());
@@ -111,21 +111,21 @@ public class JobConfigurationRegistryBeanPostProcessorTests extends TestCase {
// explicit name or beanName (using property setter): in this case then
// child beans will have the same name and will be re-registered (and
// override, if the registry supports that).
- assertNotNull(registry.getJobConfiguration("test-job"));
+ assertNotNull(registry.getJob("test-job"));
assertEquals(context.getBean("test-job-with-name"), registry
- .getJobConfiguration("foo"));
+ .getJob("foo"));
assertEquals(context.getBean("test-job-with-bean-name"), registry
- .getJobConfiguration("bar"));
+ .getJob("bar"));
assertEquals(context.getBean("test-job-with-parent-and-name"), registry
- .getJobConfiguration("spam"));
+ .getJob("spam"));
assertEquals(context.getBean("test-job-with-parent-and-bean-name"),
- registry.getJobConfiguration("bucket"));
+ registry.getJob("bucket"));
assertEquals(context.getBean("test-job-with-concrete-parent"), registry
- .getJobConfiguration("maps"));
+ .getJob("maps"));
assertEquals(context.getBean("test-job-with-concrete-parent-and-name"),
- registry.getJobConfiguration("oof"));
+ registry.getJob("oof"));
assertEquals(context
.getBean("test-job-with-concrete-parent-and-bean-name"),
- registry.getJobConfiguration("rab"));
+ registry.getJob("rab"));
}
}
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/MapJobConfigurationRegistryTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/MapJobRegistryTests.java
similarity index 56%
rename from spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/MapJobConfigurationRegistryTests.java
rename to spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/MapJobRegistryTests.java
index 0b10ca528..daffd8553 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/MapJobConfigurationRegistryTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/MapJobRegistryTests.java
@@ -19,45 +19,45 @@ import java.util.Collection;
import junit.framework.TestCase;
-import org.springframework.batch.core.configuration.DuplicateJobConfigurationException;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.NoSuchJobConfigurationException;
-import org.springframework.batch.execution.configuration.MapJobConfigurationRegistry;
+import org.springframework.batch.core.domain.DuplicateJobException;
+import org.springframework.batch.core.domain.Job;
+import org.springframework.batch.core.domain.NoSuchJobException;
+import org.springframework.batch.execution.configuration.MapJobRegistry;
/**
* @author Dave Syer
*
*/
-public class MapJobConfigurationRegistryTests extends TestCase {
+public class MapJobRegistryTests extends TestCase {
- private MapJobConfigurationRegistry registry = new MapJobConfigurationRegistry();
+ private MapJobRegistry registry = new MapJobRegistry();
/**
- * Test method for {@link org.springframework.batch.execution.configuration.MapJobConfigurationRegistry#unregister(org.springframework.batch.core.configuration.JobConfiguration)}.
+ * Test method for {@link org.springframework.batch.execution.configuration.MapJobRegistry#unregister(org.springframework.batch.core.domain.Job)}.
* @throws Exception
*/
public void testUnregister() throws Exception {
- registry.register(new JobConfiguration("foo"));
- assertNotNull(registry.getJobConfiguration("foo"));
- registry.unregister(new JobConfiguration("foo"));
+ registry.register(new Job("foo"));
+ assertNotNull(registry.getJob("foo"));
+ registry.unregister(new Job("foo"));
try {
- assertNull(registry.getJobConfiguration("foo"));
+ assertNull(registry.getJob("foo"));
fail("Expected NoSuchJobConfigurationException");
}
- catch (NoSuchJobConfigurationException e) {
+ catch (NoSuchJobException e) {
// expected
assertTrue(e.getMessage().indexOf("foo")>=0);
}
}
/**
- * Test method for {@link org.springframework.batch.execution.configuration.MapJobConfigurationRegistry#getJobConfiguration(java.lang.String)}.
+ * Test method for {@link org.springframework.batch.execution.configuration.MapJobRegistry#getJob(java.lang.String)}.
*/
public void testReplaceDuplicateConfiguration() throws Exception {
- registry.register(new JobConfiguration("foo"));
+ registry.register(new Job("foo"));
try {
- registry.register(new JobConfiguration("foo"));
- } catch (DuplicateJobConfigurationException e) {
+ registry.register(new Job("foo"));
+ } catch (DuplicateJobException e) {
fail("Unexpected DuplicateJobConfigurationException");
// expected
assertTrue(e.getMessage().indexOf("foo")>=0);
@@ -65,28 +65,28 @@ public class MapJobConfigurationRegistryTests extends TestCase {
}
/**
- * Test method for {@link org.springframework.batch.execution.configuration.MapJobConfigurationRegistry#getJobConfiguration(java.lang.String)}.
+ * Test method for {@link org.springframework.batch.execution.configuration.MapJobRegistry#getJob(java.lang.String)}.
*/
public void testRealDuplicateConfiguration() throws Exception {
- JobConfiguration jobConfiguration = new JobConfiguration("foo");
+ Job jobConfiguration = new Job("foo");
registry.register(jobConfiguration);
try {
registry.register(jobConfiguration);
fail("Unexpected DuplicateJobConfigurationException");
- } catch (DuplicateJobConfigurationException e) {
+ } catch (DuplicateJobException e) {
// expected
assertTrue(e.getMessage().indexOf("foo")>=0);
}
}
/**
- * Test method for {@link org.springframework.batch.execution.configuration.MapJobConfigurationRegistry#getJobConfigurations()}.
+ * Test method for {@link org.springframework.batch.execution.configuration.MapJobRegistry#getJobConfigurations()}.
* @throws Exception
*/
public void testGetJobConfigurations() throws Exception {
- JobConfiguration configuration = new JobConfiguration("foo");
+ Job configuration = new Job("foo");
registry.register(configuration);
- registry.register(new JobConfiguration("bar"));
+ registry.register(new Job("bar"));
Collection configurations = registry.getJobConfigurations();
assertEquals(2, configurations.size());
assertTrue(configurations.contains(configuration));
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/job/DefaultJobExecutorTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/job/DefaultJobExecutorTests.java
index 524331fa7..c672c0ed9 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/job/DefaultJobExecutorTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/job/DefaultJobExecutorTests.java
@@ -21,14 +21,14 @@ import java.util.List;
import junit.framework.TestCase;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.StepConfiguration;
-import org.springframework.batch.core.configuration.StepConfigurationSupport;
import org.springframework.batch.core.domain.BatchStatus;
+import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobInstance;
+import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
+import org.springframework.batch.core.domain.StepSupport;
import org.springframework.batch.core.executor.ExitCodeExceptionClassifier;
import org.springframework.batch.core.executor.StepExecutor;
import org.springframework.batch.core.executor.StepExecutorFactory;
@@ -41,7 +41,7 @@ import org.springframework.batch.execution.repository.dao.JobDao;
import org.springframework.batch.execution.repository.dao.MapJobDao;
import org.springframework.batch.execution.repository.dao.MapStepDao;
import org.springframework.batch.execution.repository.dao.StepDao;
-import org.springframework.batch.execution.step.SimpleStepConfiguration;
+import org.springframework.batch.execution.step.SimpleStep;
import org.springframework.batch.io.exception.BatchCriticalException;
import org.springframework.batch.repeat.ExitStatus;
@@ -62,7 +62,7 @@ public class DefaultJobExecutorTests extends TestCase {
private List list = new ArrayList();
StepExecutor defaultStepLifecycle = new StubStepExecutor() {
- public ExitStatus process(StepConfiguration configuration,
+ public ExitStatus process(Step configuration,
StepExecution stepExecution) throws StepInterruptedException,
BatchCriticalException {
list.add("default");
@@ -71,7 +71,7 @@ public class DefaultJobExecutorTests extends TestCase {
};
StepExecutor configurationStepLifecycle = new StubStepExecutor() {
- public ExitStatus process(StepConfiguration configuration,
+ public ExitStatus process(Step configuration,
StepExecution stepExecution) throws StepInterruptedException,
BatchCriticalException {
list.add("special");
@@ -91,11 +91,11 @@ public class DefaultJobExecutorTests extends TestCase {
private StepExecution stepExecution2;
- private StepConfigurationSupport stepConfiguration1;
+ private StepSupport stepConfiguration1;
- private StepConfigurationSupport stepConfiguration2;
+ private StepSupport stepConfiguration2;
- private JobConfiguration jobConfiguration;
+ private Job jobConfiguration;
private SimpleJobIdentifier jobIdentifer;
@@ -113,17 +113,17 @@ public class DefaultJobExecutorTests extends TestCase {
jobExecutor.setJobRepository(jobRepository);
jobExecutor.setStepExecutorFactory(new StepExecutorFactory() {
- public StepExecutor getExecutor(StepConfiguration configuration) {
+ public StepExecutor getExecutor(Step configuration) {
return defaultStepLifecycle;
}
});
- stepConfiguration1 = new SimpleStepConfiguration("TestStep1");
- stepConfiguration2 = new SimpleStepConfiguration("TestStep2");
+ stepConfiguration1 = new SimpleStep("TestStep1");
+ stepConfiguration2 = new SimpleStep("TestStep2");
List stepConfigurations = new ArrayList();
stepConfigurations.add(stepConfiguration1);
stepConfigurations.add(stepConfiguration2);
- jobConfiguration = new JobConfiguration();
+ jobConfiguration = new Job();
jobConfiguration.setSteps(stepConfigurations);
jobIdentifer = new SimpleJobIdentifier("TestJob");
@@ -131,7 +131,7 @@ public class DefaultJobExecutorTests extends TestCase {
jobExecution = jobRepository.findOrCreateJob(jobConfiguration, jobIdentifer);
job = jobExecution.getJob();
- List steps = job.getSteps();
+ List steps = job.getStepInstances();
step1 = (StepInstance) steps.get(0);
step2 = (StepInstance) steps.get(1);
stepExecution1 = new StepExecution(step1, jobExecution);
@@ -187,7 +187,7 @@ public class DefaultJobExecutorTests extends TestCase {
public void testRunWithNonDefaultExecutor() throws Exception {
jobExecutor.setStepExecutorFactory(new StepExecutorFactory() {
- public StepExecutor getExecutor(StepConfiguration configuration) {
+ public StepExecutor getExecutor(Step configuration) {
return configuration == stepConfiguration2 ? defaultStepLifecycle
: configurationStepLifecycle;
}
@@ -209,7 +209,7 @@ public class DefaultJobExecutorTests extends TestCase {
final StepInterruptedException exception = new StepInterruptedException(
"Interrupt!");
defaultStepLifecycle = new StubStepExecutor() {
- public ExitStatus process(StepConfiguration configuration,
+ public ExitStatus process(Step configuration,
StepExecution stepExecution)
throws StepInterruptedException, BatchCriticalException {
throw exception;
@@ -230,7 +230,7 @@ public class DefaultJobExecutorTests extends TestCase {
stepConfiguration2.setStartLimit(5);
final RuntimeException exception = new RuntimeException("Foo!");
defaultStepLifecycle = new StubStepExecutor() {
- public ExitStatus process(StepConfiguration configuration,
+ public ExitStatus process(Step configuration,
StepExecution stepExecution)
throws StepInterruptedException, BatchCriticalException {
throw exception;
@@ -302,10 +302,10 @@ public class DefaultJobExecutorTests extends TestCase {
private class StubStepExecutor implements StepExecutor {
- public void applyConfiguration(StepConfiguration configuration) {
+ public void applyConfiguration(Step configuration) {
}
- public ExitStatus process(StepConfiguration configuration,
+ public ExitStatus process(Step configuration,
StepExecution stepExecution) throws StepInterruptedException,
BatchCriticalException {
return null;
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/InterruptJobTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/InterruptJobTests.java
index a9549a58b..bdb70de55 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/InterruptJobTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/InterruptJobTests.java
@@ -19,13 +19,13 @@ import java.util.Collections;
import junit.framework.TestCase;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.NoSuchJobConfigurationException;
+import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
+import org.springframework.batch.core.domain.NoSuchJobException;
import org.springframework.batch.core.executor.JobExecutor;
import org.springframework.batch.core.runtime.SimpleJobIdentifier;
import org.springframework.batch.execution.bootstrap.support.ThreadInterruptJobExecutionListener;
-import org.springframework.batch.execution.configuration.MapJobConfigurationRegistry;
+import org.springframework.batch.execution.configuration.MapJobRegistry;
import org.springframework.batch.execution.launch.JobExecutorFacade;
import org.springframework.batch.execution.launch.SimpleJobExecutorFacade;
import org.springframework.batch.execution.repository.SimpleJobRepository;
@@ -55,10 +55,10 @@ public class InterruptJobTests extends TestCase {
facade.setJobExecutionListeners(Collections
.singletonList(new ThreadInterruptJobExecutionListener()));
- MapJobConfigurationRegistry registry = new MapJobConfigurationRegistry();
- facade.setJobConfigurationLocator(registry);
+ MapJobRegistry registry = new MapJobRegistry();
+ facade.setJobLocator(registry);
- registry.register(new JobConfiguration("foo"));
+ registry.register(new Job("foo"));
final SimpleJobIdentifier identifier = new SimpleJobIdentifier("foo");
final JobExecution execution = facade.createExecutionFrom(identifier);
@@ -67,7 +67,7 @@ public class InterruptJobTests extends TestCase {
public void run() {
try {
facade.start(execution);
- } catch (NoSuchJobConfigurationException e) {
+ } catch (NoSuchJobException e) {
fail("Unexpected NoSuchJobConfigurationException");
}
}
@@ -100,7 +100,7 @@ public class InterruptJobTests extends TestCase {
* @see org.springframework.batch.core.executor.JobExecutor#run(org.springframework.batch.core.configuration.JobConfiguration,
* org.springframework.batch.core.domain.JobExecution)
*/
- public ExitStatus run(JobConfiguration configuration,
+ public ExitStatus run(Job configuration,
JobExecution execution) throws BatchCriticalException {
try {
// 1 seconds should be long enough to allow the thread to be
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/SimpleJobExecutorFacadeTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/SimpleJobExecutorFacadeTests.java
index 836641252..c6b8e5981 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/SimpleJobExecutorFacadeTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/SimpleJobExecutorFacadeTests.java
@@ -25,11 +25,11 @@ import java.util.Properties;
import junit.framework.TestCase;
import org.easymock.MockControl;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.JobConfigurationLocator;
-import org.springframework.batch.core.configuration.NoSuchJobConfigurationException;
+import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobInstance;
+import org.springframework.batch.core.domain.JobLocator;
+import org.springframework.batch.core.domain.NoSuchJobException;
import org.springframework.batch.core.executor.JobExecutor;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobRepository;
@@ -56,7 +56,7 @@ public class SimpleJobExecutorFacadeTests extends TestCase {
private MockControl jobRepositoryControl = MockControl
.createControl(JobRepository.class);
- private JobConfiguration jobConfiguration = new JobConfiguration();
+ private Job jobConfiguration = new Job();
private volatile boolean running = false;
@@ -100,7 +100,7 @@ public class SimpleJobExecutorFacadeTests extends TestCase {
throws Exception {
jobIdentifier = new SimpleJobIdentifier("bar");
jobExecutor = new JobExecutor() {
- public ExitStatus run(JobConfiguration configuration,
+ public ExitStatus run(Job configuration,
JobExecution execution) throws BatchCriticalException {
jobExecution = execution;
return ExitStatus.FINISHED;
@@ -113,9 +113,9 @@ public class SimpleJobExecutorFacadeTests extends TestCase {
jobRepositoryControl.setReturnValue(jobExecution);
jobRepositoryControl.replay();
jobExecutorFacade
- .setJobConfigurationLocator(new JobConfigurationLocator() {
- public JobConfiguration getJobConfiguration(String name)
- throws NoSuchJobConfigurationException {
+ .setJobLocator(new JobLocator() {
+ public Job getJob(String name)
+ throws NoSuchJobException {
return jobConfiguration;
}
});
@@ -124,7 +124,7 @@ public class SimpleJobExecutorFacadeTests extends TestCase {
public void testIsRunning() throws Exception {
jobExecutorFacade.setJobExecutor(new JobExecutor() {
- public ExitStatus run(JobConfiguration configuration,
+ public ExitStatus run(Job configuration,
JobExecution execution) throws BatchCriticalException {
while (running) {
try {
@@ -138,9 +138,9 @@ public class SimpleJobExecutorFacadeTests extends TestCase {
}
});
jobExecutorFacade
- .setJobConfigurationLocator(new JobConfigurationLocator() {
- public JobConfiguration getJobConfiguration(String name)
- throws NoSuchJobConfigurationException {
+ .setJobLocator(new JobLocator() {
+ public Job getJob(String name)
+ throws NoSuchJobException {
return jobConfiguration;
}
});
@@ -150,7 +150,7 @@ public class SimpleJobExecutorFacadeTests extends TestCase {
public void run() {
try {
jobExecutorFacade.start(jobExecution);
- } catch (NoSuchJobConfigurationException e) {
+ } catch (NoSuchJobException e) {
throw new IllegalStateException("Shouldn't happen");
}
}
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/SimpleJobLauncherTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/SimpleJobLauncherTests.java
index ef470d7d2..cccd78306 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/SimpleJobLauncherTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/SimpleJobLauncherTests.java
@@ -18,11 +18,11 @@ package org.springframework.batch.execution.launch;
import junit.framework.TestCase;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.NoSuchJobConfigurationException;
+import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobIdentifier;
import org.springframework.batch.core.domain.JobInstance;
+import org.springframework.batch.core.domain.NoSuchJobException;
import org.springframework.batch.core.runtime.SimpleJobIdentifierFactory;
public class SimpleJobLauncherTests extends TestCase {
@@ -44,7 +44,7 @@ public class SimpleJobLauncherTests extends TestCase {
launcher.run();
// should do nothing
fail("Expected NoSuchJobConfigurationException");
- } catch (NoSuchJobConfigurationException e) {
+ } catch (NoSuchJobException e) {
assertTrue("Message should mention null job name: "
+ e.getMessage(), e.getMessage().toLowerCase().indexOf(
"null") >= 0);
@@ -56,7 +56,7 @@ public class SimpleJobLauncherTests extends TestCase {
launcher.setJobIdentifierFactory(new SimpleJobIdentifierFactory());
InterruptibleFacade jobExecutorFacade = new InterruptibleFacade();
launcher.setJobExecutorFacade(jobExecutorFacade);
- launcher.setJobConfigurationName(new JobConfiguration("foo").getName());
+ launcher.setJobName(new Job("foo").getName());
launcher.run();
assertFalse(launcher.isRunning());
launcher.run();
@@ -96,12 +96,12 @@ public class SimpleJobLauncherTests extends TestCase {
}
public void start(JobExecution execution)
- throws NoSuchJobConfigurationException {
+ throws NoSuchJobException {
run();
}
public JobExecution createExecutionFrom(JobIdentifier jobIdentifier)
- throws NoSuchJobConfigurationException {
+ throws NoSuchJobException {
return new JobExecution(new JobInstance(jobIdentifier));
}
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/SimpleJobTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/SimpleJobTests.java
index 4889bb276..427d110f2 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/SimpleJobTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/SimpleJobTests.java
@@ -22,12 +22,12 @@ import java.util.List;
import junit.framework.TestCase;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.StepConfiguration;
import org.springframework.batch.core.domain.BatchStatus;
+import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobIdentifier;
import org.springframework.batch.core.domain.JobInstance;
+import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.executor.StepExecutor;
import org.springframework.batch.core.executor.StepExecutorFactory;
import org.springframework.batch.core.runtime.SimpleJobIdentifier;
@@ -37,7 +37,7 @@ import org.springframework.batch.execution.repository.SimpleJobRepository;
import org.springframework.batch.execution.repository.dao.MapJobDao;
import org.springframework.batch.execution.repository.dao.MapStepDao;
import org.springframework.batch.execution.runtime.ScheduledJobIdentifierFactory;
-import org.springframework.batch.execution.step.SimpleStepConfiguration;
+import org.springframework.batch.execution.step.SimpleStep;
import org.springframework.batch.execution.step.simple.SimpleStepExecutor;
import org.springframework.batch.execution.tasklet.ItemOrientedTasklet;
import org.springframework.batch.item.ItemProcessor;
@@ -78,7 +78,7 @@ public class SimpleJobTests extends TestCase {
jobExecutor.setJobRepository(repository);
stepLifecycle.setRepository(repository);
jobExecutor.setStepExecutorFactory(new StepExecutorFactory() {
- public StepExecutor getExecutor(StepConfiguration configuration) {
+ public StepExecutor getExecutor(Step configuration) {
return stepLifecycle;
}
});
@@ -112,12 +112,12 @@ public class SimpleJobTests extends TestCase {
public void testSimpleJob() throws Exception {
- JobConfiguration jobConfiguration = new JobConfiguration();
+ Job jobConfiguration = new Job();
JobIdentifier runtimeInformation = new ScheduledJobIdentifierFactory()
.getJobIdentifier("real.job");
- jobConfiguration.addStep(new SimpleStepConfiguration(getTasklet("foo", "bar")));
- jobConfiguration.addStep(new SimpleStepConfiguration(getTasklet("spam")));
+ jobConfiguration.addStep(new SimpleStep(getTasklet("foo", "bar")));
+ jobConfiguration.addStep(new SimpleStep(getTasklet("spam")));
JobInstance job = repository.findOrCreateJob(jobConfiguration, runtimeInformation).getJob();
@@ -134,7 +134,7 @@ public class SimpleJobTests extends TestCase {
public void testSimpleJobWithRecovery() throws Exception {
- JobConfiguration jobConfiguration = new JobConfiguration();
+ Job jobConfiguration = new Job();
JobIdentifier runtimeInformation = new SimpleJobIdentifier("real.job");
final List throwables = new ArrayList();
@@ -162,7 +162,7 @@ public class SimpleJobTests extends TestCase {
* definition above)...
*/
final ItemOrientedTasklet module = getTasklet(new String[] { "foo", "bar", "spam" });
- StepConfiguration step = new SimpleStepConfiguration(module);
+ Step step = new SimpleStep(module);
module.setItemProcessor(new ItemProcessor() {
public void process(Object data) throws Exception {
throw new RuntimeException("Try again Dummy!");
@@ -183,10 +183,10 @@ public class SimpleJobTests extends TestCase {
public void testExceptionTerminates() throws Exception {
- JobConfiguration jobConfiguration = new JobConfiguration();
+ Job jobConfiguration = new Job();
JobIdentifier runtimeInformation = new SimpleJobIdentifier("real.job");
final ItemOrientedTasklet module = getTasklet(new String[] { "foo", "bar", "spam" });
- StepConfiguration step = new SimpleStepConfiguration(module);
+ Step step = new SimpleStep(module);
module.setItemProcessor(new ItemProcessor() {
public void process(Object data) throws Exception {
throw new RuntimeException("Foo");
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/TaskExecutorJobLauncherTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/TaskExecutorJobLauncherTests.java
index 58eaf9807..e29d13c93 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/TaskExecutorJobLauncherTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/launch/TaskExecutorJobLauncherTests.java
@@ -25,11 +25,11 @@ import java.util.TimerTask;
import junit.framework.TestCase;
import org.easymock.MockControl;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.NoSuchJobConfigurationException;
+import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobIdentifier;
import org.springframework.batch.core.domain.JobInstance;
+import org.springframework.batch.core.domain.NoSuchJobException;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.runtime.SimpleJobIdentifier;
import org.springframework.batch.core.runtime.SimpleJobIdentifierFactory;
@@ -57,7 +57,7 @@ public class TaskExecutorJobLauncherTests extends TestCase {
InterruptibleContainer container = new InterruptibleContainer();
launcher.setJobExecutorFacade(container);
- launcher.setJobConfigurationName(new JobConfiguration("foo").getName());
+ launcher.setJobName(new Job("foo").getName());
JobExecution execution = launcher.run();
// give the thread some time to start up...
@@ -91,7 +91,7 @@ public class TaskExecutorJobLauncherTests extends TestCase {
InterruptibleContainer container = new InterruptibleContainer();
launcher.setJobExecutorFacade(container);
- launcher.setJobConfigurationName("foo");
+ launcher.setJobName("foo");
JobExecution execution = launcher.run();
// give the thread some time to start up...
@@ -117,7 +117,7 @@ public class TaskExecutorJobLauncherTests extends TestCase {
InterruptibleContainer container = new InterruptibleContainer();
launcher.setJobExecutorFacade(container);
- launcher.setJobConfigurationName(new JobConfiguration("foo").getName());
+ launcher.setJobName(new Job("foo").getName());
launcher.run();
// give the thread some time to start up:
@@ -190,7 +190,7 @@ public class TaskExecutorJobLauncherTests extends TestCase {
control.expectAndReturn(facade
.createExecutionFrom(jobRuntimeInformation), execution);
facade.start(execution);
- control.setThrowable(new NoSuchJobConfigurationException("SPAM"));
+ control.setThrowable(new NoSuchJobException("SPAM"));
control.replay();
launcher.run(jobRuntimeInformation);
@@ -215,13 +215,13 @@ public class TaskExecutorJobLauncherTests extends TestCase {
}
public void start(JobExecution execution)
- throws NoSuchJobConfigurationException {
+ throws NoSuchJobException {
start();
execution.setExitStatus(new ExitStatus(false, "COMPLETED_BY_TEST"));
}
public JobExecution createExecutionFrom(JobIdentifier jobIdentifier)
- throws NoSuchJobConfigurationException {
+ throws NoSuchJobException {
return new JobExecution(new JobInstance(jobIdentifier));
}
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java
index 48bd036f0..9fbc6d966 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java
@@ -25,13 +25,13 @@ import junit.framework.TestCase;
import org.easymock.ArgumentsMatcher;
import org.easymock.MockControl;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.StepConfiguration;
-import org.springframework.batch.core.configuration.StepConfigurationSupport;
+import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobInstance;
+import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
+import org.springframework.batch.core.domain.StepSupport;
import org.springframework.batch.core.repository.BatchRestartException;
import org.springframework.batch.core.runtime.SimpleJobIdentifier;
import org.springframework.batch.execution.repository.dao.JobDao;
@@ -50,13 +50,13 @@ public class SimpleJobRepositoryTests extends TestCase {
SimpleJobRepository jobRepository;
- JobConfiguration jobConfiguration;
+ Job jobConfiguration;
SimpleJobIdentifier jobRuntimeInformation;
- StepConfiguration stepConfiguration1;
+ Step stepConfiguration1;
- StepConfiguration stepConfiguration2;
+ Step stepConfiguration2;
MockControl jobDaoControl = MockControl.createControl(JobDao.class);
@@ -87,13 +87,13 @@ public class SimpleJobRepositoryTests extends TestCase {
jobRuntimeInformation = new SimpleJobIdentifier("RepositoryTest");
- jobConfiguration = new JobConfiguration();
+ jobConfiguration = new Job();
jobConfiguration.setBeanName("RepositoryTest");
jobConfiguration.setRestartable(true);
- stepConfiguration1 = new StepConfigurationSupport("TestStep1");
+ stepConfiguration1 = new StepSupport("TestStep1");
- stepConfiguration2 = new StepConfigurationSupport("TestStep2");
+ stepConfiguration2 = new StepSupport("TestStep2");
List stepConfigurations = new ArrayList();
stepConfigurations.add(stepConfiguration1);
@@ -144,7 +144,7 @@ public class SimpleJobRepositoryTests extends TestCase {
jobDaoControl.replay();
JobInstance job = jobRepository.findOrCreateJob(jobConfiguration, jobRuntimeInformation).getJob();
assertTrue(job.equals(databaseJob));
- List jobSteps = job.getSteps();
+ List jobSteps = job.getStepInstances();
Iterator it = jobSteps.iterator();
StepInstance step = (StepInstance) it.next();
assertTrue(step.equals(databaseStep1));
@@ -191,7 +191,7 @@ public class SimpleJobRepositoryTests extends TestCase {
jobDaoControl.replay();
JobInstance job = jobRepository.findOrCreateJob(jobConfiguration, jobRuntimeInformation).getJob();
assertTrue(job.equals(databaseJob));
- List jobSteps = job.getSteps();
+ List jobSteps = job.getStepInstances();
Iterator it = jobSteps.iterator();
StepInstance step = (StepInstance) it.next();
assertTrue(step.equals(databaseStep1));
@@ -280,7 +280,7 @@ public class SimpleJobRepositoryTests extends TestCase {
jobDaoControl.replay();
JobInstance job = jobRepository.findOrCreateJob(jobConfiguration, jobRuntimeInformation).getJob();
assertTrue(job.equals(databaseJob));
- List jobSteps = job.getSteps();
+ List jobSteps = job.getStepInstances();
Iterator it = jobSteps.iterator();
StepInstance step = (StepInstance) it.next();
assertTrue(step.equals(databaseStep1));
@@ -420,7 +420,7 @@ public class SimpleJobRepositoryTests extends TestCase {
stepDaoControl.replay();
jobDaoControl.replay();
JobInstance job = jobRepository.findOrCreateJob(jobConfiguration, jobRuntimeInformation).getJob();
- List jobSteps = job.getSteps();
+ List jobSteps = job.getStepInstances();
Iterator it = jobSteps.iterator();
StepInstance step = (StepInstance) it.next();
assertTrue(step.equals(databaseStep1));
@@ -464,7 +464,7 @@ public class SimpleJobRepositoryTests extends TestCase {
jobDaoControl.replay();
JobInstance job = jobRepository.findOrCreateJob(jobConfiguration, jobRuntimeInformation).getJob();
assertTrue(job.equals(databaseJob));
- List jobSteps = job.getSteps();
+ List jobSteps = job.getStepInstances();
Iterator it = jobSteps.iterator();
StepInstance step = (StepInstance) it.next();
assertTrue(step.equals(databaseStep1));
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/JdbcStepDaoPrefixTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/JdbcStepDaoPrefixTests.java
index eb7164013..cf61156d5 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/JdbcStepDaoPrefixTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/JdbcStepDaoPrefixTests.java
@@ -54,7 +54,7 @@ public class JdbcStepDaoPrefixTests extends TestCase {
stepExecution.incrementVersion();
step.setStatus(BatchStatus.STARTED);
- job.addStep(step);
+ job.addStepInstance(step);
}
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/PrototypeBeanStepExecutorFactoryTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/PrototypeBeanStepExecutorFactoryTests.java
index f94076b22..1caa2877f 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/PrototypeBeanStepExecutorFactoryTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/PrototypeBeanStepExecutorFactoryTests.java
@@ -20,7 +20,7 @@ import java.util.List;
import junit.framework.TestCase;
-import org.springframework.batch.core.configuration.StepConfigurationSupport;
+import org.springframework.batch.core.domain.StepSupport;
import org.springframework.batch.core.executor.StepExecutor;
import org.springframework.batch.execution.step.simple.SimpleStepExecutor;
import org.springframework.batch.repeat.RepeatOperations;
@@ -76,21 +76,21 @@ public class PrototypeBeanStepExecutorFactoryTests extends TestCase {
SimpleStepExecutor executor = new SimpleStepExecutor();
applicationContext.getBeanFactory().registerSingleton("foo", executor);
factory.setStepExecutorName("foo");
- assertEquals(executor, factory.getExecutor(new SimpleStepConfiguration()));
+ assertEquals(executor, factory.getExecutor(new SimpleStep()));
}
public void testSuccessfulStepExecutorWithNonSimpleConfigugration() throws Exception {
SimpleStepExecutor executor = new SimpleStepExecutor();
applicationContext.getBeanFactory().registerSingleton("foo", executor);
factory.setStepExecutorName("foo");
- assertEquals(executor, factory.getExecutor(new StepConfigurationSupport()));
+ assertEquals(executor, factory.getExecutor(new StepSupport()));
}
public void testSuccessfulStepExecutorWithSimpleConfigurationAndNotSimpleExecutor() throws Exception {
StepExecutor executor = new SimpleStepExecutor();
applicationContext.getBeanFactory().registerSingleton("foo", executor);
factory.setStepExecutorName("foo");
- assertEquals(executor, factory.getExecutor(new SimpleStepConfiguration()));
+ assertEquals(executor, factory.getExecutor(new SimpleStep()));
}
public void testSuccessfulStepExecutorHolderStrategy() throws Exception {
@@ -140,7 +140,7 @@ public class PrototypeBeanStepExecutorFactoryTests extends TestCase {
* @author Dave Syer
*
*/
- public class SimpleHolderStepConfiguration extends SimpleStepConfiguration implements RepeatOperationsHolder {
+ public class SimpleHolderStepConfiguration extends SimpleStep implements RepeatOperationsHolder {
private RepeatOperations chunkOperations;
private RepeatOperations stepOperations;
public SimpleHolderStepConfiguration(RepeatOperations executor) {
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/DefaultStepExecutorTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/DefaultStepExecutorTests.java
index 1c927c3dd..d86c467aa 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/DefaultStepExecutorTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/DefaultStepExecutorTests.java
@@ -22,12 +22,12 @@ import java.util.List;
import junit.framework.TestCase;
-import org.springframework.batch.core.configuration.StepConfigurationSupport;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobInstance;
import org.springframework.batch.core.domain.StepContribution;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
+import org.springframework.batch.core.domain.StepSupport;
import org.springframework.batch.core.executor.ExitCodeExceptionClassifier;
import org.springframework.batch.core.runtime.SimpleJobIdentifier;
import org.springframework.batch.core.tasklet.Tasklet;
@@ -36,7 +36,7 @@ import org.springframework.batch.execution.repository.dao.MapJobDao;
import org.springframework.batch.execution.repository.dao.MapStepDao;
import org.springframework.batch.execution.scope.StepScope;
import org.springframework.batch.execution.scope.StepSynchronizationManager;
-import org.springframework.batch.execution.step.SimpleStepConfiguration;
+import org.springframework.batch.execution.step.SimpleStep;
import org.springframework.batch.execution.tasklet.ItemOrientedTasklet;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.batch.item.ItemReader;
@@ -63,7 +63,7 @@ public class DefaultStepExecutorTests extends TestCase {
private SimpleStepExecutor stepExecutor;
- private StepConfigurationSupport stepConfiguration;
+ private StepSupport stepConfiguration;
private RepeatTemplate template;
@@ -93,7 +93,7 @@ public class DefaultStepExecutorTests extends TestCase {
super.setUp();
stepExecutor = new SimpleStepExecutor();
stepExecutor.setRepository(new JobRepositorySupport());
- stepConfiguration = new SimpleStepConfiguration();
+ stepConfiguration = new SimpleStep();
stepConfiguration.setTasklet(getTasklet(new String[] { "foo", "bar",
"spam" }));
template = new RepeatTemplate();
@@ -393,7 +393,7 @@ public class DefaultStepExecutorTests extends TestCase {
}
public void testApplyConfigurationWithExceptionHandler() throws Exception {
- SimpleStepConfiguration stepConfiguration = new SimpleStepConfiguration("foo");
+ SimpleStep stepConfiguration = new SimpleStep("foo");
final List list = new ArrayList();
stepExecutor.setStepOperations(new RepeatTemplate() {
public void setExceptionHandler(ExceptionHandler exceptionHandler) {
@@ -406,7 +406,7 @@ public class DefaultStepExecutorTests extends TestCase {
}
public void testApplyConfigurationWithZeroSkipLimit() throws Exception {
- SimpleStepConfiguration stepConfiguration = new SimpleStepConfiguration("foo");
+ SimpleStep stepConfiguration = new SimpleStep("foo");
stepConfiguration.setSkipLimit(0);
final List list = new ArrayList();
stepExecutor.setStepOperations(new RepeatTemplate() {
@@ -419,7 +419,7 @@ public class DefaultStepExecutorTests extends TestCase {
}
public void testApplyConfigurationWithNonZeroSkipLimit() throws Exception {
- SimpleStepConfiguration stepConfiguration = new SimpleStepConfiguration("foo");
+ SimpleStep stepConfiguration = new SimpleStep("foo");
stepConfiguration.setSkipLimit(1);
final List list = new ArrayList();
stepExecutor.setStepOperations(new RepeatTemplate() {
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/JobRepositorySupport.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/JobRepositorySupport.java
index 9354ec3fb..c28a17ace 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/JobRepositorySupport.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/JobRepositorySupport.java
@@ -15,7 +15,7 @@
*/
package org.springframework.batch.execution.step.simple;
-import org.springframework.batch.core.configuration.JobConfiguration;
+import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobIdentifier;
import org.springframework.batch.core.domain.JobInstance;
@@ -32,7 +32,7 @@ public class JobRepositorySupport implements JobRepository {
/* (non-Javadoc)
* @see org.springframework.batch.container.common.repository.JobRepository#findOrCreateJob(org.springframework.batch.container.common.domain.JobConfiguration)
*/
- public JobExecution findOrCreateJob(JobConfiguration jobConfiguration, JobIdentifier runtimeInformation) {
+ public JobExecution findOrCreateJob(Job jobConfiguration, JobIdentifier runtimeInformation) {
return null;
}
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/RepeatOperationsStepConfigurationTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/RepeatOperationsStepTests.java
similarity index 81%
rename from spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/RepeatOperationsStepConfigurationTests.java
rename to spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/RepeatOperationsStepTests.java
index 195686b19..d17ed8dd2 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/RepeatOperationsStepConfigurationTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/RepeatOperationsStepTests.java
@@ -17,19 +17,19 @@ package org.springframework.batch.execution.step.simple;
import junit.framework.TestCase;
-import org.springframework.batch.execution.step.RepeatOperationsStepConfiguration;
+import org.springframework.batch.execution.step.RepeatOperationsStep;
import org.springframework.batch.repeat.support.RepeatTemplate;
/**
* @author Dave Syer
*
*/
-public class RepeatOperationsStepConfigurationTests extends TestCase {
+public class RepeatOperationsStepTests extends TestCase {
- RepeatOperationsStepConfiguration configuration = new RepeatOperationsStepConfiguration();
+ RepeatOperationsStep configuration = new RepeatOperationsStep();
/**
- * Test method for {@link org.springframework.batch.execution.step.RepeatOperationsStepConfiguration#getChunkOperations()}.
+ * Test method for {@link org.springframework.batch.execution.step.RepeatOperationsStep#getChunkOperations()}.
*/
public void testSetChunkOperations() {
assertNull(configuration.getChunkOperations());
@@ -40,7 +40,7 @@ public class RepeatOperationsStepConfigurationTests extends TestCase {
}
/**
- * Test method for {@link org.springframework.batch.execution.step.RepeatOperationsStepConfiguration#getChunkOperations()}.
+ * Test method for {@link org.springframework.batch.execution.step.RepeatOperationsStep#getChunkOperations()}.
*/
public void testSetStepOperations() {
assertNull(configuration.getChunkOperations());
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepConfigurationTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepConfigurationTests.java
index a96c8f556..3e47914bd 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepConfigurationTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepConfigurationTests.java
@@ -18,7 +18,7 @@ package org.springframework.batch.execution.step.simple;
import junit.framework.TestCase;
import org.springframework.batch.core.tasklet.Tasklet;
-import org.springframework.batch.execution.step.SimpleStepConfiguration;
+import org.springframework.batch.execution.step.SimpleStep;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.repeat.exception.handler.DefaultExceptionHandler;
@@ -28,19 +28,19 @@ import org.springframework.batch.repeat.exception.handler.DefaultExceptionHandle
*/
public class SimpleStepConfigurationTests extends TestCase {
- SimpleStepConfiguration configuration = new SimpleStepConfiguration("foo");
+ SimpleStep configuration = new SimpleStep("foo");
/**
- * Test method for {@link org.springframework.batch.execution.step.SimpleStepConfiguration#SimpleStepConfiguration()}.
+ * Test method for {@link org.springframework.batch.execution.step.SimpleStep#SimpleStepConfiguration()}.
*/
public void testSimpleStepConfiguration() {
assertNotNull(configuration.getName());
- configuration = new SimpleStepConfiguration();
+ configuration = new SimpleStep();
assertNull(configuration.getName());
}
/**
- * Test method for {@link org.springframework.batch.execution.step.SimpleStepConfiguration#SimpleStepConfiguration(org.springframework.batch.core.tasklet.Tasklet)}.
+ * Test method for {@link org.springframework.batch.execution.step.SimpleStep#SimpleStepConfiguration(org.springframework.batch.core.tasklet.Tasklet)}.
*/
public void testSimpleStepConfigurationTasklet() {
Tasklet tasklet = new Tasklet() {
@@ -48,12 +48,12 @@ public class SimpleStepConfigurationTests extends TestCase {
return ExitStatus.FINISHED;
}
};
- configuration = new SimpleStepConfiguration(tasklet);
+ configuration = new SimpleStep(tasklet);
assertEquals(tasklet, configuration.getTasklet());
}
/**
- * Test method for {@link org.springframework.batch.execution.step.SimpleStepConfiguration#getCommitInterval()}.
+ * Test method for {@link org.springframework.batch.execution.step.SimpleStep#getCommitInterval()}.
*/
public void testGetCommitInterval() {
assertEquals(1, configuration.getCommitInterval());
@@ -62,7 +62,7 @@ public class SimpleStepConfigurationTests extends TestCase {
}
/**
- * Test method for {@link org.springframework.batch.execution.step.AbstractStepConfiguration#getExceptionHandler()}.
+ * Test method for {@link org.springframework.batch.execution.step.AbstractStep#getExceptionHandler()}.
*/
public void testGetExceptionHandler() {
assertNull(configuration.getExceptionHandler());
@@ -71,7 +71,7 @@ public class SimpleStepConfigurationTests extends TestCase {
}
/**
- * Test method for {@link org.springframework.batch.execution.step.AbstractStepConfiguration#getExceptionHandler()}.
+ * Test method for {@link org.springframework.batch.execution.step.AbstractStep#getExceptionHandler()}.
*/
public void testSkipLimit() {
assertEquals(0, configuration.getSkipLimit());
@@ -80,7 +80,7 @@ public class SimpleStepConfigurationTests extends TestCase {
}
/**
- * Test method for {@link org.springframework.batch.execution.step.AbstractStepConfiguration#getSkipLimit()}.
+ * Test method for {@link org.springframework.batch.execution.step.AbstractStep#getSkipLimit()}.
*/
public void testGetSkipLimit() {
assertEquals(0, configuration.getSkipLimit());
@@ -89,7 +89,7 @@ public class SimpleStepConfigurationTests extends TestCase {
}
/**
- * Test method for {@link org.springframework.batch.execution.step.AbstractStepConfiguration#isSaveRestartData()}.
+ * Test method for {@link org.springframework.batch.execution.step.AbstractStep#isSaveRestartData()}.
*/
public void testIsSaveRestartData() {
assertEquals(false, configuration.isSaveRestartData());
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorFactoryTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorFactoryTests.java
index a9dea013d..dbaf51a6f 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorFactoryTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorFactoryTests.java
@@ -20,14 +20,14 @@ import java.util.List;
import junit.framework.TestCase;
-import org.springframework.batch.core.configuration.StepConfigurationSupport;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobInstance;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
+import org.springframework.batch.core.domain.StepSupport;
import org.springframework.batch.core.tasklet.Tasklet;
import org.springframework.batch.execution.step.RepeatOperationsHolder;
-import org.springframework.batch.execution.step.SimpleStepConfiguration;
+import org.springframework.batch.execution.step.SimpleStep;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.repeat.RepeatContext;
import org.springframework.batch.repeat.RepeatOperations;
@@ -49,11 +49,11 @@ public class SimpleStepExecutorFactoryTests extends TestCase {
}
public void testSuccessfulStepExecutor() throws Exception {
- assertNotNull(factory.getExecutor(new SimpleStepConfiguration()));
+ assertNotNull(factory.getExecutor(new SimpleStep()));
}
public void testSuccessfulExceptionHandler() throws Exception {
- SimpleStepConfiguration configuration = new SimpleStepConfiguration();
+ SimpleStep configuration = new SimpleStep();
final List list = new ArrayList();
configuration.setExceptionHandler(new ExceptionHandler() {
public void handleException(RepeatContext context,
@@ -139,7 +139,7 @@ public class SimpleStepExecutorFactoryTests extends TestCase {
public void testUnsuccessfulWrongConfiguration() throws Exception {
try {
- factory.getExecutor(new StepConfigurationSupport());
+ factory.getExecutor(new StepSupport());
fail("Expected IllegalStateException");
} catch (IllegalStateException e) {
// expected
@@ -153,7 +153,7 @@ public class SimpleStepExecutorFactoryTests extends TestCase {
public void testUnsuccessfulNoJobRepository() throws Exception {
try {
factory = new SimpleStepExecutorFactory();
- factory.getExecutor(new SimpleStepConfiguration());
+ factory.getExecutor(new SimpleStep());
fail("Expected IllegalArgumentException");
} catch (IllegalArgumentException e) {
// expected
@@ -177,7 +177,7 @@ public class SimpleStepExecutorFactoryTests extends TestCase {
* @author Dave Syer
*
*/
- public class SimpleHolderStepConfiguration extends SimpleStepConfiguration
+ public class SimpleHolderStepConfiguration extends SimpleStep
implements RepeatOperationsHolder {
private RepeatOperations chunkOperations;
private RepeatOperations stepOperations;
diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/StepExecutorInterruptionTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/StepExecutorInterruptionTests.java
index e75732c4a..9a04509f4 100644
--- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/StepExecutorInterruptionTests.java
+++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/StepExecutorInterruptionTests.java
@@ -20,14 +20,14 @@ import java.util.List;
import junit.framework.TestCase;
-import org.springframework.batch.core.configuration.JobConfiguration;
-import org.springframework.batch.core.configuration.StepConfigurationSupport;
import org.springframework.batch.core.domain.BatchStatus;
+import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.JobExecution;
import org.springframework.batch.core.domain.JobIdentifier;
import org.springframework.batch.core.domain.JobInstance;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.core.domain.StepInstance;
+import org.springframework.batch.core.domain.StepSupport;
import org.springframework.batch.core.executor.StepInterruptedException;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.runtime.SimpleJobIdentifier;
@@ -37,7 +37,7 @@ import org.springframework.batch.execution.repository.dao.JobDao;
import org.springframework.batch.execution.repository.dao.MapJobDao;
import org.springframework.batch.execution.repository.dao.MapStepDao;
import org.springframework.batch.execution.repository.dao.StepDao;
-import org.springframework.batch.execution.step.SimpleStepConfiguration;
+import org.springframework.batch.execution.step.SimpleStep;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.repeat.policy.SimpleCompletionPolicy;
import org.springframework.batch.repeat.support.RepeatTemplate;
@@ -52,7 +52,7 @@ public class StepExecutorInterruptionTests extends TestCase {
private JobInstance job;
- private StepConfigurationSupport stepConfiguration;
+ private StepSupport stepConfiguration;
private SimpleStepExecutor executor;
@@ -60,8 +60,8 @@ public class StepExecutorInterruptionTests extends TestCase {
jobRepository = new SimpleJobRepository(jobDao, stepDao);
- JobConfiguration jobConfiguration = new JobConfiguration();
- stepConfiguration = new SimpleStepConfiguration();
+ Job jobConfiguration = new Job();
+ stepConfiguration = new SimpleStep();
jobConfiguration.addStep(stepConfiguration);
JobIdentifier runtimeInformation = new SimpleJobIdentifier("TestJob");
jobConfiguration.setBeanName("testJob");
@@ -73,7 +73,7 @@ public class StepExecutorInterruptionTests extends TestCase {
executor.setRepository(jobRepository);
- List steps = job.getSteps();
+ List steps = job.getStepInstances();
final StepInstance step = (StepInstance) steps.get(0);
JobExecution jobExecutionContext = new JobExecution(new JobInstance(null, new Long(0)));
final StepExecution stepExecution = new StepExecution(step, jobExecutionContext);
diff --git a/spring-batch-execution/src/test/resources/job-configuration.xml b/spring-batch-execution/src/test/resources/job-configuration.xml
index bc6514cba..25da6533e 100644
--- a/spring-batch-execution/src/test/resources/job-configuration.xml
+++ b/spring-batch-execution/src/test/resources/job-configuration.xml
@@ -7,13 +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">
-
+
-
+
-
+
diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/bootstrap/support/test-batch-environment-no-launcher.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/bootstrap/support/test-batch-environment-no-launcher.xml
index 91c84e513..b4e8474ed 100644
--- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/bootstrap/support/test-batch-environment-no-launcher.xml
+++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/bootstrap/support/test-batch-environment-no-launcher.xml
@@ -7,7 +7,7 @@
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/spring-batch-execution/src/test/resources/org/springframework/batch/execution/bootstrap/support/test-batch-environment.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/bootstrap/support/test-batch-environment.xml
index 3394b6565..cf59d0a77 100644
--- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/bootstrap/support/test-batch-environment.xml
+++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/bootstrap/support/test-batch-environment.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/test-context.xml b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/test-context.xml
index f46669d54..af808914d 100644
--- a/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/test-context.xml
+++ b/spring-batch-execution/src/test/resources/org/springframework/batch/execution/configuration/test-context.xml
@@ -7,15 +7,15 @@
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">
-
+
-
+
-
+
-
+
@@ -34,15 +34,15 @@
-
+
-
+
-
+
@@ -50,7 +50,7 @@
-
+
diff --git a/spring-batch-execution/src/test/resources/simple-container-definition.xml b/spring-batch-execution/src/test/resources/simple-container-definition.xml
index b8049c9e2..537b99e69 100644
--- a/spring-batch-execution/src/test/resources/simple-container-definition.xml
+++ b/spring-batch-execution/src/test/resources/simple-container-definition.xml
@@ -12,7 +12,7 @@
-
+ class="org.springframework.batch.execution.configuration.MapJobRegistry" />
@@ -34,13 +34,13 @@