Skip to content

Commit

Permalink
Update camel-upgrade-recipes to 4.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JiriOndrusek committed Oct 3, 2024
1 parent fe60e2e commit 962321e
Show file tree
Hide file tree
Showing 22 changed files with 211 additions and 33 deletions.
16 changes: 15 additions & 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 All @@ -87,6 +87,20 @@
<nexus-staging-maven-plugin.version>1.7.0</nexus-staging-maven-plugin.version>
</properties>

<repositories>
<repository>
<id>apache.staging.camel</id>
<url>https://repository.apache.org/content/repositories/orgapachecamel-1750</url>
<name>Apache Camel Upgrade Recipes 4.8.0 Staging Repo</name>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>

<modules>
<module>recipes</module>
</modules>
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
Loading

0 comments on commit 962321e

Please sign in to comment.