Package org.springframework.batch.core.launch.support

Examples of org.springframework.batch.core.launch.support.RunIdIncrementer


    job = jobs.get("job").start(steps.get("step").tasklet(new Tasklet() {
      @Override
      public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
        throw new RuntimeException("Planned");
      }
    }).build()).incrementer(new RunIdIncrementer()).build();
    runner.executeJob(job, new JobParameters());
    runner.executeJob(job, new JobParameters());
    assertEquals(1, jobExplorer.getJobInstances("job", 0, 100).size());
  }
View Full Code Here


    job = jobs.get("job").start(this.steps.get("step").tasklet(new Tasklet() {
      @Override
      public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception {
        throw new RuntimeException("Planned");
      }
    }).build()).incrementer(new RunIdIncrementer()).build();
    JobParameters jobParameters = new JobParametersBuilder().addLong("id", 1L, false).toJobParameters();
    runner.executeJob(job, jobParameters);
    runner.executeJob(job, jobParameters);
    assertEquals(1, jobExplorer.getJobInstances("job", 0, 100).size());
  }
View Full Code Here

    jobProperties.setName("job");
    jobProperties.setNext(true);
    yarnBatchProperties.setJobs(new ArrayList<YarnBatchProperties.JobProperties>(Arrays.asList(jobProperties)));
    runner.setYarnBatchProperties(yarnBatchProperties);

    job = jobs.get("job").start(step).incrementer(new RunIdIncrementer()).build();
    runner.executeJob(job, new JobParameters());
    runner.executeJob(job, new JobParameters());
    assertEquals(2, jobExplorer.getJobInstances("job", 0, 100).size());
  }
View Full Code Here

   * ATTENTION!!! KEEP ORDER OF IMPORT METHODS!!!! FIRST DELETE AND THEN IMPORT!
   */

  @Bean
  public Job deleteAllDataJob() throws NoSuchJobException {
    final Job job = jobBuilders.get("deleteAllDataJob").incrementer(new RunIdIncrementer()).start(deleteContract()).next(deleteApprentice())
        .next(deleteCompanyOccupationCombination()).next(deleteCompany()).next(deleteOffice()).next(deleteRuralDistrict()).next(deleteOccupationCombination())
        .next(deleteDistrict()).next(deleteFocalPoint()).next(deleteOccupation()).next(deleteSpecialisation()).build();
    return job;
  }
View Full Code Here

    return job;
  }

  @Bean
  public Job importDataJob() throws NoSuchJobException {
    return jobBuilders.get("importDataJob").incrementer(new RunIdIncrementer()).start(importOccupation()).next(importFocalPoint()).next(importSpecialisation())
        .next(importDistrict()).next(importRuralDistrict()).next(importApprentice()).next(importOffice()).next(importCompany())
        .next(importOccupationCombination()).next(importCompanyOccupationCombination()).next(importContract()).build();
  }
View Full Code Here

   * Test method for {@link SimpleJobService#isIncrementable(String)}.
   */
  @Test
  public void testIsIncementable() throws Exception {
    EasyMock.expect(jobLocator.getJobNames()).andReturn(Arrays.asList("foo", "bar")).anyTimes();
    EasyMock.expect(jobLocator.getJob("foo")).andReturn(new JobSupport("foo", new RunIdIncrementer())).anyTimes();
    EasyMock.replay(jobLauncher, jobLocator);
    assertTrue(service.isIncrementable("foo"));
    assertFalse(service.isIncrementable("job"));
    EasyMock.verify(jobLauncher, jobLocator);
  }
View Full Code Here

   * Test method for {@link SimpleJobService#launch(String, JobParameters)}.
   */
  @Test
  public void testLaunchWithIncrementer() throws Exception {
    JobParameters jobParameters = new JobParameters();
    JobParameters nextJobParameters = new RunIdIncrementer().getNext(jobParameters);
    Job job = new JobSupport("job") {
      @Override
      public JobParametersIncrementer getJobParametersIncrementer() {
        return new RunIdIncrementer();
      }
    };
    EasyMock.expect(jobLocator.getJob("job")).andReturn(job);
    EasyMock.expect(jobLauncher.run(job, nextJobParameters)).andReturn(MetaDataInstanceFactory.createJobExecution());
    EasyMock.replay(jobLauncher, jobLocator);
View Full Code Here

  public void testLaunchFailedExecution() throws Exception {
    JobParameters jobParameters = new JobParameters();
    Job job = new JobSupport("job") {
      @Override
      public JobParametersIncrementer getJobParametersIncrementer() {
        return new RunIdIncrementer();
      }
    };
    EasyMock.expect(jobLocator.getJob("job")).andReturn(job);
    JobExecution failed = MetaDataInstanceFactory.createJobExecution();
    failed.setStatus(BatchStatus.FAILED);
View Full Code Here

  }

  @Test
  public void incrementExistingExecution() throws Exception {
    this.job = this.jobs.get("job").start(this.step)
        .incrementer(new RunIdIncrementer()).build();
    this.runner.execute(this.job, new JobParameters());
    this.runner.execute(this.job, new JobParameters());
    assertEquals(2, this.jobExplorer.getJobInstances("job", 0, 100).size());
  }
View Full Code Here

          @Override
          public RepeatStatus execute(StepContribution contribution,
              ChunkContext chunkContext) throws Exception {
            throw new RuntimeException("Planned");
          }
        }).build()).incrementer(new RunIdIncrementer()).build();
    this.runner.execute(this.job, new JobParameters());
    this.runner.execute(this.job, new JobParameters());
    assertEquals(1, this.jobExplorer.getJobInstances("job", 0, 100).size());
  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.launch.support.RunIdIncrementer

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.