[jboss-cvs] JBossAS SVN: r66025 - in trunk/testsuite/src/main/org/jboss/test/messagedriven: test and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Oct 11 08:36:57 EDT 2007


Author: adrian at jboss.org
Date: 2007-10-11 08:36:57 -0400 (Thu, 11 Oct 2007)
New Revision: 66025

Modified:
   trunk/testsuite/src/main/org/jboss/test/messagedriven/support/BasicMessageDrivenUnitTest.java
   trunk/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerDurableTopicMessageDrivenUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerQueueMessageDrivenUnitTestCase.java
   trunk/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerTopicMessageDrivenUnitTestCase.java
Log:
[JBAS-4517] - Make the message driven work, some are still failing. Make testing against JBoss Messaging the default.

Modified: trunk/testsuite/src/main/org/jboss/test/messagedriven/support/BasicMessageDrivenUnitTest.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/messagedriven/support/BasicMessageDrivenUnitTest.java	2007-10-11 12:24:43 UTC (rev 66024)
+++ trunk/testsuite/src/main/org/jboss/test/messagedriven/support/BasicMessageDrivenUnitTest.java	2007-10-11 12:36:57 UTC (rev 66025)
@@ -21,6 +21,7 @@
  */
 package org.jboss.test.messagedriven.support;
 
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Properties;
@@ -62,17 +63,32 @@
    protected static Properties testDurableTopicProps = new Properties();
 
    protected static ObjectName dlqJMXDestination = ObjectNameFactory.create("jboss.mq.destination:service=Queue,name=DLQ");
+
+   protected static String destinations = "messaging/test-destinations-full-service.xml";
    
+   protected static boolean isJBossMessaging()
+   {
+      try
+      {
+         return "false".equalsIgnoreCase(System.getProperty("jbosstest.useJBM", "true")) == false;
+      }
+      catch (Exception e)
+      {
+         return true;
+      }
+   }
+   
    static
    {
 	   
 	   
-	  if (System.getProperty("jbosstest.useJBM") != null)
+	  if (isJBossMessaging())
 	  {
 		   testQueue = ObjectNameFactory.create("jboss.messaging.destination:service=Queue,name=testQueue");
 		   testTopic = ObjectNameFactory.create("jboss.messaging.destination:service=Topic,name=testTopic");
 		   testDurableTopic = ObjectNameFactory.create("jboss.messaging.destination:service=Topic,name=testDurableTopic");
 		   dlqJMXDestination = ObjectNameFactory.create("jboss.messaging.destination:service=Queue,name=DLQ");
+		   destinations = "jbossmessaging/test-destinations-full-service.xml";
 	  }
 	   
       testQueueProps.put("destination", "queue/testQueue");
@@ -149,7 +165,6 @@
       if (destination != null)
          return destination;
       String jndiName = (String) getAttribute(getJMXDestination(), "JNDIName");
-      //System.out.println("***************************** jndiName=" + jndiName);
       destination = (Destination) lookup(jndiName, Destination.class);
       return destination;
    }
@@ -226,20 +241,49 @@
    {
       return getSession().createTextMessage();
    }
-
+   
+   protected void deployDestinations() throws Exception
+   {
+      ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+      URL url = classLoader.getResource(destinations);
+      if (url == null)
+         throw new Error(destinations + " not found");
+      deploy(url.toString());
+   }
+   
+   protected void undeployDestinations() throws Exception
+   {
+      try
+      {
+         ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+         URL url = classLoader.getResource(destinations);
+         if (url == null)
+            throw new Error(destinations + " not found");
+         undeploy(url.toString());
+      }
+      catch (Throwable t)
+      {
+         getLog().error("Error undeploying: " + destinations, t);
+      }
+   }
+   
    protected void setUp() throws Exception
    {
 	  super.setUp();
-      if ("testServerFound".equals(getName()))
-         return;
-      System.out.println("MbeanSAR=" + mbeansar);
-      deploy(mbeansar);
+	  deployDestinations();
+      try
+      {
+         deploy(mbeansar);
+      }
+      catch (Exception e)
+      {
+         undeployDestinations();
+         throw e;
+      }
    }
 
    protected void tearDown() throws Exception
    {
-      if ("testServerFound".equals(getName()))
-         return;
       try
       {
          undeploy(mbeansar);
@@ -248,6 +292,7 @@
       {
          getLog().error("Error undeploying: " + mbeansar, t);
       }
+      undeployDestinations();
       super.tearDown();
    }
    

Modified: trunk/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerDurableTopicMessageDrivenUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerDurableTopicMessageDrivenUnitTestCase.java	2007-10-11 12:24:43 UTC (rev 66024)
+++ trunk/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerDurableTopicMessageDrivenUnitTestCase.java	2007-10-11 12:36:57 UTC (rev 66025)
@@ -55,8 +55,9 @@
          new SendMessageOperation(this, "1"),
          new CheckMessageSizeOperation(this, 0, 5000),
          new ActivateOperation(this, mdbInvoker),
+         new CheckMessageSizeOperation(this, 0, 5000), 
          new SendMessageOperation(this, "2"),
-         new CheckMessageSizeOperation(this, 1, 0),
+         new CheckMessageSizeOperation(this, 1, 5000),
          new CheckJMSDestinationOperation(this, 0, getDestination()),
          new CheckMessageIDOperation(this, 0, "2"),
          new DeactivateOperation(this, mdbInvoker),

Modified: trunk/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerQueueMessageDrivenUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerQueueMessageDrivenUnitTestCase.java	2007-10-11 12:24:43 UTC (rev 66024)
+++ trunk/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerQueueMessageDrivenUnitTestCase.java	2007-10-11 12:36:57 UTC (rev 66025)
@@ -52,7 +52,7 @@
    
    public void testRestartJMS() throws Exception
    {
-	  if (System.getProperty("jbosstest.useJBM") == null)
+	  if (isJBossMessaging() == false)
 	  {
 	      Operation[] operations = new Operation[]
 	      {
@@ -70,7 +70,7 @@
 	  }
 	  else
 	  {
-		  System.out.println("testRestartJMS doesn't make sense to be executed on JBM");
+		  System.out.println("FIXME testRestartJMS for JBoss Messaging");
 	  }
    }
   

Modified: trunk/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerTopicMessageDrivenUnitTestCase.java
===================================================================
--- trunk/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerTopicMessageDrivenUnitTestCase.java	2007-10-11 12:24:43 UTC (rev 66024)
+++ trunk/testsuite/src/main/org/jboss/test/messagedriven/test/JMSContainerInvokerTopicMessageDrivenUnitTestCase.java	2007-10-11 12:36:57 UTC (rev 66025)
@@ -57,7 +57,7 @@
          new ActivateOperation(this, mdbInvoker),
          new CheckMessageSizeOperation(this, 0, 5000),
          new SendMessageOperation(this, "1"),
-         new CheckMessageSizeOperation(this, 1, 0),
+         new CheckMessageSizeOperation(this, 1, 5000),
          new CheckJMSDestinationOperation(this, 0, getDestination()),
          new CheckMessageIDOperation(this, 0, "1"),
          new DeactivateOperation(this, mdbInvoker),




More information about the jboss-cvs-commits mailing list