Package org.springframework.batch.core

Examples of org.springframework.batch.core.JobInstance


    stepConfigurations.add(stepConfiguration1);
    stepConfigurations.add(stepConfiguration2);

    job.setSteps(stepConfigurations);

    jobInstance = new JobInstance(1L, job.getName());

    databaseStep1 = "dbStep1";
    databaseStep2 = "dbStep2";

    steps = new ArrayList<String>();
    steps.add(databaseStep1);
    steps.add(databaseStep2);

    jobExecution = new JobExecution(new JobInstance(1L, job.getName()), 1L, jobParameters, null);
  }
View Full Code Here


  }

  @Test
  public void testUpdateValidJobExecution() throws Exception {

    JobExecution jobExecution = new JobExecution(new JobInstance(1L, job.getName()), 1L, jobParameters, null);
    // new execution - call update on job DAO
    jobExecutionDao.updateJobExecution(jobExecution);
    jobRepository.update(jobExecution);
    assertNotNull(jobExecution.getLastUpdated());
  }
View Full Code Here

  }

  @Transactional @Test
  public void testFindNonExistentJob() {
    // No job should be found since it hasn't been created.
    JobInstance jobInstance = jobInstanceDao.getJobInstance("nonexistentJob", jobParameters);
    assertNull(jobInstance);
  }
View Full Code Here

    assertNull(jobInstance);
  }

  @Transactional @Test
  public void testFindJob() {
    JobInstance instance = jobInstanceDao.getJobInstance(jobName, jobParameters);
    assertNotNull(instance);
    assertTrue(jobInstance.equals(instance));
  }
View Full Code Here

    // Modifying the key should bring back a completely different
    // JobInstance
    JobParameters tempProps = new JobParametersBuilder().addString("job.key", "testKey1").toJobParameters();

    JobInstance instance;
    instance = jobInstanceDao.getJobInstance(scheduledJob, jobParameters);
    assertNotNull(instance);

    instance = jobInstanceDao.getJobInstance(scheduledJob, tempProps);
    assertNull(instance);
View Full Code Here

    String testDefaultJob = "testDefault";
    // Create job.
    jobInstance = jobInstanceDao.createJobInstance(testDefaultJob, jobParameters);

    JobInstance instance = jobInstanceDao.getJobInstance(testDefaultJob, jobParameters);

    assertNotNull(instance);
  }
View Full Code Here

      public int update(String sql, Object[] args, int[] argTypes) throws DataAccessException {
        list.add(sql);
        return 1;
      }
    });
    JobExecution jobExecution = new JobExecution(new JobInstance(new Long(11), "testJob"), new JobParameters());

    jobExecutionDao.saveJobExecution(jobExecution);
    assertEquals(1, list.size());
    String query = list.get(0);
    assertTrue("Query did not contain FOO_:" + query, query.indexOf("FOO_") >= 0);
View Full Code Here

  JobRestartException, StartLimitExceededException {
    if (execution.isStopping()) {
      throw new JobInterruptedException("JobExecution interrupted.");
    }

    JobInstance jobInstance = execution.getJobInstance();

    StepExecution lastStepExecution = jobRepository.getLastStepExecution(jobInstance, step.getName());
    if (stepExecutionPartOfExistingJobExecution(execution, lastStepExecution)) {
      // If the last execution of this step was in the same job, it's
      // probably intentional so we want to run it again...
      logger.info(String.format("Duplicate step [%s] detected in execution of job=[%s]. "
          + "If either step fails, both will be executed again on restart.", step.getName(), jobInstance
          .getJobName()));
      lastStepExecution = null;
    }
    StepExecution currentStepExecution = lastStepExecution;
View Full Code Here

  /* (non-Javadoc)
   * @see org.springframework.batch.container.common.repository.JobRepository#findOrCreateJob(org.springframework.batch.container.common.domain.JobConfiguration)
   */
  @Override
  public JobExecution createJobExecution(String jobName, JobParameters jobParameters) {
    JobInstance jobInstance = new JobInstance(0L, jobName);
    return new JobExecution(jobInstance, 11L, jobParameters, null);
  }
View Full Code Here

      }
    };

    testRun();
    when(jobRepository.getLastJobExecution(job.getName(), jobParameters)).thenReturn(
        new JobExecution(new JobInstance(1L, job.getName()), jobParameters));
    when(jobRepository.createJobExecution(job.getName(), jobParameters)).thenReturn(
        new JobExecution(new JobInstance(1L, job.getName()), jobParameters));
    jobLauncher.run(job, jobParameters);
  }
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.