[jboss-cvs] JBossAS SVN: r66760 - branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Nov 6 04:37:38 EST 2007


Author: wolfc
Date: 2007-11-06 04:37:38 -0500 (Tue, 06 Nov 2007)
New Revision: 66760

Modified:
   branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java
Log:
EJBTHREE-1102: merged 66730

Modified: branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java
===================================================================
--- branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java	2007-11-06 07:40:09 UTC (rev 66759)
+++ branches/Branch_4_2/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java	2007-11-06 09:37:38 UTC (rev 66760)
@@ -44,7 +44,6 @@
 import org.jboss.test.JBossTestCase;
 import org.jboss.test.JBossTestSetup;
 import junit.framework.Test;
-import junit.framework.TestSuite;
 
 /**
  * Some simple tests of MDB. These could be much more elaborated.
@@ -95,11 +94,8 @@
 
    // JMSProviderAdapter providerAdapter;
 
-   String dest;
-
-   public MDBUnitTestCase(String name, String dest) {
+   public MDBUnitTestCase(String name) {
       super(name);
-      this.dest = dest;
       // Get JMS JNDI Adapter
       // Class cls = Class.forName(providerAdapterClass);
       // providerAdapter = (JMSProviderAdapter)cls.newInstance();
@@ -117,7 +113,7 @@
       }
    }
 
-   protected void printHeader() {
+   protected void printHeader(String dest) {
       log.info("\n---- Testing method " + getName() +
                          " for destination " +dest);
    }
@@ -148,8 +144,8 @@
    /**
     * Test sending messages to Topic testTopic
     */
-   public void testQueue() throws Exception {
-      printHeader();
+   public void testQueue(String dest) throws Exception {
+      printHeader(dest);
       TestStatus status = (TestStatus)getInitialContext().lookup("TestStatusBean/remote");
       status.clear();
       
@@ -182,8 +178,8 @@
    /**
     * Test sending messages to Queue testQueue
     */
-   public void testTopic() throws Exception {
-      printHeader();
+   public void testTopic(String dest) throws Exception {
+      printHeader(dest);
       TestStatus status = (TestStatus)getInitialContext().lookup("TestStatusBean/remote");
       status.clear();
 
@@ -220,10 +216,11 @@
     * Test sending messages to queue testObjectMessage
     */
    public void testObjectMessage() throws Exception {
-      printHeader();
+      String dest = "queue/testObjectMessage";
+      printHeader(dest);
       QueueSession session = getQueueSession();
       // Non portable!!
-      Queue queue = (Queue)getInitialContext().lookup("queue/testObjectMessage");
+      Queue queue = (Queue)getInitialContext().lookup(dest);
       QueueSender sender = session.createSender(queue);
 
       log.debug("TestQueue: Sending 10 messages 1-10");
@@ -238,11 +235,6 @@
    }
 
 
-   public void testWaitForCompletion() throws Exception {
-      try { Thread.currentThread().sleep(1000*20);
-      } catch ( InterruptedException e ) {}
-   }
-
    public void testNoQueueConstructionForAlreadyExists()
       throws Exception
    {
@@ -271,22 +263,48 @@
       fail("It should not create topic/TopicInADifferentContext");
    }
 
+   public void testQueue() throws Exception
+   {
+      testQueue("queue/testQueue");
+   }
+   
+   public void testTopic() throws Exception
+   {
+      testTopic("topic/testTopic");
+   }
+   
+   public void testDurableTopic() throws Exception
+   {
+      testTopic("topic/testDurableTopic");
+   }
+   
+   public void testQueueEx() throws Exception
+   {
+      testQueue("queue/ex");
+   }
+   
+   public void testQueueA() throws Exception
+   {
+      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
+   {
+      testQueue("queue/B");
+   }
+   
    /**
     * Setup the test suite.
     */
    public static Test suite() throws Exception
    {
-      TestSuite suite = new TestSuite();
-      suite.addTest(new MDBUnitTestCase("testQueue","queue/testQueue"));
-      suite.addTest(new MDBUnitTestCase("testTopic","topic/testTopic"));
-      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-service.xml, dd-mdb.jar"));
-
+     return new JBossTestSetup(getDeploySetup(MDBUnitTestCase.class, "dd-mdb-service.xml, dd-mdb.jar"));
    }
 }
 




More information about the jboss-cvs-commits mailing list