Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update camel-upgrade-recipes to 4.8.0 #218

Merged
merged 1 commit into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<!-- https://plugins.gradle.org/plugin/org.openrewrite.rewrite -->
<rewrite-gradle-plugin.version>6.18.0</rewrite-gradle-plugin.version>
<!-- https://github.com/apache/camel-upgrade-recipes -->
<camel-upgrade-recipes.version>0.1</camel-upgrade-recipes.version>
<camel-upgrade-recipes.version>4.8.0</camel-upgrade-recipes.version>
<!-- align with https://central.sonatype.com/artifact/org.openrewrite/rewrite-core -->
<micrometer-core.version>1.9.17</micrometer-core.version>
<!-- tests-->
Expand Down
51 changes: 36 additions & 15 deletions recipes-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
<test.camel-quarkus-3-0.http-client-version>4.5.14</test.camel-quarkus-3-0.http-client-version>
<test.camel-quarkus-3-0.http-core-version>4.4.16</test.camel-quarkus-3-0.http-core-version>
<test.camel-quarkus-3-8.camel-version>4.0.3</test.camel-quarkus-3-8.camel-version>
<test.camel-quarkus-3-15.camel-version>4.8.0</test.camel-quarkus-3-15.camel-version>
<test.camel-quarkus-3-15.jakarta-servlet-api-version>6.0.0</test.camel-quarkus-3-15.jakarta-servlet-api-version>

</properties>

Expand Down Expand Up @@ -167,7 +169,7 @@

<!-- Recipes for testing camel-quarkus -->
<dependency>
<groupId>org.apache.camel</groupId>
<groupId>org.apache.camel.upgrade</groupId>
<artifactId>camel-upgrade-recipes</artifactId>
<version>${camel-upgrade-recipes.version}</version>
<scope>test</scope>
Expand Down Expand Up @@ -309,7 +311,7 @@
<version>${test.camel-quarkus-3-0.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<!--3.18 non-camel dependencies-->
<!--3.8 non-camel dependencies-->
<artifactItem>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
Expand All @@ -322,71 +324,90 @@
<version>${test.camel-quarkus-3-0.http-core-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<!-- camel 4.0 dependencies-->
<!-- camel quarkus 3.8 test dependencies-->
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-api</artifactId>
<artifactId>camel-base</artifactId>
<version>${test.camel-quarkus-3-8.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-base</artifactId>
<artifactId>camel-base-engine</artifactId>
<version>${test.camel-quarkus-3-8.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-base-engine</artifactId>
<artifactId>camel-endpointdsl</artifactId>
<version>${test.camel-quarkus-3-8.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-endpointdsl</artifactId>
<artifactId>camel-json-validator</artifactId>
<version>${test.camel-quarkus-3-8.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core-model</artifactId>
<artifactId>camel-kafka</artifactId>
<version>${test.camel-quarkus-3-8.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-json-validator</artifactId>
<artifactId>camel-saga</artifactId>
<version>${test.camel-quarkus-3-8.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-kafka</artifactId>
<artifactId>camel-tracing</artifactId>
<version>${test.camel-quarkus-3-8.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-saga</artifactId>
<artifactId>camel-spring-redis</artifactId>
<version>${test.camel-quarkus-3-8.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-support</artifactId>
<artifactId>camel-opensearch</artifactId>
<version>${test.camel-quarkus-3-8.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-tracing</artifactId>
<artifactId>camel-elasticsearch</artifactId>
<version>${test.camel-quarkus-3-8.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<!-- camel quarkus 3.15 test dependencies-->
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-util</artifactId>
<version>${test.camel-quarkus-3-8.camel-version}</version>
<artifactId>camel-elasticsearch</artifactId>
<version>${test.camel-quarkus-3-15.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http-common</artifactId>
<version>${test.camel-quarkus-3-15.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-undertow</artifactId>
<version>${test.camel-quarkus-3-15.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${test.camel-quarkus-3-15.jakarta-servlet-api-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
</artifactItems>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,27 @@ public static RecipeSpec recipe3alpha(RecipeSpec spec, String... activeRecipes)
}

public static RecipeSpec recipe3_8(RecipeSpec spec, String... activeRecipes) {
return recipeForVersion("3.8", spec, activeRecipes);
}

public static RecipeSpec recipe3_15(RecipeSpec spec, String... activeRecipes) {
return recipeForVersion("3.15", spec, activeRecipes);
}

private static RecipeSpec recipeForVersion(String version, RecipeSpec spec, String... activeRecipes) {
if(activeRecipes.length == 0) {
return recipe(spec, "3.8");
return recipe(spec, version);
}

return recipe(spec, "3.8", activeRecipes);
return recipe(spec, version, activeRecipes);
}


private static RecipeSpec recipe(RecipeSpec spec, String version) {
String[] defaultRecipes = switch (version) {
case "3.8" -> new String[] {"io.quarkus.updates.camel.camel44.CamelQuarkusMigrationRecipe"};
case "3alpha" -> new String[] {"io.quarkus.updates.camel.camel40.CamelQuarkusMigrationRecipe"};
case "3.15" -> new String[] {"io.quarkus.updates.camel.camel47.CamelQuarkusMigrationRecipe"};
default -> throw new IllegalArgumentException("Version '" + version + "' is not allowed!");
};
return recipe(spec, version, defaultRecipes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.TypeValidation;

public class CamelUpdate41Test extends org.apache.camel.updates.camel44.CamelUpdate41Test {
public class CamelUpdate41Test extends org.apache.camel.upgrade.camel44.CamelUpdate41Test {

@Override
public void defaults(RecipeSpec spec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import static org.openrewrite.java.Assertions.java;

public class CamelUpdate42Test extends org.apache.camel.updates.camel44.CamelUpdate42Test {
public class CamelUpdate42Test extends org.apache.camel.upgrade.camel44.CamelUpdate42Test {

@Override
public void defaults(RecipeSpec spec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.TypeValidation;

public class CamelUpdate43Test extends org.apache.camel.updates.camel44.CamelUpdate43Test {
public class CamelUpdate43Test extends org.apache.camel.upgrade.camel44.CamelUpdate43Test {

@Override
public void defaults(RecipeSpec spec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.TypeValidation;

public class CamelUpdate44Test extends org.apache.camel.updates.camel44.CamelUpdate44Test {
public class CamelUpdate44Test extends org.apache.camel.upgrade.camel44.CamelUpdate44Test {

@Override
public void defaults(RecipeSpec spec) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package io.quarkus.updates.camel;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.TypeValidation;

import static org.openrewrite.java.Assertions.java;

public class CamelUpdate45Test extends org.apache.camel.upgrade.CamelUpdate45Test {

@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_15(spec)
.typeValidationOptions(TypeValidation.none());
}

@Test
@Override
public void testSearch() {
//test has to be changed, because the result of camel 4.5 migration is a;so migrated in camel 4.6,
// therefore camel-quarkus migration from 3.8 to 3.15 has to expect both changes
rewriteRun(java(
"""
public class SearchTest {
public void test() {

org.apache.camel.component.es.aggregation.BulkRequestAggregationStrategy elasticAggregationStrategy = null;
org.apache.camel.component.opensearch.aggregation.BulkRequestAggregationStrategy openAggregationStrategy = null;
}
}
""",
"""
public class SearchTest {
public void test() {

org.apache.camel.component.es.aggregation.ElasticsearchBulkRequestAggregationStrategy elasticAggregationStrategy = null;
org.apache.camel.component.opensearch.aggregation.OpensearchBulkRequestAggregationStrategy openAggregationStrategy = null;
}
}
"""));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package io.quarkus.updates.camel;

import org.junit.jupiter.api.Disabled;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.TypeValidation;

public class CamelUpdate46Test extends org.apache.camel.upgrade.CamelUpdate46Test {

@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_15(spec)
.typeValidationOptions(TypeValidation.none());
}

//following tests have to be disabled, the migration they cover is happening only between Camel 4.5-4.6
// module which introduced the code before migration does not exist in Camel 4.4 (which is used by camel-quarkus 3.8)
@Disabled
@Override
public void testLangchainEmbeddings() {
}

@Disabled
@Override
public void testLangchainChat() {

}

//followig test is covered by CamelUpdate45Test.testSearch
@Disabled
@Override
public void testSearch() {
super.testSearch();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.quarkus.updates.camel;

import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.TypeValidation;

public class CamelUpdate47Test extends org.apache.camel.upgrade.CamelUpdate47Test {

@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_15(spec)
.typeValidationOptions(TypeValidation.none());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.TypeValidation;

public class CameXmlDslRecipeTest extends org.apache.camel.updates.camel40.CameXmlDslRecipeTest {
public class CameXmlDslRecipeTest extends org.apache.camel.upgrade.camel40.CameXmlDslRecipeTest {

@Override
public void defaults(RecipeSpec spec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.TypeValidation;

public class CamelAPIsPropertiesTest extends org.apache.camel.updates.camel40.CamelAPIsPropertiesTest {
public class CamelAPIsPropertiesTest extends org.apache.camel.upgrade.camel40.CamelAPIsPropertiesTest {

@Override
public void defaults(RecipeSpec spec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.TypeValidation;

public class CamelAPIsTest extends org.apache.camel.updates.camel40.CamelAPIsTest {
public class CamelAPIsTest extends org.apache.camel.upgrade.camel40.CamelAPIsTest {

@Override
public void defaults(RecipeSpec spec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.TypeValidation;

public class CamelBeanRecipeTest extends org.apache.camel.updates.camel40.CamelBeanRecipeTest {
public class CamelBeanRecipeTest extends org.apache.camel.upgrade.camel40.CamelBeanRecipeTest {

@Override
public void defaults(RecipeSpec spec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.TypeValidation;

public class CamelEIPRecipeTest extends org.apache.camel.updates.camel40.CamelEIPRecipeTest {
public class CamelEIPRecipeTest extends org.apache.camel.upgrade.camel40.CamelEIPRecipeTest {

@Override
public void defaults(RecipeSpec spec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.TypeValidation;

public class CamelHttpTest extends org.apache.camel.updates.camel40.CamelHttpTest {
public class CamelHttpTest extends org.apache.camel.upgrade.camel40.CamelHttpTest {

@Override
public void defaults(RecipeSpec spec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.TypeValidation;

public class CamelJmxTest extends org.apache.camel.updates.camel40.CamelAPIsTest {
public class CamelJmxTest extends org.apache.camel.upgrade.camel40.CamelAPIsTest {

@Override
public void defaults(RecipeSpec spec) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.TypeValidation;

public class CamelYamlTest extends org.apache.camel.updates.camel40.CamelYamlTest {
public class CamelYamlTest extends org.apache.camel.upgrade.camel40.CamelYamlTest {

@Override
public void defaults(RecipeSpec spec) {
Expand Down
2 changes: 1 addition & 1 deletion recipes/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@


<dependency>
<groupId>org.apache.camel</groupId>
<groupId>org.apache.camel.upgrade</groupId>
<artifactId>camel-upgrade-recipes</artifactId>
<version>${camel-upgrade-recipes.version}</version>
</dependency>
Expand Down
Loading
Loading