Package org.springframework.batch.core

Examples of org.springframework.batch.core.StepExecution


    StepExecution stepExecution = getLatestStepExecution(stepName);
    return stepExecution == null ? -1 : stepExecution.getId();
  }

  public String getLatestStatus() {
    StepExecution stepExecution = getLatestStepExecution(stepName);
    return stepExecution == null ? "NON" : stepExecution.getStatus().toString();
  }
View Full Code Here


    StepExecution stepExecution = getLatestStepExecution(stepName);
    return stepExecution == null ? "NON" : stepExecution.getStatus().toString();
  }

  public String getLatestExitCode() {
    StepExecution stepExecution = getLatestStepExecution(stepName);
    return stepExecution == null ? "NONE" : stepExecution.getExitStatus().getExitCode();
  }
View Full Code Here

    StepExecution stepExecution = getLatestStepExecution(stepName);
    return stepExecution == null ? "NONE" : stepExecution.getExitStatus().getExitCode();
  }

  public String getLatestExitDescription() {
    StepExecution stepExecution = getLatestStepExecution(stepName);
    return stepExecution == null ? "" : stepExecution.getExitStatus().getExitDescription();
  }
View Full Code Here

    Collection<StepExecution> stepExecutions = jobService.listStepExecutionsForStep(jobName, stepName, 0, 4);
    if (stepExecutions.isEmpty()) {
      return null;
    }
    long lastUpdated = 0L;
    StepExecution result = null;
    for (StepExecution stepExecution : stepExecutions) {
      long updated = stepExecution.getStartTime().getTime();
      if (updated > lastUpdated) {
        result = stepExecution;
        lastUpdated = updated;
View Full Code Here

  @DirtiesContext
  public void testFailedStep() throws Exception {
    JobExecution jobExecution = jobLauncher.run(job, new JobParameters(Collections.singletonMap("item.three",
        new JobParameter("unsupported"))));
    assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
    StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
    assertEquals(9, stepExecution.getReadCount());
    // In principle the write count could be more than 2 and less than 9...
    assertEquals(7, stepExecution.getWriteCount());
  }
View Full Code Here

  @DirtiesContext
  public void testFailedStepOnError() throws Exception {
    JobExecution jobExecution = jobLauncher.run(job, new JobParameters(Collections.singletonMap("item.three",
        new JobParameter("error"))));
    assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
    StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
    assertEquals(9, stepExecution.getReadCount());
    // In principle the write count could be more than 2 and less than 9...
    assertEquals(7, stepExecution.getWriteCount());
  }
View Full Code Here

  @DirtiesContext
  public void testSunnyDayFaultTolerant() throws Exception {
    JobExecution jobExecution = jobLauncher.run(job, new JobParameters(Collections.singletonMap("item.three",
        new JobParameter("3"))));
    assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
    StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
    assertEquals(9, stepExecution.getReadCount());
    assertEquals(9, stepExecution.getWriteCount());
  }
View Full Code Here

  public void testSkipsInWriter() throws Exception {
    JobExecution jobExecution = jobLauncher.run(job, new JobParametersBuilder().addString("item.three", "fail")
        .addLong("run.id", 1L).toJobParameters());
    // System.err.println(new SimpleJdbcTemplate(dataSource).queryForList("SELECT * FROM INT_MESSAGE_GROUP"));
    assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
    StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
    assertEquals(9, stepExecution.getReadCount());
    assertEquals(7, stepExecution.getWriteCount());
    // The whole chunk gets skipped...
    assertEquals(2, stepExecution.getWriteSkipCount());
  }
View Full Code Here

  @Test
  public void testFailedStep() throws Exception {
    JobExecution jobExecution = jobLauncher.run(job, new JobParameters(Collections.singletonMap("item.three",
        new JobParameter("unsupported"))));
    assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
    StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
    assertEquals(9, stepExecution.getReadCount());
    // In principle the write count could be more than 2 and less than 9...
    assertEquals(7, stepExecution.getWriteCount());
  }
View Full Code Here

  @Test
  public void testFailedStepOnError() throws Exception {
    JobExecution jobExecution = jobLauncher.run(job, new JobParameters(Collections.singletonMap("item.three",
        new JobParameter("error"))));
    assertEquals(BatchStatus.FAILED, jobExecution.getStatus());
    StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
    assertEquals(9, stepExecution.getReadCount());
    // In principle the write count could be more than 2 and less than 9...
    assertEquals(7, stepExecution.getWriteCount());
  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.StepExecution

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.