Package org.springframework.batch.core

Examples of org.springframework.batch.core.JobInstance


  }

  @Test
  public void testStopFailedAndRestarted() throws Throwable {
    String[] args = new String[] { jobPath, "-stop", jobName };
    StubJobExplorer.jobInstances = Arrays.asList(new JobInstance(5L, jobName));
    CommandLineJobRunner.main(args);
    assertEquals(0, StubSystemExiter.status);
  }
View Full Code Here


  }

  @Test
  public void testStopRestarted() throws Throwable {
    String[] args = new String[] { jobPath, "-stop", jobName };
    JobInstance jobInstance = new JobInstance(3L, jobName);
    StubJobExplorer.jobInstances = Arrays.asList(jobInstance);
    CommandLineJobRunner.main(args);
    assertEquals(0, StubSystemExiter.status);
  }
View Full Code Here

  }

  @Test
  public void testAbandon() throws Throwable {
    String[] args = new String[] { jobPath, "-abandon", jobName };
    StubJobExplorer.jobInstances = Arrays.asList(new JobInstance(2L, jobName));
    CommandLineJobRunner.main(args);
    assertEquals(0, StubSystemExiter.status);
  }
View Full Code Here

  }

  @Test
  public void testAbandonRunning() throws Throwable {
    String[] args = new String[] { jobPath, "-abandon", jobName };
    StubJobExplorer.jobInstances = Arrays.asList(new JobInstance(3L, jobName));
    CommandLineJobRunner.main(args);
    assertEquals(1, StubSystemExiter.status);
  }
View Full Code Here

  }

  @Test
  public void testAbandonAbandoned() throws Throwable {
    String[] args = new String[] { jobPath, "-abandon", jobName };
    StubJobExplorer.jobInstances = Arrays.asList(new JobInstance(4L, jobName));
    CommandLineJobRunner.main(args);
    assertEquals(1, StubSystemExiter.status);
  }
View Full Code Here

  @Test
  public void testRestart() throws Throwable {
    String[] args = new String[] { jobPath, "-restart", jobName };
    JobParameters jobParameters = new JobParametersBuilder().addString("foo", "bar").toJobParameters();
    JobInstance jobInstance = new JobInstance(0L, jobName);
    StubJobExplorer.jobInstances = Arrays.asList(jobInstance);
    StubJobExplorer.jobParameters = jobParameters;
    CommandLineJobRunner.main(args);
    assertEquals(0, StubSystemExiter.status);
    assertEquals(jobParameters, StubJobLauncher.jobParameters);
View Full Code Here

  @Test
  public void testRestartExecution() throws Throwable {
    String[] args = new String[] { jobPath, "-restart", "11" };
    JobParameters jobParameters = new JobParametersBuilder().addString("foo", "bar").toJobParameters();
    JobExecution jobExecution = new JobExecution(new JobInstance(0L, jobName), 11L, jobParameters, null);
    jobExecution.setStatus(BatchStatus.FAILED);
    StubJobExplorer.jobExecution = jobExecution;
    CommandLineJobRunner.main(args);
    assertEquals(0, StubSystemExiter.status);
    assertEquals(jobParameters, StubJobLauncher.jobParameters);
View Full Code Here

  @Test
  public void testRestartExecutionNotFailed() throws Throwable {
    String[] args = new String[] { jobPath, "-restart", "11" };
    JobParameters jobParameters = new JobParametersBuilder().addString("foo", "bar").toJobParameters();
    JobExecution jobExecution = new JobExecution(new JobInstance(0L, jobName), 11L, jobParameters, null);
    jobExecution.setStatus(BatchStatus.COMPLETED);
    StubJobExplorer.jobExecution = jobExecution;
    CommandLineJobRunner.main(args);
    assertEquals(1, StubSystemExiter.status);
    assertEquals(null, StubJobLauncher.jobParameters);
View Full Code Here

  }

  @Test
  public void testRestartNotFailed() throws Throwable {
    String[] args = new String[] { jobPath, "-restart", jobName };
    StubJobExplorer.jobInstances = Arrays.asList(new JobInstance(123L, jobName));
    CommandLineJobRunner.main(args);
    assertEquals(1, StubSystemExiter.status);
    String errorMessage = CommandLineJobRunner.getErrorMessage();
    assertTrue("Wrong error message: " + errorMessage, errorMessage
        .contains("No failed or stopped execution found"));
View Full Code Here

  @Test
  public void testNext() throws Throwable {
    String[] args = new String[] { jobPath, "-next", jobName, "bar=foo" };
    JobParameters jobParameters = new JobParametersBuilder().addString("foo", "bar").addString("bar", "foo")
        .toJobParameters();
    StubJobExplorer.jobInstances = Arrays.asList(new JobInstance(2L, jobName));
    CommandLineJobRunner.main(args);
    assertEquals(0, StubSystemExiter.status);
    jobParameters = new JobParametersBuilder().addString("foo", "spam").addString("bar", "foo").toJobParameters();
    assertEquals(jobParameters, StubJobLauncher.jobParameters);
  }
View Full Code Here

TOP

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

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.