activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r503749 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands: ActiveMQMessageTest.cpp ActiveMQMessageTest.h
Date Mon, 05 Feb 2007 16:04:58 GMT
Author: tabish
Date: Mon Feb  5 08:04:55 2007
New Revision: 503749

URL: http://svn.apache.org/viewvc?view=rev&rev=503749
Log:
http://issues.apache.org/activemq/browse/AMQCPP-30

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMessageTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMessageTest.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMessageTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMessageTest.cpp?view=diff&rev=503749&r1=503748&r2=503749
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMessageTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMessageTest.cpp
Mon Feb  5 08:04:55 2007
@@ -33,6 +33,38 @@
 void ActiveMQMessageTest::test()
 {
     ActiveMQMessage myMessage;
+    MyAckHandler ackHandler;
 
     CPPUNIT_ASSERT( myMessage.getDataStructureType() == ActiveMQMessage::ID_ACTIVEMQMESSAGE
);
+    
+    myMessage.setAckHandler( &ackHandler );
+    myMessage.acknowledge();
+    
+    CPPUNIT_ASSERT( ackHandler.wasAcked == true );
+    
+    CPPUNIT_ASSERT( myMessage.getPropertyNames().size() == 0 );
+    CPPUNIT_ASSERT( myMessage.propertyExists( "something" ) == false );
+    
+    try {
+        myMessage.getBooleanProperty( "somethingElse" );
+        CPPUNIT_ASSERT( false );
+    } catch(...) {}
+    
+    myMessage.setBooleanProperty( "boolean", false );
+    myMessage.setByteProperty( "byte", 60 );
+    myMessage.setDoubleProperty( "double", 642.5643 );
+    myMessage.setFloatProperty( "float", 0.564f );
+    myMessage.setIntProperty( "int", 65438746 );
+    myMessage.setLongProperty( "long", 0xFFFFFFFF0000000LL );
+    myMessage.setShortProperty( "short", 512 );
+    myMessage.setStringProperty( "string", "This is a test String" );
+    
+    CPPUNIT_ASSERT( myMessage.getBooleanProperty( "boolean" ) == false );
+    CPPUNIT_ASSERT( myMessage.getByteProperty( "byte" ) == 60 );
+    CPPUNIT_ASSERT( myMessage.getDoubleProperty( "double" ) == 642.5643 );
+    CPPUNIT_ASSERT( myMessage.getFloatProperty( "float" ) == 0.564f );
+    CPPUNIT_ASSERT( myMessage.getIntProperty( "int" ) == 65438746 );
+    CPPUNIT_ASSERT( myMessage.getLongProperty( "long" ) == 0xFFFFFFFF0000000LL );
+    CPPUNIT_ASSERT( myMessage.getShortProperty( "short" ) == 512 );
+    CPPUNIT_ASSERT( myMessage.getStringProperty( "string" ) == "This is a test String" );
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMessageTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMessageTest.h?view=diff&rev=503749&r1=503748&r2=503749
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMessageTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMessageTest.h
Mon Feb  5 08:04:55 2007
@@ -21,6 +21,8 @@
 #include <cppunit/TestFixture.h>
 #include <cppunit/extensions/HelperMacros.h>
 
+#include <activemq/core/ActiveMQAckHandler.h>
+
 namespace activemq{
 namespace connector{
 namespace openwire{
@@ -31,6 +33,31 @@
         CPPUNIT_TEST_SUITE( ActiveMQMessageTest );
         CPPUNIT_TEST( test );
         CPPUNIT_TEST_SUITE_END();
+
+        class MyAckHandler : public core::ActiveMQAckHandler {
+        public:
+        
+            MyAckHandler() {
+                this->wasAcked = false;
+            }
+            
+            /**
+             * Method called to acknowledge the message passed
+             * @param message Message to Acknowlegde
+             * @throw CMSException
+             */
+            virtual void acknowledgeMessage( const core::ActiveMQMessage* message )
+                throw ( cms::CMSException ) {
+                    
+                this->wasAcked = true;
+            }
+            
+            /**
+             * Public indicator that we have received an ack
+             */
+            bool wasAcked;
+            
+        };
 
     public:
     



Mime
View raw message