[hornetq-commits] JBoss hornetq SVN: r9112 - in trunk: tests/src/org/hornetq/tests/integration/discovery and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Wed Apr 14 08:26:07 EDT 2010


Author: timfox
Date: 2010-04-14 08:26:06 -0400 (Wed, 14 Apr 2010)
New Revision: 9112

Modified:
   trunk/build-hornetq.xml
   trunk/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-342

Modified: trunk/build-hornetq.xml
===================================================================
--- trunk/build-hornetq.xml	2010-04-14 12:09:00 UTC (rev 9111)
+++ trunk/build-hornetq.xml	2010-04-14 12:26:06 UTC (rev 9112)
@@ -161,7 +161,7 @@
    <property name="thirdparty.dir" value="thirdparty"/>
    <property name="test.build.dir" value="${test.dir}/build"/>
    <property name="test.src.dir" value="${test.dir}/src"/>
-   <property name="test-mask" value="*Test"/>
+   <property name="test-mask" value="DiscoveryTest"/>
    <property name="test.classes.dir" value="${test.build.dir}/classes"/>
    <property name="test.output.dir" value="${test.dir}/build"/>
    <property name="test.reports.dir" value="${test.output.dir}/reports"/>

Modified: trunk/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java	2010-04-14 12:09:00 UTC (rev 9111)
+++ trunk/tests/src/org/hornetq/tests/integration/discovery/DiscoveryTest.java	2010-04-14 12:26:06 UTC (rev 9112)
@@ -130,9 +130,11 @@
       //We need to choose a real NIC on the local machine - note this will silently pass if the machine
       //has no usable NIC!
       
-      NetworkInterface ni = null;
       Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
-      while (networkInterfaces.hasMoreElements())
+      
+      InetAddress localAddress = null;
+      
+      outer: while (networkInterfaces.hasMoreElements())
       {
          NetworkInterface networkInterface = networkInterfaces.nextElement();
          if (networkInterface.isLoopback() || networkInterface.isVirtual() || !networkInterface.isUp() ||
@@ -141,21 +143,28 @@
             continue;
          }
          
-         ni = networkInterface;
+         Enumeration<InetAddress> en = networkInterface.getInetAddresses();
          
-         break;
-
+         while (en.hasMoreElements())
+         {
+            InetAddress ia = en.nextElement();
+            
+            if (ia.getAddress().length == 4)
+            {
+               localAddress = ia;
+               
+               break outer;
+            }
+         }
       }
       
-      if (ni == null)
+      if (localAddress == null)
       {
-         log.warn("Can't find NIC");
+         log.warn("Can't find address to use");
          
          return;
       }
       
-      InetAddress localAddress = ni.getInetAddresses().nextElement();
-      
       log.info("Local address is " + localAddress);
 
       BroadcastGroup bg = new BroadcastGroupImpl(nodeID,



More information about the hornetq-commits mailing list