You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2024/04/17 06:07:09 UTC

(camel-quarkus) branch main updated (67759776a6 -> e911310ae8)

This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git


    from 67759776a6 Manage org.apache.httpcomponents.core5:httpcore5-h2 to avoid convergence issues with CXF
     new 8db8c50942 Remove redundant usage of xml-jaxb extension
     new 5250bf76bd Prevent xml-jaxb extension producing CamelModelToXMLDumperBuildItem if xml-io-dsl is present
     new e911310ae8 Use `xml-io-dsl` instead of `xml-jaxb` when using the `management` extension.

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../dsl/xml/io/deployment/XmlIoDslProcessor.java   | 10 ++++++
 .../camel/quarkus/dsl/xml/XmlIoDslRecorder.java}   | 13 +++----
 .../xml/jaxb/deployment/XmlJaxbProcessor.java      | 20 ++++++++++-
 extensions/management/deployment/pom.xml           |  2 +-
 extensions/management/runtime/pom.xml              |  2 +-
 .../dataformats-json/json-gson/pom.xml             | 34 ------------------
 .../dataformats-json/json-jackson/pom.xml          | 17 ---------
 .../dataformats-json/json-jsonb/pom.xml            | 34 ------------------
 integration-tests/dataformats-json-grouped/pom.xml | 17 ---------
 integration-tests/main-xml-io/pom.xml              |  6 +++-
 .../src/main/resources/application.properties      |  4 +++
 .../camel/quarkus/main/CoreMainXmlIoTest.java      | 22 ++++++++++--
 integration-tests/main-xml-jaxb/pom.xml            |  8 ++---
 .../quarkus/main/CoreMainXmlJaxbResource.java      |  5 ---
 .../src/main/resources/application.properties      |  2 +-
 .../src/main/resources/rests/my-rests.xml          | 26 --------------
 .../src/main/resources/rests/my-rests.yaml}        | 12 +++----
 .../src/main/resources/routes/my-routes.xml        | 41 ----------------------
 .../src/main/resources/routes/my-routes.yaml}      | 23 ++++++------
 .../src/main/resources/templates/my-templates.xml  | 29 ---------------
 .../main/resources/templates/my-templates.yaml}    | 12 ++++---
 .../camel/quarkus/main/CoreMainXmlJaxbTest.java    | 11 ++----
 22 files changed, 100 insertions(+), 250 deletions(-)
 copy extensions-core/{yaml-io/runtime/src/main/java/org/apache/camel/quarkus/yaml/io/YamlIORecorder.java => xml-io-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/xml/XmlIoDslRecorder.java} (75%)
 delete mode 100644 integration-tests/main-xml-jaxb/src/main/resources/rests/my-rests.xml
 copy integration-tests/{csimple/src/main/resources/routes/my-routes.yaml => main-xml-jaxb/src/main/resources/rests/my-rests.yaml} (87%)
 delete mode 100644 integration-tests/main-xml-jaxb/src/main/resources/routes/my-routes.xml
 copy integration-tests/{camel-k-runtime/src/main/resources/routes/routes-with-beans.yaml => main-xml-jaxb/src/main/resources/routes/my-routes.yaml} (75%)
 delete mode 100644 integration-tests/main-xml-jaxb/src/main/resources/templates/my-templates.xml
 copy integration-tests/{jasypt/src/main/resources/routes/jasypt-routes.yaml => main-xml-jaxb/src/main/resources/templates/my-templates.yaml} (80%)


(camel-quarkus) 03/03: Use `xml-io-dsl` instead of `xml-jaxb` when using the `management` extension.

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit e911310ae8fe3ca012a60969bc3640d3d5b0dbb9
Author: Adriano Machado <60...@users.noreply.github.com>
AuthorDate: Mon Apr 8 10:09:33 2024 -0400

    Use `xml-io-dsl` instead of `xml-jaxb` when using the `management` extension.
---
 .../dsl/xml/io/deployment/XmlIoDslProcessor.java   | 10 ++++++++++
 .../camel/quarkus/dsl/xml/XmlIoDslRecorder.java}   | 18 +++++++++---------
 extensions/management/deployment/pom.xml           |  2 +-
 extensions/management/runtime/pom.xml              |  2 +-
 integration-tests/main-xml-io/pom.xml              |  6 +++++-
 .../src/main/resources/application.properties      |  4 ++++
 .../camel/quarkus/main/CoreMainXmlIoTest.java      | 22 ++++++++++++++++++++--
 7 files changed, 50 insertions(+), 14 deletions(-)

diff --git a/extensions-core/xml-io-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/xml/io/deployment/XmlIoDslProcessor.java b/extensions-core/xml-io-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/xml/io/deployment/XmlIoDslProcessor.java
index 1ef7a72f5d..8dc3382ee5 100644
--- a/extensions-core/xml-io-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/xml/io/deployment/XmlIoDslProcessor.java
+++ b/extensions-core/xml-io-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/xml/io/deployment/XmlIoDslProcessor.java
@@ -18,7 +18,11 @@
 package org.apache.camel.quarkus.dsl.xml.io.deployment;
 
 import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
+import org.apache.camel.quarkus.core.deployment.spi.CamelModelToXMLDumperBuildItem;
+import org.apache.camel.quarkus.dsl.xml.XmlIoDslRecorder;
 
 public class XmlIoDslProcessor {
     private static final String FEATURE = "camel-xml-io-dsl";
@@ -27,4 +31,10 @@ public class XmlIoDslProcessor {
     FeatureBuildItem feature() {
         return new FeatureBuildItem(FEATURE);
     }
+
+    @BuildStep
+    @Record(value = ExecutionTime.STATIC_INIT, optional = true)
+    CamelModelToXMLDumperBuildItem xmlModelDumper(XmlIoDslRecorder recorder) {
+        return new CamelModelToXMLDumperBuildItem(recorder.newXmlIoModelToXMLDumper());
+    }
 }
diff --git a/extensions-core/xml-io-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/xml/io/deployment/XmlIoDslProcessor.java b/extensions-core/xml-io-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/xml/XmlIoDslRecorder.java
similarity index 67%
copy from extensions-core/xml-io-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/xml/io/deployment/XmlIoDslProcessor.java
copy to extensions-core/xml-io-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/xml/XmlIoDslRecorder.java
index 1ef7a72f5d..1f0319a9e4 100644
--- a/extensions-core/xml-io-dsl/deployment/src/main/java/org/apache/camel/quarkus/dsl/xml/io/deployment/XmlIoDslProcessor.java
+++ b/extensions-core/xml-io-dsl/runtime/src/main/java/org/apache/camel/quarkus/dsl/xml/XmlIoDslRecorder.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package org.apache.camel.quarkus.dsl.xml;
 
-package org.apache.camel.quarkus.dsl.xml.io.deployment;
+import io.quarkus.runtime.RuntimeValue;
+import io.quarkus.runtime.annotations.Recorder;
+import org.apache.camel.spi.ModelToXMLDumper;
+import org.apache.camel.xml.LwModelToXMLDumper;
 
-import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.builditem.FeatureBuildItem;
+@Recorder
+public class XmlIoDslRecorder {
 
-public class XmlIoDslProcessor {
-    private static final String FEATURE = "camel-xml-io-dsl";
-
-    @BuildStep
-    FeatureBuildItem feature() {
-        return new FeatureBuildItem(FEATURE);
+    public RuntimeValue<ModelToXMLDumper> newXmlIoModelToXMLDumper() {
+        return new RuntimeValue<>(new LwModelToXMLDumper());
     }
 }
diff --git a/extensions/management/deployment/pom.xml b/extensions/management/deployment/pom.xml
index 2f57ee9c89..b1c4517415 100644
--- a/extensions/management/deployment/pom.xml
+++ b/extensions/management/deployment/pom.xml
@@ -36,7 +36,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-xml-jaxb-deployment</artifactId>
+            <artifactId>camel-quarkus-xml-io-dsl-deployment</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
diff --git a/extensions/management/runtime/pom.xml b/extensions/management/runtime/pom.xml
index ac0066e888..013e126c03 100644
--- a/extensions/management/runtime/pom.xml
+++ b/extensions/management/runtime/pom.xml
@@ -42,7 +42,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-xml-jaxb</artifactId>
+            <artifactId>camel-quarkus-xml-io-dsl</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel</groupId>
diff --git a/integration-tests/main-xml-io/pom.xml b/integration-tests/main-xml-io/pom.xml
index a9145bc8dd..cb6205226c 100644
--- a/integration-tests/main-xml-io/pom.xml
+++ b/integration-tests/main-xml-io/pom.xml
@@ -85,7 +85,11 @@
             <artifactId>assertj-core</artifactId>
             <scope>test</scope>
         </dependency>
-
+        <dependency>
+            <groupId>org.awaitility</groupId>
+            <artifactId>awaitility</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
 
diff --git a/integration-tests/main-xml-io/src/main/resources/application.properties b/integration-tests/main-xml-io/src/main/resources/application.properties
index 58f52b443c..4191fae9fa 100644
--- a/integration-tests/main-xml-io/src/main/resources/application.properties
+++ b/integration-tests/main-xml-io/src/main/resources/application.properties
@@ -19,14 +19,18 @@
 # Quarkus
 #
 quarkus.native.add-all-charsets = true
+quarkus.log.file.enable = true
+quarkus.log.file.path = target/quarkus.log
 
 #
 # Camel
 #
 camel.context.name=quarkus-camel-example
 camel.rest.component = platform-http
+camel.main.dumpRoutesInclude = all
 
 #
 # Main
 #
 camel.main.routes-include-pattern = routes/my-routes.xml,routes/my-routes-iso_8859_15.xml,classpath:rests/my-rests.xml,classpath:templates/my-templates.xml,classpath:routes/my-templated.xml,routes/my-route-with-beanType.xml
+camel.main.dump-routes = xml
diff --git a/integration-tests/main-xml-io/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlIoTest.java b/integration-tests/main-xml-io/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlIoTest.java
index f575a55670..ae63f16560 100644
--- a/integration-tests/main-xml-io/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlIoTest.java
+++ b/integration-tests/main-xml-io/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlIoTest.java
@@ -16,7 +16,10 @@
  */
 package org.apache.camel.quarkus.main;
 
+import java.nio.file.Files;
+import java.nio.file.Paths;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
@@ -25,11 +28,12 @@ import io.restassured.path.json.JsonPath;
 import jakarta.ws.rs.core.MediaType;
 import org.apache.camel.dsl.xml.io.XmlRoutesBuilderLoader;
 import org.apache.camel.quarkus.core.DisabledModelJAXBContextFactory;
-import org.apache.camel.quarkus.core.DisabledModelToXMLDumper;
+import org.apache.camel.xml.LwModelToXMLDumper;
 import org.hamcrest.Matchers;
 import org.junit.jupiter.api.Test;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.awaitility.Awaitility.await;
 import static org.hamcrest.Matchers.is;
 
 @QuarkusTest
@@ -45,7 +49,7 @@ public class CoreMainXmlIoTest {
                 .body()
                 .jsonPath();
 
-        assertThat(p.getString("xml-model-dumper")).isEqualTo(DisabledModelToXMLDumper.class.getName());
+        assertThat(p.getString("xml-model-dumper")).isEqualTo(LwModelToXMLDumper.class.getName());
         assertThat(p.getString("xml-model-factory")).isEqualTo(DisabledModelJAXBContextFactory.class.getName());
 
         assertThat(p.getString("xml-routes-builder-loader"))
@@ -118,4 +122,18 @@ public class CoreMainXmlIoTest {
                 .statusCode(200)
                 .body(Matchers.is("beanTypeShouldSucceed-handled-by-MyBean"));
     }
+
+    @Test
+    public void testDumpRoutes() {
+        await().atMost(10L, TimeUnit.SECONDS).pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
+            String log = Files.readString(Paths.get("target/quarkus.log"));
+            return logContainsDumpedRoutes(log);
+        });
+    }
+
+    private boolean logContainsDumpedRoutes(String log) {
+        return log.contains("<route id=\"my-xml-route\">") &&
+                log.contains("<rest id=\"greet\" path=\"/greeting\">") &&
+                log.contains("<routeTemplate id=\"myTemplate\">");
+    }
 }


(camel-quarkus) 02/03: Prevent xml-jaxb extension producing CamelModelToXMLDumperBuildItem if xml-io-dsl is present

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 5250bf76bd5c337ca4cf83ac0de89327c0e3e5e4
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Apr 16 11:12:44 2024 +0100

    Prevent xml-jaxb extension producing CamelModelToXMLDumperBuildItem if xml-io-dsl is present
---
 .../xml/jaxb/deployment/XmlJaxbProcessor.java      | 20 ++++++++++-
 integration-tests/main-xml-jaxb/pom.xml            |  8 ++---
 .../quarkus/main/CoreMainXmlJaxbResource.java      |  5 ---
 .../src/main/resources/application.properties      |  2 +-
 .../src/main/resources/rests/my-rests.xml          | 26 --------------
 .../src/main/resources/rests/my-rests.yaml         | 23 ++++++++++++
 .../src/main/resources/routes/my-routes.xml        | 41 ----------------------
 .../src/main/resources/routes/my-routes.yaml       | 34 ++++++++++++++++++
 .../src/main/resources/templates/my-templates.xml  | 29 ---------------
 .../src/main/resources/templates/my-templates.yaml | 27 ++++++++++++++
 .../camel/quarkus/main/CoreMainXmlJaxbTest.java    | 11 ++----
 11 files changed, 109 insertions(+), 117 deletions(-)

diff --git a/extensions-core/xml-jaxb/deployment/src/main/java/org/apache/camel/quarkus/component/xml/jaxb/deployment/XmlJaxbProcessor.java b/extensions-core/xml-jaxb/deployment/src/main/java/org/apache/camel/quarkus/component/xml/jaxb/deployment/XmlJaxbProcessor.java
index fe4cce2773..1d6732872a 100644
--- a/extensions-core/xml-jaxb/deployment/src/main/java/org/apache/camel/quarkus/component/xml/jaxb/deployment/XmlJaxbProcessor.java
+++ b/extensions-core/xml-jaxb/deployment/src/main/java/org/apache/camel/quarkus/component/xml/jaxb/deployment/XmlJaxbProcessor.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.quarkus.component.xml.jaxb.deployment;
 
+import java.util.function.BooleanSupplier;
+
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.annotations.ExecutionTime;
 import io.quarkus.deployment.annotations.Record;
@@ -46,9 +48,25 @@ class XmlJaxbProcessor {
         return new CamelModelJAXBContextFactoryBuildItem(recorder.newContextFactory());
     }
 
-    @BuildStep
+    @BuildStep(onlyIfNot = XmlIoPresent.class)
     @Record(value = ExecutionTime.STATIC_INIT, optional = true)
     CamelModelToXMLDumperBuildItem xmlModelDumper(XmlJaxbRecorder recorder) {
         return new CamelModelToXMLDumperBuildItem(recorder.newJaxbModelToXMLDumper());
     }
+
+    /**
+     * Normally we'd use Capabilities to detect xml-io-dsl, but in this case we must suppress the xmlModelDumper
+     * build step running. Since we can't have multiple active producers of CamelModelToXMLDumperBuildItem.
+     */
+    static class XmlIoPresent implements BooleanSupplier {
+        @Override
+        public boolean getAsBoolean() {
+            try {
+                Thread.currentThread().getContextClassLoader().loadClass("org.apache.camel.xml.LwModelToXMLDumper");
+                return true;
+            } catch (ClassNotFoundException e) {
+                return false;
+            }
+        }
+    }
 }
diff --git a/integration-tests/main-xml-jaxb/pom.xml b/integration-tests/main-xml-jaxb/pom.xml
index f9dc20e568..46a57d88a1 100644
--- a/integration-tests/main-xml-jaxb/pom.xml
+++ b/integration-tests/main-xml-jaxb/pom.xml
@@ -35,14 +35,10 @@
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-xml-jaxb</artifactId>
         </dependency>
-        <!-- JAXP is required for route dumping -->
+        <!-- YAML is used as the DSL since xml-io-dsl brings its own ModelXMLDumper that overrides the one from xml-jaxb -->
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-xml-jaxp</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-xml-io-dsl</artifactId>
+            <artifactId>camel-quarkus-yaml-dsl</artifactId>
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
diff --git a/integration-tests/main-xml-jaxb/src/main/java/org/apache/camel/quarkus/main/CoreMainXmlJaxbResource.java b/integration-tests/main-xml-jaxb/src/main/java/org/apache/camel/quarkus/main/CoreMainXmlJaxbResource.java
index 31192bda6b..6e80bcde73 100644
--- a/integration-tests/main-xml-jaxb/src/main/java/org/apache/camel/quarkus/main/CoreMainXmlJaxbResource.java
+++ b/integration-tests/main-xml-jaxb/src/main/java/org/apache/camel/quarkus/main/CoreMainXmlJaxbResource.java
@@ -27,8 +27,6 @@ import jakarta.ws.rs.Produces;
 import jakarta.ws.rs.core.MediaType;
 import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.builder.TemplatedRouteBuilder;
-import org.apache.camel.dsl.xml.io.XmlRoutesBuilderLoader;
-import org.apache.camel.spi.RoutesBuilderLoader;
 import org.apache.camel.support.PluginHelper;
 
 @Path("/test")
@@ -59,9 +57,6 @@ public class CoreMainXmlJaxbResource {
         main.getCamelContext().getRoutes().forEach(route -> routes.add(route.getId()));
 
         return Json.createObjectBuilder()
-                .add("xml-routes-builder-loader",
-                        camelContext.getBootstrapFactoryFinder(RoutesBuilderLoader.FACTORY_PATH)
-                                .findClass(XmlRoutesBuilderLoader.EXTENSION).get().getName())
                 .add("xml-model-dumper", PluginHelper.getModelToXMLDumper(camelContext).getClass().getName())
                 .add("xml-model-factory", PluginHelper.getModelJAXBContextFactory(camelContext).getClass().getName())
                 .add("routeBuilders", routeBuilders)
diff --git a/integration-tests/main-xml-jaxb/src/main/resources/application.properties b/integration-tests/main-xml-jaxb/src/main/resources/application.properties
index eb47245419..6afcd39ef7 100644
--- a/integration-tests/main-xml-jaxb/src/main/resources/application.properties
+++ b/integration-tests/main-xml-jaxb/src/main/resources/application.properties
@@ -31,5 +31,5 @@ camel.main.dumpRoutesInclude = all
 #
 # Main
 #
-camel.main.routes-include-pattern = classpath:routes/my-routes.xml,classpath:rests/my-rests.xml,classpath:templates/my-templates.xml
+camel.main.routes-include-pattern = classpath:routes/my-routes.yaml,classpath:rests/my-rests.yaml,classpath:templates/my-templates.yaml
 camel.main.dump-routes = xml
diff --git a/integration-tests/main-xml-jaxb/src/main/resources/rests/my-rests.xml b/integration-tests/main-xml-jaxb/src/main/resources/rests/my-rests.xml
deleted file mode 100644
index 24f641fa35..0000000000
--- a/integration-tests/main-xml-jaxb/src/main/resources/rests/my-rests.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You 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
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-    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.
-
--->
-<rests xmlns="http://camel.apache.org/schema/spring">
-    <rest id="greet" path="/greeting">
-        <get path="/hello">
-            <to uri="direct:greet"/>
-        </get>
-    </rest>
-</rests>
diff --git a/integration-tests/main-xml-jaxb/src/main/resources/rests/my-rests.yaml b/integration-tests/main-xml-jaxb/src/main/resources/rests/my-rests.yaml
new file mode 100644
index 0000000000..3a8680664f
--- /dev/null
+++ b/integration-tests/main-xml-jaxb/src/main/resources/rests/my-rests.yaml
@@ -0,0 +1,23 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+
+- rest:
+    id: "greet"
+    path: "/greeting"
+    get:
+      - path: "/hello"
+        to: "direct:greet"
diff --git a/integration-tests/main-xml-jaxb/src/main/resources/routes/my-routes.xml b/integration-tests/main-xml-jaxb/src/main/resources/routes/my-routes.xml
deleted file mode 100644
index c3763c0d5f..0000000000
--- a/integration-tests/main-xml-jaxb/src/main/resources/routes/my-routes.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You 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
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-    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.
-
--->
-<routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xmlns="http://camel.apache.org/schema/spring"
-        xsi:schemaLocation="
-            http://camel.apache.org/schema/spring
-            http://camel.apache.org/schema/spring/camel-spring.xsd">
-
-    <route id="rest-route">
-        <from uri="direct:greet"/>
-        <setBody>
-            <constant>Hello World!</constant>
-        </setBody>
-    </route>
-
-    <route id="my-xml-route">
-        <from uri="timer:from-xml?period=3000"/>
-        <setBody>
-            <constant>Hello World!!!</constant>
-        </setBody>
-        <to uri="log:from-xml"/>
-    </route>
-
-</routes>
\ No newline at end of file
diff --git a/integration-tests/main-xml-jaxb/src/main/resources/routes/my-routes.yaml b/integration-tests/main-xml-jaxb/src/main/resources/routes/my-routes.yaml
new file mode 100644
index 0000000000..3a67be7118
--- /dev/null
+++ b/integration-tests/main-xml-jaxb/src/main/resources/routes/my-routes.yaml
@@ -0,0 +1,34 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+
+- route:
+    id: "rest-route"
+    from:
+      uri: "direct:greet"
+      steps:
+        - setBody:
+            constant: "Hello World!"
+
+- route:
+    id: "my-yaml-route"
+    from:
+      uri: "timer:from-xml?period=3000"
+      steps:
+        - setBody:
+            constant: "Hello World!"
+        - to:
+            uri: "log:from-yaml"
diff --git a/integration-tests/main-xml-jaxb/src/main/resources/templates/my-templates.xml b/integration-tests/main-xml-jaxb/src/main/resources/templates/my-templates.xml
deleted file mode 100644
index 10416ab690..0000000000
--- a/integration-tests/main-xml-jaxb/src/main/resources/templates/my-templates.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
-    Licensed to the Apache Software Foundation (ASF) under one or more
-    contributor license agreements.  See the NOTICE file distributed with
-    this work for additional information regarding copyright ownership.
-    The ASF licenses this file to You 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
-
-         http://www.apache.org/licenses/LICENSE-2.0
-
-    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.
-
--->
-<routeTemplates xmlns="http://camel.apache.org/schema/spring">
-    <routeTemplate id="myTemplate">
-        <templateParameter name="name"/>
-        <templateParameter name="greeting"/>
-        <route>
-            <from uri="direct:template"/>
-            <setBody><simple>{{greeting}} ${body}</simple></setBody>
-        </route>
-    </routeTemplate>
-</routeTemplates>
diff --git a/integration-tests/main-xml-jaxb/src/main/resources/templates/my-templates.yaml b/integration-tests/main-xml-jaxb/src/main/resources/templates/my-templates.yaml
new file mode 100644
index 0000000000..f0cd7d7525
--- /dev/null
+++ b/integration-tests/main-xml-jaxb/src/main/resources/templates/my-templates.yaml
@@ -0,0 +1,27 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You 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
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# 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.
+#
+
+- routeTemplate:
+    id: "myTemplate"
+    parameters:
+      - name: "name"
+      - name: "greeting"
+    from:
+      uri: "direct:template"
+      steps:
+        - setBody:
+            simple: "{{greeting}} ${body}"
diff --git a/integration-tests/main-xml-jaxb/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlJaxbTest.java b/integration-tests/main-xml-jaxb/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlJaxbTest.java
index 6838b5f3a4..c58adc082a 100644
--- a/integration-tests/main-xml-jaxb/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlJaxbTest.java
+++ b/integration-tests/main-xml-jaxb/src/test/java/org/apache/camel/quarkus/main/CoreMainXmlJaxbTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.camel.quarkus.main;
 
-import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.util.List;
@@ -26,7 +25,6 @@ import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
 import io.restassured.path.json.JsonPath;
 import jakarta.ws.rs.core.MediaType;
-import org.apache.camel.dsl.xml.io.XmlRoutesBuilderLoader;
 import org.apache.camel.xml.jaxb.DefaultModelJAXBContextFactory;
 import org.apache.camel.xml.jaxb.JaxbModelToXMLDumper;
 import org.junit.jupiter.api.Test;
@@ -51,15 +49,12 @@ public class CoreMainXmlJaxbTest {
         assertThat(p.getString("xml-model-dumper")).isEqualTo(JaxbModelToXMLDumper.class.getName());
         assertThat(p.getString("xml-model-factory")).isEqualTo(DefaultModelJAXBContextFactory.class.getName());
 
-        assertThat(p.getString("xml-routes-builder-loader"))
-                .isEqualTo(XmlRoutesBuilderLoader.class.getName());
-
         assertThat(p.getList("routeBuilders", String.class))
                 .isEmpty();
 
         List<String> routes = p.getList("routes", String.class);
         assertThat(routes)
-                .contains("my-xml-route");
+                .contains("my-yaml-route");
         assertThat(routes)
                 .contains("templated-route");
         assertThat(routes)
@@ -69,13 +64,13 @@ public class CoreMainXmlJaxbTest {
     @Test
     public void testDumpRoutes() {
         await().atMost(10L, TimeUnit.SECONDS).pollDelay(100, TimeUnit.MILLISECONDS).until(() -> {
-            String log = new String(Files.readAllBytes(Paths.get("target/quarkus.log")), StandardCharsets.UTF_8);
+            String log = Files.readString(Paths.get("target/quarkus.log"));
             return logContainsDumpedRoutes(log);
         });
     }
 
     private boolean logContainsDumpedRoutes(String log) {
-        return log.contains("<route id=\"my-xml-route\">") &&
+        return log.contains("<route id=\"my-yaml-route\">") &&
                 log.contains("<rest id=\"greet\" path=\"/greeting\">") &&
                 log.contains("<routeTemplate id=\"myTemplate\">");
     }


(camel-quarkus) 01/03: Remove redundant usage of xml-jaxb extension

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 8db8c5094215cc87b54972cf7e8036b0c660ab22
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Apr 16 11:11:41 2024 +0100

    Remove redundant usage of xml-jaxb extension
---
 .../dataformats-json/json-gson/pom.xml             | 34 ----------------------
 .../dataformats-json/json-jackson/pom.xml          | 17 -----------
 .../dataformats-json/json-jsonb/pom.xml            | 34 ----------------------
 integration-tests/dataformats-json-grouped/pom.xml | 17 -----------
 4 files changed, 102 deletions(-)

diff --git a/integration-test-groups/dataformats-json/json-gson/pom.xml b/integration-test-groups/dataformats-json/json-gson/pom.xml
index f1dc0af285..342482ff18 100644
--- a/integration-test-groups/dataformats-json/json-gson/pom.xml
+++ b/integration-test-groups/dataformats-json/json-gson/pom.xml
@@ -32,14 +32,6 @@
     <description>Integration tests for Gson Json Dataformat</description>
 
     <dependencies>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-xml-io-dsl</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-xml-jaxb</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-direct</artifactId>
@@ -182,32 +174,6 @@
                         </exclusion>
                     </exclusions>
                 </dependency>
-                <dependency>
-                    <groupId>org.apache.camel.quarkus</groupId>
-                    <artifactId>camel-quarkus-xml-io-dsl-deployment</artifactId>
-                    <version>${project.version}</version>
-                    <type>pom</type>
-                    <scope>test</scope>
-                    <exclusions>
-                        <exclusion>
-                            <groupId>*</groupId>
-                            <artifactId>*</artifactId>
-                        </exclusion>
-                    </exclusions>
-                </dependency>
-                <dependency>
-                    <groupId>org.apache.camel.quarkus</groupId>
-                    <artifactId>camel-quarkus-xml-jaxb-deployment</artifactId>
-                    <version>${project.version}</version>
-                    <type>pom</type>
-                    <scope>test</scope>
-                    <exclusions>
-                        <exclusion>
-                            <groupId>*</groupId>
-                            <artifactId>*</artifactId>
-                        </exclusion>
-                    </exclusions>
-                </dependency>
             </dependencies>
         </profile>
     </profiles>
diff --git a/integration-test-groups/dataformats-json/json-jackson/pom.xml b/integration-test-groups/dataformats-json/json-jackson/pom.xml
index 07414dbc0e..8b74379447 100644
--- a/integration-test-groups/dataformats-json/json-jackson/pom.xml
+++ b/integration-test-groups/dataformats-json/json-jackson/pom.xml
@@ -36,10 +36,6 @@
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-xml-io-dsl</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-xml-jaxb</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-jackson</artifactId>
@@ -244,19 +240,6 @@
                         </exclusion>
                     </exclusions>
                 </dependency>
-                <dependency>
-                    <groupId>org.apache.camel.quarkus</groupId>
-                    <artifactId>camel-quarkus-xml-jaxb-deployment</artifactId>
-                    <version>${project.version}</version>
-                    <type>pom</type>
-                    <scope>test</scope>
-                    <exclusions>
-                        <exclusion>
-                            <groupId>*</groupId>
-                            <artifactId>*</artifactId>
-                        </exclusion>
-                    </exclusions>
-                </dependency>
             </dependencies>
         </profile>
     </profiles>
diff --git a/integration-test-groups/dataformats-json/json-jsonb/pom.xml b/integration-test-groups/dataformats-json/json-jsonb/pom.xml
index 54e79886a2..114920faa3 100644
--- a/integration-test-groups/dataformats-json/json-jsonb/pom.xml
+++ b/integration-test-groups/dataformats-json/json-jsonb/pom.xml
@@ -32,14 +32,6 @@
     <description>Integration tests for Jsonb Json Dataformat</description>
 
     <dependencies>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-xml-io-dsl</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-xml-jaxb</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-jsonb</artifactId>
@@ -214,32 +206,6 @@
                         </exclusion>
                     </exclusions>
                 </dependency>
-                <dependency>
-                    <groupId>org.apache.camel.quarkus</groupId>
-                    <artifactId>camel-quarkus-xml-io-dsl-deployment</artifactId>
-                    <version>${project.version}</version>
-                    <type>pom</type>
-                    <scope>test</scope>
-                    <exclusions>
-                        <exclusion>
-                            <groupId>*</groupId>
-                            <artifactId>*</artifactId>
-                        </exclusion>
-                    </exclusions>
-                </dependency>
-                <dependency>
-                    <groupId>org.apache.camel.quarkus</groupId>
-                    <artifactId>camel-quarkus-xml-jaxb-deployment</artifactId>
-                    <version>${project.version}</version>
-                    <type>pom</type>
-                    <scope>test</scope>
-                    <exclusions>
-                        <exclusion>
-                            <groupId>*</groupId>
-                            <artifactId>*</artifactId>
-                        </exclusion>
-                    </exclusions>
-                </dependency>
             </dependencies>
         </profile>
     </profiles>
diff --git a/integration-tests/dataformats-json-grouped/pom.xml b/integration-tests/dataformats-json-grouped/pom.xml
index aae23f3788..7d5b90a1f8 100644
--- a/integration-tests/dataformats-json-grouped/pom.xml
+++ b/integration-tests/dataformats-json-grouped/pom.xml
@@ -37,10 +37,6 @@
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-xml-io-dsl</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-xml-jaxb</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-jackson</artifactId>
@@ -297,19 +293,6 @@
                         </exclusion>
                     </exclusions>
                 </dependency>
-                <dependency>
-                    <groupId>org.apache.camel.quarkus</groupId>
-                    <artifactId>camel-quarkus-xml-jaxb-deployment</artifactId>
-                    <version>${project.version}</version>
-                    <type>pom</type>
-                    <scope>test</scope>
-                    <exclusions>
-                        <exclusion>
-                            <groupId>*</groupId>
-                            <artifactId>*</artifactId>
-                        </exclusion>
-                    </exclusions>
-                </dependency>
             </dependencies>
         </profile>
     </profiles>