This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch 2.13.x in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 75a101c76d704b3bdb4ea7c119e3ee91b5777ead Author: JiriOndrusek <[email protected]> AuthorDate: Mon Oct 17 14:02:59 2022 +0200 Cxf-soap tests: Refactor and split --- .../cxf/soap/deployment/CxfSoapProcessor.java | 6 + .../cxf-soap/cxf-soap-client/README.adoc | 28 +++ .../cxf-soap/cxf-soap-client}/pom.xml | 61 ++--- .../cxf/soap/client}/it/CxfSoapResource.java | 48 ++-- .../cxf/soap/client/it/CxfSoapRoutes.java | 73 ++++++ .../src/main/resources/application.properties | 3 - .../src/main/resources/wsdl/CalculatorService.wsdl | 248 +++++++++++++++++++++ .../cxf/soap/client/it/CxfClientTestResource.java | 65 ++++++ .../cxf/soap/client}/it/CxfSoapClientIT.java | 2 +- .../cxf/soap/client/it/CxfSoapClientTest.java | 95 ++++++++ .../cxf-soap/cxf-soap-server}/pom.xml | 36 +-- .../com/helloworld/service/CodeFirstService.java | 0 .../cxf/soap/server}/it/CxfSoapRoutes.java | 75 +------ .../src/main/resources/application.properties | 3 - .../src/main/resources/wsdl/HelloService.wsdl | 106 +++++++++ .../cxf/soap/server}/it/CxfSoapServiceIT.java | 2 +- .../cxf/soap/server}/it/CxfSoapServiceTest.java | 6 +- .../cxf-soap/cxf-soap-ws-security/README.adoc | 28 +++ .../cxf-soap/cxf-soap-ws-security}/pom.xml | 57 ++--- .../cxf/soap/security/it/CxfSoapResource.java | 54 +++++ .../cxf/soap/security}/it/CxfSoapRoutes.java | 75 ++----- .../cxf/soap/security}/it/PasswordCallback.java | 6 +- .../src/main/resources/application.properties | 3 - .../main/resources/wsdl/WssCalculatorService.wsdl | 75 +++++++ .../soap/security/it/CxfClientTestResource.java | 76 +++++++ .../cxf/soap/security/it/CxfSoapClientIT.java | 17 +- .../cxf/soap/security/it/CxfSoapClientTest.java | 85 +++++++ integration-test-groups/{ => cxf-soap}/pom.xml | 18 +- integration-test-groups/pom.xml | 1 + integration-tests/cxf-soap-grouped/README.adoc | 4 + .../{cxf-soap => cxf-soap-grouped}/pom.xml | 176 ++++++++++----- .../src/main/resources/wsdl/HelloService.wsdl | 113 ---------- .../component/cxf/soap/it/CxfSoapClientTest.java | 61 ----- .../resources/__files/simpleHelloWorldResponse.xml | 8 - .../test/resources/__files/soapObjectResponse.xml | 12 - .../test/resources/__files/wsSecurityResponse.xml | 8 - .../test/resources/mappings/simpleHelloWorld.json | 27 --- .../src/test/resources/mappings/soapObject.json | 29 --- .../src/test/resources/mappings/wsSecurity.json | 59 ----- integration-tests/pom.xml | 2 +- pom.xml | 6 + tooling/scripts/test-categories.yaml | 2 +- 42 files changed, 1198 insertions(+), 661 deletions(-) diff --git a/extensions/cxf-soap/deployment/src/main/java/org/apache/camel/quarkus/component/cxf/soap/deployment/CxfSoapProcessor.java b/extensions/cxf-soap/deployment/src/main/java/org/apache/camel/quarkus/component/cxf/soap/deployment/CxfSoapProcessor.java index bdf56e76ac..17f76a9365 100644 --- a/extensions/cxf-soap/deployment/src/main/java/org/apache/camel/quarkus/component/cxf/soap/deployment/CxfSoapProcessor.java +++ b/extensions/cxf-soap/deployment/src/main/java/org/apache/camel/quarkus/component/cxf/soap/deployment/CxfSoapProcessor.java @@ -23,6 +23,7 @@ import io.quarkus.deployment.annotations.BuildProducer; import io.quarkus.deployment.annotations.BuildStep; import io.quarkus.deployment.builditem.CombinedIndexBuildItem; import io.quarkus.deployment.builditem.FeatureBuildItem; +import io.quarkus.deployment.builditem.SystemPropertyBuildItem; import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem; import org.jboss.jandex.DotName; import org.jboss.jandex.IndexView; @@ -36,6 +37,11 @@ class CxfSoapProcessor { return new FeatureBuildItem(FEATURE); } + @BuildStep + SystemPropertyBuildItem ehcacheAgentSizeOfBypass() { + return new SystemPropertyBuildItem("org.ehcache.sizeof.AgentSizeOf.bypass", "true"); + } + @BuildStep void registerForReflection(BuildProducer<ReflectiveClassBuildItem> reflectiveClass, CombinedIndexBuildItem combinedIndex) { diff --git a/integration-test-groups/cxf-soap/cxf-soap-client/README.adoc b/integration-test-groups/cxf-soap/cxf-soap-client/README.adoc new file mode 100644 index 0000000000..c135ccd5da --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-client/README.adoc @@ -0,0 +1,28 @@ += Quarkus CXF client tests + +These are pure client tests - i.e. there are intentionally no services implemented in the test application. +All clients access services running in containers. + +== Maintenenance notes + +=== `CalculatorService.wsdl` + +`src/main/resources/wsdl/CalculatorService.wsdl` is a static copy of the WSDL served by the testing container. +It would be too complicated to start the container before running the plugin, so we rather keep the static copy. + +There is `org.apache.camel.quarkus.component.cxf.soap.it.CxfSoapClientTest.wsdlUpToDate()` to ensure that it is up to date. + +To update `CalculatorService.wsdl` manually, first start the container + +[shource,shell] +---- +$ docker pull quay.io/l2x6/calculator-ws:1.0 +$ docker run -p 8080:8080 quay.io/l2x6/calculator-ws:1.0 +---- + +And then overwrite the existing file with the new content from the container: + +[shource,shell] +---- +curl "http://localhost:8080/calculator-ws/CalculatorService?wsdl" --output src/main/resources/wsdl/CalculatorService.wsdl +---- diff --git a/integration-tests/cxf-soap/pom.xml b/integration-test-groups/cxf-soap/cxf-soap-client/pom.xml similarity index 81% copy from integration-tests/cxf-soap/pom.xml copy to integration-test-groups/cxf-soap/cxf-soap-client/pom.xml index a894500544..782f47c177 100644 --- a/integration-tests/cxf-soap/pom.xml +++ b/integration-test-groups/cxf-soap/cxf-soap-client/pom.xml @@ -23,47 +23,32 @@ <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-build-parent-it</artifactId> <version>2.13.1-SNAPSHOT</version> - <relativePath>../../poms/build-parent-it/pom.xml</relativePath> + <relativePath>../../../poms/build-parent-it/pom.xml</relativePath> </parent> - <artifactId>camel-quarkus-integration-test-cxf-soap</artifactId> - <name>Camel Quarkus :: Integration Tests :: CXF</name> - <description>Integration tests for Camel Quarkus CXF extension</description> + <artifactId>camel-quarkus-integration-test-cxf-soap-client</artifactId> + <name>Camel Quarkus :: Integration Tests :: Cxf Soap Client</name> + <description>Integration tests for Camel Quarkus CXF extension client part</description> <build> <plugins> <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> - <version>${cxf.version}</version> <executions> <execution> - <id>generate-sources</id> - <phase>generate-sources</phase> + <goals> + <goal>wsdl2java</goal> + </goals> <configuration> - <sourceRoot>${project.build.directory}/generated-sources</sourceRoot> <wsdlOptions> <wsdlOption> - <wsdl>${basedir}/src/main/resources/wsdl/HelloService.wsdl</wsdl> - <wsdlLocation>classpath:wsdl/HelloService.wsdl</wsdlLocation> - <extraargs> - <extraarg>-xjc-Xts</extraarg> - </extraargs> + <wsdl>${basedir}/src/main/resources/wsdl/CalculatorService.wsdl</wsdl> </wsdlOption> </wsdlOptions> </configuration> - <goals> - <goal>wsdl2java</goal> - </goals> </execution> </executions> - <dependencies> - <dependency> - <groupId>org.apache.cxf.xjcplugins</groupId> - <artifactId>cxf-xjc-ts</artifactId> - <version>${cxf.xjc-utils.version}</version> - </dependency> - </dependencies> </plugin> </plugins> </build> @@ -73,10 +58,6 @@ <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-cxf-soap</artifactId> </dependency> - <dependency> - <groupId>io.quarkiverse.cxf</groupId> - <artifactId>quarkus-cxf-rt-ws-security</artifactId> - </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-resteasy</artifactId> @@ -108,8 +89,19 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-integration-wiremock-support</artifactId> + <groupId>org.testcontainers</groupId> + <artifactId>testcontainers</artifactId> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-junit4-mock</artifactId> <scope>test</scope> </dependency> </dependencies> @@ -179,6 +171,17 @@ </dependency> </dependencies> </profile> + <profile> + <id>skip-testcontainers-tests</id> + <activation> + <property> + <name>skip-testcontainers-tests</name> + </property> + </activation> + <properties> + <skipTests>true</skipTests> + </properties> + </profile> </profiles> </project> diff --git a/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapResource.java b/integration-test-groups/cxf-soap/cxf-soap-client/src/main/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapResource.java similarity index 53% rename from integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapResource.java rename to integration-test-groups/cxf-soap/cxf-soap-client/src/main/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapResource.java index 5a01690eff..889e9ef3c9 100644 --- a/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapResource.java +++ b/integration-test-groups/cxf-soap/cxf-soap-client/src/main/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapResource.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.quarkus.component.cxf.soap.it; +package org.apache.camel.quarkus.component.cxf.soap.client.it; import java.net.URI; @@ -23,62 +23,50 @@ import javax.inject.Inject; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; -import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -import com.helloworld.service.PersonRequestType; -import com.helloworld.service.PersonResponseType; -import org.apache.camel.CamelContext; import org.apache.camel.ProducerTemplate; -import org.jboss.logging.Logger; +import org.jboss.eap.quickstarts.wscalculator.calculator.Operands; +import org.jboss.eap.quickstarts.wscalculator.calculator.Result; @Path("/cxf-soap") @ApplicationScoped public class CxfSoapResource { - private static final Logger LOG = Logger.getLogger(CxfSoapResource.class); - - private static final String COMPONENT_CXF = "cxf"; - @Inject - CamelContext context; - @Inject ProducerTemplate producerTemplate; - @Path("/simple/{endpoint}") + @Path("/simple") @POST - @Consumes(MediaType.TEXT_PLAIN) + @Consumes(MediaType.WILDCARD) @Produces(MediaType.TEXT_PLAIN) - public Response sendSimpleRequest(@PathParam("endpoint") String endpoint, String body) throws Exception { - //LOG.infof("Sending to cxf: %s", "CamelQuarkusCXF"); - final String response = producerTemplate.requestBody("direct:" + endpoint, body, String.class); - //LOG.infof("Got response from cxf: %s", response); + public Response sendSimpleRequest(@QueryParam("a") int a, + @QueryParam("b") int b) throws Exception { + final String response = producerTemplate.requestBody("direct:simple", new int[] { a, b }, String.class); return Response .created(new URI("https://camel.apache.org/")) .entity(response) .build(); } - @Path("/person/{endpoint}") + @Path("/operandsAdd") @POST @Consumes(MediaType.WILDCARD) - @Produces(MediaType.WILDCARD) - public Response person(@PathParam("endpoint") String endpoint, @QueryParam("lastName") String lastName, - @QueryParam("firstName") String firstName) + @Produces(MediaType.TEXT_PLAIN) + public Response operands(@QueryParam("a") int a, + @QueryParam("b") int b) throws Exception { - PersonRequestType personRequestType = new PersonRequestType(); - personRequestType.setFirstName(firstName); - personRequestType.setLastName(lastName); - //LOG.infof("Sending to cxf: %s", personRequestType); - final PersonResponseType response = producerTemplate.requestBody("direct:" + endpoint, personRequestType, - PersonResponseType.class); - //LOG.infof("Got response from cxf: %s", response); + Operands operands = new Operands(); + operands.setA(a); + operands.setB(b); + final Result response = producerTemplate.requestBody("direct:operandsAdd", operands, + Result.class); return Response .created(new URI("https://camel.apache.org/")) - .entity(response.toString()) + .entity(response.getResult()) .build(); } diff --git a/integration-test-groups/cxf-soap/cxf-soap-client/src/main/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapRoutes.java b/integration-test-groups/cxf-soap/cxf-soap-client/src/main/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapRoutes.java new file mode 100644 index 0000000000..80c82293dd --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-client/src/main/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapRoutes.java @@ -0,0 +1,73 @@ +/* + * 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.cxf.soap.client.it; + +import javax.enterprise.context.ApplicationScoped; +import javax.enterprise.inject.Produces; +import javax.inject.Inject; +import javax.inject.Named; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.cxf.common.message.CxfConstants; +import org.apache.camel.component.cxf.jaxws.CxfEndpoint; +import org.apache.cxf.ext.logging.LoggingFeature; +import org.eclipse.microprofile.config.inject.ConfigProperty; +import org.jboss.eap.quickstarts.wscalculator.calculator.CalculatorService; + +@ApplicationScoped +public class CxfSoapRoutes extends RouteBuilder { + + @Inject + @Named("loggingFeatureClient") + LoggingFeature loggingFeature; + + @ConfigProperty(name = "camel-quarkus.it.calculator.baseUri") + String serviceBaseUri; + + @Override + public void configure() { + + from("direct:simple") + .to("cxf:bean:soapClientEndpoint?dataFormat=PAYLOAD"); + + from("direct:operandsAdd") + .setHeader(CxfConstants.OPERATION_NAME).constant("addOperands") + .to("cxf:bean:soapClientEndpoint?dataFormat=POJO"); + } + + @Produces + @ApplicationScoped + @Named("loggingFeatureClient") + public LoggingFeature loggingFeature() { + final LoggingFeature result = new LoggingFeature(); + result.setPrettyLogging(true); + return result; + } + + @Produces + @ApplicationScoped + @Named + CxfEndpoint soapClientEndpoint() { + final CxfEndpoint result = new CxfEndpoint(); + result.setServiceClass(CalculatorService.class); + result.setAddress(serviceBaseUri + "/calculator-ws/CalculatorService"); + result.setWsdlURL("wsdl/CalculatorService.wsdl"); + result.getFeatures().add(loggingFeature); + return result; + } + +} diff --git a/integration-tests/cxf-soap/src/main/resources/application.properties b/integration-test-groups/cxf-soap/cxf-soap-client/src/main/resources/application.properties similarity index 93% copy from integration-tests/cxf-soap/src/main/resources/application.properties copy to integration-test-groups/cxf-soap/cxf-soap-client/src/main/resources/application.properties index efc3dcbba6..574727024a 100644 --- a/integration-tests/cxf-soap/src/main/resources/application.properties +++ b/integration-test-groups/cxf-soap/cxf-soap-client/src/main/resources/application.properties @@ -15,8 +15,5 @@ ## limitations under the License. ## --------------------------------------------------------------------------- -password-callback.username=camel -password-callback.password=quarkus - quarkus.cxf.path=/soapservice quarkus.native.resources.includes = wsdl/*.wsdl diff --git a/integration-test-groups/cxf-soap/cxf-soap-client/src/main/resources/wsdl/CalculatorService.wsdl b/integration-test-groups/cxf-soap/cxf-soap-client/src/main/resources/wsdl/CalculatorService.wsdl new file mode 100644 index 0000000000..2b0be31507 --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-client/src/main/resources/wsdl/CalculatorService.wsdl @@ -0,0 +1,248 @@ +<?xml version="1.0" ?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.jboss.org/eap/quickstarts/wscalculator/Calculator" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="CalculatorService" targetNamespace="http://www.jboss.org/eap/quickstarts/wscalculator/Calculator"> +<!-- + + 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. + +--> + <wsdl:types> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.jboss.org/eap/quickstarts/wscalculator/Calculator" elementFormDefault="unqualified" targetNamespace="http://www.jboss.org/eap/quickstarts/wscalculator/Calculator" version="1.0"> + + <xs:element name="add" type="tns:add"></xs:element> + + <xs:element name="addOperands" type="tns:addOperands"></xs:element> + + <xs:element name="addOperandsResponse" type="tns:addOperandsResponse"></xs:element> + + <xs:element name="addResponse" type="tns:addResponse"></xs:element> + + <xs:element name="divide" type="tns:divide"></xs:element> + + <xs:element name="divideResponse" type="tns:divideResponse"></xs:element> + + <xs:element name="multiply" type="tns:multiply"></xs:element> + + <xs:element name="multiplyResponse" type="tns:multiplyResponse"></xs:element> + + <xs:element name="subtract" type="tns:subtract"></xs:element> + + <xs:element name="subtractResponse" type="tns:subtractResponse"></xs:element> + + <xs:complexType name="divide"> + <xs:sequence> + <xs:element name="arg0" type="xs:int"></xs:element> + <xs:element name="arg1" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="divideResponse"> + <xs:sequence> + <xs:element name="return" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="add"> + <xs:sequence> + <xs:element name="arg0" type="xs:int"></xs:element> + <xs:element name="arg1" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="addResponse"> + <xs:sequence> + <xs:element name="return" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="subtract"> + <xs:sequence> + <xs:element name="arg0" type="xs:int"></xs:element> + <xs:element name="arg1" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="subtractResponse"> + <xs:sequence> + <xs:element name="return" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="addOperands"> + <xs:sequence> + <xs:element minOccurs="0" name="arg0" type="tns:operands"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="operands"> + <xs:sequence> + <xs:element name="a" type="xs:int"></xs:element> + <xs:element name="b" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="addOperandsResponse"> + <xs:sequence> + <xs:element minOccurs="0" name="return" type="tns:result"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="result"> + <xs:sequence> + <xs:element minOccurs="0" name="operands" type="tns:operands"></xs:element> + <xs:element name="result" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="multiply"> + <xs:sequence> + <xs:element name="arg0" type="xs:int"></xs:element> + <xs:element name="arg1" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="multiplyResponse"> + <xs:sequence> + <xs:element name="return" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + +</xs:schema> + </wsdl:types> + <wsdl:message name="add"> + <wsdl:part element="tns:add" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="subtract"> + <wsdl:part element="tns:subtract" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="subtractResponse"> + <wsdl:part element="tns:subtractResponse" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="addResponse"> + <wsdl:part element="tns:addResponse" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="multiplyResponse"> + <wsdl:part element="tns:multiplyResponse" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="divideResponse"> + <wsdl:part element="tns:divideResponse" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="divide"> + <wsdl:part element="tns:divide" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="addOperandsResponse"> + <wsdl:part element="tns:addOperandsResponse" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="addOperands"> + <wsdl:part element="tns:addOperands" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="multiply"> + <wsdl:part element="tns:multiply" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:portType name="CalculatorService"> + <wsdl:operation name="divide"> + <wsdl:input message="tns:divide" name="divide"> + </wsdl:input> + <wsdl:output message="tns:divideResponse" name="divideResponse"> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="add"> + <wsdl:input message="tns:add" name="add"> + </wsdl:input> + <wsdl:output message="tns:addResponse" name="addResponse"> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="subtract"> + <wsdl:input message="tns:subtract" name="subtract"> + </wsdl:input> + <wsdl:output message="tns:subtractResponse" name="subtractResponse"> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="addOperands"> + <wsdl:input message="tns:addOperands" name="addOperands"> + </wsdl:input> + <wsdl:output message="tns:addOperandsResponse" name="addOperandsResponse"> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="multiply"> + <wsdl:input message="tns:multiply" name="multiply"> + </wsdl:input> + <wsdl:output message="tns:multiplyResponse" name="multiplyResponse"> + </wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="CalculatorServiceSoapBinding" type="tns:CalculatorService"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding> + <wsdl:operation name="divide"> + <soap:operation soapAction="" style="document"></soap:operation> + <wsdl:input name="divide"> + <soap:body use="literal"></soap:body> + </wsdl:input> + <wsdl:output name="divideResponse"> + <soap:body use="literal"></soap:body> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="add"> + <soap:operation soapAction="" style="document"></soap:operation> + <wsdl:input name="add"> + <soap:body use="literal"></soap:body> + </wsdl:input> + <wsdl:output name="addResponse"> + <soap:body use="literal"></soap:body> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="subtract"> + <soap:operation soapAction="" style="document"></soap:operation> + <wsdl:input name="subtract"> + <soap:body use="literal"></soap:body> + </wsdl:input> + <wsdl:output name="subtractResponse"> + <soap:body use="literal"></soap:body> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="addOperands"> + <soap:operation soapAction="" style="document"></soap:operation> + <wsdl:input name="addOperands"> + <soap:body use="literal"></soap:body> + </wsdl:input> + <wsdl:output name="addOperandsResponse"> + <soap:body use="literal"></soap:body> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="multiply"> + <soap:operation soapAction="" style="document"></soap:operation> + <wsdl:input name="multiply"> + <soap:body use="literal"></soap:body> + </wsdl:input> + <wsdl:output name="multiplyResponse"> + <soap:body use="literal"></soap:body> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="CalculatorService"> + <wsdl:port binding="tns:CalculatorServiceSoapBinding" name="Calculator"> + <soap:address location="http://172.17.0.4:8080/calculator-ws/CalculatorService"></soap:address> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> \ No newline at end of file diff --git a/integration-test-groups/cxf-soap/cxf-soap-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfClientTestResource.java b/integration-test-groups/cxf-soap/cxf-soap-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfClientTestResource.java new file mode 100644 index 0000000000..d12d2c30ca --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfClientTestResource.java @@ -0,0 +1,65 @@ +/* + * 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.cxf.soap.client.it; + +import java.util.Map; + +import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.output.Slf4jLogConsumer; +import org.testcontainers.containers.wait.strategy.Wait; + +public class CxfClientTestResource implements QuarkusTestResourceLifecycleManager { + private static final Logger log = LoggerFactory.getLogger(CxfClientTestResource.class); + + private static final int WILDFLY_PORT = 8080; + private GenericContainer<?> calculatorContainer; + + @Override + public Map<String, String> start() { + + try { + calculatorContainer = new GenericContainer<>("quay.io/l2x6/calculator-ws:1.0") + .withExposedPorts(WILDFLY_PORT) + .withLogConsumer(new Slf4jLogConsumer(log)) + .waitingFor(Wait.forHttp("/calculator-ws/CalculatorService?wsdl")); + + calculatorContainer.start(); + + return Map.of( + "camel-quarkus.it.calculator.baseUri", + "http://" + calculatorContainer.getHost() + ":" + + calculatorContainer.getMappedPort(WILDFLY_PORT)); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Override + public void stop() { + try { + if (calculatorContainer != null) { + calculatorContainer.stop(); + } + } catch (Exception e) { + // ignored + } + } +} diff --git a/integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapClientIT.java b/integration-test-groups/cxf-soap/cxf-soap-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapClientIT.java similarity index 93% rename from integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapClientIT.java rename to integration-test-groups/cxf-soap/cxf-soap-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapClientIT.java index da87d1e0ee..d79e966bd9 100644 --- a/integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapClientIT.java +++ b/integration-test-groups/cxf-soap/cxf-soap-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapClientIT.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.quarkus.component.cxf.soap.it; +package org.apache.camel.quarkus.component.cxf.soap.client.it; import io.quarkus.test.junit.QuarkusIntegrationTest; diff --git a/integration-test-groups/cxf-soap/cxf-soap-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapClientTest.java b/integration-test-groups/cxf-soap/cxf-soap-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapClientTest.java new file mode 100644 index 0000000000..a1dc64d84a --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapClientTest.java @@ -0,0 +1,95 @@ +/* + * 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.cxf.soap.client.it; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import org.eclipse.microprofile.config.ConfigProvider; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; + +@QuarkusTest +@QuarkusTestResource(CxfClientTestResource.class) +class CxfSoapClientTest { + + @Test + public void simpleSoapClient() { + //first operation is "divide" + RestAssured.given() + .queryParam("a", "9") + .queryParam("b", "3") + .post("/cxf-soap/simple") + .then() + .statusCode(201) + .body(equalTo("3")); + } + + @Test + public void complexSoapClient() { + RestAssured.given() + .queryParam("a", "3") + .queryParam("b", "4") + .post("/cxf-soap/operandsAdd") + .then() + .statusCode(201) + .body(equalTo("7")); + } + + /** + * Make sure that our static copy is the same as the WSDL served by the container + * + * @throws IOException + */ + @Test + void wsdlUpToDate() throws IOException { + final String wsdlUrl = ConfigProvider.getConfig() + .getValue("camel-quarkus.it.calculator.baseUri", String.class); + + final String staticCopyPath = "target/classes/wsdl/CalculatorService.wsdl"; + /* The changing Docker IP address in the WSDL should not matter */ + final String sanitizerRegex = "<soap:address location=\"http://[^/]*/calculator-ws/CalculatorService\"></soap:address>"; + final String staticCopyContent = Files + .readString(Paths.get(staticCopyPath), StandardCharsets.UTF_8) + .replaceAll(sanitizerRegex, "") + //remove a comment with license + .replaceAll("<!--[.\\s\\S]*?-->", "\n") + //remove all whitesaces to ignore formatting changes + .replaceAll("\\s", ""); + + final String expected = RestAssured.given() + .get(wsdlUrl + "/calculator-ws/CalculatorService?wsdl") + .then() + .statusCode(200) + .extract().body().asString(); + + if (!expected.replaceAll(sanitizerRegex, "").replaceAll("\\s", "").equals(staticCopyContent)) { + Files.writeString(Paths.get(staticCopyPath), expected, StandardCharsets.UTF_8); + Assertions.fail("The static WSDL copy in " + staticCopyPath + + " went out of sync with the WSDL served by the container. The content was updated by the test, you just need to review and commit the changes."); + } + + } +} diff --git a/integration-tests/cxf-soap/pom.xml b/integration-test-groups/cxf-soap/cxf-soap-server/pom.xml similarity index 81% copy from integration-tests/cxf-soap/pom.xml copy to integration-test-groups/cxf-soap/cxf-soap-server/pom.xml index a894500544..48c995e08b 100644 --- a/integration-tests/cxf-soap/pom.xml +++ b/integration-test-groups/cxf-soap/cxf-soap-server/pom.xml @@ -23,19 +23,18 @@ <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-build-parent-it</artifactId> <version>2.13.1-SNAPSHOT</version> - <relativePath>../../poms/build-parent-it/pom.xml</relativePath> + <relativePath>../../../poms/build-parent-it/pom.xml</relativePath> </parent> - <artifactId>camel-quarkus-integration-test-cxf-soap</artifactId> - <name>Camel Quarkus :: Integration Tests :: CXF</name> - <description>Integration tests for Camel Quarkus CXF extension</description> + <artifactId>camel-quarkus-integration-test-cxf-soap-server</artifactId> + <name>Camel Quarkus :: Integration Tests :: Cxf Soap Server</name> + <description>Integration tests for Camel Quarkus CXF extension server part</description> <build> <plugins> <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> - <version>${cxf.version}</version> <executions> <execution> <id>generate-sources</id> @@ -73,20 +72,11 @@ <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-cxf-soap</artifactId> </dependency> - <dependency> - <groupId>io.quarkiverse.cxf</groupId> - <artifactId>quarkus-cxf-rt-ws-security</artifactId> - </dependency> <dependency> <groupId>io.quarkus</groupId> <artifactId>quarkus-resteasy</artifactId> </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-direct</artifactId> - </dependency> - <dependency> <groupId>org.apache.cxf.xjc-utils</groupId> <artifactId>cxf-xjc-runtime</artifactId> @@ -107,11 +97,6 @@ <artifactId>rest-assured</artifactId> <scope>test</scope> </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-integration-wiremock-support</artifactId> - <scope>test</scope> - </dependency> </dependencies> <profiles> @@ -164,19 +149,6 @@ </exclusion> </exclusions> </dependency> - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-direct-deployment</artifactId> - <version>${project.version}</version> - <type>pom</type> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>*</groupId> - <artifactId>*</artifactId> - </exclusion> - </exclusions> - </dependency> </dependencies> </profile> </profiles> diff --git a/integration-tests/cxf-soap/src/main/java/com/helloworld/service/CodeFirstService.java b/integration-test-groups/cxf-soap/cxf-soap-server/src/main/java/com/helloworld/service/CodeFirstService.java similarity index 100% rename from integration-tests/cxf-soap/src/main/java/com/helloworld/service/CodeFirstService.java rename to integration-test-groups/cxf-soap/cxf-soap-server/src/main/java/com/helloworld/service/CodeFirstService.java diff --git a/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapRoutes.java b/integration-test-groups/cxf-soap/cxf-soap-server/src/main/java/org/apache/camel/quarkus/component/cxf/soap/server/it/CxfSoapRoutes.java similarity index 50% copy from integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapRoutes.java copy to integration-test-groups/cxf-soap/cxf-soap-server/src/main/java/org/apache/camel/quarkus/component/cxf/soap/server/it/CxfSoapRoutes.java index 7ece4e148c..f68cc39d62 100644 --- a/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapRoutes.java +++ b/integration-test-groups/cxf-soap/cxf-soap-server/src/main/java/org/apache/camel/quarkus/component/cxf/soap/server/it/CxfSoapRoutes.java @@ -14,10 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.quarkus.component.cxf.soap.it; - -import java.util.HashMap; -import java.util.Map; +package org.apache.camel.quarkus.component.cxf.soap.server.it; import javax.enterprise.context.ApplicationScoped; import javax.enterprise.inject.Produces; @@ -27,45 +24,18 @@ import javax.inject.Named; import com.helloworld.service.CodeFirstService; import com.helloworld.service.HelloPortType; import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.cxf.common.message.CxfConstants; import org.apache.camel.component.cxf.jaxws.CxfEndpoint; import org.apache.cxf.ext.logging.LoggingFeature; -import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; -import org.apache.wss4j.common.ConfigurationConstants; -import org.eclipse.microprofile.config.inject.ConfigProperty; @ApplicationScoped public class CxfSoapRoutes extends RouteBuilder { @Inject - @Named("passwordCallback") - PasswordCallback passwordCallback; - - @Inject - @Named("loggingFeature") + @Named("loggingFeatureServer") LoggingFeature loggingFeature; - @Inject - @Named("wssInterceptor") - WSS4JOutInterceptor wssInterceptor; - - @ConfigProperty(name = "wiremock.url") - String serviceBaseUri; - @Override public void configure() { - - /* Client */ - from("direct:simpleSoapClient") - .to("cxf:bean:soapClientEndpoint?dataFormat=POJO"); - - from("direct:wsSecurityClient") - .to("cxf:bean:secureEndpoint?dataFormat=POJO"); - - from("direct:complexSoapClient") - .setHeader(CxfConstants.OPERATION_NAME).constant("Person") - .to("cxf:bean:soapClientEndpoint?dataFormat=POJO"); - /* Service */ from("cxf:bean:soapServiceEndpoint") .setBody().simple("Hello ${body} from CXF service"); @@ -76,52 +46,13 @@ public class CxfSoapRoutes extends RouteBuilder { @Produces @ApplicationScoped - @Named - WSS4JOutInterceptor wssInterceptor() { - final Map<String, Object> props = new HashMap<>(); - props.put(ConfigurationConstants.ACTION, "UsernameToken"); - props.put(ConfigurationConstants.PASSWORD_TYPE, "PasswordText"); - props.put(ConfigurationConstants.USER, "camel"); - props.put("passwordCallbackRef", passwordCallback); - props.put(ConfigurationConstants.ADD_USERNAMETOKEN_NONCE, "true"); - props.put(ConfigurationConstants.ADD_USERNAMETOKEN_CREATED, "true"); - return new WSS4JOutInterceptor(props); - } - - @Produces - @ApplicationScoped - @Named + @Named("loggingFeatureServer") public LoggingFeature loggingFeature() { final LoggingFeature result = new LoggingFeature(); result.setPrettyLogging(true); return result; } - @Produces - @ApplicationScoped - @Named - CxfEndpoint secureEndpoint() { - final CxfEndpoint result = new CxfEndpoint(); - result.setServiceClass(HelloPortType.class); - result.setAddress(serviceBaseUri + "/hellowss"); - result.setWsdlURL("wsdl/HelloService.wsdl"); - result.getFeatures().add(loggingFeature); - result.getOutInterceptors().add(wssInterceptor); - return result; - } - - @Produces - @ApplicationScoped - @Named - CxfEndpoint soapClientEndpoint() { - final CxfEndpoint result = new CxfEndpoint(); - result.setServiceClass(HelloPortType.class); - result.setAddress(serviceBaseUri + "/hello"); - result.setWsdlURL("wsdl/HelloService.wsdl"); - result.getFeatures().add(loggingFeature); - return result; - } - @Produces @ApplicationScoped @Named diff --git a/integration-tests/cxf-soap/src/main/resources/application.properties b/integration-test-groups/cxf-soap/cxf-soap-server/src/main/resources/application.properties similarity index 93% copy from integration-tests/cxf-soap/src/main/resources/application.properties copy to integration-test-groups/cxf-soap/cxf-soap-server/src/main/resources/application.properties index efc3dcbba6..574727024a 100644 --- a/integration-tests/cxf-soap/src/main/resources/application.properties +++ b/integration-test-groups/cxf-soap/cxf-soap-server/src/main/resources/application.properties @@ -15,8 +15,5 @@ ## limitations under the License. ## --------------------------------------------------------------------------- -password-callback.username=camel -password-callback.password=quarkus - quarkus.cxf.path=/soapservice quarkus.native.resources.includes = wsdl/*.wsdl diff --git a/integration-test-groups/cxf-soap/cxf-soap-server/src/main/resources/wsdl/HelloService.wsdl b/integration-test-groups/cxf-soap/cxf-soap-server/src/main/resources/wsdl/HelloService.wsdl new file mode 100644 index 0000000000..feab8779b5 --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-server/src/main/resources/wsdl/HelloService.wsdl @@ -0,0 +1,106 @@ +<?xml version="1.0" ?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.helloworld.com/Service/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="HelloService" targetNamespace="http://www.helloworld.com/Service/"> +<!-- + + 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. + +--> + <wsdl:types> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.helloworld.com/Service/" targetNamespace="http://www.helloworld.com/Service/" version="1.0"> + + <xs:element name="HelloRequest" type="xs:string"></xs:element> + + <xs:element name="HelloResponse" type="xs:string"></xs:element> + + <xs:element name="PersonRequest" type="tns:PersonRequestType"></xs:element> + + <xs:element name="PersonResponse" type="tns:PersonResponseType"></xs:element> + + <xs:complexType name="PersonRequestType"> + <xs:sequence> + <xs:element name="firstName" type="xs:string"></xs:element> + <xs:element name="lastName" type="xs:string"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="PersonResponseType"> + <xs:complexContent> + <xs:extension base="tns:PersonRequestType"> + <xs:sequence> + <xs:element name="greeting" type="xs:string"></xs:element> + </xs:sequence> + </xs:extension> + </xs:complexContent> + </xs:complexType> + +</xs:schema> + </wsdl:types> + <wsdl:message name="HelloResponse"> + <wsdl:part element="tns:HelloResponse" name="helloOutputPart"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="Hello"> + <wsdl:part element="tns:HelloRequest" name="helloInputPart"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="PersonResponse"> + <wsdl:part element="tns:PersonResponse" name="personOutputPart"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="Person"> + <wsdl:part element="tns:PersonRequest" name="personInputPart"> + </wsdl:part> + </wsdl:message> + <wsdl:portType name="HelloPortType"> + <wsdl:operation name="Hello"> + <wsdl:input message="tns:Hello" name="Hello"> + </wsdl:input> + <wsdl:output message="tns:HelloResponse" name="HelloResponse"> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="Person"> + <wsdl:input message="tns:Person" name="Person"> + </wsdl:input> + <wsdl:output message="tns:PersonResponse" name="PersonResponse"> + </wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="HelloServiceSoapBinding" type="tns:HelloPortType"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding> + <wsdl:operation name="Hello"> + <soap:operation soapAction="https://www.helloworld.com/Service/Hello" style="document"></soap:operation> + <wsdl:input name="Hello"> + <soap:body use="literal"></soap:body> + </wsdl:input> + <wsdl:output name="HelloResponse"> + <soap:body use="literal"></soap:body> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="Person"> + <soap:operation soapAction="https://www.helloworld.com/Service/Person" style="document"></soap:operation> + <wsdl:input name="Person"> + <soap:body use="literal"></soap:body> + </wsdl:input> + <wsdl:output name="PersonResponse"> + <soap:body use="literal"></soap:body> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="HelloService"> + <wsdl:port binding="tns:HelloServiceSoapBinding" name="HelloPort"> + <soap:address location="http://172.17.0.3:8080/helloworld-ws/HelloService"></soap:address> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> \ No newline at end of file diff --git a/integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapServiceIT.java b/integration-test-groups/cxf-soap/cxf-soap-server/src/test/java/org/apache/camel/quarkus/component/cxf/soap/server/it/CxfSoapServiceIT.java similarity index 93% rename from integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapServiceIT.java rename to integration-test-groups/cxf-soap/cxf-soap-server/src/test/java/org/apache/camel/quarkus/component/cxf/soap/server/it/CxfSoapServiceIT.java index 82aedb472d..e14043a058 100644 --- a/integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapServiceIT.java +++ b/integration-test-groups/cxf-soap/cxf-soap-server/src/test/java/org/apache/camel/quarkus/component/cxf/soap/server/it/CxfSoapServiceIT.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.quarkus.component.cxf.soap.it; +package org.apache.camel.quarkus.component.cxf.soap.server.it; import io.quarkus.test.junit.QuarkusIntegrationTest; diff --git a/integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapServiceTest.java b/integration-test-groups/cxf-soap/cxf-soap-server/src/test/java/org/apache/camel/quarkus/component/cxf/soap/server/it/CxfSoapServiceTest.java similarity index 93% rename from integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapServiceTest.java rename to integration-test-groups/cxf-soap/cxf-soap-server/src/test/java/org/apache/camel/quarkus/component/cxf/soap/server/it/CxfSoapServiceTest.java index b886be35de..1348caa3d6 100644 --- a/integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapServiceTest.java +++ b/integration-test-groups/cxf-soap/cxf-soap-server/src/test/java/org/apache/camel/quarkus/component/cxf/soap/server/it/CxfSoapServiceTest.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.quarkus.component.cxf.soap.it; +package org.apache.camel.quarkus.component.cxf.soap.server.it; import javax.xml.ws.BindingProvider; @@ -24,9 +24,9 @@ import io.quarkus.runtime.LaunchMode; import io.quarkus.test.junit.QuarkusTest; import io.restassured.RestAssured; import io.restassured.http.ContentType; -import org.assertj.core.api.Assertions; import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.ConfigProvider; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @QuarkusTest @@ -38,7 +38,7 @@ class CxfSoapServiceTest { final HelloPortType helloPort = service.getHelloPort(); String endpointURL = getServerUrl() + "/soapservice/hello"; ((BindingProvider) helloPort).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL); - Assertions.assertThat(helloPort.hello("World")).isEqualTo("Hello World from CXF service"); + Assertions.assertEquals(helloPort.hello("World"), "Hello World from CXF service"); } private static String getServerUrl() { diff --git a/integration-test-groups/cxf-soap/cxf-soap-ws-security/README.adoc b/integration-test-groups/cxf-soap/cxf-soap-ws-security/README.adoc new file mode 100644 index 0000000000..b3dc3651dd --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security/README.adoc @@ -0,0 +1,28 @@ += Quarkus CXF ws-security tests + +These are pure client tests - i.e. there are intentionally no services implemented in the test application. +All clients access services running in containers. + +== Maintenenance notes + +=== `CalculatorService.wsdl` + +`src/main/resources/wsdl/WssCalculatorService.wsdl` is a static copy of the WSDL served by the testing container. +It would be too complicated to start the container before running the plugin, so we rather keep the static copy. + +There is `org.apache.camel.quarkus.component.cxf.soap.it.CxfSoapClientTest.wsdlUpToDate()` to ensure that it is up to date. + +To update `WssCalculatorService.wsdl` manually, first start the container + +[shource,shell] +---- +$ docker pull quay.io/l2x6/calculator-ws:1.0 +$ docker run -p 8080:8080 quay.io/l2x6/calculator-ws:1.0 +---- + +And then overwrite the existing file with the new content from the container: + +[shource,shell] +---- +curl "http://localhost:8080/calculator-ws/WssCalculatorService?wsdl" --output src/main/resources/wsdl/WssCalculatorService.wsdl +---- diff --git a/integration-tests/cxf-soap/pom.xml b/integration-test-groups/cxf-soap/cxf-soap-ws-security/pom.xml similarity index 83% copy from integration-tests/cxf-soap/pom.xml copy to integration-test-groups/cxf-soap/cxf-soap-ws-security/pom.xml index a894500544..96865ad69e 100644 --- a/integration-tests/cxf-soap/pom.xml +++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security/pom.xml @@ -23,47 +23,32 @@ <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-build-parent-it</artifactId> <version>2.13.1-SNAPSHOT</version> - <relativePath>../../poms/build-parent-it/pom.xml</relativePath> + <relativePath>../../../poms/build-parent-it/pom.xml</relativePath> </parent> - <artifactId>camel-quarkus-integration-test-cxf-soap</artifactId> - <name>Camel Quarkus :: Integration Tests :: CXF</name> - <description>Integration tests for Camel Quarkus CXF extension</description> + <artifactId>camel-quarkus-integration-test-cxf-soap-ws-security</artifactId> + <name>Camel Quarkus :: Integration Tests :: Cxf Soap Ws Security</name> + <description>Integration tests for Camel Quarkus CXF extension ws security part</description> <build> <plugins> <plugin> <groupId>org.apache.cxf</groupId> <artifactId>cxf-codegen-plugin</artifactId> - <version>${cxf.version}</version> <executions> <execution> - <id>generate-sources</id> - <phase>generate-sources</phase> + <goals> + <goal>wsdl2java</goal> + </goals> <configuration> - <sourceRoot>${project.build.directory}/generated-sources</sourceRoot> <wsdlOptions> <wsdlOption> - <wsdl>${basedir}/src/main/resources/wsdl/HelloService.wsdl</wsdl> - <wsdlLocation>classpath:wsdl/HelloService.wsdl</wsdlLocation> - <extraargs> - <extraarg>-xjc-Xts</extraarg> - </extraargs> + <wsdl>${basedir}/src/main/resources/wsdl/WssCalculatorService.wsdl</wsdl> </wsdlOption> </wsdlOptions> </configuration> - <goals> - <goal>wsdl2java</goal> - </goals> </execution> </executions> - <dependencies> - <dependency> - <groupId>org.apache.cxf.xjcplugins</groupId> - <artifactId>cxf-xjc-ts</artifactId> - <version>${cxf.xjc-utils.version}</version> - </dependency> - </dependencies> </plugin> </plugins> </build> @@ -108,8 +93,19 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-integration-wiremock-support</artifactId> + <groupId>org.testcontainers</groupId> + <artifactId>testcontainers</artifactId> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-junit4-mock</artifactId> <scope>test</scope> </dependency> </dependencies> @@ -179,6 +175,17 @@ </dependency> </dependencies> </profile> + <profile> + <id>skip-testcontainers-tests</id> + <activation> + <property> + <name>skip-testcontainers-tests</name> + </property> + </activation> + <properties> + <skipTests>true</skipTests> + </properties> + </profile> </profiles> </project> diff --git a/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfSoapResource.java b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfSoapResource.java new file mode 100644 index 0000000000..486bbf2597 --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfSoapResource.java @@ -0,0 +1,54 @@ +/* + * 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.cxf.soap.security.it; + +import java.net.URI; + +import javax.enterprise.context.ApplicationScoped; +import javax.inject.Inject; +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; + +import org.apache.camel.ProducerTemplate; + +@Path("/cxf-soap") +@ApplicationScoped +public class CxfSoapResource { + + @Inject + ProducerTemplate producerTemplate; + + @Path("/modulo") + @POST + @Consumes(MediaType.WILDCARD) + @Produces(MediaType.TEXT_PLAIN) + public Response modulo(@QueryParam("a") int a, + @QueryParam("b") int b) + throws Exception { + final String response = producerTemplate.requestBody("direct:modulo", new int[] { a, b }, + String.class); + return Response + .created(new URI("https://camel.apache.org/")) + .entity(response) + .build(); + } +} diff --git a/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapRoutes.java b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfSoapRoutes.java similarity index 54% rename from integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapRoutes.java rename to integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfSoapRoutes.java index 7ece4e148c..31212837f9 100644 --- a/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapRoutes.java +++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfSoapRoutes.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.quarkus.component.cxf.soap.it; +package org.apache.camel.quarkus.component.cxf.soap.security.it; import java.util.HashMap; import java.util.Map; @@ -24,54 +24,41 @@ import javax.enterprise.inject.Produces; import javax.inject.Inject; import javax.inject.Named; -import com.helloworld.service.CodeFirstService; -import com.helloworld.service.HelloPortType; import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.cxf.common.message.CxfConstants; import org.apache.camel.component.cxf.jaxws.CxfEndpoint; import org.apache.cxf.ext.logging.LoggingFeature; import org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor; import org.apache.wss4j.common.ConfigurationConstants; import org.eclipse.microprofile.config.inject.ConfigProperty; +import org.jboss.eap.quickstarts.wscalculator.wsscalculator.WssCalculatorService; @ApplicationScoped public class CxfSoapRoutes extends RouteBuilder { + @ConfigProperty(name = "password-callback.username") + String username; + @Inject @Named("passwordCallback") PasswordCallback passwordCallback; @Inject - @Named("loggingFeature") + @Named("loggingFeatureSecurity") LoggingFeature loggingFeature; @Inject @Named("wssInterceptor") WSS4JOutInterceptor wssInterceptor; - @ConfigProperty(name = "wiremock.url") + @ConfigProperty(name = "camel-quarkus.it.calculator.baseUri") String serviceBaseUri; @Override public void configure() { - /* Client */ - from("direct:simpleSoapClient") - .to("cxf:bean:soapClientEndpoint?dataFormat=POJO"); - - from("direct:wsSecurityClient") + from("direct:modulo") .to("cxf:bean:secureEndpoint?dataFormat=POJO"); - from("direct:complexSoapClient") - .setHeader(CxfConstants.OPERATION_NAME).constant("Person") - .to("cxf:bean:soapClientEndpoint?dataFormat=POJO"); - - /* Service */ - from("cxf:bean:soapServiceEndpoint") - .setBody().simple("Hello ${body} from CXF service"); - - from("cxf:bean:codeFirstServiceEndpoint") - .setBody().constant("Hello CamelQuarkusCXF"); } @Produces @@ -81,8 +68,8 @@ public class CxfSoapRoutes extends RouteBuilder { final Map<String, Object> props = new HashMap<>(); props.put(ConfigurationConstants.ACTION, "UsernameToken"); props.put(ConfigurationConstants.PASSWORD_TYPE, "PasswordText"); - props.put(ConfigurationConstants.USER, "camel"); - props.put("passwordCallbackRef", passwordCallback); + props.put(ConfigurationConstants.USER, username); + props.put(ConfigurationConstants.PW_CALLBACK_REF, passwordCallback); props.put(ConfigurationConstants.ADD_USERNAMETOKEN_NONCE, "true"); props.put(ConfigurationConstants.ADD_USERNAMETOKEN_CREATED, "true"); return new WSS4JOutInterceptor(props); @@ -90,7 +77,7 @@ public class CxfSoapRoutes extends RouteBuilder { @Produces @ApplicationScoped - @Named + @Named("loggingFeatureSecurity") public LoggingFeature loggingFeature() { final LoggingFeature result = new LoggingFeature(); result.setPrettyLogging(true); @@ -102,46 +89,12 @@ public class CxfSoapRoutes extends RouteBuilder { @Named CxfEndpoint secureEndpoint() { final CxfEndpoint result = new CxfEndpoint(); - result.setServiceClass(HelloPortType.class); - result.setAddress(serviceBaseUri + "/hellowss"); - result.setWsdlURL("wsdl/HelloService.wsdl"); + result.setServiceClass(WssCalculatorService.class); + result.setAddress(serviceBaseUri + "/calculator-ws/WssCalculatorService"); + result.setWsdlURL("wsdl/WssCalculatorService.wsdl"); result.getFeatures().add(loggingFeature); result.getOutInterceptors().add(wssInterceptor); - return result; - } - - @Produces - @ApplicationScoped - @Named - CxfEndpoint soapClientEndpoint() { - final CxfEndpoint result = new CxfEndpoint(); - result.setServiceClass(HelloPortType.class); - result.setAddress(serviceBaseUri + "/hello"); - result.setWsdlURL("wsdl/HelloService.wsdl"); - result.getFeatures().add(loggingFeature); - return result; - } - - @Produces - @ApplicationScoped - @Named - CxfEndpoint soapServiceEndpoint() { - final CxfEndpoint result = new CxfEndpoint(); - result.setServiceClass(HelloPortType.class); - result.setAddress("/hello"); - result.setWsdlURL("wsdl/HelloService.wsdl"); - result.getFeatures().add(loggingFeature); - return result; - } - @Produces - @ApplicationScoped - @Named - CxfEndpoint codeFirstServiceEndpoint() { - final CxfEndpoint result = new CxfEndpoint(); - result.setServiceClass(CodeFirstService.class); - result.setAddress("/codefirst"); - result.getFeatures().add(loggingFeature); return result; } } diff --git a/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/PasswordCallback.java b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/java/org/apache/camel/quarkus/component/cxf/soap/security/it/PasswordCallback.java similarity index 90% rename from integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/PasswordCallback.java rename to integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/java/org/apache/camel/quarkus/component/cxf/soap/security/it/PasswordCallback.java index 99e86f65c1..b80c027b0c 100644 --- a/integration-tests/cxf-soap/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/PasswordCallback.java +++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/java/org/apache/camel/quarkus/component/cxf/soap/security/it/PasswordCallback.java @@ -14,7 +14,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.quarkus.component.cxf.soap.it; +package org.apache.camel.quarkus.component.cxf.soap.security.it; import java.io.IOException; @@ -44,7 +44,9 @@ public class PasswordCallback implements CallbackHandler { public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException { for (Callback callback : callbacks) { if (callback instanceof WSPasswordCallback) { - ((WSPasswordCallback) callback).setPassword(password); + if (username.equals(((WSPasswordCallback) callback).getIdentifier())) { + ((WSPasswordCallback) callback).setPassword(password); + } } } } diff --git a/integration-tests/cxf-soap/src/main/resources/application.properties b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/resources/application.properties similarity index 93% rename from integration-tests/cxf-soap/src/main/resources/application.properties rename to integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/resources/application.properties index efc3dcbba6..574727024a 100644 --- a/integration-tests/cxf-soap/src/main/resources/application.properties +++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/resources/application.properties @@ -15,8 +15,5 @@ ## limitations under the License. ## --------------------------------------------------------------------------- -password-callback.username=camel -password-callback.password=quarkus - quarkus.cxf.path=/soapservice quarkus.native.resources.includes = wsdl/*.wsdl diff --git a/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/resources/wsdl/WssCalculatorService.wsdl b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/resources/wsdl/WssCalculatorService.wsdl new file mode 100644 index 0000000000..0befa65a53 --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/main/resources/wsdl/WssCalculatorService.wsdl @@ -0,0 +1,75 @@ +<?xml version="1.0" ?><wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.jboss.org/eap/quickstarts/wscalculator/WssCalculator" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="WssCalculatorService" targetNamespace="http://www.jboss.org/eap/quickstarts/wscalculator/WssCalculator"> +<!-- + + 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. + +--> + <wsdl:types> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.jboss.org/eap/quickstarts/wscalculator/WssCalculator" elementFormDefault="unqualified" targetNamespace="http://www.jboss.org/eap/quickstarts/wscalculator/WssCalculator" version="1.0"> + + <xs:element name="modulo" type="tns:modulo"></xs:element> + + <xs:element name="moduloResponse" type="tns:moduloResponse"></xs:element> + + <xs:complexType name="modulo"> + <xs:sequence> + <xs:element name="arg0" type="xs:int"></xs:element> + <xs:element name="arg1" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="moduloResponse"> + <xs:sequence> + <xs:element name="return" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + +</xs:schema> + </wsdl:types> + <wsdl:message name="moduloResponse"> + <wsdl:part element="tns:moduloResponse" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="modulo"> + <wsdl:part element="tns:modulo" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:portType name="WssCalculatorService"> + <wsdl:operation name="modulo"> + <wsdl:input message="tns:modulo" name="modulo"> + </wsdl:input> + <wsdl:output message="tns:moduloResponse" name="moduloResponse"> + </wsdl:output> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="WssCalculatorServiceSoapBinding" type="tns:WssCalculatorService"> + <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding> + <wsdl:operation name="modulo"> + <soap:operation soapAction="" style="document"></soap:operation> + <wsdl:input name="modulo"> + <soap:body use="literal"></soap:body> + </wsdl:input> + <wsdl:output name="moduloResponse"> + <soap:body use="literal"></soap:body> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="WssCalculatorService"> + <wsdl:port binding="tns:WssCalculatorServiceSoapBinding" name="WssCalculator"> + + </wsdl:port> + </wsdl:service> +</wsdl:definitions> \ No newline at end of file diff --git a/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/test/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfClientTestResource.java b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/test/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfClientTestResource.java new file mode 100644 index 0000000000..8c5e6158b7 --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/test/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfClientTestResource.java @@ -0,0 +1,76 @@ +/* + * 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.cxf.soap.security.it; + +import java.util.Map; + +import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.output.Slf4jLogConsumer; +import org.testcontainers.containers.wait.strategy.Wait; + +public class CxfClientTestResource implements QuarkusTestResourceLifecycleManager { + private static final Logger log = LoggerFactory.getLogger(CxfClientTestResource.class); + + private static final int WILDFLY_PORT = 8080; + private GenericContainer<?> calculatorContainer; + + @Override + public Map<String, String> start() { + + final String user = "camel-quarkus-user-user"; + final String password = "secret-password"; + + try { + try { + calculatorContainer = new GenericContainer<>("quay.io/l2x6/calculator-ws:1.0") + .withEnv("WSS_USER", user) + .withEnv("WSS_PASSWORD", password) + .withLogConsumer(new Slf4jLogConsumer(log)) + .withExposedPorts(WILDFLY_PORT) + .waitingFor(Wait.forHttp("/calculator-ws/CalculatorService?wsdl")); + + calculatorContainer.start(); + + return Map.of( + "camel-quarkus.it.calculator.baseUri", + "http://" + calculatorContainer.getHost() + ":" + + calculatorContainer.getMappedPort(WILDFLY_PORT), + "password-callback.username", user, + "password-callback.password", password); + } catch (Exception e) { + throw new RuntimeException(e); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Override + public void stop() { + try { + if (calculatorContainer != null) { + calculatorContainer.stop(); + } + } catch (Exception e) { + // ignored + } + } +} diff --git a/integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapClientTestResource.java b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/test/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfSoapClientIT.java similarity index 66% rename from integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapClientTestResource.java rename to integration-test-groups/cxf-soap/cxf-soap-ws-security/src/test/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfSoapClientIT.java index 9a01702e63..0c2951dcd2 100644 --- a/integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapClientTestResource.java +++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/test/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfSoapClientIT.java @@ -14,19 +14,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.camel.quarkus.component.cxf.soap.it; +package org.apache.camel.quarkus.component.cxf.soap.security.it; -import org.apache.camel.quarkus.test.wiremock.WireMockTestResourceLifecycleManager; +import io.quarkus.test.junit.QuarkusIntegrationTest; -public class CxfSoapClientTestResource extends WireMockTestResourceLifecycleManager { - - @Override - protected String getRecordTargetBaseUrl() { - return "/"; - } - - @Override - protected boolean isMockingEnabled() { - return true; - } +@QuarkusIntegrationTest +class CxfSoapClientIT extends CxfSoapClientTest { } diff --git a/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/test/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfSoapClientTest.java b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/test/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfSoapClientTest.java new file mode 100644 index 0000000000..1edbc4abe2 --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security/src/test/java/org/apache/camel/quarkus/component/cxf/soap/security/it/CxfSoapClientTest.java @@ -0,0 +1,85 @@ +/* + * 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.cxf.soap.security.it; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import org.eclipse.microprofile.config.ConfigProvider; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; + +@QuarkusTest +@QuarkusTestResource(CxfClientTestResource.class) +class CxfSoapClientTest { + + @Test + public void wsSecurityClient() { + RestAssured.given() + .queryParam("a", "12") + .queryParam("b", "8") + .post("/cxf-soap/modulo") + .then() + .statusCode(201) + .body(equalTo("4")); + } + + /** + * Make sure that our static copy is the same as the WSDL served by the container + * + * @throws IOException + */ + @Test + void wsdlUpToDate() throws IOException { + final String wsdlUrl = ConfigProvider.getConfig() + .getValue("camel-quarkus.it.calculator.baseUri", String.class); + + final String staticCopyPath = "target/classes/wsdl/WssCalculatorService.wsdl"; + /* The changing Docker IP address in the WSDL should not matter */ + final String sanitizerRegex = "<soap:address location=\"http://[^/]*/calculator-ws/WssCalculatorService\"></soap:address>"; + final String staticCopyContent = Files + .readString(Paths.get(staticCopyPath), StandardCharsets.UTF_8) + .replaceAll(sanitizerRegex, "") + //remove a comment with license + .replaceAll("<!--[.\\s\\S]*?-->", "\n") + //remove all whitesaces to ignore formatting changes + .replaceAll("\\s", ""); + + final String expected = RestAssured.given() + .get(wsdlUrl + "/calculator-ws/WssCalculatorService?wsdl") + .then() + .statusCode(200) + .extract().body().asString(); + + final String expectedContent = expected.replaceAll(sanitizerRegex, ""); + + if (!expected.replaceAll(sanitizerRegex, "").replaceAll("\\s", "").equals(staticCopyContent)) { + Files.writeString(Paths.get(staticCopyPath), expectedContent, StandardCharsets.UTF_8); + Assertions.fail("The static WSDL copy in " + staticCopyPath + + " went out of sync with the WSDL served by the container. The content was updated by the test, you just need to review and commit the changes."); + } + + } +} diff --git a/integration-test-groups/pom.xml b/integration-test-groups/cxf-soap/pom.xml similarity index 71% copy from integration-test-groups/pom.xml copy to integration-test-groups/cxf-soap/pom.xml index 5ed39dbc4c..2f52ee824a 100644 --- a/integration-test-groups/pom.xml +++ b/integration-test-groups/cxf-soap/pom.xml @@ -22,28 +22,24 @@ <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus</artifactId> + <artifactId>camel-quarkus-integration-test-groups</artifactId> <version>2.13.1-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> </parent> - <artifactId>camel-quarkus-integration-test-groups</artifactId> + <artifactId>camel-quarkus-integration-tests-cxf-soap</artifactId> <packaging>pom</packaging> - <name>Camel Quarkus :: Integration Test Groups</name> + <name>Camel Quarkus :: Cxf Soap Integration Tests</name> <properties> <quarkus.banner.enabled>false</quarkus.banner.enabled> </properties> <modules> - <!-- test groups a..z; do not remove this comment, it is important when sorting via mvn process-resources -Pformat --> - <module>aws2</module> - <module>aws2-quarkus-client</module> - <module>azure</module> - <module>compression</module> - <module>foundation</module> - <module>mongodb</module> + <!-- extensions a..z; do not remove this comment, it is important when sorting via mvn process-resources -Pformat --> + <module>cxf-soap-client</module> + <module>cxf-soap-server</module> + <module>cxf-soap-ws-security</module> </modules> </project> diff --git a/integration-test-groups/pom.xml b/integration-test-groups/pom.xml index 5ed39dbc4c..1fe1a43043 100644 --- a/integration-test-groups/pom.xml +++ b/integration-test-groups/pom.xml @@ -42,6 +42,7 @@ <module>aws2-quarkus-client</module> <module>azure</module> <module>compression</module> + <module>cxf-soap</module> <module>foundation</module> <module>mongodb</module> </modules> diff --git a/integration-tests/cxf-soap-grouped/README.adoc b/integration-tests/cxf-soap-grouped/README.adoc new file mode 100644 index 0000000000..aca5cd1845 --- /dev/null +++ b/integration-tests/cxf-soap-grouped/README.adoc @@ -0,0 +1,4 @@ +== Cxf Soap grouped integration tests + +This module allows executing all tests from `integration-test-groups/cxf-soap/*` grouped together. +See the https://camel.apache.org/camel-quarkus/latest/contributor-guide/extension-testing.html#_grouping[Grouping section] of the Contributor guide for more details. diff --git a/integration-tests/cxf-soap/pom.xml b/integration-tests/cxf-soap-grouped/pom.xml similarity index 61% rename from integration-tests/cxf-soap/pom.xml rename to integration-tests/cxf-soap-grouped/pom.xml index a894500544..ca70eea4f2 100644 --- a/integration-tests/cxf-soap/pom.xml +++ b/integration-tests/cxf-soap-grouped/pom.xml @@ -26,48 +26,11 @@ <relativePath>../../poms/build-parent-it/pom.xml</relativePath> </parent> - <artifactId>camel-quarkus-integration-test-cxf-soap</artifactId> - <name>Camel Quarkus :: Integration Tests :: CXF</name> - <description>Integration tests for Camel Quarkus CXF extension</description> - - <build> - <plugins> - <plugin> - <groupId>org.apache.cxf</groupId> - <artifactId>cxf-codegen-plugin</artifactId> - <version>${cxf.version}</version> - <executions> - <execution> - <id>generate-sources</id> - <phase>generate-sources</phase> - <configuration> - <sourceRoot>${project.build.directory}/generated-sources</sourceRoot> - <wsdlOptions> - <wsdlOption> - <wsdl>${basedir}/src/main/resources/wsdl/HelloService.wsdl</wsdl> - <wsdlLocation>classpath:wsdl/HelloService.wsdl</wsdlLocation> - <extraargs> - <extraarg>-xjc-Xts</extraarg> - </extraargs> - </wsdlOption> - </wsdlOptions> - </configuration> - <goals> - <goal>wsdl2java</goal> - </goals> - </execution> - </executions> - <dependencies> - <dependency> - <groupId>org.apache.cxf.xjcplugins</groupId> - <artifactId>cxf-xjc-ts</artifactId> - <version>${cxf.xjc-utils.version}</version> - </dependency> - </dependencies> - </plugin> - </plugins> - </build> + <artifactId>camel-quarkus-integration-test-cxf-soap-grouped</artifactId> + <name>Camel Quarkus :: Integration Tests :: Cxf Soap Grouped</name> + <description>Cxf Soap tests from ../integration-test-groups/cxf-soap merged together</description> + <!-- Regenerate the dependencies via `mvn process-resources -Pformat -N` from the source tree root directory --> <dependencies> <dependency> <groupId>org.apache.camel.quarkus</groupId> @@ -77,16 +40,6 @@ <groupId>io.quarkiverse.cxf</groupId> <artifactId>quarkus-cxf-rt-ws-security</artifactId> </dependency> - <dependency> - <groupId>io.quarkus</groupId> - <artifactId>quarkus-resteasy</artifactId> - </dependency> - - <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-direct</artifactId> - </dependency> - <dependency> <groupId>org.apache.cxf.xjc-utils</groupId> <artifactId>cxf-xjc-runtime</artifactId> @@ -95,6 +48,14 @@ <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-resteasy</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct</artifactId> + </dependency> <!-- test dependencies --> <dependency> @@ -108,12 +69,110 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.apache.camel.quarkus</groupId> - <artifactId>camel-quarkus-integration-wiremock-support</artifactId> + <groupId>org.testcontainers</groupId> + <artifactId>testcontainers</artifactId> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-junit4-mock</artifactId> <scope>test</scope> </dependency> </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <executions> + <execution> + <id>add-sources</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>${basedir}/target/src/main/java</source> + </sources> + </configuration> + </execution> + <execution> + <id>add-test-sources</id> + <phase>generate-sources</phase> + <goals> + <goal>add-test-source</goal> + </goals> + <configuration> + <sources> + <source>${basedir}/target/src/test/java</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.gmaven</groupId> + <artifactId>groovy-maven-plugin</artifactId> + <executions> + <execution> + <id>group-sources</id> + <goals> + <goal>execute</goal> + </goals> + <phase>generate-sources</phase> + <configuration> + <source>file:${maven.multiModuleProjectDirectory}/tooling/scripts/group-tests.groovy</source> + <properties> + <group-tests.source.dir>${maven.multiModuleProjectDirectory}/integration-test-groups/cxf-soap</group-tests.source.dir> + <group-tests.dest.module.dir>${project.basedir}</group-tests.dest.module.dir> + <group-tests.concat.rel.paths>src/main/resources/application.properties</group-tests.concat.rel.paths> + </properties> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-codegen-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>wsdl2java</goal> + </goals> + <configuration> + <wsdlOptions> + <wsdlOption> + <wsdl>${basedir}/target/classes/wsdl/CalculatorService.wsdl</wsdl> + </wsdlOption> + <wsdlOption> + <wsdl>${basedir}/target/classes/wsdl/HelloService.wsdl</wsdl> + </wsdlOption> + <wsdlOption> + <wsdl>${basedir}/target/classes/wsdl/WssCalculatorService.wsdl</wsdl> + </wsdlOption> + </wsdlOptions> + </configuration> + </execution> + </executions> + <dependencies> + <dependency> + <groupId>org.apache.cxf.xjcplugins</groupId> + <artifactId>cxf-xjc-ts</artifactId> + <version>${cxf.xjc-utils.version}</version> + </dependency> + </dependencies> + </plugin> + </plugins> + </build> + <profiles> <profile> <id>native</id> @@ -179,6 +238,17 @@ </dependency> </dependencies> </profile> + <profile> + <id>skip-testcontainers-tests</id> + <activation> + <property> + <name>skip-testcontainers-tests</name> + </property> + </activation> + <properties> + <skipTests>true</skipTests> + </properties> + </profile> </profiles> </project> diff --git a/integration-tests/cxf-soap/src/main/resources/wsdl/HelloService.wsdl b/integration-tests/cxf-soap/src/main/resources/wsdl/HelloService.wsdl deleted file mode 100644 index f68ce72006..0000000000 --- a/integration-tests/cxf-soap/src/main/resources/wsdl/HelloService.wsdl +++ /dev/null @@ -1,113 +0,0 @@ -<?xml version="1.0"?> -<!-- - - 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. - ---> -<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" - xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" - xmlns:tns="http://www.helloworld.com/Service/" xmlns="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.helloworld.com/Service/"> - - <wsdl:types> - <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" - targetNamespace="http://www.helloworld.com/Service/"> - <xsd:element name="HelloRequest" type="xsd:string"/> - <xsd:element name="HelloResponse" type="xsd:string"/> - - <xsd:complexType name="PersonRequestType"> - <xsd:sequence> - <xsd:element name="firstName" type="xsd:string"/> - <xsd:element name="lastName" type="xsd:string"/> - </xsd:sequence> - </xsd:complexType> - <xsd:complexType name="PersonResponseType"> - <xsd:complexContent> - <extension base="tns:PersonRequestType"> - <xsd:sequence> - <xsd:element name="greeting" type="xsd:string"/> - </xsd:sequence> - </extension> - </xsd:complexContent> - </xsd:complexType> - - <xsd:element name="PersonRequest" type="tns:PersonRequestType"/> - <xsd:element name="PersonResponse" type="tns:PersonResponseType"/> - </xsd:schema> - </wsdl:types> - - <wsdl:message name="helloInputMessage"> - <wsdl:part name="helloInputPart" element="tns:HelloRequest"/> - </wsdl:message> - <wsdl:message name="helloOutputMessage"> - <wsdl:part name="helloOutputPart" element="tns:HelloResponse"/> - </wsdl:message> - - <wsdl:message name="personInputMessage"> - <wsdl:part name="personInputPart" element="tns:PersonRequest"/> - </wsdl:message> - <wsdl:message name="personOutputMessage"> - <wsdl:part name="personOutputPart" element="tns:PersonResponse"/> - </wsdl:message> - - <wsdl:portType name="HelloPortType"> - <wsdl:operation name="Hello"> - <wsdl:input name="helloInput" - message="tns:helloInputMessage"/> - <wsdl:output name="helloOutput" - message="tns:helloOutputMessage"/> - </wsdl:operation> - - <wsdl:operation name="Person"> - <wsdl:input name="personInput" - message="tns:personInputMessage"/> - <wsdl:output name="personOutput" - message="tns:personOutputMessage"/> - </wsdl:operation> - - </wsdl:portType> - - <wsdl:binding name="HelloBinding" type="tns:HelloPortType"> - <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/> - <wsdl:operation name="Hello"> - <soap:operation - soapAction="https://www.helloworld.com/Service/Hello"/> - <wsdl:input name="helloInput"> - <soap:body use="literal"/> - </wsdl:input> - <wsdl:output name="helloOutput"> - <soap:body use="literal"/> - </wsdl:output> - </wsdl:operation> - <wsdl:operation name="Person"> - <soap:operation - soapAction="https://www.helloworld.com/Service/Person"/> - <wsdl:input name="personInput"> - <soap:body use="literal"/> - </wsdl:input> - <wsdl:output name="personOutput"> - <soap:body use="literal"/> - </wsdl:output> - </wsdl:operation> - </wsdl:binding> - - <wsdl:service name="HelloService"> - <wsdl:port name="HelloPort" binding="tns:HelloBinding"> - <soap:address location="http://localhost:7878/hello"/> - </wsdl:port> - </wsdl:service> - -</wsdl:definitions> \ No newline at end of file diff --git a/integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapClientTest.java b/integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapClientTest.java deleted file mode 100644 index 7df5d9fd5f..0000000000 --- a/integration-tests/cxf-soap/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/CxfSoapClientTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.cxf.soap.it; - -import io.quarkus.test.common.QuarkusTestResource; -import io.quarkus.test.junit.QuarkusTest; -import io.restassured.RestAssured; -import org.junit.jupiter.api.Test; - -import static org.hamcrest.Matchers.containsString; -import static org.hamcrest.Matchers.is; - -@QuarkusTest -@QuarkusTestResource(CxfSoapClientTestResource.class) -class CxfSoapClientTest { - - @Test - public void simpleSoapClient() { - RestAssured.given() - .body("CamelQuarkusCXF") - .post("/cxf-soap/simple/simpleSoapClient") - .then() - .statusCode(201) - .body(is("Hello CamelQuarkusCXF")); - } - - @Test - public void wsSecurityClient() { - RestAssured.given() - .body("CamelQuarkusCXF") - .post("/cxf-soap/simple/wsSecurityClient") - .then() - .statusCode(201) - .body(is("Hello WSSecurity CamelQuarkusCXF")); - } - - @Test - public void complexSoapClient() { - RestAssured.given() - .queryParam("firstName", "Camel Quarkus") - .queryParam("lastName", "CXF") - .post("/cxf-soap/person/complexSoapClient") - .then() - .statusCode(201) - .body(containsString("greeting=Hello,firstName=Camel Quarkus,lastName=CXF")); - } -} diff --git a/integration-tests/cxf-soap/src/test/resources/__files/simpleHelloWorldResponse.xml b/integration-tests/cxf-soap/src/test/resources/__files/simpleHelloWorldResponse.xml deleted file mode 100644 index 95d7c485f0..0000000000 --- a/integration-tests/cxf-soap/src/test/resources/__files/simpleHelloWorldResponse.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0"?> -<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:hello="http://www.helloworld.com/Service/"> - <soapenv:Header/> - <soapenv:Body> - <hello:HelloResponse>Hello CamelQuarkusCXF</hello:HelloResponse> - </soapenv:Body> -</soapenv:Envelope> diff --git a/integration-tests/cxf-soap/src/test/resources/__files/soapObjectResponse.xml b/integration-tests/cxf-soap/src/test/resources/__files/soapObjectResponse.xml deleted file mode 100644 index 34725c1a53..0000000000 --- a/integration-tests/cxf-soap/src/test/resources/__files/soapObjectResponse.xml +++ /dev/null @@ -1,12 +0,0 @@ -<?xml version="1.0"?> -<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:hello="http://www.helloworld.com/Service/"> - <soapenv:Header/> - <soapenv:Body> - <ns2:PersonResponse xmlns:ns2="http://www.helloworld.com/Service/"> - <firstName>Camel Quarkus</firstName> - <lastName>CXF</lastName> - <greeting>Hello</greeting> - </ns2:PersonResponse> - </soapenv:Body> -</soapenv:Envelope> diff --git a/integration-tests/cxf-soap/src/test/resources/__files/wsSecurityResponse.xml b/integration-tests/cxf-soap/src/test/resources/__files/wsSecurityResponse.xml deleted file mode 100644 index 2edf8040d2..0000000000 --- a/integration-tests/cxf-soap/src/test/resources/__files/wsSecurityResponse.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0"?> -<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:hello="http://www.helloworld.com/Service/"> - <soapenv:Header/> - <soapenv:Body> - <hello:HelloResponse>Hello WSSecurity CamelQuarkusCXF</hello:HelloResponse> - </soapenv:Body> -</soapenv:Envelope> diff --git a/integration-tests/cxf-soap/src/test/resources/mappings/simpleHelloWorld.json b/integration-tests/cxf-soap/src/test/resources/mappings/simpleHelloWorld.json deleted file mode 100644 index 49d1d8c09a..0000000000 --- a/integration-tests/cxf-soap/src/test/resources/mappings/simpleHelloWorld.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "request": { - "method": "POST", - "url": "/hello", - "headers": { - "Content-Type": { - "equalTo": "text/xml; charset=UTF-8" - }, - "SOAPAction": { - "equalTo": "\"https://www.helloworld.com/Service/Hello\"" - } - }, - "bodyPatterns": [ - { - "equalToXml": "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><HelloRequest xmlns=\"http://www.helloworld.com/Service/\">CamelQuarkusCXF</HelloRequest></soap:Body></soap:Envelope>", - "exemptedComparisons": ["NAMESPACE_URI", "NAMESPACE_PREFIX"] - } - ] - }, - "response": { - "status": 200, - "bodyFileName": "simpleHelloWorldResponse.xml", - "headers": { - "Content-Type": "text/xml; charset=UTF-8" - } - } -} \ No newline at end of file diff --git a/integration-tests/cxf-soap/src/test/resources/mappings/soapObject.json b/integration-tests/cxf-soap/src/test/resources/mappings/soapObject.json deleted file mode 100644 index 58ae479ebc..0000000000 --- a/integration-tests/cxf-soap/src/test/resources/mappings/soapObject.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "request": { - "method": "POST", - "url": "/hello", - "headers": { - "Content-Type": { - "equalTo": "text/xml; charset=UTF-8" - }, - "SOAPAction": { - "equalTo": "\"https://www.helloworld.com/Service/Person\"" - } - }, - "bodyPatterns": [ - { - "matchesXPath": "//ns2:PersonRequest", - "xPathNamespaces": { - "ns2": "http://www.helloworld.com/Service/" - } - } - ] - }, - "response": { - "status": 200, - "bodyFileName": "soapObjectResponse.xml", - "headers": { - "Content-Type": "text/xml; charset=UTF-8" - } - } -} \ No newline at end of file diff --git a/integration-tests/cxf-soap/src/test/resources/mappings/wsSecurity.json b/integration-tests/cxf-soap/src/test/resources/mappings/wsSecurity.json deleted file mode 100644 index 1884da14f8..0000000000 --- a/integration-tests/cxf-soap/src/test/resources/mappings/wsSecurity.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "request": { - "method": "POST", - "url": "/hellowss", - "headers": { - "Content-Type": { - "equalTo": "text/xml; charset=UTF-8" - }, - "SOAPAction": { - "equalTo": "\"https://www.helloworld.com/Service/Hello\"" - } - }, - "bodyPatterns": [ - { - "matchesXPath": "//wsse:Security", - "xPathNamespaces": { - "wsse": "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" - } - }, - { - "matchesXPath": "//wsse:UsernameToken", - "xPathNamespaces": { - "wsse": "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" - } - }, - { - "matchesXPath": "//wsse:Username", - "xPathNamespaces": { - "wsse": "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" - } - }, - { - "matchesXPath": "//wsse:Password", - "xPathNamespaces": { - "wsse": "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" - } - }, - { - "matchesXPath": "//wsse:Nonce", - "xPathNamespaces": { - "wsse": "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" - } - }, - { - "matchesXPath": "//wsu:Created", - "xPathNamespaces": { - "wsu": "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" - } - } - ] - }, - "response": { - "status": 200, - "bodyFileName": "wsSecurityResponse.xml", - "headers": { - "Content-Type": "text/xml; charset=UTF-8" - } - } -} \ No newline at end of file diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 1248ee18ed..48c375791f 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -78,7 +78,7 @@ <module>crypto</module> <module>csimple</module> <module>csv</module> - <module>cxf-soap</module> + <module>cxf-soap-grouped</module> <module>dataformat</module> <module>dataformats-json</module> <module>datasonnet</module> diff --git a/pom.xml b/pom.xml index 3ad5149dcc..5fc5bf45c3 100644 --- a/pom.xml +++ b/pom.xml @@ -308,6 +308,12 @@ <pluginManagement> <plugins> <!-- Only plugins relevant to both end user applications and Camel Quarkus extensions --> + <plugin> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-codegen-plugin</artifactId> + <version>${cxf.version}</version> + </plugin> + <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> diff --git a/tooling/scripts/test-categories.yaml b/tooling/scripts/test-categories.yaml index b1b5e9f660..72fd18de4b 100644 --- a/tooling/scripts/test-categories.yaml +++ b/tooling/scripts/test-categories.yaml @@ -84,7 +84,7 @@ group-05: - bindy - cbor - csv - - cxf-soap + - cxf-soap-grouped - dataformat - datasonnet - hl7
