[jboss-cvs] JBossAS SVN: r69350 - in branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/dd/mdb: unit and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jan 25 11:36:57 EST 2008


Author: bdecoste
Date: 2008-01-25 11:36:57 -0500 (Fri, 25 Jan 2008)
New Revision: 69350

Modified:
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/TestStatusBean.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/TopicBean.java
   branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java
Log:
[JBPAPP-578] fixed timing of testObjectMessage()

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/TestStatusBean.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/TestStatusBean.java	2008-01-25 15:52:32 UTC (rev 69349)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/TestStatusBean.java	2008-01-25 16:36:57 UTC (rev 69350)
@@ -26,6 +26,7 @@
 import javax.jms.Destination;
 
 import org.jboss.annotation.ejb.Service;
+import org.jboss.logging.Logger;
 
 /**
  * 
@@ -35,8 +36,10 @@
 @Service
 public class TestStatusBean implements TestStatus
 {
-   private static ArrayList destinations = new ArrayList();
+   private static final Logger log = Logger.getLogger(TestStatusBean.class);
    
+   public static ArrayList destinations = new ArrayList();
+   
    public void clear()
    {
       destinations.clear();
@@ -49,8 +52,6 @@
    
    public ArrayList getDestinations()
    {
-      return destinations; 
+      return destinations;
    }
-   
-   
 }

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/TopicBean.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/TopicBean.java	2008-01-25 15:52:32 UTC (rev 69349)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/TopicBean.java	2008-01-25 16:36:57 UTC (rev 69350)
@@ -72,10 +72,10 @@
    {
       if (ctx.getRollbackOnly())
          throw new IllegalStateException("Error in transaction");
-      log.debug("DEBUG: TopicBean got message" + message.toString());
       try
       {
          TestStatusBean.addDestination(message.getJMSDestination());
+         log.debug("DEBUG: TopicBean got message " + TestStatusBean.destinations.size() + " " + message.toString());
       }
       catch(JMSException e)
       {

Modified: branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java	2008-01-25 15:52:32 UTC (rev 69349)
+++ branches/JBPAPP_4_2_0_GA_CP/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java	2008-01-25 16:36:57 UTC (rev 69350)
@@ -170,6 +170,8 @@
       printHeader(dest);
       TestStatus status = (TestStatus)getInitialContext().lookup("TestStatusBean/remote");
       status.clear();
+      ArrayList destinations = status.getDestinations();
+      assertEquals(0, destinations.size());
       
       QueueSession session = getQueueSession();
       Queue queue = (Queue)getInitialContext().lookup(dest);
@@ -183,10 +185,11 @@
       }
 
       sender.close();
+      session.close();
       
-      Thread.sleep(10000);
+      Thread.sleep(20 * 1000);
       
-      ArrayList destinations = status.getDestinations();
+      destinations = status.getDestinations();
       // Wolf: MQ delivers 110 messages (don't ask)
       int expected = isMQ() ? 110 : 100;
       int size = (dest.equals("queue/ex")) ? expected : 10;
@@ -206,6 +209,8 @@
       printHeader(dest);
       TestStatus status = (TestStatus)getInitialContext().lookup("TestStatusBean/remote");
       status.clear();
+      ArrayList destinations = status.getDestinations();
+      assertEquals(0, destinations.size());
 
       TopicSession session = getTopicSession();
       Topic topic = (Topic)getInitialContext().lookup(dest);
@@ -221,10 +226,11 @@
       }
 
       pub.close();
+      session.close();
 
-      Thread.sleep(20000);
+      Thread.sleep(20 * 1000);
 
-      ArrayList destinations = status.getDestinations();
+      destinations = status.getDestinations();
       
       assertEquals(10, destinations.size());
       String destinationName = (String)jndiToDestName.get(dest);
@@ -242,6 +248,11 @@
    public void testObjectMessage() throws Exception {
       String dest = "queue/testObjectMessage";
       printHeader(dest);
+      TestStatus status = (TestStatus)getInitialContext().lookup("TestStatusBean/remote");
+      status.clear();
+      ArrayList destinations = status.getDestinations();
+      assertEquals(0, destinations.size());
+      
       QueueSession session = getQueueSession();
       // Non portable!!
       Queue queue = (Queue)getInitialContext().lookup(dest);
@@ -256,6 +267,8 @@
 
       sender.close();
       session.close();
+      
+      Thread.sleep(20 * 1000);
    }
 
 
@@ -311,12 +324,6 @@
    {
       testQueue("queue/A");
    }
-   
-   // FIXME: this is really silly, should be part of test method
-   public void testWaitForCompletion() throws Exception {
-      try { Thread.sleep(1000*20);
-      } catch ( InterruptedException e ) {}
-   }
 
    public void testQueueB() throws Exception
    {




More information about the jboss-cvs-commits mailing list