Java 类org.springframework.boot.autoconfigure.batch.BatchAutoConfiguration 实例源码

项目:spring-cloud-task    文件:TaskBatchExecutionListenerTests.java   
@Test
public void testMultipleDataSources() {
    this.applicationContext = SpringApplication.run(new Class[] {JobConfigurationMultipleDataSources.class,
            PropertyPlaceholderAutoConfiguration.class,
            EmbeddedDataSourceConfiguration.class,
            BatchAutoConfiguration.class,
            TaskBatchAutoConfiguration.class}, ARGS);

    TaskExplorer taskExplorer = this.applicationContext.getBean(TaskExplorer.class);

    Page<TaskExecution> page = taskExplorer.findTaskExecutionsByName("application", new PageRequest(0, 1));

    Set<Long> jobExecutionIds = taskExplorer.getJobExecutionIdsByTaskExecutionId(page.iterator().next().getExecutionId());

    assertEquals(1, jobExecutionIds.size());
    assertEquals(1, taskExplorer.getTaskExecution(jobExecutionIds.iterator().next()).getExecutionId());
}
项目:spring-cloud-task    文件:TaskBatchExecutionListenerTests.java   
@Test
public void testAutobuiltDataSourceNoJob() {
    this.applicationContext = SpringApplication.run(new Class[] {NoJobConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class,
            EmbeddedDataSourceConfiguration.class,
            BatchAutoConfiguration.class,
            TaskBatchAutoConfiguration.class}, ARGS);

    TaskExplorer taskExplorer = this.applicationContext.getBean(TaskExplorer.class);

    Page<TaskExecution> page = taskExplorer.findTaskExecutionsByName("application", PageRequest.of(0, 1));

    Set<Long> jobExecutionIds = taskExplorer.getJobExecutionIdsByTaskExecutionId(page.iterator().next().getExecutionId());

    assertEquals(0, jobExecutionIds.size());
}
项目:spring-cloud-task    文件:TaskBatchExecutionListenerTests.java   
@Test
public void testMapBased() {
    this.applicationContext = SpringApplication.run(new Class[] {JobConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class, EmbeddedDataSourceConfiguration.class,
            BatchAutoConfiguration.class,
            TaskBatchAutoConfiguration.class}, ARGS);

    TaskExplorer taskExplorer = this.applicationContext.getBean(TaskExplorer.class);

    Page<TaskExecution> page = taskExplorer.findTaskExecutionsByName("application", PageRequest.of(0, 1));

    Set<Long> jobExecutionIds = taskExplorer.getJobExecutionIdsByTaskExecutionId(page.iterator().next().getExecutionId());

    assertEquals(1, jobExecutionIds.size());
    assertEquals(1, (long) taskExplorer.getTaskExecutionIdByJobExecutionId(jobExecutionIds.iterator().next()));
}
项目:spring-cloud-task    文件:TaskBatchExecutionListenerTests.java   
@Test
public void testMultipleJobs() {
    this.applicationContext = SpringApplication.run(new Class[] {EmbeddedDataSourceConfiguration.class, MultipleJobConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class,
            BatchAutoConfiguration.class,
            TaskBatchAutoConfiguration.class}, ARGS);

    TaskExplorer taskExplorer = this.applicationContext.getBean(TaskExplorer.class);

    Page<TaskExecution> page = taskExplorer.findTaskExecutionsByName("application", PageRequest.of(0, 1));

    Set<Long> jobExecutionIds = taskExplorer.getJobExecutionIdsByTaskExecutionId(page.iterator().next().getExecutionId());

    assertEquals(2, jobExecutionIds.size());
    Iterator<Long> jobExecutionIdsIterator = jobExecutionIds.iterator();
    assertEquals(1, (long) taskExplorer.getTaskExecutionIdByJobExecutionId(jobExecutionIdsIterator.next()));
    assertEquals(1, (long) taskExplorer.getTaskExecutionIdByJobExecutionId(jobExecutionIdsIterator.next()));
}
项目:composed-task-runner    文件:ComposedRunnerVisitorTests.java   
private void setupContextForGraph(String graph) {
    String[] ARGS = new String[] {CLOSE_CONTEXT_ARG, TASK_NAME_ARG, "--graph=" + graph};

    this.applicationContext = SpringApplication.run(new Object[] {ComposedRunnerVisitorConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class,
            EmbeddedDataSourceConfiguration.class,
            BatchAutoConfiguration.class,
            TaskBatchAutoConfiguration.class}, ARGS);
}
项目:spring-cloud-task    文件:TaskBatchExecutionListenerTests.java   
@Test
public void testAutobuiltDataSource() {
    this.applicationContext = SpringApplication.run(new Class[] {JobConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class,
            EmbeddedDataSourceConfiguration.class,
            BatchAutoConfiguration.class,
            TaskBatchAutoConfiguration.class}, ARGS);
    validateContext();
}
项目:spring-cloud-task    文件:TaskBatchExecutionListenerTests.java   
@Test
public void testFactoryBean() {
    this.applicationContext = SpringApplication.run(new Class[]{JobFactoryBeanConfiguration.class,
            PropertyPlaceholderAutoConfiguration.class,
            EmbeddedDataSourceConfiguration.class,
            BatchAutoConfiguration.class,
            TaskBatchAutoConfiguration.class}, ARGS);
    validateContext();
}