activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r588751 - in /activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal: BaseDataStreamMarshallerTest.cpp BaseDataStreamMarshallerTest.h
Date Fri, 26 Oct 2007 19:04:42 GMT
Author: tabish
Date: Fri Oct 26 12:04:41 2007
New Revision: 588751

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

Submitting a test case that exposes the problem.

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

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/BaseDataStreamMarshallerTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/BaseDataStreamMarshallerTest.cpp?rev=588751&r1=588750&r2=588751&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/BaseDataStreamMarshallerTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/BaseDataStreamMarshallerTest.cpp
Fri Oct 26 12:04:41 2007
@@ -71,6 +71,11 @@
     CPPUNIT_ASSERT( ds.cachedChild->charValue == dataStructure->cachedChild->charValue
);
     CPPUNIT_ASSERT( ds.cachedChild->shortValue == dataStructure->cachedChild->shortValue
);
     CPPUNIT_ASSERT( ds.cachedChild->intValue == dataStructure->cachedChild->intValue
);
+    CPPUNIT_ASSERT( ds.cachedChild->longValue1 == dataStructure->cachedChild->longValue1
);
+    CPPUNIT_ASSERT( ds.cachedChild->longValue2 == dataStructure->cachedChild->longValue2
);
+    CPPUNIT_ASSERT( ds.cachedChild->longValue3 == dataStructure->cachedChild->longValue3
);
+    CPPUNIT_ASSERT( ds.cachedChild->longValue4 == dataStructure->cachedChild->longValue4
);
+    CPPUNIT_ASSERT( ds.cachedChild->longValue5 == dataStructure->cachedChild->longValue5
);
     CPPUNIT_ASSERT( ds.cachedChild->floatValue == dataStructure->cachedChild->floatValue
);
     CPPUNIT_ASSERT( ds.cachedChild->doubleValue == dataStructure->cachedChild->doubleValue
);
     CPPUNIT_ASSERT( ds.cachedChild->stringValue == dataStructure->cachedChild->stringValue
);
@@ -119,6 +124,11 @@
     CPPUNIT_ASSERT( ds.cachedChild->charValue == dataStructure->cachedChild->charValue
);
     CPPUNIT_ASSERT( ds.cachedChild->shortValue == dataStructure->cachedChild->shortValue
);
     CPPUNIT_ASSERT( ds.cachedChild->intValue == dataStructure->cachedChild->intValue
);
+    CPPUNIT_ASSERT( ds.cachedChild->longValue1 == dataStructure->cachedChild->longValue1
);
+    CPPUNIT_ASSERT( ds.cachedChild->longValue2 == dataStructure->cachedChild->longValue2
);
+    CPPUNIT_ASSERT( ds.cachedChild->longValue3 == dataStructure->cachedChild->longValue3
);
+    CPPUNIT_ASSERT( ds.cachedChild->longValue4 == dataStructure->cachedChild->longValue4
);
+    CPPUNIT_ASSERT( ds.cachedChild->longValue5 == dataStructure->cachedChild->longValue5
);
     CPPUNIT_ASSERT( ds.cachedChild->floatValue == dataStructure->cachedChild->floatValue
);
     CPPUNIT_ASSERT( ds.cachedChild->doubleValue == dataStructure->cachedChild->doubleValue
);
     CPPUNIT_ASSERT( ds.cachedChild->stringValue == dataStructure->cachedChild->stringValue
);

Modified: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/BaseDataStreamMarshallerTest.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/BaseDataStreamMarshallerTest.h?rev=588751&r1=588750&r2=588751&view=diff
==============================================================================
--- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/BaseDataStreamMarshallerTest.h
(original)
+++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/BaseDataStreamMarshallerTest.h
Fri Oct 26 12:04:41 2007
@@ -28,39 +28,43 @@
 namespace connector{
 namespace openwire{
 namespace marshal{
-    
+
     class BaseDataStreamMarshallerTest : public CppUnit::TestFixture {
-        
+
         CPPUNIT_TEST_SUITE( BaseDataStreamMarshallerTest );
         CPPUNIT_TEST( testLooseMarshal );
         CPPUNIT_TEST( testTightMarshal );
-        CPPUNIT_TEST_SUITE_END();                 
-        
+        CPPUNIT_TEST_SUITE_END();
+
     public:
-    
+
         class SimpleDataStructure : public commands::BaseDataStructure {
-            
+
         public:
-        
+
             bool boolValue;
             char charValue;
             short shortValue;
             int intValue;
-            long long longValue;
+            long long longValue1;
+            long long longValue2;
+            long long longValue3;
+            long long longValue4;
+            long long longValue5;
             float floatValue;
             double doubleValue;
             std::string stringValue;
-                        
+
         public:
-        
+
             const static unsigned char TYPE = 0xFF;
-            
+
             virtual ~SimpleDataStructure(){}
-            
+
             virtual unsigned char getDataStructureType() const {
                 return TYPE;
             }
-            
+
             virtual DataStructure* cloneDataStructure() const {
                 SimpleDataStructure* s = new SimpleDataStructure();
                 s->copyDataStructure( this );
@@ -76,41 +80,49 @@
                 charValue = srcObj->charValue;
                 shortValue = srcObj->shortValue;
                 intValue = srcObj->intValue;
-                longValue = srcObj->longValue;
+                longValue1 = srcObj->longValue1;
+                longValue2 = srcObj->longValue2;
+                longValue3 = srcObj->longValue3;
+                longValue4 = srcObj->longValue4;
+                longValue5 = srcObj->longValue5;
                 floatValue = srcObj->floatValue;
                 doubleValue = srcObj->doubleValue;
                 stringValue = srcObj->stringValue;
             }
         };
-        
+
         class SimpleDataStructureMarshaller : public BaseDataStreamMarshaller{
         public:
-        
+
             virtual ~SimpleDataStructureMarshaller(){}
-         
+
             virtual commands::DataStructure* createObject() const {
                 return new SimpleDataStructure();
             }
-            
+
             virtual unsigned char getDataStructureType() const {
                 return SimpleDataStructure::TYPE;
             }
-            
+
             virtual void tightUnmarshal( OpenWireFormat* wireFormat,
                                      commands::DataStructure* dataStructure,
                                      io::DataInputStream* dataIn,
-                                     utils::BooleanStream* bs ) throw( io::IOException )

+                                     utils::BooleanStream* bs ) throw( io::IOException )
              {
                 BaseDataStreamMarshaller::tightUnmarshal( wireFormat, dataStructure, dataIn,
bs );
 
                 SimpleDataStructure* info =
                     dynamic_cast<SimpleDataStructure*>( dataStructure );
-                    
+
                 info->boolValue = bs->readBoolean();
                 info->charValue = dataIn->readChar();
                 info->shortValue = dataIn->readShort();
                 info->intValue = dataIn->readInt();
-                info->longValue = tightUnmarshalLong( wireFormat, dataIn, bs );
+                info->longValue1 = tightUnmarshalLong( wireFormat, dataIn, bs );
+                info->longValue2 = tightUnmarshalLong( wireFormat, dataIn, bs );
+                info->longValue3 = tightUnmarshalLong( wireFormat, dataIn, bs );
+                info->longValue4 = tightUnmarshalLong( wireFormat, dataIn, bs );
+                info->longValue5 = tightUnmarshalLong( wireFormat, dataIn, bs );
                 info->floatValue = dataIn->readFloat();
                 info->doubleValue = dataIn->readDouble();
                 info->stringValue = tightUnmarshalString( dataIn, bs );
@@ -122,15 +134,19 @@
             {
                 SimpleDataStructure* info =
                     dynamic_cast<SimpleDataStructure*>( dataStructure );
-            
+
                 int rc = BaseDataStreamMarshaller::tightMarshal1( wireFormat, dataStructure,
bs );
                 bs->writeBoolean( info->boolValue );
-                rc += tightMarshalLong1( wireFormat, info->longValue, bs );
+                rc += tightMarshalLong1( wireFormat, info->longValue1, bs );
+                rc += tightMarshalLong1( wireFormat, info->longValue2, bs );
+                rc += tightMarshalLong1( wireFormat, info->longValue3, bs );
+                rc += tightMarshalLong1( wireFormat, info->longValue4, bs );
+                rc += tightMarshalLong1( wireFormat, info->longValue5, bs );
                 rc += tightMarshalString1( info->stringValue, bs );
-            
+
                 return 19 + rc;
             }
-    
+
             virtual void tightMarshal2( OpenWireFormat* wireFormat,
                                         commands::DataStructure* dataStructure,
                                         io::DataOutputStream* dataOut,
@@ -140,18 +156,22 @@
 
                 SimpleDataStructure* info =
                     dynamic_cast<SimpleDataStructure*>( dataStructure );
-                    
+
                 bs->readBoolean();
                 dataOut->writeChar( info->charValue );
                 dataOut->writeShort( info->shortValue );
-                dataOut->writeInt( info->intValue );                
-                tightMarshalLong2(wireFormat, info->longValue, dataOut, bs);
+                dataOut->writeInt( info->intValue );
+                tightMarshalLong2(wireFormat, info->longValue1, dataOut, bs);
+                tightMarshalLong2(wireFormat, info->longValue2, dataOut, bs);
+                tightMarshalLong2(wireFormat, info->longValue3, dataOut, bs);
+                tightMarshalLong2(wireFormat, info->longValue4, dataOut, bs);
+                tightMarshalLong2(wireFormat, info->longValue5, dataOut, bs);
                 dataOut->writeFloat( info->floatValue );
                 dataOut->writeDouble( info->doubleValue );
                 tightMarshalString2( info->stringValue, dataOut, bs );
-                
+
             }
-    
+
             virtual void looseUnmarshal( OpenWireFormat* wireFormat,
                                          commands::DataStructure* dataStructure,
                                          io::DataInputStream* dataIn ) throw( io::IOException
)
@@ -159,17 +179,21 @@
                 BaseDataStreamMarshaller::looseUnmarshal( wireFormat, dataStructure, dataIn
);
                 SimpleDataStructure* info =
                     dynamic_cast<SimpleDataStructure*>( dataStructure );
-                    
+
                 info->boolValue = dataIn->readBoolean();
                 info->charValue = dataIn->readChar();
                 info->shortValue = dataIn->readShort();
                 info->intValue = dataIn->readInt();
-                info->longValue = looseUnmarshalLong( wireFormat, dataIn );
+                info->longValue1 = looseUnmarshalLong( wireFormat, dataIn );
+                info->longValue2 = looseUnmarshalLong( wireFormat, dataIn );
+                info->longValue3 = looseUnmarshalLong( wireFormat, dataIn );
+                info->longValue4 = looseUnmarshalLong( wireFormat, dataIn );
+                info->longValue5 = looseUnmarshalLong( wireFormat, dataIn );
                 info->floatValue = dataIn->readFloat();
                 info->doubleValue = dataIn->readDouble();
                 info->stringValue = looseUnmarshalString( dataIn );
             }
-    
+
             virtual void looseMarshal( OpenWireFormat* wireFormat,
                                        commands::DataStructure* dataStructure,
                                        io::DataOutputStream* dataOut ) throw( io::IOException
)
@@ -177,51 +201,55 @@
                 SimpleDataStructure* info =
                     dynamic_cast<SimpleDataStructure*>( dataStructure );
                 BaseDataStreamMarshaller::looseMarshal( wireFormat, dataStructure, dataOut
);
-    
+
                 dataOut->writeBoolean( info->boolValue );
                 dataOut->writeChar( info->charValue );
                 dataOut->writeShort( info->shortValue );
                 dataOut->writeInt( info->intValue );
-                looseMarshalLong( wireFormat, info->longValue, dataOut );
+                looseMarshalLong( wireFormat, info->longValue1, dataOut );
+                looseMarshalLong( wireFormat, info->longValue2, dataOut );
+                looseMarshalLong( wireFormat, info->longValue3, dataOut );
+                looseMarshalLong( wireFormat, info->longValue4, dataOut );
+                looseMarshalLong( wireFormat, info->longValue5, dataOut );
                 dataOut->writeFloat( info->floatValue );
                 dataOut->writeDouble( info->doubleValue );
                 looseMarshalString( info->stringValue, dataOut );
             }
         };
-        
+
         class ComplexDataStructure : public commands::BaseDataStructure {
-            
+
         public:
-        
+
             bool boolValue;
             SimpleDataStructure* cachedChild;
-                        
+
         public:
-        
+
             const static unsigned char TYPE = 0xFE;
-            
+
             ComplexDataStructure(){
                 cachedChild = NULL;
             }
             virtual ~ComplexDataStructure(){
                 setCachedChild( NULL );
             }
-            
+
             void setCachedChild( SimpleDataStructure* child ) {
                 if( cachedChild != NULL ) {
                     delete cachedChild;
                     cachedChild = NULL;
                 }
-                
+
                 if( child != NULL ) {
                     cachedChild = child;
                 }
             }
-            
+
             virtual unsigned char getDataStructureType() const {
                 return TYPE;
             }
-            
+
             virtual DataStructure* cloneDataStructure() const {
                 ComplexDataStructure* s = new ComplexDataStructure();
                 s->copyDataStructure( this );
@@ -234,41 +262,41 @@
                     return;
                 }
                 boolValue = srcObj->boolValue;
-                
+
                 if( cachedChild != NULL ) {
                     delete cachedChild;
                     cachedChild = NULL;
                 }
-                
+
                 if( srcObj->cachedChild != NULL ) {
                     cachedChild = dynamic_cast<SimpleDataStructure*>(srcObj->cachedChild->cloneDataStructure());
-                }             
+                }
             }
         };
-        
+
         class ComplexDataStructureMarshaller : public BaseDataStreamMarshaller{
         public:
-        
+
             virtual ~ComplexDataStructureMarshaller(){}
-         
+
             virtual commands::DataStructure* createObject() const {
                 return new ComplexDataStructure();
             }
-            
+
             virtual unsigned char getDataStructureType() const {
                 return ComplexDataStructure::TYPE;
             }
-            
+
             virtual void tightUnmarshal( OpenWireFormat* wireFormat,
                                      commands::DataStructure* dataStructure,
                                      io::DataInputStream* dataIn,
-                                     utils::BooleanStream* bs ) throw( io::IOException )

+                                     utils::BooleanStream* bs ) throw( io::IOException )
              {
                 BaseDataStreamMarshaller::tightUnmarshal( wireFormat, dataStructure, dataIn,
bs );
 
                 ComplexDataStructure* info =
                     dynamic_cast<ComplexDataStructure*>( dataStructure );
-                    
+
                 info->boolValue = bs->readBoolean();
                 info->setCachedChild( dynamic_cast< SimpleDataStructure* >(
                     tightUnmarshalCachedObject( wireFormat, dataIn, bs ) ) );
@@ -280,14 +308,14 @@
             {
                 ComplexDataStructure* info =
                     dynamic_cast<ComplexDataStructure*>( dataStructure );
-            
+
                 int rc = BaseDataStreamMarshaller::tightMarshal1( wireFormat, dataStructure,
bs );
                 bs->writeBoolean( info->boolValue );
                 rc += tightMarshalCachedObject1( wireFormat, info->cachedChild, bs );
-            
+
                 return rc;
             }
-    
+
             virtual void tightMarshal2( OpenWireFormat* wireFormat,
                                         commands::DataStructure* dataStructure,
                                         io::DataOutputStream* dataOut,
@@ -297,12 +325,12 @@
 
                 ComplexDataStructure* info =
                     dynamic_cast<ComplexDataStructure*>( dataStructure );
-                    
+
                 bs->readBoolean();
                 tightMarshalCachedObject2( wireFormat, info->cachedChild, dataOut, bs
);
-                
+
             }
-    
+
             virtual void looseUnmarshal( OpenWireFormat* wireFormat,
                                          commands::DataStructure* dataStructure,
                                          io::DataInputStream* dataIn ) throw( io::IOException
)
@@ -310,12 +338,12 @@
                 BaseDataStreamMarshaller::looseUnmarshal( wireFormat, dataStructure, dataIn
);
                 ComplexDataStructure* info =
                     dynamic_cast<ComplexDataStructure*>( dataStructure );
-                    
+
                 info->boolValue = dataIn->readBoolean();
-                info->setCachedChild( dynamic_cast< SimpleDataStructure* >( 
+                info->setCachedChild( dynamic_cast< SimpleDataStructure* >(
                     looseUnmarshalCachedObject( wireFormat, dataIn ) ) );
             }
-    
+
             virtual void looseMarshal( OpenWireFormat* wireFormat,
                                        commands::DataStructure* dataStructure,
                                        io::DataOutputStream* dataOut ) throw( io::IOException
)
@@ -323,21 +351,21 @@
                 ComplexDataStructure* info =
                     dynamic_cast<ComplexDataStructure*>( dataStructure );
                 BaseDataStreamMarshaller::looseMarshal( wireFormat, dataStructure, dataOut
);
-    
+
                 dataOut->writeBoolean( info->boolValue );
                 looseMarshalCachedObject( wireFormat, info->cachedChild, dataOut );
             }
         };
-        
+
     private:
-    
+
         ComplexDataStructure* dataStructure;
 
     public:
-    
+
         BaseDataStreamMarshallerTest() {}
         virtual ~BaseDataStreamMarshallerTest() {}
-        
+
         virtual void setUp(){
             dataStructure = new ComplexDataStructure();
             dataStructure->boolValue = true;
@@ -346,23 +374,27 @@
             dataStructure->cachedChild->charValue = 'a';
             dataStructure->cachedChild->shortValue = 1000;
             dataStructure->cachedChild->intValue = 100000;
-            dataStructure->cachedChild->longValue = 1000000;
+            dataStructure->cachedChild->longValue1 = 1000000;
+            dataStructure->cachedChild->longValue2 = 256;
+            dataStructure->cachedChild->longValue3 = 65536;
+            dataStructure->cachedChild->longValue4 = 65535;
+            dataStructure->cachedChild->longValue5 = 32769;
             dataStructure->cachedChild->floatValue = 10.3f;
             dataStructure->cachedChild->doubleValue = 20.1;
             dataStructure->cachedChild->stringValue = "hello world";
-        } 
-        
+        }
+
         virtual void tearDown(){
-            
+
             if( dataStructure != NULL ) {
                 delete dataStructure;
                 dataStructure = NULL;
             }
         }
-    
+
         void testLooseMarshal();
         void testTightMarshal();
-        
+
     };
 
 }}}}



Mime
View raw message