Package org.springframework.batch.core

Examples of org.springframework.batch.core.JobParameters


  }

  @Test
  @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...
View Full Code Here


  }

  @Test
  @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

    tasklet.setFail(false);
  }
 
  @Test
  public void testLaunchJob() throws Exception {
    JobExecution jobExecution = jobLauncher.run(job, new JobParameters());
    assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
    assertEquals(ExitStatus.COMPLETED, jobExecution.getExitStatus());
  }
View Full Code Here

  }

  @Test
  public void testLaunchJob() throws Exception {
    int before = jobExplorer.getJobInstances(job.getName(), 0, 100).size();
    assertNotNull(jobLauncher.run(job, new JobParameters()));
    List<JobInstance> jobInstances = jobExplorer.getJobInstances(job.getName(), 0, 100);
    int after = jobInstances.size();
    assertEquals(1, after-before);
    JobExecution jobExecution = jobExplorer.getJobExecutions(jobInstances.get(jobInstances.size()-1)).get(0);
    assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
View Full Code Here

    assertEquals(7, stepExecution.getWriteCount());
  }

  @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...
View Full Code Here

    assertEquals(7, stepExecution.getWriteCount());
  }

  @Test
  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

  }

  @Test
  public void testLaunchJob() throws Exception {
    int before = jobExplorer.getJobInstances(job.getName(), 0, 100).size();
    assertNotNull(jobLauncher.run(job, new JobParameters()));
    List<JobInstance> jobInstances = jobExplorer.getJobInstances(job.getName(), 0, 100);
    int after = jobInstances.size();
    assertEquals(1, after - before);
    JobExecution jobExecution = jobExplorer.getJobExecutions(jobInstances.get(jobInstances.size() - 1)).get(0);
    assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
View Full Code Here

  @Test
  @DirtiesContext
  @SuppressWarnings("unchecked")
  public void testNoReply() {
    GenericMessage<JobLaunchRequest> trigger = new GenericMessage<JobLaunchRequest>(new JobLaunchRequest(job,
        new JobParameters()));
    try {
      requestChannel.send(trigger);
    }
    catch (MessagingException e) {
      String message = e.getMessage();
View Full Code Here

  @Test
  public void testExceptionRaised() throws Exception {

    final Message<JobLaunchRequest> message = MessageBuilder.withPayload(new JobLaunchRequest(new JobSupport("testJob"),
    new JobParameters())).build();

    final JobLauncher jobLauncher = mock(JobLauncher.class);
    when(jobLauncher.run(any(Job.class), any(JobParameters.class)))
      .thenThrow(new JobParametersInvalidException("This is a JobExecutionException."));
View Full Code Here

  @Test
  @DirtiesContext
  @SuppressWarnings("unchecked")
  public void testNoReply() {
    GenericMessage<JobLaunchRequest> trigger = new GenericMessage<JobLaunchRequest>(new JobLaunchRequest(job,
        new JobParameters()));
    try {
      requestChannel.send(trigger);
      fail();
    }
    catch (MessagingException e) {
View Full Code Here

TOP

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

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.