From 269d2404c25277913449dfc36784900a9b55bf45 Mon Sep 17 00:00:00 2001 From: George Gastaldi Date: Tue, 3 Dec 2024 21:14:21 -0300 Subject: [PATCH] Introduce Quarkus 3.18 Migration Scripts - This removes the `quarkus.flyway.clean-on-validation-error`. See https://github.com/quarkusio/quarkus/pull/44912 --- .../updates/core/CoreUpdate318Test.java | 39 +++++++++++++++++++ .../resources/quarkus-updates/core/3.18.yaml | 9 +++++ 2 files changed, 48 insertions(+) create mode 100644 recipes-tests/src/test/java/io/quarkus/updates/core/CoreUpdate318Test.java create mode 100644 recipes/src/main/resources/quarkus-updates/core/3.18.yaml diff --git a/recipes-tests/src/test/java/io/quarkus/updates/core/CoreUpdate318Test.java b/recipes-tests/src/test/java/io/quarkus/updates/core/CoreUpdate318Test.java new file mode 100644 index 0000000000..e5d325ec01 --- /dev/null +++ b/recipes-tests/src/test/java/io/quarkus/updates/core/CoreUpdate318Test.java @@ -0,0 +1,39 @@ +package io.quarkus.updates.core; + +import org.intellij.lang.annotations.Language; +import org.junit.jupiter.api.Test; +import org.openrewrite.java.JavaParser; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.RewriteTest; +import org.openrewrite.test.TypeValidation; + +import java.nio.file.Path; + +import static org.openrewrite.properties.Assertions.properties; + +public class CoreUpdate318Test implements RewriteTest { + + @Override + public void defaults(RecipeSpec spec) { + CoreTestUtil.recipe(spec, Path.of("quarkus-updates", "core", "3.18.yaml"), "3.18.0") + .parser(JavaParser.fromJavaVersion().logCompilationWarningsAndErrors(true)) + .typeValidationOptions(TypeValidation.none()); + } + + @Test + void testFlywayConfigurationUpdated() { + + @Language("properties") + String originalProperties = """ + quarkus.flyway."datasource-name".clean-on-validation-error=true + %test.quarkus.flyway."datasource-name".clean-on-validation-error=true + quarkus.flyway.clean-on-validation-error=true + """; + + @Language("properties") + String afterProperties = """ + """; + + rewriteRun(properties(originalProperties, afterProperties, spec -> spec.path("src/main/resources/application.properties"))); + } +} diff --git a/recipes/src/main/resources/quarkus-updates/core/3.18.yaml b/recipes/src/main/resources/quarkus-updates/core/3.18.yaml new file mode 100644 index 0000000000..a46f13bb3d --- /dev/null +++ b/recipes/src/main/resources/quarkus-updates/core/3.18.yaml @@ -0,0 +1,9 @@ +##### +# Remove the `quarkus.flyway.clean-on-validation-error` property +##### +--- +type: specs.openrewrite.org/v1beta/recipe +name: io.quarkus.updates.core.quarkus318.RemoveFlywayCleanOnValidationError +recipeList: + - org.openrewrite.quarkus.DeleteQuarkusProperty: + propertyKey: quarkus\.flyway\.(.+\.)?clean-on-validation-error