Package org.springframework.batch.admin.history

Examples of org.springframework.batch.admin.history.StepExecutionHistory


      if (stepName.contains(":partition")) {
        // assume we want to compare all partitions
        stepName = stepName.replaceAll("(:partition).*", "$1*");
      }
      String jobName = stepExecution.getJobExecution().getJobInstance().getJobName();
      StepExecutionHistory stepExecutionHistory = computeHistory(jobName, stepName);
      model.addAttribute(stepExecutionHistory);
      model.addAttribute(new StepExecutionProgress(stepExecution, stepExecutionHistory));
    }
    catch (NoSuchStepExecutionException e) {
      errors.reject("no.such.step.execution", new Object[] { stepExecutionId }, "There is no such step execution ("
View Full Code Here


  }

  private StepExecutionHistory computeHistory(String jobName, String stepName) {
    int total = jobService.countStepExecutionsForStep(jobName, stepName);
    StepExecutionHistory stepExecutionHistory = new StepExecutionHistory(stepName);
    for (int i = 0; i < total; i += 1000) {
      for (StepExecution stepExecution : jobService.listStepExecutionsForStep(jobName, stepName, i, 1000)) {
        stepExecutionHistory.append(stepExecution);
      }
    }
    return stepExecutionHistory;
  }
View Full Code Here

  @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);
    String content = response.getContentAsString();
    // System.err.println(content);
    assertTrue(content.contains("History of Step Execution for Step=step"));
View Full Code Here

    oldStepExecution.setEndTime(new Date());
    StepExecution stepExecution = MetaDataInstanceFactory
        .createStepExecution();
    model.put("stepExecutionInfo", new StepExecutionInfo(stepExecution,
        TimeZone.getTimeZone("GMT")));
    StepExecutionHistory stepExecutionHistory = new StepExecutionHistory(
        "step");
    stepExecutionHistory.append(oldStepExecution);
    model.put("stepExecutionHistory", stepExecutionHistory);
    model.put("stepExecutionProgress", new StepExecutionProgress(
        stepExecution, stepExecutionHistory));
    progress.render(model, request, response);
    String content = response.getContentAsString();
View Full Code Here

    // StepExecution, history and progress
    assertEquals(3, model.size());
    assertEquals("jobs/executions/step/progress", result);

    assertTrue(model.containsKey("stepExecutionHistory"));
    StepExecutionHistory history = (StepExecutionHistory) model.get("stepExecutionHistory");
    // The wildcard is intentional:
    assertEquals("step:partition*", history.getStepName());

    EasyMock.verify(jobService);

  }
View Full Code Here

  @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

    return (endTime != null ? endTime.getTime() : System.currentTimeMillis())
        - stepExecution.getStartTime().getTime();
  }

  public double getMeanDuration() {
    StepExecutionHistory history = computeHistory(stepName);
    return history.getDuration().getMean();
  }
View Full Code Here

    StepExecutionHistory history = computeHistory(stepName);
    return history.getDuration().getMean();
  }

  public double getMaxDuration() {
    StepExecutionHistory history = computeHistory(stepName);
    return history.getDuration().getMax();
  }
View Full Code Here

    }
    return result;
  }

  private StepExecutionHistory computeHistory(String stepName, int total) {
    StepExecutionHistory stepExecutionHistory = new StepExecutionHistory(stepName);
    for (StepExecution stepExecution : jobService.listStepExecutionsForStep(jobName, stepName, 0, total)) {
      stepExecutionHistory.append(stepExecution);
    }
    return stepExecutionHistory;
  }
View Full Code Here

      if (stepName.contains(":partition")) {
        // assume we want to compare all partitions
        stepName = stepName.replaceAll("(:partition).*", "$1*");
      }
      String jobName = stepExecution.getJobExecution().getJobInstance().getJobName();
      StepExecutionHistory stepExecutionHistory = computeHistory(jobName, stepName);
      return progressInfoResourceAssembler.toResource(new StepExecutionProgressInfo(stepExecution,
          stepExecutionHistory));
    }
    catch (org.springframework.batch.admin.service.NoSuchStepExecutionException e) {
      throw new NoSuchStepExecutionException(stepExecutionId);
View Full Code Here

TOP

Related Classes of org.springframework.batch.admin.history.StepExecutionHistory

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.