[jboss-cvs] JBoss Messaging SVN: r2582 - trunk/tests/src/org/jboss/test/messaging/jms.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Apr 17 15:20:21 EDT 2007


Author: clebert.suconic at jboss.com
Date: 2007-04-17 15:20:21 -0400 (Tue, 17 Apr 2007)
New Revision: 2582

Modified:
   trunk/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-939 - Adding testcase

Modified: trunk/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java
===================================================================
--- trunk/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java	2007-04-17 17:12:05 UTC (rev 2581)
+++ trunk/tests/src/org/jboss/test/messaging/jms/ConnectionFactoryTest.java	2007-04-17 19:20:21 UTC (rev 2582)
@@ -28,6 +28,10 @@
 import javax.jms.QueueConnectionFactory;
 import javax.jms.TopicConnection;
 import javax.jms.TopicConnectionFactory;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.jms.TopicSubscriber;
+import javax.jms.TopicSession;
 import javax.management.ObjectName;
 import javax.naming.InitialContext;
 
@@ -35,6 +39,7 @@
 import org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate;
 import org.jboss.test.messaging.MessagingTestCase;
 import org.jboss.test.messaging.tools.ServerManagement;
+import org.jboss.test.messaging.tools.jmx.ServiceContainer;
 
 /**
  * @author <a href="mailto:ovidiu at jboss.org">Ovidiu Feodorov</a>
@@ -264,7 +269,68 @@
       c.close();
    }
 
+   // Added for http://jira.jboss.org/jira/browse/JBMESSAGING-939
+   public void testDurableSubscriptionOnPreConfiguredConnectionFactory() throws Exception
+   {
+      ObjectName cf1 = deployConnectionFactory("jboss.messaging.destination:service=TestConnectionFactory1", ServiceContainer.REMOTING_OBJECT_NAME.getCanonicalName(), "/TestDurableCF", "cfTest");
 
+      ServerManagement.deployTopic("TestSubscriber");
+
+      Connection conn = null;
+
+      try
+      {
+         Topic topic = (Topic) initialContext.lookup("/topic/TestSubscriber");
+         ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("/TestDurableCF");
+         conn = cf.createConnection();
+
+         // I have to remove this asertion, as the test would work if doing this assertion
+         // as getClientID performed some operation that cleared the bug condition during
+         // the creation of this testcase
+         //assertEquals("cfTest", conn.getClientID());
+
+         Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+         TopicSubscriber subs = session.createDurableSubscriber(topic,
+            "durableSubscriberChangeSelectorTest", "TEST = 'test'", false);
+      }
+      finally
+      {
+         try
+         {
+            if (conn != null)
+            {
+               conn.close();
+            }
+         }
+         catch (Exception e)
+         {
+            log.warn(e.toString(), e);
+         }
+
+
+         try
+         {
+            stopService(cf1);
+         }
+         catch (Exception e)
+         {
+            log.warn(e.toString(), e);
+         }
+
+         try
+         {
+            ServerManagement.destroyTopic("TestSubscriber");
+         }
+         catch (Exception e)
+         {
+            log.warn(e.toString(), e);
+         }
+
+      }
+
+   }
+
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------




More information about the jboss-cvs-commits mailing list