Package org.springframework.batch.core.step

Examples of org.springframework.batch.core.step.AbstractStep


    };
    factory.setItemReader(provider);
    factory.setItemWriter(itemWriter);
    factory.setRetryLimit(5);
    factory.setRetryableExceptionClasses(getExceptionMap(RuntimeException.class));
    AbstractStep step = (AbstractStep) factory.getObject();
    step.setName("mytest");
    StepExecution stepExecution = new StepExecution(step.getName(),
        jobExecution);
    repository.add(stepExecution);
    step.execute(stepExecution);

    assertEquals(2, recovered.size());
    assertEquals(2, stepExecution.getSkipCount());
    assertEquals(2, stepExecution.getWriteSkipCount());
View Full Code Here


    };
    factory.setItemReader(provider);
    factory.setItemWriter(itemWriter);
    factory.setRetryLimit(5);
    factory.setRetryableExceptionClasses(getExceptionMap(RuntimeException.class));
    AbstractStep step = (AbstractStep) factory.getObject();
    step.setName("mytest");
    StepExecution stepExecution = new StepExecution(step.getName(),
        jobExecution);
    repository.add(stepExecution);
    step.execute(stepExecution);

    assertEquals(2, recovered.size());
    assertEquals(2, stepExecution.getSkipCount());
    assertEquals(2, stepExecution.getWriteSkipCount());
View Full Code Here

            "Write error - planned but retryable.");
      }
    };
    factory.setItemReader(provider);
    factory.setItemWriter(itemWriter);
    AbstractStep step = (AbstractStep) factory.getObject();

    StepExecution stepExecution = new StepExecution(step.getName(),
        jobExecution);
    repository.add(stepExecution);
    step.execute(stepExecution);
    assertEquals(BatchStatus.FAILED, stepExecution.getStatus());

    List<String> expectedOutput = Arrays.asList(StringUtils
        .commaDelimitedListToStringArray(""));
    assertEquals(expectedOutput, written);
View Full Code Here

            "Write error - planned but retryable.");
      }
    };
    factory.setItemReader(provider);
    factory.setItemWriter(itemWriter);
    AbstractStep step = (AbstractStep) factory.getObject();

    StepExecution stepExecution = new StepExecution(step.getName(),
        jobExecution);
    repository.add(stepExecution);
    step.execute(stepExecution);
    assertEquals(BatchStatus.FAILED, stepExecution.getStatus());

    // We added a bogus cache so no items are actually skipped
    // because they aren't recognised as eligible
    assertEquals(0, stepExecution.getSkipCount());
View Full Code Here

  @Test
  public void testSimpleJob() throws Exception {

    job.setSteps(new ArrayList<Step>());
    AbstractStep step = (AbstractStep) getStepFactory("foo", "bar").getObject();
    step.setName("step1");
    job.addStep(step);
    step = (AbstractStep) getStepFactory("spam").getObject();
    step.setName("step2");
    job.addStep(step);

    JobExecution jobExecution = repository.createJobExecution(job.getName(), new JobParameters());

    job.execute(jobExecution);
View Full Code Here

    SimpleStepFactoryBean<String, String> factory = getStepFactory("foo", "bar");
    factory.setTaskExecutor(new SimpleAsyncTaskExecutor());
    factory.setThrottleLimit(1);

    AbstractStep step = (AbstractStep) factory.getObject();
    step.setName("step1");

    JobExecution jobExecution = repository.createJobExecution(job.getName(), new JobParameters());
    StepExecution stepExecution = jobExecution.createStepExecution(step.getName());
    repository.add(stepExecution);
    step.execute(stepExecution);
    assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());
    assertEquals(2, written.size());
    assertTrue(written.contains("foo"));
  }
View Full Code Here

      @Override
      public void write(List<? extends String> data) throws Exception {
        throw new RuntimeException("Foo");
      }
    });
    AbstractStep step = (AbstractStep) factory.getObject();
    job.setSteps(Collections.singletonList((Step) step));

    JobExecution jobExecution = repository.createJobExecution(job.getName(), new JobParameters());

    job.execute(jobExecution);
View Full Code Here

        if (count++ == 0) {
          throw new RuntimeException("Foo");
        }
      }
    });
    AbstractStep step = (AbstractStep) factory.getObject();
    job.setSteps(Collections.singletonList((Step) step));

    JobExecution jobExecution = repository.createJobExecution(job.getName(), new JobParameters());

    job.execute(jobExecution);
View Full Code Here

    AssertingWriteListener writeListener = new AssertingWriteListener();
    CountingChunkListener chunkListener = new CountingChunkListener(writeListener);
    factory.setListeners(new StepListener[] { chunkListener, writeListener });
    factory.setCommitInterval(commitInterval);

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

    job.setSteps(Collections.singletonList((Step) step));

    JobExecution jobExecution = repository.createJobExecution(job.getName(), new JobParameters());
    job.execute(jobExecution);
View Full Code Here

      return builder.build();
    }

    @Bean
    protected Step step1() throws Exception {
      AbstractStep step = new AbstractStep("step1") {
        @Override
        protected void doExecute(StepExecution stepExecution) throws Exception {
          stepExecution.setExitStatus(ExitStatus.COMPLETED);
          stepExecution.setStatus(BatchStatus.COMPLETED);
        }
      };
      step.setJobRepository(getJobRepository());
      return step;
    }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.step.AbstractStep

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.