Examples of StepSupport


Examples of org.springframework.batch.core.step.StepSupport

  protected void setUp() throws Exception {

    JobParameters jobParameters = new JobParametersBuilder().addLong("commit.interval", 2L).toJobParameters();
    jobInstance = new JobInstance(new Long(0), "testJob");
    JobExecution jobExecution = new JobExecution(jobInstance, jobParameters);
    Step step = new StepSupport("bar");
    stepExecution = jobExecution.createStepExecution(step.getName());
    policy.beforeStep(stepExecution);

  }
View Full Code Here

Examples of org.springframework.batch.core.step.StepSupport

    fb.setListeners(new StepListener[] { new StepExecutionListenerSupport() });
    fb.setTaskExecutor(new SyncTaskExecutor());

    SimplePartitioner partitioner = new SimplePartitioner();
    fb.setPartitioner(partitioner);
    fb.setStep(new StepSupport("foo"));

    Object step = fb.getObject();
    assertTrue(step instanceof PartitionStep);
    Object handler = ReflectionTestUtils.getField(step, "partitionHandler");
    assertTrue(handler instanceof TaskExecutorPartitionHandler);
View Full Code Here

Examples of org.springframework.batch.core.step.StepSupport

    fb.setTaskExecutor(new SyncTaskExecutor());

    SimplePartitioner partitioner = new SimplePartitioner();
    fb.setPartitioner(partitioner);
    TaskExecutorPartitionHandler partitionHandler = new TaskExecutorPartitionHandler();
    partitionHandler.setStep(new StepSupport("foo"));
    ProxyFactory factory = new ProxyFactory(partitionHandler);
    fb.setPartitionHandler((PartitionHandler) factory.getProxy());

    Object step = fb.getObject();
    assertTrue(step instanceof PartitionStep);
View Full Code Here

Examples of org.springframework.batch.core.step.StepSupport

   */
  @Transactional
  @Test
  public void testGetStepExecutionCountAndLastStepExecution() throws Exception {
    job.setRestartable(true);
    StepSupport step = new StepSupport("restartedStep");

    // first execution
    JobExecution firstJobExec = jobRepository.createJobExecution(job.getName(), jobParameters);
    StepExecution firstStepExec = new StepExecution(step.getName(), firstJobExec);
    jobRepository.add(firstStepExec);

    assertEquals(1, jobRepository.getStepExecutionCount(firstJobExec.getJobInstance(), step.getName()));
    assertEquals(firstStepExec, jobRepository.getLastStepExecution(firstJobExec.getJobInstance(), step.getName()));

    // first execution failed
    firstJobExec.setStartTime(new Date(4));
    firstStepExec.setStartTime(new Date(5));
    firstStepExec.setStatus(BatchStatus.FAILED);
    firstStepExec.setEndTime(new Date(6));
    jobRepository.update(firstStepExec);
    firstJobExec.setStatus(BatchStatus.FAILED);
    firstJobExec.setEndTime(new Date(7));
    jobRepository.update(firstJobExec);

    // second execution
    JobExecution secondJobExec = jobRepository.createJobExecution(job.getName(), jobParameters);
    StepExecution secondStepExec = new StepExecution(step.getName(), secondJobExec);
    jobRepository.add(secondStepExec);

    assertEquals(2, jobRepository.getStepExecutionCount(secondJobExec.getJobInstance(), step.getName()));
    assertEquals(secondStepExec, jobRepository.getLastStepExecution(secondJobExec.getJobInstance(), step.getName()));
  }
View Full Code Here

Examples of org.springframework.batch.core.step.StepSupport

  @Before
  public void onSetUp() throws Exception {
    repository = getJobRepository();
    jobExecution = repository.createJobExecution("job", new JobParameters());
    jobInstance = jobExecution.getJobInstance();
    step = new StepSupport("foo");
    stepExecution = new StepExecution(step.getName(), jobExecution);
    dao = getStepExecutionDao();
  }
View Full Code Here

Examples of org.springframework.batch.core.step.StepSupport

      }
    };
    JobExecution jobExec = jobRepository.createJobExecution(job.getName(), jobParameters);
    jobExec.setStartTime(new Date(0));
    jobExec.setExecutionContext(ctx);
    Step step = new StepSupport("step1");
    StepExecution stepExec = new StepExecution(step.getName(), jobExec);
    stepExec.setExecutionContext(ctx);

    jobRepository.add(stepExec);

    StepExecution retrievedStepExec = jobRepository.getLastStepExecution(jobExec.getJobInstance(), step.getName());
    assertEquals(stepExec, retrievedStepExec);
    assertEquals(ctx, retrievedStepExec.getExecutionContext());

    // JobExecution retrievedJobExec =
    // jobRepository.getLastJobExecution(jobExec.getJobInstance());
View Full Code Here

Examples of org.springframework.batch.core.step.StepSupport

   * match the version of persisted entity.
   */
  @Transactional
  @Test
  public void testConcurrentModificationException() {
    step = new StepSupport("foo");

    StepExecution exec1 = new StepExecution(step.getName(), jobExecution);
    dao.saveStepExecution(exec1);

    StepExecution exec2 = new StepExecution(step.getName(), jobExecution);
View Full Code Here

Examples of org.springframework.batch.core.step.StepSupport

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

    stepConfiguration1 = new StepSupport("TestStep1");

    stepConfiguration2 = new StepSupport("TestStep2");

    List<Step> stepConfigurations = new ArrayList<Step>();
    stepConfigurations.add(stepConfiguration1);
    stepConfigurations.add(stepConfiguration2);
View Full Code Here

Examples of org.springframework.batch.core.step.StepSupport

    assertEquals("bar", execution.getExecutionContext().getString("foo"));
  }

  @Test
  public void testEqualsWithSameName() throws Exception {
    Step step = new StepSupport("stepName");
    Entity stepExecution1 = newStepExecution(step,11L,4L);
    Entity stepExecution2 = newStepExecution(step,11L,5L);
    assertFalse(stepExecution1.equals(stepExecution2));
  }
View Full Code Here

Examples of org.springframework.batch.core.step.StepSupport

    assertFalse(stepExecution1.equals(stepExecution2));
  }

  @Test
  public void testEqualsWithSameIdentifier() throws Exception {
    Step step = new StepSupport("stepName");
    Entity stepExecution1 = newStepExecution(step, new Long(11));
    Entity stepExecution2 = newStepExecution(step, new Long(11));
    assertEquals(stepExecution1, stepExecution2);
  }
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.