You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2007/02/07 01:09:45 UTC
svn commit: r504385 - in /activemq/activemq-cpp/trunk/activemq-cpp/src:
main/activemq/connector/openwire/commands/BaseCommand.h
test/activemq/connector/openwire/commands/BrokerInfoTest.cpp
Author: tabish
Date: Tue Feb 6 16:09:44 2007
New Revision: 504385
URL: http://svn.apache.org/viewvc?view=rev&rev=504385
Log:
http://issues.apache.org/activemq/browse/AMQCPP-30
Modified:
activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/BaseCommand.h
activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/BrokerInfoTest.cpp
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/BaseCommand.h
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/BaseCommand.h?view=diff&rev=504385&r1=504384&r2=504385
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/BaseCommand.h (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/connector/openwire/commands/BaseCommand.h Tue Feb 6 16:09:44 2007
@@ -71,6 +71,20 @@
virtual bool isResponseRequired() const {
return responseRequired;
}
+
+ /**
+ * Copy the contents of the passed object into this objects
+ * members, overwriting any existing data.
+ * @return src - Source Object
+ */
+ virtual void copyDataStructure( const DataStructure* src ) {
+
+ const BaseCommand<T>* command =
+ dynamic_cast< const BaseCommand<T>* >( src );
+
+ this->setResponseRequired( command->isResponseRequired() );
+ this->setCommandId( command->getCommandId() );
+ }
private:
Modified: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/BrokerInfoTest.cpp
URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/BrokerInfoTest.cpp?view=diff&rev=504385&r1=504384&r2=504385
==============================================================================
--- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/BrokerInfoTest.cpp (original)
+++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/commands/BrokerInfoTest.cpp Tue Feb 6 16:09:44 2007
@@ -34,4 +34,20 @@
BrokerInfo myCommand;
CPPUNIT_ASSERT( myCommand.getDataStructureType() == BrokerInfo::ID_BROKERINFO );
+
+ myCommand.setBrokerName( "BrokerName" );
+ myCommand.setBrokerURL( "http://www.example.com" );
+ myCommand.setCommandId( 37 );
+ myCommand.setMasterBroker( true );
+
+ BrokerInfo* copy =
+ dynamic_cast<BrokerInfo*>( myCommand.cloneDataStructure() );
+
+ CPPUNIT_ASSERT( copy != NULL );
+ CPPUNIT_ASSERT( copy->getBrokerName() == myCommand.getBrokerName() );
+ CPPUNIT_ASSERT( copy->getBrokerURL() == myCommand.getBrokerURL() );
+ CPPUNIT_ASSERT( copy->getCommandId() == myCommand.getCommandId() );
+ CPPUNIT_ASSERT( copy->isMasterBroker() == myCommand.isMasterBroker() );
+
+ delete copy;
}