activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r662228 - in /activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal: PrimitiveMapMarshallerTest.cpp PrimitiveMapMarshallerTest.h
Date Sun, 01 Jun 2008 14:50:08 GMT
Author: tabish
Date: Sun Jun  1 07:50:08 2008
New Revision: 662228

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

Modified:
    activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/PrimitiveMapMarshallerTest.cpp
    activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/PrimitiveMapMarshallerTest.h

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/PrimitiveMapMarshallerTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/PrimitiveMapMarshallerTest.cpp?rev=662228&r1=662227&r2=662228&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/PrimitiveMapMarshallerTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/PrimitiveMapMarshallerTest.cpp
Sun Jun  1 07:50:08 2008
@@ -68,29 +68,24 @@
     // Turn it into some bytes
     PrimitiveMapMarshaller::marshal( &myMap, marshaled );
 
-    // Try and get it back from those bytes.
-    PrimitiveMap* newMap = NULL;
-
     try {
-        newMap = PrimitiveMapMarshaller::unmarshal( marshaled );
+        this->unmarshaledMap = PrimitiveMapMarshaller::unmarshal( marshaled );
     } catch(...) {
         CPPUNIT_ASSERT( false );
     }
 
-    CPPUNIT_ASSERT( newMap != NULL );
-
-    CPPUNIT_ASSERT( myMap.getString( "stringKey" ) == stringValue );
-    CPPUNIT_ASSERT( myMap.getBool( "boolKey" ) == booleanValue );
-    CPPUNIT_ASSERT( myMap.getByte( "byteKey" ) == byteValue );
-    CPPUNIT_ASSERT( myMap.getChar( "charKey" ) == charValue );
-    CPPUNIT_ASSERT( myMap.getShort( "shortKey" ) == shortValue );
-    CPPUNIT_ASSERT( myMap.getInt( "intKey" ) == intValue );
-    CPPUNIT_ASSERT( myMap.getLong( "longKey" ) == longValue );
-    CPPUNIT_ASSERT( myMap.getFloat( "floatKey" ) == floatValue );
-    CPPUNIT_ASSERT( myMap.getDouble( "doubleKey" ) == doubleValue );
-    CPPUNIT_ASSERT( myMap.getByteArray( "bytesKey" ) == bytes );
+    CPPUNIT_ASSERT( this->unmarshaledMap != NULL );
 
-    delete newMap;
+    CPPUNIT_ASSERT( this->unmarshaledMap->getString( "stringKey" ) == stringValue );
+    CPPUNIT_ASSERT( this->unmarshaledMap->getBool( "boolKey" ) == booleanValue );
+    CPPUNIT_ASSERT( this->unmarshaledMap->getByte( "byteKey" ) == byteValue );
+    CPPUNIT_ASSERT( this->unmarshaledMap->getChar( "charKey" ) == charValue );
+    CPPUNIT_ASSERT( this->unmarshaledMap->getShort( "shortKey" ) == shortValue );
+    CPPUNIT_ASSERT( this->unmarshaledMap->getInt( "intKey" ) == intValue );
+    CPPUNIT_ASSERT( this->unmarshaledMap->getLong( "longKey" ) == longValue );
+    CPPUNIT_ASSERT( this->unmarshaledMap->getFloat( "floatKey" ) == floatValue );
+    CPPUNIT_ASSERT( this->unmarshaledMap->getDouble( "doubleKey" ) == doubleValue );
+    CPPUNIT_ASSERT( this->unmarshaledMap->getByteArray( "bytesKey" ) == bytes );
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -125,6 +120,7 @@
     }
 
     CPPUNIT_ASSERT( newMap != NULL );
+    CPPUNIT_ASSERT( newMap->size() == 3 );
 
     delete newMap;
 }
@@ -161,6 +157,7 @@
     }
 
     CPPUNIT_ASSERT( newMap != NULL );
+    CPPUNIT_ASSERT( newMap->size() == 3 );
 
     delete newMap;
 }

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/PrimitiveMapMarshallerTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/PrimitiveMapMarshallerTest.h?rev=662228&r1=662227&r2=662228&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/PrimitiveMapMarshallerTest.h
(original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/PrimitiveMapMarshallerTest.h
Sun Jun  1 07:50:08 2008
@@ -20,6 +20,7 @@
 
 #include <cppunit/TestFixture.h>
 #include <cppunit/extensions/HelperMacros.h>
+#include <activemq/util/PrimitiveMap.h>
 
 namespace activemq{
 namespace connector{
@@ -31,14 +32,27 @@
         CPPUNIT_TEST_SUITE( PrimitiveMapMarshallerTest );
         CPPUNIT_TEST( test );
         CPPUNIT_TEST( testLists );
-        //CPPUNIT_TEST( testMaps );
+        CPPUNIT_TEST( testMaps );
         CPPUNIT_TEST_SUITE_END();
 
+    private:
+
+        activemq::util::PrimitiveMap* unmarshaledMap;
+
     public:
 
         PrimitiveMapMarshallerTest() {}
         virtual ~PrimitiveMapMarshallerTest() {}
 
+        virtual void setUp() {
+            this->unmarshaledMap = NULL;
+        }
+
+        virtual void tearDown() {
+            delete this->unmarshaledMap;
+            this->unmarshaledMap = NULL;
+        }
+
         void test();
         void testLists();
         void testMaps();



Mime
View raw message