Examples of StepExecutionListenerSupport


Examples of org.springframework.batch.core.listener.StepExecutionListenerSupport

   * Exception in afterStep is ignored (only logged).
   */
  public void testAfterStepFailureWhenTaskletFails() throws Exception {

    final RuntimeException exception = new RuntimeException();
    taskletStep.setStepExecutionListeners(new StepExecutionListenerSupport[] { new StepExecutionListenerSupport() {
      @Override
      public ExitStatus afterStep(StepExecution stepExecution) {
        throw exception;
      }
    } });
View Full Code Here

Examples of org.springframework.batch.core.listener.StepExecutionListenerSupport

      }

    };

    step.setTasklet(new TestingChunkOrientedTasklet<String>(itemReader, itemWriter));
    step.registerStepExecutionListener(new StepExecutionListenerSupport() {
      @Override
      public ExitStatus afterStep(StepExecution stepExecution) {
        return ExitStatus.FAILED.addExitDescription("FOO");
      }
    });
View Full Code Here

Examples of org.springframework.batch.core.listener.StepExecutionListenerSupport

    assertEquals("bar", stepExecution.getExecutionContext().getString("foo"));
  }

  @Test
  public void testDirectlyInjectedListener() throws Exception {
    step.registerStepExecutionListener(new StepExecutionListenerSupport() {
      @Override
      public void beforeStep(StepExecution stepExecution) {
        list.add("foo");
      }
View Full Code Here

Examples of org.springframework.batch.core.listener.StepExecutionListenerSupport

  @Test
  public void testAfterStep() throws Exception {

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

    step.setStepExecutionListeners(new StepExecutionListener[] { new StepExecutionListenerSupport() {
      @Override
      public ExitStatus afterStep(StepExecution stepExecution) {
        list.add("afterStepCalled");
        return customStatus;
      }
View Full Code Here

Examples of org.springframework.batch.core.listener.StepExecutionListenerSupport

    assertEquals(customStatus.getExitDescription(), returnedStatus.getExitDescription());
  }

  @Test
  public void testDirectlyInjectedListenerOnError() throws Exception {
    step.registerStepExecutionListener(new StepExecutionListenerSupport() {
      @Override
      public ExitStatus afterStep(StepExecution stepExecution) {
        list.add("exception");
        return null;
      }
View Full Code Here

Examples of org.springframework.batch.core.listener.StepExecutionListenerSupport

   * doesn't cause step failure.
   * @throws JobInterruptedException
   */
  @Test
  public void testStepFailureInAfterStepCallback() throws JobInterruptedException {
    StepExecutionListener listener = new StepExecutionListenerSupport() {
      @Override
      public ExitStatus afterStep(StepExecution stepExecution) {
        throw new RuntimeException("exception thrown in afterStep to signal failure");
      }
    };
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.