Package org.springframework.batch.core

Examples of org.springframework.batch.core.JobExecution


    assertEquals(1, server.queryNames(new ObjectName("*:type=JobExecution,name=foo,step=step,*"), null).size());
  }

  @Test
  public void testMBeanCreationWithIllegalCharacter() throws Exception {
    JobExecution jobExecution = jobRepository.createJobExecution("bar", new JobParameters());
    jobRepository.add(jobExecution.createStepExecution("step:partition0"));
    init();
    assertEquals(2, server.queryNames(new ObjectName("*:type=JobExecution,name=bar,*"), null).size());
  }
View Full Code Here


    exporter.getStepCount();
  }
 
  @Test
  public void testMBeanCreation() throws Exception {
    JobExecution jobExecution = jobRepository.createJobExecution("foo", new JobParameters());
    jobRepository.add(jobExecution.createStepExecution("step"));
    init();
    assertEquals(1, server.queryNames(new ObjectName("*:type=JobExecution,name=foo,*"), null).size());
    assertEquals(0, server.queryNames(new ObjectName("*:type=JobExecution,name=foo,step=step,*"), null).size());
  }
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testGetStepExecutions() throws Exception {
    JobExecution jobExecution = MetaDataInstanceFactory.createJobExecutionWithStepExecutions(12L, Arrays.asList(
        "step1", "step2"));
    EasyMock.expect(jobExecutionDao.getJobExecution(12L)).andReturn(jobExecution);
    stepExecutionDao.addStepExecutions(jobExecution);
    EasyMock.expectLastCall();
    EasyMock.expect(stepExecutionDao.findStepNamesForJobExecution("job", "*:partition*")).andReturn(
 
View Full Code Here

      public JobParametersIncrementer getJobParametersIncrementer() {
        return new RunIdIncrementer();
      }
    };
    EasyMock.expect(jobLocator.getJob("job")).andReturn(job);
    JobExecution failed = MetaDataInstanceFactory.createJobExecution();
    failed.setStatus(BatchStatus.FAILED);
    EasyMock.expect(jobRepository.getLastJobExecution("job", jobParameters)).andReturn(failed);
    EasyMock.expect(jobLauncher.run(job, jobParameters)).andReturn(MetaDataInstanceFactory.createJobExecution());
    EasyMock.replay(jobLauncher, jobLocator, jobRepository);
    assertNotNull(service.launch("job", jobParameters));
    EasyMock.verify(jobLauncher, jobLocator, jobRepository);
View Full Code Here

  /**
   * Test method for {@link SimpleJobService#launch(String, JobParameters)}.
   */
  @Test
  public void testRestart() throws Exception {
    JobExecution jobExecution = MetaDataInstanceFactory.createJobExecution();
    EasyMock.expect(jobExecutionDao.getJobExecution(123L)).andReturn(jobExecution);
    EasyMock.expect(jobInstanceDao.getJobInstance(jobExecution)).andReturn(
        MetaDataInstanceFactory.createJobInstance());
    JobParameters jobParameters = new JobParameters();
    Job job = new JobSupport("job");
View Full Code Here

  /**
   * Test method for {@link SimpleJobService#abandon(Long)}.
   */
  @Test
  public void testAbort() throws Exception {
    JobExecution jobExecution = MetaDataInstanceFactory.createJobExecution(123L);
    jobExecution.setStatus(BatchStatus.STOPPING);
    EasyMock.expect(jobExecutionDao.getJobExecution(123L)).andReturn(jobExecution);
    jobRepository.update(jobExecution);
    EasyMock.replay(jobExecutionDao, jobRepository);
    service.abandon(123L);
    assertEquals(BatchStatus.ABANDONED, jobExecution.getStatus());
    assertNotNull(jobExecution.getEndTime());
    EasyMock.verify(jobExecutionDao, jobRepository);
  }
View Full Code Here

  /**
   * Test method for {@link SimpleJobService#stop(Long)}.
   */
  @Test
  public void testStop() throws Exception {
    JobExecution jobExecution = MetaDataInstanceFactory.createJobExecution(123L);
    EasyMock.expect(jobExecutionDao.getJobExecution(123L)).andReturn(jobExecution);
    jobRepository.update(jobExecution);
    EasyMock.replay(jobExecutionDao, jobRepository);
    service.stop(123L);
    assertEquals(BatchStatus.STOPPING, jobExecution.getStatus());
    EasyMock.verify(jobExecutionDao, jobRepository);
  }
View Full Code Here

  /**
   * Test method for {@link SimpleJobService#getJobExecution(Long)}.
   */
  @Test
  public void testGetJobExecution() throws Exception {
    JobExecution jobExecution = MetaDataInstanceFactory.createJobExecution(123L);
    JobInstance jobInstance = jobExecution.getJobInstance();
    jobExecution.setJobInstance(null);
    EasyMock.expect(jobExecutionDao.getJobExecution(123L)).andReturn(jobExecution);
    EasyMock.expect(jobInstanceDao.getJobInstance(jobExecution)).andReturn(jobInstance);
    EasyMock.expect(executionContextDao.getExecutionContext(jobExecution)).andReturn(new ExecutionContext());
    stepExecutionDao.addStepExecutions(jobExecution);
    EasyMock.expectLastCall();
    EasyMock.replay(stepExecutionDao, jobExecutionDao, jobInstanceDao, executionContextDao);
    JobExecution result = service.getJobExecution(123L);
    assertNotNull(result);
    assertNotNull(result.getJobInstance());
    EasyMock.verify(stepExecutionDao, jobExecutionDao, jobInstanceDao, executionContextDao);
  }
View Full Code Here

  @Qualifier("jobs/executions.json")
  private View view;

  @Test
  public void testJobExecutionsForInstance() throws Exception {
    JobExecution jobExecution = MetaDataInstanceFactory.createJobExecution();
    model.put("jobExecutions", Arrays.asList(new JobExecutionInfo(jobExecution, TimeZone.getTimeZone("GMT"))));
    model.put("baseUrl", "http://localhost:8080/springsource");
    model.put("jobInfo", new JobInfo("foo", 1, 123L, false, false));
    model.put("jobInstanceInfo", new JobInstanceInfo(MetaDataInstanceFactory.createJobInstance("job", 112L), Arrays.asList(jobExecution),
        TimeZone.getTimeZone("GMT")));
View Full Code Here

    assertEquals(3, wrapper.get("jobInstance", Map.class).size());
  }

  @Test
  public void testViewWithJobExecutionInfo() throws Exception {
    JobExecution jobExecution1 = MetaDataInstanceFactory.createJobExecution();
    JobExecution jobExecution2 = MetaDataInstanceFactory.createJobExecution(13L);
    jobExecution2.setEndTime(new Date());
    model.put("baseUrl", "http://localhost:8080/springsource");
    model.put("jobExecutions", Arrays.asList(new JobExecutionInfo(jobExecution1, TimeZone.getTimeZone("GMT")),
        new JobExecutionInfo(jobExecution2, TimeZone.getTimeZone("GMT"))));
    model.put("currentTime", new Date());
    view.render(model, request, response);
View Full Code Here

TOP

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

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.