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/10 23:57:56 UTC

svn commit: r620353 - in /activemq/activemq-cpp/trunk/src: main/activemq/cmsutil/CmsTemplate.cpp main/activemq/cmsutil/CmsTemplate.h main/activemq/cmsutil/DynamicDestinationResolver.cpp test/activemq/cmsutil/CmsTemplateTest.cpp

Author: nmittler
Date: Sun Feb 10 14:57:55 2008
New Revision: 620353

URL: http://svn.apache.org/viewvc?rev=620353&view=rev
Log:
AMQCPP-152 - Adding destroy method to CmsTemplate

Modified:
    activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.cpp
    activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h
    activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp
    activemq/activemq-cpp/trunk/src/test/activemq/cmsutil/CmsTemplateTest.cpp

Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.cpp?rev=620353&r1=620352&r2=620353&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.cpp Sun Feb 10 14:57:55 2008
@@ -27,6 +27,39 @@
 using namespace decaf::lang::exceptions;
 using namespace std;
 
+/**
+ * Macro for catching an exception then rethrowing an
+ * ActiveMQException (which is a cms::CMSException).
+ * @param type 
+ *      The type of the exception to throw
+ * @param t 
+ *      The instance of CmsTemplate
+ * (e.g. ActiveMQException ).
+ */
+#define CMSTEMPLATE_CATCH( type, t ) \
+    catch( type& ex ){ \
+        ex.setMark(__FILE__, __LINE__); \
+        try { \
+            t->destroy(); \
+        } catch( ... ) {} \
+        throw ActiveMQException(ex); \
+    }
+
+/**
+ * A catch-all that throws an ActiveMQException.
+ * @param t 
+ *      The instance of CmsTemplate
+ */
+#define CMSTEMPLATE_CATCHALL(t) \
+    catch( ... ){ \
+        ActiveMQException ex( __FILE__, __LINE__, \
+            "caught unknown exception" ); \
+        try { \
+            t->destroy(); \
+        } catch( ... ) {} \
+        throw ex; \
+    }
+
 ////////////////////////////////////////////////////////////////////////////////
 CmsTemplate::CmsTemplate() {
     initDefaults();
@@ -107,9 +140,9 @@
         // Make sure we have a valid default destination.
         checkDefaultDestination();
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_RETHROW( IllegalStateException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCH( IllegalStateException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -117,21 +150,21 @@
       
     try {
         
-        // Destroy the session pools.
-        destroySessionPools();
-        
         // Clear the connection reference
         connection = NULL;
         
         // Clear the reference to the default destination.
         defaultDestination = NULL;
-        
+                
+        // Destroy the session pools.
+        destroySessionPools();
+                
         // Call the base class.
         CmsDestinationAccessor::destroy();
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_RETHROW( IllegalStateException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCH( IllegalStateException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -145,7 +178,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::Destination* CmsTemplate::resolveDefaultDestination(cms::Session* session)
-throw (cms::CMSException, IllegalStateException) {
+throw (cms::CMSException) {
     
     try {
         
@@ -165,8 +198,9 @@
         
         return dest;
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_RETHROW( IllegalStateException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCH( IllegalStateException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -191,8 +225,8 @@
         
         return connection;
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -208,8 +242,8 @@
         // Take a session from the pool.
         return sessionPools[getSessionAcknowledgeMode()]->takeSession();        
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -226,8 +260,8 @@
         session->close();
         session = NULL;
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -237,7 +271,7 @@
     try {
 
         // If no destination was provided, resolve the default.
-        if( dest == NULL ) {            
+        if( dest == NULL ) {
             dest = resolveDefaultDestination(session);
         }
         
@@ -258,9 +292,9 @@
 
         return producer;
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( IllegalStateException, ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCH( IllegalStateException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -289,9 +323,9 @@
 
         return consumer;
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_EXCEPTION_CONVERT( IllegalStateException, ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCH( IllegalStateException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -373,16 +407,9 @@
         
         // Return the session to the pool.
         returnSession(pooledSession);
-        
-    } catch( ActiveMQException& e ) {
-        
-        e.setMark(__FILE__, __LINE__);
-        
-        // Return the session to the pool.
-        returnSession(pooledSession);
-        
-        throw e;
     }
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -396,8 +423,8 @@
         // Execute the action in a session.
         execute(&cb);
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -412,8 +439,8 @@
         // Execute the action in a session.
         execute(&cb);
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -427,8 +454,8 @@
         // Execute the action in a session.
         execute(&cb);
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -442,7 +469,7 @@
         if( session == NULL ) {
             return;
         }
-        
+                
         // Create the producer.
         producer = parent->createProducer(session, getDestination(session));
         
@@ -452,15 +479,9 @@
         // Destroy the producer.
         parent->destroyProducer(producer);
         
-    } catch( ActiveMQException& e) {
-        
-        e.setMark(__FILE__, __LINE__);
-        
-        // Destroy the producer.
-        parent->destroyProducer(producer);
-        
-        throw e;
     }
+    CMSTEMPLATE_CATCH( ActiveMQException, parent )
+    CMSTEMPLATE_CATCHALL(parent)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -471,47 +492,47 @@
     try {    
         return parent->resolveDestinationName(session, destinationName);        
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, parent )
+    CMSTEMPLATE_CATCH( IllegalStateException, parent )
+    CMSTEMPLATE_CATCHALL(parent)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void CmsTemplate::send(MessageCreator* messageCreator) 
-throw (cms::CMSException, IllegalStateException)  {
+throw (cms::CMSException)  {
     
     try {
         SendExecutor senderExecutor(messageCreator, this);
         execute(&senderExecutor);
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCH_RETHROW( IllegalStateException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 void CmsTemplate::send(cms::Destination* dest, 
                 MessageCreator* messageCreator) 
-throw (cms::CMSException, IllegalStateException) {
+throw (cms::CMSException) {
     
     try {        
         SendExecutor senderExecutor(messageCreator, this);
         execute(dest, &senderExecutor);
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
        
 ////////////////////////////////////////////////////////////////////////////////
 void CmsTemplate::send(const std::string& destinationName, 
                 MessageCreator* messageCreator) 
-throw (cms::CMSException, IllegalStateException) {
+throw (cms::CMSException) {
     
     try {
         SendExecutor senderExecutor(messageCreator, this);
         execute(destinationName, &senderExecutor);
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
         
 ////////////////////////////////////////////////////////////////////////////////
@@ -574,12 +595,9 @@
         }
         }
         
-    } catch( ActiveMQException& e) {
-        
-        e.setMark(__FILE__, __LINE__ );
-        
-        throw e;
     }
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -606,9 +624,6 @@
         // Destroy the message resource.
         parent->destroyMessage(message);
         
-        // Destroy the consumer resource.
-        parent->destroyConsumer(consumer);
-        
         throw e;
     }
 }
@@ -621,13 +636,14 @@
     try {    
         return parent->resolveDestinationName(session, destinationName);        
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, parent )
+    CMSTEMPLATE_CATCH( IllegalStateException, parent )
+    CMSTEMPLATE_CATCHALL(parent)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::Message* CmsTemplate::receive() 
-throw (cms::CMSException, IllegalStateException) {
+throw (cms::CMSException) {
     
     try {        
         ReceiveExecutor receiveExecutor(this, NULL,
@@ -636,13 +652,13 @@
         
         return receiveExecutor.getMessage();
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::Message* CmsTemplate::receive(cms::Destination* destination ) 
-throw (cms::CMSException, IllegalStateException) {
+throw (cms::CMSException) {
     
     try {        
         ReceiveExecutor receiveExecutor(this, destination,
@@ -651,13 +667,13 @@
         
         return receiveExecutor.getMessage();
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::Message* CmsTemplate::receive(const std::string& destinationName) 
-throw (cms::CMSException, IllegalStateException) {
+throw (cms::CMSException) {
     
     try {        
         ResolveReceiveExecutor receiveExecutor(this,
@@ -667,13 +683,13 @@
         
         return receiveExecutor.getMessage();
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::Message* CmsTemplate::receiveSelected(const std::string& selector) 
-throw (cms::CMSException, IllegalStateException) {
+throw (cms::CMSException) {
     
     try {        
         ReceiveExecutor receiveExecutor(this, NULL,
@@ -682,14 +698,14 @@
         
         return receiveExecutor.getMessage();
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::Message* CmsTemplate::receiveSelected(cms::Destination* destination,
         const std::string& selector) 
-throw (cms::CMSException, IllegalStateException) {
+throw (cms::CMSException) {
     
     try {        
         ReceiveExecutor receiveExecutor(this, destination,
@@ -698,14 +714,14 @@
         
         return receiveExecutor.getMessage();
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 cms::Message* CmsTemplate::receiveSelected(const std::string& destinationName,
         const std::string& selector) 
-throw (cms::CMSException, IllegalStateException) {
+throw (cms::CMSException) {
     
     try {        
         ResolveReceiveExecutor receiveExecutor(this,
@@ -715,7 +731,7 @@
         
         return receiveExecutor.getMessage();
     }
-    AMQ_CATCH_RETHROW( ActiveMQException )
-    AMQ_CATCHALL_THROW( ActiveMQException )
+    CMSTEMPLATE_CATCH( ActiveMQException, this )
+    CMSTEMPLATE_CATCHALL(this)
 }
 

Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h?rev=620353&r1=620352&r2=620353&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/CmsTemplate.h Sun Feb 10 14:57:55 2008
@@ -535,11 +535,9 @@
          * @param messageCreator
          *          Responsible for creating the message to be sent
          * @throws cms::CMSException thrown if an error occurs.
-         * @throws decaf::lang::exceptions::IllegalStateException thrown if the
-         *          default destination has not been specified.
          */
         virtual void send(MessageCreator* messageCreator) 
-        throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
+        throw (cms::CMSException);
 
         /**
          * Convenience method for sending a message to the specified destination.
@@ -549,12 +547,10 @@
          * @param messageCreator
          *          Responsible for creating the message to be sent
          * @throws cms::CMSException thrown if an error occurs.
-         * @throws decaf::lang::exceptions::IllegalStateException thrown if the
-         *          default destination has not been specified.
          */
         virtual void send(cms::Destination* dest, 
                 MessageCreator* messageCreator)
-        throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
+        throw (cms::CMSException);
         
         /**
          * Convenience method for sending a message to the specified destination.
@@ -564,22 +560,18 @@
          * @param messageCreator
          *          Responsible for creating the message to be sent
          * @throws cms::CMSException thrown if an error occurs.
-         * @throws decaf::lang::exceptions::IllegalStateException thrown if the
-         *          default destination has not been specified.
          */
         virtual void send(const std::string& destinationName, 
                 MessageCreator* messageCreator)
-        throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
+        throw (cms::CMSException);
         
         /**
          * Performs a synchronous read from the default destination.
          * @return the message
          * @throws cms::CMSException thrown if an error occurs
-         * @throws decaf::lang::exceptions::IllegalStateException thrown if the
-         *          default destination has not been specified.
          */
         virtual cms::Message* receive()
-        throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
+        throw (cms::CMSException);
         
         /**
          * Performs a synchronous read from the specified destination.
@@ -587,11 +579,9 @@
          *          the destination to receive on
          * @return the message
          * @throws cms::CMSException thrown if an error occurs
-         * @throws decaf::lang::exceptions::IllegalStateException thrown if the
-         *          default destination has not been specified.
          */
         virtual cms::Message* receive(cms::Destination* destination )
-        throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
+        throw (cms::CMSException);
         
         /**
          * Performs a synchronous read from the specified destination.
@@ -600,11 +590,9 @@
          *          (will be resolved to destination internally).
          * @return the message
          * @throws cms::CMSException thrown if an error occurs
-         * @throws decaf::lang::exceptions::IllegalStateException thrown if the
-         *          default destination has not been specified.
          */
         virtual cms::Message* receive(const std::string& destinationName )
-        throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
+        throw (cms::CMSException);
         
         /**
          * Performs a synchronous read consuming only messages identified by the
@@ -614,11 +602,9 @@
          *          the selector expression.
          * @return the message
          * @throws cms::CMSException thrown if an error occurs
-         * @throws decaf::lang::exceptions::IllegalStateException thrown if the
-         *          default destination has not been specified.
          */
         virtual cms::Message* receiveSelected(const std::string& selector )
-        throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
+        throw (cms::CMSException);
         
         /**
          * Performs a synchronous read from the specified destination, consuming 
@@ -630,12 +616,10 @@
          *          the selector expression.
          * @return the message
          * @throws cms::CMSException thrown if an error occurs
-         * @throws decaf::lang::exceptions::IllegalStateException thrown if the
-         *          default destination has not been specified.
          */
         virtual cms::Message* receiveSelected( cms::Destination* destination,
                 const std::string& selector )
-                throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
+                throw (cms::CMSException);
         
         /**
          * Performs a synchronous read from the specified destination, consuming 
@@ -648,12 +632,10 @@
          *          the selector expression.
          * @return the message
          * @throws cms::CMSException thrown if an error occurs
-         * @throws decaf::lang::exceptions::IllegalStateException thrown if the
-         *          default destination has not been specified.
          */
         virtual cms::Message* receiveSelected( const std::string& destinationName,
                 const std::string& selector )
-                throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
+                throw (cms::CMSException);
         
     private:
     
@@ -787,11 +769,9 @@
          *          the parent session.
          * @return the default destination
          * @throws cms::CMSException if an error occurs
-         * @throws decaf::lang::exceptions::IllegalStateException thrown if
-         *          no default destination was provided.
          */
         cms::Destination* resolveDefaultDestination(cms::Session* session)
-        throw (cms::CMSException, decaf::lang::exceptions::IllegalStateException);
+        throw (cms::CMSException);
     };
 
 }}

Modified: activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp?rev=620353&r1=620352&r2=620353&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp (original)
+++ activemq/activemq-cpp/trunk/src/main/activemq/cmsutil/DynamicDestinationResolver.cpp Sun Feb 10 14:57:55 2008
@@ -17,8 +17,10 @@
 
 #include "DynamicDestinationResolver.h"
 #include "ResourceLifecycleManager.h"
+#include <activemq/exceptions/ActiveMQException.h>
 
 using namespace activemq::cmsutil;
+using namespace activemq::exceptions;
 using namespace decaf::util;
 using namespace std;
 
@@ -92,6 +94,10 @@
         cms::Session* session, const std::string& destName, bool pubSubDomain)
         throw (cms::CMSException) {
  
+    if( destName == "" ) {
+        throw ActiveMQException(__FILE__, __LINE__, "destination name is invalid");
+    }
+    
     // Get the resolver for this session.
     SessionResolver* resolver = NULL;
     try {

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=620353&r1=620352&r2=620353&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/cmsutil/CmsTemplateTest.cpp (original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/cmsutil/CmsTemplateTest.cpp Sun Feb 10 14:57:55 2008
@@ -120,13 +120,12 @@
         MyProducerCallback callback6;
         activemq::connector::stomp::StompTopic myTopic("anothertopic");
         cmsTemplate->execute(&myTopic, &callback6);
-        CPPUNIT_ASSERT(callback6.session == callback.session);
-        CPPUNIT_ASSERT(callback6.producer != callback4.producer);
+        CPPUNIT_ASSERT(callback6.session != NULL);
         
         // Now try an explicitly named destination 
         MyProducerCallback callback7;
         cmsTemplate->execute("fred", &callback7);
-        CPPUNIT_ASSERT(callback7.session == callback.session);
+        CPPUNIT_ASSERT(callback7.session == callback6.session);
         CPPUNIT_ASSERT(callback7.producer != callback6.producer);
                 
     } catch( cms::CMSException& e) {