|
|
|
|
@ -63,6 +63,7 @@ import org.springframework.transaction.PlatformTransactionManager;
@@ -63,6 +63,7 @@ import org.springframework.transaction.PlatformTransactionManager;
|
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
|
import static org.assertj.core.api.Assertions.assertThatExceptionOfType; |
|
|
|
|
import static org.mockito.Mockito.mock; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Tests for {@link BatchAutoConfiguration}. |
|
|
|
|
@ -96,6 +97,12 @@ class BatchAutoConfigurationTests {
@@ -96,6 +97,12 @@ class BatchAutoConfigurationTests {
|
|
|
|
|
.run((context) -> assertThat(context).doesNotHaveBean(BatchConfigurer.class)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void whenThereIsAnEntityManagerFactoryButNoDataSourceAutoConfigurationBacksOff() { |
|
|
|
|
this.contextRunner.withUserConfiguration(TestConfiguration.class, EntityManagerFactoryConfiguration.class) |
|
|
|
|
.run((context) -> assertThat(context).doesNotHaveBean(BatchConfigurer.class)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
void testCustomConfigurationWithNoDatabase() { |
|
|
|
|
this.contextRunner.withUserConfiguration(TestCustomConfiguration.class).run((context) -> { |
|
|
|
|
@ -283,6 +290,16 @@ class BatchAutoConfigurationTests {
@@ -283,6 +290,16 @@ class BatchAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false) |
|
|
|
|
static class EntityManagerFactoryConfiguration { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
EntityManagerFactory entityManagerFactory() { |
|
|
|
|
return mock(EntityManagerFactory.class); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@EnableBatchProcessing |
|
|
|
|
@TestAutoConfigurationPackage(City.class) |
|
|
|
|
static class TestCustomConfiguration implements BatchConfigurer { |
|
|
|
|
|