Java 类org.springframework.batch.core.explore.JobExplorer 实例源码

项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:BatchAutoConfigurationTests.java   
@Test
public void testRenamePrefix() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.datasource.name:batchtest",
            "spring.batch.schema:classpath:batch/custom-schema-hsql.sql",
            "spring.batch.tablePrefix:PREFIX_");
    this.context.register(TestConfiguration.class,
            EmbeddedDataSourceConfiguration.class,
            HibernateJpaAutoConfiguration.class, BatchAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
    assertThat(new JdbcTemplate(this.context.getBean(DataSource.class))
            .queryForList("select * from PREFIX_JOB_EXECUTION")).isEmpty();
    JobExplorer jobExplorer = this.context.getBean(JobExplorer.class);
    assertThat(jobExplorer.findRunningJobExecutions("test")).isEmpty();
    JobRepository jobRepository = this.context.getBean(JobRepository.class);
    assertThat(jobRepository.getLastJobExecution("test", new JobParameters()))
            .isNull();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JobLauncherCommandLineRunnerTests.java   
@Before
public void init() throws Exception {
    this.context.register(BatchConfiguration.class);
    this.context.refresh();
    JobRepository jobRepository = this.context.getBean(JobRepository.class);
    this.jobLauncher = this.context.getBean(JobLauncher.class);
    this.jobs = new JobBuilderFactory(jobRepository);
    PlatformTransactionManager transactionManager = this.context
            .getBean(PlatformTransactionManager.class);
    this.steps = new StepBuilderFactory(jobRepository, transactionManager);
    this.step = this.steps.get("step").tasklet(new Tasklet() {
        @Override
        public RepeatStatus execute(StepContribution contribution,
                ChunkContext chunkContext) throws Exception {
            return null;
        }
    }).build();
    this.job = this.jobs.get("job").start(this.step).build();
    this.jobExplorer = this.context.getBean(JobExplorer.class);
    this.runner = new JobLauncherCommandLineRunner(this.jobLauncher,
            this.jobExplorer);
    this.context.getBean(BatchConfiguration.class).clear();
}
项目:spring-boot-concourse    文件:BatchAutoConfigurationTests.java   
@Test
public void testRenamePrefix() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.datasource.name:batchtest",
            "spring.batch.schema:classpath:batch/custom-schema-hsql.sql",
            "spring.batch.tablePrefix:PREFIX_");
    this.context.register(TestConfiguration.class,
            EmbeddedDataSourceConfiguration.class,
            HibernateJpaAutoConfiguration.class, BatchAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
    assertThat(new JdbcTemplate(this.context.getBean(DataSource.class))
            .queryForList("select * from PREFIX_JOB_EXECUTION")).isEmpty();
    JobExplorer jobExplorer = this.context.getBean(JobExplorer.class);
    assertThat(jobExplorer.findRunningJobExecutions("test")).isEmpty();
    JobRepository jobRepository = this.context.getBean(JobRepository.class);
    assertThat(jobRepository.getLastJobExecution("test", new JobParameters()))
            .isNull();
}
项目:spring-boot-concourse    文件:JobLauncherCommandLineRunnerTests.java   
@Before
public void init() throws Exception {
    this.context.register(BatchConfiguration.class);
    this.context.refresh();
    JobRepository jobRepository = this.context.getBean(JobRepository.class);
    this.jobLauncher = this.context.getBean(JobLauncher.class);
    this.jobs = new JobBuilderFactory(jobRepository);
    PlatformTransactionManager transactionManager = this.context
            .getBean(PlatformTransactionManager.class);
    this.steps = new StepBuilderFactory(jobRepository, transactionManager);
    this.step = this.steps.get("step").tasklet(new Tasklet() {
        @Override
        public RepeatStatus execute(StepContribution contribution,
                ChunkContext chunkContext) throws Exception {
            return null;
        }
    }).build();
    this.job = this.jobs.get("job").start(this.step).build();
    this.jobExplorer = this.context.getBean(JobExplorer.class);
    this.runner = new JobLauncherCommandLineRunner(this.jobLauncher,
            this.jobExplorer);
    this.context.getBean(BatchConfiguration.class).clear();
}
项目:contestparser    文件:BatchAutoConfigurationTests.java   
@Test
public void testRenamePrefix() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
            "spring.datasource.name:batchtest",
            "spring.batch.schema:classpath:batch/custom-schema-hsql.sql",
            "spring.batch.tablePrefix:PREFIX_");
    this.context.register(TestConfiguration.class,
            EmbeddedDataSourceConfiguration.class,
            HibernateJpaAutoConfiguration.class, BatchAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    assertNotNull(this.context.getBean(JobLauncher.class));
    assertEquals(0, new JdbcTemplate(this.context.getBean(DataSource.class))
            .queryForList("select * from PREFIX_JOB_EXECUTION").size());
    JobExplorer jobExplorer = this.context.getBean(JobExplorer.class);
    assertEquals(0, jobExplorer.findRunningJobExecutions("test").size());
    JobRepository jobRepository = this.context.getBean(JobRepository.class);
    assertNull(jobRepository.getLastJobExecution("test", new JobParameters()));
}
项目:GemFireLite    文件:Test1.java   
public static void main(String[] args) throws Exception
{
  ServerConfigHelper.initLog4j("log4j-shell.xml");
  ClassPathXmlApplicationContext ctx = Util.initContext("batch/new-context.xml","batch-file-ac01.xml");
  JobLauncher launch = ctx.getBean(JobLauncher.class);
  JobExplorer epl=ctx.getBean(JobExplorer.class);
  JobRegistry reg =ctx.getBean(JobRegistry.class);
  JobOperator jop=ctx.getBean(JobOperator.class);
  System.out.println(epl.getJobNames()+" "+reg.getJobNames()+" "+jop.toString());



  for(String bn: ctx.getBeanFactory().getBeanDefinitionNames())
  {
    System.out.println(bn);
  }

  ctx.close();
}
项目:composed-task-runner    文件:ComposedRunnerVisitorTests.java   
private Collection<StepExecution> getStepExecutions() {
    JobExplorer jobExplorer = this.applicationContext.getBean(JobExplorer.class);
    List<JobInstance> jobInstances = jobExplorer.findJobInstancesByJobName("job", 0, 1);
    assertEquals(1, jobInstances.size());
    JobInstance jobInstance = jobInstances.get(0);
    List<JobExecution> jobExecutions = jobExplorer.getJobExecutions(jobInstance);
    assertEquals(1, jobExecutions.size());
    JobExecution jobExecution = jobExecutions.get(0);
    return jobExecution.getStepExecutions();
}
项目:spring-batch-support    文件:JobServiceImpl.java   
public JobServiceImpl(JobExplorer jobExplorer, JobOperator jobOperator, JobLauncher jobLauncher, JobRegistry jobRegistry,
                      JobRepository jobRepository) {
    this.jobExplorer = jobExplorer;
    this.jobOperator = jobOperator;
    this.jobLauncher = jobLauncher;
    this.jobRegistry = jobRegistry;
    this.jobRepository = jobRepository;
}
项目:spring-batch-support    文件:BatchConfig.java   
@Bean
public JobService jobService(JobOperator batchJobOperator,
                             JobRegistry batchJobRegistry,
                             JobExplorer jobExplorer,
                             JobLauncher jobLauncher,
                             JobRepository jobRepository) throws Exception {
    return new JobServiceImpl(jobExplorer, batchJobOperator, jobLauncher, batchJobRegistry, jobRepository);
}
项目:spring-batch-support    文件:SpringBatchDefaultServiceConfiguration.java   
@Bean
@ConditionalOnMissingBean(JobExplorer.class)
public JobExplorer getJobExplorer() throws Exception {
    BatchConfigurer batchConfigurer = getBatchConfigurer();
    if (batchConfigurer != null) {
        return batchConfigurer.getJobExplorer();
    }
    JobExplorerFactoryBean jobExplorerFactoryBean = new JobExplorerFactoryBean();
    jobExplorerFactoryBean.setDataSource(dataSource);
    return jobExplorerFactoryBean.getObject();
}
项目:spring-batch-support    文件:SpringBatchDefaultServiceConfiguration.java   
@Bean
@ConditionalOnMissingBean(JobService.class)
public JobService jobService(JobOperator batchJobOperator,
                             JobRegistry batchJobRegistry,
                             JobExplorer jobExplorer,
                             JobLauncher jobLauncher,
                             JobRepository jobRepository) throws Exception {
    return new JobServiceImpl(jobExplorer, batchJobOperator, jobLauncher, batchJobRegistry, jobRepository);
}
项目:spring-batch-admin    文件:RootConfig.java   
@Bean
public JobExplorer jobExplorer() throws Exception {
    JobExplorerFactoryBean factory = new JobExplorerFactoryBean();
    factory.setDataSource(dataSource);
    factory.afterPropertiesSet();
    return factory.getObject();
}
项目:spring-seed    文件:SpringSeedBatchConfig.java   
@Bean
public JobExplorer jobExplorer() throws Exception {
    MapJobExplorerFactoryBean mapJobExplorerFactoryBean = new MapJobExplorerFactoryBean();
    mapJobExplorerFactoryBean.setRepositoryFactory(jobRepository());
    mapJobExplorerFactoryBean.afterPropertiesSet();
    return mapJobExplorerFactoryBean.getObject();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:BasicBatchConfigurer.java   
protected JobExplorer createJobExplorer() throws Exception {
    JobExplorerFactoryBean jobExplorerFactoryBean = new JobExplorerFactoryBean();
    jobExplorerFactoryBean.setDataSource(this.dataSource);
    String tablePrefix = this.properties.getTablePrefix();
    if (StringUtils.hasText(tablePrefix)) {
        jobExplorerFactoryBean.setTablePrefix(tablePrefix);
    }
    jobExplorerFactoryBean.afterPropertiesSet();
    return jobExplorerFactoryBean.getObject();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:BatchAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = "spring.batch.job", name = "enabled", havingValue = "true", matchIfMissing = true)
public JobLauncherCommandLineRunner jobLauncherCommandLineRunner(
        JobLauncher jobLauncher, JobExplorer jobExplorer) {
    JobLauncherCommandLineRunner runner = new JobLauncherCommandLineRunner(
            jobLauncher, jobExplorer);
    String jobNames = this.properties.getJob().getNames();
    if (StringUtils.hasText(jobNames)) {
        runner.setJobNames(jobNames);
    }
    return runner;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:BatchAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(DataSource.class)
public JobExplorer jobExplorer(DataSource dataSource) throws Exception {
    JobExplorerFactoryBean factory = new JobExplorerFactoryBean();
    factory.setDataSource(dataSource);
    String tablePrefix = this.properties.getTablePrefix();
    if (StringUtils.hasText(tablePrefix)) {
        factory.setTablePrefix(tablePrefix);
    }
    factory.afterPropertiesSet();
    return factory.getObject();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:BatchAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(JobOperator.class)
public SimpleJobOperator jobOperator(JobExplorer jobExplorer, JobLauncher jobLauncher,
        ListableJobLocator jobRegistry, JobRepository jobRepository)
                throws Exception {
    SimpleJobOperator factory = new SimpleJobOperator();
    factory.setJobExplorer(jobExplorer);
    factory.setJobLauncher(jobLauncher);
    factory.setJobRegistry(jobRegistry);
    factory.setJobRepository(jobRepository);
    if (this.jobParametersConverter != null) {
        factory.setJobParametersConverter(this.jobParametersConverter);
    }
    return factory;
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:BatchAutoConfigurationTests.java   
@Test
public void testDefaultContext() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(TestConfiguration.class,
            EmbeddedDataSourceConfiguration.class, BatchAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
    assertThat(this.context.getBean(JobExplorer.class)).isNotNull();
    assertThat(new JdbcTemplate(this.context.getBean(DataSource.class))
            .queryForList("select * from BATCH_JOB_EXECUTION")).isEmpty();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:BatchAutoConfigurationTests.java   
@Test
public void testNoDatabase() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(TestCustomConfiguration.class, BatchAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
    JobExplorer explorer = this.context.getBean(JobExplorer.class);
    assertThat(explorer).isNotNull();
    assertThat(explorer.getJobInstances("job", 0, 100)).isEmpty();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:BatchAutoConfigurationTests.java   
@Override
public JobExplorer getJobExplorer() throws Exception {
    MapJobExplorerFactoryBean explorer = new MapJobExplorerFactoryBean(
            this.factory);
    explorer.afterPropertiesSet();
    return explorer.getObject();
}
项目:spring-boot-concourse    文件:BasicBatchConfigurer.java   
protected JobExplorer createJobExplorer() throws Exception {
    JobExplorerFactoryBean jobExplorerFactoryBean = new JobExplorerFactoryBean();
    jobExplorerFactoryBean.setDataSource(this.dataSource);
    String tablePrefix = this.properties.getTablePrefix();
    if (StringUtils.hasText(tablePrefix)) {
        jobExplorerFactoryBean.setTablePrefix(tablePrefix);
    }
    jobExplorerFactoryBean.afterPropertiesSet();
    return jobExplorerFactoryBean.getObject();
}
项目:spring-boot-concourse    文件:BatchAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = "spring.batch.job", name = "enabled", havingValue = "true", matchIfMissing = true)
public JobLauncherCommandLineRunner jobLauncherCommandLineRunner(
        JobLauncher jobLauncher, JobExplorer jobExplorer) {
    JobLauncherCommandLineRunner runner = new JobLauncherCommandLineRunner(
            jobLauncher, jobExplorer);
    String jobNames = this.properties.getJob().getNames();
    if (StringUtils.hasText(jobNames)) {
        runner.setJobNames(jobNames);
    }
    return runner;
}
项目:spring-boot-concourse    文件:BatchAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(DataSource.class)
public JobExplorer jobExplorer(DataSource dataSource) throws Exception {
    JobExplorerFactoryBean factory = new JobExplorerFactoryBean();
    factory.setDataSource(dataSource);
    String tablePrefix = this.properties.getTablePrefix();
    if (StringUtils.hasText(tablePrefix)) {
        factory.setTablePrefix(tablePrefix);
    }
    factory.afterPropertiesSet();
    return factory.getObject();
}
项目:spring-boot-concourse    文件:BatchAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(JobOperator.class)
public SimpleJobOperator jobOperator(JobExplorer jobExplorer, JobLauncher jobLauncher,
        ListableJobLocator jobRegistry, JobRepository jobRepository)
                throws Exception {
    SimpleJobOperator factory = new SimpleJobOperator();
    factory.setJobExplorer(jobExplorer);
    factory.setJobLauncher(jobLauncher);
    factory.setJobRegistry(jobRegistry);
    factory.setJobRepository(jobRepository);
    if (this.jobParametersConverter != null) {
        factory.setJobParametersConverter(this.jobParametersConverter);
    }
    return factory;
}
项目:spring-boot-concourse    文件:BatchAutoConfigurationTests.java   
@Test
public void testDefaultContext() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(TestConfiguration.class,
            EmbeddedDataSourceConfiguration.class, BatchAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
    assertThat(this.context.getBean(JobExplorer.class)).isNotNull();
    assertThat(new JdbcTemplate(this.context.getBean(DataSource.class))
            .queryForList("select * from BATCH_JOB_EXECUTION")).isEmpty();
}
项目:spring-boot-concourse    文件:BatchAutoConfigurationTests.java   
@Test
public void testNoDatabase() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(TestCustomConfiguration.class, BatchAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    assertThat(this.context.getBean(JobLauncher.class)).isNotNull();
    JobExplorer explorer = this.context.getBean(JobExplorer.class);
    assertThat(explorer).isNotNull();
    assertThat(explorer.getJobInstances("job", 0, 100)).isEmpty();
}
项目:spring-boot-concourse    文件:BatchAutoConfigurationTests.java   
@Override
public JobExplorer getJobExplorer() throws Exception {
    MapJobExplorerFactoryBean explorer = new MapJobExplorerFactoryBean(
            this.factory);
    explorer.afterPropertiesSet();
    return explorer.getObject();
}
项目:contestparser    文件:BasicBatchConfigurer.java   
private JobExplorer createJobExplorer() throws Exception {
    JobExplorerFactoryBean jobExplorerFactoryBean = new JobExplorerFactoryBean();
    jobExplorerFactoryBean.setDataSource(this.dataSource);
    String tablePrefix = this.properties.getTablePrefix();
    if (StringUtils.hasText(tablePrefix)) {
        jobExplorerFactoryBean.setTablePrefix(tablePrefix);
    }
    jobExplorerFactoryBean.afterPropertiesSet();
    return jobExplorerFactoryBean.getObject();
}
项目:contestparser    文件:BatchAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
@ConditionalOnProperty(prefix = "spring.batch.job", name = "enabled", havingValue = "true", matchIfMissing = true)
public JobLauncherCommandLineRunner jobLauncherCommandLineRunner(
        JobLauncher jobLauncher, JobExplorer jobExplorer) {
    JobLauncherCommandLineRunner runner = new JobLauncherCommandLineRunner(
            jobLauncher, jobExplorer);
    String jobNames = this.properties.getJob().getNames();
    if (StringUtils.hasText(jobNames)) {
        runner.setJobNames(jobNames);
    }
    return runner;
}
项目:contestparser    文件:BatchAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean
@ConditionalOnBean(DataSource.class)
public JobExplorer jobExplorer(DataSource dataSource) throws Exception {
    JobExplorerFactoryBean factory = new JobExplorerFactoryBean();
    factory.setDataSource(dataSource);
    String tablePrefix = this.properties.getTablePrefix();
    if (StringUtils.hasText(tablePrefix)) {
        factory.setTablePrefix(tablePrefix);
    }
    factory.afterPropertiesSet();
    return factory.getObject();
}
项目:contestparser    文件:BatchAutoConfiguration.java   
@Bean
@ConditionalOnMissingBean(JobOperator.class)
public SimpleJobOperator jobOperator(JobExplorer jobExplorer, JobLauncher jobLauncher,
        ListableJobLocator jobRegistry, JobRepository jobRepository)
                throws Exception {
    SimpleJobOperator factory = new SimpleJobOperator();
    factory.setJobExplorer(jobExplorer);
    factory.setJobLauncher(jobLauncher);
    factory.setJobRegistry(jobRegistry);
    factory.setJobRepository(jobRepository);
    if (this.jobParametersConverter != null) {
        factory.setJobParametersConverter(this.jobParametersConverter);
    }
    return factory;
}
项目:contestparser    文件:BatchAutoConfigurationTests.java   
@Test
public void testDefaultContext() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(TestConfiguration.class,
            EmbeddedDataSourceConfiguration.class, BatchAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    assertNotNull(this.context.getBean(JobLauncher.class));
    assertNotNull(this.context.getBean(JobExplorer.class));
    assertEquals(0, new JdbcTemplate(this.context.getBean(DataSource.class))
            .queryForList("select * from BATCH_JOB_EXECUTION").size());
}
项目:contestparser    文件:BatchAutoConfigurationTests.java   
@Test
public void testNoDatabase() throws Exception {
    this.context = new AnnotationConfigApplicationContext();
    this.context.register(TestCustomConfiguration.class, BatchAutoConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class);
    this.context.refresh();
    assertNotNull(this.context.getBean(JobLauncher.class));
    JobExplorer explorer = this.context.getBean(JobExplorer.class);
    assertNotNull(explorer);
    assertEquals(0, explorer.getJobInstances("job", 0, 100).size());
}
项目:contestparser    文件:BatchAutoConfigurationTests.java   
@Override
public JobExplorer getJobExplorer() throws Exception {
    MapJobExplorerFactoryBean explorer = new MapJobExplorerFactoryBean(
            this.factory);
    explorer.afterPropertiesSet();
    return explorer.getObject();
}
项目:contestparser    文件:JobLauncherCommandLineRunnerTests.java   
@Before
public void init() throws Exception {
    this.context.register(BatchConfiguration.class);
    this.context.refresh();
    JobRepository jobRepository = this.context.getBean(JobRepository.class);
    this.jobLauncher = this.context.getBean(JobLauncher.class);
    this.jobs = new JobBuilderFactory(jobRepository);
    PlatformTransactionManager transactionManager = this.context
            .getBean(PlatformTransactionManager.class);
    this.steps = new StepBuilderFactory(jobRepository, transactionManager);
    this.step = this.steps.get("step").tasklet(new Tasklet() {
        @Override
        public RepeatStatus execute(StepContribution contribution,
                ChunkContext chunkContext) throws Exception {
            return null;
        }
    }).build();
    this.job = this.jobs.get("job").start(this.step).build();
    this.jobExplorer = this.context.getBean(JobExplorer.class);
    this.runner = new JobLauncherCommandLineRunner(this.jobLauncher,
            this.jobExplorer);
    this.context.getBean(BatchConfiguration.class).clear();
}
项目:GemFireLite    文件:TestSubContext.java   
public static void main(String[] args) 
{
  try
  {
    ServerConfigHelper.initConfig();
    ServerConfigHelper.initLog4j("log4j-debug.xml");
    ClassPathXmlApplicationContext ctx = Util.initContext("batch/new-context.xml");
    JobLauncher launch = ctx.getBean(JobLauncher.class);
    JobExplorer epl=ctx.getBean(JobExplorer.class);
    JobRegistry reg =ctx.getBean(JobRegistry.class);
    JobOperator jop=ctx.getBean(JobOperator.class);
    ClassPathXmlApplicationContext ctx2 = Util.initContext(false,"batch/job-context.xml","batch-file-prod.xml");
    ctx2.setParent(ctx);
    ctx2.refresh();
    Job job = ctx2.getBean(Job.class);
    JobParametersBuilder build = new JobParametersBuilder();
    build.addLong("Id", System.currentTimeMillis());



    JobExecution exec= launch.run(job,build.toJobParameters());
    System.out.println(reg.getJobNames());
    Thread.sleep(Long.MAX_VALUE);
  }
  catch (Exception e)
  {
    e.printStackTrace();
  }

}
项目:spring-cloud-task    文件:DeployerPartitionHandler.java   
public DeployerPartitionHandler(TaskLauncher taskLauncher,
        JobExplorer jobExplorer,
        Resource resource,
        String stepName) {
    Assert.notNull(taskLauncher, "A taskLauncher is required");
    Assert.notNull(jobExplorer, "A jobExplorer is required");
    Assert.notNull(resource, "A resource is required");
    Assert.hasText(stepName, "A step name is required");

    this.taskLauncher = taskLauncher;
    this.jobExplorer = jobExplorer;
    this.resource = resource;
    this.stepName = stepName;
}
项目:spring-cloud-task    文件:DeployerStepExecutionHandler.java   
public DeployerStepExecutionHandler(BeanFactory beanFactory, JobExplorer jobExplorer, JobRepository jobRepository) {
    Assert.notNull(beanFactory, "A beanFactory is required");
    Assert.notNull(jobExplorer, "A jobExplorer is required");
    Assert.notNull(jobRepository, "A jobRepository is required");

    this.stepLocator = new BeanFactoryStepLocator();
    ((BeanFactoryStepLocator) this.stepLocator).setBeanFactory(beanFactory);

    this.jobExplorer = jobExplorer;
    this.jobRepository = jobRepository;
}
项目:spring-cloud-task    文件:DeployerPartitionHandlerTests.java   
private void validateConstructorValidation(TaskLauncher taskLauncher, JobExplorer jobExplorer, Resource resource, String stepName, String expectedMessage) {
    try {
        new DeployerPartitionHandler(taskLauncher, jobExplorer, resource, stepName);
    }
    catch (IllegalArgumentException iae) {
        assertEquals(expectedMessage, iae.getMessage());
    }
}
项目:spring-cloud-task    文件:DeployerStepExecutionHandlerTests.java   
private void validateConstructorValidation(BeanFactory beanFactory, JobExplorer jobExplorer, JobRepository jobRepository, String message) {
    try {
        new DeployerStepExecutionHandler(beanFactory, jobExplorer, jobRepository);
    }
    catch (IllegalArgumentException iae) {
        assertEquals(message, iae.getMessage());
    }
}