OPEN - issue BATCH-679: Non-sequential execution - add state subpackage

This commit is contained in:
dsyer
2008-10-30 11:33:05 +00:00
parent 09be3f0b0d
commit dade6952c8
28 changed files with 77 additions and 70 deletions

View File

@@ -26,7 +26,7 @@ import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.job.flow.support.JobExecutionDecider;
import org.springframework.batch.core.job.flow.support.state.JobExecutionDecider;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
import org.springframework.beans.factory.annotation.Autowired;

View File

@@ -26,7 +26,7 @@ import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.job.flow.support.JobExecutionDecider;
import org.springframework.batch.core.job.flow.support.state.JobExecutionDecider;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
import org.springframework.beans.factory.annotation.Autowired;

View File

@@ -32,13 +32,13 @@ import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.UnexpectedJobExecutionException;
import org.springframework.batch.core.job.flow.support.DecisionState;
import org.springframework.batch.core.job.flow.support.EndState;
import org.springframework.batch.core.job.flow.support.JobExecutionDecider;
import org.springframework.batch.core.job.flow.support.PauseState;
import org.springframework.batch.core.job.flow.support.SimpleFlow;
import org.springframework.batch.core.job.flow.support.StateTransition;
import org.springframework.batch.core.job.flow.support.StepState;
import org.springframework.batch.core.job.flow.support.state.DecisionState;
import org.springframework.batch.core.job.flow.support.state.EndState;
import org.springframework.batch.core.job.flow.support.state.JobExecutionDecider;
import org.springframework.batch.core.job.flow.support.state.PauseState;
import org.springframework.batch.core.job.flow.support.state.StepState;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean;
import org.springframework.batch.core.step.StepSupport;

View File

@@ -21,14 +21,14 @@ import org.springframework.batch.core.StartLimitExceededException;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.job.flow.FlowExecution;
import org.springframework.batch.core.job.flow.JobFlowExecutor;
import org.springframework.batch.core.job.flow.FlowExecutor;
import org.springframework.batch.core.repository.JobRestartException;
/**
* @author Dave Syer
*
*/
public class JobFlowExecutorSupport implements JobFlowExecutor {
public class JobFlowExecutorSupport implements FlowExecutor {
public String executeStep(Step step) throws JobInterruptedException, JobRestartException,
StartLimitExceededException {

View File

@@ -27,7 +27,7 @@ import java.util.List;
import org.junit.Test;
import org.springframework.batch.core.job.flow.FlowExecution;
import org.springframework.batch.core.job.flow.FlowExecutionException;
import org.springframework.batch.core.job.flow.JobFlowExecutor;
import org.springframework.batch.core.job.flow.FlowExecutor;
import org.springframework.batch.core.job.flow.support.SimpleFlow;
import org.springframework.batch.core.job.flow.support.StateTransition;
@@ -35,11 +35,11 @@ import org.springframework.batch.core.job.flow.support.StateTransition;
* @author Dave Syer
*
*/
public class BasicFlowTests {
public class SimpleFlowTests {
private SimpleFlow flow = new SimpleFlow("job");
private JobFlowExecutor executor = new JobFlowExecutorSupport();
private FlowExecutor executor = new JobFlowExecutorSupport();
@Test(expected = IllegalArgumentException.class)
public void testEmptySteps() throws Exception {
@@ -156,7 +156,7 @@ public class BasicFlowTests {
public void testFailedStep() throws Exception {
flow.setStateTransitions(collect(StateTransition.createStateTransition(new StubState("step1") {
@Override
public String handle(JobFlowExecutor executor) {
public String handle(FlowExecutor executor) {
return FlowExecution.FAILED;
}
}, "step2"), StateTransition.createEndStateTransition(new StubState("step2"))));
@@ -185,7 +185,7 @@ public class BasicFlowTests {
private boolean paused = false;
@Override
public String handle(JobFlowExecutor executor) throws Exception {
public String handle(FlowExecutor executor) throws Exception {
if (!paused) {
paused = true;
return FlowExecution.PAUSED;

View File

@@ -16,9 +16,9 @@
package org.springframework.batch.core.job.flow.support;
import org.springframework.batch.core.job.flow.FlowExecution;
import org.springframework.batch.core.job.flow.JobFlowExecutor;
import org.springframework.batch.core.job.flow.support.AbstractState;
import org.springframework.batch.core.job.flow.FlowExecutor;
import org.springframework.batch.core.job.flow.support.State;
import org.springframework.batch.core.job.flow.support.state.AbstractState;
/**
* Base class for {@link State} implementations.
@@ -36,7 +36,7 @@ public class StateSupport extends AbstractState {
}
@Override
public String handle(JobFlowExecutor executor) throws Exception {
public String handle(FlowExecutor executor) throws Exception {
return FlowExecution.COMPLETED;
}

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.job.flow.support;
package org.springframework.batch.core.job.flow.support.state;
import static org.junit.Assert.assertEquals;
@@ -21,7 +21,9 @@ import org.junit.Before;
import org.junit.Test;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.job.flow.JobFlowExecutor;
import org.springframework.batch.core.job.flow.FlowExecutor;
import org.springframework.batch.core.job.flow.support.JobFlowExecutorSupport;
import org.springframework.batch.core.job.flow.support.state.EndState;
/**
* @author Dave Syer
@@ -37,7 +39,7 @@ public class EndStateTests {
}
/**
* Test method for {@link EndState#handle(JobFlowExecutor)}.
* Test method for {@link EndState#handle(FlowExecutor)}.
* @throws Exception
*/
@Test
@@ -58,7 +60,7 @@ public class EndStateTests {
}
/**
* Test method for {@link EndState#handle(JobFlowExecutor)}.
* Test method for {@link EndState#handle(FlowExecutor)}.
* @throws Exception
*/
@Test
@@ -79,7 +81,7 @@ public class EndStateTests {
}
/**
* Test method for {@link EndState#handle(JobFlowExecutor)}.
* Test method for {@link EndState#handle(FlowExecutor)}.
* @throws Exception
*/
@Test

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.job.flow.support;
package org.springframework.batch.core.job.flow.support.state;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
@@ -23,7 +23,7 @@ import java.util.Collections;
import org.junit.Test;
import org.springframework.batch.core.job.flow.FlowExecution;
import org.springframework.batch.core.job.flow.support.MaxValueFlowExecutionAggregator;
import org.springframework.batch.core.job.flow.support.state.MaxValueFlowExecutionAggregator;
/**
* @author Dave Syer

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.job.flow.support;
package org.springframework.batch.core.job.flow.support.state;
import static org.junit.Assert.assertEquals;
@@ -24,7 +24,7 @@ import org.easymock.EasyMock;
import org.junit.Test;
import org.springframework.batch.core.job.flow.Flow;
import org.springframework.batch.core.job.flow.FlowExecution;
import org.springframework.batch.core.job.flow.support.SplitState;
import org.springframework.batch.core.job.flow.support.state.SplitState;
import org.springframework.core.task.SimpleAsyncTaskExecutor;