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

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun May 27 06:36:03 EDT 2007


Author: timfox
Date: 2007-05-27 06:36:01 -0400 (Sun, 27 May 2007)
New Revision: 2732

Modified:
   trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java
Log:
removeAllMessages in setup()


Modified: trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java	2007-05-27 09:05:55 UTC (rev 2731)
+++ trunk/tests/src/org/jboss/test/messaging/jms/bridge/BridgeTestBase.java	2007-05-27 10:36:01 UTC (rev 2732)
@@ -36,6 +36,7 @@
 import javax.jms.Session;
 import javax.jms.TextMessage;
 import javax.jms.Topic;
+import javax.management.ObjectName;
 import javax.naming.InitialContext;
 
 import org.jboss.jms.server.bridge.Bridge;
@@ -93,7 +94,7 @@
          // make sure all servers are created and started; make sure that database is zapped
          // ONLY for the first server, the others rely on values they expect to find in shared
          // tables; don't clear the database for those.
-            ServerManagement.start(i, "all", i == 0);
+         ServerManagement.start(i, "all", i == 0);
       }
       
       //We need a local transaction and recovery manager
@@ -123,8 +124,25 @@
       
       ServerManagement.deployQueue("localDestQueue", 0);
          
-      ServerManagement.deployQueue("destQueue", 1);                        
+      ServerManagement.deployQueue("destQueue", 1);             
+      
+      // Make sure there are no messages in the queues or topics
+      removeAllMessages("sourceQueue", true, 0);
+      
+      removeAllMessages("sourceTopic", false, 0);
+      
+      removeAllMessages("localDestQueue", true, 0);
+      
+      removeAllMessages("destQueue", true, 1);
+      
    }
+   
+   private void removeAllMessages(String destName, boolean isQueue, int server) throws Exception
+   {
+   	String on = "jboss.messaging.destination:service=" + (isQueue ? "Queue" : "Topic") + ",name=" + destName;
+   	
+   	ServerManagement.getServer(server).invoke(new ObjectName(on), "removeAllMessages", null, null);
+   }
 
    protected void tearDown() throws Exception
    {       




More information about the jboss-cvs-commits mailing list