[jboss-cvs] JBossAS SVN: r63599 - in trunk/ejb3/src: resources/test/dd/mdb/META-INF and 2 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jun 21 10:43:37 EDT 2007


Author: wolfc
Date: 2007-06-21 10:43:37 -0400 (Thu, 21 Jun 2007)
New Revision: 63599

Modified:
   trunk/ejb3/src/resources/test/dd/mdb/META-INF/ejb-jar.xml
   trunk/ejb3/src/resources/test/dd/mdb/META-INF/jboss.xml
   trunk/ejb3/src/resources/test/dd/mdb/dd-mdb-jbossmq-destinations-service.xml
   trunk/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/ObjectMessageBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/QueueBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java
Log:
Fixed dd/mdb test

Modified: trunk/ejb3/src/resources/test/dd/mdb/META-INF/ejb-jar.xml
===================================================================
--- trunk/ejb3/src/resources/test/dd/mdb/META-INF/ejb-jar.xml	2007-06-21 14:27:23 UTC (rev 63598)
+++ trunk/ejb3/src/resources/test/dd/mdb/META-INF/ejb-jar.xml	2007-06-21 14:43:37 UTC (rev 63599)
@@ -125,10 +125,10 @@
           	<activation-config-property-name>subscriptionName</activation-config-property-name>
           	<activation-config-property-value>DurableTopicTest</activation-config-property-value>
           </activation-config-property>
-          <!--activation-config-property>
+          <activation-config-property>
           	<activation-config-property-name>clientId</activation-config-property-name>
           	<activation-config-property-value>DurableTopicTest</activation-config-property-value>
-          </activation-config-property-->
+          </activation-config-property>
         </activation-config>
       </message-driven>
 

Modified: trunk/ejb3/src/resources/test/dd/mdb/META-INF/jboss.xml
===================================================================
--- trunk/ejb3/src/resources/test/dd/mdb/META-INF/jboss.xml	2007-06-21 14:27:23 UTC (rev 63598)
+++ trunk/ejb3/src/resources/test/dd/mdb/META-INF/jboss.xml	2007-06-21 14:43:37 UTC (rev 63599)
@@ -42,8 +42,10 @@
       <message-driven>
          <ejb-name>DurableTopicBean</ejb-name>
          <destination-jndi-name>topic/testDurableTopic</destination-jndi-name>
+         <!--
          <mdb-user>dynsub</mdb-user>
          <mdb-passwd>dynsub</mdb-passwd>
+         -->
          <mdb-subscription-id>DurableTopicTest</mdb-subscription-id>
       </message-driven>
       <message-driven>

Modified: trunk/ejb3/src/resources/test/dd/mdb/dd-mdb-jbossmq-destinations-service.xml
===================================================================
--- trunk/ejb3/src/resources/test/dd/mdb/dd-mdb-jbossmq-destinations-service.xml	2007-06-21 14:27:23 UTC (rev 63598)
+++ trunk/ejb3/src/resources/test/dd/mdb/dd-mdb-jbossmq-destinations-service.xml	2007-06-21 14:43:37 UTC (rev 63599)
@@ -86,5 +86,9 @@
 	 name="jboss.mq.destination:service=Queue,name=ex">
     <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
   </mbean>
+  <mbean code="org.jboss.mq.server.jmx.Queue"
+	 name="jboss.mq.destination:service=Queue,name=testObjectMessage">
+    <depends optional-attribute-name="DestinationManager">jboss.mq:service=DestinationManager</depends>
+  </mbean>
 
 </server>

Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/ObjectMessageBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/ObjectMessageBean.java	2007-06-21 14:27:23 UTC (rev 63598)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/ObjectMessageBean.java	2007-06-21 14:43:37 UTC (rev 63599)
@@ -49,7 +49,6 @@
 
    }
 
-   @Resource
    public void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException
    {
       this.ctx = ctx;

Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/QueueBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/QueueBean.java	2007-06-21 14:27:23 UTC (rev 63598)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/QueueBean.java	2007-06-21 14:43:37 UTC (rev 63599)
@@ -21,6 +21,8 @@
  */
 package org.jboss.ejb3.test.dd.mdb;
 
+import java.sql.Connection;
+
 import javax.annotation.Resource;
 import javax.ejb.MessageDrivenBean;
 import javax.ejb.MessageDrivenContext;
@@ -63,7 +65,6 @@
 
    }
 
-   @Resource
    public void setMessageDrivenContext(MessageDrivenContext ctx) throws EJBException
    {
       this.ctx = ctx;
@@ -99,9 +100,13 @@
    
    private void testInjections() throws Exception
    {
+      if(ctx == null)
+         throw new IllegalStateException("ctx is not set");
+      
       stateless.test();
       statelessLocal.testLocal();
-      testDatasource.getConnection();
+      Connection conn = testDatasource.getConnection();
+      conn.close();
       
       Context initCtx = new InitialContext();
       Context myEnv = (Context) initCtx.lookup(Container.ENC_CTX_NAME + "/env");

Modified: trunk/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java	2007-06-21 14:27:23 UTC (rev 63598)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java	2007-06-21 14:43:37 UTC (rev 63599)
@@ -24,6 +24,8 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
+
 import javax.jms.ObjectMessage;
 import javax.jms.Queue;
 import javax.jms.QueueConnection;
@@ -81,15 +83,15 @@
    QueueConnection queueConnection;
    TopicConnection topicConnection;
    
-   static HashMap jndiToDestName = new HashMap();
+   static Map<String, String> jndiToDestName = new HashMap<String, String>();
    static
    {
-      jndiToDestName.put("queue/testQueue", "QUEUE.testQueue");
-      jndiToDestName.put("topic/testTopic", "TOPIC.testTopic");
-      jndiToDestName.put("topic/testDurableTopic", "TOPIC.testDurableTopic");
-      jndiToDestName.put("queue/ex", "QUEUE.ex");
-      jndiToDestName.put("queue/A", "QUEUE.A");
-      jndiToDestName.put("queue/B", "QUEUE.B");
+      jndiToDestName.put("queue/testQueue", "JBossQueue[testQueue]");
+      jndiToDestName.put("topic/testTopic", "JBossTopic[testTopic]");
+      jndiToDestName.put("topic/testDurableTopic", "JBossTopic[testDurableTopic]");
+      jndiToDestName.put("queue/ex", "JBossQueue[ex]");
+      jndiToDestName.put("queue/A", "JBossQueue[A]");
+      jndiToDestName.put("queue/B", "JBossQueue[B]");
    }
    
 
@@ -166,10 +168,10 @@
 
       sender.close();
       
-      Thread.currentThread().sleep(10000);
+      Thread.sleep(10000);
       
       ArrayList destinations = status.getDestinations();
-      int size = (dest.equals("queue/ex")) ? 110 : 10;
+      int size = (dest.equals("queue/ex")) ? 100 : 10;
 
       assertEquals(size, destinations.size());
       String destinationName = (String)jndiToDestName.get(dest);
@@ -202,11 +204,11 @@
 
       pub.close();
 
-      Thread.currentThread().sleep(10000);
+      Thread.sleep(10000);
 
       ArrayList destinations = status.getDestinations();
       
-      assertEquals(10, destinations.size());
+      assertEquals("MDB failed to receive messages on " + dest, 10, destinations.size());
       String destinationName = (String)jndiToDestName.get(dest);
       for (Iterator it = destinations.iterator() ; it.hasNext() ;)
       {
@@ -237,12 +239,6 @@
       session.close();
    }
 
-
-   public void testWaitForCompletion() throws Exception {
-      try { Thread.currentThread().sleep(1000*20);
-      } catch ( InterruptedException e ) {}
-   }
-
    public void testNoQueueConstructionForAlreadyExists()
       throws Exception
    {
@@ -282,13 +278,9 @@
       suite.addTest(new MDBUnitTestCase("testTopic","topic/testDurableTopic"));
       suite.addTest(new MDBUnitTestCase("testQueue","queue/ex"));
       suite.addTest(new MDBUnitTestCase("testQueue","queue/A"));
-      suite.addTest(new MDBUnitTestCase("testWaitForCompletion",""));
       suite.addTest(new MDBUnitTestCase("testQueue","queue/B"));
 
      return new JBossTestSetup(getDeploySetup(suite, "dd-mdb-jbossmq-destinations-service.xml, dd-mdb-service.xml, dd-mdb.jar"));
 
    }
-}
-
-
-
+}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list