Package org.springframework.batch.core

Examples of org.springframework.batch.core.JobParametersBuilder


  @Test
  public void testGetRestartJobParametersWithDefaults() {
    JsrJobOperator jobOperator = (JsrJobOperator) jsrJobOperator;

    JobExecution jobExecution = new JobExecution(1L,
        new JobParametersBuilder().addString("prevKey1", "prevVal1").addString("prevKey2", "prevVal2").toJobParameters());

    Properties defaultProperties = new Properties();
    defaultProperties.setProperty("prevKey2", "not value 2");
    Properties userProperties = new Properties(defaultProperties);
View Full Code Here


  @Test
  public void testNewJobParametersOverridePreviousRestartParameters() {
    JsrJobOperator jobOperator = (JsrJobOperator) jsrJobOperator;

    JobExecution jobExecution = new JobExecution(1L,
        new JobParametersBuilder()
    .addString("prevKey1", "prevVal1")
    .addString("overrideTest", "jobExecution")
    .toJobParameters());

    Properties userProperties = new Properties();
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);
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);
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);
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

  public void testNextFirstInSequence() throws Throwable {
    String[] args = new String[] { jobPath, "-next", jobName };
    StubJobExplorer.jobInstances = new ArrayList<JobInstance>();
    CommandLineJobRunner.main(args);
    assertEquals(0, StubSystemExiter.status);
    JobParameters jobParameters = new JobParametersBuilder().addString("foo", "spam").toJobParameters();
    assertEquals(jobParameters, StubJobLauncher.jobParameters);
  }
View Full Code Here

  @Autowired
  JobRepository jobRepository;
 
  @Test
  public void testListeners() throws Exception{
    JobExecution jobExecution = jobRepository.createJobExecution("testJob", new JobParametersBuilder().addLong("now",
        System.currentTimeMillis()).toJobParameters());
    job.execute(jobExecution);
    assertTrue(beforeCalled);
    assertTrue(afterCalled);
  }
View Full Code Here

    assertEquals(5L, context.getExecutionId());
  }

  @Test
  public void testJobParameters() {
    JobParameters params = new JobParametersBuilder()
    .addString("key1", "value1")
    .toJobParameters();

    when(execution.getJobParameters()).thenReturn(params);
View Full Code Here

  @Autowired
  JobRepository jobRepository;
 
  @Test
  public void testListeners() throws Exception{
    JobExecution jobExecution = jobRepository.createJobExecution("testJob", new JobParametersBuilder().addLong("now",
        System.currentTimeMillis()).toJobParameters());
    job.execute(jobExecution);
    assertTrue(beforeCalled);
    assertTrue(afterCalled);
  }
View Full Code Here

TOP

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

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.