You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by pp...@apache.org on 2023/04/12 16:51:59 UTC

[camel-quarkus] 01/02: #4291 avoid In/Out Message soap headers conflict

This is an automated email from the ASF dual-hosted git repository.

ppalaga pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit adb626918b04cb3c0959f78802d21a2aedef6d0c
Author: Freeman Fang <fr...@gmail.com>
AuthorDate: Tue Apr 11 15:24:48 2023 -0400

    #4291 avoid In/Out Message soap headers conflict
---
 .../server/it/WsSecurityPolicyServerRoutes.java             | 13 +++++++++----
 .../server/it/CxfWssSecurityPolicyServerTest.java           |  4 +---
 .../cxf/soap/it/ws/trust/server/WsTrustServerRoutes.java    | 12 +++++++++---
 .../component/cxf/soap/it/ws/trust/CxfWsTrustTest.java      |  2 --
 4 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/integration-test-groups/cxf-soap/cxf-soap-ws-security-server/src/main/java/org/apache/camel/quarkus/component/cxf/soap/securitypolicy/server/it/WsSecurityPolicyServerRoutes.java b/integration-test-groups/cxf-soap/cxf-soap-ws-security-server/src/main/java/org/apache/camel/quarkus/component/cxf/soap/securitypolicy/server/it/WsSecurityPolicyServerRoutes.java
index 40a9bc93cf..fbe5c86813 100644
--- a/integration-test-groups/cxf-soap/cxf-soap-ws-security-server/src/main/java/org/apache/camel/quarkus/component/cxf/soap/securitypolicy/server/it/WsSecurityPolicyServerRoutes.java
+++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security-server/src/main/java/org/apache/camel/quarkus/component/cxf/soap/securitypolicy/server/it/WsSecurityPolicyServerRoutes.java
@@ -19,9 +19,12 @@ package org.apache.camel.quarkus.component.cxf.soap.securitypolicy.server.it;
 import jakarta.enterprise.context.ApplicationScoped;
 import jakarta.enterprise.inject.Produces;
 import jakarta.inject.Named;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.cxf.jaxws.CxfEndpoint;
 import org.apache.cxf.ext.logging.LoggingFeature;
+import org.apache.cxf.headers.Header;
 
 @ApplicationScoped
 public class WsSecurityPolicyServerRoutes extends RouteBuilder {
@@ -29,10 +32,12 @@ public class WsSecurityPolicyServerRoutes extends RouteBuilder {
     @Override
     public void configure() {
 
-        from("cxf:bean:wsSecurityPolicyHelloService?dataFormat=POJO")
-                .log("exchange: ${exchange}")
-                .setBody(exchange -> "Secure good morning " + exchange.getMessage().getBody(String.class));
-
+        from("cxf:bean:wsSecurityPolicyHelloService?dataFormat=POJO").process(new Processor() {
+            public void process(final Exchange exchange) throws Exception {
+                exchange.getIn().removeHeader(Header.HEADER_LIST);
+                exchange.getMessage().setBody("Secure good morning " + exchange.getMessage().getBody(String.class));
+            }
+        });
     }
 
     @Produces
diff --git a/integration-test-groups/cxf-soap/cxf-soap-ws-security-server/src/test/java/org/apache/camel/quarkus/component/cxf/soap/securitypolicy/server/it/CxfWssSecurityPolicyServerTest.java b/integration-test-groups/cxf-soap/cxf-soap-ws-security-server/src/test/java/org/apache/camel/quarkus/component/cxf/soap/securitypolicy/server/it/CxfWssSecurityPolicyServerTest.java
index 0b07fd590f..118ae27b60 100644
--- a/integration-test-groups/cxf-soap/cxf-soap-ws-security-server/src/test/java/org/apache/camel/quarkus/component/cxf/soap/securitypolicy/server/it/CxfWssSecurityPolicyServerTest.java
+++ b/integration-test-groups/cxf-soap/cxf-soap-ws-security-server/src/test/java/org/apache/camel/quarkus/component/cxf/soap/securitypolicy/server/it/CxfWssSecurityPolicyServerTest.java
@@ -28,7 +28,6 @@ import org.apache.cxf.ws.security.SecurityConstants;
 import org.assertj.core.api.Assertions;
 import org.hamcrest.CoreMatchers;
 import org.hamcrest.Matchers;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import static io.quarkiverse.cxf.test.QuarkusCxfClientTestUtil.anyNs;
@@ -38,7 +37,6 @@ import static io.restassured.RestAssured.given;
 public class CxfWssSecurityPolicyServerTest {
 
     @Test
-    @Disabled("https://github.com/apache/camel-quarkus/issues/4291")
     void encrypetdSigned() throws IOException {
         WssSecurityPolicyHelloService client = getPlainClient();
 
@@ -51,7 +49,7 @@ public class CxfWssSecurityPolicyServerTest {
         ctx.put(SecurityConstants.ENCRYPT_PROPERTIES,
                 Thread.currentThread().getContextClassLoader().getResource("alice.properties"));
 
-        Assertions.assertThat(client.sayHello("foo")).isEqualTo("Secure Hello foo!");
+        Assertions.assertThat(client.sayHello("foo")).isEqualTo("Secure good morning foo");
     }
 
     @Test
diff --git a/integration-test-groups/cxf-soap/cxf-soap-ws-trust/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/ws/trust/server/WsTrustServerRoutes.java b/integration-test-groups/cxf-soap/cxf-soap-ws-trust/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/ws/trust/server/WsTrustServerRoutes.java
index efc0d903bf..a9fc23ce53 100644
--- a/integration-test-groups/cxf-soap/cxf-soap-ws-trust/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/ws/trust/server/WsTrustServerRoutes.java
+++ b/integration-test-groups/cxf-soap/cxf-soap-ws-trust/src/main/java/org/apache/camel/quarkus/component/cxf/soap/it/ws/trust/server/WsTrustServerRoutes.java
@@ -24,9 +24,12 @@ import javax.xml.namespace.QName;
 import jakarta.enterprise.context.ApplicationScoped;
 import jakarta.enterprise.inject.Produces;
 import jakarta.inject.Named;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.cxf.jaxws.CxfEndpoint;
 import org.apache.cxf.ext.logging.LoggingFeature;
+import org.apache.cxf.headers.Header;
 
 @ApplicationScoped
 public class WsTrustServerRoutes extends RouteBuilder {
@@ -34,9 +37,12 @@ public class WsTrustServerRoutes extends RouteBuilder {
     @Override
     public void configure() {
 
-        from("cxf:bean:wsTrustHelloService?dataFormat=POJO")
-                .setBody().constant("WS-Trust Hello World!");
-
+        from("cxf:bean:wsTrustHelloService?dataFormat=POJO").process(new Processor() {
+            public void process(final Exchange exchange) throws Exception {
+                exchange.getIn().removeHeader(Header.HEADER_LIST);
+                exchange.getMessage().setBody("WS-Trust Hello World!");
+            }
+        });
     }
 
     @Produces
diff --git a/integration-test-groups/cxf-soap/cxf-soap-ws-trust/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/ws/trust/CxfWsTrustTest.java b/integration-test-groups/cxf-soap/cxf-soap-ws-trust/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/ws/trust/CxfWsTrustTest.java
index a9c4f64d14..8be99196da 100644
--- a/integration-test-groups/cxf-soap/cxf-soap-ws-trust/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/ws/trust/CxfWsTrustTest.java
+++ b/integration-test-groups/cxf-soap/cxf-soap-ws-trust/src/test/java/org/apache/camel/quarkus/component/cxf/soap/it/ws/trust/CxfWsTrustTest.java
@@ -35,7 +35,6 @@ import org.apache.cxf.ws.security.trust.STSClient;
 import org.assertj.core.api.Assertions;
 import org.hamcrest.CoreMatchers;
 import org.hamcrest.Matchers;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
 import static io.quarkiverse.cxf.test.QuarkusCxfClientTestUtil.anyNs;
@@ -90,7 +89,6 @@ public class CxfWsTrustTest {
     }
 
     @Test
-    @Disabled("https://github.com/apache/camel-quarkus/issues/4291")
     public void programmaticSts() throws Exception {
         Bus bus = BusFactory.newInstance().createBus();
         try {