Merge branch '2.7.x'

pull/29274/head
Stephane Nicoll 3 years ago
commit fed89f98aa

@ -90,6 +90,7 @@ dependencies {
exclude group: "commons-logging", module: "commons-logging" exclude group: "commons-logging", module: "commons-logging"
} }
optional("org.flywaydb:flyway-core") optional("org.flywaydb:flyway-core")
optional("org.flywaydb:flyway-sqlserver")
optional("org.freemarker:freemarker") optional("org.freemarker:freemarker")
optional("org.hibernate:hibernate-core-jakarta") optional("org.hibernate:hibernate-core-jakarta")
optional("org.hibernate:hibernate-jcache") { optional("org.hibernate:hibernate-jcache") {

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2021 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -32,6 +32,8 @@ import org.flywaydb.core.api.MigrationVersion;
import org.flywaydb.core.api.callback.Callback; import org.flywaydb.core.api.callback.Callback;
import org.flywaydb.core.api.configuration.FluentConfiguration; import org.flywaydb.core.api.configuration.FluentConfiguration;
import org.flywaydb.core.api.migration.JavaMigration; import org.flywaydb.core.api.migration.JavaMigration;
import org.flywaydb.core.internal.plugin.PluginRegister;
import org.flywaydb.database.sqlserver.SQLServerConfigurationExtension;
import org.springframework.beans.factory.ObjectProvider; import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.AutoConfigureAfter; import org.springframework.boot.autoconfigure.AutoConfigureAfter;
@ -249,9 +251,8 @@ public class FlywayAutoConfiguration {
// No method reference for compatibility with Flyway 6.x // No method reference for compatibility with Flyway 6.x
map.from(properties.getOutputQueryResults()) map.from(properties.getOutputQueryResults())
.to((outputQueryResults) -> configuration.outputQueryResults(outputQueryResults)); .to((outputQueryResults) -> configuration.outputQueryResults(outputQueryResults));
// No method reference for compatibility with Flyway 6.x map.from(properties.getSqlServerKerberosLoginFile()).whenNonNull()
map.from(properties.getSqlServerKerberosLoginFile()).to((sqlServerKerberosLoginFile) -> configuration .to(this::configureSqlServerKerberosLoginFile);
.sqlServerKerberosLoginFile(sqlServerKerberosLoginFile));
// No method reference for compatibility with Flyway 6.x // No method reference for compatibility with Flyway 6.x
map.from(properties.getSkipExecutingMigrations()) map.from(properties.getSkipExecutingMigrations())
.to((skipExecutingMigrations) -> configuration.skipExecutingMigrations(skipExecutingMigrations)); .to((skipExecutingMigrations) -> configuration.skipExecutingMigrations(skipExecutingMigrations));
@ -295,6 +296,12 @@ public class FlywayAutoConfiguration {
} }
} }
private void configureSqlServerKerberosLoginFile(String sqlServerKerberosLoginFile) {
SQLServerConfigurationExtension sqlServerConfigurationExtension = PluginRegister
.getPlugin(SQLServerConfigurationExtension.class);
sqlServerConfigurationExtension.setKerberosLoginFile(sqlServerKerberosLoginFile);
}
private void configureValidateMigrationNaming(FluentConfiguration configuration, private void configureValidateMigrationNaming(FluentConfiguration configuration,
boolean validateMigrationNaming) { boolean validateMigrationNaming) {
try { try {

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2021 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -33,6 +33,8 @@ import org.flywaydb.core.api.callback.Context;
import org.flywaydb.core.api.callback.Event; import org.flywaydb.core.api.callback.Event;
import org.flywaydb.core.api.migration.JavaMigration; import org.flywaydb.core.api.migration.JavaMigration;
import org.flywaydb.core.internal.license.FlywayTeamsUpgradeRequiredException; import org.flywaydb.core.internal.license.FlywayTeamsUpgradeRequiredException;
import org.flywaydb.core.internal.plugin.PluginRegister;
import org.flywaydb.database.sqlserver.SQLServerConfigurationExtension;
import org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform; import org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -629,9 +631,15 @@ class FlywayAutoConfigurationTests {
@Test @Test
void sqlServerKerberosLoginFileIsCorrectlyMapped() { void sqlServerKerberosLoginFileIsCorrectlyMapped() {
try {
this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class) this.contextRunner.withUserConfiguration(EmbeddedDataSourceConfiguration.class)
.withPropertyValues("spring.flyway.sql-server-kerberos-login-file=/tmp/config") .withPropertyValues("spring.flyway.sql-server-kerberos-login-file=/tmp/config")
.run(validateFlywayTeamsPropertyOnly("sqlServer.kerberosLoginFile")); .run(validateFlywayTeamsPropertyOnly("sqlserver.kerberos.login.file"));
}
finally {
// Reset to default value
PluginRegister.getPlugin(SQLServerConfigurationExtension.class).setKerberosLoginFile(null);
}
} }
@Test @Test

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2021 the original author or authors. * Copyright 2012-2022 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -110,6 +110,8 @@ class FlywayPropertiesTests {
// Properties specific settings // Properties specific settings
ignoreProperties(properties, "url", "driverClassName", "user", "password", "enabled", "checkLocation", ignoreProperties(properties, "url", "driverClassName", "user", "password", "enabled", "checkLocation",
"createDataSource"); "createDataSource");
// Property that moved to a separate SQL plugin
ignoreProperties(properties, "sqlServerKerberosLoginFile");
// High level object we can't set with properties // High level object we can't set with properties
ignoreProperties(configuration, "callbacks", "classLoader", "dataSource", "javaMigrations", ignoreProperties(configuration, "callbacks", "classLoader", "dataSource", "javaMigrations",
"javaMigrationClassProvider", "resourceProvider", "resolvers"); "javaMigrationClassProvider", "resourceProvider", "resolvers");

@ -218,10 +218,11 @@ bom {
] ]
} }
} }
library("Flyway", "8.0.4") { library("Flyway", "8.3.0") {
group("org.flywaydb") { group("org.flywaydb") {
modules = [ modules = [
"flyway-core" "flyway-core",
"flyway-sqlserver"
] ]
plugins = [ plugins = [
"flyway-maven-plugin" "flyway-maven-plugin"

@ -13,7 +13,7 @@
name="com.puppycrawl.tools.checkstyle.checks.imports.IllegalImportCheck"> name="com.puppycrawl.tools.checkstyle.checks.imports.IllegalImportCheck">
<property name="regexp" value="true" /> <property name="regexp" value="true" />
<property name="illegalPkgs" <property name="illegalPkgs"
value="^sun.*, ^org\.apache\.commons\.(?!compress|dbcp2|logging|pool2).*, ^com\.datastax\.oss\.driver\.shaded.*, ^com\.google\.common.*, ^io\.micrometer\.shaded.*, ^org\.flywaydb\.core\.internal.*, ^org\.testcontainers\.shaded.*" /> value="^sun.*, ^org\.apache\.commons\.(?!compress|dbcp2|logging|pool2).*, ^com\.datastax\.oss\.driver\.shaded.*, ^com\.google\.common.*, ^io\.micrometer\.shaded.*, ^org\.testcontainers\.shaded.*" />
<property name="illegalClasses" <property name="illegalClasses"
value="^com\.hazelcast\.util\.Base64, ^org\.junit\.rules\.ExpectedException, ^org\.mockito\.InjectMocks, ^org\.slf4j\.LoggerFactory, ^org.springframework.context.annotation.ScannedGenericBeanDefinition, ^reactor\.core\.support\.Assert"/> value="^com\.hazelcast\.util\.Base64, ^org\.junit\.rules\.ExpectedException, ^org\.mockito\.InjectMocks, ^org\.slf4j\.LoggerFactory, ^org.springframework.context.annotation.ScannedGenericBeanDefinition, ^reactor\.core\.support\.Assert"/>
</module> </module>

Loading…
Cancel
Save