[jboss-cvs] JBoss Messaging SVN: r2960 - trunk/tests/src/org/jboss/test/messaging/jms/clustering.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Aug 6 13:30:20 EDT 2007


Author: timfox
Date: 2007-08-06 13:30:20 -0400 (Mon, 06 Aug 2007)
New Revision: 2960

Modified:
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/MultiThreadFailoverTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/NoFailoverTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/clustering/RecoverDeliveriesTest.java
Log:
Test speedup


Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/MultiThreadFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/MultiThreadFailoverTest.java	2007-08-06 16:39:25 UTC (rev 2959)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/MultiThreadFailoverTest.java	2007-08-06 17:30:20 UTC (rev 2960)
@@ -79,7 +79,6 @@
     */
    public void testMultiThreadOnReceive() throws Exception
    {
-
       Connection conn1 = cf.createConnection();
       Connection conn2 = cf.createConnection();
       Connection conn3 = cf.createConnection();
@@ -450,6 +449,10 @@
          conn2.close();
 
          conn3.close();
+         
+         this.removeAllMessages(queue[0].getQueueName(), true, 0);
+         this.removeAllMessages(queue[1].getQueueName(), true, 1);
+         this.removeAllMessages(queue[2].getQueueName(), true, 2);
       }
    }
 

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/NoFailoverTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/NoFailoverTest.java	2007-08-06 16:39:25 UTC (rev 2959)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/NoFailoverTest.java	2007-08-06 17:30:20 UTC (rev 2960)
@@ -42,7 +42,7 @@
  * @version <tt>$Revision$</tt>
  *          $Id$
  */
-public class NoFailoverTest extends ClusteringTestBase
+public class NoFailoverTest extends NewClusteringTestBase
 {
 
    // Constants ------------------------------------------------------------------------------------
@@ -133,10 +133,6 @@
          ServerManagement.deployQueue("testDistributedQueue", 1);
          ServerManagement.deployTopic("testDistributedTopic", 1);
 
-
-         // Since there is no active connection, the cf won't be notified about the change on nodes
-         lookups();
-
          conn = createConnectionOnServer(cf, 1);
 
          sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -149,8 +145,6 @@
          rm = (TextMessage) cons.receive(1000);
 
          assertEquals(rm.getText(), "Before Crash");
-
-
       }
       finally
       {
@@ -168,25 +162,11 @@
 
    protected void setUp() throws Exception
    {
-      config = "all-failover";
       this.nodeCount=3;
+      
       super.setUp();
    }
 
-   protected void tearDown() throws Exception
-   {
-      super.tearDown();
-      
-      for (int i = 0; i < nodeCount; i++)
-      {
-         if (ServerManagement.isStarted(i))
-         {
-            ServerManagement.log(ServerManagement.INFO, "Undeploying Server " + i, i);
-            ServerManagement.stop(i);
-         }
-      }
-   }
-
    // Private --------------------------------------------------------------------------------------
 
    // Inner classes --------------------------------------------------------------------------------

Modified: trunk/tests/src/org/jboss/test/messaging/jms/clustering/RecoverDeliveriesTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/clustering/RecoverDeliveriesTest.java	2007-08-06 16:39:25 UTC (rev 2959)
+++ trunk/tests/src/org/jboss/test/messaging/jms/clustering/RecoverDeliveriesTest.java	2007-08-06 17:30:20 UTC (rev 2960)
@@ -36,7 +36,6 @@
 
 import org.jboss.jms.client.FailoverEvent;
 import org.jboss.jms.client.JBossConnection;
-import org.jboss.jms.client.JBossConnectionFactory;
 import org.jboss.jms.client.delegate.ClientClusteredConnectionFactoryDelegate;
 import org.jboss.messaging.util.MessageQueueNameHelper;
 import org.jboss.test.messaging.tools.ServerManagement;
@@ -50,7 +49,7 @@
  * $Id: $
  *
  */
-public class RecoverDeliveriesTest extends ClusteringTestBase
+public class RecoverDeliveriesTest extends NewClusteringTestBase
 {
    
    // Constants -----------------------------------------------------
@@ -140,11 +139,9 @@
    {
    	final long timeout = 20 * 1000;
    	
-   	JBossConnectionFactory factory = (JBossConnectionFactory) ic[0].lookup("/ClusteredConnectionFactory");
+   	((ClientClusteredConnectionFactoryDelegate)cf.getDelegate()).setSupportsFailover(false);
    	
-   	((ClientClusteredConnectionFactoryDelegate)factory.getDelegate()).setSupportsFailover(false);
-   	
-      Connection conn1 = createConnectionOnServer(factory,1);
+      Connection conn1 = createConnectionOnServer(cf,1);
       
       Connection conn2 = null;
  
@@ -189,7 +186,7 @@
       		assertEquals("message" + i, tm.getText());
       	}
       		
-      	int failoverNodeId = this.getFailoverNodeForNode(factory, 1);
+      	int failoverNodeId = this.getFailoverNodeForNode(cf, 1);
       	
       	assertEquals(2, failoverNodeId);
       	
@@ -238,7 +235,7 @@
       	
       	log.info("Creating connection");
       	
-      	conn2 = createConnectionOnServer(factory, failoverNodeId);
+      	conn2 = createConnectionOnServer(cf, failoverNodeId);
                      
        	Session sess2 = conn2.createSession(false, Session.AUTO_ACKNOWLEDGE);
        	
@@ -281,6 +278,8 @@
          {
             conn2.close();
          }
+         
+         ((ClientClusteredConnectionFactoryDelegate)cf.getDelegate()).setSupportsFailover(true);
       }
    }
    
@@ -295,31 +294,13 @@
       nodeCount = 3;
 
       super.setUp();
-
-      log.debug("setup done");
    }
    
-   protected void tearDown() throws Exception
-   {
-      super.tearDown();
-      
-      for (int i = 0; i < nodeCount; i++)
-      {
-         if (ServerManagement.isStarted(i))
-         {
-            ServerManagement.log(ServerManagement.INFO, "Undeploying Server " + i, i);
-            ServerManagement.stop(i);
-         }
-      }
-   }
-   
    // Private -------------------------------------------------------
 
    private void simple(boolean transactional) throws Exception
    {
-   	JBossConnectionFactory factory = (JBossConnectionFactory) ic[0].lookup("/ClusteredConnectionFactory");
-
-      Connection conn1 = createConnectionOnServer(factory,1);
+      Connection conn1 = createConnectionOnServer(cf,1);
  
       try
       {
@@ -361,7 +342,7 @@
       	
       	//Now kill server
       	
-      	int failoverNodeId = this.getFailoverNodeForNode(factory, 1);
+      	int failoverNodeId = this.getFailoverNodeForNode(cf, 1);
       	
       	int recoveryMapSize = ServerManagement.getServer(failoverNodeId).getRecoveryMapSize(queue[failoverNodeId].getQueueName());
       	assertEquals(0, recoveryMapSize);
@@ -447,9 +428,7 @@
    
    private void durableSub(boolean transactional) throws Exception
    {
-   	JBossConnectionFactory factory = (JBossConnectionFactory) ic[0].lookup("/ClusteredConnectionFactory");
-
-      Connection conn1 = createConnectionOnServer(factory,1);
+      Connection conn1 = createConnectionOnServer(cf,1);
  
       try
       {
@@ -503,7 +482,7 @@
       	
       	//Now kill server
       	
-      	int failoverNodeId = this.getFailoverNodeForNode(factory, 1);
+      	int failoverNodeId = this.getFailoverNodeForNode(cf, 1);
       	
       	log.info("Failover node is " + failoverNodeId);
       	
@@ -578,6 +557,8 @@
          tm = (TextMessage)cons1.receive(5000);
       		
       	assertNull(tm);      		
+      	
+      	sess1.unsubscribe(subName);
       }
       finally
       {
@@ -590,9 +571,7 @@
    
    private void cancel(boolean transactional) throws Exception
    {
-   	JBossConnectionFactory factory = (JBossConnectionFactory) ic[0].lookup("/ClusteredConnectionFactory");
-
-      Connection conn1 = createConnectionOnServer(factory,1);
+      Connection conn1 = createConnectionOnServer(cf,1);
  
       try
       {
@@ -632,7 +611,7 @@
       	
       	//Don't ack
       	
-      	int failoverNodeId = this.getFailoverNodeForNode(factory, 1);      	      	
+      	int failoverNodeId = this.getFailoverNodeForNode(cf, 1);      	      	
 
       	int recoveryMapSize = ServerManagement.getServer(failoverNodeId).getRecoveryMapSize(queue[failoverNodeId].getQueueName());
       	assertEquals(0, recoveryMapSize);
@@ -663,6 +642,8 @@
          {
             conn1.close();
          }
+         
+         this.removeAllMessages(queue[0].getQueueName(), true, 1);
       }
    }
    
@@ -670,11 +651,9 @@
    
    private void connectionOnNewNode(boolean transactional) throws Exception
    {
-   	JBossConnectionFactory factory = (JBossConnectionFactory) ic[0].lookup("/ClusteredConnectionFactory");
-
-      Connection conn1 = createConnectionOnServer(factory,1);
+      Connection conn1 = createConnectionOnServer(cf,1);
       
-      Connection conn2 = createConnectionOnServer(factory,2);
+      Connection conn2 = createConnectionOnServer(cf,2);
  
       try
       {
@@ -723,7 +702,7 @@
       	
       	//Now kill server
       	
-      	int failoverNodeId = this.getFailoverNodeForNode(factory, 1);      	
+      	int failoverNodeId = this.getFailoverNodeForNode(cf, 1);      	
       	
       	int recoveryMapSize = ServerManagement.getServer(failoverNodeId).getRecoveryMapSize(queue[failoverNodeId].getQueueName());
       	assertEquals(0, recoveryMapSize);
@@ -811,13 +790,11 @@
    
    private void connectionsOnAllNodes(boolean transactional) throws Exception
    {
-   	JBossConnectionFactory factory = (JBossConnectionFactory) ic[0].lookup("/ClusteredConnectionFactory");
-
-      Connection conn0 = createConnectionOnServer(factory, 0);
+      Connection conn0 = createConnectionOnServer(cf, 0);
       
-      Connection conn1 = createConnectionOnServer(factory, 1);
+      Connection conn1 = createConnectionOnServer(cf, 1);
       
-      Connection conn2 = createConnectionOnServer(factory, 2);
+      Connection conn2 = createConnectionOnServer(cf, 2);
  
       try
       {
@@ -968,7 +945,7 @@
       	
       	//Now kill server
       	
-      	int failoverNodeId = this.getFailoverNodeForNode(factory, 1);    
+      	int failoverNodeId = this.getFailoverNodeForNode(cf, 1);    
       	
       	ServerManagement.kill(1);
 
@@ -1073,24 +1050,6 @@
       }
    }
    
-   /*
-    * Test recoveryArea timeout
-    * 
-    * Create session, consume messages but don't ack
-    * 
-    * kill the server
-    * 
-    * somehow prevent the client failing over. ??
-    * 
-    * assert recovery area is full
-    * 
-    * wait for timeout
-    * 
-    * assert messages can be consumed
-    * 
-    * assert recovery area is empty
-    */
-   
    // Inner classes -------------------------------------------------
    
 }




More information about the jboss-cvs-commits mailing list