You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2019/10/29 11:10:28 UTC
[camel-quarkus] 01/08: Created a camel-pdf component extension
fixes #341
This is an automated email from the ASF dual-hosted git repository.
aldettinger pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 233f56ba27f6abe975f50f57b2bfd82205f8166c
Author: aldettinger <al...@gmail.com>
AuthorDate: Tue Oct 22 15:44:12 2019 +0200
Created a camel-pdf component extension fixes #341
---
.../pages/list-of-camel-quarkus-extensions.adoc | 5 +-
extensions/pdf/deployment/pom.xml | 75 +++++++++++++++
.../component/pdf/deployment/PdfProcessor.java | 42 +++++++++
extensions/pdf/pom.xml | 39 ++++++++
extensions/pdf/runtime/pom.xml | 78 +++++++++++++++
.../main/resources/META-INF/quarkus-extension.json | 9 ++
extensions/pom.xml | 1 +
extensions/readme.adoc | 5 +-
integration-tests/pdf/pom.xml | 105 +++++++++++++++++++++
.../quarkus/component/pdf/it/PdfResource.java | 84 +++++++++++++++++
.../camel/quarkus/component/pdf/it/PdfIT.java | 24 +++++
.../camel/quarkus/component/pdf/it/PdfTest.java | 74 +++++++++++++++
integration-tests/pom.xml | 1 +
poms/bom-deployment/pom.xml | 5 +
poms/bom/pom.xml | 10 ++
15 files changed, 555 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 06f89d7..d4c8d40 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: 25 in 21 JAR artifacts (0 deprecated)
+Number of Camel components: 26 in 22 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -57,6 +57,9 @@ Number of Camel components: 25 in 21 JAR artifacts (0 deprecated)
| link:https://camel.apache.org/components/latest/paho-component.html[Paho] (camel-quarkus-paho) +
`paho:topic` | 0.2 | Component for communicating with MQTT message brokers using Eclipse Paho MQTT Client.
+| link:https://camel.apache.org/components/latest/pdf-component.html[PDF] (camel-quarkus-pdf) +
+`pdf:operation` | 0.2 | The pdf components provides the ability to create, modify or extract content from PDF documents.
+
| link:https://camel.apache.org/components/latest/rest-component.html[REST] (camel-quarkus-rest) +
`rest:method:path:uriTemplate` | 0.2 | The rest component is used for either hosting REST services (consumer) or calling external REST services (producer).
diff --git a/extensions/pdf/deployment/pom.xml b/extensions/pdf/deployment/pom.xml
new file mode 100644
index 0000000..b19e9ce
--- /dev/null
+++ b/extensions/pdf/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-pdf-parent</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-pdf-deployment</artifactId>
+ <name>Camel Quarkus :: Pdf :: 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-pdf</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/pdf/deployment/src/main/java/org/apache/camel/quarkus/component/pdf/deployment/PdfProcessor.java b/extensions/pdf/deployment/src/main/java/org/apache/camel/quarkus/component/pdf/deployment/PdfProcessor.java
new file mode 100644
index 0000000..500e362
--- /dev/null
+++ b/extensions/pdf/deployment/src/main/java/org/apache/camel/quarkus/component/pdf/deployment/PdfProcessor.java
@@ -0,0 +1,42 @@
+/*
+ * 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.pdf.deployment;
+
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.substrate.SubstrateResourceBuildItem;
+
+class PdfProcessor {
+
+ private static final String FEATURE = "camel-pdf";
+
+ private static final String[] RUNTIME_RESOURCES = new String[] {"org/apache/pdfbox/resources/version.properties",
+ "org/apache/pdfbox/resources/icc/ISOcoated_v2_300_bas.icc",
+ "org/apache/pdfbox/resources/glyphlist/additional.txt",
+ "org/apache/pdfbox/resources/ttf/LiberationSans-Regular.ttf"};
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ SubstrateResourceBuildItem initResources() {
+ return new SubstrateResourceBuildItem(RUNTIME_RESOURCES);
+ }
+
+}
diff --git a/extensions/pdf/pom.xml b/extensions/pdf/pom.xml
new file mode 100644
index 0000000..2506a89
--- /dev/null
+++ b/extensions/pdf/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.1-SNAPSHOT</version>
+ <relativePath>../../poms/build-parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-pdf-parent</artifactId>
+ <name>Camel Quarkus :: Pdf</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ </modules>
+</project>
diff --git a/extensions/pdf/runtime/pom.xml b/extensions/pdf/runtime/pom.xml
new file mode 100644
index 0000000..9bd6129
--- /dev/null
+++ b/extensions/pdf/runtime/pom.xml
@@ -0,0 +1,78 @@
+<?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-pdf-parent</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-pdf</artifactId>
+ <name>Camel Quarkus :: Pdf :: 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-pdf</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/pdf/runtime/src/main/resources/META-INF/quarkus-extension.json b/extensions/pdf/runtime/src/main/resources/META-INF/quarkus-extension.json
new file mode 100644
index 0000000..1c8857c
--- /dev/null
+++ b/extensions/pdf/runtime/src/main/resources/META-INF/quarkus-extension.json
@@ -0,0 +1,9 @@
+{
+ "name": "Camel Quarkus Pdf",
+ "labels": [
+ "integration",
+ "camel"
+ ],
+ "guide": "https://quarkus.io/guides/camel"
+}
+
diff --git a/extensions/pom.xml b/extensions/pom.xml
index 70e4f82..2ba2bbc 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -72,6 +72,7 @@
<module>vm</module>
<module>zipfile</module>
<module>attachments</module>
+ <module>pdf</module>
</modules>
<build>
diff --git a/extensions/readme.adoc b/extensions/readme.adoc
index 998d6e0..0cfe130 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: 25 in 21 JAR artifacts (0 deprecated)
+Number of Camel components: 26 in 22 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,5",options="header"]
|===
@@ -56,6 +56,9 @@ Number of Camel components: 25 in 21 JAR artifacts (0 deprecated)
| link:https://camel.apache.org/components/latest/paho-component.html[Paho] (camel-quarkus-paho) +
`paho:topic` | 0.2 | Component for communicating with MQTT message brokers using Eclipse Paho MQTT Client.
+| link:https://camel.apache.org/components/latest/pdf-component.html[PDF] (camel-quarkus-pdf) +
+`pdf:operation` | 0.2 | The pdf components provides the ability to create, modify or extract content from PDF documents.
+
| link:https://camel.apache.org/components/latest/rest-component.html[REST] (camel-quarkus-rest) +
`rest:method:path:uriTemplate` | 0.2 | The rest component is used for either hosting REST services (consumer) or calling external REST services (producer).
diff --git a/integration-tests/pdf/pom.xml b/integration-tests/pdf/pom.xml
new file mode 100644
index 0000000..555ade7
--- /dev/null
+++ b/integration-tests/pdf/pom.xml
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-integration-tests</artifactId>
+ <version>0.3.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>camel-quarkus-integration-test-pdf</artifactId>
+ <name>Camel Quarkus :: Integration Tests :: Pdf</name>
+ <description>Integration tests for Camel Quarkus Pdf extension</description>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-pdf</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>
+ <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>
+ <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/pdf/src/main/java/org/apache/camel/quarkus/component/pdf/it/PdfResource.java b/integration-tests/pdf/src/main/java/org/apache/camel/quarkus/component/pdf/it/PdfResource.java
new file mode 100644
index 0000000..0142e3a
--- /dev/null
+++ b/integration-tests/pdf/src/main/java/org/apache/camel/quarkus/component/pdf/it/PdfResource.java
@@ -0,0 +1,84 @@
+/*
+ * 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.pdf.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.PUT;
+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.apache.camel.component.pdf.PdfHeaderConstants;
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.jboss.logging.Logger;
+
+@Path("/pdf")
+@ApplicationScoped
+public class PdfResource {
+
+ private static final Logger LOG = Logger.getLogger(PdfResource.class);
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Inject
+ ConsumerTemplate consumerTemplate;
+
+ private PDDocument document;
+
+ @Path("/createFromText")
+ @POST
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ public Response createFromText(String message) throws Exception {
+
+ byte[] pdfBytes = producerTemplate.requestBody("pdf:create", message, byte[].class);
+ document = PDDocument.load(pdfBytes);
+ LOG.infof("The PDDocument has been created and contains %d bytes", pdfBytes.length);
+
+ return Response.created(new URI("pdf/extractText")).entity(pdfBytes).build();
+ }
+
+ @Path("/appendText")
+ @PUT
+ @Consumes(MediaType.TEXT_PLAIN)
+ @Produces(MediaType.APPLICATION_OCTET_STREAM)
+ public Response appendText(String message) throws Exception {
+
+ byte[] pdfBytes = producerTemplate.requestBodyAndHeader("pdf:append", message, PdfHeaderConstants.PDF_DOCUMENT_HEADER_NAME, document, byte[].class);
+ LOG.infof("The PDDocument has been updated and now contains %d bytes", pdfBytes.length);
+
+ return Response.ok().entity(pdfBytes).build();
+ }
+
+ @Path("/extractText")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String get() throws Exception {
+ LOG.info("Extracting text from the PDDocument");
+ return producerTemplate.requestBody("pdf:extractText", document, String.class);
+ }
+}
diff --git a/integration-tests/pdf/src/test/java/org/apache/camel/quarkus/component/pdf/it/PdfIT.java b/integration-tests/pdf/src/test/java/org/apache/camel/quarkus/component/pdf/it/PdfIT.java
new file mode 100644
index 0000000..1c9eac8
--- /dev/null
+++ b/integration-tests/pdf/src/test/java/org/apache/camel/quarkus/component/pdf/it/PdfIT.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.pdf.it;
+
+import io.quarkus.test.junit.SubstrateTest;
+
+@SubstrateTest
+class PdfIT extends PdfTest {
+
+}
diff --git a/integration-tests/pdf/src/test/java/org/apache/camel/quarkus/component/pdf/it/PdfTest.java b/integration-tests/pdf/src/test/java/org/apache/camel/quarkus/component/pdf/it/PdfTest.java
new file mode 100644
index 0000000..996afce
--- /dev/null
+++ b/integration-tests/pdf/src/test/java/org/apache/camel/quarkus/component/pdf/it/PdfTest.java
@@ -0,0 +1,74 @@
+/*
+ * 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.pdf.it;
+
+import java.io.IOException;
+
+import io.quarkus.test.junit.QuarkusTest;
+import io.restassured.RestAssured;
+import io.restassured.http.ContentType;
+
+import org.apache.pdfbox.pdmodel.PDDocument;
+import org.apache.pdfbox.text.PDFTextStripper;
+import org.junit.jupiter.api.Order;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+@QuarkusTest
+class PdfTest {
+
+ @Order(1)
+ @Test
+ public void createFromTextShouldReturnANewPdfDocument() throws IOException {
+ byte[] bytes = RestAssured.given().
+ contentType(ContentType.TEXT).body("content to be included in the created pdf document").post("/pdf/createFromText").
+ then().statusCode(201).extract().asByteArray();
+
+ PDDocument doc = PDDocument.load(bytes);
+ PDFTextStripper pdfTextStripper = new PDFTextStripper();
+ String text = pdfTextStripper.getText(doc);
+ assertEquals(1, doc.getNumberOfPages());
+ assertTrue(text.contains("content to be included in the created pdf document"));
+ }
+
+ @Order(2)
+ @Test
+ public void appendTextShouldReturnAnUpdatedPdfDocument() throws IOException {
+ byte[] bytes = RestAssured.given().
+ contentType(ContentType.TEXT).body("another line that should be appended").put("/pdf/appendText").
+ then().statusCode(200).extract().asByteArray();
+
+ PDDocument doc = PDDocument.load(bytes);
+ PDFTextStripper pdfTextStripper = new PDFTextStripper();
+ String text = pdfTextStripper.getText(doc);
+ assertEquals(2, doc.getNumberOfPages());
+ assertTrue(text.contains("content to be included in the created pdf document"));
+ assertTrue(text.contains("another line that should be appended"));
+ }
+
+ @Order(3)
+ @Test
+ public void extractTextShouldReturnUpdatedText() {
+ String pdfText = RestAssured.get("/pdf/extractText").then().statusCode(200).extract().asString();
+
+ assertTrue(pdfText.contains("content to be included in the created pdf document"));
+ assertTrue(pdfText.contains("another line that should be appended"));
+ }
+
+}
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 888a0be..2179969 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -101,6 +101,7 @@
<module>tarfile</module>
<module>twitter</module>
<module>zipfile</module>
+ <module>pdf</module>
</modules>
<build>
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index 810c472..35545ea 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -260,6 +260,11 @@
<artifactId>camel-quarkus-fhir-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-pdf-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index 750d8d2..b8d9edf 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -213,6 +213,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-pdf</artifactId>
+ <version>${camel.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-rest</artifactId>
<version>${camel.version}</version>
</dependency>
@@ -495,6 +500,11 @@
<artifactId>camel-quarkus-attachments</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-pdf</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>