From 629e1d3ac5e2fcf2622c3ba3a185c9544b115da6 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Tue, 9 Nov 2021 07:29:34 +0100 Subject: [PATCH] Upgrade to Flyway 8.0.3 Closes gh-28572 --- .../flyway/FlywayAutoConfiguration.java | 9 +++-- .../flyway/FlywayProperties.java | 38 +++++++++++++++---- .../flyway/FlywayAutoConfigurationTests.java | 29 ++++++++++---- .../spring-boot-dependencies/build.gradle | 2 +- 4 files changed, 60 insertions(+), 18 deletions(-) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java index 7e61621030..0b5a6cb6bd 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration.java @@ -241,15 +241,18 @@ public class FlywayAutoConfiguration { map.from(properties.getJdbcProperties()).whenNot(Map::isEmpty) .to((jdbcProperties) -> configuration.jdbcProperties(jdbcProperties)); // No method reference for compatibility with Flyway 6.x + map.from(properties.getKerberosConfigFile()) + .to((configFile) -> configuration.kerberosConfigFile(configFile)); + // No method reference for compatibility with Flyway 6.x map.from(properties.getOracleKerberosCacheFile()) .to((cacheFile) -> configuration.oracleKerberosCacheFile(cacheFile)); // No method reference for compatibility with Flyway 6.x - map.from(properties.getOracleKerberosConfigFile()) - .to((configFile) -> configuration.oracleKerberosConfigFile(configFile)); - // No method reference for compatibility with Flyway 6.x map.from(properties.getOutputQueryResults()) .to((outputQueryResults) -> configuration.outputQueryResults(outputQueryResults)); // No method reference for compatibility with Flyway 6.x + map.from(properties.getSqlServerKerberosLoginFile()).to((sqlServerKerberosLoginFile) -> configuration + .sqlServerKerberosLoginFile(sqlServerKerberosLoginFile)); + // No method reference for compatibility with Flyway 6.x map.from(properties.getSkipExecutingMigrations()) .to((skipExecutingMigrations) -> configuration.skipExecutingMigrations(skipExecutingMigrations)); // No method reference for compatibility with Flyway < 7.8 diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java index f4b8aa3c9c..e640d47f45 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/flyway/FlywayProperties.java @@ -334,16 +334,16 @@ public class FlywayProperties { */ private Map jdbcProperties = new HashMap<>(); + /** + * Path of the Kerberos config file. Requires Flyway Teams. + */ + private String kerberosConfigFile; + /** * Path of the Oracle Kerberos cache file. Requires Flyway Teams. */ private String oracleKerberosCacheFile; - /** - * Path of the Oracle Kerberos config file. Requires Flyway Teams. - */ - private String oracleKerberosConfigFile; - /** * Location of the Oracle Wallet, used to sign-in to the database automatically. * Requires Flyway Teams. @@ -356,6 +356,11 @@ public class FlywayProperties { */ private Boolean outputQueryResults; + /** + * Path to the SQL Server Kerberos login file. Requires Flyway Teams. + */ + private String sqlServerKerberosLoginFile; + /** * Whether Flyway should skip executing the contents of the migrations and only update * the schema history table. Requires Flyway teams. @@ -856,6 +861,14 @@ public class FlywayProperties { this.jdbcProperties = jdbcProperties; } + public String getKerberosConfigFile() { + return this.kerberosConfigFile; + } + + public void setKerberosConfigFile(String kerberosConfigFile) { + this.kerberosConfigFile = kerberosConfigFile; + } + public String getOracleKerberosCacheFile() { return this.oracleKerberosCacheFile; } @@ -864,12 +877,15 @@ public class FlywayProperties { this.oracleKerberosCacheFile = oracleKerberosCacheFile; } + @DeprecatedConfigurationProperty(replacement = "spring.flyway.kerberos-config-file") + @Deprecated public String getOracleKerberosConfigFile() { - return this.oracleKerberosConfigFile; + return getKerberosConfigFile(); } + @Deprecated public void setOracleKerberosConfigFile(String oracleKerberosConfigFile) { - this.oracleKerberosConfigFile = oracleKerberosConfigFile; + setKerberosConfigFile(oracleKerberosConfigFile); } public Boolean getOutputQueryResults() { @@ -880,6 +896,14 @@ public class FlywayProperties { this.outputQueryResults = outputQueryResults; } + public String getSqlServerKerberosLoginFile() { + return this.sqlServerKerberosLoginFile; + } + + public void setSqlServerKerberosLoginFile(String sqlServerKerberosLoginFile) { + this.sqlServerKerberosLoginFile = sqlServerKerberosLoginFile; + } + public Boolean getSkipExecutingMigrations() { return this.skipExecutingMigrations; } diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java index 3e6b1ae392..3f79f222c4 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/flyway/FlywayAutoConfigurationTests.java @@ -602,6 +602,21 @@ class FlywayAutoConfigurationTests { .run(validateFlywayTeamsPropertyOnly("jdbcProperties")); } + @Test + void kerberosConfigFileIsCorrectlyMapped() { + this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) + .withPropertyValues("spring.flyway.kerberos-config-file=/tmp/config") + .run(validateFlywayTeamsPropertyOnly("kerberosConfigFile")); + } + + @Test + @Deprecated + void oracleKerberosConfigFileIsCorrectlyMappedToReplacementProperty() { + this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) + .withPropertyValues("spring.flyway.oracle-kerberos-config-file=/tmp/config") + .run(validateFlywayTeamsPropertyOnly("kerberosConfigFile")); + } + @Test void oracleKerberosCacheFileIsCorrectlyMapped() { this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) @@ -609,13 +624,6 @@ class FlywayAutoConfigurationTests { .run(validateFlywayTeamsPropertyOnly("oracle.kerberosCacheFile")); } - @Test - void oracleKerberosConfigFileIsCorrectlyMapped() { - this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) - .withPropertyValues("spring.flyway.oracle-kerberos-config-file=/tmp/config") - .run(validateFlywayTeamsPropertyOnly("oracle.kerberosConfigFile")); - } - @Test void outputQueryResultsIsCorrectlyMapped() { this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) @@ -623,6 +631,13 @@ class FlywayAutoConfigurationTests { .run(validateFlywayTeamsPropertyOnly("outputQueryResults")); } + @Test + void sqlServerKerberosLoginFileIsCorrectlyMapped() { + this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) + .withPropertyValues("spring.flyway.sql-server-kerberos-login-file=/tmp/config") + .run(validateFlywayTeamsPropertyOnly("sqlServer.kerberosLoginFile")); + } + @Test void skipExecutingMigrationsIsCorrectlyMapped() { this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) diff --git a/spring-boot-project/spring-boot-dependencies/build.gradle b/spring-boot-project/spring-boot-dependencies/build.gradle index 748709f155..7aadd34ca5 100644 --- a/spring-boot-project/spring-boot-dependencies/build.gradle +++ b/spring-boot-project/spring-boot-dependencies/build.gradle @@ -309,7 +309,7 @@ bom { ] } } - library("Flyway", "8.0.2") { + library("Flyway", "8.0.3") { group("org.flywaydb") { modules = [ "flyway-core"