[jboss-cvs] JBoss Messaging SVN: r3588 - branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/clustering.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jan 17 21:06:34 EST 2008


Author: clebert.suconic at jboss.com
Date: 2008-01-17 21:06:34 -0500 (Thu, 17 Jan 2008)
New Revision: 3588

Modified:
   branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/clustering/DistributedTopicTest.java
Log:
http://jira.jboss.org/jira/browse/JBMESSAGING-1216 - Adding test for it

Modified: branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/clustering/DistributedTopicTest.java
===================================================================
--- branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/clustering/DistributedTopicTest.java	2008-01-17 21:38:40 UTC (rev 3587)
+++ branches/Branch_Stable/tests/src/org/jboss/test/messaging/jms/clustering/DistributedTopicTest.java	2008-01-18 02:06:34 UTC (rev 3588)
@@ -246,7 +246,56 @@
          try { if (conn2 != null) conn2.close(); } catch (Exception ignored){}
       }
    }
+
+   // http://jira.jboss.org/jira/browse/JBMESSAGING-1216
+   public void testDestinationTypeOnMessage() throws Exception
+   {
+      
+      Connection conn0 = this.createConnectionOnServer(cf, 0);
+      conn0.setClientID("aCustomer");
+      Connection conn1 = this.createConnectionOnServer(cf, 1);
+      conn1.setClientID("aCustomer");
+      
+      try
+      {
+         
+         Session session0 = conn0.createSession(true, Session.AUTO_ACKNOWLEDGE);
+         Session session1 = conn1.createSession(true, Session.AUTO_ACKNOWLEDGE);
    
+         MessageConsumer subscriber0 = session0.createDurableSubscriber(topic[0], "sub");
+         MessageConsumer subscriber1 = session0.createDurableSubscriber(topic[1], "sub2");
+         
+         conn0.start();
+         conn1.start();
+         
+         MessageProducer publisher = session0.createProducer(topic[0]);
+         
+         publisher.send(session0.createTextMessage("Hello!"));
+         session0.commit();
+         
+         TextMessage msg0 = (TextMessage)subscriber0.receive(1000);
+         TextMessage msg1 = (TextMessage)subscriber1.receive(1000);
+         
+         assertNotNull(msg0);
+         assertNotNull(msg1);
+         
+         log.info("Type of msg0 - " + msg0.getJMSDestination().getClass().getName());
+         log.info("Type of msg1 - " + msg1.getJMSDestination().getClass().getName());
+         
+         assertTrue ("msg0 is type of " + msg0.getJMSDestination() + " instead of Topic" ,msg0.getJMSDestination() instanceof Topic);
+         assertTrue ("msg1 is type of " + msg0.getJMSDestination() + " instead of Topic", msg1.getJMSDestination() instanceof Topic);
+         
+         session0.commit();
+         session1.commit();
+      }
+      finally
+      {
+         try { conn0.close(); } catch (Throwable ignored) {}
+         try { conn1.close(); } catch (Throwable ignored) {}
+      }
+   }
+   
+   
    // Package protected ---------------------------------------------
 
    // Protected -----------------------------------------------------




More information about the jboss-cvs-commits mailing list