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