Add transaction manager in Spring Data jdbc tests

See gh-17654
pull/17660/head
Madhura Bhave 5 years ago committed by Stephane Nicoll
parent 39a7b9da38
commit 3423dbf6ac

@ -26,6 +26,7 @@ import org.springframework.boot.autoconfigure.data.empty.EmptyDataPackage;
import org.springframework.boot.autoconfigure.data.jdbc.city.City; import org.springframework.boot.autoconfigure.data.jdbc.city.City;
import org.springframework.boot.autoconfigure.data.jdbc.city.CityRepository; import org.springframework.boot.autoconfigure.data.jdbc.city.CityRepository;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration; import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
import org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration; import org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration;
import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.boot.test.context.runner.ApplicationContextRunner;
@ -65,8 +66,8 @@ class JdbcRepositoriesAutoConfigurationTests {
@Test @Test
void basicAutoConfiguration() { void basicAutoConfiguration() {
this.contextRunner this.contextRunner
.withConfiguration( .withConfiguration(AutoConfigurations.of(JdbcTemplateAutoConfiguration.class,
AutoConfigurations.of(JdbcTemplateAutoConfiguration.class, DataSourceAutoConfiguration.class)) DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class))
.withUserConfiguration(TestConfiguration.class, EmbeddedDataSourceConfiguration.class) .withUserConfiguration(TestConfiguration.class, EmbeddedDataSourceConfiguration.class)
.withPropertyValues("spring.datasource.schema=classpath:data-jdbc-schema.sql", .withPropertyValues("spring.datasource.schema=classpath:data-jdbc-schema.sql",
"spring.datasource.data=classpath:city.sql", "spring.datasource.generate-unique-name:true") "spring.datasource.data=classpath:city.sql", "spring.datasource.generate-unique-name:true")
@ -90,8 +91,8 @@ class JdbcRepositoriesAutoConfigurationTests {
@Test @Test
void honoursUsersEnableJdbcRepositoriesConfiguration() { void honoursUsersEnableJdbcRepositoriesConfiguration() {
this.contextRunner this.contextRunner
.withConfiguration( .withConfiguration(AutoConfigurations.of(JdbcTemplateAutoConfiguration.class,
AutoConfigurations.of(JdbcTemplateAutoConfiguration.class, DataSourceAutoConfiguration.class)) DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class))
.withUserConfiguration(EnableRepositoriesConfiguration.class, EmbeddedDataSourceConfiguration.class) .withUserConfiguration(EnableRepositoriesConfiguration.class, EmbeddedDataSourceConfiguration.class)
.withPropertyValues("spring.datasource.schema=classpath:data-jdbc-schema.sql", .withPropertyValues("spring.datasource.schema=classpath:data-jdbc-schema.sql",
"spring.datasource.data=classpath:city.sql", "spring.datasource.generate-unique-name:true") "spring.datasource.data=classpath:city.sql", "spring.datasource.generate-unique-name:true")

Loading…
Cancel
Save