Use main DataSource when there are no migration-specific conn details
Fixes gh-35109
This commit is contained in:
parent
363dc9368d
commit
7ffacf43f3
|
@ -24,7 +24,6 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
@ -85,7 +84,7 @@ import org.springframework.util.StringUtils;
|
||||||
* @author Dominic Gunn
|
* @author Dominic Gunn
|
||||||
* @author Dan Zheng
|
* @author Dan Zheng
|
||||||
* @author András Deák
|
* @author András Deák
|
||||||
* @author Semyon Danilov
|
* @author Semyon Danilo
|
||||||
* @author Chris Bono
|
* @author Chris Bono
|
||||||
* @author Moritz Halbritter
|
* @author Moritz Halbritter
|
||||||
* @author Andy Wilkinson
|
* @author Andy Wilkinson
|
||||||
|
@ -126,7 +125,7 @@ public class FlywayAutoConfiguration {
|
||||||
@ConditionalOnMissingBean(FlywayConnectionDetails.class)
|
@ConditionalOnMissingBean(FlywayConnectionDetails.class)
|
||||||
PropertiesFlywayConnectionDetails flywayConnectionDetails(FlywayProperties properties,
|
PropertiesFlywayConnectionDetails flywayConnectionDetails(FlywayProperties properties,
|
||||||
ObjectProvider<JdbcConnectionDetails> jdbcConnectionDetails) {
|
ObjectProvider<JdbcConnectionDetails> jdbcConnectionDetails) {
|
||||||
return new PropertiesFlywayConnectionDetails(properties, jdbcConnectionDetails.getIfAvailable());
|
return new PropertiesFlywayConnectionDetails(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated(since = "3.0.0", forRemoval = true)
|
@Deprecated(since = "3.0.0", forRemoval = true)
|
||||||
|
@ -134,14 +133,15 @@ public class FlywayAutoConfiguration {
|
||||||
ObjectProvider<DataSource> dataSource, ObjectProvider<DataSource> flywayDataSource,
|
ObjectProvider<DataSource> dataSource, ObjectProvider<DataSource> flywayDataSource,
|
||||||
ObjectProvider<FlywayConfigurationCustomizer> fluentConfigurationCustomizers,
|
ObjectProvider<FlywayConfigurationCustomizer> fluentConfigurationCustomizers,
|
||||||
ObjectProvider<JavaMigration> javaMigrations, ObjectProvider<Callback> callbacks) {
|
ObjectProvider<JavaMigration> javaMigrations, ObjectProvider<Callback> callbacks) {
|
||||||
return flyway(properties, new PropertiesFlywayConnectionDetails(properties, null), resourceLoader,
|
return flyway(properties, new PropertiesFlywayConnectionDetails(properties), resourceLoader, dataSource,
|
||||||
dataSource, flywayDataSource, fluentConfigurationCustomizers, javaMigrations, callbacks,
|
null, flywayDataSource, fluentConfigurationCustomizers, javaMigrations, callbacks,
|
||||||
new ResourceProviderCustomizer());
|
new ResourceProviderCustomizer());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
Flyway flyway(FlywayProperties properties, FlywayConnectionDetails connectionDetails,
|
Flyway flyway(FlywayProperties properties, FlywayConnectionDetails connectionDetails,
|
||||||
ResourceLoader resourceLoader, ObjectProvider<DataSource> dataSource,
|
ResourceLoader resourceLoader, ObjectProvider<DataSource> dataSource,
|
||||||
|
ObjectProvider<JdbcConnectionDetails> jdbcConnectionDetails,
|
||||||
@FlywayDataSource ObjectProvider<DataSource> flywayDataSource,
|
@FlywayDataSource ObjectProvider<DataSource> flywayDataSource,
|
||||||
ObjectProvider<FlywayConfigurationCustomizer> fluentConfigurationCustomizers,
|
ObjectProvider<FlywayConfigurationCustomizer> fluentConfigurationCustomizers,
|
||||||
ObjectProvider<JavaMigration> javaMigrations, ObjectProvider<Callback> callbacks,
|
ObjectProvider<JavaMigration> javaMigrations, ObjectProvider<Callback> callbacks,
|
||||||
|
@ -412,46 +412,34 @@ public class FlywayAutoConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapts {@link FlywayProperties} to {@link FlywayConnectionDetails}, using
|
* Adapts {@link FlywayProperties} to {@link FlywayConnectionDetails}.
|
||||||
* {@link JdbcConnectionDetails} as a fallback when Flyway-specific properties have
|
|
||||||
* not be configured.
|
|
||||||
*/
|
*/
|
||||||
static final class PropertiesFlywayConnectionDetails implements FlywayConnectionDetails {
|
static final class PropertiesFlywayConnectionDetails implements FlywayConnectionDetails {
|
||||||
|
|
||||||
private final JdbcConnectionDetails fallback;
|
|
||||||
|
|
||||||
private final FlywayProperties properties;
|
private final FlywayProperties properties;
|
||||||
|
|
||||||
PropertiesFlywayConnectionDetails(FlywayProperties properties, JdbcConnectionDetails fallback) {
|
PropertiesFlywayConnectionDetails(FlywayProperties properties) {
|
||||||
this.fallback = fallback;
|
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return get(this.properties.getUser(), JdbcConnectionDetails::getUsername);
|
return this.properties.getUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return get(this.properties.getPassword(), JdbcConnectionDetails::getPassword);
|
return this.properties.getPassword();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getJdbcUrl() {
|
public String getJdbcUrl() {
|
||||||
return get(this.properties.getUrl(), JdbcConnectionDetails::getJdbcUrl);
|
return this.properties.getUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDriverClassName() {
|
public String getDriverClassName() {
|
||||||
return get(this.properties.getDriverClassName(), JdbcConnectionDetails::getDriverClassName);
|
return this.properties.getDriverClassName();
|
||||||
}
|
|
||||||
|
|
||||||
private String get(String primary, Function<JdbcConnectionDetails, String> fallbackProperty) {
|
|
||||||
if (primary != null) {
|
|
||||||
return primary;
|
|
||||||
}
|
|
||||||
return (this.fallback != null) ? fallbackProperty.apply(this.fallback) : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,33 +28,37 @@ import org.springframework.boot.jdbc.DatabaseDriver;
|
||||||
public interface FlywayConnectionDetails extends ConnectionDetails {
|
public interface FlywayConnectionDetails extends ConnectionDetails {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Username for the database.
|
* Username for the database or {@code null} if no Flyway-specific configuration is
|
||||||
* @return the username for the database
|
* required.
|
||||||
|
* @return the username for the database or {@code null}
|
||||||
*/
|
*/
|
||||||
String getUsername();
|
String getUsername();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Password for the database.
|
* Password for the database or {@code null} if no Flyway-specific configuration is
|
||||||
* @return the password for the database
|
* required.
|
||||||
|
* @return the password for the database or {@code null}
|
||||||
*/
|
*/
|
||||||
String getPassword();
|
String getPassword();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JDBC URL for the database.
|
* JDBC URL for the database or {@code null} if no Flyway-specific configuration is
|
||||||
* @return the JDBC URL for the database
|
* required.
|
||||||
|
* @return the JDBC URL for the database or {@code null}
|
||||||
*/
|
*/
|
||||||
String getJdbcUrl();
|
String getJdbcUrl();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the JDBC driver class. Defaults to the class name of the driver
|
* The name of the JDBC driver class. Defaults to the class name of the driver
|
||||||
* specified in the JDBC URL.
|
* specified in the JDBC URL or {@code null} when no JDBC URL is configured.
|
||||||
* @return the JDBC driver class name
|
* @return the JDBC driver class name or {@code null}
|
||||||
* @see #getJdbcUrl()
|
* @see #getJdbcUrl()
|
||||||
* @see DatabaseDriver#fromJdbcUrl(String)
|
* @see DatabaseDriver#fromJdbcUrl(String)
|
||||||
* @see DatabaseDriver#getDriverClassName()
|
* @see DatabaseDriver#getDriverClassName()
|
||||||
*/
|
*/
|
||||||
default String getDriverClassName() {
|
default String getDriverClassName() {
|
||||||
return DatabaseDriver.fromJdbcUrl(getJdbcUrl()).getDriverClassName();
|
String jdbcUrl = getJdbcUrl();
|
||||||
|
return (jdbcUrl != null) ? DatabaseDriver.fromJdbcUrl(jdbcUrl).getDriverClassName() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
package org.springframework.boot.autoconfigure.liquibase;
|
package org.springframework.boot.autoconfigure.liquibase;
|
||||||
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
import liquibase.change.DatabaseChange;
|
import liquibase.change.DatabaseChange;
|
||||||
|
@ -33,8 +31,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.boot.autoconfigure.flyway.FlywayConnectionDetails;
|
|
||||||
import org.springframework.boot.autoconfigure.flyway.FlywayProperties;
|
|
||||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.jdbc.JdbcConnectionDetails;
|
import org.springframework.boot.autoconfigure.jdbc.JdbcConnectionDetails;
|
||||||
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration.LiquibaseAutoConfigurationRuntimeHints;
|
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration.LiquibaseAutoConfigurationRuntimeHints;
|
||||||
|
@ -93,7 +89,7 @@ public class LiquibaseAutoConfiguration {
|
||||||
@ConditionalOnMissingBean(LiquibaseConnectionDetails.class)
|
@ConditionalOnMissingBean(LiquibaseConnectionDetails.class)
|
||||||
PropertiesLiquibaseConnectionDetails liquibaseConnectionDetails(LiquibaseProperties properties,
|
PropertiesLiquibaseConnectionDetails liquibaseConnectionDetails(LiquibaseProperties properties,
|
||||||
ObjectProvider<JdbcConnectionDetails> jdbcConnectionDetails) {
|
ObjectProvider<JdbcConnectionDetails> jdbcConnectionDetails) {
|
||||||
return new PropertiesLiquibaseConnectionDetails(properties, jdbcConnectionDetails.getIfAvailable());
|
return new PropertiesLiquibaseConnectionDetails(properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@ -198,46 +194,35 @@ public class LiquibaseAutoConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapts {@link FlywayProperties} to {@link FlywayConnectionDetails}, using
|
* Adapts {@link LiquibaseProperties} to {@link LiquibaseConnectionDetails}.
|
||||||
* {@link JdbcConnectionDetails} as a fallback when Flyway-specific properties have
|
|
||||||
* not be configured.
|
|
||||||
*/
|
*/
|
||||||
static final class PropertiesLiquibaseConnectionDetails implements LiquibaseConnectionDetails {
|
static final class PropertiesLiquibaseConnectionDetails implements LiquibaseConnectionDetails {
|
||||||
|
|
||||||
private final JdbcConnectionDetails fallback;
|
|
||||||
|
|
||||||
private final LiquibaseProperties properties;
|
private final LiquibaseProperties properties;
|
||||||
|
|
||||||
PropertiesLiquibaseConnectionDetails(LiquibaseProperties properties, JdbcConnectionDetails fallback) {
|
PropertiesLiquibaseConnectionDetails(LiquibaseProperties properties) {
|
||||||
this.fallback = fallback;
|
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUsername() {
|
public String getUsername() {
|
||||||
return get(this.properties.getUser(), JdbcConnectionDetails::getUsername);
|
return this.properties.getUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return get(this.properties.getPassword(), JdbcConnectionDetails::getPassword);
|
return this.properties.getPassword();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getJdbcUrl() {
|
public String getJdbcUrl() {
|
||||||
return get(this.properties.getUrl(), JdbcConnectionDetails::getJdbcUrl);
|
return this.properties.getUrl();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDriverClassName() {
|
public String getDriverClassName() {
|
||||||
return get(this.properties.getDriverClassName(), JdbcConnectionDetails::getDriverClassName);
|
String driverClassName = this.properties.getDriverClassName();
|
||||||
}
|
return (driverClassName != null) ? driverClassName : LiquibaseConnectionDetails.super.getDriverClassName();
|
||||||
|
|
||||||
private String get(String primary, Function<JdbcConnectionDetails, String> fallbackProperty) {
|
|
||||||
if (primary != null) {
|
|
||||||
return primary;
|
|
||||||
}
|
|
||||||
return (this.fallback != null) ? fallbackProperty.apply(this.fallback) : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,33 +28,37 @@ import org.springframework.boot.jdbc.DatabaseDriver;
|
||||||
public interface LiquibaseConnectionDetails extends ConnectionDetails {
|
public interface LiquibaseConnectionDetails extends ConnectionDetails {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Username for the database.
|
* Username for the database or {@code null} if no Liquibase-specific configuration is
|
||||||
* @return the username for the database
|
* required.
|
||||||
|
* @return the username for the database or {@code null}
|
||||||
*/
|
*/
|
||||||
String getUsername();
|
String getUsername();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Password for the database.
|
* Password for the database or {@code null} if no Liquibase-specific configuration is
|
||||||
* @return the password for the database
|
* required.
|
||||||
|
* @return the password for the database or {@code null}
|
||||||
*/
|
*/
|
||||||
String getPassword();
|
String getPassword();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JDBC URL for the database.
|
* JDBC URL for the database or {@code null} if no Liquibase-specific configuration is
|
||||||
* @return the JDBC URL for the database
|
* required.
|
||||||
|
* @return the JDBC URL for the database or {@code null}
|
||||||
*/
|
*/
|
||||||
String getJdbcUrl();
|
String getJdbcUrl();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of the JDBC driver class. Defaults to the class name of the driver
|
* The name of the JDBC driver class. Defaults to the class name of the driver
|
||||||
* specified in the JDBC URL.
|
* specified in the JDBC URL or {@code null} when no JDBC URL is configured.
|
||||||
* @return the JDBC driver class name
|
* @return the JDBC driver class name or {@code null}
|
||||||
* @see #getJdbcUrl()
|
* @see #getJdbcUrl()
|
||||||
* @see DatabaseDriver#fromJdbcUrl(String)
|
* @see DatabaseDriver#fromJdbcUrl(String)
|
||||||
* @see DatabaseDriver#getDriverClassName()
|
* @see DatabaseDriver#getDriverClassName()
|
||||||
*/
|
*/
|
||||||
default String getDriverClassName() {
|
default String getDriverClassName() {
|
||||||
return DatabaseDriver.fromJdbcUrl(getJdbcUrl()).getDriverClassName();
|
String jdbcUrl = getJdbcUrl();
|
||||||
|
return (jdbcUrl != null) ? DatabaseDriver.fromJdbcUrl(jdbcUrl).getDriverClassName() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,16 +122,6 @@ class FlywayAutoConfigurationTests {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void createsDataSourceWithNoDataSourceBeanAndJdbcConnectionDetails() {
|
|
||||||
this.contextRunner
|
|
||||||
.withUserConfiguration(JdbcConnectionDetailsConfiguration.class, MockFlywayMigrationStrategy.class)
|
|
||||||
.run((context) -> {
|
|
||||||
assertThat(context).hasSingleBean(Flyway.class);
|
|
||||||
assertThat(context.getBean(Flyway.class).getConfiguration().getDataSource()).isNotNull();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void backsOffWithFlywayUrlAndNoSpringJdbc() {
|
void backsOffWithFlywayUrlAndNoSpringJdbc() {
|
||||||
this.contextRunner.withPropertyValues("spring.flyway.url:jdbc:hsqldb:mem:" + UUID.randomUUID())
|
this.contextRunner.withPropertyValues("spring.flyway.url:jdbc:hsqldb:mem:" + UUID.randomUUID())
|
||||||
|
@ -193,7 +183,7 @@ class FlywayAutoConfigurationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void jdbcConnectionDetailsAreUsedOverDataSourceProperties() {
|
void shouldUseMainDataSourceWhenThereIsNoFlywaySpecificConfiguration() {
|
||||||
this.contextRunner
|
this.contextRunner
|
||||||
.withUserConfiguration(EmbeddedDataSourceConfiguration.class, JdbcConnectionDetailsConfiguration.class,
|
.withUserConfiguration(EmbeddedDataSourceConfiguration.class, JdbcConnectionDetailsConfiguration.class,
|
||||||
MockFlywayMigrationStrategy.class)
|
MockFlywayMigrationStrategy.class)
|
||||||
|
@ -201,16 +191,8 @@ class FlywayAutoConfigurationTests {
|
||||||
"spring.datasource.password=some-password",
|
"spring.datasource.password=some-password",
|
||||||
"spring.datasource.driver-class-name=org.hsqldb.jdbc.JDBCDriver")
|
"spring.datasource.driver-class-name=org.hsqldb.jdbc.JDBCDriver")
|
||||||
.run((context) -> {
|
.run((context) -> {
|
||||||
assertThat(context).hasSingleBean(Flyway.class);
|
|
||||||
Flyway flyway = context.getBean(Flyway.class);
|
Flyway flyway = context.getBean(Flyway.class);
|
||||||
DataSource dataSource = flyway.getConfiguration().getDataSource();
|
assertThat(flyway.getConfiguration().getDataSource()).isSameAs(context.getBean(DataSource.class));
|
||||||
assertThat(dataSource).isInstanceOf(SimpleDriverDataSource.class);
|
|
||||||
SimpleDriverDataSource simpleDriverDataSource = (SimpleDriverDataSource) dataSource;
|
|
||||||
assertThat(simpleDriverDataSource.getUrl())
|
|
||||||
.isEqualTo("jdbc:postgresql://database.example.com:12345/database-1");
|
|
||||||
assertThat(simpleDriverDataSource.getUsername()).isEqualTo("user-1");
|
|
||||||
assertThat(simpleDriverDataSource.getPassword()).isEqualTo("secret-1");
|
|
||||||
assertThat(simpleDriverDataSource.getDriver()).isInstanceOf(Driver.class);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,18 +101,6 @@ class LiquibaseAutoConfigurationTests {
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
void createsDataSourceWithNoDataSourceBeanAndJdbcConnectionDetails() {
|
|
||||||
this.contextRunner.withSystemProperties("shouldRun=false")
|
|
||||||
.withUserConfiguration(JdbcConnectionDetailsConfiguration.class)
|
|
||||||
.run(assertLiquibase((liquibase) -> {
|
|
||||||
SimpleDriverDataSource dataSource = (SimpleDriverDataSource) liquibase.getDataSource();
|
|
||||||
assertThat(dataSource.getUrl()).isEqualTo("jdbc:postgresql://database.example.com:12345/database-1");
|
|
||||||
assertThat(dataSource.getUsername()).isEqualTo("user-1");
|
|
||||||
assertThat(dataSource.getPassword()).isEqualTo("secret-1");
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void backsOffWithLiquibaseUrlAndNoSpringJdbc() {
|
void backsOffWithLiquibaseUrlAndNoSpringJdbc() {
|
||||||
this.contextRunner.withPropertyValues("spring.liquibase.url:jdbc:hsqldb:mem:" + UUID.randomUUID())
|
this.contextRunner.withPropertyValues("spring.liquibase.url:jdbc:hsqldb:mem:" + UUID.randomUUID())
|
||||||
|
@ -133,15 +121,13 @@ class LiquibaseAutoConfigurationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void jdbcConnectionDetailsAreUsedIfAvailable() {
|
void shouldUseMainDataSourceWhenThereIsNoLiquibaseSpecificConfiguration() {
|
||||||
this.contextRunner.withSystemProperties("shouldRun=false")
|
this.contextRunner.withSystemProperties("shouldRun=false")
|
||||||
.withUserConfiguration(EmbeddedDataSourceConfiguration.class, JdbcConnectionDetailsConfiguration.class)
|
.withUserConfiguration(EmbeddedDataSourceConfiguration.class, JdbcConnectionDetailsConfiguration.class)
|
||||||
.run(assertLiquibase((liquibase) -> {
|
.run((context) -> {
|
||||||
SimpleDriverDataSource dataSource = (SimpleDriverDataSource) liquibase.getDataSource();
|
SpringLiquibase liquibase = context.getBean(SpringLiquibase.class);
|
||||||
assertThat(dataSource.getUrl()).isEqualTo("jdbc:postgresql://database.example.com:12345/database-1");
|
assertThat(liquibase.getDataSource()).isSameAs(context.getBean(DataSource.class));
|
||||||
assertThat(dataSource.getUsername()).isEqualTo("user-1");
|
});
|
||||||
assertThat(dataSource.getPassword()).isEqualTo("secret-1");
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in New Issue