Package org.springframework.batch.core.job.flow

Examples of org.springframework.batch.core.job.flow.StateSupport


  @Test
  public void testFailedStep() throws Exception {
    SimpleFlow flow = new JsrFlow("job");
    List<StateTransition> transitions = new ArrayList<StateTransition>();
    transitions.add(StateTransition.createStateTransition(new StateSupport("step1", FlowExecutionStatus.FAILED),
        "step2"));
    StepState step2 = new StepState(new StubStep("step2"));
    transitions.add(StateTransition.createStateTransition(step2, ExitStatus.FAILED.getExitCode(), "end0"));
    transitions.add(StateTransition.createStateTransition(step2, ExitStatus.COMPLETED.getExitCode(), "end1"));
    transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.FAILED, "end0")));
View Full Code Here


  @Test
  public void testFailedStepRestarted() throws Exception {
    SimpleFlow flow = new JsrFlow("job");
    List<StateTransition> transitions = new ArrayList<StateTransition>();
    transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
    State step2State = new StateSupport("step2") {
      @Override
      public FlowExecutionStatus handle(FlowExecutor executor) throws Exception {
        JobExecution jobExecution = executor.getJobExecution();
        StepExecution stepExecution = jobExecution.createStepExecution(getName());
        jobRepository.add(stepExecution);
View Full Code Here

  @Test
  public void testStoppingStep() throws Exception {
    SimpleFlow flow = new JsrFlow("job");
    List<StateTransition> transitions = new ArrayList<StateTransition>();
    transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "step2"));
    State state2 = new StateSupport("step2", FlowExecutionStatus.FAILED);
    transitions.add(StateTransition.createStateTransition(state2, ExitStatus.FAILED.getExitCode(), "end0"));
    transitions.add(StateTransition.createStateTransition(state2, ExitStatus.COMPLETED.getExitCode(), "end1"));
    transitions.add(StateTransition.createStateTransition(new EndState(FlowExecutionStatus.STOPPED, "end0"),
        "step3"));
    transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end1")));
View Full Code Here

    StepExecution stepExecution = new StepExecution("step1", new JobExecution(5L));
    stepExecution.setExitStatus(new ExitStatus("unmapped exit code"));
    stepExecution.setStatus(BatchStatus.FAILED);
    executor = new FlowExecutor(stepExecution);

    State startState = new StateSupport("step1", new FlowExecutionStatus("unmapped exit code"));
    State endState = new StateSupport("failed", FlowExecutionStatus.FAILED);

    StateTransition failureTransition = StateTransition.createStateTransition(startState, "FAILED", "failed");
    StateTransition endTransition = StateTransition.createEndStateTransition(endState);
    flow.setStateTransitions(collect(failureTransition, endTransition));
    flow.afterPropertiesSet();
View Full Code Here

    flow.afterPropertiesSet();
  }

  @Test(expected = IllegalArgumentException.class)
  public void testNoNextStepSpecified() throws Exception {
    flow.setStateTransitions(Collections.singletonList(StateTransition.createStateTransition(new StateSupport(
        "step"), "foo")));
    flow.afterPropertiesSet();
  }
View Full Code Here

    flow.afterPropertiesSet();
  }

  @Test
  public void testStepLoop() throws Exception {
    flow.setStateTransitions(collect(StateTransition.createStateTransition(new StateSupport("step"),
        ExitStatus.FAILED.getExitCode(), "step"), StateTransition.createEndStateTransition(new StateSupport("step"))));
    flow.afterPropertiesSet();
    FlowExecution execution = flow.start(executor);
    assertEquals(FlowExecutionStatus.COMPLETED, execution.getStatus());
    assertEquals("step", execution.getName());
  }
View Full Code Here

    assertEquals("step", execution.getName());
  }

  @Test(expected = IllegalArgumentException.class)
  public void testNoEndStep() throws Exception {
    flow.setStateTransitions(Collections.singletonList(StateTransition.createStateTransition(new StateSupport(
        "step"), ExitStatus.FAILED.getExitCode(), "step")));
    flow.afterPropertiesSet();
  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.job.flow.StateSupport

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.