Package org.springframework.batch.core

Examples of org.springframework.batch.core.Job


            new JobParameter(successStatus.name()));
      mainJobParams.put(JobConstants.CLUSTER_FAILURE_STATUS_JOB_PARAM,
            new JobParameter(failStatus.name()));
      //enable sub job indicator to for job progress query
      mainJobParams.put(JobConstants.SUB_JOB_ENABLED, new JobParameter(1l));
      Job subJob = jobRegistry.getJob(subJobName);
      for (int stepNumber = 0, j = subJobParameters.size(); stepNumber < j; stepNumber++) {
         SubJobStep subJobStep = new SubJobStep();
         subJobStep.setName(subJobName + "-subJobStep-" + stepNumber);
         subJobStep.setJob(subJob);
         subJobStep.setJobParametersExtractor(jobParametersExtractor);
View Full Code Here


   * @see StepLocator#getStep(String)
   */
  public Step getStep(String path) throws NoSuchStepException {
    String jobName = path.substring(0, path.indexOf("/"));
    String stepName = path.substring(jobName.length() + 1);
    Job job;
    try {
      job = jobLocator.getJob(jobName);
    }
    catch (NoSuchJobException e) {
      throw new NoSuchStepException("No step could be located because no job was found with name=" + jobName);
View Full Code Here

   * @see StepLocator#getStepNames()
   */
  public Collection<String> getStepNames() {
    Collection<String> result = new HashSet<String>();
    for (String jobName : jobLocator.getJobNames()) {
      Job job;
      try {
        job = jobLocator.getJob(jobName);
      }
      catch (NoSuchJobException e) {
        throw new IllegalStateException("Job not found although it was listed with name=" + jobName);
View Full Code Here

  public JobLaunchRequest adapt(String request) throws NoSuchJobException {
    request = request.trim();
    Assert.isTrue(request.matches(PATTERN), "Input in wrong format ("
        + request + "): use jobname([(key=value(,key=value)*])");
    String jobName = request.replaceAll(PATTERN, "$1");
    Job job = jobLocator.getJob(jobName);
    String paramsText = request.replaceAll(PATTERN, "$3");
    JobParameters jobParameters = converter.getJobParameters(StringUtils
        .splitArrayElementsIntoProperties(paramsText.split(","), "="));
    return new JobLaunchRequest(job, jobParameters);
  }
View Full Code Here

  @ServiceActivator
  public JobLaunchRequest adapt(String jobName) throws NoSuchJobException,
  JobParametersNotFoundException {
    jobName = jobName.trim();
    Job job = jobLocator.getJob(jobName);
    JobParameters jobParameters = getLastFailedJobParameters(jobName);
    return new JobLaunchRequest(job, jobParameters);
  }
View Full Code Here

   * Test method for {@link SimpleJobService#launch(String, JobParameters)}.
   */
  @Test
  public void testLaunch() throws Exception {
    JobParameters jobParameters = new JobParameters();
    Job job = new JobSupport("job");
    EasyMock.expect(jobLocator.getJob("job")).andReturn(job);
    EasyMock.expect(jobLauncher.run(job, jobParameters)).andReturn(MetaDataInstanceFactory.createJobExecution());
    EasyMock.replay(jobLauncher, jobLocator);
    assertNotNull(service.launch("job", jobParameters));
    EasyMock.verify(jobLauncher, jobLocator);
View Full Code Here

   */
  @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();
      }
    };
View Full Code Here

   * Test method for {@link SimpleJobService#launch(String, JobParameters)}.
   */
  @Test
  public void testLaunchFailedExecution() throws Exception {
    JobParameters jobParameters = new JobParameters();
    Job job = new JobSupport("job") {
      @Override
      public JobParametersIncrementer getJobParametersIncrementer() {
        return new RunIdIncrementer();
      }
    };
View Full Code Here

    JobExecution jobExecution = MetaDataInstanceFactory.createJobExecution();
    EasyMock.expect(jobExecutionDao.getJobExecution(123L)).andReturn(jobExecution);
    EasyMock.expect(jobInstanceDao.getJobInstance(jobExecution)).andReturn(
        MetaDataInstanceFactory.createJobInstance());
    JobParameters jobParameters = new JobParameters();
    Job job = new JobSupport("job");
    EasyMock.expect(jobLocator.getJob("job")).andReturn(job);
    EasyMock.expect(jobLauncher.run(job, jobParameters))
    .andReturn(MetaDataInstanceFactory.createJobExecution(124L));
    EasyMock.replay(jobInstanceDao, jobExecutionDao, jobLauncher, jobLocator);
    assertNotNull(service.restart(123L));
View Full Code Here

    assertTrue(context.containsBean("jobRepository"));
    String[] beanNames = BeanFactoryUtils.beanNamesForTypeIncludingAncestors(context.getBeanFactory(),
        JobController.class);
    assertEquals(1, beanNames.length);

    Job job = context.getBean(JobRegistry.class).getJob("job1");
    final JobExecution jobExecution = parent.getBean(JobLauncher.class).run(job,
        new JobParametersBuilder().addString("fail", "false").toJobParameters());

    new DirectPoller<BatchStatus>(100).poll(new Callable<BatchStatus>() {
      public BatchStatus call() throws Exception {
View Full Code Here

TOP

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

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.