From a6f63e52b8fd902e822786db5c7523625fd94b5d Mon Sep 17 00:00:00 2001 From: Peter Palaga Date: Tue, 24 Sep 2024 16:08:26 +0200 Subject: [PATCH] quarkus-cxf-saaj native compilation fails when the extension is used in isolation --- .github/workflows/build.yml | 2 +- extensions/saaj/runtime/pom.xml | 4 + integration-tests/pom.xml | 1 + integration-tests/saaj/pom.xml | 122 ++++++++++++++++++ .../io/quarkiverse/saaj/it/SaajResource.java | 66 ++++++++++ .../src/main/resources/application.properties | 0 .../java/io/quarkiverse/saaj/it/SaajIT.java | 7 + .../java/io/quarkiverse/saaj/it/SaajTest.java | 29 +++++ .../saaj/src/test/resources/plaintext.xml | 24 ++++ 9 files changed, 254 insertions(+), 1 deletion(-) create mode 100644 integration-tests/saaj/pom.xml create mode 100644 integration-tests/saaj/src/main/java/io/quarkiverse/saaj/it/SaajResource.java create mode 100644 integration-tests/saaj/src/main/resources/application.properties create mode 100644 integration-tests/saaj/src/test/java/io/quarkiverse/saaj/it/SaajIT.java create mode 100644 integration-tests/saaj/src/test/java/io/quarkiverse/saaj/it/SaajTest.java create mode 100644 integration-tests/saaj/src/test/resources/plaintext.xml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 53425d557..cf16459b0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,7 +35,7 @@ jobs: strategy: fail-fast: false matrix: - testModule: ['client', 'client-server', 'fastinfoset', 'hc5', 'metrics', 'mtls', 'mtls -Djks', 'mtom', 'mtom-awt', 'opentelemetry', 'santuario-xmlsec', 'server', 'ws-rm-client', 'ws-security', 'ws-security -Djks', 'ws-security-policy', 'ws-security-policy -Djks', 'ws-trust', 'wsdl2java', 'wsdl2java-no-config'] + testModule: ['client', 'client-server', 'fastinfoset', 'hc5', 'metrics', 'mtls', 'mtls -Djks', 'mtom', 'mtom-awt', 'opentelemetry', 'saaj', 'santuario-xmlsec', 'server', 'ws-rm-client', 'ws-security', 'ws-security -Djks', 'ws-security-policy', 'ws-security-policy -Djks', 'ws-trust', 'wsdl2java', 'wsdl2java-no-config'] name: ${{matrix.testModule}} native tests needs: build-and-run-jvm-tests runs-on: ubuntu-latest diff --git a/extensions/saaj/runtime/pom.xml b/extensions/saaj/runtime/pom.xml index c3983c961..fff5149c2 100644 --- a/extensions/saaj/runtime/pom.xml +++ b/extensions/saaj/runtime/pom.xml @@ -21,6 +21,10 @@ com.sun.xml.messaging.saaj saaj-impl + + org.jvnet.mimepull + mimepull + org.graalvm.sdk nativeimage diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index f9215f094..4a27a15ea 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -28,6 +28,7 @@ mtom-awt metrics opentelemetry + saaj wsdl2java wsdl2java-no-config santuario-xmlsec diff --git a/integration-tests/saaj/pom.xml b/integration-tests/saaj/pom.xml new file mode 100644 index 000000000..5fb0c3f59 --- /dev/null +++ b/integration-tests/saaj/pom.xml @@ -0,0 +1,122 @@ + + + 4.0.0 + + io.quarkiverse.cxf + quarkus-cxf-integration-tests + 3.16.0-SNAPSHOT + ../pom.xml + + + quarkus-cxf-integration-test-saaj + + Quarkus CXF - Integration Test - SAAJ + + + + io.quarkus + quarkus-resteasy + + + io.quarkiverse.cxf + quarkus-cxf-saaj + + + + io.quarkiverse.cxf + quarkus-cxf-test-util + test + + + io.quarkus + quarkus-junit5 + test + + + io.rest-assured + rest-assured + test + + + + + + + io.quarkus + quarkus-maven-plugin + + + + build + + + + + + + + + native + + + native + + + + + + maven-surefire-plugin + + ${native.surefire.skip} + + + + maven-failsafe-plugin + + + + integration-test + verify + + + + ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + native + + + + virtualDependencies + + + !noVirtualDependencies + + + + + + io.quarkiverse.cxf + quarkus-cxf-saaj-deployment + ${project.version} + pom + test + + + * + * + + + + + + + \ No newline at end of file diff --git a/integration-tests/saaj/src/main/java/io/quarkiverse/saaj/it/SaajResource.java b/integration-tests/saaj/src/main/java/io/quarkiverse/saaj/it/SaajResource.java new file mode 100644 index 000000000..e636b4a50 --- /dev/null +++ b/integration-tests/saaj/src/main/java/io/quarkiverse/saaj/it/SaajResource.java @@ -0,0 +1,66 @@ +/* +* 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 io.quarkiverse.saaj.it; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.CertificateException; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.ws.rs.POST; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.PathParam; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; +import jakarta.xml.soap.MessageFactory; +import jakarta.xml.soap.SOAPBody; +import jakarta.xml.soap.SOAPElement; +import jakarta.xml.soap.SOAPEnvelope; +import jakarta.xml.soap.SOAPMessage; +import jakarta.xml.soap.SOAPPart; + +@Path("/saaj") +@ApplicationScoped +public class SaajResource { + + public SaajResource() throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { + } + + @POST + @Produces(MediaType.TEXT_XML) + @Path("/hello/{person}") + public byte[] hello(@PathParam("person") String person) throws Exception { + MessageFactory messageFactory = MessageFactory.newInstance(); + SOAPMessage soapMessage = messageFactory.createMessage(); + SOAPPart soapPart = soapMessage.getSOAPPart(); + + // Creating envelope and adding content + SOAPEnvelope envelope = soapPart.getEnvelope(); + envelope.addNamespaceDeclaration("hello", "http://saaj.quarkiverse.io/hello"); + + SOAPBody soapBody = envelope.getBody(); + SOAPElement soapBodyElem = soapBody.addChildElement("hello", "hello"); + soapBodyElem.addChildElement("person").addTextNode(person); + soapMessage.saveChanges(); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + soapMessage.writeTo(out); + return out.toByteArray(); + } + +} diff --git a/integration-tests/saaj/src/main/resources/application.properties b/integration-tests/saaj/src/main/resources/application.properties new file mode 100644 index 000000000..e69de29bb diff --git a/integration-tests/saaj/src/test/java/io/quarkiverse/saaj/it/SaajIT.java b/integration-tests/saaj/src/test/java/io/quarkiverse/saaj/it/SaajIT.java new file mode 100644 index 000000000..6e7b9cbdb --- /dev/null +++ b/integration-tests/saaj/src/test/java/io/quarkiverse/saaj/it/SaajIT.java @@ -0,0 +1,7 @@ +package io.quarkiverse.saaj.it; + +import io.quarkus.test.junit.QuarkusIntegrationTest; + +@QuarkusIntegrationTest +public class SaajIT extends SaajTest { +} diff --git a/integration-tests/saaj/src/test/java/io/quarkiverse/saaj/it/SaajTest.java b/integration-tests/saaj/src/test/java/io/quarkiverse/saaj/it/SaajTest.java new file mode 100644 index 000000000..dfe1a4260 --- /dev/null +++ b/integration-tests/saaj/src/test/java/io/quarkiverse/saaj/it/SaajTest.java @@ -0,0 +1,29 @@ +package io.quarkiverse.saaj.it; + +import static io.quarkiverse.cxf.test.QuarkusCxfClientTestUtil.anyNs; +import static io.restassured.RestAssured.given; + +import org.hamcrest.CoreMatchers; +import org.hamcrest.Matchers; +import org.junit.jupiter.api.Test; + +import io.quarkus.test.junit.QuarkusTest; + +@QuarkusTest +public class SaajTest { + + @Test + public void ping() { + given() + .when() + .post("/saaj/hello/Joe") + .then() + .statusCode(200) + .body( + Matchers.hasXPath( + anyNs("Envelope", "Body", "hello", "person") + + "/text()", + CoreMatchers.is("Joe"))); + } + +} diff --git a/integration-tests/saaj/src/test/resources/plaintext.xml b/integration-tests/saaj/src/test/resources/plaintext.xml new file mode 100644 index 000000000..26907987c --- /dev/null +++ b/integration-tests/saaj/src/test/resources/plaintext.xml @@ -0,0 +1,24 @@ + + + + + spade + + + shovel + + + + Dig PLC, 1 First Ave, Dublin 1, Ireland + + + + Dig PLC, 1 First Ave, Dublin 1, Ireland + + + Foo B Baz + 1234 567890 12345 + + + +