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 2022/11/10 20:57:28 UTC
[camel-quarkus] 05/05: CxfSoapClientTest.wsdlUpToDate() and CxfSoapWssClientTest.wsdlUpToDate() fail on the platform #4254
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 1b7846dce5fe0a5390df772373e3a4caed733bf8
Author: Peter Palaga <pp...@redhat.com>
AuthorDate: Wed Nov 9 15:29:53 2022 +0100
CxfSoapClientTest.wsdlUpToDate() and CxfSoapWssClientTest.wsdlUpToDate() fail on the platform #4254
---
.../cxf-soap/cxf-soap-client/pom.xml | 1 +
.../cxf/soap/client/it/CxfSoapClientTest.java | 19 ++++++++++++++++---
.../cxf-soap/cxf-soap-ws-security-client/pom.xml | 1 +
.../cxf/soap/wss/client/it/CxfSoapWssClientTest.java | 18 +++++++++++++++---
integration-tests/cxf-soap-grouped/pom.xml | 3 +++
5 files changed, 36 insertions(+), 6 deletions(-)
diff --git a/integration-test-groups/cxf-soap/cxf-soap-client/pom.xml b/integration-test-groups/cxf-soap/cxf-soap-client/pom.xml
index 6e293ce9c4..0d2cc76841 100644
--- a/integration-test-groups/cxf-soap/cxf-soap-client/pom.xml
+++ b/integration-test-groups/cxf-soap/cxf-soap-client/pom.xml
@@ -44,6 +44,7 @@
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/wsdl/CalculatorService.wsdl</wsdl>
+ <wsdlLocation>classpath:wsdl/CalculatorService.wsdl</wsdlLocation>
</wsdlOption>
</wsdlOptions>
</configuration>
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 5f96277b2f..88f7684ee4 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,8 +17,10 @@
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;
import java.nio.file.Paths;
import io.quarkus.test.common.QuarkusTestResource;
@@ -68,11 +70,22 @@ class CxfSoapClientTest {
final String wsdlUrl = ConfigProvider.getConfig()
.getValue("camel-quarkus.it.calculator.baseUri", String.class);
- final String staticCopyPath = "target/classes/wsdl/CalculatorService.wsdl";
+ 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);
+ }
+ }
+
/* 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)
+ .readString(staticCopyPath, StandardCharsets.UTF_8)
.replaceAll(sanitizerRegex, "")
//remove a comment with license
.replaceAll("<!--[.\\s\\S]*?-->", "\n")
@@ -86,7 +99,7 @@ class CxfSoapClientTest {
.extract().body().asString();
if (!expected.replaceAll(sanitizerRegex, "").replaceAll("\\s", "").equals(staticCopyContent)) {
- Files.writeString(Paths.get(staticCopyPath), expected, StandardCharsets.UTF_8);
+ Files.writeString(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-test-groups/cxf-soap/cxf-soap-ws-security-client/pom.xml b/integration-test-groups/cxf-soap/cxf-soap-ws-security-client/pom.xml
index 29fa54e7c3..913fbdfe16 100644
--- a/integration-test-groups/cxf-soap/cxf-soap-ws-security-client/pom.xml
+++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security-client/pom.xml
@@ -44,6 +44,7 @@
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/wsdl/WssCalculatorService.wsdl</wsdl>
+ <wsdlLocation>classpath:wsdl/wsdl/WssCalculatorService.wsdl</wsdlLocation>
</wsdlOption>
</wsdlOptions>
</configuration>
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 45f1b47938..ca35e586f8 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,8 +17,10 @@
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;
import java.nio.file.Paths;
import io.quarkus.test.common.QuarkusTestResource;
@@ -56,11 +58,21 @@ class CxfSoapWssClientTest {
final String wsdlUrl = ConfigProvider.getConfig()
.getValue("camel-quarkus.it.wss.client.baseUri", String.class);
- final String staticCopyPath = "target/classes/wsdl/WssCalculatorService.wsdl";
+ 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);
+ }
+ }
/* 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)
+ .readString(staticCopyPath, StandardCharsets.UTF_8)
.replaceAll(sanitizerRegex, "")
//remove a comment with license
.replaceAll("<!--[.\\s\\S]*?-->", "\n")
@@ -76,7 +88,7 @@ class CxfSoapWssClientTest {
final String expectedContent = expected.replaceAll(sanitizerRegex, "");
if (!expected.replaceAll(sanitizerRegex, "").replaceAll("\\s", "").equals(staticCopyContent)) {
- Files.writeString(Paths.get(staticCopyPath), expectedContent, StandardCharsets.UTF_8);
+ Files.writeString(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-tests/cxf-soap-grouped/pom.xml b/integration-tests/cxf-soap-grouped/pom.xml
index 791ad5b1ff..842e3fa584 100644
--- a/integration-tests/cxf-soap-grouped/pom.xml
+++ b/integration-tests/cxf-soap-grouped/pom.xml
@@ -169,12 +169,15 @@
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/target/classes/wsdl/CalculatorService.wsdl</wsdl>
+ <wsdlLocation>classpath:wsdl/CalculatorService.wsdl</wsdlLocation>
</wsdlOption>
<wsdlOption>
<wsdl>${basedir}/target/classes/wsdl/HelloService.wsdl</wsdl>
+ <wsdlLocation>classpath:wsdl/HelloService.wsdl</wsdlLocation>
</wsdlOption>
<wsdlOption>
<wsdl>${basedir}/target/classes/wsdl/WssCalculatorService.wsdl</wsdl>
+ <wsdlLocation>classpath:wsdl/WssCalculatorService.wsdl</wsdlLocation>
</wsdlOption>
</wsdlOptions>
</configuration>