Package org.springframework.batch.core

Examples of org.springframework.batch.core.JobInstance


  @Test
  public void testCreateAndRetrieveWithNullParameter() throws Exception {

    JobParameters jobParameters = new JobParametersBuilder().addString("foo", null).toJobParameters();

    JobInstance fooInstance = dao.createJobInstance(fooJob, jobParameters);
    assertNotNull(fooInstance.getId());
    assertEquals(fooJob, fooInstance.getJobName());

    JobInstance retrievedInstance = dao.getJobInstance(fooJob, jobParameters);
    assertEquals(fooInstance, retrievedInstance);
    assertEquals(fooJob, retrievedInstance.getJobName());
  }
View Full Code Here


   */
  @Transactional
  @Test
  public void testCreateAndGetById() throws Exception {

    JobInstance fooInstance = dao.createJobInstance(fooJob, fooParams);
    assertNotNull(fooInstance.getId());
    assertEquals(fooJob, fooInstance.getJobName());

    JobInstance retrievedInstance = dao.getJobInstance(fooInstance.getId());
    assertEquals(fooInstance, retrievedInstance);
    assertEquals(fooJob, retrievedInstance.getJobName());
  }
View Full Code Here

    return null;
  }

  private void checkRepository(BatchStatus status, ExitStatus exitStatus) {
    // because map DAO stores in memory, it can be checked directly
    JobInstance jobInstance = jobExecution.getJobInstance();
    JobExecution other = jobExecutionDao.findJobExecutions(jobInstance).get(0);
    assertEquals(jobInstance.getId(), other.getJobId());
    assertEquals(status, other.getStatus());
    if (exitStatus != null) {
      assertEquals(exitStatus.getExitCode(), other.getExitStatus().getExitCode());
    }
  }
View Full Code Here

   */
  @Transactional
  @Test
  public void testGetMissingById() throws Exception {

    JobInstance retrievedInstance = dao.getJobInstance(1111111L);
    assertNull(retrievedInstance);

  }
View Full Code Here

    List<JobInstance> jobInstances = dao.getJobInstances(multiInstanceJob, startIndex, queryCount);

    assertEquals(queryCount, jobInstances.size());

    for (int i = 0; i < queryCount; i++) {
      JobInstance returnedInstance = jobInstances.get(i);
      assertEquals(multiInstanceJob, returnedInstance.getJobName());
      assertEquals(Integer.valueOf(0), returnedInstance.getVersion());

      //checks the correct instances are returned and the order is descending
      //      assertEquals(instanceCount - startIndex - i , returnedInstance.getJobParameters().getLong(paramKey));
    }
View Full Code Here

  @Transactional
  @Test
  public void testCreationAddsVersion() {

    JobInstance jobInstance = new JobInstance((long) 1, "testVersionAndId");

    assertNull(jobInstance.getVersion());

    jobInstance = dao.createJobInstance("testVersion", new JobParameters());

    assertNotNull(jobInstance.getVersion());
  }
View Full Code Here

  }

  @Before
  public void setup() {
    JobSynchronizationManager.release();
    jobExecution = new JobExecution(new JobInstance(5l, "JOB"), null, null);
  }
View Full Code Here

  /*
   * Find all dependencies for a JobExecution, including JobInstance (which
   * requires JobParameters) plus StepExecutions
   */
  private void getJobExecutionDependencies(JobExecution jobExecution) {
    JobInstance jobInstance = jobInstanceDao.getJobInstance(jobExecution);
    stepExecutionDao.addStepExecutions(jobExecution);
    jobExecution.setJobInstance(jobInstance);
    jobExecution.setExecutionContext(ecDao.getExecutionContext(jobExecution));

  }
View Full Code Here

  @Transactional
  @Test
  public void testFindJobInstanceByExecution() {

    JobParameters jobParameters = new JobParameters();
    JobInstance jobInstance = dao.createJobInstance("testInstance",
        jobParameters);
    JobExecution jobExecution = new JobExecution(jobInstance, 2L, jobParameters, null);
    jobExecutionDao.saveJobExecution(jobExecution);

    JobInstance returnedInstance = dao.getJobInstance(jobExecution);
    assertEquals(jobInstance, returnedInstance);
  }
View Full Code Here

    taskletStep.setTasklet(new ExceptionTasklet());
    jobRepository = new UpdateCountingJobRepository();
    taskletStep.setJobRepository(jobRepository);
    taskletStep.setTransactionManager(new ResourcelessTransactionManager());

    JobInstance jobInstance = new JobInstance(1L, "testJob");
    JobExecution jobExecution = new JobExecution(jobInstance, new JobParameters());
    stepExecution = new StepExecution("testStep", jobExecution);
  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.JobInstance

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.