Examples of JobParametersBuilder


Examples of org.springframework.batch.core.JobParametersBuilder

  @Test
  public void testLaunchTwoJobs() throws Exception {
    int before = SimpleJdbcTestUtils.countRowsInTable(jdbcTemplate, "BATCH_STEP_EXECUTION");
    long count = 0;
    JobExecution jobExecution1 = jobLauncher.run(job1, new JobParametersBuilder(jobParameters).addLong("run.id", count++)
        .toJobParameters());
    JobExecution jobExecution2 = jobLauncher.run(job1, new JobParametersBuilder(jobParameters).addLong("run.id", count++)
        .toJobParameters());
    assertEquals(BatchStatus.COMPLETED, jobExecution1.getStatus());
    assertEquals(BatchStatus.COMPLETED, jobExecution2.getStatus());
    int after = SimpleJdbcTestUtils.countRowsInTable(jdbcTemplate, "BATCH_STEP_EXECUTION");
    assertEquals(before + 2, after);
View Full Code Here

Examples of org.springframework.batch.core.JobParametersBuilder

        JobController.class);
    assertEquals(1, beanNames.length);

    Job job = context.getBean(JobRegistry.class).getJob("job1");
    final JobExecution jobExecution = parent.getBean(JobLauncher.class).run(job,
        new JobParametersBuilder().addString("fail", "false").toJobParameters());

    new DirectPoller<BatchStatus>(100).poll(new Callable<BatchStatus>() {
      public BatchStatus call() throws Exception {
        BatchStatus status = jobExecution.getStatus();
        if (status.isLessThan(BatchStatus.STOPPED) && status!=BatchStatus.COMPLETED) {
View Full Code Here

Examples of org.springframework.batch.core.JobParametersBuilder

  }
 
  @Test
  public void testResourceConverter() throws Exception {
    FileInfo info = service.createFile("foo/crap");
    JobExecution jobExecution = jobLauncher.run(job, new JobParametersBuilder().addString("input.file", "files://"+info.getPath()).toJobParameters());
    assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
  }
View Full Code Here

Examples of org.springframework.batch.core.JobParametersBuilder

  public void testLaunchFromSimpleRequestString() throws Exception {

    TestMessagingGateway gateway = new TestMessagingGateway(requests, replies);


    JobLaunchRequest jobLaunchRequest = new JobLaunchRequest(job, new JobParametersBuilder().addString(
        "input.file", "classpath:data/test.txt").addLong("timestamp", System.currentTimeMillis())
        .toJobParameters());

    JobExecution result = (JobExecution) gateway.sendAndReceive(jobLaunchRequest);
View Full Code Here

Examples of org.springframework.batch.core.JobParametersBuilder

  @DirtiesContext
  public void testSmallLaunch() throws Exception {

    int before = jdbcTemplate.queryForInt("SELECT COUNT(1) from LEAD_INPUTS");

    JobParameters jobParameters = new JobParametersBuilder().addString("input.file", "classpath:data/test.txt")
        .addLong("timestamp", System.currentTimeMillis()).toJobParameters();
    JobExecution jobExecution = jobLauncher.run(job, jobParameters);

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

Examples of org.springframework.batch.core.JobParametersBuilder

  private JobExplorer jobExplorer;

  @Test
  public void testLaunch() throws Exception {
    jobRepositoryTestUtils.removeJobExecutions();
    jobLauncher.run(job, new JobParametersBuilder().addLong("timestamp", System.currentTimeMillis())
        .toJobParameters());
  }
View Full Code Here

Examples of org.springframework.batch.core.JobParametersBuilder

  public void testLaunchWithJobRunning() throws Exception {
    JobExecution jobExecution;
    jobExecution = jobRepositoryTestUtils.createJobExecutions("test-job", new String[0], 1).get(0);

    try {
      jobLauncher.run(job, new JobParametersBuilder().addLong("timestamp", System.currentTimeMillis())
          .toJobParameters());
      fail("Expected: JobExecutionAlreadyRunningException");
    }
    catch (JobExecutionAlreadyRunningException e) {
      // expected
View Full Code Here

Examples of org.springframework.batch.core.JobParametersBuilder

    List<JobExecution> list = new ArrayList<JobExecution>(jobRepositoryTestUtils.createJobExecutions("test-job",
        new String[0], 1));

    try {
      jobLauncher.run(job, new JobParametersBuilder().addLong("timestamp", System.currentTimeMillis())
          .toJobParameters());
      fail("Expected: JobExecutionAlreadyRunningException");
    }
    catch (JobExecutionAlreadyRunningException e) {
      // expected
View Full Code Here

Examples of org.springframework.batch.core.JobParametersBuilder

    jobRepositoryTestUtils.removeJobExecutions();

    List<JobExecution> list = new ArrayList<JobExecution>(jobRepositoryTestUtils.createJobExecutions("test-job",
        new String[0], 1));

    JobParameters jobParameters = new JobParametersBuilder().addLong("timestamp", System.currentTimeMillis())
        .toJobParameters();
    try {
      // Simulate a job starting without using jobLauncher
      jobRepository.createJobExecution("test-job", jobParameters);
      fail("Expected: JobExecutionAlreadyRunningException");
View Full Code Here

Examples of org.springframework.batch.core.JobParametersBuilder

  }

  @Test
  @DirtiesContext
  public void testSkipsInWriter() throws Exception {
    JobExecution jobExecution = jobLauncher.run(job, new JobParametersBuilder().addString("item.three", "fail")
        .addLong("run.id", 1L).toJobParameters());
    // System.err.println(new SimpleJdbcTemplate(dataSource).queryForList("SELECT * FROM INT_MESSAGE_GROUP"));
    assertEquals(BatchStatus.COMPLETED, jobExecution.getStatus());
    StepExecution stepExecution = jobExecution.getStepExecutions().iterator().next();
    assertEquals(9, stepExecution.getReadCount());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.