Tabnine Logo
org.springframework.batch.core.job.flow.support
Code IndexAdd Tabnine to your IDE (free)

How to use org.springframework.batch.core.job.flow.support

Best Java code snippets using org.springframework.batch.core.job.flow.support (Showing top 20 results out of 315)

origin: spring-projects/spring-batch

/**
 * Locate start state and pre-populate data structures needed for execution.
 *
 * @see InitializingBean#afterPropertiesSet()
 */
@Override
public void afterPropertiesSet() throws Exception {
  if (startState == null) {
    initializeTransitions();
  }
}
origin: spring-projects/spring-batch

/**
 * Create a new end state {@link StateTransition} specification. This
 * transition explicitly goes unconditionally to an end state (i.e. no more
 * executions).
 *
 * @param state the {@link State} used to generate the outcome for this
 * transition
 * @return {@link StateTransition} that was created.
 */
public static StateTransition createEndStateTransition(State state) {
  return createStateTransition(state, null, null);
}
origin: spring-projects/spring-batch

/**
 * @see Flow#start(FlowExecutor)
 */
@Override
public FlowExecution start(FlowExecutor executor) throws FlowExecutionException {
  if (startState == null) {
    initializeTransitions();
  }
  State state = startState;
  String stateName = state.getName();
  return resume(stateName, executor);
}
origin: spring-projects/spring-batch

@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());
}
origin: spring-projects/spring-batch

@Test
public void testBranching() throws Exception {
  flow.setStateTransitions(collect(StateTransition.createStateTransition(new StubState("step1"), "step2"),
      StateTransition.createStateTransition(new StubState("step1"), ExitStatus.COMPLETED.getExitCode(), "step3"),
      StateTransition.createEndStateTransition(new StubState("step2")), StateTransition
      .createEndStateTransition(new StubState("step3"))));
  flow.setStateTransitionComparator(new DefaultStateTransitionComparator());
  flow.afterPropertiesSet();
  FlowExecution execution = flow.start(executor);
  assertEquals(FlowExecutionStatus.COMPLETED, execution.getStatus());
  assertEquals("step3", execution.getName());
}
origin: spring-projects/spring-batch

@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());
}
origin: spring-projects/spring-batch

@Test
public void testGetStateDoesNotExist() throws Exception {
  flow.setStateTransitions(Collections.singletonList(StateTransition.createEndStateTransition(new StubState(
      "step1"))));
  flow.afterPropertiesSet();
  State state = flow.getState("bar");
  assertNull(state);
}
origin: spring-projects/spring-batch

@Test(expected = IllegalArgumentException.class)
public void testNoNextStepSpecified() throws Exception {
  flow.setStateTransitions(Collections.singletonList(StateTransition.createStateTransition(new StateSupport(
      "step"), "foo")));
  flow.afterPropertiesSet();
}
origin: spring-projects/spring-batch

@Override
protected boolean isFlowContinued(State state, FlowExecutionStatus status, StepExecution stepExecution) {
  if(state instanceof DelegateState) {
    state = ((DelegateState) state).getState();
  }
  if(state instanceof JsrStepState) {
    currentStep = (JsrStepState) state;
  }
  return super.isFlowContinued(state, status, stepExecution);
}
origin: spring-projects/spring-batch

@Before
public void setUp() throws Exception {
  comparator = new DefaultStateTransitionComparator();
}
origin: spring-projects/spring-batch

@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());
}
origin: spring-projects/spring-batch

@Test
public void testGetStateExists() throws Exception {
  flow.setStateTransitions(Collections.singletonList(StateTransition.createEndStateTransition(new StubState(
      "step1"))));
  flow.afterPropertiesSet();
  State state = flow.getState("step1");
  assertNotNull(state);
  assertEquals("step1", state.getName());
}
origin: spring-projects/spring-batch

/**
 * Create a new state {@link StateTransition} specification with a wildcard
 * pattern that matches all outcomes.
 *
 * @param state the {@link State} used to generate the outcome for this
 * transition
 * @param next the name of the next {@link State} to execute
 * @return {@link StateTransition} that was created.
 */
public static StateTransition createStateTransition(State state, String next) {
  return createStateTransition(state, null, next);
}
origin: spring-projects/spring-batch

@Test
public void testFailedStep() throws Exception {
  flow.setStateTransitions(collect(StateTransition.createStateTransition(new StubState("step1") {
    @Override
    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());
}
origin: spring-projects/spring-batch

/**
 * Convenience method to switch the origin and destination of a transition,
 * creating a new instance.
 *
 * @param stateTransition an existing state transition
 * @param state the new state for the origin
 * @param next the new name for the destination
 *
 * @return {@link StateTransition} that was created.
 */
public static StateTransition switchOriginAndDestination(StateTransition stateTransition, State state, String next) {
  return createStateTransition(state, stateTransition.pattern, next);
}
origin: spring-projects/spring-batch

@Test
public void testNoMatchForNextStep() throws Exception {
  flow.setStateTransitions(collect(StateTransition.createStateTransition(new StubState("step1"), "FOO", "step2"),
      StateTransition.createEndStateTransition(new StubState("step2"))));
  flow.afterPropertiesSet();
  try {
    flow.start(executor);
    fail("Expected JobExecutionException");
  }
  catch (FlowExecutionException e) {
    // expected
    String message = e.getMessage();
    assertTrue("Wrong message: " + message, message.toLowerCase().contains("next state not found"));
  }
}
origin: spring-projects/spring-batch

/**
 * Create a new end state {@link StateTransition} specification. This
 * transition explicitly goes to an end state (i.e. no more processing) if
 * the outcome matches the pattern.
 *
 * @param state the {@link State} used to generate the outcome for this
 * transition
 * @param pattern the pattern to match in the exit status of the
 * {@link State}
 * @return {@link StateTransition} that was created.
 */
public static StateTransition createEndStateTransition(State state, String pattern) {
  return createStateTransition(state, pattern, null);
}
origin: spring-projects/spring-batch

@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());
}
origin: spring-projects/spring-batch

@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());
}
origin: spring-projects/spring-batch

@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());
}
org.springframework.batch.core.job.flow.support

Most used classes

  • SimpleFlow
    A Flow that branches conditionally depending on the exit status of the last State. The input paramet
  • StateTransition
    Value object representing a potential transition from one State to another. The originating State na
  • StepState
    State implementation that delegates to a FlowExecutor to execute the specified Step.
  • AbstractState
  • DecisionState
    State that requires a decider to make the status decision.
  • FlowExecutionAggregator,
  • FlowState,
  • SplitState,
  • DefaultStateTransitionComparator,
  • JobFlowExecutorSupport,
  • SimpleFlowTests$StubState,
  • SimpleFlowTests,
  • MaxValueFlowExecutionAggregator
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now