本文整理汇总了Java中org.springframework.batch.core.explore.JobExplorer类的典型用法代码示例。如果您正苦于以下问题:Java JobExplorer类的具体用法?Java JobExplorer怎么用?Java JobExplorer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JobExplorer类属于org.springframework.batch.core.explore包,在下文中一共展示了JobExplorer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testRenamePrefix
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
@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();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:22,代码来源:BatchAutoConfigurationTests.java
示例2: init
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
@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();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:24,代码来源:JobLauncherCommandLineRunnerTests.java
示例3: testRenamePrefix
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
@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()));
}
示例4: main
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
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();
}
示例5: getStepExecutions
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
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();
}
开发者ID:spring-cloud-task-app-starters,项目名称:composed-task-runner,代码行数:11,代码来源:ComposedRunnerVisitorTests.java
示例6: JobServiceImpl
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
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;
}
示例7: jobService
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
@Bean
public JobService jobService(JobOperator batchJobOperator,
JobRegistry batchJobRegistry,
JobExplorer jobExplorer,
JobLauncher jobLauncher,
JobRepository jobRepository) throws Exception {
return new JobServiceImpl(jobExplorer, batchJobOperator, jobLauncher, batchJobRegistry, jobRepository);
}
示例8: getJobExplorer
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
@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();
}
示例9: jobService
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
@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);
}
示例10: jobExplorer
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
@Bean
public JobExplorer jobExplorer() throws Exception {
JobExplorerFactoryBean factory = new JobExplorerFactoryBean();
factory.setDataSource(dataSource);
factory.afterPropertiesSet();
return factory.getObject();
}
示例11: jobExplorer
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
@Bean
public JobExplorer jobExplorer() throws Exception {
MapJobExplorerFactoryBean mapJobExplorerFactoryBean = new MapJobExplorerFactoryBean();
mapJobExplorerFactoryBean.setRepositoryFactory(jobRepository());
mapJobExplorerFactoryBean.afterPropertiesSet();
return mapJobExplorerFactoryBean.getObject();
}
示例12: createJobExplorer
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
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();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:11,代码来源:BasicBatchConfigurer.java
示例13: jobLauncherCommandLineRunner
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
@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;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:BatchAutoConfiguration.java
示例14: jobExplorer
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
@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();
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:BatchAutoConfiguration.java
示例15: jobOperator
import org.springframework.batch.core.explore.JobExplorer; //导入依赖的package包/类
@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;
}
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:16,代码来源:BatchAutoConfiguration.java