Package org.springframework.batch.core

Examples of org.springframework.batch.core.Step


      }
    };
    JobExecution jobExec = jobRepository.createJobExecution(job.getName(), jobParameters);
    jobExec.setStartTime(new Date(0));
    jobExec.setExecutionContext(ctx);
    Step step = new StepSupport("step1");
    StepExecution stepExec = new StepExecution(step.getName(), jobExec);
    stepExec.setExecutionContext(ctx);

    jobRepository.add(stepExec);

    StepExecution retrievedStepExec = jobRepository.getLastStepExecution(jobExec.getJobInstance(), step.getName());
    assertEquals(stepExec, retrievedStepExec);
    assertEquals(ctx, retrievedStepExec.getExecutionContext());

    // JobExecution retrievedJobExec =
    // jobRepository.getLastJobExecution(jobExec.getJobInstance());
View Full Code Here


  /* (non-Javadoc)
   * @see org.springframework.batch.core.step.StepLocator#getStep(java.lang.String)
   */
  @Override
  public Step getStep(String stepName) throws NoSuchStepException {
    Step result = null;

    if(step.getName().equals(stepName)) {
      result = step;
    } else if(step instanceof StepLocator) {
      result = ((StepLocator) step).getStep(stepName);
View Full Code Here

  @Autowired
  private BeanFactory beanFactory;

  @Test
  public void testListenersAtStepLevel() throws Exception {
    Step step = (Step) beanFactory.getBean("s1");
    List<?> list = getListeners(step);
    assertEquals(1, list.size());
    assertTrue(list.get(0) instanceof StepExecutionListenerSupport);
  }
View Full Code Here

  }

  @Test
  // TODO: BATCH-1689 (expected=BeanCreationException.class)
  public void testListenersAtStepLevelWrongType() throws Exception {
    Step step = (Step) beanFactory.getBean("s2");
    List<?> list = getListeners(step);
    assertEquals(1, list.size());
    assertTrue(list.get(0) instanceof ChunkListenerSupport);
  }
View Full Code Here

    assertTrue(list.get(0) instanceof ChunkListenerSupport);
  }

  @Test
  public void testListenersAtTaskletAndStepLevels() throws Exception {
    Step step = (Step) beanFactory.getBean("s3");
    List<?> list = getListeners(step);
    assertEquals(2, list.size());
    assertTrue(list.get(0) instanceof StepExecutionListenerSupport);
    assertTrue(list.get(1) instanceof ChunkListenerSupport);
  }
View Full Code Here

    assertTrue(list.get(1) instanceof ChunkListenerSupport);
  }

  @Test
  public void testListenersAtChunkAndStepLevels() throws Exception {
    Step step = (Step) beanFactory.getBean("s4");
    List<?> list = getListeners(step);
    assertEquals(2, list.size());
    assertTrue(list.get(0) instanceof StepExecutionListenerSupport);
    assertTrue(list.get(1) instanceof ItemListenerSupport);
  }
View Full Code Here

  public Step getStep(String stepName) {
    for (Step step : this.steps) {
      if (step.getName().equals(stepName)) {
        return step;
      } else if(step instanceof StepLocator) {
        Step result = ((StepLocator)step).getStep(stepName);
        if(result != null) {
          return result;
        }
      }
    }
View Full Code Here

      processor.clear();
      factory.setItemProcessor(processor);

      try {

        Step step = factory.getObject();

        stepExecution = jobExecution.createStepExecution(factory.getName());
        repository.add(stepExecution);
        step.execute(stepExecution);
        assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());

        List<String> committed = new ArrayList<String>(writer.getWritten());
        Collections.sort(committed);
        assertEquals("[1, 2, 3, 4, 5]", committed.toString());
View Full Code Here

      writer.setFailures("1", "2", "3", "4", "5");

      try {

        Step step = factory.getObject();

        stepExecution = jobExecution.createStepExecution(factory.getName());
        repository.add(stepExecution);
        step.execute(stepExecution);
        assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());

        assertEquals(5, stepExecution.getSkipCount());
        List<String> processed = new ArrayList<String>(processor.getProcessed());
        Collections.sort(processed);
View Full Code Here

      assertEquals(0, JdbcTestUtils.countRowsInTable(jdbcTemplate, "ERROR_LOG"));

      try {

        Step step = factory.getObject();

        stepExecution = jobExecution.createStepExecution(factory.getName());
        repository.add(stepExecution);
        step.execute(stepExecution);
        assertEquals(BatchStatus.COMPLETED, stepExecution.getStatus());

        List<String> committed = new ArrayList<String>(writer.getCommitted());
        Collections.sort(committed);
        assertEquals("[1, 2, 3, 4, 5]", committed.toString());
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.