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

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


The following commit(s) were added to refs/heads/main by this push:
     new 02e639ed76 Fix #1615 to add xslt-saxon native support (#5133)
02e639ed76 is described below

commit 02e639ed7619a4523be5b38e6a84f007630e7083
Author: Zheng Feng <[email protected]>
AuthorDate: Mon Jul 31 19:05:47 2023 +0800

    Fix #1615 to add xslt-saxon native support (#5133)
---
 .../ROOT/examples/components/xslt-saxon.yml        |  6 ++---
 .../pages/reference/extensions/xslt-saxon.adoc     | 14 ++++++----
 extensions-jvm/pom.xml                             |  1 -
 extensions/pom.xml                                 |  1 +
 .../xslt-saxon/deployment/pom.xml                  |  0
 .../xslt/saxon/deployment/XsltSaxonProcessor.java  | 31 +++++++++++++---------
 {extensions-jvm => extensions}/xslt-saxon/pom.xml  |  2 +-
 .../xslt-saxon/runtime/pom.xml                     |  5 ++++
 .../main/resources/META-INF/quarkus-extension.yaml |  0
 integration-tests-jvm/pom.xml                      |  1 -
 integration-tests/pom.xml                          |  1 +
 .../xslt-saxon/pom.xml                             | 27 +++++++++++++++++++
 .../component/xslt/saxon/it/XsltSaxonResource.java |  0
 .../component/xslt/saxon/it/XsltSaxonIT.java       | 16 +++--------
 .../component/xslt/saxon/it/XsltSaxonTest.java     |  0
 tooling/scripts/test-categories.yaml               |  1 +
 16 files changed, 70 insertions(+), 36 deletions(-)

diff --git a/docs/modules/ROOT/examples/components/xslt-saxon.yml 
b/docs/modules/ROOT/examples/components/xslt-saxon.yml
index 48637302a2..30d4286a15 100644
--- a/docs/modules/ROOT/examples/components/xslt-saxon.yml
+++ b/docs/modules/ROOT/examples/components/xslt-saxon.yml
@@ -2,11 +2,11 @@
 # This file was generated by 
camel-quarkus-maven-plugin:update-extension-doc-page
 cqArtifactId: camel-quarkus-xslt-saxon
 cqArtifactIdBase: xslt-saxon
-cqNativeSupported: false
-cqStatus: Preview
+cqNativeSupported: true
+cqStatus: Stable
 cqDeprecated: false
 cqJvmSince: 1.1.0
-cqNativeSince: n/a
+cqNativeSince: 3.0.0
 cqCamelPartName: xslt-saxon
 cqCamelPartTitle: XSLT Saxon
 cqCamelPartDescription: Transform XML payloads using an XSLT template using 
Saxon.
diff --git a/docs/modules/ROOT/pages/reference/extensions/xslt-saxon.adoc 
b/docs/modules/ROOT/pages/reference/extensions/xslt-saxon.adoc
index 2a0775472d..73b9d70db7 100644
--- a/docs/modules/ROOT/pages/reference/extensions/xslt-saxon.adoc
+++ b/docs/modules/ROOT/pages/reference/extensions/xslt-saxon.adoc
@@ -4,17 +4,17 @@
 = XSLT Saxon
 :linkattrs:
 :cq-artifact-id: camel-quarkus-xslt-saxon
-:cq-native-supported: false
-:cq-status: Preview
-:cq-status-deprecation: Preview
+:cq-native-supported: true
+:cq-status: Stable
+:cq-status-deprecation: Stable
 :cq-description: Transform XML payloads using an XSLT template using Saxon.
 :cq-deprecated: false
 :cq-jvm-since: 1.1.0
-:cq-native-since: n/a
+:cq-native-since: 3.0.0
 
 ifeval::[{doc-show-badges} == true]
 [.badges]
-[.badge-key]##JVM since##[.badge-supported]##1.1.0## 
[.badge-key]##Native##[.badge-unsupported]##unsupported##
+[.badge-key]##JVM since##[.badge-supported]##1.1.0## [.badge-key]##Native 
since##[.badge-supported]##3.0.0##
 endif::[]
 
 Transform XML payloads using an XSLT template using Saxon.
@@ -29,6 +29,10 @@ Please refer to the above link for usage and configuration 
details.
 [id="extensions-xslt-saxon-maven-coordinates"]
 == Maven coordinates
 
+https://{link-quarkus-code-generator}/?extension-search=camel-quarkus-xslt-saxon[Create
 a new project with this extension on {link-quarkus-code-generator}, 
window="_blank"]
+
+Or add the coordinates to your existing project:
+
 [source,xml]
 ----
 <dependency>
diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml
index ec56a2f55f..278a4f9a42 100644
--- a/extensions-jvm/pom.xml
+++ b/extensions-jvm/pom.xml
@@ -102,7 +102,6 @@
         <module>workday</module>
         <module>xj</module>
         <module>xmpp</module>
-        <module>xslt-saxon</module>
         <module>zookeeper</module>
         <module>zookeeper-master</module>
     </modules>
diff --git a/extensions/pom.xml b/extensions/pom.xml
index c8262d6704..eb51ecc44b 100644
--- a/extensions/pom.xml
+++ b/extensions/pom.xml
@@ -248,6 +248,7 @@
         <module>xmlsecurity</module>
         <module>xpath</module>
         <module>xslt</module>
+        <module>xslt-saxon</module>
         <module>zendesk</module>
         <module>zip-deflater</module>
         <module>zipfile</module>
diff --git a/extensions-jvm/xslt-saxon/deployment/pom.xml 
b/extensions/xslt-saxon/deployment/pom.xml
similarity index 100%
rename from extensions-jvm/xslt-saxon/deployment/pom.xml
rename to extensions/xslt-saxon/deployment/pom.xml
diff --git 
a/extensions-jvm/xslt-saxon/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/deployment/XsltSaxonProcessor.java
 
b/extensions/xslt-saxon/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/deployment/XsltSaxonProcessor.java
similarity index 52%
rename from 
extensions-jvm/xslt-saxon/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/deployment/XsltSaxonProcessor.java
rename to 
extensions/xslt-saxon/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/deployment/XsltSaxonProcessor.java
index 26a253d16a..dbb03724df 100644
--- 
a/extensions-jvm/xslt-saxon/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/deployment/XsltSaxonProcessor.java
+++ 
b/extensions/xslt-saxon/deployment/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/deployment/XsltSaxonProcessor.java
@@ -16,13 +16,18 @@
  */
 package org.apache.camel.quarkus.component.xslt.saxon.deployment;
 
+import io.quarkus.deployment.annotations.BuildProducer;
 import io.quarkus.deployment.annotations.BuildStep;
-import io.quarkus.deployment.annotations.ExecutionTime;
-import io.quarkus.deployment.annotations.Record;
 import io.quarkus.deployment.builditem.FeatureBuildItem;
-import io.quarkus.deployment.pkg.steps.NativeBuild;
-import org.apache.camel.quarkus.core.JvmOnlyRecorder;
+import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
+import 
io.quarkus.deployment.builditem.nativeimage.RuntimeInitializedClassBuildItem;
+import net.sf.saxon.Configuration;
+import net.sf.saxon.functions.StringJoin;
+import net.sf.saxon.functions.String_1;
+import net.sf.saxon.functions.Tokenize_1;
+import org.apache.camel.component.xslt.saxon.XsltSaxonBuilder;
 import org.jboss.logging.Logger;
+import org.xmlresolver.loaders.XmlLoader;
 
 class XsltSaxonProcessor {
 
@@ -34,13 +39,15 @@ class XsltSaxonProcessor {
         return new FeatureBuildItem(FEATURE);
     }
 
-    /**
-     * Remove this once this extension starts supporting the native mode.
-     */
-    @BuildStep(onlyIf = NativeBuild.class)
-    @Record(value = ExecutionTime.RUNTIME_INIT)
-    void warnJvmInNative(JvmOnlyRecorder recorder) {
-        JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
-        recorder.warnJvmInNative(FEATURE); // warn at runtime
+    @BuildStep
+    void build(BuildProducer<ReflectiveClassBuildItem> reflectiveClasses,
+            BuildProducer<RuntimeInitializedClassBuildItem> 
runtimeInitializedClasses) {
+        reflectiveClasses.produce(ReflectiveClassBuildItem
+                .builder(Configuration.class, String_1.class, 
Tokenize_1.class, StringJoin.class).build());
+        
reflectiveClasses.produce(ReflectiveClassBuildItem.builder(XmlLoader.class).build());
+        
reflectiveClasses.produce(ReflectiveClassBuildItem.builder(XsltSaxonBuilder.class).build());
+
+        runtimeInitializedClasses
+                .produce(new 
RuntimeInitializedClassBuildItem("org.apache.hc.client5.http.impl.auth.NTLMEngineImpl"));
     }
 }
diff --git a/extensions-jvm/xslt-saxon/pom.xml b/extensions/xslt-saxon/pom.xml
similarity index 96%
rename from extensions-jvm/xslt-saxon/pom.xml
rename to extensions/xslt-saxon/pom.xml
index f466460f90..d405cc2ee6 100644
--- a/extensions-jvm/xslt-saxon/pom.xml
+++ b/extensions/xslt-saxon/pom.xml
@@ -21,7 +21,7 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.camel.quarkus</groupId>
-        <artifactId>camel-quarkus-extensions-jvm</artifactId>
+        <artifactId>camel-quarkus-extensions</artifactId>
         <version>3.0.0-SNAPSHOT</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
diff --git a/extensions-jvm/xslt-saxon/runtime/pom.xml 
b/extensions/xslt-saxon/runtime/pom.xml
similarity index 95%
rename from extensions-jvm/xslt-saxon/runtime/pom.xml
rename to extensions/xslt-saxon/runtime/pom.xml
index 1153b0e460..a708e601be 100644
--- a/extensions-jvm/xslt-saxon/runtime/pom.xml
+++ b/extensions/xslt-saxon/runtime/pom.xml
@@ -32,6 +32,7 @@
 
     <properties>
         <camel.quarkus.jvmSince>1.1.0</camel.quarkus.jvmSince>
+        <camel.quarkus.nativeSince>3.0.0</camel.quarkus.nativeSince>
     </properties>
 
     <dependencies>
@@ -43,6 +44,10 @@
             <groupId>org.apache.camel</groupId>
             <artifactId>camel-xslt-saxon</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.brotli</groupId>
+            <artifactId>dec</artifactId>
+        </dependency>
     </dependencies>
 
     <build>
diff --git 
a/extensions-jvm/xslt-saxon/runtime/src/main/resources/META-INF/quarkus-extension.yaml
 
b/extensions/xslt-saxon/runtime/src/main/resources/META-INF/quarkus-extension.yaml
similarity index 100%
rename from 
extensions-jvm/xslt-saxon/runtime/src/main/resources/META-INF/quarkus-extension.yaml
rename to 
extensions/xslt-saxon/runtime/src/main/resources/META-INF/quarkus-extension.yaml
diff --git a/integration-tests-jvm/pom.xml b/integration-tests-jvm/pom.xml
index f512624870..7e8c1241a8 100644
--- a/integration-tests-jvm/pom.xml
+++ b/integration-tests-jvm/pom.xml
@@ -102,7 +102,6 @@
         <module>xj</module>
         <module>xml-grouped</module>
         <module>xmpp</module>
-        <module>xslt-saxon</module>
         <module>zookeeper</module>
         <module>zookeeper-master</module>
     </modules>
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index b9fb9472df..b4f8dba44b 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -235,6 +235,7 @@
         <module>xml-grouped</module>
         <module>xmlsecurity</module>
         <module>xpath</module>
+        <module>xslt-saxon</module>
         <module>zendesk</module>
     </modules>
 
diff --git a/integration-tests-jvm/xslt-saxon/pom.xml 
b/integration-tests/xslt-saxon/pom.xml
similarity index 77%
rename from integration-tests-jvm/xslt-saxon/pom.xml
rename to integration-tests/xslt-saxon/pom.xml
index 1aa30e2160..47ac7249dc 100644
--- a/integration-tests-jvm/xslt-saxon/pom.xml
+++ b/integration-tests/xslt-saxon/pom.xml
@@ -78,6 +78,33 @@
                 </dependency>
             </dependencies>
         </profile>
+        <profile>
+            <id>native</id>
+            <activation>
+                <property>
+                    <name>native</name>
+                </property>
+            </activation>
+            <properties>
+                <quarkus.package.type>native</quarkus.package.type>
+            </properties>
+            <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>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
     </profiles>
 
 </project>
diff --git 
a/integration-tests-jvm/xslt-saxon/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonResource.java
 
b/integration-tests/xslt-saxon/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonResource.java
similarity index 100%
rename from 
integration-tests-jvm/xslt-saxon/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonResource.java
rename to 
integration-tests/xslt-saxon/src/main/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonResource.java
diff --git 
a/integration-tests-jvm/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonTest.java
 
b/integration-tests/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonIT.java
similarity index 69%
copy from 
integration-tests-jvm/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonTest.java
copy to 
integration-tests/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonIT.java
index 0443ef248e..0947e5a1f0 100644
--- 
a/integration-tests-jvm/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonTest.java
+++ 
b/integration-tests/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonIT.java
@@ -16,19 +16,9 @@
  */
 package org.apache.camel.quarkus.component.xslt.saxon.it;
 
-import io.quarkus.test.junit.QuarkusTest;
-import io.restassured.RestAssured;
-import org.junit.jupiter.api.Test;
+import io.quarkus.test.junit.QuarkusIntegrationTest;
 
-@QuarkusTest
-class XsltSaxonTest {
-
-    @Test
-    public void loadComponentXsltSaxon() {
-        /* A simple autogenerated test */
-        RestAssured.get("/xslt-saxon/load/component/xslt-saxon")
-                .then()
-                .statusCode(200);
-    }
+@QuarkusIntegrationTest
+class XsltSaxonIT extends XsltSaxonTest {
 
 }
diff --git 
a/integration-tests-jvm/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonTest.java
 
b/integration-tests/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonTest.java
similarity index 100%
rename from 
integration-tests-jvm/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonTest.java
rename to 
integration-tests/xslt-saxon/src/test/java/org/apache/camel/quarkus/component/xslt/saxon/it/XsltSaxonTest.java
diff --git a/tooling/scripts/test-categories.yaml 
b/tooling/scripts/test-categories.yaml
index 60147a9851..d5762c07b4 100644
--- a/tooling/scripts/test-categories.yaml
+++ b/tooling/scripts/test-categories.yaml
@@ -183,6 +183,7 @@ group-11:
   - univocity-parsers
   - velocity
   - xml-grouped
+  - xslt-saxon
 group-12:
   - aws2-grouped
   - csimple

Reply via email to