[jboss-cvs] JBoss Messaging SVN: r2844 - in trunk/tests/src/org/jboss/test/messaging: jms/clustering and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 5 01:42:37 EDT 2007


Author: clebert.suconic at jboss.com
Date: 2007-07-05 01:42:36 -0400 (Thu, 05 Jul 2007)
New Revision: 2844

Modified:
   trunk/tests/src/org/jboss/test/messaging/MessagingTestCase.java
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
Log:
Fixing test

Modified: trunk/tests/src/org/jboss/test/messaging/MessagingTestCase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/MessagingTestCase.java	2007-07-05 01:31:15 UTC (rev 2843)
+++ trunk/tests/src/org/jboss/test/messaging/MessagingTestCase.java	2007-07-05 05:42:36 UTC (rev 2844)
@@ -316,6 +316,29 @@
    	}
    }
 
+   protected Connection createConnectionOnServer(ConnectionFactory factory, int serverId, String user, String password)
+   throws Exception
+   {
+   	int count=0;
+
+   	while (true)
+   	{
+   		if (count++>10)
+   			return null;
+
+   		Connection connection = factory.createConnection(user, password);
+
+   		if (getServerId(connection) == serverId)
+   		{
+   			return connection;
+   		}
+   		else
+   		{
+   			connection.close();
+   		}
+   	}
+   }
+
    protected XAConnection createXAConnectionOnServer(XAConnectionFactory factory, int serverId)
    throws Exception
    {

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java	2007-07-05 01:31:15 UTC (rev 2843)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/FailoverTest.java	2007-07-05 05:42:36 UTC (rev 2844)
@@ -2061,22 +2061,14 @@
       {
          if (userName!=null)
          {
-            conn = cf.createConnection(userName, password);
+            conn = createConnectionOnServer(cf, 1, userName, password);
          }
          else
          {
-            conn = cf.createConnection();
+            conn = createConnectionOnServer(cf, 1);
          }
          conn.close();
 
-         if (userName!=null)
-         {
-            conn = cf.createConnection(userName, password);
-         }
-         else
-         {
-            conn = cf.createConnection();
-         }
          conn.start();
 
          // Disable Lease for this test.. as the ValveAspect should capture this
@@ -2084,8 +2076,7 @@
 
          // make sure we're connecting to node 1
 
-         int nodeID = ((ConnectionState)((DelegateSupport)((JBossConnection)conn).
-            getDelegate()).getState()).getServerID();
+         int nodeID = getServerId(conn);
 
          assertEquals(1, nodeID);
 




More information about the jboss-cvs-commits mailing list