Package org.springframework.batch.core

Examples of org.springframework.batch.core.Job


    // Tests

    @Test
    public void shouldInjectJobToEndpoint() throws IllegalAccessException {
        SpringBatchEndpoint batchEndpoint = getMandatoryEndpoint("spring-batch:mockJob", SpringBatchEndpoint.class);
        Job batchEndpointJob = (Job) FieldUtils.readField(batchEndpoint, "job", true);
        assertSame(job, batchEndpointJob);
    }
View Full Code Here


    // Tests

    @Test
    public void shouldInjectJobToEndpoint() throws IllegalAccessException {
        SpringBatchEndpoint batchEndpoint = getMandatoryEndpoint("spring-batch:mockJob", SpringBatchEndpoint.class);
        Job batchEndpointJob = (Job) FieldUtils.readField(batchEndpoint, "job", true);
        assertSame(job, batchEndpointJob);
    }
View Full Code Here

    private Map<String, JobLauncher> allResolvedJobLaunchers;

    @Override
    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
        Job resolvedJob = CamelContextHelper.mandatoryLookup(getCamelContext(), remaining, Job.class);
        SpringBatchEndpoint endpoint = new SpringBatchEndpoint(uri, this, jobLauncher, defaultResolvedJobLauncher, allResolvedJobLaunchers, resolvedJob);
        setProperties(endpoint, parameters);
        return endpoint;
    }
View Full Code Here

    public void testRunJob() throws Exception {
        SimpleJobLauncher launcher = new SimpleJobLauncher();
        launcher.setJobRepository(new TestDummyJobRepository());
        launcher.afterPropertiesSet();

        Job job = new TestDummyJob("testRunJob");
        JobExecution execution = launcher.run(job, new JobParameters());
        assertNotNull("No job exectuion instance", execution);

        String jobName = job.getName();
        Operation op = assertOperationDetails(getFirstEntered(), "run", job.getName());
        assertOperationPath(op, jobName, null);
    }
View Full Code Here

        super();
    }

    @Test
    public void testExecute() {
        Job job = new TestDummyJob("testExecute");
        String jobName = job.getName();
        job.execute(TestDummyJobRepository.createJobExecutionInstance(jobName));

        Operation op = assertOperationDetails(getLastEntered(), "execute", jobName);
        assertOperationPath(op, jobName, null);
    }
View Full Code Here

        AbstractApplicationContext context = new ClassPathXmlApplicationContext("classpath:/META-INF/spring/*-context.xml");
        log.info("Batch Tweet Influencers Hive Job Running");
        context.registerShutdownHook();

        JobLauncher jobLauncher = context.getBean(JobLauncher.class);
        Job job = context.getBean(Job.class);
        jobLauncher.run(job, new JobParameters());

    }
View Full Code Here

   * ATTENTION!!! KEEP ORDER OF IMPORT METHODS!!!! FIRST DELETE AND THEN IMPORT!
   */

  @Bean
  public Job deleteAllDataJob() throws NoSuchJobException {
    final Job job = jobBuilders.get("deleteAllDataJob").incrementer(new RunIdIncrementer()).start(deleteContract()).next(deleteApprentice())
        .next(deleteCompanyOccupationCombination()).next(deleteCompany()).next(deleteOffice()).next(deleteRuralDistrict()).next(deleteOccupationCombination())
        .next(deleteDistrict()).next(deleteFocalPoint()).next(deleteOccupation()).next(deleteSpecialisation()).build();
    return job;
  }
View Full Code Here

      long subJobEnabled = jobParameters.getLong(JobConstants.SUB_JOB_ENABLED);
      // sub job launcher
      if (subJobEnabled == 1) {
         if (jobRegistry != null) {
            try {
               Job job = jobRegistry.getJob(jobName);
               if (job != null) {
                  jobRegistry.unregister(jobName);
                  logger.info("unregistered sub job launcher. " + jobName);
               }
            } catch (NoSuchJobException e) {
View Full Code Here

    * @return jobExecution id
    * @throws Exception
    */
   public long runJob(String jobName, JobParameters param) throws Exception {
      // TODO handle errors
      Job job = jobRegistry.getJob(jobName);
      return jobLauncher.run(job, param).getId();
   }
View Full Code Here

            + subJobName);
      long result = Long.MIN_VALUE;
      JobParameter clusterNameParameter =
            param.getParameters().get(JobConstants.CLUSTER_NAME_JOB_PARAM);
      String clusterName = (String) clusterNameParameter.getValue();
      Job preparingJob = jobRegistry.getJob(jobName);
      JobExecution preparingJobExecution = jobLauncher.run(preparingJob, param);
      int subJobNumber = 0;
      waitJobExecution(preparingJobExecution.getId(), Long.MAX_VALUE);
      if (preparingJobExecution.getStatus() == BatchStatus.COMPLETED) {
         subJobNumber =
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.