[jboss-cvs] JBoss Messaging SVN: r2700 - trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 17 04:58:33 EDT 2007


Author: sergeypk
Date: 2007-05-17 04:58:32 -0400 (Thu, 17 May 2007)
New Revision: 2700

Modified:
   trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/ClusteredPostOfficeConfigurationTest.java
Log:
Remember to stop the post office we start.

Modified: trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/ClusteredPostOfficeConfigurationTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/ClusteredPostOfficeConfigurationTest.java	2007-05-17 05:59:03 UTC (rev 2699)
+++ trunk/tests/src/org/jboss/test/messaging/core/plugin/postoffice/cluster/ClusteredPostOfficeConfigurationTest.java	2007-05-17 08:58:32 UTC (rev 2700)
@@ -9,10 +9,8 @@
 import org.jboss.messaging.core.plugin.postoffice.cluster.DefaultClusteredPostOffice;
 import org.jboss.test.messaging.core.plugin.base.PostOfficeTestBase;
 import org.jgroups.JChannel;
-import org.jgroups.protocols.TP;
 import org.jgroups.protocols.UDP;
 import org.jgroups.stack.Protocol;
-import org.jgroups.stack.ProtocolStack;
 
 // This test assumes that bind_addr is not set in the clustered-*-persistence.xml
 // configuration file!
@@ -80,12 +78,16 @@
    private void assertChannelsBoundTo(InetAddress bindAddress) throws Exception {
       String addressAsString = bindAddress.toString();
       ClusteredPostOffice postOffice = createClusteredPostOfficeSimple();
-
-      JChannel syncChannel = getPostOfficeSyncChannel(postOffice);
-      assertEquals(addressAsString, getUDPBindAddress(syncChannel));
       
-      JChannel asyncChannel = getPostOfficeAsyncChannel(postOffice);
-      assertEquals(addressAsString, getUDPBindAddress(asyncChannel));
+      try {
+         JChannel syncChannel = getPostOfficeSyncChannel(postOffice);
+         assertEquals(addressAsString, getUDPBindAddress(syncChannel));
+         
+         JChannel asyncChannel = getPostOfficeAsyncChannel(postOffice);
+         assertEquals(addressAsString, getUDPBindAddress(asyncChannel));
+      } finally {
+         postOffice.stop();
+      }
    }
 
    public void testNoProperties() throws Exception {
@@ -101,4 +103,16 @@
       System.setProperty(org.jgroups.Global.BIND_ADDR, address);
       assertChannelsBoundTo(InetAddress.getByName(address));
    }
+   
+   public void testIgnoreBindAddressPropertySet() throws Exception {
+      InetAddress defaultAddress = org.jgroups.util.Util.getFirstNonLoopbackAddress();
+      if (defaultAddress == null) {
+         fail("No address available for JGroups to bind to");
+      }
+      
+      String address = "127.0.0.1";
+      System.setProperty(org.jgroups.Global.BIND_ADDR, address);
+      System.setProperty(org.jgroups.Global.IGNORE_BIND_ADDRESS_PROPERTY, "true");
+      assertChannelsBoundTo(defaultAddress);
+   }
 }




More information about the jboss-cvs-commits mailing list