You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/08/28 16:08:06 UTC

[camel-quarkus] branch zipfile created (now b6370d4)

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

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


      at b6370d4  camel-zipfile quarkus extension

This branch includes the following new commits:

     new b6370d4  camel-zipfile quarkus extension

The 1 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.



[camel-quarkus] 01/01: camel-zipfile quarkus extension

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

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

commit b6370d49e42c9442f88e032f53424cbfe4564183
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Wed Aug 28 18:07:49 2019 +0200

    camel-zipfile quarkus extension
---
 .../ROOT/pages/_partials/component-extensions.adoc |   1 +
 extensions/pom.xml                                 |   1 +
 extensions/zipfile/deployment/pom.xml              |  57 ++++++++++
 .../zipfile/deployment/ZipfileProcessor.java       |  15 +++
 extensions/zipfile/pom.xml                         |  21 ++++
 extensions/zipfile/runtime/pom.xml                 |  60 +++++++++++
 integration-tests/pom.xml                          |   1 +
 integration-tests/zipfile/pom.xml                  | 118 +++++++++++++++++++++
 .../component/zipfile/it/ZipfileResource.java      |  57 ++++++++++
 .../component/zipfile/it/ZipfileRouteBuilder.java  |  29 +++++
 .../quarkus/component/zipfile/it/ZipfileIT.java    |   8 ++
 .../quarkus/component/zipfile/it/ZipfileTest.java  |  46 ++++++++
 poms/bom-deployment/pom.xml                        |   5 +
 poms/bom/pom.xml                                   |  10 ++
 14 files changed, 429 insertions(+)

diff --git a/docs/modules/ROOT/pages/_partials/component-extensions.adoc b/docs/modules/ROOT/pages/_partials/component-extensions.adoc
index 026d9ea..d0c8f42 100644
--- a/docs/modules/ROOT/pages/_partials/component-extensions.adoc
+++ b/docs/modules/ROOT/pages/_partials/component-extensions.adoc
@@ -14,3 +14,4 @@
 * `camel-quarkus-servlet`
 * `camel-quarkus-timer`
 * `camel-quarkus-twitter`
+* `camel-quarkus-zipfile`
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 7f77325..a8129bf 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -56,6 +56,7 @@
         <module>timer</module>
         <module>twitter</module>
         <module>bean</module>
+        <module>zipfile</module>
     </modules>
 
     <build>
diff --git a/extensions/zipfile/deployment/pom.xml b/extensions/zipfile/deployment/pom.xml
new file mode 100644
index 0000000..a109e36
--- /dev/null
+++ b/extensions/zipfile/deployment/pom.xml
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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-zipfile-parent</artifactId>
+        <version>0.1.1-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-zipfile-deployment</artifactId>
+    <name>Camel Quarkus :: ZipFile :: 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-deployment</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-zipfile</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/zipfile/deployment/src/main/java/org/apache/camel/quarkus/component/zipfile/deployment/ZipfileProcessor.java b/extensions/zipfile/deployment/src/main/java/org/apache/camel/quarkus/component/zipfile/deployment/ZipfileProcessor.java
new file mode 100644
index 0000000..e6b8117
--- /dev/null
+++ b/extensions/zipfile/deployment/src/main/java/org/apache/camel/quarkus/component/zipfile/deployment/ZipfileProcessor.java
@@ -0,0 +1,15 @@
+package org.apache.camel.quarkus.component.zipfile.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+
+class ZipfileProcessor {
+
+    private static final String FEATURE = "camel-zipfile";
+
+    @BuildStep
+    FeatureBuildItem feature() {
+        return new FeatureBuildItem(FEATURE);
+    }
+
+}
diff --git a/extensions/zipfile/pom.xml b/extensions/zipfile/pom.xml
new file mode 100644
index 0000000..dde645f
--- /dev/null
+++ b/extensions/zipfile/pom.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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.1.1-SNAPSHOT</version>
+        <relativePath>../../poms/build-parent/pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-zipfile-parent</artifactId>
+    <name>Camel Quarkus :: ZipFile</name>
+    <packaging>pom</packaging>
+
+    <modules>
+        <module>deployment</module>
+        <module>runtime</module>
+    </modules>
+</project>
diff --git a/extensions/zipfile/runtime/pom.xml b/extensions/zipfile/runtime/pom.xml
new file mode 100644
index 0000000..82f14dd
--- /dev/null
+++ b/extensions/zipfile/runtime/pom.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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-zipfile-parent</artifactId>
+        <version>0.1.1-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>camel-quarkus-zipfile</artifactId>
+    <name>Camel Quarkus :: ZipFile :: Runtime</name>
+
+    <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</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel</groupId>
+            <artifactId>camel-zipfile</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/integration-tests/pom.xml b/integration-tests/pom.xml
index 0b475c3..f9765cc 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -69,6 +69,7 @@
         <module>salesforce</module>
         <module>servlet</module>
         <module>twitter</module>
+        <module>zipfile</module>
     </modules>
 
     <build>
diff --git a/integration-tests/zipfile/pom.xml b/integration-tests/zipfile/pom.xml
new file mode 100644
index 0000000..19f1efb
--- /dev/null
+++ b/integration-tests/zipfile/pom.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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.1.1-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>camel-quarkus-integration-test-zipfile</artifactId>
+    <name>Camel Quarkus :: Integration Tests :: zipfile</name>
+    <description>Integration tests for Camel Quarkus zipfile extension</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-zipfile</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>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-image</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/zipfile/src/main/java/org/apache/camel/quarkus/component/zipfile/it/ZipfileResource.java b/integration-tests/zipfile/src/main/java/org/apache/camel/quarkus/component/zipfile/it/ZipfileResource.java
new file mode 100644
index 0000000..a8e7c22
--- /dev/null
+++ b/integration-tests/zipfile/src/main/java/org/apache/camel/quarkus/component/zipfile/it/ZipfileResource.java
@@ -0,0 +1,57 @@
+/*
+ * 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.zipfile.it;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.net.URI;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.Consumes;
+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.ProducerTemplate;
+import org.jboss.logging.Logger;
+
+@Path("/zipfile")
+@ApplicationScoped
+public class ZipfileResource {
+
+    private static final Logger log = Logger.getLogger(ZipfileResource.class);
+
+    @Inject
+    ProducerTemplate producerTemplate;
+
+    @Path("/post")
+    @POST
+    @Consumes(MediaType.TEXT_PLAIN)
+    @Produces(MediaType.APPLICATION_OCTET_STREAM)
+    public Response post(String message) throws Exception {
+        log.infof("Sending to zipfile: %s", message);
+        final byte[] response = producerTemplate.requestBody("direct:start", message, byte[].class);
+        log.infof("Got response from zipfile: %s", response);
+        return Response
+                .created(new URI("https://camel.apache.org/"))
+                .header("content-length", response.length)
+                .entity(response)
+                .build();
+    }
+}
diff --git a/integration-tests/zipfile/src/main/java/org/apache/camel/quarkus/component/zipfile/it/ZipfileRouteBuilder.java b/integration-tests/zipfile/src/main/java/org/apache/camel/quarkus/component/zipfile/it/ZipfileRouteBuilder.java
new file mode 100644
index 0000000..d5b839d
--- /dev/null
+++ b/integration-tests/zipfile/src/main/java/org/apache/camel/quarkus/component/zipfile/it/ZipfileRouteBuilder.java
@@ -0,0 +1,29 @@
+/*
+ * 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.zipfile.it;
+
+import org.apache.camel.builder.RouteBuilder;
+
+
+public class ZipfileRouteBuilder extends RouteBuilder {
+    @Override
+    public void configure() {
+        // Add some routes or remove this class
+        from("direct:start")
+            .marshal().zipFile();
+    }
+}
diff --git a/integration-tests/zipfile/src/test/java/org/apache/camel/quarkus/component/zipfile/it/ZipfileIT.java b/integration-tests/zipfile/src/test/java/org/apache/camel/quarkus/component/zipfile/it/ZipfileIT.java
new file mode 100644
index 0000000..c669345
--- /dev/null
+++ b/integration-tests/zipfile/src/test/java/org/apache/camel/quarkus/component/zipfile/it/ZipfileIT.java
@@ -0,0 +1,8 @@
+package org.apache.camel.quarkus.component.zipfile.it;
+
+import io.quarkus.test.junit.SubstrateTest;
+
+@SubstrateTest
+class ZipfileIT extends ZipfileTest {
+
+}
diff --git a/integration-tests/zipfile/src/test/java/org/apache/camel/quarkus/component/zipfile/it/ZipfileTest.java b/integration-tests/zipfile/src/test/java/org/apache/camel/quarkus/component/zipfile/it/ZipfileTest.java
new file mode 100644
index 0000000..adaad56
--- /dev/null
+++ b/integration-tests/zipfile/src/test/java/org/apache/camel/quarkus/component/zipfile/it/ZipfileTest.java
@@ -0,0 +1,46 @@
+package org.apache.camel.quarkus.component.zipfile.it;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+import io.restassured.response.ExtractableResponse;
+import org.apache.camel.CamelContext;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.util.IOHelper;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Test;
+
+@QuarkusTest
+class ZipfileTest {
+
+    @Test
+    public void test() throws Exception {
+        byte[] body;
+
+        ExtractableResponse response = RestAssured.given() //
+            .contentType(ContentType.TEXT).body("Hello World").post("/zipfile/post") //
+            .then().extract();
+
+        body = response.body().asByteArray();
+        Assertions.assertNotNull(body);
+
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        ZipInputStream zis = new ZipInputStream(new ByteArrayInputStream(body));
+        ZipEntry entry = zis.getNextEntry();
+        if (entry != null) {
+            IOHelper.copy(zis, bos);
+        }
+
+        String str = bos.toString();
+        Assertions.assertEquals("Hello World", str);
+    }
+
+}
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index 32da42f..e1488ee 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -169,6 +169,11 @@
                 <artifactId>camel-quarkus-xstream-common-deployment</artifactId>
                 <version>${camel-quarkus.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-zipfile-deployment</artifactId>
+                <version>${project.version}</version>
+            </dependency>
 
         </dependencies>
     </dependencyManagement>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index f35c79b..4081954 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -175,6 +175,11 @@
                 <artifactId>camel-twitter</artifactId>
                 <version>${camel.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.apache.camel</groupId>
+                <artifactId>camel-zipfile</artifactId>
+                <version>${camel.version}</version>
+            </dependency>
 
             <!-- Camel Quarkus Common (in alphabetical order) -->
             <dependency>
@@ -296,6 +301,11 @@
                 <artifactId>xstream</artifactId>
                 <version>${xstream.version}</version>
             </dependency>
+            <dependency>
+                <groupId>org.apache.camel.quarkus</groupId>
+                <artifactId>camel-quarkus-zipfile</artifactId>
+                <version>${project.version}</version>
+            </dependency>
 
         </dependencies>
     </dependencyManagement>