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 2020/02/28 07:38:11 UTC

[camel-quarkus] branch master updated (ba40c08 -> cc2b89f)

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

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


    from ba40c08  Execute the reactive-streams itest by the CI
     new 6ec4cbd  Join TagSoup and XSLT integration tests
     new 03723a8  Fix #498 Improve the XSLT test coverage
     new cc2b89f  Update mvnd.builder.rule in the timer-log example

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:
 .github/workflows/pr-build.yaml                    |   3 +-
 examples/timer-log/pom.xml                         |   2 +-
 .../xslt/deployment/XsltNativeImageProcessor.java  |  29 +++--
 .../component/xslt/deployment/XsltProcessor.java   |   3 +-
 integration-tests/pom.xml                          |   3 +-
 .../quarkus/component/tagsoup/it/TagSoupIT.java    |  24 ----
 .../quarkus/component/tagsoup/it/TagSoupTest.java  |  45 --------
 integration-tests/{tagsoup => xml}/pom.xml         |  16 +--
 .../quarkus/component/xml/it/XmlResource.java}     |  42 ++++++-
 .../quarkus/component/xml/it/XmlRouteBuilder.java} |  16 ++-
 .../src/main/resources/application.properties      |   2 +-
 .../main/resources/xslt/classpath-transform.xsl    |   0
 .../src/main/resources/xslt/html-to-text.xsl}      |  17 +--
 .../src/main/resources/xslt/html-transform.xsl}    |  23 ++--
 .../camel/quarkus/component/xml/it/XmlIT.java}     |   4 +-
 .../camel/quarkus/component/xml/it/XmlTest.java    | 101 ++++++++++++++++
 .../{tagsoup => xml}/src/test/resources/test.html  |   0
 integration-tests/xslt/pom.xml                     | 128 ---------------------
 .../quarkus/component/xslt/it/XsltResource.java    |  42 -------
 .../camel/quarkus/component/xslt/it/XsltRoute.java |  28 -----
 .../camel/quarkus/component/xslt/it/XsltIT.java    |  24 ----
 .../camel/quarkus/component/xslt/it/XsltTest.java  |  43 -------
 22 files changed, 202 insertions(+), 393 deletions(-)
 delete mode 100644 integration-tests/tagsoup/src/test/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupIT.java
 delete mode 100644 integration-tests/tagsoup/src/test/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupTest.java
 rename integration-tests/{tagsoup => xml}/pom.xml (93%)
 rename integration-tests/{tagsoup/src/main/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupResource.java => xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlResource.java} (55%)
 rename integration-tests/{tagsoup/src/main/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupRouteBuilder.java => xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java} (79%)
 rename integration-tests/{xslt => xml}/src/main/resources/application.properties (91%)
 copy integration-tests/{xslt => xml}/src/main/resources/xslt/classpath-transform.xsl (100%)
 copy integration-tests/{xslt/src/main/resources/xslt/classpath-transform.xsl => xml/src/main/resources/xslt/html-to-text.xsl} (71%)
 rename integration-tests/{xslt/src/main/resources/xslt/classpath-transform.xsl => xml/src/main/resources/xslt/html-transform.xsl} (71%)
 copy integration-tests/{sql/src/test/java/org/apache/camel/quarkus/component/sql/it/SqlIT.java => xml/src/test/java/org/apache/camel/quarkus/component/xml/it/XmlIT.java} (91%)
 create mode 100644 integration-tests/xml/src/test/java/org/apache/camel/quarkus/component/xml/it/XmlTest.java
 rename integration-tests/{tagsoup => xml}/src/test/resources/test.html (100%)
 delete mode 100644 integration-tests/xslt/pom.xml
 delete mode 100644 integration-tests/xslt/src/main/java/org/apache/camel/quarkus/component/xslt/it/XsltResource.java
 delete mode 100644 integration-tests/xslt/src/main/java/org/apache/camel/quarkus/component/xslt/it/XsltRoute.java
 delete mode 100644 integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltIT.java
 delete mode 100644 integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java


[camel-quarkus] 03/03: Update mvnd.builder.rule in the timer-log example

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

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

commit cc2b89f6c4486f61b8ab35b9cab09866e45353a5
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Thu Feb 27 18:29:40 2020 +0100

    Update mvnd.builder.rule in the timer-log example
---
 examples/timer-log/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/examples/timer-log/pom.xml b/examples/timer-log/pom.xml
index 20c1d75..03d860b 100644
--- a/examples/timer-log/pom.xml
+++ b/examples/timer-log/pom.xml
@@ -38,7 +38,7 @@
         <!-- explicit dependencies of this module in the Maven sense, although they are required by the Quarkus Maven plugin. -->
         <!-- Please update rule whenever you change the dependencies of this module by running -->
         <!--     mvn process-resources -Pformat    from the root directory -->
-        <mvnd.builder.rule>camel-quarkus-log-deployment,camel-quarkus-support-policy-deployment,camel-quarkus-timer-deployment</mvnd.builder.rule>
+        <mvnd.builder.rule>camel-quarkus-core-xml-deployment,camel-quarkus-log-deployment,camel-quarkus-support-policy-deployment,camel-quarkus-timer-deployment</mvnd.builder.rule>
     </properties>
 
     <dependencies>


[camel-quarkus] 01/03: Join TagSoup and XSLT integration tests

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

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

commit 6ec4cbda2f7732e6014d25dfa5edcae3de1cef7b
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Thu Feb 27 13:58:33 2020 +0100

    Join TagSoup and XSLT integration tests
---
 .github/workflows/pr-build.yaml                    |   3 +-
 integration-tests/pom.xml                          |   3 +-
 .../quarkus/component/tagsoup/it/TagSoupIT.java    |  24 ----
 .../quarkus/component/tagsoup/it/TagSoupTest.java  |  45 --------
 integration-tests/{tagsoup => xml}/pom.xml         |  12 +-
 .../quarkus/component/xml/it/XmlResource.java}     |  17 ++-
 .../quarkus/component/xml/it/XmlRouteBuilder.java} |   4 +-
 .../src/main/resources/application.properties      |   0
 .../main/resources/xslt/classpath-transform.xsl    |   0
 .../camel/quarkus/component/xml/it/XmlIT.java}     |   4 +-
 .../camel/quarkus/component/xml/it/XmlTest.java}   |  28 ++++-
 .../{tagsoup => xml}/src/test/resources/test.html  |   0
 integration-tests/xslt/pom.xml                     | 128 ---------------------
 .../quarkus/component/xslt/it/XsltResource.java    |  42 -------
 .../camel/quarkus/component/xslt/it/XsltRoute.java |  28 -----
 15 files changed, 50 insertions(+), 288 deletions(-)

diff --git a/.github/workflows/pr-build.yaml b/.github/workflows/pr-build.yaml
index 1207a56..685351f 100644
--- a/.github/workflows/pr-build.yaml
+++ b/.github/workflows/pr-build.yaml
@@ -245,7 +245,6 @@ jobs:
             -pl :camel-quarkus-integration-test-base64 \
             -pl :camel-quarkus-integration-test-bindy \
             -pl :camel-quarkus-integration-test-snakeyaml \
-            -pl :camel-quarkus-integration-test-tagsoup \
             -pl :camel-quarkus-integration-test-csv \
             -pl :camel-quarkus-integration-test-dataformat
   networking:
@@ -418,7 +417,7 @@ jobs:
     needs: build
     strategy:
       matrix:
-        extension: [ 'dataformats-json', 'infinispan', 'olingo4', 'xslt' ]
+        extension: [ 'dataformats-json', 'infinispan', 'olingo4', 'xml' ]
     steps:
       - name: Set BRANCH_OPTIONS
         if: github.base_ref == 'camel-master' || github.base_ref == 'quarkus-master'
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 20dd296..10c3333 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -213,12 +213,11 @@
         <module>snakeyaml</module>
         <module>sql</module>
         <module>stream</module>
-        <module>tagsoup</module>
         <module>tarfile</module>
         <module>telegram</module>
         <module>twitter</module>
         <module>validator</module>
-        <module>xslt</module>
+        <module>xml</module>
         <module>zipfile</module>
     </modules>
 
diff --git a/integration-tests/tagsoup/src/test/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupIT.java b/integration-tests/tagsoup/src/test/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupIT.java
deleted file mode 100644
index b5d1adc..0000000
--- a/integration-tests/tagsoup/src/test/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupIT.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.quarkus.component.tagsoup.it;
-
-import io.quarkus.test.junit.NativeImageTest;
-
-@NativeImageTest
-class TagSoupIT extends TagSoupTest {
-
-}
diff --git a/integration-tests/tagsoup/src/test/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupTest.java b/integration-tests/tagsoup/src/test/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupTest.java
deleted file mode 100644
index f47d9ab..0000000
--- a/integration-tests/tagsoup/src/test/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.quarkus.component.tagsoup.it;
-
-import java.nio.charset.Charset;
-
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import io.restassured.http.ContentType;
-import org.apache.commons.io.IOUtils;
-import org.junit.jupiter.api.Test;
-
-import static org.hamcrest.Matchers.is;
-
-@QuarkusTest
-class TagSoupTest {
-
-    @Test
-    public void htmlParse() throws Exception {
-        String html = IOUtils.toString(getClass().getResourceAsStream("/test.html"), Charset.forName("UTF-8"));
-
-        RestAssured.given() //
-                .contentType(ContentType.HTML)
-                .accept(ContentType.TEXT)
-                .body(html)
-                .post("/tagsoup/html-parse")
-                .then()
-                .statusCode(200)
-                .body(is("Paragraph Contents"));
-    }
-}
diff --git a/integration-tests/tagsoup/pom.xml b/integration-tests/xml/pom.xml
similarity index 92%
rename from integration-tests/tagsoup/pom.xml
rename to integration-tests/xml/pom.xml
index 70bf009..6636c29 100644
--- a/integration-tests/tagsoup/pom.xml
+++ b/integration-tests/xml/pom.xml
@@ -25,9 +25,9 @@
         <version>1.1.0-SNAPSHOT</version>
     </parent>
 
-    <artifactId>camel-quarkus-integration-test-tagsoup</artifactId>
-    <name>Camel Quarkus :: Integration Tests :: TagSoup</name>
-    <description>Integration tests for Camel Quarkus TagSoup extension</description>
+    <artifactId>camel-quarkus-integration-test-xml</artifactId>
+    <name>Camel Quarkus :: Integration Tests :: XML</name>
+    <description>Integration tests for various XML related extensions</description>
 
     <properties>
         <!-- mvnd, a.k.a. Maven Daemon: https://github.com/gnodet/mvnd -->
@@ -36,7 +36,7 @@
         <!-- explicit dependencies of this module in the Maven sense, although they are required by the Quarkus Maven plugin. -->
         <!-- Please update rule whenever you change the dependencies of this module by running -->
         <!--     mvn process-resources -Pformat    from the root directory -->
-        <mvnd.builder.rule>camel-quarkus-direct-deployment,camel-quarkus-support-policy-deployment,camel-quarkus-tagsoup-deployment</mvnd.builder.rule>
+        <mvnd.builder.rule>camel-quarkus-direct-deployment,camel-quarkus-support-policy-deployment,camel-quarkus-tagsoup-deployment,camel-quarkus-xslt-deployment</mvnd.builder.rule>
     </properties>
 
     <dependencies>
@@ -46,6 +46,10 @@
         </dependency>
         <dependency>
             <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-xslt</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-direct</artifactId>
         </dependency>
         <dependency>
diff --git a/integration-tests/tagsoup/src/main/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupResource.java b/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlResource.java
similarity index 76%
rename from integration-tests/tagsoup/src/main/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupResource.java
rename to integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlResource.java
index fedb449..72511ae 100644
--- a/integration-tests/tagsoup/src/main/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupResource.java
+++ b/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlResource.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.component.tagsoup.it;
+package org.apache.camel.quarkus.component.xml.it;
 
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Inject;
@@ -27,11 +27,11 @@ import javax.ws.rs.core.MediaType;
 import org.apache.camel.ProducerTemplate;
 import org.jboss.logging.Logger;
 
-@Path("/tagsoup")
+@Path("/xml")
 @ApplicationScoped
-public class TagSoupResource {
+public class XmlResource {
 
-    private static final Logger LOG = Logger.getLogger(TagSoupResource.class);
+    private static final Logger LOG = Logger.getLogger(XmlResource.class);
 
     @Inject
     ProducerTemplate producerTemplate;
@@ -43,8 +43,15 @@ public class TagSoupResource {
     public String htmlParse(String html) {
         LOG.debugf("Parsing HTML %s", html);
         return producerTemplate.requestBody(
-                TagSoupRouteBuilder.DIRECT_HTML_TO_DOM,
+                XmlRouteBuilder.DIRECT_HTML_TO_DOM,
                 html,
                 String.class);
     }
+
+    @Path("/xslt")
+    @POST
+    @Produces(MediaType.TEXT_PLAIN)
+    public String classpath(String body) throws Exception {
+        return producerTemplate.requestBody("xslt:xslt/classpath-transform.xsl", body, String.class);
+    }
 }
diff --git a/integration-tests/tagsoup/src/main/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupRouteBuilder.java b/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java
similarity index 95%
rename from integration-tests/tagsoup/src/main/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupRouteBuilder.java
rename to integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java
index 7c1815a..1e8dccf 100644
--- a/integration-tests/tagsoup/src/main/java/org/apache/camel/quarkus/component/tagsoup/it/TagSoupRouteBuilder.java
+++ b/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.component.tagsoup.it;
+package org.apache.camel.quarkus.component.xml.it;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Node;
 
 import org.apache.camel.builder.RouteBuilder;
 
-public class TagSoupRouteBuilder extends RouteBuilder {
+public class XmlRouteBuilder extends RouteBuilder {
     public static final String DIRECT_HTML_TO_DOM = "direct:html-to-dom";
 
     @Override
diff --git a/integration-tests/xslt/src/main/resources/application.properties b/integration-tests/xml/src/main/resources/application.properties
similarity index 100%
rename from integration-tests/xslt/src/main/resources/application.properties
rename to integration-tests/xml/src/main/resources/application.properties
diff --git a/integration-tests/xslt/src/main/resources/xslt/classpath-transform.xsl b/integration-tests/xml/src/main/resources/xslt/classpath-transform.xsl
similarity index 100%
rename from integration-tests/xslt/src/main/resources/xslt/classpath-transform.xsl
rename to integration-tests/xml/src/main/resources/xslt/classpath-transform.xsl
diff --git a/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltIT.java b/integration-tests/xml/src/test/java/org/apache/camel/quarkus/component/xml/it/XmlIT.java
similarity index 91%
rename from integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltIT.java
rename to integration-tests/xml/src/test/java/org/apache/camel/quarkus/component/xml/it/XmlIT.java
index a49fdf4..e9136aa 100644
--- a/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltIT.java
+++ b/integration-tests/xml/src/test/java/org/apache/camel/quarkus/component/xml/it/XmlIT.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.component.xslt.it;
+package org.apache.camel.quarkus.component.xml.it;
 
 import io.quarkus.test.junit.NativeImageTest;
 
 @NativeImageTest
-class XsltIT extends XsltTest {
+class XmlIT extends XmlTest {
 
 }
diff --git a/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java b/integration-tests/xml/src/test/java/org/apache/camel/quarkus/component/xml/it/XmlTest.java
similarity index 67%
rename from integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java
rename to integration-tests/xml/src/test/java/org/apache/camel/quarkus/component/xml/it/XmlTest.java
index 2d04599..02da424 100644
--- a/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java
+++ b/integration-tests/xml/src/test/java/org/apache/camel/quarkus/component/xml/it/XmlTest.java
@@ -14,23 +14,43 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.camel.quarkus.component.xslt.it;
+package org.apache.camel.quarkus.component.xml.it;
+
+import java.nio.charset.Charset;
 
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import org.apache.commons.io.IOUtils;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
+import static org.hamcrest.Matchers.is;
+
 @QuarkusTest
-class XsltTest {
+class XmlTest {
+
+    @Test
+    public void htmlParse() throws Exception {
+        String html = IOUtils.toString(getClass().getResourceAsStream("/test.html"), Charset.forName("UTF-8"));
+
+        RestAssured.given() //
+                .contentType(ContentType.HTML)
+                .accept(ContentType.TEXT)
+                .body(html)
+                .post("/xml/html-parse")
+                .then()
+                .statusCode(200)
+                .body(is("Paragraph Contents"));
+    }
 
     private static final String BODY = "<mail><subject>Hey</subject><body>Hello world!</body></mail>";
 
     @Test
-    public void classpath() {
+    public void xslt() {
         final String actual = RestAssured.given()
                 .body(BODY)
-                .post("/xslt/classpath-xsl")
+                .post("/xml/xslt")
                 .then()
                 .statusCode(200)
                 .extract().body().asString().trim().replaceAll(">\\s+<", "><");
diff --git a/integration-tests/tagsoup/src/test/resources/test.html b/integration-tests/xml/src/test/resources/test.html
similarity index 100%
rename from integration-tests/tagsoup/src/test/resources/test.html
rename to integration-tests/xml/src/test/resources/test.html
diff --git a/integration-tests/xslt/pom.xml b/integration-tests/xslt/pom.xml
deleted file mode 100644
index 29c368a..0000000
--- a/integration-tests/xslt/pom.xml
+++ /dev/null
@@ -1,128 +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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.camel.quarkus</groupId>
-        <artifactId>camel-quarkus-integration-tests</artifactId>
-        <version>1.1.0-SNAPSHOT</version>
-    </parent>
-
-    <artifactId>camel-quarkus-integration-test-xslt</artifactId>
-    <name>Camel Quarkus :: Integration Tests :: XSLT</name>
-    <description>Integration tests for Camel Quarkus XSLT extension</description>
-
-    <properties>
-        <!-- mvnd, a.k.a. Maven Daemon: https://github.com/gnodet/mvnd -->
-        <!-- The following rule tells mvnd to build the listed deployment modules before this module. -->
-        <!-- This is important because mvnd builds modules in parallel by default. The deployment modules are not -->
-        <!-- explicit dependencies of this module in the Maven sense, although they are required by the Quarkus Maven plugin. -->
-        <!-- Please update rule whenever you change the dependencies of this module by running -->
-        <!--     mvn process-resources -Pformat    from the root directory -->
-        <mvnd.builder.rule>camel-quarkus-direct-deployment,camel-quarkus-jackson-deployment,camel-quarkus-log-deployment,camel-quarkus-support-policy-deployment,camel-quarkus-xslt-deployment</mvnd.builder.rule>
-    </properties>
-
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-xslt</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-direct</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-log</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.camel.quarkus</groupId>
-            <artifactId>camel-quarkus-jackson</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>io.quarkus</groupId>
-            <artifactId>quarkus-resteasy</artifactId>
-        </dependency>
-
-        <!-- test dependencies -->
-        <dependency>
-            <groupId>io.quarkus</groupId>
-            <artifactId>quarkus-junit5</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>io.rest-assured</groupId>
-            <artifactId>rest-assured</artifactId>
-            <scope>test</scope>
-        </dependency>
-    </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>io.quarkus</groupId>
-                <artifactId>quarkus-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>build</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-
-    <profiles>
-        <profile>
-            <id>native</id>
-            <activation>
-                <property>
-                    <name>native</name>
-                </property>
-            </activation>
-            <properties>
-                <quarkus.package.type>native</quarkus.package.type>
-            </properties>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-failsafe-plugin</artifactId>
-                        <executions>
-                            <execution>
-                                <goals>
-                                    <goal>integration-test</goal>
-                                    <goal>verify</goal>
-                                </goals>
-                                <configuration>
-                                    <systemProperties>
-                                        <native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
-                                    </systemProperties>
-                                </configuration>
-                            </execution>
-                        </executions>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
-    </profiles>
-
-</project>
diff --git a/integration-tests/xslt/src/main/java/org/apache/camel/quarkus/component/xslt/it/XsltResource.java b/integration-tests/xslt/src/main/java/org/apache/camel/quarkus/component/xslt/it/XsltResource.java
deleted file mode 100644
index 1624da1..0000000
--- a/integration-tests/xslt/src/main/java/org/apache/camel/quarkus/component/xslt/it/XsltResource.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.quarkus.component.xslt.it;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-import org.apache.camel.ProducerTemplate;
-
-@Path("/xslt")
-@ApplicationScoped
-public class XsltResource {
-
-    @Inject
-    ProducerTemplate producerTemplate;
-
-    @Path("/classpath-xsl")
-    @POST
-    @Produces(MediaType.TEXT_PLAIN)
-    public String classpath(String body) throws Exception {
-        return producerTemplate.requestBody("direct:classpath-xsl", body, String.class);
-    }
-
-}
diff --git a/integration-tests/xslt/src/main/java/org/apache/camel/quarkus/component/xslt/it/XsltRoute.java b/integration-tests/xslt/src/main/java/org/apache/camel/quarkus/component/xslt/it/XsltRoute.java
deleted file mode 100644
index c053642..0000000
--- a/integration-tests/xslt/src/main/java/org/apache/camel/quarkus/component/xslt/it/XsltRoute.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-package org.apache.camel.quarkus.component.xslt.it;
-
-import org.apache.camel.builder.RouteBuilder;
-
-public class XsltRoute extends RouteBuilder {
-
-    @Override
-    public void configure() throws Exception {
-        from("direct:classpath-xsl")
-                .to("xslt:xslt/classpath-transform.xsl");
-    }
-}


[camel-quarkus] 02/03: Fix #498 Improve the XSLT test coverage

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

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

commit 03723a8a7722a41f4277166da162db4ce2b8442a
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Thu Feb 27 18:20:42 2020 +0100

    Fix #498 Improve the XSLT test coverage
---
 .../xslt/deployment/XsltNativeImageProcessor.java  | 29 ++++++++++++-----
 .../component/xslt/deployment/XsltProcessor.java   |  3 +-
 integration-tests/xml/pom.xml                      |  4 ---
 .../quarkus/component/xml/it/XmlResource.java      | 25 ++++++++++++++
 .../quarkus/component/xml/it/XmlRouteBuilder.java  | 12 +++++++
 .../xml/src/main/resources/application.properties  |  2 +-
 .../xml/src/main/resources/xslt/html-to-text.xsl   | 32 ++++++++++++++++++
 .../xml/src/main/resources/xslt/html-transform.xsl | 38 ++++++++++++++++++++++
 .../camel/quarkus/component/xml/it/XmlTest.java    | 38 ++++++++++++++++++++++
 9 files changed, 168 insertions(+), 15 deletions(-)

diff --git a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltNativeImageProcessor.java b/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltNativeImageProcessor.java
index 8c78c3b..fb32115 100644
--- a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltNativeImageProcessor.java
+++ b/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltNativeImageProcessor.java
@@ -17,13 +17,14 @@
 package org.apache.camel.quarkus.component.xslt.deployment;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 import java.util.stream.Collectors;
 
+import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBundleBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
 import org.apache.camel.quarkus.component.xslt.CamelXsltConfig;
 import org.apache.camel.support.ResourceHelper;
@@ -45,25 +46,35 @@ class XsltNativeImageProcessor {
     }
 
     @BuildStep
-    List<NativeImageResourceBuildItem> xsltResources(CamelXsltConfig config) {
+    void xsltResources(
+            CamelXsltConfig config,
+            BuildProducer<NativeImageResourceBuildItem> nativeResources,
+            BuildProducer<NativeImageResourceBundleBuildItem> nativeResourceBundles) {
         if (!config.sources.isPresent()) {
-            return Collections.emptyList();
+            return;
         }
 
-        List<NativeImageResourceBuildItem> items = new ArrayList<>(config.sources.get().size());
-
-        for (String source : config.sources.get()) {
+        final List<String> sources = config.sources.get();
+        List<String> paths = new ArrayList<>(sources.size() + 5);
+        for (String source : sources) {
             String scheme = ResourceHelper.getScheme(source);
 
             if (Objects.isNull(scheme) || Objects.equals(scheme, CLASSPATH_SCHEME)) {
                 if (Objects.equals(scheme, CLASSPATH_SCHEME)) {
                     source = source.substring(CLASSPATH_SCHEME.length() + 1);
                 }
-
-                items.add(new NativeImageResourceBuildItem(source));
+                paths.add(source);
             }
         }
+        paths.add("org/apache/xml/serializer/Encodings.properties");
+        paths.add("org/apache/xml/serializer/output_html.properties");
+        paths.add("org/apache/xml/serializer/output_text.properties");
+        paths.add("org/apache/xml/serializer/output_unknown.properties");
+        paths.add("org/apache/xml/serializer/output_xml.properties");
+        nativeResources.produce(new NativeImageResourceBuildItem(paths));
 
-        return items;
+        nativeResourceBundles.produce(new NativeImageResourceBundleBuildItem("org.apache.xml.serializer.HTMLEntities"));
+        nativeResourceBundles.produce(new NativeImageResourceBundleBuildItem("org.apache.xml.serializer.XMLEntities"));
     }
+
 }
diff --git a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java b/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
index c5f2165..e0cf8cd 100644
--- a/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
+++ b/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
@@ -108,7 +108,7 @@ class XsltProcessor {
                     tf.setErrorListener(new CamelXsltErrorListener());
                     tf.newTemplates(resolvedUri.source);
                 } catch (TransformerException e) {
-                    throw new RuntimeException(e);
+                    throw new RuntimeException("Could not compile XSLT " + uri, e);
                 }
             }
 
@@ -135,4 +135,5 @@ class XsltProcessor {
                     .forEach(File::delete);
         }
     }
+
 }
diff --git a/integration-tests/xml/pom.xml b/integration-tests/xml/pom.xml
index 6636c29..0fb48f7 100644
--- a/integration-tests/xml/pom.xml
+++ b/integration-tests/xml/pom.xml
@@ -56,10 +56,6 @@
             <groupId>io.quarkus</groupId>
             <artifactId>quarkus-resteasy</artifactId>
         </dependency>
-        <dependency>
-            <groupId>xerces</groupId>
-            <artifactId>xercesImpl</artifactId>
-        </dependency>
 
         <!-- test dependencies -->
         <dependency>
diff --git a/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlResource.java b/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlResource.java
index 72511ae..586cd07 100644
--- a/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlResource.java
+++ b/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlResource.java
@@ -54,4 +54,29 @@ public class XmlResource {
     public String classpath(String body) throws Exception {
         return producerTemplate.requestBody("xslt:xslt/classpath-transform.xsl", body, String.class);
     }
+
+    @Path("/html-transform")
+    @POST
+    @Consumes(MediaType.TEXT_HTML)
+    @Produces(MediaType.TEXT_PLAIN)
+    public String htmlTransform(String html) {
+        LOG.debugf("Parsing HTML %s", html);
+        return producerTemplate.requestBody(
+                XmlRouteBuilder.DIRECT_HTML_TRANSFORM,
+                html,
+                String.class);
+    }
+
+    @Path("/html-to-text")
+    @POST
+    @Consumes(MediaType.TEXT_HTML)
+    @Produces(MediaType.TEXT_PLAIN)
+    public String htmlToText(String html) {
+        LOG.debugf("Parsing HTML %s", html);
+        return producerTemplate.requestBody(
+                XmlRouteBuilder.DIRECT_HTML_TO_TEXT,
+                html,
+                String.class);
+    }
+
 }
diff --git a/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java b/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java
index 1e8dccf..4ce71d4 100644
--- a/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java
+++ b/integration-tests/xml/src/main/java/org/apache/camel/quarkus/component/xml/it/XmlRouteBuilder.java
@@ -23,6 +23,8 @@ import org.apache.camel.builder.RouteBuilder;
 
 public class XmlRouteBuilder extends RouteBuilder {
     public static final String DIRECT_HTML_TO_DOM = "direct:html-to-dom";
+    public static final String DIRECT_HTML_TRANSFORM = "direct:html-transfrom";
+    public static final String DIRECT_HTML_TO_TEXT = "direct:html-to-text";
 
     @Override
     public void configure() {
@@ -50,5 +52,15 @@ public class XmlRouteBuilder extends RouteBuilder {
                     }
                     exchange.getIn().setBody(text.getTextContent());
                 });
+
+        from(DIRECT_HTML_TRANSFORM)
+                .unmarshal().tidyMarkup()
+                // tagSoup produces DOM that is then consumed by XSLT
+                .to("xslt:xslt/html-transform.xsl");
+
+        from(DIRECT_HTML_TO_TEXT)
+                .unmarshal().tidyMarkup()
+                // tagSoup produces DOM that is then consumed by XSLT
+                .to("xslt:xslt/html-to-text.xsl");
     }
 }
diff --git a/integration-tests/xml/src/main/resources/application.properties b/integration-tests/xml/src/main/resources/application.properties
index 58fc158..68f4e99 100644
--- a/integration-tests/xml/src/main/resources/application.properties
+++ b/integration-tests/xml/src/main/resources/application.properties
@@ -23,4 +23,4 @@ quarkus.log.category."org.apache.camel.quarkus.core.deployment".level = INFO
 #
 # Quarkus - Camel
 #
-quarkus.camel.xslt.sources = xslt/classpath-transform.xsl
+quarkus.camel.xslt.sources = xslt/classpath-transform.xsl,xslt/html-transform.xsl,xslt/html-to-text.xsl
diff --git a/integration-tests/xml/src/main/resources/xslt/html-to-text.xsl b/integration-tests/xml/src/main/resources/xslt/html-to-text.xsl
new file mode 100644
index 0000000..0a5a196
--- /dev/null
+++ b/integration-tests/xml/src/main/resources/xslt/html-to-text.xsl
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    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.
+
+-->
+<xsl:stylesheet
+        xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
+        version='1.0'>
+
+    <xsl:output method="text"/>
+
+    <xsl:template match="/">
+= <xsl:value-of select="/html/head/title"/><xsl:text>&#xa;</xsl:text>
+<xsl:text>&#xa;</xsl:text>
+<xsl:value-of select="/html/body/p"/>
+    </xsl:template>
+
+</xsl:stylesheet>
diff --git a/integration-tests/xml/src/main/resources/xslt/html-transform.xsl b/integration-tests/xml/src/main/resources/xslt/html-transform.xsl
new file mode 100644
index 0000000..fed0d6c
--- /dev/null
+++ b/integration-tests/xml/src/main/resources/xslt/html-transform.xsl
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+
+    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.
+
+-->
+<xsl:stylesheet
+        xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
+        version='1.0'>
+
+    <xsl:output method="html" indent="yes" encoding="ISO-8859-1"/>
+
+    <xsl:template match="/">
+        <html>
+        <head>
+            <title><xsl:value-of select="/html/head/title"/></title>
+        </head>
+        <body>
+            <h1><xsl:value-of select="/html/head/title"/></h1>
+            <p>Paragraph Contents</p>
+        </body>
+        </html>
+    </xsl:template>
+
+</xsl:stylesheet>
diff --git a/integration-tests/xml/src/test/java/org/apache/camel/quarkus/component/xml/it/XmlTest.java b/integration-tests/xml/src/test/java/org/apache/camel/quarkus/component/xml/it/XmlTest.java
index 02da424..08861fa 100644
--- a/integration-tests/xml/src/test/java/org/apache/camel/quarkus/component/xml/it/XmlTest.java
+++ b/integration-tests/xml/src/test/java/org/apache/camel/quarkus/component/xml/it/XmlTest.java
@@ -60,4 +60,42 @@ class XmlTest {
                 actual);
     }
 
+    @Test
+    public void htmlTransform() throws Exception {
+        String html = IOUtils.toString(getClass().getResourceAsStream("/test.html"), Charset.forName("UTF-8"));
+
+        final String actual = RestAssured.given()
+                .contentType(ContentType.HTML)
+                .accept(ContentType.TEXT)
+                .body(html)
+                .post("/xml/html-transform")
+                .then()
+                .statusCode(200)
+                .extract().body().asString().trim().replaceAll(">\\s+<", "><");
+
+        Assertions.assertEquals(
+                "<html><head><META http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\"><title>Title</title></head><body><h1>Title</h1><p>Paragraph Contents</p></body></html>",
+                actual);
+    }
+
+    @Test
+    public void htmlToText() throws Exception {
+        String html = IOUtils.toString(getClass().getResourceAsStream("/test.html"), Charset.forName("UTF-8"));
+
+        final String actual = RestAssured.given()
+                .contentType(ContentType.HTML)
+                .accept(ContentType.TEXT)
+                .body(html)
+                .post("/xml/html-to-text")
+                .then()
+                .statusCode(200)
+                .extract().body().asString().trim();
+
+        Assertions.assertEquals(
+                "= Title\n"
+                        + "\n"
+                        + "Paragraph Contents",
+                actual);
+    }
+
 }