[jboss-cvs] JBossAS SVN: r66730 - branches/JBPAPP_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
Mon Nov 5 08:28:01 EST 2007


Author: wolfc
Date: 2007-11-05 08:28:01 -0500 (Mon, 05 Nov 2007)
New Revision: 66730

Modified:
   branches/JBPAPP_4_2/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java
Log:
JBPAPP-347 / EJBTHREE-1102: split test methods

Modified: branches/JBPAPP_4_2/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java
===================================================================
--- branches/JBPAPP_4_2/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java	2007-11-05 12:49:05 UTC (rev 66729)
+++ branches/JBPAPP_4_2/ejb3/src/test/org/jboss/ejb3/test/dd/mdb/unit/MDBUnitTestCase.java	2007-11-05 13:28:01 UTC (rev 66730)
@@ -112,11 +112,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();
@@ -134,7 +131,7 @@
       }
    }
 
-   protected void printHeader() {
+   protected void printHeader(String dest) {
       log.info("\n---- Testing method " + getName() +
                          " for destination " +dest);
    }
@@ -165,8 +162,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();
       
@@ -199,8 +196,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();
 
@@ -237,10 +234,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");
@@ -255,11 +253,6 @@
    }
 
 
-   public void testWaitForCompletion() throws Exception {
-      try { Thread.currentThread().sleep(1000*20);
-      } catch ( InterruptedException e ) {}
-   }
-
    public void testNoQueueConstructionForAlreadyExists()
       throws Exception
    {
@@ -288,22 +281,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-${jboss.jms.provider}-service.xml, dd-mdb.jar"));
-
+     return new JBossTestSetup(getDeploySetup(MDBUnitTestCase.class, "dd-mdb-${jboss.jms.provider}-service.xml, dd-mdb.jar"));
    }
 }
 




More information about the jboss-cvs-commits mailing list