Package org.springframework.batch.core.job

Examples of org.springframework.batch.core.job.JobSupport


  /**
   * Test method for {@link org.springframework.batch.core.configuration.support.MapJobRegistry#getJobNames()}.
   * @throws Exception
   */
  public void testGetJobConfigurations() throws Exception {
    JobFactory jobFactory = new ReferenceJobFactory(new JobSupport("foo"));
    registry.register(jobFactory);
    registry.register(new ReferenceJobFactory(new JobSupport("bar")));
    Collection<String> configurations = registry.getJobNames();
    assertEquals(2, configurations.size());
    assertTrue(configurations.contains(jobFactory.getJobName()));
  }
View Full Code Here


    jobRepository = new SimpleJobRepository(jobInstanceDao, jobExecutionDao, stepExecutionDao, ecDao);

    jobParameters = new JobParametersBuilder().toJobParameters();

    job = new JobSupport();
    job.setBeanName("RepositoryTest");
    job.setRestartable(true);

    stepConfiguration1 = new StepSupport("TestStep1");
View Full Code Here

  }

  @Test
  public void testRunRestartableJobInstanceTwice() throws Exception {
    job = new JobSupport("foo") {
      @Override
      public boolean isRestartable() {
        return true;
      }
View Full Code Here

   * Non-restartable JobInstance can be run only once - attempt to run
   * existing non-restartable JobInstance causes error.
   */
  @Test
  public void testRunNonRestartableJobInstanceTwice() throws Exception {
    job = new JobSupport("foo") {
      @Override
      public boolean isRestartable() {
        return false;
      }

View Full Code Here

  }

  @Test
  public void testRunWithException() throws Exception {
    job = new JobSupport() {
      @Override
      public void execute(JobExecution execution) {
        execution.setExitStatus(ExitStatus.FAILED);
        throw new RuntimeException("foo");
      }
View Full Code Here

    }
  }

  @Test
  public void testRunWithError() throws Exception {
    job = new JobSupport() {
      @Override
      public void execute(JobExecution execution) {
        execution.setExitStatus(ExitStatus.FAILED);
        throw new Error("foo");
      }
View Full Code Here

    template.setCompletionPolicy(new SimpleCompletionPolicy(1));

    step = getStep(new String[] { "foo", "bar", "spam" });
    step.setStepOperations(template);

    job = new JobSupport("FOO");
    jobInstance = new JobInstance(0L, job.getName());
    jobParameters = new JobParameters();

    step.setTransactionManager(transactionManager);
View Full Code Here

    // Only process one item:
    chunkOperations = new RepeatTemplate();
    chunkOperations.setCompletionPolicy(new SimpleCompletionPolicy(1));

    job = new JobSupport("FOO");

    TaskExecutorRepeatTemplate repeatTemplate = new TaskExecutorRepeatTemplate();
    repeatTemplate.setThrottleLimit(2);
    repeatTemplate.setTaskExecutor(new SimpleAsyncTaskExecutor());
    step.setStepOperations(repeatTemplate);
View Full Code Here

  private void configureStep(TaskletStep step) throws JobExecutionAlreadyRunningException, JobRestartException,
  JobInstanceAlreadyCompleteException {

    this.step = step;
    JobSupport job = new JobSupport();
    job.addStep(step);
    job.setBeanName("testJob");
    jobExecution = jobRepository.createJobExecution(job.getName(), new JobParameters());
    step.setJobRepository(jobRepository);
    step.setTransactionManager(new ResourcelessTransactionManager());
    itemWriter = new ItemWriter<Object>() {
      @Override
      public void write(List<? extends Object> item) throws Exception {
View Full Code Here

    // Only process one item:
    chunkOperations = new RepeatTemplate();
    chunkOperations.setCompletionPolicy(new SimpleCompletionPolicy(1));

    job = new JobSupport("FOO");

    step.setTransactionManager(transactionManager);

  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.job.JobSupport

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.