You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by nm...@apache.org on 2008/02/09 20:54:18 UTC

svn commit: r620180 - /activemq/activemq-cpp/trunk/src/test/activemq/cmsutil/CmsTemplateTest.cpp

Author: nmittler
Date: Sat Feb  9 11:54:17 2008
New Revision: 620180

URL: http://svn.apache.org/viewvc?rev=620180&view=rev
Log:
AMQCPP-152 - Adding addition tests for CmsTemplate

Modified:
    activemq/activemq-cpp/trunk/src/test/activemq/cmsutil/CmsTemplateTest.cpp

Modified: activemq/activemq-cpp/trunk/src/test/activemq/cmsutil/CmsTemplateTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/cmsutil/CmsTemplateTest.cpp?rev=620180&r1=620179&r2=620180&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/cmsutil/CmsTemplateTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/cmsutil/CmsTemplateTest.cpp Sat Feb  9 11:54:17 2008
@@ -104,6 +104,30 @@
         cmsTemplate->execute(&callback4);    
         CPPUNIT_ASSERT(callback4.session == callback.session);
         CPPUNIT_ASSERT(callback4.producer != callback3.producer);
+        
+        // Now try without a valid default destination and make sure
+        // we get an exception.
+        try {
+            cmsTemplate->setDefaultDestinationName("");
+            MyProducerCallback callback5;
+            cmsTemplate->execute(&callback5);
+            CPPUNIT_FAIL("failed to throw expected exception");
+        } catch( cms::CMSException& ex) {
+            // expected.
+        }
+        
+        // Now try an explicit destination 
+        MyProducerCallback callback6;
+        activemq::connector::stomp::StompTopic myTopic("anothertopic");
+        cmsTemplate->execute(&myTopic, &callback6);
+        CPPUNIT_ASSERT(callback6.session == callback.session);
+        CPPUNIT_ASSERT(callback6.producer != callback4.producer);
+        
+        // Now try an explicitly named destination 
+        MyProducerCallback callback7;
+        cmsTemplate->execute("fred", &callback7);
+        CPPUNIT_ASSERT(callback7.session == callback.session);
+        CPPUNIT_ASSERT(callback7.producer != callback6.producer);
                 
     } catch( cms::CMSException& e) {
         e.printStackTrace();