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

coheigea pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/main by this push:
     new fb95f76fbee Fix encrypted properties tests to work with WSS4J 4.0.2 
(#3458)
fb95f76fbee is described below

commit fb95f76fbee1f911238d47bec250b2489cf2b3e9
Author: Colm O hEigeartaigh <[email protected]>
AuthorDate: Thu Sep 10 12:20:09 2026 +0100

    Fix encrypted properties tests to work with WSS4J 4.0.2 (#3458)
---
 .../apache/cxf/systest/ws/action/ActionTest.java   | 45 ++++++++++--------
 .../cxf/systest/ws/fault/ModifiedRequestTest.java  |  4 ++
 .../apache/cxf/systest/ws/x509/X509TokenTest.java  | 54 +++++++++++++---------
 3 files changed, 61 insertions(+), 42 deletions(-)

diff --git 
a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java
 
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java
index 008df6b1c32..4ed202d5bac 100644
--- 
a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java
+++ 
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/action/ActionTest.java
@@ -246,25 +246,32 @@ public class ActionTest extends 
AbstractBusClientServerTestBase {
             return;
         }
 
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = ActionTest.class.getResource(
-                      JavaUtils.isFIPSEnabled() 
-                      ? "client-fips.xml" : "client.xml");
-
-        Bus bus = bf.createBus(busFile.toString());
-        BusFactory.setDefaultBus(bus);
-        BusFactory.setThreadDefaultBus(bus);
-
-        URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, 
"DoubleItEncryptedPasswordPort");
-        DoubleItPortType port =
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(port, PORT);
-        assertEquals(50, port.doubleIt(25));
-
-        ((java.io.Closeable)port).close();
-        bus.shutdown(true);
+        try {
+            if (!JavaUtils.isFIPSEnabled()) {
+                
System.setProperty("org.apache.wss4j.crypto.jasypt.useLegacyDefaultAlgorithm", 
"true");
+            }
+            SpringBusFactory bf = new SpringBusFactory();
+            URL busFile = ActionTest.class.getResource(
+                        JavaUtils.isFIPSEnabled() 
+                        ? "client-fips.xml" : "client.xml");
+
+            Bus bus = bf.createBus(busFile.toString());
+            BusFactory.setDefaultBus(bus);
+            BusFactory.setThreadDefaultBus(bus);
+
+            URL wsdl = ActionTest.class.getResource("DoubleItAction.wsdl");
+            Service service = Service.create(wsdl, SERVICE_QNAME);
+            QName portQName = new QName(NAMESPACE, 
"DoubleItEncryptedPasswordPort");
+            DoubleItPortType port =
+                    service.getPort(portQName, DoubleItPortType.class);
+            updateAddressPort(port, PORT);
+            assertEquals(50, port.doubleIt(25));
+
+            ((java.io.Closeable)port).close();
+            bus.shutdown(true);
+        } finally {
+            
System.clearProperty("org.apache.wss4j.crypto.jasypt.useLegacyDefaultAlgorithm");
+        }
     }
 
     @org.junit.Test
diff --git 
a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/ModifiedRequestTest.java
 
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/ModifiedRequestTest.java
index 4a0833b2808..652fea1a881 100644
--- 
a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/ModifiedRequestTest.java
+++ 
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/fault/ModifiedRequestTest.java
@@ -74,11 +74,15 @@ public class ModifiedRequestTest extends 
AbstractBusClientServerTestBase {
             // set this to false to fork
             launchServer(ModifiedRequestServer.class, true)
         );
+        if (!JavaUtils.isFIPSEnabled()) {
+            
System.setProperty("org.apache.wss4j.crypto.jasypt.useLegacyDefaultAlgorithm", 
"true");
+        }
     }
 
     @org.junit.AfterClass
     public static void cleanup() throws Exception {
         stopAllServers();
+        
System.clearProperty("org.apache.wss4j.crypto.jasypt.useLegacyDefaultAlgorithm");
     }
 
     @org.junit.Test
diff --git 
a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
 
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
index 37bb6a13de7..1be706075d5 100644
--- 
a/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
+++ 
b/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/x509/X509TokenTest.java
@@ -845,33 +845,41 @@ public class X509TokenTest extends 
AbstractBusClientServerTestBase {
             return;
         }
 
-        SpringBusFactory bf = new SpringBusFactory();
-        URL busFile = X509TokenTest.class.getResource(
-                      JavaUtils.isFIPSEnabled() 
-                      ? "client-fips.xml"
-                          : "client.xml");
+        try {
+            if (!JavaUtils.isFIPSEnabled()) {
+                
System.setProperty("org.apache.wss4j.crypto.jasypt.useLegacyDefaultAlgorithm", 
"true");
+            }
 
-        Bus bus = bf.createBus(busFile.toString());
-        BusFactory.setDefaultBus(bus);
-        BusFactory.setThreadDefaultBus(bus);
+            SpringBusFactory bf = new SpringBusFactory();
+            URL busFile = X509TokenTest.class.getResource(
+                        JavaUtils.isFIPSEnabled() 
+                        ? "client-fips.xml"
+                            : "client.xml");
+
+            Bus bus = bf.createBus(busFile.toString());
+            BusFactory.setDefaultBus(bus);
+            BusFactory.setThreadDefaultBus(bus);
+
+            URL wsdl = 
X509TokenTest.class.getResource(JavaUtils.isFIPSEnabled()
+                                                    ? "DoubleItX509-fips.wsdl"
+                                                        : "DoubleItX509.wsdl");
+            Service service = Service.create(wsdl, SERVICE_QNAME);
+            QName portQName = new QName(NAMESPACE, 
"DoubleItAsymmetricEncryptedPasswordPort");
+            DoubleItPortType x509Port =
+                    service.getPort(portQName, DoubleItPortType.class);
+            updateAddressPort(x509Port, test.getPort());
+
+            if (test.isStreaming()) {
+                SecurityTestUtil.enableStreaming(x509Port);
+            }
 
-        URL wsdl = X509TokenTest.class.getResource(JavaUtils.isFIPSEnabled()
-                                                   ? "DoubleItX509-fips.wsdl"
-                                                       : "DoubleItX509.wsdl");
-        Service service = Service.create(wsdl, SERVICE_QNAME);
-        QName portQName = new QName(NAMESPACE, 
"DoubleItAsymmetricEncryptedPasswordPort");
-        DoubleItPortType x509Port =
-                service.getPort(portQName, DoubleItPortType.class);
-        updateAddressPort(x509Port, test.getPort());
+            assertEquals(50, x509Port.doubleIt(25));
 
-        if (test.isStreaming()) {
-            SecurityTestUtil.enableStreaming(x509Port);
+            ((java.io.Closeable)x509Port).close();
+            bus.shutdown(true);
+        } finally {
+            
System.clearProperty("org.apache.wss4j.crypto.jasypt.useLegacyDefaultAlgorithm");
         }
-
-        assertEquals(50, x509Port.doubleIt(25));
-
-        ((java.io.Closeable)x509Port).close();
-        bus.shutdown(true);
     }
 
     @org.junit.Test

Reply via email to