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

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


        logger.debug("Handling state="+stateName);
        status = state.handle(executor);
        stepExecution = executor.getStepExecution();
      }
      catch (FlowExecutionException e) {
        executor.close(new FlowExecution(stateName, status));
        throw e;
      }
      catch (Exception e) {
        executor.close(new FlowExecution(stateName, status));
        throw new FlowExecutionException(String.format("Ended flow=%s at state=%s with exception", name,
                                    stateName), e);
      }

      logger.debug("Completed state="+stateName+" with status="+status);

      state = nextState(stateName, status, stepExecution);
    }

    FlowExecution result = new FlowExecution(stateName, status);
    executor.close(result);
    return result;

  }
View Full Code Here


    StateTransition failureTransition = StateTransition.createStateTransition(startState, "FAILED", "failed");
    StateTransition endTransition = StateTransition.createEndStateTransition(endState);
    flow.setStateTransitions(collect(failureTransition, endTransition));
    flow.afterPropertiesSet();
    FlowExecution execution = flow.start(executor);
    assertEquals(FlowExecutionStatus.FAILED, execution.getStatus());
    assertEquals("failed", execution.getName());
  }
View Full Code Here

  @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

  @Test
  public void testUnconnectedSteps() throws Exception {
    flow.setStateTransitions(collect(StateTransition.createEndStateTransition(new StubState("step1")),
        StateTransition.createEndStateTransition(new StubState("step2"))));
    flow.afterPropertiesSet();
    FlowExecution execution = flow.start(executor);
    assertEquals(FlowExecutionStatus.COMPLETED, execution.getStatus());
    assertEquals("step1", execution.getName());
  }
View Full Code Here

  @Test
  public void testOneStep() throws Exception {
    flow.setStateTransitions(Collections.singletonList(StateTransition.createEndStateTransition(new StubState(
        "step1"))));
    flow.afterPropertiesSet();
    FlowExecution execution = flow.start(executor);
    assertEquals(FlowExecutionStatus.COMPLETED, execution.getStatus());
    assertEquals("step1", execution.getName());
  }
View Full Code Here

      @Override
      public void close(FlowExecution result) {
        list.add(result);
      }
    };
    FlowExecution execution = flow.start(executor);
    assertEquals(1, list.size());
    assertEquals(FlowExecutionStatus.COMPLETED, execution.getStatus());
    assertEquals("step1", execution.getName());
  }
View Full Code Here

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

  @Test
  public void testTwoSteps() throws Exception {
    flow.setStateTransitions(collect(StateTransition.createStateTransition(new StubState("step1"), "step2"),
        StateTransition.createEndStateTransition(new StubState("step2"))));
    flow.afterPropertiesSet();
    FlowExecution execution = flow.start(executor);
    assertEquals(FlowExecutionStatus.COMPLETED, execution.getStatus());
    assertEquals("step2", execution.getName());
  }
View Full Code Here

  @Test
  public void testResume() throws Exception {
    flow.setStateTransitions(collect(StateTransition.createStateTransition(new StubState("step1"), "step2"),
        StateTransition.createEndStateTransition(new StubState("step2"))));
    flow.afterPropertiesSet();
    FlowExecution execution = flow.resume("step2", executor);
    assertEquals(FlowExecutionStatus.COMPLETED, execution.getStatus());
    assertEquals("step2", execution.getName());
  }
View Full Code Here

      public FlowExecutionStatus handle(FlowExecutor executor) {
        return FlowExecutionStatus.FAILED;
      }
    }, "step2"), StateTransition.createEndStateTransition(new StubState("step2"))));
    flow.afterPropertiesSet();
    FlowExecution execution = flow.start(executor);
    assertEquals(FlowExecutionStatus.COMPLETED, execution.getStatus());
    assertEquals("step2", execution.getName());
  }
View Full Code Here

TOP

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

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.