Examples of StepState


Examples of org.springframework.batch.core.job.flow.support.state.StepState

  @Test
  public void testInterrupted() throws Exception {
    SimpleFlow flow = new SimpleFlow("job");
    List<StateTransition> transitions = new ArrayList<StateTransition>();
    transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
      @Override
      public void execute(StepExecution stepExecution) throws JobInterruptedException {
        stepExecution.setStatus(BatchStatus.STOPPING);
        jobRepository.update(stepExecution);
      }
View Full Code Here

Examples of org.springframework.batch.core.job.flow.support.state.StepState

  @Test
  public void testUnknownStatusStopsJob() throws Exception {
    SimpleFlow flow = new SimpleFlow("job");
    List<StateTransition> transitions = new ArrayList<StateTransition>();
    transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
      @Override
      public void execute(StepExecution stepExecution) throws JobInterruptedException {
        stepExecution.setStatus(BatchStatus.UNKNOWN);
        stepExecution.setTerminateOnly();
        jobRepository.update(stepExecution);
      }
    }), "step2"));
    transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step2")), "end0"));
    transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
    flow.setStateTransitions(transitions);
    flow.afterPropertiesSet();
    job.setFlow(flow);
    job.afterPropertiesSet();
View Full Code Here

Examples of org.springframework.batch.core.job.flow.support.state.StepState

    SimpleFlow flow = new SimpleFlow("job");
    SimpleFlow flow1 = new SimpleFlow("flow1");
    SimpleFlow flow2 = new SimpleFlow("flow2");

    List<StateTransition> transitions = new ArrayList<StateTransition>();
    transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
      @Override
      public void execute(StepExecution stepExecution) throws JobInterruptedException {
        if (!stepExecution.getJobExecution().getExecutionContext().containsKey("STOPPED")) {
          stepExecution.getJobExecution().getExecutionContext().put("STOPPED", true);
          stepExecution.setStatus(BatchStatus.STOPPED);
View Full Code Here

Examples of org.springframework.batch.core.job.flow.support.state.StepState

  @Test
  public void testInterruptedException() throws Exception {
    SimpleFlow flow = new SimpleFlow("job");
    List<StateTransition> transitions = new ArrayList<StateTransition>();
    transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
      @Override
      public void execute(StepExecution stepExecution) throws JobInterruptedException {
        throw new JobInterruptedException("Stopped");
      }
    }), "end0"));
View Full Code Here

Examples of org.springframework.batch.core.job.flow.support.state.StepState

    SimpleFlow flow = new SimpleFlow("job");
    SimpleFlow flow1 = new SimpleFlow("flow1");
    SimpleFlow flow2 = new SimpleFlow("flow2");

    List<StateTransition> transitions = new ArrayList<StateTransition>();
    transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1") {
      @Override
      public void execute(StepExecution stepExecution) throws JobInterruptedException {
        throw new JobInterruptedException("Stopped");
      }
    }), "end0"));
View Full Code Here

Examples of org.springframework.batch.core.job.flow.support.state.StepState

  @Test
  public void testEndStateStopped() throws Exception {
    SimpleFlow flow = new SimpleFlow("job");
    List<StateTransition> transitions = new ArrayList<StateTransition>();
    transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step1")), "end"));
    transitions.add(StateTransition
        .createStateTransition(new EndState(FlowExecutionStatus.STOPPED, "end"), "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")));
    transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end1")));
    flow.setStateTransitions(transitions);
View Full Code Here

Examples of org.springframework.batch.core.job.flow.support.state.StepState

  }

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

Examples of org.springframework.batch.core.job.flow.support.state.StepState

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

Examples of org.springframework.batch.core.job.flow.support.state.StepState

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

Examples of org.springframework.batch.core.job.flow.support.state.StepState

  @Test
  public void testBasicFlow() throws Throwable {
    SimpleFlow flow = new SimpleFlow("job");
    List<StateTransition> transitions = new ArrayList<StateTransition>();
    transitions.add(StateTransition.createStateTransition(new StepState(new StubStep("step")), "end0"));
    transitions.add(StateTransition.createEndStateTransition(new EndState(FlowExecutionStatus.COMPLETED, "end0")));
    flow.setStateTransitions(transitions);
    job.setFlow(flow);
    job.execute(jobExecution);
    if (!jobExecution.getAllFailureExceptions().isEmpty()) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.