Package org.springframework.batch.core

Examples of org.springframework.batch.core.Step


    assertTrue(listener.isExecuted());
  }

  private TestTasklet assertTasklet(Job job, String stepName, String taskletName) {
    System.err.println(((FlowJob) job).getStepNames());
    Step step = ((FlowJob) job).getStep(stepName);
    assertTrue("Wrong type for step name="+stepName+": "+step, step instanceof TaskletStep);
    Object tasklet = ReflectionTestUtils.getField(step, "tasklet");
    assertTrue(tasklet instanceof TestTasklet);
    TestTasklet testTasklet = (TestTasklet) tasklet;
    assertEquals(taskletName, testTasklet.getName());
View Full Code Here


  private State createState(Object input) {
    State result;
    if (input instanceof Step) {
      if (!states.containsKey(input)) {
        Step step = (Step) input;
        states.put(input, new StepState(prefix + step.getName(), step));
      }
      result = states.get(input);
    }
    else if (input instanceof JobExecutionDecider) {
      if (!states.containsKey(input)) {
View Full Code Here

*/
public class StepLocatorStepFactoryBeanTests {

  @Test
  public void testFoo() throws Exception {
    Step testStep1 = buildTestStep("foo");
    Step testStep2 = buildTestStep("bar");
    Step testStep3 = buildTestStep("baz");

    SimpleJob simpleJob = new SimpleJob();   // is a StepLocator
    simpleJob.addStep(testStep1);
    simpleJob.addStep(testStep2);
    simpleJob.addStep(testStep3);
View Full Code Here

    stepLocatorStepFactoryBean.setStepName("bar");
    assertEquals(testStep2, stepLocatorStepFactoryBean.getObject());
  }

  private Step buildTestStep(final String stepName) {
    return new Step() {
      @Override
      public String getName() {
        return stepName;
      }
View Full Code Here

        //get the current stepExecution
        for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
          if (stepExecution.getStatus().isRunning()) {
            try {
              //have the step execution that's running -> need to 'stop' it
              Step step = ((StepLocator)job).getStep(stepExecution.getStepName());
              if (step instanceof TaskletStep) {
                Tasklet tasklet = ((TaskletStep)step).getTasklet();
                if (tasklet instanceof StoppableTasklet) {
                  StepSynchronizationManager.register(stepExecution);
                  ((StoppableTasklet)tasklet).stop();
View Full Code Here

        //get the current stepExecution
        for (org.springframework.batch.core.StepExecution stepExecution : jobExecution.getStepExecutions()) {
          if (stepExecution.getStatus().isRunning()) {
            try {
              //have the step execution that's running -> need to 'stop' it
              Step step = ((StepLocator)job).getStep(stepExecution.getStepName());
              if (step instanceof TaskletStep) {
                Tasklet tasklet = ((TaskletStep)step).getTasklet();
                if (tasklet instanceof StoppableTasklet) {
                  StepSynchronizationManager.register(stepExecution);
                  ((StoppableTasklet)tasklet).stop();
View Full Code Here

  @Test
  public void testExitStatusReturned() throws JobExecutionException {

    final ExitStatus customStatus = new ExitStatus("test");

    Step testStep = new Step() {

      @Override
      public void execute(StepExecution stepExecution) throws JobInterruptedException {
        stepExecution.setExitStatus(customStatus);
      }
View Full Code Here

  @Test
  public void testGetStepExists() {
    step1 = new StubStep("step1", jobRepository);
    step2 = new StubStep("step2", jobRepository);
    job.setSteps(Arrays.asList(new Step[] { step1, step2 }));
    Step step = job.getStep("step2");
    assertNotNull(step);
    assertEquals("step2", step.getName());
  }
View Full Code Here

  @Test
  public void testGetStepNotExists() {
    step1 = new StubStep("step1", jobRepository);
    step2 = new StubStep("step2", jobRepository);
    job.setSteps(Arrays.asList(new Step[] { step1, step2 }));
    Step step = job.getStep("foo");
    assertNull(step);
  }
View Full Code Here

    flow.setStateTransitions(transitions);
    flow.afterPropertiesSet();
    job.setFlow(flow);
    job.afterPropertiesSet();

    Step step = job.getStep("step2");
    assertNotNull(step);
    assertEquals("step2", step.getName());
  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.Step

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.