activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r759178 - in /activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test: SimpleTest.cpp SimpleTest.h openwire/OpenwireSimpleTest.h
Date Fri, 27 Mar 2009 15:33:09 GMT
Author: tabish
Date: Fri Mar 27 15:33:07 2009
New Revision: 759178

URL: http://svn.apache.org/viewvc?rev=759178&view=rev
Log:
Add a new Integration test to investigate an issue reported on the Mailing list, couldn't
reproduce it but its worth keeping the test.

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp?rev=759178&r1=759177&r2=759178&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.cpp
Fri Mar 27 15:33:07 2009
@@ -344,3 +344,50 @@
         CPPUNIT_ASSERT( false );
     }
 }
+
+////////////////////////////////////////////////////////////////////////////////
+void SimpleTest::testBytesMessageSendRecv() {
+
+    try {
+
+        // Create CMS Object for Comms
+        cms::Session* session( cmsProvider->getSession() );
+        cms::MessageConsumer* consumer = cmsProvider->getConsumer();
+        cms::MessageProducer* producer = cmsProvider->getProducer();
+        producer->setDeliveryMode( DeliveryMode::NON_PERSISTENT );
+
+        auto_ptr<cms::BytesMessage> bytesMessage( session->createBytesMessage()
);
+
+        bytesMessage->writeBoolean( true );
+        bytesMessage->writeByte( 127 );
+        bytesMessage->writeDouble( 123456.789 );
+        bytesMessage->writeInt( 65537 );
+        bytesMessage->writeString( "TEST-STRING" );
+
+        // Send some text messages
+        producer->send( bytesMessage.get() );
+
+        auto_ptr<cms::Message> message( consumer->receive( 2000 ) );
+        CPPUNIT_ASSERT( message.get() != NULL );
+
+        CPPUNIT_ASSERT_THROW_MESSAGE(
+            "Should throw an ActiveMQExceptio",
+            message->setStringProperty( "FOO", "BAR" ),
+            exceptions::ActiveMQException );
+
+        BytesMessage* bytesMessage2 = dynamic_cast<cms::BytesMessage*>( message.get()
);
+        CPPUNIT_ASSERT( bytesMessage2 != NULL );
+        CPPUNIT_ASSERT_THROW_MESSAGE(
+            "Should throw an ActiveMQExceptio",
+            bytesMessage2->writeBoolean( false ),
+            exceptions::ActiveMQException );
+
+        CPPUNIT_ASSERT( bytesMessage2->readBoolean() == true );
+        CPPUNIT_ASSERT( bytesMessage2->readByte() == 127 );
+        CPPUNIT_ASSERT( bytesMessage2->readDouble() == 123456.789 );
+        CPPUNIT_ASSERT( bytesMessage2->readInt() == 65537 );
+        CPPUNIT_ASSERT( bytesMessage2->readString() == "TEST-STRING" );
+    }
+    AMQ_CATCH_RETHROW( ActiveMQException )
+    AMQ_CATCHALL_THROW( ActiveMQException )
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.h?rev=759178&r1=759177&r2=759178&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/SimpleTest.h
Fri Mar 27 15:33:07 2009
@@ -39,7 +39,7 @@
         virtual void testMultipleSessions();
         virtual void testReceiveAlreadyInQueue();
         virtual void testQuickCreateAndDestroy();
-
+        virtual void testBytesMessageSendRecv();
 
     };
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h?rev=759178&r1=759177&r2=759178&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test-integration/activemq/test/openwire/OpenwireSimpleTest.h
Fri Mar 27 15:33:07 2009
@@ -35,6 +35,7 @@
         CPPUNIT_TEST( testMultipleConnections );
         CPPUNIT_TEST( testMultipleSessions );
         CPPUNIT_TEST( testReceiveAlreadyInQueue );
+        CPPUNIT_TEST( testBytesMessageSendRecv );
         CPPUNIT_TEST( testQuickCreateAndDestroy );
         CPPUNIT_TEST( testWithZeroConsumerPrefetch );
         CPPUNIT_TEST( testMapMessageSendToQueue );



Mime
View raw message