You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2022/06/22 17:58:45 UTC

[cxf] 01/02: Fix ws-discovery-api test on MacOS on M1

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

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

commit 2ce86e64d1ff695b93a958ec327c81c933b78565
Author: Daniel Kulp <da...@kulp.com>
AuthorDate: Wed Jun 22 12:14:14 2022 -0400

    Fix ws-discovery-api test on MacOS on M1
---
 .../java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java   | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java b/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
index aa8f8684a9..93a6b38c55 100644
--- a/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
+++ b/services/ws-discovery/ws-discovery-api/src/test/java/org/apache/cxf/ws/discovery/WSDiscoveryClientTest.java
@@ -84,7 +84,6 @@ public final class WSDiscoveryClientTest {
             System.out.println("Skipping MultiResponse test for REL");
             return;
         }
-
         Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
         int count = 0;
         if (interfaces != null) {
@@ -108,8 +107,10 @@ public final class WSDiscoveryClientTest {
                     //fake a discovery server to send back some canned messages.
                     InetAddress address = InetAddress.getByName("239.255.255.250");
                     MulticastSocket s = new MulticastSocket(Integer.parseInt(PORT));
+                    if (!"Mac OS X".equals(System.getProperties().getProperty("os.name"))) {
+                        s.setNetworkInterface(findIpv4Interface());
+                    }
                     s.setBroadcast(true);
-                    s.setNetworkInterface(findIpv4Interface());
                     s.setLoopbackMode(false);
                     s.setReuseAddress(true);
                     s.joinGroup(address);
@@ -120,8 +121,7 @@ public final class WSDiscoveryClientTest {
                     s.receive(p);
                     SocketAddress sa = p.getSocketAddress();
                     String incoming = new String(p.getData(), 0, p.getLength(), StandardCharsets.UTF_8);
-                    int idx = incoming.indexOf("MessageID");
-                    idx = incoming.indexOf('>', idx);
+                    int idx = incoming.indexOf('>', incoming.indexOf("MessageID"));
                     incoming = incoming.substring(idx + 1);
                     idx = incoming.indexOf("</");
                     incoming = incoming.substring(0, idx);