Package org.springframework.batch.core

Examples of org.springframework.batch.core.JobParametersBuilder


    StepSynchronizationManager.register(stepExecution);
  }

  @Override
  protected JobParameters getUniqueJobParameters() {
    return new JobParametersBuilder(super.getUniqueJobParameters()).addString("inputFile",
        "data/iosample/input/delimited.csv").addString("outputFile",
        "file:./build/test-outputs/delimitedOutput.csv").toJobParameters();
  }
View Full Code Here


    assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
    assertEquals(second, jobExecution.getStepExecutions().iterator().next().getWriteCount());
  }

  protected JobParameters getJobParameters(double amount) {
    return new JobParametersBuilder().addLong("timestamp", new Date().getTime()).addDouble("credit", amount)
        .toJobParameters();
  }
View Full Code Here

    configs[0] = DataSourceConfiguration.class;
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(configs);
    Job job = jobName == null ? context.getBean(Job.class) : context.getBean(jobName, Job.class);
    JobLauncher jobLauncher = context.getBean(JobLauncher.class);
    execution = jobLauncher
        .run(job, new JobParametersBuilder().addLong("run.id", (long) (Math.random() * Long.MAX_VALUE))
            .toJobParameters());
    assertEquals(status, execution.getStatus());
    assertEquals(stepExecutionCount, execution.getStepExecutions().size());
    context.close();

View Full Code Here

    JdbcTestUtils.deleteFromTables(jdbcTemplate, "PLAYER_SUMMARY", "GAMES", "PLAYERS");
  }

  @Test
  public void testLaunchJob() throws Exception {
    JobExecution execution = jobLauncher.run(job, new JobParametersBuilder().addLong("commit.interval", 10L)
        .toJobParameters());
    assertEquals(BatchStatus.COMPLETED, execution.getStatus());
    for (StepExecution stepExecution : execution.getStepExecutions()) {
      logger.info("Processed: " + stepExecution);
      if (stepExecution.getStepName().equals("playerload")) {
View Full Code Here

    JdbcTestUtils.deleteFromTables(jdbcTemplate, "PLAYER_SUMMARY", "GAMES", "PLAYERS");
  }

  @Test
  public void testLaunchJob() throws Exception {
    JobExecution execution = jobLauncher.run(job, new JobParametersBuilder().toJobParameters());
    assertEquals(BatchStatus.COMPLETED, execution.getStatus());
    for (StepExecution stepExecution : execution.getStepExecutions()) {
      logger.info("Processed: "+stepExecution);
    }
  }
View Full Code Here

      }
    }
    catch (Exception e) {
      // Ignore (wrong platform)
    }
    JobExecution execution = jobLauncher.run(job, new JobParametersBuilder().addLong("skip.limit", 0L)
        .toJobParameters());
    assertEquals(BatchStatus.COMPLETED, execution.getStatus());
    for (StepExecution stepExecution : execution.getStepExecutions()) {
      logger.info("Processed: " + stepExecution);
    }
    // They all skip on the second execution because of a primary key
    // violation
    long retryLimit = 2L;
    execution = jobLauncher.run(job,
        new JobParametersBuilder().addLong("skip.limit", 100000L).addLong("retry.limit", retryLimit)
            .toJobParameters());
    assertEquals(BatchStatus.COMPLETED, execution.getStatus());
    for (StepExecution stepExecution : execution.getStepExecutions()) {
      logger.info("Processed: " + stepExecution);
      if (stepExecution.getStepName().equals("playerload")) {
View Full Code Here

  @Autowired
  public JobLauncher jobLauncher;

  @Test
  public void testReprocessException() throws Exception {
    JobExecution execution = jobLauncher.run(job, new JobParametersBuilder().toJobParameters());

    assertEquals(BatchStatus.COMPLETED, execution.getStatus());
  }
View Full Code Here

  public void testRunStepStatusUnknown() throws Exception {
    //try and restart a job where the step execution is UNKNOWN
    //setup
    String jobName = "test_job";
    JobRepository jobRepository = mock(JobRepository.class);
    JobParameters parameters = new JobParametersBuilder().addLong("runtime", System.currentTimeMillis()).toJobParameters();
    JobExecution jobExecution = mock(JobExecution.class);
    Job job = mock(Job.class);
    JobParametersValidator validator = mock(JobParametersValidator.class);
    StepExecution stepExecution = mock(StepExecution.class);
View Full Code Here

  private JobExecution launch(boolean start, long jobExecutionId) throws Exception {

    if (start) {

      Calendar c = Calendar.getInstance();
      JobParametersBuilder builder = new JobParametersBuilder();
      builder.addDate("TIMESTAMP", c.getTime());
      JobParameters jobParameters = builder.toJobParameters();

      return jobLauncher.run(job, jobParameters);

    } else {
View Full Code Here

  }

  @Test
  public void testGetProperties() throws Exception {

    JobParameters parameters = new JobParametersBuilder().addDate("schedule.date", dateFormat.parse("01/23/2008"))
        .addString("job.key", "myKey").addLong("vendor.id", new Long(33243243)).addDouble("double.key", 1.23)
        .toJobParameters();

    Properties props = factory.getProperties(parameters);
    assertNotNull(props);
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.