activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r882361 [4/4] - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/activemq/commands/ main/activemq/wireformat/openwire/utils/ main/cms/ test/activemq/commands/ test/activemq/wireformat/openwire/utils/
Date Thu, 19 Nov 2009 23:37:27 GMT
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTextMessageTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTextMessageTest.cpp?rev=882361&r1=882360&r2=882361&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTextMessageTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTextMessageTest.cpp
Thu Nov 19 23:37:26 2009
@@ -19,14 +19,14 @@
 
 #include <activemq/commands/ActiveMQTextMessage.h>
 
+using namespace cms;
 using namespace std;
 using namespace activemq;
 using namespace activemq::util;
 using namespace activemq::commands;
 
 ////////////////////////////////////////////////////////////////////////////////
-void ActiveMQTextMessageTest::test()
-{
+void ActiveMQTextMessageTest::test() {
     ActiveMQTextMessage myMessage;
 
     CPPUNIT_ASSERT( myMessage.getDataStructureType() == ActiveMQTextMessage::ID_ACTIVEMQTEXTMESSAGE
);
@@ -42,3 +42,87 @@
     CPPUNIT_ASSERT( clonedMessage->getText() == testText );
     delete clonedMessage;
 }
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQTextMessageTest::testShallowCopy() {
+
+    ActiveMQTextMessage msg;
+    std::string string1 = "str";
+    msg.setText( string1 );
+
+    ActiveMQTextMessage msg2;
+
+    msg2.copyDataStructure( &msg );
+    CPPUNIT_ASSERT( msg.getText() == msg2.getText() );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQTextMessageTest::testGetBytes() {
+
+    ActiveMQTextMessage msg;
+    std::string str = "testText";
+    msg.setText( str );
+    msg.beforeMarshal( NULL );
+
+    ActiveMQTextMessage msg2;
+    msg2.setContent( msg.getContent() );
+
+    CPPUNIT_ASSERT( msg2.getText() == str );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQTextMessageTest::testClearBody() {
+
+    ActiveMQTextMessage textMessage;
+    textMessage.setText( "string" );
+    textMessage.clearBody();
+    CPPUNIT_ASSERT( !textMessage.isReadOnlyBody() );
+    CPPUNIT_ASSERT( textMessage.getText() == "" );
+    try {
+        textMessage.setText( "String" );
+        textMessage.getText();
+    } catch( MessageNotWriteableException& mnwe ) {
+        CPPUNIT_FAIL( "should be writeable" );
+    } catch( MessageNotReadableException& mnre ) {
+        CPPUNIT_FAIL( "should be readable" );
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQTextMessageTest::testReadOnlyBody() {
+    ActiveMQTextMessage textMessage;
+    textMessage.setText( "test" );
+    textMessage.setReadOnlyBody( true );
+    try {
+        textMessage.getText();
+    } catch( MessageNotReadableException& e ) {
+        CPPUNIT_FAIL( "should be readable" );
+    }
+    try {
+        textMessage.setText( "test" );
+        CPPUNIT_FAIL( "should throw exception" );
+    } catch( MessageNotWriteableException& mnwe ) {
+    }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQTextMessageTest::testWriteOnlyBody() {
+
+    ActiveMQTextMessage textMessage;
+    textMessage.setReadOnlyBody( false );
+    try {
+        textMessage.setText( "test" );
+        textMessage.getText();
+    } catch( MessageNotReadableException& e ) {
+        CPPUNIT_FAIL( "should be readable" );
+    }
+    textMessage.setReadOnlyBody( true );
+    try {
+        textMessage.getText();
+        textMessage.setText( "test" );
+        CPPUNIT_FAIL( "should throw exception" );
+    } catch( MessageNotReadableException& e ) {
+        CPPUNIT_FAIL( "should be readable" );
+    } catch( MessageNotWriteableException& mnwe ) {
+    }
+}

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTextMessageTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTextMessageTest.h?rev=882361&r1=882360&r2=882361&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTextMessageTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQTextMessageTest.h
Thu Nov 19 23:37:26 2009
@@ -28,6 +28,11 @@
 
         CPPUNIT_TEST_SUITE( ActiveMQTextMessageTest );
         CPPUNIT_TEST( test );
+        CPPUNIT_TEST( testClearBody );
+        CPPUNIT_TEST( testReadOnlyBody );
+        CPPUNIT_TEST( testWriteOnlyBody );
+        CPPUNIT_TEST( testShallowCopy );
+        CPPUNIT_TEST( testGetBytes );
         CPPUNIT_TEST_SUITE_END();
 
     public:
@@ -36,6 +41,11 @@
         virtual ~ActiveMQTextMessageTest() {}
 
         void test();
+        void testClearBody();
+        void testReadOnlyBody();
+        void testWriteOnlyBody();
+        void testShallowCopy();
+        void testGetBytes();
 
     };
 

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/utils/MessagePropertyInterceptorTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/utils/MessagePropertyInterceptorTest.cpp?rev=882361&r1=882360&r2=882361&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/utils/MessagePropertyInterceptorTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/utils/MessagePropertyInterceptorTest.cpp
Thu Nov 19 23:37:26 2009
@@ -25,6 +25,7 @@
 using namespace std;
 using namespace decaf;
 using namespace decaf::io;
+using namespace decaf::lang;
 using namespace activemq;
 using namespace activemq::util;
 using namespace activemq::exceptions;
@@ -60,13 +61,13 @@
     interceptor.setStringProperty( "JMSXDeliveryCount", "12" );
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
-        "Should Throw an ActiveMQException",
+        "Should Throw an Exception",
         interceptor.setBooleanProperty( "JMSXGroupSeq", false ),
-        ActiveMQException );
+        Exception );
 
     CPPUNIT_ASSERT_THROW_MESSAGE(
-        "Should Throw an ActiveMQException",
+        "Should Throw an Exception",
         interceptor.setStringProperty( "JMSXGroupSeq", "FOO" ),
-        ActiveMQException );
+        Exception );
 
 }



Mime
View raw message