Package org.springframework.batch.core

Examples of org.springframework.batch.core.Step.execute()


    try {
      if(log.isDebugEnabled()) {
        log.debug("Executing step: " + step + " / " + stepExecution);
      }
      step.execute(stepExecution);
    } catch (JobInterruptedException e) {
      log.error("error executing step 1", e);
      stepExecution.setStatus(BatchStatus.STOPPED);
    } catch (Throwable e) {
      log.error("error executing step 2", e);
View Full Code Here


    @Test
    public void testExecute() throws JobInterruptedException {
        Step step = createTestStep("testExecute");
        JobExecution jobData = TestDummyJobRepository.createJobExecutionInstance(step.getName());
        StepExecution stepData = new StepExecution(step.getName(), jobData);
        step.execute(stepData);
        assertOperationDetails(getLastEntered(), "execute", step.getName());
    }

    @Override
    public StepOperationCollectionAspect getAspect() {
View Full Code Here

    if (step == null) {
      throw new NoSuchStepException(String.format("No Step with name [%s] could be located.", stepName));
    }

    try {
      step.execute(stepExecution);
    }
    catch (JobInterruptedException e) {
      stepExecution.setStatus(BatchStatus.STOPPED);
      // The receiver should update the stepExecution in repository
    }
View Full Code Here

        .commaDelimitedListToStringArray("1,2,3,4,5,6"))));

    Step step = (Step) factory.getObject();

    StepExecution stepExecution = getStepExecution(step);
    step.execute(stepExecution);

    waitForResults(6, 10);

    assertEquals(6, TestItemWriter.count);
    assertEquals(6, stepExecution.getReadCount());
View Full Code Here

    stepExecution.getExecutionContext().putInt(ChunkMessageChannelItemWriter.EXPECTED, 6);
    stepExecution.getExecutionContext().putInt(ChunkMessageChannelItemWriter.ACTUAL, 4);
    // And make the back log real
    requests.send(getSimpleMessage("foo", stepExecution.getJobExecution().getJobId()));
    requests.send(getSimpleMessage("bar", stepExecution.getJobExecution().getJobId()));
    step.execute(stepExecution);

    waitForResults(8, 10);

    assertEquals(8, TestItemWriter.count);
    assertEquals(6, stepExecution.getReadCount());
View Full Code Here

    // Speed up the eventual failure
    writer.setMaxWaitTimeouts(2);

    // And make the back log real
    requests.send(getSimpleMessage("foo", 4321L));
    step.execute(stepExecution);
    assertEquals(BatchStatus.FAILED, stepExecution.getStatus());
    assertEquals(ExitStatus.FAILED.getExitCode(), stepExecution.getExitStatus().getExitCode());
    String message = stepExecution.getExitStatus().getExitDescription();
    assertTrue("Message does not contain 'wrong job': " + message, message.contains("wrong job"));
View Full Code Here

    factory.setCommitInterval(2);

    Step step = (Step) factory.getObject();

    StepExecution stepExecution = getStepExecution(step);
    step.execute(stepExecution);
    assertEquals(BatchStatus.FAILED, stepExecution.getStatus());
    assertEquals(ExitStatus.FAILED.getExitCode(), stepExecution.getExitStatus().getExitCode());
    String message = stepExecution.getExitStatus().getExitDescription();
    assertTrue("Message does not contain 'fail': " + message, message.contains("fail"));
View Full Code Here

    /*
     * With no backlog we process all the items, but the listener can't
     * reconcile the expected number of items with the actual. An infinite
     * loop would be bad, so the best we can do is fail as fast as possible.
     */
    step.execute(stepExecution);
    assertEquals(BatchStatus.FAILED, stepExecution.getStatus());
    assertEquals(ExitStatus.FAILED.getExitCode(), stepExecution.getExitStatus().getExitCode());
    String message = stepExecution.getExitStatus().getExitDescription();
    assertTrue("Message did not contain 'timed out': " + message, message.toLowerCase().contains("timed out"));

View Full Code Here

        .commaDelimitedListToStringArray("wait,fail,3,4,5,6"))));

    Step step = (Step) factory.getObject();

    StepExecution stepExecution = getStepExecution(step);
    step.execute(stepExecution);

    waitForResults(2, 10);

    // The number of items processed is actually between 1 and 6, because
    // the one that failed might have been processed out of order.
View Full Code Here

        .commaDelimitedListToStringArray("1,2,3,4,5,6"))));

    Step step = factory.getObject();

    StepExecution stepExecution = getStepExecution(step);
    step.execute(stepExecution);

    waitForResults(6, 10);

    assertEquals(6, TestItemWriter.count);
    assertEquals(6, stepExecution.getReadCount());
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.