|
1 | 1 | /*
|
2 |
| - * Copyright 2012-2019 the original author or authors. |
| 2 | + * Copyright 2012-2020 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
35 | 35 | import org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
|
36 | 36 | import org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor;
|
37 | 37 | import org.springframework.batch.core.explore.JobExplorer;
|
38 |
| -import org.springframework.batch.core.explore.support.MapJobExplorerFactoryBean; |
39 | 38 | import org.springframework.batch.core.job.AbstractJob;
|
40 | 39 | import org.springframework.batch.core.launch.JobLauncher;
|
41 |
| -import org.springframework.batch.core.launch.support.SimpleJobLauncher; |
42 | 40 | import org.springframework.batch.core.repository.JobRepository;
|
43 |
| -import org.springframework.batch.core.repository.support.MapJobRepositoryFactoryBean; |
44 |
| -import org.springframework.batch.support.transaction.ResourcelessTransactionManager; |
45 | 41 | import org.springframework.beans.factory.annotation.Autowired;
|
46 | 42 | import org.springframework.boot.CommandLineRunner;
|
47 | 43 | import org.springframework.boot.DefaultApplicationArguments;
|
@@ -105,15 +101,6 @@ void whenThereIsAnEntityManagerFactoryButNoDataSourceAutoConfigurationBacksOff()
|
105 | 101 | .run((context) -> assertThat(context).doesNotHaveBean(BatchConfigurer.class));
|
106 | 102 | }
|
107 | 103 |
|
108 |
| - @Test |
109 |
| - void testCustomConfigurationWithNoDatabase() { |
110 |
| - this.contextRunner.withUserConfiguration(TestCustomConfiguration.class).run((context) -> { |
111 |
| - assertThat(context).hasSingleBean(JobLauncher.class); |
112 |
| - JobExplorer explorer = context.getBean(JobExplorer.class); |
113 |
| - assertThat(explorer.getJobInstances("job", 0, 100)).isEmpty(); |
114 |
| - }); |
115 |
| - } |
116 |
| - |
117 | 104 | @Test
|
118 | 105 | void testNoBatchConfiguration() {
|
119 | 106 | this.contextRunner.withUserConfiguration(EmptyConfiguration.class, EmbeddedDataSourceConfiguration.class)
|
@@ -319,44 +306,6 @@ EntityManagerFactory entityManagerFactory() {
|
319 | 306 |
|
320 | 307 | }
|
321 | 308 |
|
322 |
| - @EnableBatchProcessing |
323 |
| - @TestAutoConfigurationPackage(City.class) |
324 |
| - static class TestCustomConfiguration implements BatchConfigurer { |
325 |
| - |
326 |
| - private JobRepository jobRepository; |
327 |
| - |
328 |
| - private MapJobRepositoryFactoryBean factory = new MapJobRepositoryFactoryBean(); |
329 |
| - |
330 |
| - @Override |
331 |
| - public JobRepository getJobRepository() throws Exception { |
332 |
| - if (this.jobRepository == null) { |
333 |
| - this.factory.afterPropertiesSet(); |
334 |
| - this.jobRepository = this.factory.getObject(); |
335 |
| - } |
336 |
| - return this.jobRepository; |
337 |
| - } |
338 |
| - |
339 |
| - @Override |
340 |
| - public PlatformTransactionManager getTransactionManager() { |
341 |
| - return new ResourcelessTransactionManager(); |
342 |
| - } |
343 |
| - |
344 |
| - @Override |
345 |
| - public JobLauncher getJobLauncher() { |
346 |
| - SimpleJobLauncher launcher = new SimpleJobLauncher(); |
347 |
| - launcher.setJobRepository(this.jobRepository); |
348 |
| - return launcher; |
349 |
| - } |
350 |
| - |
351 |
| - @Override |
352 |
| - public JobExplorer getJobExplorer() throws Exception { |
353 |
| - MapJobExplorerFactoryBean explorer = new MapJobExplorerFactoryBean(this.factory); |
354 |
| - explorer.afterPropertiesSet(); |
355 |
| - return explorer.getObject(); |
356 |
| - } |
357 |
| - |
358 |
| - } |
359 |
| - |
360 | 309 | @Configuration(proxyBeanMethods = false)
|
361 | 310 | @EnableBatchProcessing
|
362 | 311 | static class NamedJobConfigurationWithRegisteredJob {
|
|
0 commit comments