You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2023/04/06 12:34:10 UTC
[camel-quarkus] 04/06: Upgrade to CXF test container quay.io/l2x6/calculator-ws:1.1
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 978cf22f25664185e0f1da495b50537f750e84cd
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Tue Mar 28 16:30:15 2023 +0200
Upgrade to CXF test container quay.io/l2x6/calculator-ws:1.1
---
.../cxf/soap/client/it/CxfSoapClientResource.java | 34 +++-
.../src/main/resources/wsdl/CalculatorService.wsdl | 188 +++++++++++++++++----
.../cxf/soap/client/it/CxfClientTestResource.java | 2 +-
.../cxf/soap/client/it/CxfSoapClientTest.java | 16 +-
.../soap/wss/client/it/CxfSoapWssClientTest.java | 16 +-
.../wss/client/it/CxfWssClientTestResource.java | 2 +-
6 files changed, 191 insertions(+), 67 deletions(-)
diff --git a/integration-test-groups/cxf-soap/cxf-soap-client/src/main/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapClientResource.java b/integration-test-groups/cxf-soap/cxf-soap-client/src/main/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapClientResource.java
index 4ecee01f68..5732a8543a 100644
--- a/integration-test-groups/cxf-soap/cxf-soap-client/src/main/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapClientResource.java
+++ b/integration-test-groups/cxf-soap/cxf-soap-client/src/main/java/org/apache/camel/quarkus/component/cxf/soap/client/it/CxfSoapClientResource.java
@@ -16,6 +16,8 @@
*/
package org.apache.camel.quarkus.component.cxf.soap.client.it;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.net.URI;
import java.util.LinkedHashMap;
import java.util.Map;
@@ -30,7 +32,9 @@ import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.apache.camel.CamelExecutionException;
import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.cxf.common.message.CxfConstants;
import org.jboss.eap.quickstarts.wscalculator.calculator.Operands;
import org.jboss.eap.quickstarts.wscalculator.calculator.Result;
@@ -45,14 +49,28 @@ public class CxfSoapClientResource {
@POST
@Consumes(MediaType.WILDCARD)
@Produces(MediaType.TEXT_PLAIN)
- public Response sendSimpleRequest(@QueryParam("a") int a,
- @QueryParam("b") int b, @QueryParam("endpointUri") String endpointUri) throws Exception {
- final String response = producerTemplate.requestBody(String.format("direct:%s", endpointUri), new int[] { a, b },
- String.class);
- return Response
- .created(new URI("https://camel.apache.org/"))
- .entity(response)
- .build();
+ public Response sendSimpleRequest(
+ @QueryParam("a") int a,
+ @QueryParam("b") int b,
+ @QueryParam("endpointUri") String endpointUri,
+ @QueryParam("operation") String operation) throws Exception {
+ try {
+ final String response = producerTemplate.requestBodyAndHeader(
+ String.format("direct:%s", endpointUri),
+ new int[] { a, b },
+ CxfConstants.OPERATION_NAME,
+ operation,
+ String.class);
+ return Response
+ .created(new URI("https://camel.apache.org/"))
+ .entity(response)
+ .build();
+ } catch (CamelExecutionException e) {
+ try (StringWriter stackTrace = new StringWriter(); PrintWriter out = new PrintWriter(stackTrace)) {
+ e.printStackTrace(out);
+ return Response.serverError().entity(stackTrace.toString()).build();
+ }
+ }
}
@Path("/simpleAddDataFormat")
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
index 2b0be31507..43455b0449 100644
--- 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
@@ -22,6 +22,18 @@
<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>
@@ -40,27 +52,26 @@
<xs:element name="subtractResponse" type="tns:subtractResponse"></xs:element>
- <xs:complexType name="divide">
+ <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="divideResponse">
+ <xs:complexType name="addResponse">
<xs:sequence>
<xs:element name="return" type="xs:int"></xs:element>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="add">
+ <xs:complexType name="addArray">
<xs:sequence>
- <xs:element name="arg0" type="xs:int"></xs:element>
- <xs:element name="arg1" type="xs:int"></xs:element>
+ <xs:element maxOccurs="unbounded" minOccurs="0" name="arg0" type="xs:int"></xs:element>
</xs:sequence>
</xs:complexType>
- <xs:complexType name="addResponse">
+ <xs:complexType name="addArrayResponse">
<xs:sequence>
<xs:element name="return" type="xs:int"></xs:element>
</xs:sequence>
@@ -79,9 +90,35 @@
</xs:sequence>
</xs:complexType>
- <xs:complexType name="addOperands">
+ <xs:complexType name="divide">
<xs:sequence>
- <xs:element minOccurs="0" name="arg0" type="tns:operands"></xs:element>
+ <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>
@@ -92,6 +129,18 @@
</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>
@@ -120,6 +169,42 @@
</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>
@@ -144,41 +229,47 @@
<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:message name="addArrayResponse">
+ <wsdl:part element="tns:addArrayResponse" 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="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>
@@ -194,21 +285,21 @@
</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">
+ <wsdl:operation name="add">
<soap:operation soapAction="" style="document"></soap:operation>
- <wsdl:input name="divide">
+ <wsdl:input name="add">
<soap:body use="literal"></soap:body>
</wsdl:input>
- <wsdl:output name="divideResponse">
+ <wsdl:output name="addResponse">
<soap:body use="literal"></soap:body>
</wsdl:output>
</wsdl:operation>
- <wsdl:operation name="add">
+ <wsdl:operation name="addArray">
<soap:operation soapAction="" style="document"></soap:operation>
- <wsdl:input name="add">
+ <wsdl:input name="addArray">
<soap:body use="literal"></soap:body>
</wsdl:input>
- <wsdl:output name="addResponse">
+ <wsdl:output name="addArrayResponse">
<soap:body use="literal"></soap:body>
</wsdl:output>
</wsdl:operation>
@@ -221,6 +312,33 @@
<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">
@@ -242,7 +360,7 @@
</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>
+ <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-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
index d12d2c30ca..d8ff5eba2c 100644
--- 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
@@ -36,7 +36,7 @@ public class CxfClientTestResource implements QuarkusTestResourceLifecycleManage
public Map<String, String> start() {
try {
- calculatorContainer = new GenericContainer<>("quay.io/l2x6/calculator-ws:1.0")
+ calculatorContainer = new GenericContainer<>("quay.io/l2x6/calculator-ws:1.1")
.withExposedPorts(WILDFLY_PORT)
.withLogConsumer(new Slf4jLogConsumer(log))
.waitingFor(Wait.forHttp("/calculator-ws/CalculatorService?wsdl"));
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
index 236c35295f..ad9d1cb0e4 100644
--- 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
@@ -17,7 +17,6 @@
package org.apache.camel.quarkus.component.cxf.soap.client.it;
import java.io.IOException;
-import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -30,6 +29,7 @@ import org.eclipse.microprofile.config.ConfigProvider;
import org.hamcrest.CoreMatchers;
import org.hamcrest.Matchers;
import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.Assumptions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
@@ -48,6 +48,7 @@ class CxfSoapClientTest {
.queryParam("a", "9")
.queryParam("b", "3")
.queryParam("endpointUri", endpointUri)
+ .queryParam("operation", "divide")
.post("/cxf-soap/client/simple")
.then()
.statusCode(201)
@@ -91,16 +92,9 @@ class CxfSoapClientTest {
.getValue("camel-quarkus.it.calculator.baseUri", String.class);
final String wsdlRelPath = "wsdl/CalculatorService.wsdl";
- final Path staticCopyPath = Paths.get("target/classes/" + wsdlRelPath);
- if (!Files.isRegularFile(staticCopyPath)) {
- /* The test is run inside Quarkus Platform
- * and the resource is not available in the filesystem
- * So let's copy it */
- Files.createDirectories(staticCopyPath.getParent());
- try (InputStream in = getClass().getClassLoader().getResourceAsStream(wsdlRelPath)) {
- Files.copy(in, staticCopyPath);
- }
- }
+ final Path staticCopyPath = Paths.get("src/main/resources/" + wsdlRelPath);
+ Assumptions.assumeTrue(Files.isRegularFile(staticCopyPath),
+ staticCopyPath + " does not exist - we probably run inside Quarkus Platform");
/* The changing Docker IP address in the WSDL should not matter */
final String sanitizerRegex = "<soap:address location=\"http://[^/]*/calculator-ws/CalculatorService\"></soap:address>";
diff --git a/integration-test-groups/cxf-soap/cxf-soap-ws-security-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/wss/client/it/CxfSoapWssClientTest.java b/integration-test-groups/cxf-soap/cxf-soap-ws-security-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/wss/client/it/CxfSoapWssClientTest.java
index ca35e586f8..24f0d3ced6 100644
--- a/integration-test-groups/cxf-soap/cxf-soap-ws-security-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/wss/client/it/CxfSoapWssClientTest.java
+++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/wss/client/it/CxfSoapWssClientTest.java
@@ -17,7 +17,6 @@
package org.apache.camel.quarkus.component.cxf.soap.wss.client.it;
import java.io.IOException;
-import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -28,6 +27,7 @@ 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.Assumptions;
import org.junit.jupiter.api.Test;
import static org.hamcrest.Matchers.equalTo;
@@ -59,16 +59,10 @@ class CxfSoapWssClientTest {
.getValue("camel-quarkus.it.wss.client.baseUri", String.class);
final String wsdlRelPath = "wsdl/WssCalculatorService.wsdl";
- final Path staticCopyPath = Paths.get("target/classes/" + wsdlRelPath);
- if (!Files.isRegularFile(staticCopyPath)) {
- /* The test is run inside Quarkus Platform
- * and the resource is not available in the filesystem
- * So let's copy it */
- Files.createDirectories(staticCopyPath.getParent());
- try (InputStream in = getClass().getClassLoader().getResourceAsStream(wsdlRelPath)) {
- Files.copy(in, staticCopyPath);
- }
- }
+ final Path staticCopyPath = Paths.get("src/main/resources/" + wsdlRelPath);
+ Assumptions.assumeTrue(Files.isRegularFile(staticCopyPath),
+ staticCopyPath + " does not exist - we probably run inside Quarkus Platform");
+
/* 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
diff --git a/integration-test-groups/cxf-soap/cxf-soap-ws-security-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/wss/client/it/CxfWssClientTestResource.java b/integration-test-groups/cxf-soap/cxf-soap-ws-security-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/wss/client/it/CxfWssClientTestResource.java
index 94412b124d..3e70613e19 100644
--- a/integration-test-groups/cxf-soap/cxf-soap-ws-security-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/wss/client/it/CxfWssClientTestResource.java
+++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security-client/src/test/java/org/apache/camel/quarkus/component/cxf/soap/wss/client/it/CxfWssClientTestResource.java
@@ -40,7 +40,7 @@ public class CxfWssClientTestResource implements QuarkusTestResourceLifecycleMan
try {
try {
- calculatorContainer = new GenericContainer<>("quay.io/l2x6/calculator-ws:1.0")
+ calculatorContainer = new GenericContainer<>("quay.io/l2x6/calculator-ws:1.1")
.withEnv("WSS_USER", user)
.withEnv("WSS_PASSWORD", password)
.withLogConsumer(new Slf4jLogConsumer(log))