You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2020/09/28 15:39:31 UTC

[camel-quarkus] branch master updated (3b654ba -> 4be271f)

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

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


    from 3b654ba  Updated CHANGELOG.md
     new 0069803  Remove redundant camel-quarkus-xml-jaxb dependency from file-split-log-xml example
     new daab714  Work around camel main inability to load REST DSL configs from XML for #1852
     new 4be271f  Document camel main xml configuration properties

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:
 docs/modules/ROOT/pages/user-guide/bootstrap.adoc  | 88 ++++++++++++++++++++++
 examples/file-split-log-xml/pom.xml                | 17 -----
 .../quarkus/main/CamelMainRoutesCollector.java     | 53 +++++++++++++
 integration-tests/main-xml-io/pom.xml              | 17 +++++
 .../camel/quarkus/main/CoreMainXmlIoResource.java  |  7 ++
 .../src/main/resources/application.properties      |  3 +
 .../src/main/resources/rests/my-rests.xml}         | 19 +++--
 .../src/main/resources/templates/my-templates.xml} | 12 ++-
 .../camel/quarkus/main/CoreMainXmlIoTest.java      | 10 ++-
 integration-tests/main-xml-jaxb/pom.xml            | 17 +++++
 .../quarkus/main/CoreMainXmlJaxbResource.java      |  7 ++
 .../src/main/resources/application.properties      |  3 +
 .../src/main/resources/rests/my-rests.xml}         | 19 +++--
 .../src/main/resources/templates/my-templates.xml} | 12 ++-
 .../camel/quarkus/main/CoreMainXmlJaxbTest.java    | 10 ++-
 15 files changed, 255 insertions(+), 39 deletions(-)
 copy integration-tests/{jing/src/main/resources/schema.rng => main-xml-io/src/main/resources/rests/my-rests.xml} (72%)
 copy integration-tests/{tika/src/main/resources/quarkus.xml => main-xml-io/src/main/resources/templates/my-templates.xml} (69%)
 copy integration-tests/{jing/src/main/resources/schema.rng => main-xml-jaxb/src/main/resources/rests/my-rests.xml} (72%)
 copy integration-tests/{tika/src/main/resources/quarkus.xml => main-xml-jaxb/src/main/resources/templates/my-templates.xml} (69%)


[camel-quarkus] 03/03: Document camel main xml configuration properties

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

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

commit 4be271fd1d83cbda9d8480b5e7f98abf0c9fc7f1
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Sep 28 10:33:00 2020 +0100

    Document camel main xml configuration properties
    
    Fixes #1823
---
 docs/modules/ROOT/pages/user-guide/bootstrap.adoc | 88 +++++++++++++++++++++++
 integration-tests/main-xml-io/pom.xml             |  2 +-
 integration-tests/main-xml-jaxb/pom.xml           | 13 ++++
 3 files changed, 102 insertions(+), 1 deletion(-)

diff --git a/docs/modules/ROOT/pages/user-guide/bootstrap.adoc b/docs/modules/ROOT/pages/user-guide/bootstrap.adoc
index 5eefc32..b61d35b 100644
--- a/docs/modules/ROOT/pages/user-guide/bootstrap.adoc
+++ b/docs/modules/ROOT/pages/user-guide/bootstrap.adoc
@@ -102,3 +102,91 @@ public class Main {
 ====
 It is recommended to perform very little logic in the Java Main.
 ====
+
+=== XML Configuration
+
+In order to configure Camel routes, rests or templates in XML, you must add a Camel XML parser dependency to the classpath. E.g either `camel-quarkus-xml-io` or 
+`camel-quarkus-xml-jaxb`. `camel-quarkus-xml-io` is preferred due to its lightweight implementation.
+
+==== Routes
+
+With Camel Main, you can set a property that points to the location of route XML files:
+
+[source,properties]
+----
+camel.main.xml-routes = routes/routes.xml, file:src/main/routes/other-routes.xml
+----
+
+[NOTE]
+====
+Path globbing like `camel.main.xml-routes = *./routes.xml` currently does not work in native mode.
+====
+
+Spring XML with `<beans>` or Blueprint XML with `<blueprint>` elements are not supported. The route XML should be in the simplified version like:
+
+[source,xml]
+----
+<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="xml-route">
+        <from uri="timer:from-xml?period=1000"/>
+        <log message="Hello XML!"/>
+    </route>
+
+</routes>
+----
+
+==== REST DSL
+
+The Camel https://camel.apache.org/manual/latest/rest-dsl.html[REST DSL] can be defined in XML and configured with Camel Main via a property:
+
+[source,properties]
+----
+camel.main.xml-rests = rests/rests.xml, file:src/main/rests/other-rests.xml
+----
+
+The XML for the REST configuration looks like:
+
+[source,xml]
+----
+<rests xmlns="http://camel.apache.org/schema/spring">
+	<rest id="greeting" path="/greeting">
+	    <get uri="/hello">
+            <setBody>
+                <constant>Hello World!</constant>
+            </setBody>
+        </get>
+    </rest>
+</rests>
+----
+
+==== Route Templates
+
+https://camel.apache.org/manual/latest/route-template.html[Route templates] can be defined in XML and configured with Camel Main via a property:
+
+[source,properties]
+----
+camel.main.xml-route-templates = templates/route-template.xml, file:src/main/rests/other-route-template.xml
+----
+
+The XML for the route template configuration looks like:
+
+[source,xml]
+----
+<routeTemplates xmlns="http://camel.apache.org/schema/spring">
+    <routeTemplate id="myTemplate">
+        <templateParameter name="name"/>
+        <templateParameter name="greeting"/>
+        <templateParameter name="myPeriod" defaultValue="3s"/>
+        <route>
+            <from uri="timer:{{name}}?period={{myPeriod}}"/>
+            <setBody><simple>{{greeting}} ${body}</simple></setBody>
+            <log message="${body}"/>
+        </route>
+    </routeTemplate>
+</routeTemplates>
+----
diff --git a/integration-tests/main-xml-io/pom.xml b/integration-tests/main-xml-io/pom.xml
index 38b6274..3e5b89a 100644
--- a/integration-tests/main-xml-io/pom.xml
+++ b/integration-tests/main-xml-io/pom.xml
@@ -127,7 +127,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-platform-http-deployment</artifactId>
+            <artifactId>camel-quarkus-rest-deployment</artifactId>
             <version>${project.version}</version>
             <type>pom</type>
             <scope>test</scope>
diff --git a/integration-tests/main-xml-jaxb/pom.xml b/integration-tests/main-xml-jaxb/pom.xml
index 344ed86..5c954d2 100644
--- a/integration-tests/main-xml-jaxb/pom.xml
+++ b/integration-tests/main-xml-jaxb/pom.xml
@@ -127,6 +127,19 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-rest-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-timer-deployment</artifactId>
             <version>${project.version}</version>
             <type>pom</type>


[camel-quarkus] 02/03: Work around camel main inability to load REST DSL configs from XML for #1852

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

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

commit daab7141ac2679c74986e604c7cb91ebedf13080
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Sep 28 10:32:53 2020 +0100

    Work around camel main inability to load REST DSL configs from XML for #1852
---
 .../quarkus/main/CamelMainRoutesCollector.java     | 53 ++++++++++++++++++++++
 integration-tests/main-xml-io/pom.xml              | 17 +++++++
 .../camel/quarkus/main/CoreMainXmlIoResource.java  |  7 +++
 .../src/main/resources/application.properties      |  3 ++
 .../src/main/resources/rests/my-rests.xml          | 30 ++++++++++++
 .../src/main/resources/templates/my-templates.xml  | 29 ++++++++++++
 .../camel/quarkus/main/CoreMainXmlIoTest.java      | 10 +++-
 integration-tests/main-xml-jaxb/pom.xml            |  4 ++
 .../quarkus/main/CoreMainXmlJaxbResource.java      |  7 +++
 .../src/main/resources/application.properties      |  3 ++
 .../src/main/resources/rests/my-rests.xml          | 30 ++++++++++++
 .../src/main/resources/templates/my-templates.xml  | 29 ++++++++++++
 .../camel/quarkus/main/CoreMainXmlJaxbTest.java    | 10 +++-
 13 files changed, 230 insertions(+), 2 deletions(-)

diff --git a/extensions-core/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRoutesCollector.java b/extensions-core/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRoutesCollector.java
index 8595f53..db56da9 100644
--- a/extensions-core/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRoutesCollector.java
+++ b/extensions-core/main/runtime/src/main/java/org/apache/camel/quarkus/main/CamelMainRoutesCollector.java
@@ -16,12 +16,22 @@
  */
 package org.apache.camel.quarkus.main;
 
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Set;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.RoutesBuilder;
+import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.main.DefaultRoutesCollector;
+import org.apache.camel.model.rest.RestsDefinition;
 import org.apache.camel.quarkus.core.RegistryRoutesLoader;
+import org.apache.camel.spi.PackageScanResourceResolver;
+import org.apache.camel.util.IOHelper;
+import org.apache.camel.util.StopWatch;
 
 public class CamelMainRoutesCollector extends DefaultRoutesCollector {
     private final RegistryRoutesLoader registryRoutesLoader;
@@ -42,4 +52,47 @@ public class CamelMainRoutesCollector extends DefaultRoutesCollector {
 
         return registryRoutesLoader.collectRoutesFromRegistry(camelContext, excludePattern, includePattern);
     }
+
+    /**
+     * TODO: Remove this when upgrading to Camel > 3.5.0.
+     *
+     * https://github.com/apache/camel-quarkus/issues/1852
+     */
+    @Override
+    public List<RestsDefinition> collectXmlRestsFromDirectory(CamelContext camelContext, String directory) {
+        ExtendedCamelContext ecc = camelContext.adapt(ExtendedCamelContext.class);
+        PackageScanResourceResolver resolver = camelContext.adapt(ExtendedCamelContext.class).getPackageScanResourceResolver();
+
+        List<RestsDefinition> answer = new ArrayList<>();
+
+        StopWatch watch = new StopWatch();
+        int count = 0;
+        String[] parts = directory.split(",");
+        for (String part : parts) {
+            log.debug("Loading additional Camel XML rests from: {}", part);
+            try {
+                Set<InputStream> set = resolver.findResources(part);
+                for (InputStream is : set) {
+                    log.debug("Found XML rest from location: {}", part);
+                    RestsDefinition rests = (RestsDefinition) ecc.getXMLRoutesDefinitionLoader().loadRestsDefinition(ecc, is);
+                    if (rests != null) {
+                        answer.add(rests);
+                        IOHelper.close(is);
+                        count += rests.getRests().size();
+                    }
+                }
+            } catch (FileNotFoundException e) {
+                log.debug("No XML rests found in {}. Skipping XML rests detection.", part);
+            } catch (Exception e) {
+                throw RuntimeCamelException.wrapRuntimeException(e);
+            }
+            if (count > 0) {
+                log.info("Loaded {} ({} millis) additional Camel XML rests from: {}", count, watch.taken(), directory);
+            } else {
+                log.info("No additional Camel XML rests discovered from: {}", directory);
+            }
+        }
+
+        return answer;
+    }
 }
diff --git a/integration-tests/main-xml-io/pom.xml b/integration-tests/main-xml-io/pom.xml
index aaa595a..38b6274 100644
--- a/integration-tests/main-xml-io/pom.xml
+++ b/integration-tests/main-xml-io/pom.xml
@@ -48,6 +48,10 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-rest</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-timer</artifactId>
         </dependency>
 
@@ -123,6 +127,19 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-platform-http-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-timer-deployment</artifactId>
             <version>${project.version}</version>
             <type>pom</type>
diff --git a/integration-tests/main-xml-io/src/main/java/org/apache/camel/quarkus/main/CoreMainXmlIoResource.java b/integration-tests/main-xml-io/src/main/java/org/apache/camel/quarkus/main/CoreMainXmlIoResource.java
index 03b225f..d69e170 100644
--- a/integration-tests/main-xml-io/src/main/java/org/apache/camel/quarkus/main/CoreMainXmlIoResource.java
+++ b/integration-tests/main-xml-io/src/main/java/org/apache/camel/quarkus/main/CoreMainXmlIoResource.java
@@ -31,6 +31,7 @@ import javax.ws.rs.core.MediaType;
 
 import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.ProducerTemplate;
+import org.apache.camel.builder.TemplatedRouteBuilder;
 
 @Path("/test")
 @ApplicationScoped
@@ -53,6 +54,12 @@ public class CoreMainXmlIoResource {
         JsonArrayBuilder routeBuilders = Json.createArrayBuilder();
         main.configure().getRoutesBuilders().forEach(builder -> routeBuilders.add(builder.getClass().getName()));
 
+        TemplatedRouteBuilder.builder(main.getCamelContext(), "myTemplate")
+                .parameter("name", "Camel Quarkus")
+                .parameter("greeting", "Hello")
+                .routeId("templated-route")
+                .add();
+
         JsonArrayBuilder routes = Json.createArrayBuilder();
         main.getCamelContext().getRoutes().forEach(route -> routes.add(route.getId()));
 
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 3f0170a..de06ddb 100644
--- a/integration-tests/main-xml-io/src/main/resources/application.properties
+++ b/integration-tests/main-xml-io/src/main/resources/application.properties
@@ -23,8 +23,11 @@
 # Camel
 #
 camel.context.name=quarkus-camel-example
+camel.rest.component = platform-http
 
 #
 # Main
 #
 camel.main.xml-routes = classpath:routes/my-routes.xml
+camel.main.xml-rests = classpath:rests/my-rests.xml
+camel.main.xml-route-templates = classpath:templates/my-templates.xml
diff --git a/integration-tests/main-xml-io/src/main/resources/rests/my-rests.xml b/integration-tests/main-xml-io/src/main/resources/rests/my-rests.xml
new file mode 100644
index 0000000..fcbd834
--- /dev/null
+++ b/integration-tests/main-xml-io/src/main/resources/rests/my-rests.xml
@@ -0,0 +1,30 @@
+<?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 uri="/hello">
+            <route id="rest-route">
+                <setBody>
+                    <constant>Hello World!</constant>
+                </setBody>
+            </route>
+        </get>
+    </rest>
+</rests>
diff --git a/integration-tests/main-xml-io/src/main/resources/templates/my-templates.xml b/integration-tests/main-xml-io/src/main/resources/templates/my-templates.xml
new file mode 100644
index 0000000..10416ab
--- /dev/null
+++ b/integration-tests/main-xml-io/src/main/resources/templates/my-templates.xml
@@ -0,0 +1,29 @@
+<?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-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 e773e6c..617c17b 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,6 +16,8 @@
  */
 package org.apache.camel.quarkus.main;
 
+import java.util.List;
+
 import javax.ws.rs.core.MediaType;
 
 import io.quarkus.test.junit.QuarkusTest;
@@ -49,8 +51,14 @@ public class CoreMainXmlIoTest {
 
         assertThat(p.getList("routeBuilders", String.class))
                 .isEmpty();
-        assertThat(p.getList("routes", String.class))
+
+        List<String> routes = p.getList("routes", String.class);
+        assertThat(routes)
                 .contains("my-xml-route");
+        assertThat(routes)
+                .contains("templated-route");
+        assertThat(routes)
+                .contains("rest-route");
     }
 
     @Test
diff --git a/integration-tests/main-xml-jaxb/pom.xml b/integration-tests/main-xml-jaxb/pom.xml
index 7bdd38b..344ed86 100644
--- a/integration-tests/main-xml-jaxb/pom.xml
+++ b/integration-tests/main-xml-jaxb/pom.xml
@@ -52,6 +52,10 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-rest</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-timer</artifactId>
         </dependency>
 
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 8b93d78..dab9cf1 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
@@ -28,6 +28,7 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 
 import org.apache.camel.ExtendedCamelContext;
+import org.apache.camel.builder.TemplatedRouteBuilder;
 
 @Path("/test")
 @ApplicationScoped
@@ -47,6 +48,12 @@ public class CoreMainXmlJaxbResource {
         JsonArrayBuilder routeBuilders = Json.createArrayBuilder();
         main.configure().getRoutesBuilders().forEach(builder -> routeBuilders.add(builder.getClass().getName()));
 
+        TemplatedRouteBuilder.builder(main.getCamelContext(), "myTemplate")
+                .parameter("name", "Camel Quarkus")
+                .parameter("greeting", "Hello")
+                .routeId("templated-route")
+                .add();
+
         JsonArrayBuilder routes = Json.createArrayBuilder();
         main.getCamelContext().getRoutes().forEach(route -> routes.add(route.getId()));
 
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 3f0170a..de06ddb 100644
--- a/integration-tests/main-xml-jaxb/src/main/resources/application.properties
+++ b/integration-tests/main-xml-jaxb/src/main/resources/application.properties
@@ -23,8 +23,11 @@
 # Camel
 #
 camel.context.name=quarkus-camel-example
+camel.rest.component = platform-http
 
 #
 # Main
 #
 camel.main.xml-routes = classpath:routes/my-routes.xml
+camel.main.xml-rests = classpath:rests/my-rests.xml
+camel.main.xml-route-templates = classpath:templates/my-templates.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
new file mode 100644
index 0000000..fcbd834
--- /dev/null
+++ b/integration-tests/main-xml-jaxb/src/main/resources/rests/my-rests.xml
@@ -0,0 +1,30 @@
+<?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 uri="/hello">
+            <route id="rest-route">
+                <setBody>
+                    <constant>Hello World!</constant>
+                </setBody>
+            </route>
+        </get>
+    </rest>
+</rests>
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
new file mode 100644
index 0000000..10416ab
--- /dev/null
+++ b/integration-tests/main-xml-jaxb/src/main/resources/templates/my-templates.xml
@@ -0,0 +1,29 @@
+<?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/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 116c0e7..f5f6b24 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,6 +16,8 @@
  */
 package org.apache.camel.quarkus.main;
 
+import java.util.List;
+
 import javax.ws.rs.core.MediaType;
 
 import io.quarkus.test.junit.QuarkusTest;
@@ -46,7 +48,13 @@ public class CoreMainXmlJaxbTest {
 
         assertThat(p.getList("routeBuilders", String.class))
                 .isEmpty();
-        assertThat(p.getList("routes", String.class))
+
+        List<String> routes = p.getList("routes", String.class);
+        assertThat(routes)
                 .contains("my-xml-route");
+        assertThat(routes)
+                .contains("templated-route");
+        assertThat(routes)
+                .contains("rest-route");
     }
 }


[camel-quarkus] 01/03: Remove redundant camel-quarkus-xml-jaxb dependency from file-split-log-xml example

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

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

commit 006980346a4b6f6f5ef065e15ee13028abd4ca94
Author: James Netherton <ja...@gmail.com>
AuthorDate: Mon Sep 28 10:29:41 2020 +0100

    Remove redundant camel-quarkus-xml-jaxb dependency from file-split-log-xml example
---
 examples/file-split-log-xml/pom.xml | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/examples/file-split-log-xml/pom.xml b/examples/file-split-log-xml/pom.xml
index 9c8b22e..012311c 100644
--- a/examples/file-split-log-xml/pom.xml
+++ b/examples/file-split-log-xml/pom.xml
@@ -52,10 +52,6 @@
         </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-file</artifactId>
         </dependency>
 
@@ -125,19 +121,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>
 
     <build>