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/17 11:24:04 UTC

[camel-quarkus] 09/34: #670 fix PDF itests in native mode

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

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

commit 23e36a10c3083be2d899fc8e78e6e03055221445
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Wed Feb 12 17:23:29 2020 -0500

    #670 fix PDF itests in native mode
---
 extensions/pdf/deployment/pom.xml                              |  4 ++++
 .../camel/quarkus/component/pdf/deployment/PdfProcessor.java   | 10 +++++++---
 extensions/pdf/runtime/pom.xml                                 | 10 ++++++++++
 .../org/apache/camel/quarkus/component/pdf/it/PdfResource.java |  2 +-
 4 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/extensions/pdf/deployment/pom.xml b/extensions/pdf/deployment/pom.xml
index 3b7e9a2..0058ff4 100644
--- a/extensions/pdf/deployment/pom.xml
+++ b/extensions/pdf/deployment/pom.xml
@@ -50,6 +50,10 @@
             <groupId>org.apache.camel.quarkus</groupId>
             <artifactId>camel-quarkus-pdf</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-support-commons-logging-deployment</artifactId>
+        </dependency>
     </dependencies>
 
     <build>
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
index 60568c0..e7bbf14 100644
--- 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
@@ -16,11 +16,12 @@
  */
 package org.apache.camel.quarkus.component.pdf.deployment;
 
+import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.builditem.nativeimage.NativeImageConfigBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.NativeImageResourceBuildItem;
 import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
-import org.apache.camel.component.pdf.PdfConfiguration;
 
 class PdfProcessor {
 
@@ -42,8 +43,11 @@ class PdfProcessor {
     }
 
     @BuildStep
-    ReflectiveClassBuildItem initReflectiveConfiguration() {
-        return new ReflectiveClassBuildItem(true, false, PdfConfiguration.class);
+    NativeImageConfigBuildItem build(BuildProducer<ReflectiveClassBuildItem> reflectiveClass) {
+        return NativeImageConfigBuildItem.builder()
+                .addRuntimeInitializedClass("org.apache.pdfbox.pdmodel.font.PDType1Font")
+                .addRuntimeInitializedClass("org.apache.camel.component.pdf.PdfConfiguration")
+                .build();
     }
 
 }
diff --git a/extensions/pdf/runtime/pom.xml b/extensions/pdf/runtime/pom.xml
index a4de961..72da6bc 100644
--- a/extensions/pdf/runtime/pom.xml
+++ b/extensions/pdf/runtime/pom.xml
@@ -53,6 +53,16 @@
         <dependency>
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-pdf</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-logging</groupId>
+                    <artifactId>commons-logging</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.camel.quarkus</groupId>
+            <artifactId>camel-quarkus-support-commons-logging</artifactId>
         </dependency>
     </dependencies>
 
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
index ffd6fa8..c8d7bda 100644
--- 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
@@ -51,7 +51,7 @@ public class PdfResource {
     @Produces(MediaType.APPLICATION_OCTET_STREAM)
     public Response createFromText(String message) throws Exception {
         document = producerTemplate.requestBody(
-                "pdf:create?fontSize=6&pageSize=PAGE_SIZE_A5&font=Courier", message, byte[].class);
+                "pdf:create?fontSize=6&pageSize=PAGE_SIZE_A5", message, byte[].class);
 
         LOG.infof("The PDDocument has been created and contains %d bytes", document.length);