[camel-quarkus] branch xslt created (now ab8546d)

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[camel-quarkus] branch xslt created (now ab8546d)

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

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


      at ab8546d  #406 regen

This branch includes the following new commits:

     new c35dd70  Fixes #406 xslt extension
     new 517e311  Fixes #406 xslt extension
     new ab8546d  #406 regen

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.


Reply | Threaded
Open this post in threaded view
|

[camel-quarkus] 01/03: Fixes #406 xslt extension

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

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

commit c35dd7046337181e35a85ab3e98d2f740bc217ea
Author: Claus Ibsen <[hidden email]>
AuthorDate: Wed Nov 13 06:57:48 2019 +0100

    Fixes #406 xslt extension
---
 extensions/pom.xml                                 |   1 +
 extensions/xslt/deployment/pom.xml                 |  75 ++++++++++++
 .../component/xslt/deployment/XsltProcessor.java   |  31 +++++
 extensions/xslt/pom.xml                            |  39 ++++++
 extensions/xslt/runtime/pom.xml                    |  82 +++++++++++++
 .../main/resources/META-INF/quarkus-extension.yaml |  27 +++++
 integration-tests/pom.xml                          |   1 +
 integration-tests/xslt/pom.xml                     | 132 +++++++++++++++++++++
 .../quarkus/component/xslt/it/XsltResource.java    |  69 +++++++++++
 .../camel/quarkus/component/xslt/it/XsltIT.java    |  24 ++++
 .../camel/quarkus/component/xslt/it/XsltTest.java  |  43 +++++++
 poms/bom-deployment/pom.xml                        |   5 +
 poms/bom/pom.xml                                   |  10 ++
 13 files changed, 539 insertions(+)

diff --git a/extensions/pom.xml b/extensions/pom.xml
index f6974f5..f76f4b8 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -79,6 +79,7 @@
         <module>pdf</module>
         <module>controlbus</module>
         <module>scheduler</module>
+        <module>xslt</module>
 
     </modules>
 
diff --git a/extensions/xslt/deployment/pom.xml b/extensions/xslt/deployment/pom.xml
new file mode 100644
index 0000000..a061aed
--- /dev/null
+++ b/extensions/xslt/deployment/pom.xml
@@ -0,0 +1,75 @@
+<?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-xslt-parent</artifactId>
+        <version>0.3.2-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-xslt-deployment</artifactId>
+    <name>Camel Quarkus :: XSLT :: Deployment</name>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-bom-deployment</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-core-xml-deployment</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-xslt</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <annotationProcessorPaths>
+                        <path>
+                            <groupId>io.quarkus</groupId>
+                            <artifactId>quarkus-extension-processor</artifactId>
+                            <version>${quarkus.version}</version>
+                        </path>
+                    </annotationProcessorPaths>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
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
new file mode 100644
index 0000000..5b33726
--- /dev/null
+++ b/extensions/xslt/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/deployment/XsltProcessor.java
@@ -0,0 +1,31 @@
+/*
+ * 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.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+
+class XsltProcessor {
+
+    private static final String FEATURE = "camel-xslt";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+}
diff --git a/extensions/xslt/pom.xml b/extensions/xslt/pom.xml
new file mode 100644
index 0000000..34ea290
--- /dev/null
+++ b/extensions/xslt/pom.xml
@@ -0,0 +1,39 @@
+<?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-build-parent</artifactId>
+        <version>0.3.2-SNAPSHOT</version>
+        <relativePath>../../poms/build-parent/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-xslt-parent</artifactId>
+    <name>Camel Quarkus :: XSLT</name>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>deployment</module>
+        <module>runtime</module>
+    </modules>
+</project>
diff --git a/extensions/xslt/runtime/pom.xml b/extensions/xslt/runtime/pom.xml
new file mode 100644
index 0000000..a697e6b
--- /dev/null
+++ b/extensions/xslt/runtime/pom.xml
@@ -0,0 +1,82 @@
+<?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-xslt-parent</artifactId>
+        <version>0.3.2-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-xslt</artifactId>
+    <name>Camel Quarkus :: XSLT :: Runtime</name>
+
+    <properties>
+        <firstVersion>0.4.0</firstVersion>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-bom</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-core-xml</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-xslt</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>io.quarkus</groupId>
+                <artifactId>quarkus-bootstrap-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <annotationProcessorPaths>
+                        <path>
+                            <groupId>io.quarkus</groupId>
+                            <artifactId>quarkus-extension-processor</artifactId>
+                            <version>${quarkus.version}</version>
+                        </path>
+                    </annotationProcessorPaths>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git a/extensions/xslt/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions/xslt/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..0de4d2d
--- /dev/null
+++ b/extensions/xslt/runtime/src/main/resources/META-INF/quarkus-extension.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.
+#
+
+---
+name: "Camel Quarkus XSLT"
+description: "Camel XSLT support"
+metadata:
+  keywords:
+  - "camel"
+  - "xml"
+  guide: "https://quarkus.io/guides/camel"
+  categories:
+  - "integration"
\ No newline at end of file
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 89bc03f..ab50143 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -108,6 +108,7 @@
         <module>pdf</module>
         <module>controlbus</module>
         <module>scheduler</module>
+        <module>xslt</module>
 
     </modules>
 
diff --git a/integration-tests/xslt/pom.xml b/integration-tests/xslt/pom.xml
new file mode 100644
index 0000000..3e8e8e6
--- /dev/null
+++ b/integration-tests/xslt/pom.xml
@@ -0,0 +1,132 @@
+<?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>0.3.2-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>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-xslt</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-log</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>
+            <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>
+                    <plugin>
+                        <groupId>io.quarkus</groupId>
+                        <artifactId>quarkus-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>native-image</id>
+                                <goals>
+                                    <goal>native-image</goal>
+                                </goals>
+                                <configuration>
+                                    <reportErrorsAtRuntime>false</reportErrorsAtRuntime>
+                                    <cleanupServer>true</cleanupServer>
+                                    <enableHttpsUrlHandler>true</enableHttpsUrlHandler>
+                                    <enableServer>false</enableServer>
+                                    <dumpProxies>false</dumpProxies>
+                                    <graalvmHome>${graalvmHome}</graalvmHome>
+                                    <enableJni>true</enableJni>
+                                    <enableAllSecurityServices>true</enableAllSecurityServices>
+                                    <disableReports>true</disableReports>
+                                </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
new file mode 100644
index 0000000..07feecd
--- /dev/null
+++ b/integration-tests/xslt/src/main/java/org/apache/camel/quarkus/component/xslt/it/XsltResource.java
@@ -0,0 +1,69 @@
+/*
+ * 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 java.net.URI;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import org.apache.camel.ConsumerTemplate;
+import org.apache.camel.ProducerTemplate;
+import org.jboss.logging.Logger;
+
+@Path("/xslt")
+@ApplicationScoped
+public class XsltResource {
+
+    private static final Logger LOG = Logger.getLogger(XsltResource.class);
+
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    @Inject
+    ConsumerTemplate consumerTemplate;
+
+    @Path("/get")
+    @GET
+    @Produces(MediaType.TEXT_PLAIN)
+    public String get() throws Exception {
+        final String message = consumerTemplate.receiveBodyNoWait("xslt:--fix-me--", String.class);
+        LOG.infof("Received from xslt: %s", message);
+        return message;
+    }
+
+    @Path("/post")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.TEXT_PLAIN)
+    public Response post(String message) throws Exception {
+        LOG.infof("Sending to xslt: %s", message);
+        final String response = producerTemplate.requestBody("xslt:--fix-me--", message, String.class);
+        LOG.infof("Got response from xslt: %s", response);
+        return Response
+                .created(new URI("https://camel.apache.org/"))
+                .entity(response)
+                .build();
+    }
+}
diff --git a/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltIT.java b/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltIT.java
new file mode 100644
index 0000000..a49fdf4
--- /dev/null
+++ b/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltIT.java
@@ -0,0 +1,24 @@
+/*
+ * 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 io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class XsltIT extends XsltTest {
+
+}
diff --git a/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java b/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java
new file mode 100644
index 0000000..ff5621a
--- /dev/null
+++ b/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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 java.util.UUID;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+@QuarkusTest
+class XsltTest {
+
+    @Test
+    public void test() {
+        final String msg = UUID.randomUUID().toString().replace("-", "");
+        RestAssured.given() //
+            .contentType(ContentType.TEXT).body(msg).post("/xslt/post") //
+            .then().statusCode(201);
+
+        Assertions.fail("Add some assertions to " + getClass().getName());
+
+        RestAssured.get("/xslt/get").then().statusCode(200);
+    }
+
+}
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index 304e4d2..b4543e0 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -293,6 +293,11 @@
                 <artifactId>camel-quarkus-scheduler-deployment</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-xslt-deployment</artifactId>
+                <version>${camel-quarkus.version}</version>
+            </dependency>
 
 
         </dependencies>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index ca3c2c9..9d35962 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -304,6 +304,11 @@
             </dependency>
             <dependency>
                 <groupId>org.apache.camel</groupId>
+                <artifactId>camel-xslt</artifactId>
+                <version>${camel.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.apache.camel</groupId>
                 <artifactId>camel-zipfile</artifactId>
                 <version>${camel.version}</version>
             </dependency>
@@ -580,6 +585,11 @@
                 <artifactId>camel-quarkus-scheduler</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-xslt</artifactId>
+                <version>${camel-quarkus.version}</version>
+            </dependency>
 
 
         </dependencies>

Reply | Threaded
Open this post in threaded view
|

[camel-quarkus] 02/03: Fixes #406 xslt extension

davsclaus-2
In reply to this post by davsclaus-2
This is an automated email from the ASF dual-hosted git repository.

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

commit 517e311192d7a4f6ba5cf3e0004691dc928e1de7
Author: Claus Ibsen <[hidden email]>
AuthorDate: Wed Nov 13 07:13:54 2019 +0100

    Fixes #406 xslt extension
---
 integration-tests/xslt/pom.xml                     |  4 +++
 .../quarkus/component/xslt/it/XsltResource.java    | 25 ++-----------
 .../quarkus/component/xslt/it/XsltRoute.java}      | 35 ++++++------------
 .../xslt/src/main/resources/transform.xsl          | 41 ++++++++++++++++++++++
 .../camel/quarkus/component/xslt/it/XsltTest.java  | 16 ++-------
 5 files changed, 60 insertions(+), 61 deletions(-)

diff --git a/integration-tests/xslt/pom.xml b/integration-tests/xslt/pom.xml
index 3e8e8e6..423d142 100644
--- a/integration-tests/xslt/pom.xml
+++ b/integration-tests/xslt/pom.xml
@@ -38,6 +38,10 @@
         </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>
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
index 07feecd..0ea8144 100644
--- 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
@@ -16,19 +16,13 @@
  */
 package org.apache.camel.quarkus.component.xslt.it;
 
-import java.net.URI;
-
 import javax.enterprise.context.ApplicationScoped;
 import javax.inject.Inject;
-import javax.ws.rs.Consumes;
 import javax.ws.rs.GET;
-import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
 
-import org.apache.camel.ConsumerTemplate;
 import org.apache.camel.ProducerTemplate;
 import org.jboss.logging.Logger;
 
@@ -41,29 +35,14 @@ public class XsltResource {
     @Inject
     ProducerTemplate producerTemplate;
 
-    @Inject
-    ConsumerTemplate consumerTemplate;
-
     @Path("/get")
     @GET
     @Produces(MediaType.TEXT_PLAIN)
     public String get() throws Exception {
-        final String message = consumerTemplate.receiveBodyNoWait("xslt:--fix-me--", String.class);
+        String body = "<mail><subject>Hey</subject><body>Hello world!</body></mail>";
+        String message = producerTemplate.requestBody("direct:start", body, String.class);
         LOG.infof("Received from xslt: %s", message);
         return message;
     }
 
-    @Path("/post")
-    @POST
-    @Consumes(MediaType.TEXT_PLAIN)
-    @Produces(MediaType.TEXT_PLAIN)
-    public Response post(String message) throws Exception {
-        LOG.infof("Sending to xslt: %s", message);
-        final String response = producerTemplate.requestBody("xslt:--fix-me--", message, String.class);
-        LOG.infof("Got response from xslt: %s", response);
-        return Response
-                .created(new URI("https://camel.apache.org/"))
-                .entity(response)
-                .build();
-    }
 }
diff --git a/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java b/integration-tests/xslt/src/main/java/org/apache/camel/quarkus/component/xslt/it/XsltRoute.java
similarity index 53%
copy from integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java
copy to integration-tests/xslt/src/main/java/org/apache/camel/quarkus/component/xslt/it/XsltRoute.java
index ff5621a..c844765 100644
--- a/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java
+++ b/integration-tests/xslt/src/main/java/org/apache/camel/quarkus/component/xslt/it/XsltRoute.java
@@ -1,13 +1,13 @@
-/*
+/**
  * 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
- *
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,28 +16,13 @@
  */
 package org.apache.camel.quarkus.component.xslt.it;
 
-import java.util.UUID;
+import org.apache.camel.builder.RouteBuilder;
 
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import io.restassured.http.ContentType;
+public class XsltRoute extends RouteBuilder {
 
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.Test;
-
-@QuarkusTest
-class XsltTest {
-
-    @Test
-    public void test() {
-        final String msg = UUID.randomUUID().toString().replace("-", "");
-        RestAssured.given() //
-            .contentType(ContentType.TEXT).body(msg).post("/xslt/post") //
-            .then().statusCode(201);
-
-        Assertions.fail("Add some assertions to " + getClass().getName());
-
-        RestAssured.get("/xslt/get").then().statusCode(200);
+    @Override
+    public void configure() throws Exception {
+        from("direct:start")
+                .to("xslt:transform.xsl");
     }
-
 }
diff --git a/integration-tests/xslt/src/main/resources/transform.xsl b/integration-tests/xslt/src/main/resources/transform.xsl
new file mode 100644
index 0000000..30c5ab4
--- /dev/null
+++ b/integration-tests/xslt/src/main/resources/transform.xsl
@@ -0,0 +1,41 @@
+<?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="xml" indent="yes" encoding="ISO-8859-1"/>
+
+    <xsl:template match="/">
+        <transformed subject="{/mail/subject}">
+            <cheese>
+                <xsl:apply-templates select="*|@*"/>
+            </cheese>
+        </transformed>
+    </xsl:template>
+
+    <xsl:template match="*">
+        <xsl:copy>
+            <xsl:copy-of select="attribute::*"/>
+            <xsl:apply-templates/>
+        </xsl:copy>
+    </xsl:template>
+
+</xsl:stylesheet>
diff --git a/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java b/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java
index ff5621a..bc1470e 100644
--- a/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java
+++ b/integration-tests/xslt/src/test/java/org/apache/camel/quarkus/component/xslt/it/XsltTest.java
@@ -16,13 +16,9 @@
  */
 package org.apache.camel.quarkus.component.xslt.it;
 
-import java.util.UUID;
-
 import io.quarkus.test.junit.QuarkusTest;
 import io.restassured.RestAssured;
-import io.restassured.http.ContentType;
-
-import org.junit.jupiter.api.Assertions;
+import org.hamcrest.xml.HasXPath;
 import org.junit.jupiter.api.Test;
 
 @QuarkusTest
@@ -30,14 +26,8 @@ class XsltTest {
 
     @Test
     public void test() {
-        final String msg = UUID.randomUUID().toString().replace("-", "");
-        RestAssured.given() //
-            .contentType(ContentType.TEXT).body(msg).post("/xslt/post") //
-            .then().statusCode(201);
-
-        Assertions.fail("Add some assertions to " + getClass().getName());
-
-        RestAssured.get("/xslt/get").then().statusCode(200);
+        RestAssured.get("/xslt/get").then().statusCode(200)
+                .body(HasXPath.hasXPath("/transformed/cheese/mail/subject"));
     }
 
 }

Reply | Threaded
Open this post in threaded view
|

[camel-quarkus] 03/03: #406 regen

davsclaus-2
In reply to this post by davsclaus-2
This is an automated email from the ASF dual-hosted git repository.

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

commit ab8546d66774bf021c8fc5808bcea3576f5099dc
Author: Claus Ibsen <[hidden email]>
AuthorDate: Wed Nov 13 07:19:21 2019 +0100

    #406 regen
---
 docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc | 5 ++++-
 extensions/readme.adoc                                        | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
index 122c3aa..b31be72 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -6,7 +6,7 @@ As of Camel Quarkus {camel-quarkus-last-release} the following Camel artifacts a
 == Camel Components
 
 // components: START
-Number of Camel components: 31 in 27 JAR artifacts (0 deprecated)
+Number of Camel components: 32 in 28 JAR artifacts (0 deprecated)
 
 [width="100%",cols="4,1,5",options="header"]
 |===
@@ -105,6 +105,9 @@ Number of Camel components: 31 in 27 JAR artifacts (0 deprecated)
 | link:https://camel.apache.org/components/latest/vm-component.html[VM] (camel-quarkus-vm) +
 `vm:name` | 0.3 | The vm component provides asynchronous call to another endpoint from the same CamelContext.
 
+| link:https://camel.apache.org/components/latest/xslt-component.html[XSLT] (camel-quarkus-xslt) +
+`xslt:resourceUri` | 0.4 | Transforms the message using a XSLT template.
+
 |===
 // components: END
 
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index d3f060d..6b004d7 100644
--- a/extensions/readme.adoc
+++ b/extensions/readme.adoc
@@ -5,7 +5,7 @@ Apache Camel Quarkus supports the following Camel artifacts as Quarkus Extension
 == Camel Components
 
 // components: START
-Number of Camel components: 31 in 27 JAR artifacts (0 deprecated)
+Number of Camel components: 32 in 28 JAR artifacts (0 deprecated)
 
 [width="100%",cols="4,1,5",options="header"]
 |===
@@ -104,6 +104,9 @@ Number of Camel components: 31 in 27 JAR artifacts (0 deprecated)
 | link:https://camel.apache.org/components/latest/vm-component.html[VM] (camel-quarkus-vm) +
 `vm:name` | 0.3 | The vm component provides asynchronous call to another endpoint from the same CamelContext.
 
+| link:https://camel.apache.org/components/latest/xslt-component.html[XSLT] (camel-quarkus-xslt) +
+`xslt:resourceUri` | 0.4 | Transforms the message using a XSLT template.
+
 |===
 // components: END