This is an automated email from the ASF dual-hosted git repository. jamesnetherton pushed a commit to branch 3.2.x in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 16983ff3e3dbd75827f8dc1bb3f53a9bf07ffcdc Author: Peter Palaga <[email protected]> AuthorDate: Wed Sep 6 14:15:11 2023 +0200 Test REST to SOAP bridge scenario --- .../cxf-soap/cxf-soap-rest/pom.xml | 203 ++++++++++++ .../cxf/soap/rest/it/CxfSoapRestRoutes.java | 88 +++++ .../src/main/resources/application.properties | 23 ++ .../src/main/resources/wsdl/CalculatorService.wsdl | 366 +++++++++++++++++++++ .../cxf/soap/rest/it/CxfRestTestResource.java | 74 +++++ .../component/cxf/soap/rest/it/CxfSoapRestIT.java | 23 ++ .../cxf/soap/rest/it/CxfSoapRestTest.java | 54 +++ integration-test-groups/cxf-soap/pom.xml | 1 + integration-tests/cxf-soap-grouped/pom.xml | 34 ++ 9 files changed, 866 insertions(+) diff --git a/integration-test-groups/cxf-soap/cxf-soap-rest/pom.xml b/integration-test-groups/cxf-soap/cxf-soap-rest/pom.xml new file mode 100644 index 0000000000..9cbf5614e7 --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-rest/pom.xml @@ -0,0 +1,203 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + + 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. + +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-build-parent-it</artifactId> + <version>3.2.1-SNAPSHOT</version> + <relativePath>../../../poms/build-parent-it/pom.xml</relativePath> + </parent> + + <artifactId>camel-quarkus-integration-test-cxf-soap-rest</artifactId> + <name>Camel Quarkus :: Integration Tests :: CXF SOAP REST bridge</name> + <description>A REST to SOAP bridge</description> + + <dependencies> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-cxf-soap</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-direct</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-rest</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-jackson</artifactId> + </dependency> + + <!-- test dependencies --> + <dependency> + <groupId>io.quarkus</groupId> + <artifactId>quarkus-junit5</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>io.rest-assured</groupId> + <artifactId>rest-assured</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <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>${quarkus.platform.group-id}</groupId> + <artifactId>quarkus-maven-plugin</artifactId> + <version>${quarkus.platform.version}</version> + <extensions>true</extensions><!-- Workaround for https://github.com/quarkusio/quarkus/issues/21718 --> + <executions> + <execution> + <id>generate-code</id> + <goals> + <goal>generate-code</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + + <profiles> + <profile> + <id>native</id> + <activation> + <property> + <name>native</name> + </property> + </activation> + <properties> + <quarkus.package.type>native</quarkus.package.type> + </properties> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-failsafe-plugin</artifactId> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> + <profile> + <id>virtualDependencies</id> + <activation> + <property> + <name>!noVirtualDependencies</name> + </property> + </activation> + <dependencies> + <!-- The following dependencies guarantee that this module is built after them. You can update them by running `mvn process-resources -Pformat -N` from the source tree root directory --> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-cxf-soap-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </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> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-jackson-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-rest-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </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-rest/src/main/java/org/apache/camel/quarkus/component/cxf/soap/rest/it/CxfSoapRestRoutes.java b/integration-test-groups/cxf-soap/cxf-soap-rest/src/main/java/org/apache/camel/quarkus/component/cxf/soap/rest/it/CxfSoapRestRoutes.java new file mode 100644 index 0000000000..3d6ea3d029 --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-rest/src/main/java/org/apache/camel/quarkus/component/cxf/soap/rest/it/CxfSoapRestRoutes.java @@ -0,0 +1,88 @@ +/* + * 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.rest.it; + +import jakarta.enterprise.context.ApplicationScoped; +import jakarta.enterprise.context.SessionScoped; +import jakarta.enterprise.inject.Produces; +import jakarta.inject.Inject; +import jakarta.inject.Named; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.component.cxf.jaxws.CxfEndpoint; +import org.apache.camel.model.rest.RestBindingMode; +import org.apache.cxf.ext.logging.LoggingFeature; +import org.eclipse.microprofile.config.inject.ConfigProperty; +import org.jboss.eap.quickstarts.wscalculator.calculator.AddOperands; +import org.jboss.eap.quickstarts.wscalculator.calculator.CalculatorService; +import org.jboss.eap.quickstarts.wscalculator.calculator.Result; + +@ApplicationScoped +public class CxfSoapRestRoutes extends RouteBuilder { + + @Inject + @Named("loggingFeatureRest") + LoggingFeature loggingFeatureRest; + + @ConfigProperty(name = "camel-quarkus.it.calculator.baseUri") + String serviceBaseUri; + + @Override + public void configure() { + + rest("cxf-soap-rest").bindingMode(RestBindingMode.json) + .post("post") + .type(AddOperands.class) + .outType(Result.class) + .to("direct:headersPropagation"); + from("direct:headersPropagation") + .process(exchange -> exchange.getIn().setBody(exchange.getIn().getBody(AddOperands.class).getArg0())) + .to("cxf:bean:soapClientRestEndpoint?defaultOperationName=addOperands") + .setHeader("Content-Type", constant("application/json")) + .setBody(e -> e.getMessage().getBody(Object[].class)[0]); + + } + + @Produces + @ApplicationScoped + @Named("loggingFeatureRest") + public LoggingFeature loggingFeatureRest() { + final LoggingFeature result = new LoggingFeature(); + result.setPrettyLogging(true); + return result; + } + + @Produces + @SessionScoped + @Named + CxfEndpoint soapClientRestEndpoint() { + final CxfEndpoint result = new CxfEndpoint(); + result.setServiceClass(CalculatorService.class); + result.setAddress(calculatorServiceAddress()); + result.setWsdlURL(calculatorServiceWsdlUrl()); + result.getFeatures().add(loggingFeatureRest); + return result; + } + + private String calculatorServiceAddress() { + return serviceBaseUri + "/calculator-ws/CalculatorService"; + } + + private String calculatorServiceWsdlUrl() { + return "wsdl/CalculatorService.wsdl"; + } + +} diff --git a/integration-test-groups/cxf-soap/cxf-soap-rest/src/main/resources/application.properties b/integration-test-groups/cxf-soap/cxf-soap-rest/src/main/resources/application.properties new file mode 100644 index 0000000000..7c106510c8 --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-rest/src/main/resources/application.properties @@ -0,0 +1,23 @@ +## --------------------------------------------------------------------------- +## 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. +## --------------------------------------------------------------------------- + +quarkus.cxf.path=/soapservice +quarkus.native.resources.includes = wsdl/*.wsdl + +# do everything with named parameter sets so that it works in the grouped module +quarkus.cxf.codegen.wsdl2java.CalculatorService.includes = wsdl/CalculatorService.wsdl +quarkus.cxf.codegen.wsdl2java.CalculatorService.additional-params = -wsdlLocation,classpath:wsdl/CalculatorService.wsdl diff --git a/integration-test-groups/cxf-soap/cxf-soap-rest/src/main/resources/wsdl/CalculatorService.wsdl b/integration-test-groups/cxf-soap/cxf-soap-rest/src/main/resources/wsdl/CalculatorService.wsdl new file mode 100644 index 0000000000..43455b0449 --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-rest/src/main/resources/wsdl/CalculatorService.wsdl @@ -0,0 +1,366 @@ +<?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="addArray" type="tns:addArray"></xs:element> + + <xs:element name="addArrayResponse" type="tns:addArrayResponse"></xs:element> + + <xs:element name="addList" type="tns:addList"></xs:element> + + <xs:element name="addListResponse" type="tns:addListResponse"></xs:element> + + <xs:element name="addNumberAndOperands" type="tns:addNumberAndOperands"></xs:element> + + <xs:element name="addNumberAndOperandsResponse" type="tns:addNumberAndOperandsResponse"></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="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="addArray"> + <xs:sequence> + <xs:element maxOccurs="unbounded" minOccurs="0" name="arg0" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="addArrayResponse"> + <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="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="addList"> + <xs:sequence> + <xs:element maxOccurs="unbounded" minOccurs="0" name="arg0" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="addListResponse"> + <xs:sequence> + <xs:element name="return" type="xs:int"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="addNumberAndOperands"> + <xs:sequence> + <xs:element name="arg0" type="xs:int"></xs:element> + <xs:element minOccurs="0" name="arg1" 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="addNumberAndOperandsResponse"> + <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="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="addListResponse"> + <wsdl:part element="tns:addListResponse" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="addArray"> + <wsdl:part element="tns:addArray" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="divide"> + <wsdl:part element="tns:divide" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="addList"> + <wsdl:part element="tns:addList" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="addOperandsResponse"> + <wsdl:part element="tns:addOperandsResponse" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="addNumberAndOperands"> + <wsdl:part element="tns:addNumberAndOperands" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:message name="addNumberAndOperandsResponse"> + <wsdl:part element="tns:addNumberAndOperandsResponse" 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: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="addArrayResponse"> + <wsdl:part element="tns:addArrayResponse" name="parameters"> + </wsdl:part> + </wsdl:message> + <wsdl:portType name="CalculatorService"> + <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="addArray"> + <wsdl:input message="tns:addArray" name="addArray"> + </wsdl:input> + <wsdl:output message="tns:addArrayResponse" name="addArrayResponse"> + </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="divide"> + <wsdl:input message="tns:divide" name="divide"> + </wsdl:input> + <wsdl:output message="tns:divideResponse" name="divideResponse"> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="addList"> + <wsdl:input message="tns:addList" name="addList"> + </wsdl:input> + <wsdl:output message="tns:addListResponse" name="addListResponse"> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="addNumberAndOperands"> + <wsdl:input message="tns:addNumberAndOperands" name="addNumberAndOperands"> + </wsdl:input> + <wsdl:output message="tns:addNumberAndOperandsResponse" name="addNumberAndOperandsResponse"> + </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="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="addArray"> + <soap:operation soapAction="" style="document"></soap:operation> + <wsdl:input name="addArray"> + <soap:body use="literal"></soap:body> + </wsdl:input> + <wsdl:output name="addArrayResponse"> + <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="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="addList"> + <soap:operation soapAction="" style="document"></soap:operation> + <wsdl:input name="addList"> + <soap:body use="literal"></soap:body> + </wsdl:input> + <wsdl:output name="addListResponse"> + <soap:body use="literal"></soap:body> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="addNumberAndOperands"> + <soap:operation soapAction="" style="document"></soap:operation> + <wsdl:input name="addNumberAndOperands"> + <soap:body use="literal"></soap:body> + </wsdl:input> + <wsdl:output name="addNumberAndOperandsResponse"> + <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.3: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-rest/src/test/java/org/apache/camel/quarkus/component/cxf/soap/rest/it/CxfRestTestResource.java b/integration-test-groups/cxf-soap/cxf-soap-rest/src/test/java/org/apache/camel/quarkus/component/cxf/soap/rest/it/CxfRestTestResource.java new file mode 100644 index 0000000000..1bf2e18dc6 --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-rest/src/test/java/org/apache/camel/quarkus/component/cxf/soap/rest/it/CxfRestTestResource.java @@ -0,0 +1,74 @@ +/* + * 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.rest.it; + +import java.util.Map; +import java.util.UUID; + +import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; +import org.eclipse.microprofile.config.ConfigProvider; +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 CxfRestTestResource implements QuarkusTestResourceLifecycleManager { + private static final Logger log = LoggerFactory.getLogger(CxfRestTestResource.class); + + private static final int WILDFLY_PORT = 8080; + private GenericContainer<?> calculatorContainer; + + @Override + public Map<String, String> start() { + final String BASIC_AUTH_USER = "tester"; + final String BASIC_AUTH_PASSWORD = UUID.randomUUID().toString(); + final String IMAGE_NAME = ConfigProvider.getConfig().getValue("calculator-ws.container.image", String.class); + + try { + calculatorContainer = new GenericContainer<>(IMAGE_NAME) + .withExposedPorts(WILDFLY_PORT) + .withEnv("BASIC_AUTH_USER", BASIC_AUTH_USER) + .withEnv("BASIC_AUTH_PASSWORD", BASIC_AUTH_PASSWORD) + .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), + "cq.cxf.it.calculator.auth.basic.user", BASIC_AUTH_USER, + "cq.cxf.it.calculator.auth.basic.password", BASIC_AUTH_PASSWORD); + } 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-test-groups/cxf-soap/cxf-soap-rest/src/test/java/org/apache/camel/quarkus/component/cxf/soap/rest/it/CxfSoapRestIT.java b/integration-test-groups/cxf-soap/cxf-soap-rest/src/test/java/org/apache/camel/quarkus/component/cxf/soap/rest/it/CxfSoapRestIT.java new file mode 100644 index 0000000000..4dc017f93d --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-rest/src/test/java/org/apache/camel/quarkus/component/cxf/soap/rest/it/CxfSoapRestIT.java @@ -0,0 +1,23 @@ +/* + * 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.rest.it; + +import io.quarkus.test.junit.QuarkusIntegrationTest; + +@QuarkusIntegrationTest +class CxfSoapRestIT extends CxfSoapRestTest { +} diff --git a/integration-test-groups/cxf-soap/cxf-soap-rest/src/test/java/org/apache/camel/quarkus/component/cxf/soap/rest/it/CxfSoapRestTest.java b/integration-test-groups/cxf-soap/cxf-soap-rest/src/test/java/org/apache/camel/quarkus/component/cxf/soap/rest/it/CxfSoapRestTest.java new file mode 100644 index 0000000000..14bbb02528 --- /dev/null +++ b/integration-test-groups/cxf-soap/cxf-soap-rest/src/test/java/org/apache/camel/quarkus/component/cxf/soap/rest/it/CxfSoapRestTest.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.rest.it; + +import com.fasterxml.jackson.databind.ObjectMapper; +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.junit.QuarkusTest; +import io.restassured.RestAssured; +import io.restassured.http.ContentType; +import io.restassured.response.Response; +import org.jboss.eap.quickstarts.wscalculator.calculator.AddOperands; +import org.jboss.eap.quickstarts.wscalculator.calculator.Operands; +import org.jboss.eap.quickstarts.wscalculator.calculator.Result; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +@QuarkusTest +@QuarkusTestResource(CxfRestTestResource.class) +class CxfSoapRestTest { + + @Test + public void headersPropagation() throws Exception { + int firstOperand = 5; + int secondOperand = 23; + AddOperands addOperands = new AddOperands(); + Operands operands = new Operands(); + operands.setA(firstOperand); + operands.setB(secondOperand); + addOperands.setArg0(operands); + String payload = new ObjectMapper().writeValueAsString(addOperands); + + Response response = RestAssured.given() + .contentType(ContentType.JSON) + .body(payload) + .post("/cxf-soap-rest/post") + .andReturn(); + Assertions.assertSame(firstOperand + secondOperand, response.as(Result.class).getResult(), + "The expected sum is incorrect."); + } +} diff --git a/integration-test-groups/cxf-soap/pom.xml b/integration-test-groups/cxf-soap/pom.xml index ad4a38ee99..accdcdc897 100644 --- a/integration-test-groups/cxf-soap/pom.xml +++ b/integration-test-groups/cxf-soap/pom.xml @@ -41,6 +41,7 @@ <module>cxf-soap-converter</module> <module>cxf-soap-mtom</module> <module>cxf-soap-mtom-awt</module> + <module>cxf-soap-rest</module> <module>cxf-soap-server</module> <module>cxf-soap-ssl</module> <module>cxf-soap-ws-security-client</module> diff --git a/integration-tests/cxf-soap-grouped/pom.xml b/integration-tests/cxf-soap-grouped/pom.xml index daf54183a0..1c9f13107d 100644 --- a/integration-tests/cxf-soap-grouped/pom.xml +++ b/integration-tests/cxf-soap-grouped/pom.xml @@ -76,6 +76,14 @@ <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jaxb</artifactId> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-rest</artifactId> + </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-jackson</artifactId> + </dependency> <!-- test dependencies --> <dependency> @@ -235,6 +243,19 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-jackson-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> <dependency> <groupId>org.apache.camel.quarkus</groupId> <artifactId>camel-quarkus-jaxb-deployment</artifactId> @@ -248,6 +269,19 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.apache.camel.quarkus</groupId> + <artifactId>camel-quarkus-rest-deployment</artifactId> + <version>${project.version}</version> + <type>pom</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>*</groupId> + <artifactId>*</artifactId> + </exclusion> + </exclusions> + </dependency> </dependencies> </profile> <profile>
