Package org.springframework.xd.dirt.job

Examples of org.springframework.xd.dirt.job.JobExecutionInfo


      @RequestParam(defaultValue = "20") int pageSize) {

    Collection<JobExecutionInfoResource> result = new ArrayList<JobExecutionInfoResource>();
    try {
      for (JobExecution jobExecution : jobService.listJobExecutionsForJob(jobName, startJobExecution, pageSize)) {
        result.add(jobExecutionInfoResourceAssembler.toResource(new JobExecutionInfo(jobExecution, timeZone)));
      }
    }
    catch (NoSuchJobException e) {
      throw new NoSuchBatchJobException(jobName);
    }
View Full Code Here


  private JobExecutionInfoResource getJobExecutionInfoResource(JobExecution jobExecution,
      Set<String> restartableJobs,
      Set<String> deployedJobs,
      Set<String> jobDefinitionNames) {

    final JobExecutionInfoResource jobExecutionInfoResource = jobExecutionInfoResourceAssembler.toResource(new JobExecutionInfo(
        jobExecution,
        timeZone));
    final String jobName = jobExecution.getJobInstance().getJobName();
    jobExecutionInfoResource.setDeleted(!jobDefinitionNames.contains(jobName));
    jobExecutionInfoResource.setDeployed(deployedJobs.contains(jobName));
View Full Code Here

  @Override
  protected DetailedJobInfoResource instantiateResource(DetailedJobInfo entity) {
    JobExecutionInfoResource jobExecutionInfoResource;
    if (entity.getLastExecutionInfo() != null) {
      JobExecutionInfo jobExecutionInfo = new JobExecutionInfo(
          entity.getLastExecutionInfo().getJobExecution(),
          entity.getLastExecutionInfo().getTimeZone());
      jobExecutionInfoResource = jobExecutionInfoResourceAssembler.instantiateResource(jobExecutionInfo);
    }
    else {
View Full Code Here

      try {
        List<JobExecution> jobExecutions = (List<JobExecution>) jobService.getJobExecutionsForJobInstance(
            jobInstance.getJobName(), jobInstance.getId());
        List<JobExecutionInfo> jobExecutionInfos = new ArrayList<JobExecutionInfo>();
        for (JobExecution jobExecution : jobExecutions) {
          jobExecutionInfos.add(new JobExecutionInfo(jobExecution, timeZone));
        }
        return jobInstanceInfoResourceAssembler.toResource(new JobInstanceInfo(jobInstance, jobExecutionInfos));
      }
      catch (NoSuchJobException e) {
        throw new NoSuchBatchJobException(jobName);
View Full Code Here

      for (JobInstance jobInstance : jobInstances) {
        List<JobExecution> jobExecutions = (List<JobExecution>) jobService.getJobExecutionsForJobInstance(
            jobName, jobInstance.getId());
        List<JobExecutionInfo> jobExecutionInfos = new ArrayList<JobExecutionInfo>();
        for (JobExecution jobExecution : jobExecutions) {
          jobExecutionInfos.add(new JobExecutionInfo(jobExecution, timeZone));
        }
        result.add(jobInstanceInfoResourceAssembler.toResource(new JobInstanceInfo(jobInstance,
            jobExecutionInfos)));
      }
      return result;
View Full Code Here

   * @throws NoSuchJobException
   */
  private JobExecutionInfo getLastExecution(String jobName) throws NoSuchJobException {
    Collection<JobExecution> executions = jobService.listJobExecutionsForJob(jobName, 0, 1);
    if (executions.size() > 0) {
      return new JobExecutionInfo(executions.iterator().next(), timeZone);
    }
    else {
      return null;
    }
  }
View Full Code Here

        post("/jobs/definitions").param("name", "job1").param("definition", JOB_DEFINITION).accept(
            MediaType.APPLICATION_JSON)).andExpect(status().isCreated());
    mockMvc.perform(
        post("/jobs/definitions").param("name", "job2").param("definition", JOB_DEFINITION).accept(
            MediaType.APPLICATION_JSON)).andExpect(status().isCreated());
    JobExecutionInfo info = new JobExecutionInfo(execution, timeZone);
    mockMvc.perform(
        get("/jobs/configurations").accept(
            MediaType.APPLICATION_JSON)).andExpect(
        status().isOk()).andExpect(jsonPath("$.content", Matchers.hasSize(2))).andExpect(
        jsonPath("$.content[*].executionCount", contains(2, 1))).andExpect(
        jsonPath("$.content[*].launchable", contains(false, true))).andExpect(
        jsonPath("$.content[*].deployed", contains(true, true))).andExpect(
        jsonPath("$.content[*].incrementable", contains(false, true))).andExpect(
        jsonPath("$.content[*].jobInstanceId", contains(nullValue(), nullValue()))).andExpect(
        jsonPath("$.content[*].duration", contains(info.getDuration(), null))).andExpect(
        jsonPath("$.content[*].startTime", contains(info.getStartTime(), null))).andExpect(
        jsonPath("$.content[*].startDate", contains(info.getStartDate(), null))).andExpect(
        jsonPath("$.content[*].stepExecutionCount", contains(info.getStepExecutionCount(), 0))).andExpect(
        jsonPath("$.content[*].jobParameters", contains(info.getJobParametersString(), null)))

        // should contain the display name (ie- without the .job suffix)
        .andExpect(jsonPath("$.content[0].name", equalTo("job1"))).andExpect(
            jsonPath("$.content[0].jobInstanceId", nullValue()))

View Full Code Here

        post("/jobs/definitions").param("name", "job1").param("definition", JOB_DEFINITION).accept(
            MediaType.APPLICATION_JSON)).andExpect(status().isCreated());
    mockMvc.perform(
        post("/jobs/definitions").param("name", "job2").param("definition", JOB_DEFINITION).accept(
            MediaType.APPLICATION_JSON)).andExpect(status().isCreated());
    JobExecutionInfo info = new JobExecutionInfo(execution, timeZone);
    mockMvc.perform(
        get("/jobs/configurations").param("page", "0").param("size", "1").accept(
            MediaType.APPLICATION_JSON)).andExpect(
        status().isOk()).andExpect(jsonPath("$.content", Matchers.hasSize(1))).andExpect(
        jsonPath("$.content[*].executionCount", contains(2))).andExpect(
        jsonPath("$.content[*].launchable", contains(false))).andExpect(
        jsonPath("$.content[*].deployed", contains(true))).andExpect(
        jsonPath("$.content[*].incrementable", contains(false))).andExpect(
        jsonPath("$.content[*].jobInstanceId", contains(nullValue()))).andExpect(
        jsonPath("$.content[*].duration", contains(info.getDuration()))).andExpect(
        jsonPath("$.content[*].startTime", contains(info.getStartTime()))).andExpect(
        jsonPath("$.content[*].startDate", contains(info.getStartDate()))).andExpect(
        jsonPath("$.content[*].stepExecutionCount", contains(info.getStepExecutionCount()))).andExpect(
        jsonPath("$.content[*].jobParameters", contains(info.getJobParametersString())))

        // should contain the display name (ie- without the .job suffix)
        .andExpect(jsonPath("$.content[0].name", equalTo("job1"))).andExpect(
            jsonPath("$.content[0].jobInstanceId", nullValue()))

View Full Code Here

TOP

Related Classes of org.springframework.xd.dirt.job.JobExecutionInfo

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.