activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r503491 - in /activemq/activemq-cpp/trunk/activemq-cpp: src/main/activemq/connector/openwire/commands/ src/test/activemq/connector/openwire/commands/ vs2005-build/
Date Sun, 04 Feb 2007 21:38:27 GMT
Author: tabish
Date: Sun Feb  4 13:38:26 2007
New Revision: 503491

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

Modified:
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h
    activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMapMessageTest.cpp
    activemq/activemq-cpp/trunk/activemq-cpp/vs2005-build/vs2005-activemq-unittests.vcproj
    activemq/activemq-cpp/trunk/activemq-cpp/vs2005-build/vs2005-activemq.vcproj

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp?view=diff&rev=503491&r1=503490&r2=503491
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.cpp
Sun Feb  4 13:38:26 2007
@@ -66,6 +66,32 @@
 
     try{ 
         
+        this->checkMapIsUnmarshalled();
+        return *map;
+    }
+    AMQ_CATCH_RETHROW( exceptions::NullPointerException )
+    AMQ_CATCHALL_THROW( exceptions::NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+const util::PrimitiveMap& ActiveMQMapMessage::getMap() const 
+    throw ( exceptions::NullPointerException ) {
+
+    try{
+
+        this->checkMapIsUnmarshalled();
+        return *map;
+    }
+    AMQ_CATCH_RETHROW( exceptions::NullPointerException )
+    AMQ_CATCHALL_THROW( exceptions::NullPointerException )
+}
+
+////////////////////////////////////////////////////////////////////////////////
+void ActiveMQMapMessage::checkMapIsUnmarshalled() const 
+    throw ( exceptions::NullPointerException ) {
+
+    try {
+
         if( map == NULL ) {
             
             if( getContent().size() == 0 ){
@@ -82,19 +108,6 @@
                     "map have fialed." );
             }    
         }
-        
-        return *map;
-    }
-    AMQ_CATCH_RETHROW( exceptions::NullPointerException )
-    AMQ_CATCHALL_THROW( exceptions::NullPointerException )
-}
-
-////////////////////////////////////////////////////////////////////////////////
-const util::PrimitiveMap& ActiveMQMapMessage::getMap() const 
-    throw ( exceptions::NullPointerException ) {
-
-    try{
-        this->getMap();
     }
     AMQ_CATCH_RETHROW( exceptions::NullPointerException )
     AMQ_CATCHALL_THROW( exceptions::NullPointerException )
@@ -104,7 +117,7 @@
 std::vector<std::string> ActiveMQMapMessage::getMapNames(void) const {
 
     try{
-        getMap().getKeys();
+        return getMap().getKeys();
     }
     AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
     AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
@@ -114,7 +127,7 @@
 bool ActiveMQMapMessage::itemExists( const std::string& name ) const {
 
     try{
-        getMap().contains( name );
+        return getMap().contains( name );
     }
     AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
     AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
@@ -125,7 +138,7 @@
     throw( cms::CMSException ) {
 
     try{
-        getMap().getBool( name );
+        return getMap().getBool( name );
     }
     AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
     AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
@@ -147,7 +160,7 @@
     throw( cms::CMSException ) {
 
     try{
-        getMap().getByte( name );
+        return getMap().getByte( name );
     }
     AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
     AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
@@ -170,7 +183,7 @@
     throw( cms::CMSException ) {
 
     try{
-        getMap().getByteArray( name );
+        return NULL; // TODO getMap().getByteArray( name );
     }
     AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
     AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
@@ -193,7 +206,7 @@
     throw( cms::CMSException ) {
 
     try{
-        getMap().getChar( name );
+        return getMap().getChar( name );
     }
     AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
     AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
@@ -215,7 +228,7 @@
     throw( cms::CMSException ) {
 
     try{
-        getMap().getDouble( name );
+        return getMap().getDouble( name );
     }
     AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
     AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
@@ -238,7 +251,7 @@
     throw( cms::CMSException ) {
 
     try{
-        getMap().getFloat( name );
+        return getMap().getFloat( name );
     }
     AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
     AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
@@ -260,7 +273,7 @@
     throw( cms::CMSException ) {
 
     try{
-        getMap().getInt( name );
+        return getMap().getInt( name );
     }
     AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
     AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
@@ -282,7 +295,7 @@
     throw( cms::CMSException ) {
 
     try{
-        getMap().getLong( name );
+        return getMap().getLong( name );
     }
     AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
     AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
@@ -304,7 +317,7 @@
     throw( cms::CMSException ) {
 
     try{
-        getMap().getShort( name );
+        return getMap().getShort( name );
     }
     AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
     AMQ_CATCHALL_THROW( exceptions::ActiveMQException )
@@ -326,7 +339,7 @@
     throw( cms::CMSException ) {
 
     try{
-        getMap().getString( name );
+        return getMap().getString( name );
     }
     AMQ_CATCH_RETHROW( exceptions::ActiveMQException )
     AMQ_CATCHALL_THROW( exceptions::ActiveMQException )

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h?view=diff&rev=503491&r1=503490&r2=503491
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/ActiveMQMapMessage.h
Sun Feb  4 13:38:26 2007
@@ -297,6 +297,12 @@
         util::PrimitiveMap& getMap() throw ( exceptions::NullPointerException );
         const util::PrimitiveMap& getMap() const throw ( exceptions::NullPointerException
);
 
+        /**
+         * Performs the unmarshal on the Map if needed, otherwise just returns
+         */
+        virtual void checkMapIsUnmarshalled() const 
+            throw ( exceptions::NullPointerException );
+
     private:
     
         // Map Structure to hold unmarshalled Map Data

Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMapMessageTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMapMessageTest.cpp?view=diff&rev=503491&r1=503490&r2=503491
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMapMessageTest.cpp
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/ActiveMQMapMessageTest.cpp
Sun Feb  4 13:38:26 2007
@@ -35,4 +35,25 @@
     ActiveMQMapMessage myMessage;
     
     CPPUNIT_ASSERT( myMessage.getDataStructureType() == ActiveMQMapMessage::ID_ACTIVEMQMAPMESSAGE
);
+
+    CPPUNIT_ASSERT( myMessage.getMapNames().size() == 0 );
+    CPPUNIT_ASSERT( myMessage.itemExists( "Something" ) == false );
+    
+    myMessage.setBoolean( "boolean", false );
+    myMessage.setByte( "byte", 127 );
+    myMessage.setChar( "char", 'a' );
+    myMessage.setShort( "short", 32000 );
+    myMessage.setInt( "int", 6789999 );
+    myMessage.setLong( "long", 0xFFFAAA33345LL );
+    myMessage.setFloat( "float", 0.000012f );
+    myMessage.setDouble( "double", 64.54654 );
+
+    CPPUNIT_ASSERT( myMessage.getBoolean( "boolean" ) == false );
+    CPPUNIT_ASSERT( myMessage.getByte( "byte" ) == 127 );
+    CPPUNIT_ASSERT( myMessage.getChar( "char" ) == 'a' );
+    CPPUNIT_ASSERT( myMessage.getShort( "short" ) == 32000 );
+    CPPUNIT_ASSERT( myMessage.getInt( "int" ) == 6789999 );
+    CPPUNIT_ASSERT( myMessage.getLong( "long" ) == 0xFFFAAA33345LL );
+    CPPUNIT_ASSERT( myMessage.getFloat( "float" ) == 0.000012f );
+    CPPUNIT_ASSERT( myMessage.getDouble( "double" ) == 64.54654 );
 }

Modified: activemq/activemq-cpp/trunk/activemq-cpp/vs2005-build/vs2005-activemq-unittests.vcproj
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/vs2005-build/vs2005-activemq-unittests.vcproj?view=diff&rev=503491&r1=503490&r2=503491
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/vs2005-build/vs2005-activemq-unittests.vcproj
(original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/vs2005-build/vs2005-activemq-unittests.vcproj
Sun Feb  4 13:38:26 2007
@@ -451,6 +451,14 @@
 							>
 						</File>
 						<File
+							RelativePath="..\src\test\activemq\connector\openwire\commands\ActiveMQMapMessageTest.cpp"
+							>
+						</File>
+						<File
+							RelativePath="..\src\test\activemq\connector\openwire\commands\ActiveMQMapMessageTest.h"
+							>
+						</File>
+						<File
 							RelativePath="..\src\test\activemq\connector\openwire\commands\ActiveMQQueueTest.cpp"
 							>
 						</File>

Modified: activemq/activemq-cpp/trunk/activemq-cpp/vs2005-build/vs2005-activemq.vcproj
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/vs2005-build/vs2005-activemq.vcproj?view=diff&rev=503491&r1=503490&r2=503491
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/vs2005-build/vs2005-activemq.vcproj (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/vs2005-build/vs2005-activemq.vcproj Sun Feb 
4 13:38:26 2007
@@ -1347,10 +1347,6 @@
 							>
 						</File>
 						<File
-							RelativePath="..\src\main\activemq\connector\openwire\commands\BaseCommand.cpp"
-							>
-						</File>
-						<File
 							RelativePath="..\src\main\activemq\connector\openwire\commands\BaseCommand.h"
 							>
 						</File>



Mime
View raw message