From f9619e345efaa47e4b94b5438e73bd80b929d01c Mon Sep 17 00:00:00 2001 From: dsyer Date: Tue, 29 Jan 2008 16:36:16 +0000 Subject: [PATCH] OPEN - issue BATCH-324: Step as factory for StepExecutor http://jira.springframework.org/browse/BATCH-324 Substantial re-org of core domain packages to align concerns --- .../domain/IncorrectJobCountException.java | 34 --- .../JobExecutionException.java | 2 +- .../{executor => domain}/JobExecutor.java | 4 +- .../batch/core/domain/Step.java | 1 - .../batch/core/domain/StepExecutor.java | 50 +++ .../StepInterruptedException.java | 2 +- .../batch/core/domain/StepSupport.java | 1 - .../batch/core/executor/StepExecutor.java | 66 ---- .../batch/core/executor/package.html | 7 - .../DuplicateJobException.java | 4 +- .../{domain => repository}/JobException.java | 4 +- .../JobExecutionAlreadyRunningException.java | 2 +- .../{domain => repository}/JobLocator.java | 4 +- .../{domain => repository}/JobRegistry.java | 4 +- .../ListableJobRegistry.java | 4 +- .../NoSuchJobException.java | 4 +- .../ExitCodeExceptionClassifier.java | 2 +- .../JobExecutionExceptionTests.java | 3 +- .../{configuration => domain}/JobTests.java | 2 +- .../SpringBeanJobTests.java | 2 +- .../StepInterruptedExceptionTests.java | 3 +- .../StepSupportTests.java | 2 +- .../DuplicateJobExceptionTests.java | 4 +- .../JobExceptionTests.java | 4 +- .../NoSuchJobExceptionTests.java | 4 +- .../support/CommandLineJobRunner.java | 4 +- .../support/SimpleExportedJobLauncher.java | 4 +- .../JobRegistryBeanPostProcessor.java | 6 +- .../configuration/MapJobRegistry.java | 8 +- .../execution/job/DefaultJobExecutor.java | 13 +- .../execution/launch/SimpleJobLauncher.java | 2 +- .../execution/step/simple/AbstractStep.java | 4 +- .../step/simple/RepeatOperationsHolder.java | 2 +- .../step/simple/RepeatOperationsStep.java | 2 +- .../SimpleExitCodeExceptionClassifier.java | 4 +- .../step/simple/SimpleStepExecutor.java | 19 +- .../step/simple/StepInterruptionPolicy.java | 4 +- .../simple/ThreadStepInterruptionPolicy.java | 2 +- .../support/CommandLineJobRunnerTests.java | 2 +- .../JobRegistryBeanPostProcessorTests.java | 4 +- .../configuration/MapJobRegistryTests.java | 4 +- .../job/DefaultJobExecutorTests.java | 21 +- .../launch/SimpleJobLauncherTests.java | 2 +- .../execution/launch/SimpleJobTests.java | 4 - .../repository/dao/AbstractStepDaoTests.java | 2 +- .../simple/RepeatOperationsStepTests.java | 4 +- ...impleExitCodeExceptionClassifierTests.java | 4 +- .../step/simple/SimpleStepExecutorTests.java | 22 +- .../step/simple/SimpleStepTests.java | 2 +- .../simple/StepExecutorInterruptionTests.java | 6 +- .../ThreadStepInterruptionPolicyTests.java | 2 +- .../src/test/resources/job-configuration.xml | 2 +- .../resources/simple-container-definition.xml | 11 +- .../sample/item/reader/OrderItemReader.java | 5 +- .../src/main/resources/jobs/adhocLoopJob.xml | 35 ++- .../resources/simple-container-definition.xml | 288 +++++++++--------- .../batch/sample/DefaultJobLoader.java | 4 +- 57 files changed, 333 insertions(+), 384 deletions(-) delete mode 100644 spring-batch-core/src/main/java/org/springframework/batch/core/domain/IncorrectJobCountException.java rename spring-batch-core/src/main/java/org/springframework/batch/core/{executor => domain}/JobExecutionException.java (91%) rename spring-batch-core/src/main/java/org/springframework/batch/core/{executor => domain}/JobExecutor.java (86%) create mode 100644 spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepExecutor.java rename spring-batch-core/src/main/java/org/springframework/batch/core/{executor => domain}/StepInterruptedException.java (96%) delete mode 100644 spring-batch-core/src/main/java/org/springframework/batch/core/executor/StepExecutor.java delete mode 100644 spring-batch-core/src/main/java/org/springframework/batch/core/executor/package.html rename spring-batch-core/src/main/java/org/springframework/batch/core/{domain => repository}/DuplicateJobException.java (88%) rename spring-batch-core/src/main/java/org/springframework/batch/core/{domain => repository}/JobException.java (88%) rename spring-batch-core/src/main/java/org/springframework/batch/core/{domain => repository}/JobLocator.java (88%) rename spring-batch-core/src/main/java/org/springframework/batch/core/{domain => repository}/JobRegistry.java (90%) rename spring-batch-core/src/main/java/org/springframework/batch/core/{domain => repository}/ListableJobRegistry.java (88%) rename spring-batch-core/src/main/java/org/springframework/batch/core/{domain => repository}/NoSuchJobException.java (88%) rename spring-batch-core/src/main/java/org/springframework/batch/core/{executor => runtime}/ExitCodeExceptionClassifier.java (93%) rename spring-batch-core/src/test/java/org/springframework/batch/core/{executor => domain}/JobExecutionExceptionTests.java (89%) rename spring-batch-core/src/test/java/org/springframework/batch/core/{configuration => domain}/JobTests.java (94%) rename spring-batch-core/src/test/java/org/springframework/batch/core/{configuration => domain}/SpringBeanJobTests.java (98%) rename spring-batch-core/src/test/java/org/springframework/batch/core/{executor => domain}/StepInterruptedExceptionTests.java (89%) rename spring-batch-core/src/test/java/org/springframework/batch/core/{configuration => domain}/StepSupportTests.java (94%) rename spring-batch-core/src/test/java/org/springframework/batch/core/{configuration => repository}/DuplicateJobExceptionTests.java (88%) rename spring-batch-core/src/test/java/org/springframework/batch/core/{configuration => repository}/JobExceptionTests.java (89%) rename spring-batch-core/src/test/java/org/springframework/batch/core/{configuration => repository}/NoSuchJobExceptionTests.java (88%) diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/IncorrectJobCountException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/IncorrectJobCountException.java deleted file mode 100644 index a628d123a..000000000 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/IncorrectJobCountException.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2006-2008 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.batch.core.domain; - -/** - * Checked exception indicating that an Incorrect number of jobs has - * been found. - * - * @author Lucas Ward - * - */ -public class IncorrectJobCountException extends JobException { - - public IncorrectJobCountException(String msg) { - super(msg); - } - - public IncorrectJobCountException(String msg, Throwable e) { - super(msg, e); - } -} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/executor/JobExecutionException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobExecutionException.java similarity index 91% rename from spring-batch-core/src/main/java/org/springframework/batch/core/executor/JobExecutionException.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobExecutionException.java index 66782e6fa..edacb4570 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/executor/JobExecutionException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobExecutionException.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.executor; +package org.springframework.batch.core.domain; /** * @author Dave Syer diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/executor/JobExecutor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobExecutor.java similarity index 86% rename from spring-batch-core/src/main/java/org/springframework/batch/core/executor/JobExecutor.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobExecutor.java index a2d693262..f959e5895 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/executor/JobExecutor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobExecutor.java @@ -14,10 +14,8 @@ * limitations under the License. */ -package org.springframework.batch.core.executor; +package org.springframework.batch.core.domain; -import org.springframework.batch.core.domain.Job; -import org.springframework.batch.core.domain.JobExecution; import org.springframework.batch.io.exception.BatchCriticalException; import org.springframework.batch.repeat.ExitStatus; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/Step.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/Step.java index bff532be8..2482cdfba 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/Step.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/Step.java @@ -15,7 +15,6 @@ */ package org.springframework.batch.core.domain; -import org.springframework.batch.core.executor.StepExecutor; /** * Batch domain interface representing the configuration of a step. As with the diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepExecutor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepExecutor.java new file mode 100644 index 000000000..fe16f2a61 --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepExecutor.java @@ -0,0 +1,50 @@ +/* + * Copyright 2006-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.springframework.batch.core.domain; + +import org.springframework.batch.io.exception.BatchCriticalException; +import org.springframework.batch.repeat.ExitStatus; + +/** + * Interface for processing a step. Implementations are free to process the step + * and return when finished, or to schedule the step for processing + * concurrently, or in the future. The status of the execution should be + * trackable with the step execution. The step should be treated as immutable.
+ * + * Because step execution parameters and policies can vary from step to step, a + * {@link StepExecutor} should be created by the caller using a {@link Step}. + * + * @author Lucas Ward + * @author Dave Syer + * + */ +public interface StepExecutor { + + /** + * It is not safe to re-use an instance of {@link StepExecutor} to process + * multiple concurrent executions. Use the factory method in {@link Step} to + * create a new instance and execute that. + * + * @param stepExecution an entity representing the step to be executed + * + * @throws StepInterruptedException if the step is interrupted externally + * @throws BatchCriticalException if there is a problem that needs to be + * signalled to the caller + */ + ExitStatus process(StepExecution stepExecution) throws StepInterruptedException, BatchCriticalException; + +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/executor/StepInterruptedException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepInterruptedException.java similarity index 96% rename from spring-batch-core/src/main/java/org/springframework/batch/core/executor/StepInterruptedException.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepInterruptedException.java index 83b2451ae..004b64a38 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/executor/StepInterruptedException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepInterruptedException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.core.executor; +package org.springframework.batch.core.domain; import org.springframework.batch.io.exception.BatchCriticalException; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java index ac79c6696..6e5943ae0 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepSupport.java @@ -15,7 +15,6 @@ */ package org.springframework.batch.core.domain; -import org.springframework.batch.core.executor.StepExecutor; import org.springframework.beans.factory.BeanNameAware; /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/executor/StepExecutor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/executor/StepExecutor.java deleted file mode 100644 index afffd978e..000000000 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/executor/StepExecutor.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2006-2007 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.springframework.batch.core.executor; - -import org.springframework.batch.core.domain.Step; -import org.springframework.batch.core.domain.StepExecution; -import org.springframework.batch.io.exception.BatchCriticalException; -import org.springframework.batch.repeat.ExitStatus; - -/** - * Interface for processing a step. Implementations are free to process the step - * and return when finished, or to schedule the step for processing - * concurrently, or in the future. The status of the execution should be - * trackable with the step execution. The step should be treated as - * immutable.
- * - * Because step execution parameters and policies can vary from step to step, a - * {@link StepExecutor} should be created by the caller using a - * {@link StepExecutorFactory}. - * - * @author Lucas Ward - * @author Dave Syer - * - */ -public interface StepExecutor { - - /** - * Process the step according to the given step. Implementations - * can be expected to modify their state when this method is called, to take - * account of any policy information in the step. Thus it is not - * safe to re-use an instance of {@link StepExecutor} to process multiple - * concurrent executions. - * - * @param step - * the configuration to use when running the step. Contains a - * recipe for the business logic of an individual processing - * operation. Also used to determine policies for commit - * intervals and exception handling, for instance. - * - * @param stepExecution - * an entity representing the step to be executed - * @throws StepInterruptedException - * if the step is interrupted externally - * @throws BatchCriticalException - * if there is a problem that needs to be signalled to the - * caller - */ - ExitStatus process(Step step, - StepExecution stepExecution) throws StepInterruptedException, - BatchCriticalException; - -} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/executor/package.html b/spring-batch-core/src/main/java/org/springframework/batch/core/executor/package.html deleted file mode 100644 index d3a965f37..000000000 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/executor/package.html +++ /dev/null @@ -1,7 +0,0 @@ - - -

-Interfaces and generic implementations of executor concerns. -

- - diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/DuplicateJobException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/DuplicateJobException.java similarity index 88% rename from spring-batch-core/src/main/java/org/springframework/batch/core/domain/DuplicateJobException.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/DuplicateJobException.java index f02bd8ed8..75db95b33 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/DuplicateJobException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/DuplicateJobException.java @@ -13,7 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.domain; +package org.springframework.batch.core.repository; + +import org.springframework.batch.core.domain.Job; /** * Checked exception that indicates a name clash when registering diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobException.java similarity index 88% rename from spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobException.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobException.java index 8aa31cf83..7cf809797 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobException.java @@ -13,7 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.domain; +package org.springframework.batch.core.repository; + +import org.springframework.batch.core.domain.Job; /** * Base class for checked exceptions related to {@link Job} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobExecutionAlreadyRunningException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobExecutionAlreadyRunningException.java index 58df8ac05..399dc4015 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobExecutionAlreadyRunningException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobExecutionAlreadyRunningException.java @@ -15,7 +15,7 @@ */ package org.springframework.batch.core.repository; -import org.springframework.batch.core.executor.JobExecutionException; +import org.springframework.batch.core.domain.JobExecutionException; /** * @author Dave Syer diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobLocator.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobLocator.java similarity index 88% rename from spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobLocator.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobLocator.java index f0f8dde5a..43ca793e0 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobLocator.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobLocator.java @@ -13,7 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.domain; +package org.springframework.batch.core.repository; + +import org.springframework.batch.core.domain.Job; /** * A runtime service locator interface for retrieving job configurations by diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobRegistry.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRegistry.java similarity index 90% rename from spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobRegistry.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRegistry.java index b5b4f1f5f..2034f4558 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobRegistry.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/JobRegistry.java @@ -13,7 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.domain; +package org.springframework.batch.core.repository; + +import org.springframework.batch.core.domain.Job; /** * A runtime service registry interface for registering job configurations by diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/ListableJobRegistry.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/ListableJobRegistry.java similarity index 88% rename from spring-batch-core/src/main/java/org/springframework/batch/core/domain/ListableJobRegistry.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/ListableJobRegistry.java index 19ae5a8c2..2632c4507 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/ListableJobRegistry.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/ListableJobRegistry.java @@ -13,10 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.domain; +package org.springframework.batch.core.repository; import java.util.Collection; +import org.springframework.batch.core.domain.Job; + /** * A listable extension of {@link JobRegistry}. * diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/NoSuchJobException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/NoSuchJobException.java similarity index 88% rename from spring-batch-core/src/main/java/org/springframework/batch/core/domain/NoSuchJobException.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/NoSuchJobException.java index fb951a3c4..a3c135c4a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/NoSuchJobException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/NoSuchJobException.java @@ -13,7 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.domain; +package org.springframework.batch.core.repository; + +import org.springframework.batch.core.domain.Job; /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/executor/ExitCodeExceptionClassifier.java b/spring-batch-core/src/main/java/org/springframework/batch/core/runtime/ExitCodeExceptionClassifier.java similarity index 93% rename from spring-batch-core/src/main/java/org/springframework/batch/core/executor/ExitCodeExceptionClassifier.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/runtime/ExitCodeExceptionClassifier.java index 7cd7d7a4d..0b308c34a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/executor/ExitCodeExceptionClassifier.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/runtime/ExitCodeExceptionClassifier.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.executor; +package org.springframework.batch.core.runtime; import org.springframework.batch.common.ExceptionClassifier; import org.springframework.batch.repeat.ExitStatus; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/executor/JobExecutionExceptionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobExecutionExceptionTests.java similarity index 89% rename from spring-batch-core/src/test/java/org/springframework/batch/core/executor/JobExecutionExceptionTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobExecutionExceptionTests.java index 7f50c5802..166b344fe 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/executor/JobExecutionExceptionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobExecutionExceptionTests.java @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.executor; +package org.springframework.batch.core.domain; import org.springframework.batch.core.AbstractExceptionTests; +import org.springframework.batch.core.domain.JobExecutionException; /** * @author Dave Syer diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/JobTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobTests.java similarity index 94% rename from spring-batch-core/src/test/java/org/springframework/batch/core/configuration/JobTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobTests.java index 51ccfe9ae..389757528 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/JobTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/JobTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.configuration; +package org.springframework.batch.core.domain; import java.util.Collections; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/SpringBeanJobTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/SpringBeanJobTests.java similarity index 98% rename from spring-batch-core/src/test/java/org/springframework/batch/core/configuration/SpringBeanJobTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/domain/SpringBeanJobTests.java index 77c35ff50..98c316002 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/SpringBeanJobTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/SpringBeanJobTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.core.configuration; +package org.springframework.batch.core.domain; import junit.framework.TestCase; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/executor/StepInterruptedExceptionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepInterruptedExceptionTests.java similarity index 89% rename from spring-batch-core/src/test/java/org/springframework/batch/core/executor/StepInterruptedExceptionTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepInterruptedExceptionTests.java index b3492e200..b4ca19ba3 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/executor/StepInterruptedExceptionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepInterruptedExceptionTests.java @@ -13,9 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.executor; +package org.springframework.batch.core.domain; import org.springframework.batch.core.AbstractExceptionTests; +import org.springframework.batch.core.domain.StepInterruptedException; /** * @author Dave Syer diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/StepSupportTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepSupportTests.java similarity index 94% rename from spring-batch-core/src/test/java/org/springframework/batch/core/configuration/StepSupportTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepSupportTests.java index fbb1497d7..e135d6c61 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/StepSupportTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/domain/StepSupportTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.configuration; +package org.springframework.batch.core.domain; import junit.framework.TestCase; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/DuplicateJobExceptionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/DuplicateJobExceptionTests.java similarity index 88% rename from spring-batch-core/src/test/java/org/springframework/batch/core/configuration/DuplicateJobExceptionTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/DuplicateJobExceptionTests.java index 8e111833a..3b3e2bbb1 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/DuplicateJobExceptionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/DuplicateJobExceptionTests.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.configuration; +package org.springframework.batch.core.repository; import org.springframework.batch.core.AbstractExceptionTests; -import org.springframework.batch.core.domain.DuplicateJobException; +import org.springframework.batch.core.repository.DuplicateJobException; /** * @author Dave Syer diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/JobExceptionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/JobExceptionTests.java similarity index 89% rename from spring-batch-core/src/test/java/org/springframework/batch/core/configuration/JobExceptionTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/JobExceptionTests.java index 4631c6f2a..b2e63f604 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/JobExceptionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/JobExceptionTests.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.configuration; +package org.springframework.batch.core.repository; import org.springframework.batch.core.AbstractExceptionTests; -import org.springframework.batch.core.domain.JobException; +import org.springframework.batch.core.repository.JobException; /** * @author Dave Syer diff --git a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/NoSuchJobExceptionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/NoSuchJobExceptionTests.java similarity index 88% rename from spring-batch-core/src/test/java/org/springframework/batch/core/configuration/NoSuchJobExceptionTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/NoSuchJobExceptionTests.java index aa6dcf4c0..be2a86c3c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/NoSuchJobExceptionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/NoSuchJobExceptionTests.java @@ -13,10 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.core.configuration; +package org.springframework.batch.core.repository; import org.springframework.batch.core.AbstractExceptionTests; -import org.springframework.batch.core.domain.NoSuchJobException; +import org.springframework.batch.core.repository.NoSuchJobException; /** * @author Dave Syer diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/CommandLineJobRunner.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/CommandLineJobRunner.java index c18797af1..09dafb967 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/CommandLineJobRunner.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/CommandLineJobRunner.java @@ -21,9 +21,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.batch.core.domain.Job; import org.springframework.batch.core.domain.JobExecution; -import org.springframework.batch.core.domain.JobLocator; import org.springframework.batch.core.domain.JobParameters; -import org.springframework.batch.core.executor.ExitCodeExceptionClassifier; +import org.springframework.batch.core.repository.JobLocator; +import org.springframework.batch.core.runtime.ExitCodeExceptionClassifier; import org.springframework.batch.core.runtime.JobParametersFactory; import org.springframework.batch.execution.launch.JobLauncher; import org.springframework.batch.execution.step.simple.SimpleExitCodeExceptionClassifier; diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/SimpleExportedJobLauncher.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/SimpleExportedJobLauncher.java index 675b21ebf..ef966aa1e 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/SimpleExportedJobLauncher.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/bootstrap/support/SimpleExportedJobLauncher.java @@ -22,11 +22,11 @@ import java.util.Properties; import org.springframework.batch.core.domain.Job; import org.springframework.batch.core.domain.JobExecution; -import org.springframework.batch.core.domain.JobLocator; import org.springframework.batch.core.domain.JobParameters; -import org.springframework.batch.core.domain.NoSuchJobException; import org.springframework.batch.core.domain.StepExecution; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; +import org.springframework.batch.core.repository.JobLocator; +import org.springframework.batch.core.repository.NoSuchJobException; import org.springframework.batch.core.runtime.JobParametersFactory; import org.springframework.batch.execution.launch.JobLauncher; import org.springframework.batch.support.PropertiesConverter; diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessor.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessor.java index 22cf81c24..4d562881b 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessor.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.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.batch.core.repository.DuplicateJobException; +import org.springframework.batch.core.repository.JobLocator; +import org.springframework.batch.core.repository.JobRegistry; import org.springframework.beans.BeansException; import org.springframework.beans.FatalBeanException; import org.springframework.beans.factory.DisposableBean; diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/MapJobRegistry.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/MapJobRegistry.java index 2482c9390..1df3bb876 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/MapJobRegistry.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/configuration/MapJobRegistry.java @@ -21,11 +21,11 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; -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.batch.core.repository.DuplicateJobException; +import org.springframework.batch.core.repository.JobRegistry; +import org.springframework.batch.core.repository.ListableJobRegistry; +import org.springframework.batch.core.repository.NoSuchJobException; import org.springframework.util.Assert; /** 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 d65c2dde8..a7a4adbf4 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 @@ -24,15 +24,15 @@ import org.springframework.batch.common.ExceptionClassifier; 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.JobExecutor; 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.StepExecutor; import org.springframework.batch.core.domain.StepInstance; -import org.springframework.batch.core.executor.ExitCodeExceptionClassifier; -import org.springframework.batch.core.executor.JobExecutor; -import org.springframework.batch.core.executor.StepExecutor; -import org.springframework.batch.core.executor.StepInterruptedException; +import org.springframework.batch.core.domain.StepInterruptedException; import org.springframework.batch.core.repository.JobRepository; +import org.springframework.batch.core.runtime.ExitCodeExceptionClassifier; import org.springframework.batch.execution.step.simple.SimpleExitCodeExceptionClassifier; import org.springframework.batch.io.exception.BatchCriticalException; import org.springframework.batch.repeat.ExitStatus; @@ -54,7 +54,7 @@ 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.domain.Job, + * @see org.springframework.batch.core.domain.JobExecutor#run(org.springframework.batch.core.domain.Job, * org.springframework.batch.core.domain.JobExecution) */ public ExitStatus run(Job job, JobExecution execution) @@ -85,8 +85,7 @@ public class DefaultJobExecutor implements JobExecutor { updateStatus(execution, BatchStatus.STARTED); StepExecutor stepExecutor = step.createStepExecutor(); StepExecution stepExecution = execution.createStepExecution(stepInstance); - status = stepExecutor.process(step, - stepExecution); + status = stepExecutor.process(stepExecution); } } 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 d2fb28e68..d98176156 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 @@ -19,9 +19,9 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.batch.core.domain.Job; import org.springframework.batch.core.domain.JobExecution; +import org.springframework.batch.core.domain.JobExecutor; import org.springframework.batch.core.domain.JobInstance; import org.springframework.batch.core.domain.JobParameters; -import org.springframework.batch.core.executor.JobExecutor; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.repeat.ExitStatus; diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/AbstractStep.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/AbstractStep.java index af5764f81..31a09b36d 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/AbstractStep.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/AbstractStep.java @@ -16,8 +16,8 @@ package org.springframework.batch.execution.step.simple; import org.springframework.batch.core.domain.Step; +import org.springframework.batch.core.domain.StepExecutor; import org.springframework.batch.core.domain.StepSupport; -import org.springframework.batch.core.executor.StepExecutor; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.tasklet.Tasklet; import org.springframework.batch.repeat.exception.handler.ExceptionHandler; @@ -113,7 +113,7 @@ public abstract class AbstractStep extends StepSupport { */ public StepExecutor createStepExecutor() { assertMandatoryProperties(); - SimpleStepExecutor executor = new SimpleStepExecutor(); + SimpleStepExecutor executor = new SimpleStepExecutor(this); executor.setRepository(jobRepository); executor.applyConfiguration(this); executor.setTasklet(tasklet); diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/RepeatOperationsHolder.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/RepeatOperationsHolder.java index 1efe2422f..3a3904782 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/RepeatOperationsHolder.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/RepeatOperationsHolder.java @@ -16,7 +16,7 @@ package org.springframework.batch.execution.step.simple; import org.springframework.batch.core.domain.Step; -import org.springframework.batch.core.executor.StepExecutor; +import org.springframework.batch.core.domain.StepExecutor; import org.springframework.batch.repeat.RepeatOperations; /** diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/RepeatOperationsStep.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/RepeatOperationsStep.java index aa98c2311..1c4a2873c 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/RepeatOperationsStep.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/RepeatOperationsStep.java @@ -17,7 +17,7 @@ package org.springframework.batch.execution.step.simple; import org.springframework.batch.core.domain.Step; -import org.springframework.batch.core.executor.StepExecutor; +import org.springframework.batch.core.domain.StepExecutor; import org.springframework.batch.repeat.RepeatOperations; /** diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleExitCodeExceptionClassifier.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleExitCodeExceptionClassifier.java index 8c1ec4e14..266667362 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleExitCodeExceptionClassifier.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/SimpleExitCodeExceptionClassifier.java @@ -18,8 +18,8 @@ package org.springframework.batch.execution.step.simple; import java.io.PrintWriter; import java.io.StringWriter; -import org.springframework.batch.core.executor.ExitCodeExceptionClassifier; -import org.springframework.batch.core.executor.StepInterruptedException; +import org.springframework.batch.core.domain.StepInterruptedException; +import org.springframework.batch.core.runtime.ExitCodeExceptionClassifier; import org.springframework.batch.repeat.ExitStatus; /** 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 c3ea237a0..bd28bef96 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 @@ -23,11 +23,11 @@ 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.StepExecutor; import org.springframework.batch.core.domain.StepInstance; -import org.springframework.batch.core.executor.ExitCodeExceptionClassifier; -import org.springframework.batch.core.executor.StepExecutor; -import org.springframework.batch.core.executor.StepInterruptedException; +import org.springframework.batch.core.domain.StepInterruptedException; import org.springframework.batch.core.repository.JobRepository; +import org.springframework.batch.core.runtime.ExitCodeExceptionClassifier; import org.springframework.batch.core.tasklet.Tasklet; import org.springframework.batch.execution.scope.SimpleStepContext; import org.springframework.batch.execution.scope.StepContext; @@ -96,6 +96,15 @@ public class SimpleStepExecutor implements StepExecutor { private Tasklet tasklet; + private AbstractStep step; + + /** + * Package private constructor so the factory can create a the executor. + */ + SimpleStepExecutor(AbstractStep abstractStep) { + this.step = abstractStep; + } + /** * Public setter for the {@link StatisticsService}. This will be used to * create the {@link StepContext}, and hence any component that is a @@ -163,9 +172,9 @@ 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(Step, StepExecution) + * @see StepExecutor#process(StepExecution) */ - public ExitStatus process(final Step step, final StepExecution stepExecution) throws BatchCriticalException, + public ExitStatus process(final StepExecution stepExecution) throws BatchCriticalException, StepInterruptedException { final StepInstance stepInstance = stepExecution.getStep(); diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/StepInterruptionPolicy.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/StepInterruptionPolicy.java index 8ed02dfd9..75d5e3e9c 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/StepInterruptionPolicy.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/StepInterruptionPolicy.java @@ -16,8 +16,8 @@ package org.springframework.batch.execution.step.simple; -import org.springframework.batch.core.executor.StepExecutor; -import org.springframework.batch.core.executor.StepInterruptedException; +import org.springframework.batch.core.domain.StepExecutor; +import org.springframework.batch.core.domain.StepInterruptedException; import org.springframework.batch.repeat.RepeatContext; /** diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/ThreadStepInterruptionPolicy.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/ThreadStepInterruptionPolicy.java index f82ef506f..0a74165c3 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/ThreadStepInterruptionPolicy.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/step/simple/ThreadStepInterruptionPolicy.java @@ -16,7 +16,7 @@ package org.springframework.batch.execution.step.simple; -import org.springframework.batch.core.executor.StepInterruptedException; +import org.springframework.batch.core.domain.StepInterruptedException; import org.springframework.batch.repeat.RepeatContext; /** diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/CommandLineJobRunnerTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/CommandLineJobRunnerTests.java index 63df8eb3c..21266f3ba 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/CommandLineJobRunnerTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/bootstrap/support/CommandLineJobRunnerTests.java @@ -20,8 +20,8 @@ import junit.framework.TestCase; import org.springframework.batch.core.domain.Job; import org.springframework.batch.core.domain.JobExecution; import org.springframework.batch.core.domain.JobParameters; -import org.springframework.batch.core.executor.ExitCodeExceptionClassifier; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; +import org.springframework.batch.core.runtime.ExitCodeExceptionClassifier; import org.springframework.batch.execution.launch.JobLauncher; import org.springframework.batch.repeat.ExitStatus; diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessorTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessorTests.java index 2c85b9cd1..12e1702dc 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessorTests.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.domain.DuplicateJobException; import org.springframework.batch.core.domain.Job; -import org.springframework.batch.core.domain.NoSuchJobException; +import org.springframework.batch.core.repository.DuplicateJobException; +import org.springframework.batch.core.repository.NoSuchJobException; import org.springframework.beans.FatalBeanException; import org.springframework.context.support.ClassPathXmlApplicationContext; diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/MapJobRegistryTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/MapJobRegistryTests.java index daffd8553..7332ccfc1 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/MapJobRegistryTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/configuration/MapJobRegistryTests.java @@ -19,9 +19,9 @@ import java.util.Collection; import junit.framework.TestCase; -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.core.repository.DuplicateJobException; +import org.springframework.batch.core.repository.NoSuchJobException; import org.springframework.batch.execution.configuration.MapJobRegistry; /** 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 284d14c9b..4761d25fa 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 @@ -28,11 +28,11 @@ import org.springframework.batch.core.domain.JobInstance; import org.springframework.batch.core.domain.JobParameters; import org.springframework.batch.core.domain.Step; import org.springframework.batch.core.domain.StepExecution; +import org.springframework.batch.core.domain.StepExecutor; import org.springframework.batch.core.domain.StepInstance; -import org.springframework.batch.core.executor.ExitCodeExceptionClassifier; -import org.springframework.batch.core.executor.StepExecutor; -import org.springframework.batch.core.executor.StepInterruptedException; +import org.springframework.batch.core.domain.StepInterruptedException; import org.springframework.batch.core.repository.JobRepository; +import org.springframework.batch.core.runtime.ExitCodeExceptionClassifier; import org.springframework.batch.core.tasklet.Tasklet; import org.springframework.batch.execution.repository.SimpleJobRepository; import org.springframework.batch.execution.repository.dao.JobDao; @@ -61,8 +61,7 @@ public class DefaultJobExecutorTests extends TestCase { private List list = new ArrayList(); StepExecutor defaultStepLifecycle = new StubStepExecutor() { - public ExitStatus process(Step configuration, - StepExecution stepExecution) throws StepInterruptedException, + public ExitStatus process(StepExecution stepExecution) throws StepInterruptedException, BatchCriticalException { list.add("default"); return ExitStatus.FINISHED; @@ -70,8 +69,7 @@ public class DefaultJobExecutorTests extends TestCase { }; StepExecutor configurationStepLifecycle = new StubStepExecutor() { - public ExitStatus process(Step configuration, - StepExecution stepExecution) throws StepInterruptedException, + public ExitStatus process(StepExecution stepExecution) throws StepInterruptedException, BatchCriticalException { list.add("special"); return ExitStatus.FINISHED; @@ -193,8 +191,7 @@ public class DefaultJobExecutorTests extends TestCase { final StepInterruptedException exception = new StepInterruptedException( "Interrupt!"); defaultStepLifecycle = new StubStepExecutor() { - public ExitStatus process(Step configuration, - StepExecution stepExecution) + public ExitStatus process(StepExecution stepExecution) throws StepInterruptedException, BatchCriticalException { throw exception; } @@ -214,8 +211,7 @@ public class DefaultJobExecutorTests extends TestCase { stepConfiguration2.setStartLimit(5); final RuntimeException exception = new RuntimeException("Foo!"); defaultStepLifecycle = new StubStepExecutor() { - public ExitStatus process(Step configuration, - StepExecution stepExecution) + public ExitStatus process(StepExecution stepExecution) throws StepInterruptedException, BatchCriticalException { throw exception; } @@ -289,8 +285,7 @@ public class DefaultJobExecutorTests extends TestCase { public void applyConfiguration(Step configuration) { } - public ExitStatus process(Step configuration, - StepExecution stepExecution) throws StepInterruptedException, + public ExitStatus process(StepExecution stepExecution) throws StepInterruptedException, BatchCriticalException { return null; } 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 3dde16e93..1fa0e0ae1 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 @@ -21,8 +21,8 @@ import junit.framework.TestCase; import org.easymock.MockControl; import org.springframework.batch.core.domain.Job; import org.springframework.batch.core.domain.JobExecution; +import org.springframework.batch.core.domain.JobExecutor; import org.springframework.batch.core.domain.JobParameters; -import org.springframework.batch.core.executor.JobExecutor; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.repeat.ExitStatus; 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 ef2dde300..6eb0b343c 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 @@ -35,7 +35,6 @@ import org.springframework.batch.execution.repository.dao.MapStepDao; import org.springframework.batch.execution.step.simple.AbstractStep; import org.springframework.batch.execution.step.simple.RepeatOperationsStep; import org.springframework.batch.execution.step.simple.SimpleStep; -import org.springframework.batch.execution.step.simple.SimpleStepExecutor; import org.springframework.batch.execution.tasklet.ItemOrientedTasklet; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemRecoverer; @@ -66,12 +65,9 @@ public class SimpleJobTests extends TestCase { private DefaultJobExecutor jobExecutor = new DefaultJobExecutor();; - private SimpleStepExecutor stepLifecycle = new SimpleStepExecutor(); - protected void setUp() throws Exception { super.setUp(); jobExecutor.setJobRepository(repository); - stepLifecycle.setRepository(repository); } private Tasklet getTasklet(String arg) throws Exception { diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java index d98f7b26f..ba6bc3ece 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java @@ -27,7 +27,7 @@ import org.springframework.batch.core.domain.JobInstance; import org.springframework.batch.core.domain.JobParameters; import org.springframework.batch.core.domain.StepExecution; import org.springframework.batch.core.domain.StepInstance; -import org.springframework.batch.core.executor.ExitCodeExceptionClassifier; +import org.springframework.batch.core.runtime.ExitCodeExceptionClassifier; import org.springframework.batch.repeat.ExitStatus; import org.springframework.batch.restart.GenericRestartData; import org.springframework.batch.restart.RestartData; diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/RepeatOperationsStepTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/RepeatOperationsStepTests.java index eb8fa03d2..ff886c992 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/RepeatOperationsStepTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/RepeatOperationsStepTests.java @@ -82,7 +82,7 @@ public class RepeatOperationsStepTests extends TestCase { new Long(11)), new JobExecution(new JobInstance(new Long(0L), new JobParameters()), new Long(12))); try { - executor.process(configuration, stepExecution); + executor.process(stepExecution); fail("Expected RuntimeException"); } catch (NullPointerException e) { // expected @@ -122,7 +122,7 @@ public class RepeatOperationsStepTests extends TestCase { StepExecution stepExecution = new StepExecution(new StepInstance( new Long(11)), new JobExecution(new JobInstance(new Long(0L), new JobParameters()), new Long(12))); - executor.process(configuration, stepExecution); + executor.process(stepExecution); assertEquals(2, list.size()); assertEquals(1, steps.size()); } diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleExitCodeExceptionClassifierTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleExitCodeExceptionClassifierTests.java index 061959802..084e334b3 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleExitCodeExceptionClassifierTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleExitCodeExceptionClassifierTests.java @@ -16,8 +16,8 @@ package org.springframework.batch.execution.step.simple; -import org.springframework.batch.core.executor.ExitCodeExceptionClassifier; -import org.springframework.batch.core.executor.StepInterruptedException; +import org.springframework.batch.core.domain.StepInterruptedException; +import org.springframework.batch.core.runtime.ExitCodeExceptionClassifier; import org.springframework.batch.repeat.ExitStatus; import junit.framework.TestCase; diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorTests.java index 8185ce562..0fedb566e 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepExecutorTests.java @@ -122,7 +122,7 @@ public class SimpleStepExecutorTests extends TestCase { StepExecution stepExecution = new StepExecution(step, jobExecutionContext); - stepExecutor.process(stepConfiguration, stepExecution); + stepExecutor.process(stepExecution); assertEquals(1, processed.size()); assertEquals(1, stepExecution.getTaskCount().intValue()); } @@ -169,7 +169,7 @@ public class SimpleStepExecutorTests extends TestCase { } }); - stepExecutor.process(stepConfiguration, stepExecution); + stepExecutor.process(stepExecution); assertEquals(1, processed.size()); } @@ -197,7 +197,7 @@ public class SimpleStepExecutorTests extends TestCase { } }); - stepExecutor.process(stepConfiguration, stepExecution); + stepExecutor.process(stepExecution); assertEquals(1, processed.size()); } @@ -212,7 +212,7 @@ public class SimpleStepExecutorTests extends TestCase { StepExecution stepExecution = new StepExecution(step, jobExecutionContext); - stepExecutor.process(stepConfiguration, stepExecution); + stepExecutor.process(stepExecution); assertEquals(1, processed.size()); } @@ -240,7 +240,7 @@ public class SimpleStepExecutorTests extends TestCase { jobExecutionContext); try { - stepExecutor.process(stepConfiguration, stepExecution); + stepExecutor.process(stepExecution); } catch (Exception ex) { assertEquals(stepExecution.getRollbackCount(), new Integer(1)); @@ -272,7 +272,7 @@ public class SimpleStepExecutorTests extends TestCase { jobExecutionContext); try { - stepExecutor.process(stepConfiguration, stepExecution); + stepExecutor.process(stepExecution); } catch (Exception ex) { ExitStatus status = stepExecution.getExitStatus(); @@ -294,7 +294,7 @@ public class SimpleStepExecutorTests extends TestCase { jobExecutionContext); try { - stepExecutor.process(stepConfiguration, stepExecution); + stepExecutor.process(stepExecution); } catch (Throwable t) { fail(); @@ -319,7 +319,7 @@ public class SimpleStepExecutorTests extends TestCase { jobExecutionContext); try { - stepExecutor.process(stepConfiguration, stepExecution); + stepExecutor.process(stepExecution); } catch (Throwable t) { fail(); @@ -344,7 +344,7 @@ public class SimpleStepExecutorTests extends TestCase { jobExecutionContext); try { - stepExecutor.process(stepConfiguration, stepExecution); + stepExecutor.process(stepExecution); } catch (Throwable t) { fail(); @@ -371,7 +371,7 @@ public class SimpleStepExecutorTests extends TestCase { StepExecution stepExecution = new StepExecution(step, jobExecution); try { - stepExecutor.process(stepConfiguration, stepExecution); + stepExecutor.process(stepExecution); } catch (Throwable t) { fail(); @@ -442,7 +442,7 @@ public class SimpleStepExecutorTests extends TestCase { }); try { - stepExecutor.process(stepConfiguration, stepExecution); + stepExecutor.process(stepExecution); } catch (Throwable t) { fail(); diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepTests.java index 1c9a0e391..1c6256526 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/SimpleStepTests.java @@ -60,7 +60,7 @@ public class SimpleStepTests extends TestCase { new Long(11)), new JobExecution(new JobInstance(new Long(0L), new JobParameters()), new Long(12))); try { - executor.process(configuration, stepExecution); + executor.process(stepExecution); fail("Expected RuntimeException"); } catch (NullPointerException e) { throw e; 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 010ade0e2..e920729f7 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 @@ -26,9 +26,9 @@ import org.springframework.batch.core.domain.JobExecution; import org.springframework.batch.core.domain.JobInstance; import org.springframework.batch.core.domain.JobParameters; import org.springframework.batch.core.domain.StepExecution; +import org.springframework.batch.core.domain.StepExecutor; import org.springframework.batch.core.domain.StepInstance; -import org.springframework.batch.core.executor.StepExecutor; -import org.springframework.batch.core.executor.StepInterruptedException; +import org.springframework.batch.core.domain.StepInterruptedException; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.tasklet.Tasklet; import org.springframework.batch.execution.repository.SimpleJobRepository; @@ -90,7 +90,7 @@ public class StepExecutorInterruptionTests extends TestCase { Thread processingThread = new Thread() { public void run() { try { - executor.process(stepConfiguration, stepExecution); + executor.process(stepExecution); } catch (StepInterruptedException e) { // do nothing... diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/ThreadStepInterruptionPolicyTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/ThreadStepInterruptionPolicyTests.java index 22e7f0629..640b2c443 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/ThreadStepInterruptionPolicyTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/step/simple/ThreadStepInterruptionPolicyTests.java @@ -17,7 +17,7 @@ package org.springframework.batch.execution.step.simple; import junit.framework.TestCase; -import org.springframework.batch.core.executor.StepInterruptedException; +import org.springframework.batch.core.domain.StepInterruptedException; import org.springframework.batch.repeat.RepeatContext; import org.springframework.batch.repeat.context.RepeatContextSupport; diff --git a/spring-batch-execution/src/test/resources/job-configuration.xml b/spring-batch-execution/src/test/resources/job-configuration.xml index b17d35400..85509f522 100644 --- a/spring-batch-execution/src/test/resources/job-configuration.xml +++ b/spring-batch-execution/src/test/resources/job-configuration.xml @@ -8,7 +8,7 @@ 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/simple-container-definition.xml b/spring-batch-execution/src/test/resources/simple-container-definition.xml index d8b07d59e..53cfd7fa3 100644 --- a/spring-batch-execution/src/test/resources/simple-container-definition.xml +++ b/spring-batch-execution/src/test/resources/simple-container-definition.xml @@ -15,7 +15,7 @@ - - - - - - + + - + - - - - - - - - - + + class="org.springframework.batch.repeat.support.RepeatTemplate"> + + + + + + + + + + + + + + @@ -108,7 +115,7 @@ - + diff --git a/spring-batch-samples/src/main/resources/simple-container-definition.xml b/spring-batch-samples/src/main/resources/simple-container-definition.xml index 47393bc57..8da03e088 100644 --- a/spring-batch-samples/src/main/resources/simple-container-definition.xml +++ b/spring-batch-samples/src/main/resources/simple-container-definition.xml @@ -1,9 +1,9 @@ - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + class="org.springframework.batch.execution.repository.dao.MapJobDao" /> + class="org.springframework.batch.execution.repository.dao.MapStepDao" /> - - - - - - - - - - + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/DefaultJobLoader.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/DefaultJobLoader.java index d43997974..4c5f27a3c 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/DefaultJobLoader.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/DefaultJobLoader.java @@ -8,8 +8,8 @@ import java.util.Iterator; import java.util.Map; import org.springframework.batch.core.domain.Job; -import org.springframework.batch.core.domain.ListableJobRegistry; -import org.springframework.batch.core.domain.NoSuchJobException; +import org.springframework.batch.core.repository.ListableJobRegistry; +import org.springframework.batch.core.repository.NoSuchJobException; import org.springframework.beans.BeanWrapperImpl; import org.springframework.beans.BeansException; import org.springframework.beans.PropertyAccessorUtils;