[jboss-cvs] JBoss Messaging SVN: r5543 - branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Dec 18 17:20:01 EST 2008


Author: clebert.suconic at jboss.com
Date: 2008-12-18 17:20:01 -0500 (Thu, 18 Dec 2008)
New Revision: 5543

Modified:
   branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/JMSTestCase.java
Log:
Adding check on tearDown, so it is easier to find broken tests because of counters

Modified: branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/JMSTestCase.java
===================================================================
--- branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/JMSTestCase.java	2008-12-18 19:11:01 UTC (rev 5542)
+++ branches/Branch_1_4/tests/src/org/jboss/test/messaging/jms/JMSTestCase.java	2008-12-18 22:20:01 UTC (rev 5543)
@@ -20,113 +20,126 @@
 public class JMSTestCase extends MessagingTestCase
 {
    protected static Topic topic1;
-   
+
    protected static Topic topic2;
-   
+
    protected static Topic topic3;
-   
+
    protected static Queue queue1;
-   
+
    protected static Queue queue2;
-   
+
    protected static Queue queue3;
-   
+
    protected static Queue queue4;
-   
+
    protected static JBossConnectionFactory cf;
-   
+
    protected static InitialContext ic;
-   
+
    protected static final String defaultConf = "all";
-   
+
    protected static String conf;
-   
+
    protected String overrideConf;
-   
+
    protected boolean startMessagingServer = true;
-   	
-	protected void setUp() throws Exception
-	{
-		super.setUp();
-		
-		boolean changeServer = false;
-		
-		String newConf = null;
-					
-		if (overrideConf == null && !defaultConf.equals(conf))
-		{
-			//Going back to default
-			changeServer = true;
-			
-			newConf = defaultConf;
-		}
-		
-		if (overrideConf != null && !overrideConf.equals(conf))
-		{
-			//Applying new config
-			changeServer = true;
-			
-			newConf = overrideConf;
-		}		
-		
-		if (changeServer || !ServerManagement.isStarted(0))
-		{
-			log.info("Config has changed so stopping server with " + conf + " config and starting new one with " + newConf);
-			
-			ServerManagement.stop();
-			
-			if (changeServer)
-			{
-				conf = newConf;
-			}
-			
-			ServerManagement.start(0, conf);
-			
-			deployAndLookupAdministeredObjects();			
-		}
-		else
-		{
-			log.info("Server does not need to be changed");
-		}
-			
+
+   @Override
+   protected void setUp() throws Exception
+   {
+      super.setUp();
+
+      boolean changeServer = false;
+
+      String newConf = null;
+
+      if (overrideConf == null && !defaultConf.equals(conf))
+      {
+         // Going back to default
+         changeServer = true;
+
+         newConf = defaultConf;
+      }
+
+      if (overrideConf != null && !overrideConf.equals(conf))
+      {
+         // Applying new config
+         changeServer = true;
+
+         newConf = overrideConf;
+      }
+
+      if (changeServer || !ServerManagement.isStarted(0))
+      {
+         log.info("Config has changed so stopping server with " + conf + " config and starting new one with " + newConf);
+
+         ServerManagement.stop();
+
+         if (changeServer)
+         {
+            conf = newConf;
+         }
+
+         ServerManagement.start(0, conf);
+
+         deployAndLookupAdministeredObjects();
+      }
+      else
+      {
+         log.info("Server does not need to be changed");
+      }
+
+      checkNotEmpty();
+   }
+
+   /**
+    * @throws Exception
+    */
+   protected void checkNotEmpty() throws Exception
+   {
       checkEmpty(queue1);
       checkEmpty(queue2);
       checkEmpty(queue3);
       checkEmpty(queue4);
-      
+
       // Check no subscriptions left lying around
-            
+
       checkNoSubscriptions(topic1);
-      checkNoSubscriptions(topic2); 
-      checkNoSubscriptions(topic3); 		
-	}
-	
-	protected void tearDown() throws Exception
-	{
-		super.tearDown();
-		
-		//A few sanity checks
-		
-		if (ServerManagement.isStarted(0))
-		{			
-			if (checkNoMessageData())
-			{
-				fail("Message Data exists");
-			}
-		}
-		
-		//This will tell us if any connections have been left open
-		assertEquals(0, ResourceManagerFactory.instance.size());
-	}
+      checkNoSubscriptions(topic2);
+      checkNoSubscriptions(topic3);
+   }
 
-	public JMSTestCase(String name)
-	{
-		super(name);
-	}
-	
-	protected void deployAndLookupAdministeredObjects() throws Exception
-	{
-		ServerManagement.deployTopic("Topic1");
+   @Override
+   protected void tearDown() throws Exception
+   {
+      super.tearDown();
+
+      // A few sanity checks
+
+      if (ServerManagement.isStarted(0))
+      {
+         if (checkNoMessageData())
+         {
+            fail("Message Data exists");
+         }
+      }
+
+      // This will tell us if any connections have been left open
+      assertEquals(0, ResourceManagerFactory.instance.size());
+
+      checkNotEmpty();
+
+   }
+
+   public JMSTestCase(final String name)
+   {
+      super(name);
+   }
+
+   protected void deployAndLookupAdministeredObjects() throws Exception
+   {
+      ServerManagement.deployTopic("Topic1");
       ServerManagement.deployTopic("Topic2");
       ServerManagement.deployTopic("Topic3");
       ServerManagement.deployQueue("Queue1");
@@ -143,5 +156,5 @@
       queue2 = (Queue)ic.lookup("/queue/Queue2");
       queue3 = (Queue)ic.lookup("/queue/Queue3");
       queue4 = (Queue)ic.lookup("/queue/Queue4");
-	}
+   }
 }




More information about the jboss-cvs-commits mailing list