Examples of StepExecution


Examples of org.springframework.batch.core.StepExecution

      }
      logger.debug("Removed step executions from job execution: " + missingStepNames);
    }

    for (String stepName : missingStepNames) {
      StepExecution stepExecution = jobExecution.createStepExecution(stepName);
      stepExecution.setStatus(BatchStatus.UNKNOWN);
    }

    return jobExecution.getStepExecutions();

  }
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

  @Override
  public StepExecution getStepExecution(Long jobExecutionId, Long stepExecutionId)
      throws NoSuchJobExecutionException, NoSuchStepExecutionException {
    JobExecution jobExecution = getJobExecution(jobExecutionId);
    StepExecution stepExecution = stepExecutionDao.getStepExecution(jobExecution, stepExecutionId);
    if (stepExecution == null) {
      throw new NoSuchStepExecutionException("There is no StepExecution with jobExecutionId=" + jobExecutionId
          + " and id=" + stepExecutionId);
    }
    try {
      stepExecution.setExecutionContext(executionContextDao.getExecutionContext(stepExecution));
    }
    catch (Exception e) {
      logger.info("Cannot load execution context for step execution: " + stepExecution);
    }
    return stepExecution;
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

    jobExecution.setEndTime(new Date(earlierExecution.getEndTime().getTime() + 100));
    assertFalse(jobExecution.isRunning());

    Iterator<StepExecution> iterator = jobExecution.getStepExecutions().iterator();
    iterator.next();
    StepExecution stepExecution = iterator.next();
    stepExecution.setStatus(BatchStatus.COMPLETED);
    stepExecution.setExitStatus(ExitStatus.COMPLETED.addExitDescription("Foo"));

    metrics = new SimpleJobExecutionMetrics(jobService, "job");

  }
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

  @Qualifier("jobs/executions/step/progress")
  private View progress;

  @Test
  public void testHistoryView() throws Exception {
    StepExecution oldStepExecution = MetaDataInstanceFactory
        .createStepExecution();
    oldStepExecution.setEndTime(new Date());
    StepExecutionHistory stepExecutionHistory = new StepExecutionHistory(
        "step");
    stepExecutionHistory.append(oldStepExecution);
    model.put("stepExecutionHistory", stepExecutionHistory);
    history.render(model, request, response);
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

    assertTrue(content.contains("<td>Duration</td>"));
  }

  @Test
  public void testProgressView() throws Exception {
    StepExecution oldStepExecution = MetaDataInstanceFactory
        .createStepExecution();
    oldStepExecution.setEndTime(new Date());
    StepExecution stepExecution = MetaDataInstanceFactory
        .createStepExecution();
    model.put("stepExecutionInfo", new StepExecutionInfo(stepExecution,
        TimeZone.getTimeZone("GMT")));
    StepExecutionHistory stepExecutionHistory = new StepExecutionHistory(
        "step");
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

  @Test
  public void testListForJobExecutionSunnyDay() throws Exception {

    jobService.getStepExecutions(123L);
    StepExecution stepExecution = MetaDataInstanceFactory
        .createStepExecution();
    EasyMock.expectLastCall().andReturn(Arrays.asList(stepExecution));
    jobService.getJobExecution(123L);
    EasyMock.expectLastCall().andReturn(stepExecution.getJobExecution());
    EasyMock.replay(jobService);

    ExtendedModelMap model = new ExtendedModelMap();
    String result = controller.list(model, 123L, null, null);
    // StepExecutions, JobExecution
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

        .asList("step1"));
    EasyMock.expect(jobExecutionDao.getJobExecution(123L)).andReturn(jobExecution);
    EasyMock.expect(jobInstanceDao.getJobInstance(jobExecution)).andReturn(null);
    EasyMock.expect(executionContextDao.getExecutionContext(jobExecution)).andReturn(new ExecutionContext());
    stepExecutionDao.addStepExecutions(jobExecution);
    StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
    Long stepExecutionId = stepExecution.getId();
    EasyMock.expect(stepExecutionDao.getStepExecution(jobExecution, stepExecutionId)).andReturn(stepExecution);
    EasyMock.expect(executionContextDao.getExecutionContext(stepExecution)).andReturn(new ExecutionContext());
    EasyMock.replay(jobExecutionDao, stepExecutionDao, executionContextDao, jobInstanceDao);
    assertNotNull(service.getStepExecution(123L, 1234L));
    EasyMock.verify(jobExecutionDao, stepExecutionDao, executionContextDao, jobInstanceDao);
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

        .asList("step1"));
    EasyMock.expect(jobExecutionDao.getJobExecution(123L)).andReturn(jobExecution);
    EasyMock.expect(jobInstanceDao.getJobInstance(jobExecution)).andReturn(null);
    EasyMock.expect(executionContextDao.getExecutionContext(jobExecution)).andReturn(new ExecutionContext());
    stepExecutionDao.addStepExecutions(jobExecution);
    StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
    Long stepExecutionId = stepExecution.getId();
    EasyMock.expect(stepExecutionDao.getStepExecution(jobExecution, stepExecutionId)).andReturn(stepExecution);
    EasyMock.expect(executionContextDao.getExecutionContext(stepExecution)).andThrow(
        new IllegalStateException("Expected"));
    EasyMock.replay(jobExecutionDao, stepExecutionDao, executionContextDao, jobInstanceDao);
    StepExecution result = service.getStepExecution(123L, 1234L);
    assertNotNull(result);
    // If there is a problem extracting the execution context it will be empty
    assertNotNull(result.getExecutionContext());
    EasyMock.verify(jobExecutionDao, stepExecutionDao, executionContextDao, jobInstanceDao);
  }
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

    assertEquals("http://localhost:8080/springsource/jobs/executions/123.json", wrapper.get("jobExecution.resource"));
  }

  @Test
  public void testLaunchViewWithStackTrace() throws Exception {
    StepExecution stepExecution = MetaDataInstanceFactory.createStepExecution();
    StringWriter description = new StringWriter();
    new RuntimeException("planned").printStackTrace(new PrintWriter(description));
    stepExecution.setExitStatus(ExitStatus.FAILED.addExitDescription(description.toString()));
    model.put("stepExecutionInfo", new StepExecutionInfo(stepExecution, TimeZone
        .getTimeZone("GMT")));
    model.put("baseUrl", "http://localhost:8080/springsource");
    view.render(model, request, response);
    String content = response.getContentAsString();
    // System.err.println(content);
    assertTrue(content.contains("\"duration\" : \""));
    JsonWrapper wrapper = new JsonWrapper(content);
    assertEquals(0, wrapper.get("stepExecution.commitCount"));
    assertEquals("http://localhost:8080/springsource/jobs/executions/123.json", wrapper.get("jobExecution.resource"));
    assertEquals(stepExecution.getId(), wrapper.get("stepExecution.id", Long.class));
    assertEquals(stepExecution.getJobExecution().getStatus().toString(), wrapper.get("jobExecution.status"));
    assertEquals(stepExecution.getJobExecutionId(), wrapper.get("jobExecution.id", Long.class));
  }
View Full Code Here

Examples of org.springframework.batch.core.StepExecution

  private StepExecutionProgress progress;

  @Before
  public void setUp() {
    StepExecution stepExecution = MetaDataInstanceFactory
        .createStepExecution();
    stepExecution.setEndTime(new Date());
    StepExecutionHistory history = new StepExecutionHistory("step");
    // history.append(stepExecution);
    progress = new StepExecutionProgress(MetaDataInstanceFactory
        .createStepExecution(), history);
  }
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.