[camel-quarkus] branch master updated: #670 fix PDF itests in native mode

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[camel-quarkus] branch master updated: #670 fix PDF itests in native mode

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 95ecf8f  #670 fix PDF itests in native mode
     new 4deda38  Merge pull request #707 from ffang/issue670
95ecf8f is described below

commit 95ecf8f91f2fe25a960d827a3fdc9c0b5bbc41aa
Author: Freeman Fang <[hidden email]>
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);