Package org.springframework.batch.core

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


    writer.setFailures("2");

    Step step = factory.getObject();

    step.execute(stepExecution);

    assertEquals(BatchStatus.FAILED, stepExecution.getStatus());
    assertEquals(0, stepExecution.getWriteSkipCount());
    assertEquals(2, stepExecution.getReadCount());
View Full Code Here


    map.put(ItemStreamException.class, true);
    factory.setSkippableExceptionClasses(map);

    Step step = factory.getObject();

    step.execute(stepExecution);

    assertEquals(1, stepExecution.getSkipCount());
    assertEquals(1, stepExecution.getReadSkipCount());
    assertEquals(4, stepExecution.getReadCount());
    assertEquals(0, stepExecution.getWriteSkipCount());
View Full Code Here

    processor.setFailures("4");
    writer.setFailures("4");

    Step step = factory.getObject();

    step.execute(stepExecution);

    assertEquals(1, stepExecution.getSkipCount());
    assertEquals(0, stepExecution.getReadSkipCount());
    assertEquals(5, stepExecution.getReadCount());
    assertEquals(1, stepExecution.getProcessSkipCount());
View Full Code Here

    processor.setFilter(true);
    ItemProcessListenerStub<String, String> listenerStub = new ItemProcessListenerStub<String, String>();
    factory.setListeners(new StepListener[] { listenerStub });
    Step step = factory.getObject();

    step.execute(stepExecution);

    assertEquals(0, stepExecution.getSkipCount());
    assertEquals(0, stepExecution.getReadSkipCount());
    assertEquals(5, stepExecution.getReadCount());
    assertEquals(1, stepExecution.getFilterCount());
View Full Code Here

  public void testNullWriter() throws Exception {

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

    step.execute(stepExecution);

    assertEquals(0, stepExecution.getSkipCount());
    assertEquals(0, stepExecution.getReadSkipCount());
    assertEquals(5, stepExecution.getReadCount());
    // Write count is incremented even if nothing happens
View Full Code Here

  public void testWriteSkip() throws Exception {
    writer.setFailures("4");

    Step step = factory.getObject();

    step.execute(stepExecution);

    assertEquals(1, stepExecution.getSkipCount());
    assertEquals(0, stepExecution.getReadSkipCount());
    assertEquals(5, stepExecution.getReadCount());
    assertEquals(1, stepExecution.getWriteSkipCount());
View Full Code Here

      }
    });

    Step step = factory.getObject();

    step.execute(stepExecution);
    String message = stepExecution.getFailureExceptions().get(0).getCause().getMessage();
    assertEquals("Wrong message: ", "Ouch!", message);
    assertStepExecutionsAreEqual(stepExecution, repository.getLastStepExecution(jobExecution.getJobInstance(), step
        .getName()));
  }
View Full Code Here

    factory.setSkipLimit(1);

    Step step = factory.getObject();

    step.execute(stepExecution);

    assertEquals(1, stepExecution.getSkipCount());

    // writer did not skip "2" as it never made it to writer, only "4" did
    assertTrue(reader.getRead().contains("4"));
View Full Code Here

    factory.setSkipLimit(3);
    factory.setSkippableExceptionClasses(getExceptionMap(Exception.class));

    Step step = factory.getObject();

    step.execute(stepExecution);
    assertEquals(BatchStatus.FAILED, stepExecution.getStatus());

    assertEquals(3, stepExecution.getSkipCount());
    assertEquals(2, stepExecution.getReadSkipCount());
    assertEquals(1, stepExecution.getWriteSkipCount());
View Full Code Here

    factory.setCommitInterval(2);
    factory.setSkipLimit(2);

    Step step = factory.getObject();

    step.execute(stepExecution);

    // 1,3 skipped inside a committed chunk. 5 tripped the skip
    // limit but it was skipped in a chunk that rolled back, so
    // it will re-appear on a restart and the listener is not called.
    assertEquals(2, listenerCalls.size());
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.