diff --git a/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelQuarkusTestUtil.java b/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelQuarkusTestUtil.java index 454f3acd22..1d76cc74ea 100644 --- a/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelQuarkusTestUtil.java +++ b/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelQuarkusTestUtil.java @@ -1,7 +1,13 @@ package io.quarkus.updates.camel; +import org.openrewrite.Recipe; +import org.openrewrite.config.Environment; +import org.openrewrite.config.YamlResourceLoader; import org.openrewrite.test.RecipeSpec; +import java.net.URI; +import java.util.Properties; + public class CamelQuarkusTestUtil { public static RecipeSpec recipe3alpha(RecipeSpec spec) { @@ -30,7 +36,18 @@ private static RecipeSpec recipe(RecipeSpec spec, String version) { } public static RecipeSpec recipe(RecipeSpec spec, String version, String... activerecipes) { - return spec.recipeFromResource("/quarkus-updates/org.apache.camel.quarkus/camel-quarkus/" + version + ".yaml", activerecipes); - } + YamlResourceLoader yrl = new YamlResourceLoader( + CamelQuarkusTestUtil.class.getResourceAsStream("/quarkus-updates/org.apache.camel.quarkus/camel-quarkus/" + version + ".yaml"), URI.create("rewrite.yml"), new Properties()); + Recipe r = Environment.builder() + //classpath loader has to be initialized to load recipes from camel-upgrade-recipes dependency + .scanYamlResources() + //yaml single recipe with Quarkus recipe has to be present as it contains active recipe + .load(yrl) + .build() + .activateRecipes(activerecipes); + + spec.recipes(r); + return spec; + } } diff --git a/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate41Test.java b/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate41Test.java index 6dce7ee4f4..e009b19a82 100644 --- a/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate41Test.java +++ b/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate41Test.java @@ -1,4 +1,16 @@ package io.quarkus.updates.camel; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.TypeValidation; + public class CamelUpdate41Test extends org.apache.camel.updates.camel44.CamelUpdate41Test { + + @Override + public void defaults(RecipeSpec spec) { + //let the parser be initialized in the camel parent + super.defaults(spec); + //recipe has to be loaded differently + CamelQuarkusTestUtil.recipe3_8(spec) + .typeValidationOptions(TypeValidation.none()); + } } diff --git a/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate42Test.java b/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate42Test.java index f5db1e5a4a..d9d1f80218 100644 --- a/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate42Test.java +++ b/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate42Test.java @@ -1,13 +1,18 @@ package io.quarkus.updates.camel; -import org.junit.jupiter.api.Test; -import org.openrewrite.java.JavaParser; -import org.openrewrite.properties.Assertions; import org.openrewrite.test.RecipeSpec; -import org.openrewrite.test.RewriteTest; import org.openrewrite.test.TypeValidation; import static org.openrewrite.java.Assertions.java; public class CamelUpdate42Test extends org.apache.camel.updates.camel44.CamelUpdate42Test { + + @Override + public void defaults(RecipeSpec spec) { + //let the parser be initialized in the camel parent + super.defaults(spec); + //recipe has to be loaded differently + CamelQuarkusTestUtil.recipe3_8(spec) + .typeValidationOptions(TypeValidation.none()); + } } diff --git a/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate43Test.java b/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate43Test.java index 9845cce934..1a14c8eefb 100644 --- a/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate43Test.java +++ b/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate43Test.java @@ -1,4 +1,16 @@ package io.quarkus.updates.camel; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.TypeValidation; + public class CamelUpdate43Test extends org.apache.camel.updates.camel44.CamelUpdate43Test { + + @Override + public void defaults(RecipeSpec spec) { + //let the parser be initialized in the camel parent + super.defaults(spec); + //recipe has to be loaded differently + CamelQuarkusTestUtil.recipe3_8(spec) + .typeValidationOptions(TypeValidation.none()); + } } diff --git a/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate44Test.java b/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate44Test.java index d18040433d..2297fc20c8 100644 --- a/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate44Test.java +++ b/recipes-tests/src/test/java/io/quarkus/updates/camel/CamelUpdate44Test.java @@ -1,4 +1,16 @@ package io.quarkus.updates.camel; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.TypeValidation; + public class CamelUpdate44Test extends org.apache.camel.updates.camel44.CamelUpdate44Test { + + @Override + public void defaults(RecipeSpec spec) { + //let the parser be initialized in the camel parent + super.defaults(spec); + //recipe has to be loaded differently + CamelQuarkusTestUtil.recipe3_8(spec) + .typeValidationOptions(TypeValidation.none()); + } } diff --git a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CameXmlDslRecipeTest.java b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CameXmlDslRecipeTest.java index 957b889624..b6d0e47781 100644 --- a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CameXmlDslRecipeTest.java +++ b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CameXmlDslRecipeTest.java @@ -1,4 +1,17 @@ package io.quarkus.updates.camel.camel40; +import io.quarkus.updates.camel.CamelQuarkusTestUtil; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.TypeValidation; + public class CameXmlDslRecipeTest extends org.apache.camel.updates.camel40.CameXmlDslRecipeTest { + + @Override + public void defaults(RecipeSpec spec) { + //let the parser be initialized in the camel parent + super.defaults(spec); + //recipe has to be loaded differently + CamelQuarkusTestUtil.recipe3alpha(spec) + .typeValidationOptions(TypeValidation.none()); + } } diff --git a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelAPIsPropertiesTest.java b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelAPIsPropertiesTest.java index 92d53bb689..1ede4da4d4 100644 --- a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelAPIsPropertiesTest.java +++ b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelAPIsPropertiesTest.java @@ -1,4 +1,17 @@ package io.quarkus.updates.camel.camel40; +import io.quarkus.updates.camel.CamelQuarkusTestUtil; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.TypeValidation; + public class CamelAPIsPropertiesTest extends org.apache.camel.updates.camel40.CamelAPIsPropertiesTest { + + @Override + public void defaults(RecipeSpec spec) { + //let the parser be initialized in the camel parent + super.defaults(spec); + //recipe has to be loaded differently + CamelQuarkusTestUtil.recipe3alpha(spec) + .typeValidationOptions(TypeValidation.none()); + } } diff --git a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelAPIsTest.java b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelAPIsTest.java index 7db026d0c0..07bcd86dcf 100644 --- a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelAPIsTest.java +++ b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelAPIsTest.java @@ -1,4 +1,17 @@ package io.quarkus.updates.camel.camel40; +import io.quarkus.updates.camel.CamelQuarkusTestUtil; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.TypeValidation; + public class CamelAPIsTest extends org.apache.camel.updates.camel40.CamelAPIsTest { -} \ No newline at end of file + + @Override + public void defaults(RecipeSpec spec) { + //let the parser be initialized in the camel parent + super.defaults(spec); + //recipe has to be loaded differently + CamelQuarkusTestUtil.recipe3alpha(spec) + .typeValidationOptions(TypeValidation.none()); + } +} diff --git a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelBeanRecipeTest.java b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelBeanRecipeTest.java index 4315813d37..4e3dd6c79f 100644 --- a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelBeanRecipeTest.java +++ b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelBeanRecipeTest.java @@ -1,4 +1,17 @@ package io.quarkus.updates.camel.camel40; +import io.quarkus.updates.camel.CamelQuarkusTestUtil; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.TypeValidation; + public class CamelBeanRecipeTest extends org.apache.camel.updates.camel40.CamelBeanRecipeTest { + + @Override + public void defaults(RecipeSpec spec) { + //let the parser be initialized in the camel parent + super.defaults(spec); + //recipe has to be loaded differently + CamelQuarkusTestUtil.recipe3alpha(spec) + .typeValidationOptions(TypeValidation.none()); + } } diff --git a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelEIPRecipeTest.java b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelEIPRecipeTest.java index 73b59fec86..c0dac0619e 100644 --- a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelEIPRecipeTest.java +++ b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelEIPRecipeTest.java @@ -1,4 +1,17 @@ package io.quarkus.updates.camel.camel40; +import io.quarkus.updates.camel.CamelQuarkusTestUtil; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.TypeValidation; + public class CamelEIPRecipeTest extends org.apache.camel.updates.camel40.CamelEIPRecipeTest { + + @Override + public void defaults(RecipeSpec spec) { + //let the parser be initialized in the camel parent + super.defaults(spec); + //recipe has to be loaded differently + CamelQuarkusTestUtil.recipe3alpha(spec) + .typeValidationOptions(TypeValidation.none()); + } } diff --git a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelHttpTest.java b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelHttpTest.java index 5edaf3d6bc..54b4ae27aa 100644 --- a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelHttpTest.java +++ b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelHttpTest.java @@ -1,4 +1,17 @@ package io.quarkus.updates.camel.camel40; +import io.quarkus.updates.camel.CamelQuarkusTestUtil; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.TypeValidation; + public class CamelHttpTest extends org.apache.camel.updates.camel40.CamelHttpTest { + + @Override + public void defaults(RecipeSpec spec) { + //let the parser be initialized in the camel parent + super.defaults(spec); + //recipe has to be loaded differently + CamelQuarkusTestUtil.recipe3alpha(spec) + .typeValidationOptions(TypeValidation.none()); + } } diff --git a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelJmxTest.java b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelJmxTest.java index 0045833f1c..e5775fff9e 100644 --- a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelJmxTest.java +++ b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelJmxTest.java @@ -1,4 +1,17 @@ package io.quarkus.updates.camel.camel40; +import io.quarkus.updates.camel.CamelQuarkusTestUtil; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.TypeValidation; + public class CamelJmxTest extends org.apache.camel.updates.camel40.CamelAPIsTest { + + @Override + public void defaults(RecipeSpec spec) { + //let the parser be initialized in the camel parent + super.defaults(spec); + //recipe has to be loaded differently + CamelQuarkusTestUtil.recipe3alpha(spec) + .typeValidationOptions(TypeValidation.none()); + } } diff --git a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelYamlTest.java b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelYamlTest.java index 5758f5ca3f..e4f7957aea 100644 --- a/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelYamlTest.java +++ b/recipes-tests/src/test/java/io/quarkus/updates/camel/camel40/CamelYamlTest.java @@ -1,4 +1,17 @@ package io.quarkus.updates.camel.camel40; +import io.quarkus.updates.camel.CamelQuarkusTestUtil; +import org.openrewrite.test.RecipeSpec; +import org.openrewrite.test.TypeValidation; + public class CamelYamlTest extends org.apache.camel.updates.camel40.CamelYamlTest { + + @Override + public void defaults(RecipeSpec spec) { + //let the parser be initialized in the camel parent + super.defaults(spec); + //recipe has to be loaded differently + CamelQuarkusTestUtil.recipe3alpha(spec) + .typeValidationOptions(TypeValidation.none()); + } } diff --git a/recipes/src/main/resources/quarkus-updates/org.apache.camel.quarkus/camel-quarkus/3alpha.yaml b/recipes/src/main/resources/quarkus-updates/org.apache.camel.quarkus/camel-quarkus/3alpha.yaml index 33acd10ab6..6e8f2e4ee6 100644 --- a/recipes/src/main/resources/quarkus-updates/org.apache.camel.quarkus/camel-quarkus/3alpha.yaml +++ b/recipes/src/main/resources/quarkus-updates/org.apache.camel.quarkus/camel-quarkus/3alpha.yaml @@ -37,6 +37,8 @@ description: Migrate `camel3` quarkus application to `camel4` quarkus. recipeList: # use the recipe from camel standalone migration - org.apache.camel.updates.camel40.CamelMigrationRecipe + # workaround for https://issues.apache.org/jira/browse/CAMEL-21131 + - org.openrewrite.java.camel.migrate.ChangePropertyValue --- type: specs.openrewrite.org/v1beta/recipe name: org.openrewrite.java.camel.migrate.removedExtensions