|
|
@ -74,6 +74,7 @@ import static org.mockito.Mockito.mock;
|
|
|
|
* @author Stephane Nicoll
|
|
|
|
* @author Stephane Nicoll
|
|
|
|
* @author Dominic Gunn
|
|
|
|
* @author Dominic Gunn
|
|
|
|
* @author András Deák
|
|
|
|
* @author András Deák
|
|
|
|
|
|
|
|
* @author Takaaki Shimbo
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
class FlywayAutoConfigurationTests {
|
|
|
|
class FlywayAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
|
@ -158,6 +159,15 @@ class FlywayAutoConfigurationTests {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
void flywayMultipleDataSources() {
|
|
|
|
|
|
|
|
this.contextRunner.withUserConfiguration(FlywayMultipleDataSourcesConfiguration.class).run((context) -> {
|
|
|
|
|
|
|
|
assertThat(context).hasSingleBean(Flyway.class);
|
|
|
|
|
|
|
|
assertThat(context.getBean(Flyway.class).getConfiguration().getDataSource())
|
|
|
|
|
|
|
|
.isEqualTo(context.getBean("flywayDataSource"));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
void schemaManagementProviderDetectsDataSource() {
|
|
|
|
void schemaManagementProviderDetectsDataSource() {
|
|
|
|
this.contextRunner
|
|
|
|
this.contextRunner
|
|
|
@ -509,6 +519,27 @@ class FlywayAutoConfigurationTests {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
|
|
|
|
static class FlywayMultipleDataSourcesConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
DataSource mainDataSource() {
|
|
|
|
|
|
|
|
return DataSourceBuilder.create().url("jdbc:hsqldb:mem:main").username("sa").build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
DataSource secondlyDataSource() {
|
|
|
|
|
|
|
|
return DataSourceBuilder.create().url("jdbc:hsqldb:mem:secondly").username("sa").build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@FlywayDataSource
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
|
|
|
DataSource flywayDataSource(DataSource mainDataSource) {
|
|
|
|
|
|
|
|
return mainDataSource;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
@Configuration(proxyBeanMethods = false)
|
|
|
|
static class FlywayJavaMigrationsConfiguration {
|
|
|
|
static class FlywayJavaMigrationsConfiguration {
|
|
|
|
|
|
|
|
|
|
|
|