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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jul 19 16:02:31 EDT 2007


Author: timfox
Date: 2007-07-19 16:02:31 -0400 (Thu, 19 Jul 2007)
New Revision: 2914

Modified:
   trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTest.java
   trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java
   trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java
Log:
Speeded up bridge tests


Modified: trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java	2007-07-19 18:47:34 UTC (rev 2913)
+++ trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeMBeanTest.java	2007-07-19 20:02:31 UTC (rev 2914)
@@ -78,45 +78,47 @@
       
    public void testStopStartPauseResume() throws Exception
    {
-      ServerManagement.deployQueue("sourceQueue", 1);
-      ServerManagement.deployQueue("targetQueue", 2);
-      
-      Properties props1 = new Properties();
-      props1.putAll(ServerManagement.getJNDIEnvironment(1));
-      
-      Properties props2 = new Properties();
-      props2.putAll(ServerManagement.getJNDIEnvironment(2));
-      
-      installJMSProviderLoader(0, props1, "/XAConnectionFactory", "adaptor1");
-      
-      installJMSProviderLoader(0, props2, "/XAConnectionFactory", "adaptor2");
-      
-      log.info("Deploying bridge");
-      
-      ObjectName sourceProviderLoader = new ObjectName("jboss.messaging:service=JMSProviderLoader,name=adaptor1");
-      ObjectName targetProviderLoader = new ObjectName("jboss.messaging:service=JMSProviderLoader,name=adaptor2");
-      
-      
-      ObjectName on = deployBridge(0, "Bridge1", sourceProviderLoader, targetProviderLoader,
-                                   "/queue/sourceQueue", "/queue/targetQueue",
-                                   null, null, null, null,
-                                   Bridge.QOS_AT_MOST_ONCE, null, 1,
-                                   -1, null, null, 5000, -1, false);
-      log.info("Deployed bridge");
-      
-      ServerManagement.getServer(0).invoke(on, "create", new Object[0], new String[0]);
-      
-      log.info("Created bridge");
-      
       Connection connSource = null;
       
       Connection connTarget = null;
       
-      InitialContext icSource = new InitialContext(props1);
-      InitialContext icTarget = new InitialContext(props2);
+      ObjectName on = null;
       
-      try
-      {
+   	try
+   	{
+	      ServerManagement.deployQueue("sourceQueue", 1);
+	      ServerManagement.deployQueue("targetQueue", 2);
+	      
+	      Properties props1 = new Properties();
+	      props1.putAll(ServerManagement.getJNDIEnvironment(1));
+	      
+	      Properties props2 = new Properties();
+	      props2.putAll(ServerManagement.getJNDIEnvironment(2));
+	      
+	      installJMSProviderLoader(0, props1, "/XAConnectionFactory", "adaptor1");
+	      
+	      installJMSProviderLoader(0, props2, "/XAConnectionFactory", "adaptor2");
+	      
+	      log.info("Deploying bridge");
+	      
+	      ObjectName sourceProviderLoader = new ObjectName("jboss.messaging:service=JMSProviderLoader,name=adaptor1");
+	      ObjectName targetProviderLoader = new ObjectName("jboss.messaging:service=JMSProviderLoader,name=adaptor2");
+	      
+	      
+	      on = deployBridge(0, "Bridge1", sourceProviderLoader, targetProviderLoader,
+	                                   "/queue/sourceQueue", "/queue/targetQueue",
+	                                   null, null, null, null,
+	                                   Bridge.QOS_AT_MOST_ONCE, null, 1,
+	                                   -1, null, null, 5000, -1, false);
+	      log.info("Deployed bridge");
+	      
+	      ServerManagement.getServer(0).invoke(on, "create", new Object[0], new String[0]);
+	      
+	      log.info("Created bridge");
+	      
+	      InitialContext icSource = new InitialContext(props1);
+	      InitialContext icTarget = new InitialContext(props2);
+      
          ConnectionFactory cf0 = (ConnectionFactory)icSource.lookup("/XAConnectionFactory");
          
          ConnectionFactory cf1 = (ConnectionFactory)icTarget.lookup("/XAConnectionFactory");
@@ -277,13 +279,35 @@
          
          try
          {
-            ServerManagement.getServer(0).invoke(on, "destroy", new Object[0], new String[0]);
+         	if (on != null)
+         	{
+         		ServerManagement.getServer(0).invoke(on, "stop", new Object[0], new String[0]);
+         		ServerManagement.getServer(0).invoke(on, "destroy", new Object[0], new String[0]);
+         	}
          }
          catch(Exception e)
          {
             //Ignore            
          }
          
+         try
+         {
+         	ServerManagement.undeployQueue("sourceQueue", 1);   	       
+         }
+         catch (Exception e)
+         {
+         	//Ignore
+         }
+         
+         try
+         {
+         	ServerManagement.undeployQueue("targetQueue", 2);
+         }
+         catch (Exception e)
+         {
+         	//Ignore
+         }
+         
          uninstallJMSProviderLoader(0, "adaptor1");
          
          uninstallJMSProviderLoader(0,  "adaptor2");
@@ -291,14 +315,14 @@
    }
          
    public void testDeploy() throws Exception
-   {
-      ServerManagement.deployQueue("sourceQueue", 1);
-      ServerManagement.deployQueue("targetQueue", 2);
-      
+   {      
       ObjectName on = null;
       
       try
-      {         
+      {       
+      	ServerManagement.deployQueue("sourceQueue", 1);
+         ServerManagement.deployQueue("targetQueue", 2);
+                  
          Thread.sleep(5000);
          
          Properties props1 = new Properties();
@@ -314,7 +338,7 @@
          ObjectName sourceProviderLoader = new ObjectName("jboss.messaging:service=JMSProviderLoader,name=adaptor1");
          ObjectName targetProviderLoader = new ObjectName("jboss.messaging:service=JMSProviderLoader,name=adaptor2");
          
-         on = deployBridge(0, "Bridge1", sourceProviderLoader, targetProviderLoader,
+         on = deployBridge(0, "Bridge2", sourceProviderLoader, targetProviderLoader,
                            "/queue/sourceQueue", "/queue/targetQueue",
                            null, null, null, null,
                            Bridge.QOS_ONCE_AND_ONLY_ONCE, null, 1,
@@ -630,9 +654,24 @@
             //Ignore            
          }         
          
-         ServerManagement.undeployQueue("sourceQueue", 1);
-         ServerManagement.undeployQueue("targetQueue", 2);
+         try
+         {
+         	ServerManagement.undeployQueue("sourceQueue", 1);   	       
+         }
+         catch (Exception e)
+         {
+         	//Ignore
+         }
          
+         try
+         {
+         	ServerManagement.undeployQueue("targetQueue", 2);
+         }
+         catch (Exception e)
+         {
+         	//Ignore
+         }
+         
          uninstallJMSProviderLoader(0, "adaptor1");
          
          uninstallJMSProviderLoader(0, "adaptor2");

Modified: trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTest.java	2007-07-19 18:47:34 UTC (rev 2913)
+++ trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTest.java	2007-07-19 20:02:31 UTC (rev 2914)
@@ -663,7 +663,7 @@
             
          this.checkAllMessageReceivedInOrder(cf1, destQueue, 0, NUM_MESSAGES);
          
-         this.checkNoneReceived(cf1, destQueue, 5000);
+         this.checkNoneReceived(cf1, destQueue, 2000);
                                 
       }
       finally
@@ -720,7 +720,7 @@
          
          checkAllMessageReceivedInOrder(cf1, destQueue, 0, NUM_MESSAGES);
          
-         this.checkNoneReceived(cf1, destQueue, 5000);                       
+         this.checkNoneReceived(cf1, destQueue, 2000);                       
       }
       finally
       {                        
@@ -753,7 +753,7 @@
          
          checkAllMessageReceivedInOrder(cf1, destQueue, 0, NUM_MESSAGES);
          
-         this.checkNoneReceived(cf1, destQueue, 5000);
+         this.checkNoneReceived(cf1, destQueue, 2000);
                        
       }
       finally
@@ -791,7 +791,7 @@
                          
          //Verify none are received
          
-         this.checkNoneReceived(cf1, destQueue, 5000);
+         this.checkNoneReceived(cf1, destQueue, 2000);
          
          log.info("Waiting");
          Thread.sleep(120000);
@@ -805,9 +805,9 @@
          this.checkAllMessageReceivedInOrder(cf1, destQueue, 0, NUM_MESSAGES);
                   
          
-         this.checkNoneReceived(cf1, destQueue, 5000);         
+         this.checkNoneReceived(cf1, destQueue, 2000);         
          
-         this.checkNoneReceived(cf0, sourceQueue, 5000);
+         this.checkNoneReceived(cf0, sourceQueue, 2000);
       }
       finally
       {      
@@ -1096,9 +1096,9 @@
          
          this.checkAllMessageReceivedInOrder(cf1, destQueue, 0, NUM_MESSAGES);
          
-         this.checkNoneReceived(cf1, destQueue, 5000);
+         this.checkNoneReceived(cf1, destQueue, 2000);
          
-         this.checkNoneReceived(cf0, sourceQueue, 5000);
+         this.checkNoneReceived(cf0, sourceQueue, 2000);
                                       
          t.join();
          
@@ -1176,9 +1176,9 @@
          
          this.checkAllMessageReceivedInOrder(cf0, localDestQueue, 0, NUM_MESSAGES);
          
-         this.checkNoneReceived(cf0, localDestQueue, 5000);
+         this.checkNoneReceived(cf0, localDestQueue, 2000);
          
-         this.checkNoneReceived(cf0, sourceQueue, 5000);
+         this.checkNoneReceived(cf0, sourceQueue, 2000);
                           
          t.join();
          
@@ -1240,7 +1240,7 @@
                          
          //Verify none are received
          
-         this.checkNoneReceived(cf1, destQueue, 5000);
+         this.checkNoneReceived(cf1, destQueue, 2000);
          
          //Send the other half
          
@@ -1268,9 +1268,9 @@
          
          //Make sure no messages are left
          
-         this.checkNoneReceived(cf1, destQueue, 5000);         
+         this.checkNoneReceived(cf1, destQueue, 2000);         
          
-         this.checkNoneReceived(cf0, sourceQueue, 5000);
+         this.checkNoneReceived(cf0, sourceQueue, 2000);
       }
       finally
       {      
@@ -1305,7 +1305,7 @@
             
          this.sendMessages(cf0, sourceQueue, 0, NUM_MESSAGES / 2, persistent);
          
-         this.checkNoneReceived(cf1, destQueue, 5000);                
+         this.checkNoneReceived(cf1, destQueue, 2000);                
          
          //Send the other half
          
@@ -1316,9 +1316,9 @@
          
          this.checkAllMessageReceivedInOrder(cf0, localDestQueue, 0, NUM_MESSAGES);
          
-         this.checkNoneReceived(cf0, localDestQueue, 5000);
+         this.checkNoneReceived(cf0, localDestQueue, 2000);
          
-         this.checkNoneReceived(cf0, sourceQueue, 5000);
+         this.checkNoneReceived(cf0, sourceQueue, 2000);
          
          //Send another batch with one more than batch size
          
@@ -1338,9 +1338,9 @@
          
          //Make sure no messages are left
          
-         this.checkNoneReceived(cf0, localDestQueue, 5000);         
+         this.checkNoneReceived(cf0, localDestQueue, 2000);         
          
-         this.checkNoneReceived(cf0, sourceQueue, 5000);        
+         this.checkNoneReceived(cf0, sourceQueue, 2000);        
       }
       finally
       {               
@@ -1389,11 +1389,11 @@
          
          this.checkAllMessageReceivedInOrder(cf1, destQueue, 0, NUM_MESSAGES);
          
-         this.checkNoneReceived(cf1, destQueue, 5000);
+         this.checkNoneReceived(cf1, destQueue, 2000);
          
          //Make sure no messages are left in the source dest
          
-         this.checkNoneReceived(cf0, sourceQueue, 5000);
+         this.checkNoneReceived(cf0, sourceQueue, 2000);
          
       }
       finally
@@ -1445,11 +1445,11 @@
          
          this.checkAllMessageReceivedInOrder(cf0, localDestQueue, 0, NUM_MESSAGES);
          
-         this.checkNoneReceived(cf0, localDestQueue, 5000);
+         this.checkNoneReceived(cf0, localDestQueue, 2000);
          
          //Make sure no messages are left in the source dest
          
-         this.checkNoneReceived(cf0, sourceQueue, 5000);
+         this.checkNoneReceived(cf0, sourceQueue, 2000);
          
       }
       finally

Modified: trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java	2007-07-19 18:47:34 UTC (rev 2913)
+++ trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java	2007-07-19 20:02:31 UTC (rev 2914)
@@ -163,38 +163,36 @@
       {
          log.error("Failed to undeploy", e);
       }
+                  
+//      for (int i = 0; i < nodeCount; i++)
+//      {
+//         try
+//         {
+//            if (ServerManagement.isStarted(i))
+//            {
+//               ServerManagement.log(ServerManagement.INFO, "Undeploying Server " + i, i);
+//               
+//               ServerManagement.stop(i);
+//            }
+//         }
+//         catch (Exception e)
+//         {
+//            log.error("Failed to stop server", e);
+//         }
+//      }
       
+//      for (int i = 1; i < nodeCount; i++)
+//      {
+//         try
+//         {
+//            ServerManagement.kill(i);
+//         }
+//         catch (Exception e)
+//         {
+//            log.error("Failed to kill server", e);
+//         }
+//      }
       
-      
-      for (int i = 0; i < nodeCount; i++)
-      {
-         try
-         {
-            if (ServerManagement.isStarted(i))
-            {
-               ServerManagement.log(ServerManagement.INFO, "Undeploying Server " + i, i);
-               
-               ServerManagement.stop(i);
-            }
-         }
-         catch (Exception e)
-         {
-            log.error("Failed to stop server", e);
-         }
-      }
-      
-      for (int i = 1; i < nodeCount; i++)
-      {
-         try
-         {
-            ServerManagement.kill(i);
-         }
-         catch (Exception e)
-         {
-            log.error("Failed to kill server", e);
-         }
-      }
-      
       sc.stop();
       
       super.tearDown();      
@@ -342,7 +340,7 @@
          
          while (true)
          {
-            TextMessage tm = (TextMessage)cons.receive(5000);
+            TextMessage tm = (TextMessage)cons.receive(3000);
               
             if (tm == null)
             {
@@ -350,9 +348,7 @@
             }
             
             msgs.add(tm.getText());
-            
-            log.info("*** RECEIVED MESSAGE *** " + tm.getText());
-            
+
             count++;
             
          }
@@ -411,7 +407,7 @@
            
          for (int i = 0; i < numMessages; i++)
          {            
-            TextMessage tm = (TextMessage)cons.receive(5000);
+            TextMessage tm = (TextMessage)cons.receive(3000);
             
             assertNotNull(tm);
               

Modified: trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java	2007-07-19 18:47:34 UTC (rev 2913)
+++ trunk/tests/src/org/jboss/test/messaging/jms/bridge/ReconnectTest.java	2007-07-19 20:02:31 UTC (rev 2914)
@@ -179,7 +179,7 @@
          
          //Verify none are received
          
-         checkNoneReceived(cf1, destQueue, 5000);
+         checkNoneReceived(cf1, destQueue, 2000);
          
          //Now crash the dest server
          
@@ -189,7 +189,7 @@
          
          //Wait a while before starting up to simulate the dest being down for a while
          log.info("Waiting 15 secs before bringing server back up");
-         Thread.sleep(15000);
+         Thread.sleep(10000);
          log.info("Done wait");
          
          //Restart the server
@@ -210,13 +210,13 @@
          
          log.info("Sent messages");
          
-         Thread.sleep(3000);
+         Thread.sleep(2000);
                   
          checkMessagesReceived(cf1, destQueue, qosMode, NUM_MESSAGES);
                     
          //Make sure no messages are left in the source dest
          
-         this.checkNoneReceived(cf0, sourceQueue, 5000);                
+         this.checkNoneReceived(cf0, sourceQueue, 2000);                
       }
       finally
       {      
@@ -294,7 +294,7 @@
          
          //Make sure no messages are left in the source dest
          
-         checkNoneReceived(cf0, sourceQueue, 5000);
+         checkNoneReceived(cf0, sourceQueue, 2000);
          
          log.info("Got here");
          




More information about the jboss-cvs-commits mailing list