activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r774861 [2/2] - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/ main/activemq/commands/ main/activemq/wireformat/openwire/marshal/ test/ test/activemq/commands/ test/activemq/wireformat/openwire/marshal/
Date Thu, 14 May 2009 18:22:41 GMT
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am?rev=774861&r1=774860&r2=774861&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/Makefile.am Thu May 14 18:22:39 2009
@@ -82,7 +82,7 @@
     activemq/transport/correlator/ResponseCorrelatorTest.cpp \
     activemq/transport/IOTransportTest.cpp \
     activemq/wireformat/openwire/OpenWireFormatTest.cpp \
-    activemq/wireformat/openwire/marshal/PrimitiveMapMarshallerTest.cpp \
+    activemq/wireformat/openwire/marshal/PrimitiveTypesMarshallerTest.cpp \
     activemq/wireformat/openwire/marshal/BaseDataStreamMarshallerTest.cpp \
     activemq/wireformat/openwire/utils/HexTableTest.cpp \
     activemq/wireformat/openwire/utils/OpenwireStringSupportTest.cpp \
@@ -121,6 +121,7 @@
     activemq/commands/ActiveMQDestinationTest2.cpp \
     activemq/commands/ActiveMQTempTopicTest.cpp \
     activemq/commands/ActiveMQTopicTest.cpp \
+    activemq/commands/ActiveMQStreamMessageTest.cpp \
     activemq/commands/ActiveMQMessageTest.cpp \
     activemq/commands/ActiveMQTempQueueTest.cpp \
     activemq/commands/ActiveMQBytesMessageTest.cpp \
@@ -192,8 +193,8 @@
     activemq/transport/correlator/ResponseCorrelatorTest.h \
     activemq/transport/TransportRegistryTest.h \
     activemq/wireformat/openwire/OpenWireFormatTest.h \
-    activemq/wireformat/openwire/marshal/PrimitiveMapMarshallerTest.h \
     activemq/wireformat/openwire/marshal/BaseDataStreamMarshallerTest.h \
+    activemq/wireformat/openwire/marshal/PrimitiveTypesMarshallerTest.h \
     activemq/wireformat/openwire/utils/MessagePropertyInterceptorTest.h \
     activemq/wireformat/openwire/utils/OpenwireStringSupportTest.h \
     activemq/wireformat/openwire/utils/HexTableTest.h \
@@ -232,6 +233,7 @@
     activemq/core/ActiveMQConnectionTest.h \
     activemq/core/ActiveMQSessionTest.h \
     activemq/core/MessageDispatchChannelTest.h \
+    activemq/commands/ActiveMQStreamMessageTest.h \
     activemq/commands/ActiveMQTempTopicTest.h \
     activemq/commands/ActiveMQQueueTest.h \
     activemq/commands/ActiveMQBytesMessageTest.h \

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQStreamMessageTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQStreamMessageTest.cpp?rev=774861&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQStreamMessageTest.cpp
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQStreamMessageTest.cpp
Thu May 14 18:22:39 2009
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "ActiveMQStreamMessageTest.h"
+
+#include <activemq/commands/ActiveMQStreamMessage.h>
+
+using namespace std;
+using namespace activemq;
+using namespace activemq::commands;
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQStreamMessageTest::testSetAndGet() {
+
+    ActiveMQStreamMessage myMessage;
+
+    CPPUNIT_ASSERT( myMessage.getDataStructureType() == ActiveMQStreamMessage::ID_ACTIVEMQSTREAMMESSAGE
);
+
+    std::vector<unsigned char> data;
+    data.push_back( 2 );
+    data.push_back( 4 );
+    data.push_back( 8 );
+    data.push_back( 16 );
+    data.push_back( 32 );
+    std::vector<unsigned char> readData( data.size() );
+
+    myMessage.writeBoolean( false );
+    myMessage.writeByte( 127 );
+    myMessage.writeChar( 'a' );
+    myMessage.writeShort( 32000 );
+    myMessage.writeInt( 6789999 );
+    myMessage.writeLong( 0xFFFAAA33345LL );
+    myMessage.writeFloat( 0.000012f );
+    myMessage.writeDouble( 64.54654 );
+    myMessage.writeBytes( data );
+
+    myMessage.reset();
+
+    CPPUNIT_ASSERT( myMessage.readBoolean() == false );
+    CPPUNIT_ASSERT( myMessage.readByte() == 127 );
+    CPPUNIT_ASSERT( myMessage.readChar() == 'a' );
+    CPPUNIT_ASSERT( myMessage.readShort() == 32000 );
+    CPPUNIT_ASSERT( myMessage.readInt() == 6789999 );
+    CPPUNIT_ASSERT( myMessage.readLong() == 0xFFFAAA33345LL );
+    CPPUNIT_ASSERT( myMessage.readFloat() == 0.000012f );
+    CPPUNIT_ASSERT( myMessage.readDouble() == 64.54654 );
+    CPPUNIT_ASSERT( myMessage.readBytes( readData ) == data.size() );
+}
+

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQStreamMessageTest.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQStreamMessageTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQStreamMessageTest.h?rev=774861&view=auto
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQStreamMessageTest.h
(added)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQStreamMessageTest.h
Thu May 14 18:22:39 2009
@@ -0,0 +1,44 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _ACTIVEMQ_COMMANDS_ACTIVEMQSTREAMMESSAGETEST_H_
+#define _ACTIVEMQ_COMMANDS_ACTIVEMQSTREAMMESSAGETEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace activemq {
+namespace commands {
+
+    class ActiveMQStreamMessageTest : public CppUnit::TestFixture {
+
+        CPPUNIT_TEST_SUITE( ActiveMQStreamMessageTest );
+        CPPUNIT_TEST( testSetAndGet );
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        ActiveMQStreamMessageTest() {}
+        virtual ~ActiveMQStreamMessageTest() {}
+
+        void testSetAndGet();
+
+    };
+
+}}
+
+#endif /* _ACTIVEMQ_COMMANDS_ACTIVEMQSTREAMMESSAGETEST_H_ */

Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/commands/ActiveMQStreamMessageTest.h
------------------------------------------------------------------------------
    svn:eol-style = native

Copied: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshallerTest.cpp
(from r774073, activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/PrimitiveMapMarshallerTest.cpp)
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshallerTest.cpp?p2=activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshallerTest.cpp&p1=activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/PrimitiveMapMarshallerTest.cpp&r1=774073&r2=774861&rev=774861&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/PrimitiveMapMarshallerTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshallerTest.cpp
Thu May 14 18:22:39 2009
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-#include "PrimitiveMapMarshallerTest.h"
+#include "PrimitiveTypesMarshallerTest.h"
 
 #include <activemq/util/PrimitiveMap.h>
 #include <activemq/util/PrimitiveList.h>
-#include <activemq/wireformat/openwire/marshal/PrimitiveMapMarshaller.h>
+#include <activemq/wireformat/openwire/marshal/PrimitiveTypesMarshaller.h>
 
 using namespace std;
 using namespace activemq;
@@ -31,7 +31,7 @@
 using namespace activemq::wireformat::openwire::marshal;
 
 ////////////////////////////////////////////////////////////////////////////////
-void PrimitiveMapMarshallerTest::test() {
+void PrimitiveTypesMarshallerTest::test() {
 
     PrimitiveMap myMap;
 
@@ -66,10 +66,11 @@
     std::vector<unsigned char> marshaled;
 
     // Turn it into some bytes
-    PrimitiveMapMarshaller::marshal( &myMap, marshaled );
+    PrimitiveTypesMarshaller::marshal( &myMap, marshaled );
 
     try {
-        this->unmarshaledMap = PrimitiveMapMarshaller::unmarshal( marshaled );
+        this->unmarshaledMap = new PrimitiveMap();
+        PrimitiveTypesMarshaller::unmarshal( this->unmarshaledMap, marshaled );
     } catch(...) {
         CPPUNIT_ASSERT( false );
     }
@@ -89,7 +90,7 @@
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void PrimitiveMapMarshallerTest::testLists() {
+void PrimitiveTypesMarshallerTest::testLists() {
 
     PrimitiveMap myMap;
 
@@ -108,25 +109,23 @@
     std::vector<unsigned char> marshaled;
 
     // Turn it into some bytes
-    PrimitiveMapMarshaller::marshal( &myMap, marshaled );
+    PrimitiveTypesMarshaller::marshal( &myMap, marshaled );
 
     // Try and get it back from those bytes.
-    PrimitiveMap* newMap = NULL;
+    std::auto_ptr<PrimitiveMap> newMap( new PrimitiveMap );
 
     try {
-        newMap = PrimitiveMapMarshaller::unmarshal( marshaled );
+        PrimitiveTypesMarshaller::unmarshal( newMap.get(), marshaled );
     } catch(...) {
         CPPUNIT_ASSERT( false );
     }
 
-    CPPUNIT_ASSERT( newMap != NULL );
+    CPPUNIT_ASSERT( newMap.get() != NULL );
     CPPUNIT_ASSERT( newMap->size() == 3 );
-
-    delete newMap;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
-void PrimitiveMapMarshallerTest::testMaps() {
+void PrimitiveTypesMarshallerTest::testMaps() {
 
     PrimitiveMap myMap;
 
@@ -145,19 +144,17 @@
     std::vector<unsigned char> marshaled;
 
     // Turn it into some bytes
-    PrimitiveMapMarshaller::marshal( &myMap, marshaled );
+    PrimitiveTypesMarshaller::marshal( &myMap, marshaled );
 
     // Try and get it back from those bytes.
-    PrimitiveMap* newMap = NULL;
+    std::auto_ptr<PrimitiveMap> newMap( new PrimitiveMap );
 
     try {
-        newMap = PrimitiveMapMarshaller::unmarshal( marshaled );
+        PrimitiveTypesMarshaller::unmarshal( newMap.get(), marshaled );
     } catch(...) {
         CPPUNIT_ASSERT( false );
     }
 
-    CPPUNIT_ASSERT( newMap != NULL );
+    CPPUNIT_ASSERT( newMap.get() != NULL );
     CPPUNIT_ASSERT( newMap->size() == 3 );
-
-    delete newMap;
 }

Copied: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshallerTest.h
(from r774073, activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/PrimitiveMapMarshallerTest.h)
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshallerTest.h?p2=activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshallerTest.h&p1=activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/PrimitiveMapMarshallerTest.h&r1=774073&r2=774861&rev=774861&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/PrimitiveMapMarshallerTest.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/PrimitiveTypesMarshallerTest.h
Thu May 14 18:22:39 2009
@@ -15,8 +15,8 @@
  * limitations under the License.
  */
 
-#ifndef _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_PRIMITIVEMAPMARSHALLERTEST_H_
-#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_PRIMITIVEMAPMARSHALLERTEST_H_
+#ifndef _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_PRIMITIVETYPESMARSHALLERTEST_H_
+#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_PRIMITIVETYPESMARSHALLERTEST_H_
 
 #include <cppunit/TestFixture.h>
 #include <cppunit/extensions/HelperMacros.h>
@@ -27,9 +27,9 @@
 namespace openwire{
 namespace marshal{
 
-    class PrimitiveMapMarshallerTest : public CppUnit::TestFixture {
+    class PrimitiveTypesMarshallerTest : public CppUnit::TestFixture {
 
-        CPPUNIT_TEST_SUITE( PrimitiveMapMarshallerTest );
+        CPPUNIT_TEST_SUITE( PrimitiveTypesMarshallerTest );
         CPPUNIT_TEST( test );
         CPPUNIT_TEST( testLists );
         CPPUNIT_TEST( testMaps );
@@ -41,8 +41,8 @@
 
     public:
 
-        PrimitiveMapMarshallerTest() {}
-        virtual ~PrimitiveMapMarshallerTest() {}
+        PrimitiveTypesMarshallerTest() {}
+        virtual ~PrimitiveTypesMarshallerTest() {}
 
         virtual void setUp() {
             this->unmarshaledMap = NULL;
@@ -61,4 +61,4 @@
 
 }}}}
 
-#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_PRIMITIVEMAPMARSHALLERTEST_H_*/
+#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSHAL_PRIMITIVETYPESMARSHALLERTEST_H_*/

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/testRegistry.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/testRegistry.cpp?rev=774861&r1=774860&r2=774861&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/testRegistry.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/testRegistry.cpp Thu May 14 18:22:39
2009
@@ -40,11 +40,13 @@
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQDestinationTest );
 #include <activemq/commands/ActiveMQBytesMessageTest.h>
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQBytesMessageTest );
+#include <activemq/commands/ActiveMQStreamMessageTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::commands::ActiveMQStreamMessageTest );
 
 #include <activemq/wireformat/openwire/marshal/BaseDataStreamMarshallerTest.h>
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::wireformat::openwire::marshal::BaseDataStreamMarshallerTest
);
-#include <activemq/wireformat/openwire/marshal/PrimitiveMapMarshallerTest.h>
-CPPUNIT_TEST_SUITE_REGISTRATION( activemq::wireformat::openwire::marshal::PrimitiveMapMarshallerTest
);
+#include <activemq/wireformat/openwire/marshal/PrimitiveTypesMarshallerTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION( activemq::wireformat::openwire::marshal::PrimitiveTypesMarshallerTest
);
 
 #include <activemq/wireformat/openwire/utils/BooleanStreamTest.h>
 CPPUNIT_TEST_SUITE_REGISTRATION( activemq::wireformat::openwire::utils::BooleanStreamTest
);



Mime
View raw message