Skip to content

Commit

Permalink
Merge pull request #267 from JiriOndrusek/upgrade-to-camel-4.10.0
Browse files Browse the repository at this point in the history
Bump camel-upgrade-recipes to 4.10.0
  • Loading branch information
ia3andy authored Mar 3, 2025
2 parents 4472b2d + 902ed03 commit cfaaedc
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 91 deletions.
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>7.0.3</rewrite-gradle-plugin.version>
<!-- https://github.com/apache/camel-upgrade-recipes -->
<camel-upgrade-recipes.version>4.9.0</camel-upgrade-recipes.version>
<camel-upgrade-recipes.version>4.10.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
14 changes: 14 additions & 0 deletions recipes-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<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>
<test.camel-quarkus-3-17.camel-version>4.9.0</test.camel-quarkus-3-17.camel-version>
<test.camel-quarkus-3-18.camel-version>4.10.0</test.camel-quarkus-3-18.camel-version>

</properties>

Expand Down Expand Up @@ -454,6 +455,19 @@
<version>${test.camel-quarkus-3-15.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<!-- camel quarkus 3.18 (camel 4.10.0) test dependencies-->
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-smb</artifactId>
<version>${test.camel-quarkus-3-17.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>org.apache.camel</groupId>
<artifactId>camel-azure-files</artifactId>
<version>${test.camel-quarkus-3-17.camel-version}</version>
<outputDirectory>${rewrite-tmp-classpath}</outputDirectory>
</artifactItem>

<artifactItem>
<groupId>jakarta.xml.bind</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public static RecipeSpec recipe3_17(RecipeSpec spec, String... activeRecipes) {
return recipeForVersion("3.17", spec, activeRecipes);
}

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

private static RecipeSpec recipeForVersion(String version, RecipeSpec spec, String... activeRecipes) {
if(activeRecipes.length == 0) {
return recipe(spec, version);
Expand All @@ -45,6 +49,7 @@ private static RecipeSpec recipe(RecipeSpec spec, String version) {
case "3alpha" -> new String[] {"io.quarkus.updates.camel.camel40.CamelQuarkusMigrationRecipe"};
case "3.15" -> new String[] {"io.quarkus.updates.camel.camel47.CamelQuarkusMigrationRecipe"};
case "3.17" -> new String[] {"io.quarkus.updates.camel.camel49.CamelQuarkusMigrationRecipe"};
case "3.18" -> new String[] {"io.quarkus.updates.camel.camel410.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
@@ -0,0 +1,16 @@
package io.quarkus.updates.camel;

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

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

@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_18(spec)
.typeValidationOptions(TypeValidation.none());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,94 +16,4 @@ public void defaults(RecipeSpec spec) {
CamelQuarkusTestUtil.recipe3_17(spec)
.typeValidationOptions(TypeValidation.none());
}

/**
* Quarkus-updates recipes somehow groups imports in comparison to camel-upgrade-recipes.
* (The original test method contains a lot of imports which are grouped in the result)
* Therefore, I override this test method to avoid grouping behavior.
* According to the doc, it should b possible to declar import style, see https://docs.openrewrite.org/reference/yaml-format-reference#style-example
*
* <a href="https://camel.apache.org/manual/camel-4x-upgrade-guide-4_9.html#_camel_debezium">camel-debezium</a>
*/
@Test
@Override
public void testDebezium() {
//language=java
rewriteRun(java(
"""
import org.apache.camel.component.debezium.configuration.Db2ConnectorEmbeddedDebeziumConfiguration;
import org.apache.camel.component.debezium.configuration.MongodbConnectorEmbeddedDebeziumConfiguration;
import org.apache.camel.component.debezium.DebeziumMongodbComponentConfigurer;
import org.apache.camel.component.debezium.DebeziumMongodbComponent;
import org.apache.camel.component.debezium.configuration.MySqlConnectorEmbeddedDebeziumConfiguration;
import org.apache.camel.component.debezium.DebeziumMySqlComponent;
import org.apache.camel.component.debezium.configuration.OracleConnectorEmbeddedDebeziumConfiguration;
import org.apache.camel.component.debezium.DebeziumOracleComponent;
import org.apache.camel.component.debezium.configuration.PostgresConnectorEmbeddedDebeziumConfiguration;
import org.apache.camel.component.debezium.DebeziumPostgresComponent;
import org.apache.camel.component.debezium.configuration.SqlserverConnectorEmbeddedDebeziumConfiguration;
import org.apache.camel.component.debezium.DebeziumSqlserverComponent;
public class DebeziumTest {
public void method() {
//db2
Db2ConnectorEmbeddedDebeziumConfiguration conf = null;
DebeziumDb2Component component = null;
//mongodb
MongodbConnectorEmbeddedDebeziumConfiguration conf = null;
DebeziumMongodbComponent component = null;
//mysql
MySqlConnectorEmbeddedDebeziumConfiguration conf = null;
DebeziumMySqlComponent component = null;
//oracle
OracleConnectorEmbeddedDebeziumConfiguration conf = null;
DebeziumOracleComponent component = null;
//postgres
PostgresConnectorEmbeddedDebeziumConfiguration conf = null;
DebeziumPostgresComponent component = null;
//sqlserver
SqlserverConnectorEmbeddedDebeziumConfiguration conf = null;
DebeziumSqlserverComponent component = null;
}
}
""",
"""
import org.apache.camel.component.debezium.configuration.MongodbConnectorEmbeddedDebeziumConfiguration;
import org.apache.camel.component.debezium.configuration.SqlserverConnectorEmbeddedDebeziumConfiguration;
import org.apache.camel.component.debezium.db2.configuration.Db2ConnectorEmbeddedDebeziumConfiguration;
import org.apache.camel.component.debezium.mongodb.DebeziumMongodbComponent;
import org.apache.camel.component.debezium.mysql.DebeziumMySqlComponent;
import org.apache.camel.component.debezium.mysql.configuration.MySqlConnectorEmbeddedDebeziumConfiguration;
import org.apache.camel.component.debezium.oracle.DebeziumOracleComponent;
import org.apache.camel.component.debezium.oracle.configuration.OracleConnectorEmbeddedDebeziumConfiguration;
import org.apache.camel.component.debezium.postgres.DebeziumPostgresComponent;
import org.apache.camel.component.debezium.postgres.configuration.PostgresConnectorEmbeddedDebeziumConfiguration;
import org.apache.camel.component.debezium.sqlserver.DebeziumSqlserverComponent;
public class DebeziumTest {
public void method() {
//db2
Db2ConnectorEmbeddedDebeziumConfiguration conf = null;
DebeziumDb2Component component = null;
//mongodb
MongodbConnectorEmbeddedDebeziumConfiguration conf = null;
DebeziumMongodbComponent component = null;
//mysql
MySqlConnectorEmbeddedDebeziumConfiguration conf = null;
DebeziumMySqlComponent component = null;
//oracle
OracleConnectorEmbeddedDebeziumConfiguration conf = null;
DebeziumOracleComponent component = null;
//postgres
PostgresConnectorEmbeddedDebeziumConfiguration conf = null;
DebeziumPostgresComponent component = null;
//sqlserver
SqlserverConnectorEmbeddedDebeziumConfiguration conf = null;
DebeziumSqlserverComponent component = null;
}
}
"""));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#
# Copyright 2021 the original author or authors.
# <p>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# <p>
# https://www.apache.org/licenses/LICENSE-2.0
# <p>
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#####
# Rules coming from https://camel.apache.org/manual/camel-4x-upgrade-guide.html
#####

#####
# Update the Camel - Quarkus extensions
#####
---
type: specs.openrewrite.org/v1beta/recipe
name: io.quarkus.updates.camel.camel410.CamelQuarkusMigrationRecipe
displayName: Migrates `camel 4.9` application to `camel 4.10`
description: Migrates `camel 4.9` quarkus application to `camel 4.10`.
recipeList:
# use the recipe from camel upgrade recipes project
- org.apache.camel.upgrade.camel410.CamelMigrationRecipe

0 comments on commit cfaaedc

Please sign in to comment.