[hornetq-commits] JBoss hornetq SVN: r11237 - branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Aug 29 16:10:05 EDT 2011


Author: clebert.suconic at jboss.com
Date: 2011-08-29 16:10:05 -0400 (Mon, 29 Aug 2011)
New Revision: 11237

Modified:
   branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
   branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
   branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java
   branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
   branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterTest.java
Log:
speeding up tests

Modified: branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java	2011-08-29 19:59:41 UTC (rev 11236)
+++ branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusterTestBase.java	2011-08-29 20:10:05 UTC (rev 11237)
@@ -73,7 +73,7 @@
  */
 public abstract class ClusterTestBase extends ServiceTestBase
 {
-   private static final Logger log = Logger.getLogger(ClusterTestBase.class);
+   private final Logger log = Logger.getLogger(this.getClass());
 
    private static final int[] PORTS = { TransportConstants.DEFAULT_PORT,
                                        TransportConstants.DEFAULT_PORT + 1,
@@ -116,9 +116,6 @@
 
       locators = new ServerLocator[ClusterTestBase.MAX_SERVERS];
 
-      // To make sure the test will start with a clean VM
-      forceGC();
-
    }
 
    @Override
@@ -247,7 +244,7 @@
       while (System.currentTimeMillis() - start < ClusterTestBase.WAIT_TIMEOUT);
       String msg = "Timed out waiting for server starting = " + node;
 
-      ClusterTestBase.log.error(msg);
+      log.error(msg);
 
       throw new IllegalStateException(msg);
    }
@@ -283,7 +280,7 @@
                    topology +
                    ")";
 
-      ClusterTestBase.log.error(msg);
+      log.error(msg);
 
       throw new Exception(msg);
    }
@@ -359,7 +356,7 @@
                    ")" +
                    ")";
 
-      ClusterTestBase.log.error(msg);
+      log.error(msg);
 
       Bindings bindings = po.getBindingsForAddress(new SimpleString(address));
 
@@ -772,7 +769,7 @@
 
             if (message == null)
             {
-               ClusterTestBase.log.info("*** dumping consumers:");
+               log.info("*** dumping consumers:");
 
                dumpConsumers();
 
@@ -873,7 +870,7 @@
 
             if (message == null)
             {
-               ClusterTestBase.log.info("*** dumping consumers:");
+               log.info("*** dumping consumers:");
 
                dumpConsumers();
 
@@ -920,7 +917,7 @@
       {
          if (consumers[i] != null && !consumers[i].consumer.isClosed())
          {
-            ClusterTestBase.log.info("Dumping consumer " + i);
+            log.info("Dumping consumer " + i);
 
             checkReceive(i);
          }
@@ -984,13 +981,13 @@
 
             if (message != null)
             {
-               ClusterTestBase.log.info("check receive Consumer " + consumerID +
+               log.info("check receive Consumer " + consumerID +
                                         " received message " +
                                         message.getObjectProperty(ClusterTestBase.COUNT_PROP));
             }
             else
             {
-               ClusterTestBase.log.info("check receive Consumer " + consumerID + " null message");
+               log.info("check receive Consumer " + consumerID + " null message");
             }
          }
          while (message != null);
@@ -2030,7 +2027,7 @@
          timeStarts[node] = System.currentTimeMillis();
          
          servers[node].setIdentity("server " + node);
-         ClusterTestBase.log.info("starting server " + servers[node]);
+         log.info("starting server " + servers[node]);
          servers[node].start();
          
 //         for (int i = 0 ; i <= node; i++)
@@ -2038,9 +2035,9 @@
 //            System.out.println(servers[node].getClusterManager().getTopology().describe());
 //         }
 
-         ClusterTestBase.log.info("started server " + servers[node]);
+         log.info("started server " + servers[node]);
 
-         ClusterTestBase.log.info("started server " + node);
+         log.info("started server " + node);
 
          waitForServer(servers[node]);
 
@@ -2082,13 +2079,13 @@
 
                timeStarts[node] = System.currentTimeMillis();
                
-               ClusterTestBase.log.info("stopping server " + node);
+               log.info("stopping server " + node);
                servers[node].stop();
-               ClusterTestBase.log.info("server " + node + " stopped");
+               log.info("server " + node + " stopped");
             }
             catch (Exception e)
             {
-               ClusterTestBase.log.warn(e.getMessage(), e);
+               log.warn(e.getMessage(), e);
             }
          }
       }

Modified: branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java	2011-08-29 19:59:41 UTC (rev 11236)
+++ branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java	2011-08-29 20:10:05 UTC (rev 11237)
@@ -97,9 +97,7 @@
       setupCluster();
 
       startServers(0, 1, 2, 3, 4);
-      
-      Thread.sleep(1000);
-
+ 
       setupSessionFactory(0, isNetty());
       setupSessionFactory(1, isNetty());
       setupSessionFactory(2, isNetty());

Modified: branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java	2011-08-29 19:59:41 UTC (rev 11236)
+++ branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/OneWayChainClusterTest.java	2011-08-29 20:10:05 UTC (rev 11237)
@@ -88,13 +88,6 @@
 
       waitForBindings(0, "queues.testaddress", 1, 1, true);
       
-      Thread.sleep(2000);
-      System.out.println(clusterDescription(servers[0]));
-      System.out.println(clusterDescription(servers[1]));
-      System.out.println(clusterDescription(servers[2]));
-      System.out.println(clusterDescription(servers[3]));
-      System.out.println(clusterDescription(servers[4]));
-      
       waitForBindings(0, "queues.testaddress", 1, 1, false);
 
       send(0, "queues.testaddress", 10, false, null);
@@ -323,8 +316,6 @@
 
       stopServers(2);
 
-      Thread.sleep(2000);
-
       log.info("============================================ after stop");
       log.info(clusterDescription(servers[0]));
       log.info(clusterDescription(servers[1]));
@@ -333,8 +324,6 @@
 
       startServers(2);
 
-      Thread.sleep(2000);
-
       log.info("============================================ after start");
       log.info(clusterDescription(servers[0]));
       log.info(clusterDescription(servers[1]));
@@ -358,7 +347,6 @@
       setupClusterConnection("cluster4-X", 4, -1, "queues", false, 4, isNetty(), true);
 
       startServers(0, 1, 2, 3, 4);
-      Thread.sleep(2000);
       Set<ClusterConnection> connectionSet = getServer(0).getClusterManager().getClusterConnections();
       assertNotNull(connectionSet);
       assertEquals(1, connectionSet.size());

Modified: branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java	2011-08-29 19:59:41 UTC (rev 11236)
+++ branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java	2011-08-29 20:10:05 UTC (rev 11237)
@@ -72,7 +72,7 @@
       startServers(0);
 
       // Give it a little time for the bridge to try to start
-      Thread.sleep(2000);
+      Thread.sleep(500);
 
       stopServers(0);
    }
@@ -102,7 +102,11 @@
    public void testStartSourceServerBeforeTargetServer() throws Exception
    {
       startServers(0, 1);
+      
+      waitForTopology(servers[0], 2);
+      waitForTopology(servers[1], 2);
 
+
       setupSessionFactory(0,  isNetty(), true);
       setupSessionFactory(1,  isNetty(), true);
 
@@ -124,6 +128,13 @@
    public void testStopAndStartTarget() throws Exception
    {
       startServers(0, 1);
+      
+      waitForTopology(servers[0], 2);
+      waitForTopology(servers[1], 2);
+      
+      System.out.println(servers[0].getClusterManager().getTopology().describe());
+      
+      System.out.println(servers[1].getClusterManager().getTopology().describe());
 
       setupSessionFactory(0,  isNetty(), true);
       setupSessionFactory(1,  isNetty(), true);
@@ -150,12 +161,14 @@
       OnewayTwoNodeClusterTest.log.info("stopping server 1");
 
       stopServers(1);
+      
+      waitForTopology(servers[0], 1);
 
       OnewayTwoNodeClusterTest.log.info("restarting server 1(" + servers[1].getIdentity() + ")");
 
       startServers(1);
       
-      //Thread.sleep(1000);
+      waitForTopology(servers[0], 2);
       
       log.info("Server 1 id="  + servers[1].getNodeID());
       

Modified: branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterTest.java
===================================================================
--- branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterTest.java	2011-08-29 19:59:41 UTC (rev 11236)
+++ branches/Branch_2_2_EAP_cluster_clean3/tests/src/org/hornetq/tests/integration/cluster/distribution/SymmetricClusterTest.java	2011-08-29 20:10:05 UTC (rev 11237)
@@ -1085,9 +1085,14 @@
    public void testRouteWhenNoConsumersFalseNoLocalConsumerLoadBalancedQueues() throws Exception
    {
       setupCluster(false);
-
+      
       startServers();
 
+      for (int i = 0 ; i <= 4; i++)
+      {
+         waitForTopology(servers[i], 5);
+      }
+
       setupSessionFactory(0, isNetty());
       setupSessionFactory(1, isNetty());
       setupSessionFactory(2, isNetty());
@@ -1241,10 +1246,6 @@
       waitForBindings(3, "queues.testaddress", 4, 4, false);
       waitForBindings(4, "queues.testaddress", 4, 4, false);
 
-      // this.checkReceive(0, 1, 2, 3, 4);
-
-      // Thread.sleep(300000);
-
       verifyReceiveAll(10, 0, 1, 2, 3, 4);
    }
 
@@ -1470,7 +1471,6 @@
       waitForBindings(3, "queues.testaddress", 6, 6, true);
       waitForBindings(4, "queues.testaddress", 7, 7, true);
 
-      Thread.sleep(2000);
       System.out.println("#####################################");
       System.out.println(clusterDescription(servers[0]));
       System.out.println(clusterDescription(servers[1]));



More information about the hornetq-commits mailing list