From commits-return-13737-apmail-activemq-commits-archive=activemq.apache.org@activemq.apache.org Tue Jun 08 22:49:07 2010 Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 42062 invoked from network); 8 Jun 2010 22:49:07 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 8 Jun 2010 22:49:07 -0000 Received: (qmail 69101 invoked by uid 500); 8 Jun 2010 22:49:06 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 69050 invoked by uid 500); 8 Jun 2010 22:49:06 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 69038 invoked by uid 99); 8 Jun 2010 22:49:06 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jun 2010 22:49:06 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jun 2010 22:48:50 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 512462388C06; Tue, 8 Jun 2010 22:47:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r952853 [12/18] - in /activemq/activemq-cpp/trunk/activemq-cpp/src: main/ main/activemq/wireformat/openwire/marshal/v6/ test/ test/activemq/wireformat/openwire/marshal/v6/ Date: Tue, 08 Jun 2010 22:47:52 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100608224756.512462388C06@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/v6/srcmakefile.mk URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/v6/srcmakefile.mk?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/v6/srcmakefile.mk (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/main/activemq/wireformat/openwire/marshal/v6/srcmakefile.mk Tue Jun 8 22:47:47 2010 @@ -0,0 +1,144 @@ +# --------------------------------------------------------------------------- +# 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. +# --------------------------------------------------------------------------- + +cc_sources += \ + activemq/wireformat/openwire/marshal/v6/ActiveMQBlobMessageMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ActiveMQBytesMessageMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ActiveMQDestinationMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ActiveMQMapMessageMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ActiveMQMessageMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ActiveMQObjectMessageMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ActiveMQQueueMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ActiveMQStreamMessageMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ActiveMQTempDestinationMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ActiveMQTempQueueMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ActiveMQTempTopicMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ActiveMQTextMessageMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ActiveMQTopicMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/BaseCommandMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/BrokerIdMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/BrokerInfoMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ConnectionControlMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ConnectionErrorMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ConnectionIdMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ConnectionInfoMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ConsumerControlMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ConsumerIdMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ConsumerInfoMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ControlCommandMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/DataArrayResponseMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/DataResponseMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/DestinationInfoMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/DiscoveryEventMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ExceptionResponseMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/FlushCommandMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/IntegerResponseMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/JournalQueueAckMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/JournalTopicAckMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/JournalTraceMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/JournalTransactionMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/KeepAliveInfoMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/LastPartialCommandMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/LocalTransactionIdMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/MarshallerFactory.cpp \ + activemq/wireformat/openwire/marshal/v6/MessageAckMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/MessageDispatchMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/MessageDispatchNotificationMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/MessageIdMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/MessageMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/MessagePullMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/NetworkBridgeFilterMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/PartialCommandMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ProducerAckMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ProducerIdMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ProducerInfoMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/RemoveInfoMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/RemoveSubscriptionInfoMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ReplayCommandMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ResponseMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/SessionIdMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/SessionInfoMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/ShutdownInfoMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/SubscriptionInfoMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/TransactionIdMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/TransactionInfoMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/WireFormatInfoMarshaller.cpp \ + activemq/wireformat/openwire/marshal/v6/XATransactionIdMarshaller.cpp + +h_sources += \ + activemq/wireformat/openwire/marshal/v6/ActiveMQBlobMessageMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ActiveMQBytesMessageMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ActiveMQDestinationMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ActiveMQMapMessageMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ActiveMQMessageMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ActiveMQObjectMessageMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ActiveMQQueueMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ActiveMQStreamMessageMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ActiveMQTempDestinationMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ActiveMQTempQueueMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ActiveMQTempTopicMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ActiveMQTextMessageMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ActiveMQTopicMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/BaseCommandMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/BrokerIdMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/BrokerInfoMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ConnectionControlMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ConnectionErrorMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ConnectionIdMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ConnectionInfoMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ConsumerControlMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ConsumerIdMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ConsumerInfoMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ControlCommandMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/DataArrayResponseMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/DataResponseMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/DestinationInfoMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/DiscoveryEventMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ExceptionResponseMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/FlushCommandMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/IntegerResponseMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/JournalQueueAckMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/JournalTopicAckMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/JournalTraceMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/JournalTransactionMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/KeepAliveInfoMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/LastPartialCommandMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/LocalTransactionIdMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/MarshallerFactory.h \ + activemq/wireformat/openwire/marshal/v6/MessageAckMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/MessageDispatchMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/MessageDispatchNotificationMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/MessageIdMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/MessageMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/MessagePullMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/NetworkBridgeFilterMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/PartialCommandMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ProducerAckMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ProducerIdMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ProducerInfoMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/RemoveInfoMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/RemoveSubscriptionInfoMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ReplayCommandMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ResponseMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/SessionIdMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/SessionInfoMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/ShutdownInfoMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/SubscriptionInfoMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/TransactionIdMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/TransactionInfoMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/WireFormatInfoMarshaller.h \ + activemq/wireformat/openwire/marshal/v6/XATransactionIdMarshaller.h Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBlobMessageMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBlobMessageMarshallerTest.cpp?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBlobMessageMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBlobMessageMarshallerTest.cpp Tue Jun 8 22:47:47 2010 @@ -0,0 +1,181 @@ +/* + * 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 + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +// NOTE!: This file is autogenerated - do not modify! +// if you need to make a change, please see the Java Classes in the +// activemq-core module +// + +using namespace std; +using namespace activemq; +using namespace activemq::util; +using namespace activemq::exceptions; +using namespace activemq::commands; +using namespace activemq::wireformat; +using namespace activemq::wireformat::openwire; +using namespace activemq::wireformat::openwire::marshal; +using namespace activemq::wireformat::openwire::utils; +using namespace activemq::wireformat::openwire::marshal::v6; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQBlobMessageMarshallerTest::test() { + + ActiveMQBlobMessageMarshaller myMarshaller; + ActiveMQBlobMessage myCommand; + ActiveMQBlobMessage* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQBlobMessageMarshallerTest::testLooseMarshal() { + + ActiveMQBlobMessageMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + ActiveMQBlobMessage outCommand; + ActiveMQBlobMessage inCommand; + + Pointer producerId( new ProducerId() ); + producerId->setConnectionId( "ConnectionId" ); + producerId->setSessionId( 123 ); + producerId->setValue( 42 ); + + Pointer messageId( new MessageId() ); + messageId->setBrokerSequenceId( 1 ); + messageId->setProducerSequenceId( 3 ); + messageId->setProducerId( producerId ); + + outCommand.setMessageId( messageId ); + + try { + + // Marshal the dataStructure to a byte array. + ByteArrayOutputStream baos; + DataOutputStream dataOut( &baos ); + dataOut.writeByte( outCommand.getDataStructureType() ); + marshaller.looseMarshal( &openWireFormat, &outCommand, &dataOut ); + + // Now read it back in and make sure it's all right. + std::pair array = baos.toByteArray(); + ByteArrayInputStream bais( array.first, array.second, true ); + DataInputStream dataIn( &bais ); + unsigned char dataType = dataIn.readByte(); + CPPUNIT_ASSERT( dataType == outCommand.getDataStructureType() ); + marshaller.looseUnmarshal( &openWireFormat, &inCommand, &dataIn ); + + CPPUNIT_ASSERT( inCommand.equals( &outCommand ) == true ); + + } catch( ActiveMQException& e ) { + e.printStackTrace(); + CPPUNIT_ASSERT( false ); + } catch( ... ) { + CPPUNIT_ASSERT( false ); + } +} + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQBlobMessageMarshallerTest::testTightMarshal() { + + ActiveMQBlobMessageMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + ActiveMQBlobMessage outCommand; + ActiveMQBlobMessage inCommand; + + Pointer producerId( new ProducerId() ); + producerId->setConnectionId( "ConnectionId" ); + producerId->setSessionId( 123 ); + producerId->setValue( 42 ); + + Pointer messageId( new MessageId() ); + messageId->setBrokerSequenceId( 1 ); + messageId->setProducerSequenceId( 3 ); + messageId->setProducerId( producerId ); + + outCommand.setMessageId( messageId ); + + try { + + // Marshal the dataStructure to a byte array. + ByteArrayOutputStream baos; + DataOutputStream dataOut( &baos ); + // Phase 1 - count the size + int size = 1; + BooleanStream bs; + size += marshaller.tightMarshal1( &openWireFormat, &outCommand, &bs ); + size += bs.marshalledSize(); + // Phase 2 - marshal + dataOut.writeByte( outCommand.getDataStructureType() ); + bs.marshal( &dataOut ); + marshaller.tightMarshal2( &openWireFormat, &outCommand, &dataOut, &bs ); + + // Now read it back in and make sure it's all right. + std::pair array = baos.toByteArray(); + ByteArrayInputStream bais( array.first, array.second, true ); + DataInputStream dataIn( &bais ); + + unsigned char dataType = dataIn.readByte(); + CPPUNIT_ASSERT( dataType == outCommand.getDataStructureType() ); + bs.clear(); + bs.unmarshal( &dataIn ); + marshaller.tightUnmarshal( &openWireFormat, &inCommand, &dataIn, &bs ); + + CPPUNIT_ASSERT( inCommand.equals( &outCommand ) == true ); + + } catch( ActiveMQException& e ) { + e.printStackTrace(); + CPPUNIT_ASSERT( false ); + } catch( ... ) { + CPPUNIT_ASSERT( false ); + } +} + Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBlobMessageMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBlobMessageMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBlobMessageMarshallerTest.h?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBlobMessageMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBlobMessageMarshallerTest.h Tue Jun 8 22:47:47 2010 @@ -0,0 +1,66 @@ +/* + * 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_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQBLOBMESSAGEMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQBLOBMESSAGEMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace wireformat{ +namespace openwire{ +namespace marshal{ +namespace v6{ + + /** + * Marshalling Test code for Open Wire Format for ActiveMQBlobMessageMarshallerTest + * + * NOTE!: This file is autogenerated - do not modify! + * if you need to make a change, please see the Java Classes + * in the activemq-openwire-generator module + */ + class ActiveMQBlobMessageMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( ActiveMQBlobMessageMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + ActiveMQBlobMessageMarshallerTest() {} + virtual ~ActiveMQBlobMessageMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQBLOBMESSAGEMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBlobMessageMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBytesMessageMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBytesMessageMarshallerTest.cpp?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBytesMessageMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBytesMessageMarshallerTest.cpp Tue Jun 8 22:47:47 2010 @@ -0,0 +1,181 @@ +/* + * 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 + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +// NOTE!: This file is autogenerated - do not modify! +// if you need to make a change, please see the Java Classes in the +// activemq-core module +// + +using namespace std; +using namespace activemq; +using namespace activemq::util; +using namespace activemq::exceptions; +using namespace activemq::commands; +using namespace activemq::wireformat; +using namespace activemq::wireformat::openwire; +using namespace activemq::wireformat::openwire::marshal; +using namespace activemq::wireformat::openwire::utils; +using namespace activemq::wireformat::openwire::marshal::v6; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQBytesMessageMarshallerTest::test() { + + ActiveMQBytesMessageMarshaller myMarshaller; + ActiveMQBytesMessage myCommand; + ActiveMQBytesMessage* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQBytesMessageMarshallerTest::testLooseMarshal() { + + ActiveMQBytesMessageMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + ActiveMQBytesMessage outCommand; + ActiveMQBytesMessage inCommand; + + Pointer producerId( new ProducerId() ); + producerId->setConnectionId( "ConnectionId" ); + producerId->setSessionId( 123 ); + producerId->setValue( 42 ); + + Pointer messageId( new MessageId() ); + messageId->setBrokerSequenceId( 1 ); + messageId->setProducerSequenceId( 3 ); + messageId->setProducerId( producerId ); + + outCommand.setMessageId( messageId ); + + try { + + // Marshal the dataStructure to a byte array. + ByteArrayOutputStream baos; + DataOutputStream dataOut( &baos ); + dataOut.writeByte( outCommand.getDataStructureType() ); + marshaller.looseMarshal( &openWireFormat, &outCommand, &dataOut ); + + // Now read it back in and make sure it's all right. + std::pair array = baos.toByteArray(); + ByteArrayInputStream bais( array.first, array.second, true ); + DataInputStream dataIn( &bais ); + unsigned char dataType = dataIn.readByte(); + CPPUNIT_ASSERT( dataType == outCommand.getDataStructureType() ); + marshaller.looseUnmarshal( &openWireFormat, &inCommand, &dataIn ); + + CPPUNIT_ASSERT( inCommand.equals( &outCommand ) == true ); + + } catch( ActiveMQException& e ) { + e.printStackTrace(); + CPPUNIT_ASSERT( false ); + } catch( ... ) { + CPPUNIT_ASSERT( false ); + } +} + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQBytesMessageMarshallerTest::testTightMarshal() { + + ActiveMQBytesMessageMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + ActiveMQBytesMessage outCommand; + ActiveMQBytesMessage inCommand; + + Pointer producerId( new ProducerId() ); + producerId->setConnectionId( "ConnectionId" ); + producerId->setSessionId( 123 ); + producerId->setValue( 42 ); + + Pointer messageId( new MessageId() ); + messageId->setBrokerSequenceId( 1 ); + messageId->setProducerSequenceId( 3 ); + messageId->setProducerId( producerId ); + + outCommand.setMessageId( messageId ); + + try { + + // Marshal the dataStructure to a byte array. + ByteArrayOutputStream baos; + DataOutputStream dataOut( &baos ); + // Phase 1 - count the size + int size = 1; + BooleanStream bs; + size += marshaller.tightMarshal1( &openWireFormat, &outCommand, &bs ); + size += bs.marshalledSize(); + // Phase 2 - marshal + dataOut.writeByte( outCommand.getDataStructureType() ); + bs.marshal( &dataOut ); + marshaller.tightMarshal2( &openWireFormat, &outCommand, &dataOut, &bs ); + + // Now read it back in and make sure it's all right. + std::pair array = baos.toByteArray(); + ByteArrayInputStream bais( array.first, array.second, true ); + DataInputStream dataIn( &bais ); + + unsigned char dataType = dataIn.readByte(); + CPPUNIT_ASSERT( dataType == outCommand.getDataStructureType() ); + bs.clear(); + bs.unmarshal( &dataIn ); + marshaller.tightUnmarshal( &openWireFormat, &inCommand, &dataIn, &bs ); + + CPPUNIT_ASSERT( inCommand.equals( &outCommand ) == true ); + + } catch( ActiveMQException& e ) { + e.printStackTrace(); + CPPUNIT_ASSERT( false ); + } catch( ... ) { + CPPUNIT_ASSERT( false ); + } +} + Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBytesMessageMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBytesMessageMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBytesMessageMarshallerTest.h?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBytesMessageMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBytesMessageMarshallerTest.h Tue Jun 8 22:47:47 2010 @@ -0,0 +1,66 @@ +/* + * 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_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQBYTESMESSAGEMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQBYTESMESSAGEMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace wireformat{ +namespace openwire{ +namespace marshal{ +namespace v6{ + + /** + * Marshalling Test code for Open Wire Format for ActiveMQBytesMessageMarshallerTest + * + * NOTE!: This file is autogenerated - do not modify! + * if you need to make a change, please see the Java Classes + * in the activemq-openwire-generator module + */ + class ActiveMQBytesMessageMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( ActiveMQBytesMessageMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + ActiveMQBytesMessageMarshallerTest() {} + virtual ~ActiveMQBytesMessageMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQBYTESMESSAGEMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQBytesMessageMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMapMessageMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMapMessageMarshallerTest.cpp?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMapMessageMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMapMessageMarshallerTest.cpp Tue Jun 8 22:47:47 2010 @@ -0,0 +1,181 @@ +/* + * 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 + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +// NOTE!: This file is autogenerated - do not modify! +// if you need to make a change, please see the Java Classes in the +// activemq-core module +// + +using namespace std; +using namespace activemq; +using namespace activemq::util; +using namespace activemq::exceptions; +using namespace activemq::commands; +using namespace activemq::wireformat; +using namespace activemq::wireformat::openwire; +using namespace activemq::wireformat::openwire::marshal; +using namespace activemq::wireformat::openwire::utils; +using namespace activemq::wireformat::openwire::marshal::v6; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQMapMessageMarshallerTest::test() { + + ActiveMQMapMessageMarshaller myMarshaller; + ActiveMQMapMessage myCommand; + ActiveMQMapMessage* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQMapMessageMarshallerTest::testLooseMarshal() { + + ActiveMQMapMessageMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + ActiveMQMapMessage outCommand; + ActiveMQMapMessage inCommand; + + Pointer producerId( new ProducerId() ); + producerId->setConnectionId( "ConnectionId" ); + producerId->setSessionId( 123 ); + producerId->setValue( 42 ); + + Pointer messageId( new MessageId() ); + messageId->setBrokerSequenceId( 1 ); + messageId->setProducerSequenceId( 3 ); + messageId->setProducerId( producerId ); + + outCommand.setMessageId( messageId ); + + try { + + // Marshal the dataStructure to a byte array. + ByteArrayOutputStream baos; + DataOutputStream dataOut( &baos ); + dataOut.writeByte( outCommand.getDataStructureType() ); + marshaller.looseMarshal( &openWireFormat, &outCommand, &dataOut ); + + // Now read it back in and make sure it's all right. + std::pair array = baos.toByteArray(); + ByteArrayInputStream bais( array.first, array.second, true ); + DataInputStream dataIn( &bais ); + unsigned char dataType = dataIn.readByte(); + CPPUNIT_ASSERT( dataType == outCommand.getDataStructureType() ); + marshaller.looseUnmarshal( &openWireFormat, &inCommand, &dataIn ); + + CPPUNIT_ASSERT( inCommand.equals( &outCommand ) == true ); + + } catch( ActiveMQException& e ) { + e.printStackTrace(); + CPPUNIT_ASSERT( false ); + } catch( ... ) { + CPPUNIT_ASSERT( false ); + } +} + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQMapMessageMarshallerTest::testTightMarshal() { + + ActiveMQMapMessageMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + ActiveMQMapMessage outCommand; + ActiveMQMapMessage inCommand; + + Pointer producerId( new ProducerId() ); + producerId->setConnectionId( "ConnectionId" ); + producerId->setSessionId( 123 ); + producerId->setValue( 42 ); + + Pointer messageId( new MessageId() ); + messageId->setBrokerSequenceId( 1 ); + messageId->setProducerSequenceId( 3 ); + messageId->setProducerId( producerId ); + + outCommand.setMessageId( messageId ); + + try { + + // Marshal the dataStructure to a byte array. + ByteArrayOutputStream baos; + DataOutputStream dataOut( &baos ); + // Phase 1 - count the size + int size = 1; + BooleanStream bs; + size += marshaller.tightMarshal1( &openWireFormat, &outCommand, &bs ); + size += bs.marshalledSize(); + // Phase 2 - marshal + dataOut.writeByte( outCommand.getDataStructureType() ); + bs.marshal( &dataOut ); + marshaller.tightMarshal2( &openWireFormat, &outCommand, &dataOut, &bs ); + + // Now read it back in and make sure it's all right. + std::pair array = baos.toByteArray(); + ByteArrayInputStream bais( array.first, array.second, true ); + DataInputStream dataIn( &bais ); + + unsigned char dataType = dataIn.readByte(); + CPPUNIT_ASSERT( dataType == outCommand.getDataStructureType() ); + bs.clear(); + bs.unmarshal( &dataIn ); + marshaller.tightUnmarshal( &openWireFormat, &inCommand, &dataIn, &bs ); + + CPPUNIT_ASSERT( inCommand.equals( &outCommand ) == true ); + + } catch( ActiveMQException& e ) { + e.printStackTrace(); + CPPUNIT_ASSERT( false ); + } catch( ... ) { + CPPUNIT_ASSERT( false ); + } +} + Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMapMessageMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMapMessageMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMapMessageMarshallerTest.h?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMapMessageMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMapMessageMarshallerTest.h Tue Jun 8 22:47:47 2010 @@ -0,0 +1,66 @@ +/* + * 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_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQMAPMESSAGEMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQMAPMESSAGEMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace wireformat{ +namespace openwire{ +namespace marshal{ +namespace v6{ + + /** + * Marshalling Test code for Open Wire Format for ActiveMQMapMessageMarshallerTest + * + * NOTE!: This file is autogenerated - do not modify! + * if you need to make a change, please see the Java Classes + * in the activemq-openwire-generator module + */ + class ActiveMQMapMessageMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( ActiveMQMapMessageMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + ActiveMQMapMessageMarshallerTest() {} + virtual ~ActiveMQMapMessageMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQMAPMESSAGEMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMapMessageMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMessageMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMessageMarshallerTest.cpp?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMessageMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMessageMarshallerTest.cpp Tue Jun 8 22:47:47 2010 @@ -0,0 +1,181 @@ +/* + * 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 + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +// NOTE!: This file is autogenerated - do not modify! +// if you need to make a change, please see the Java Classes in the +// activemq-core module +// + +using namespace std; +using namespace activemq; +using namespace activemq::util; +using namespace activemq::exceptions; +using namespace activemq::commands; +using namespace activemq::wireformat; +using namespace activemq::wireformat::openwire; +using namespace activemq::wireformat::openwire::marshal; +using namespace activemq::wireformat::openwire::utils; +using namespace activemq::wireformat::openwire::marshal::v6; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQMessageMarshallerTest::test() { + + ActiveMQMessageMarshaller myMarshaller; + ActiveMQMessage myCommand; + ActiveMQMessage* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQMessageMarshallerTest::testLooseMarshal() { + + ActiveMQMessageMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + ActiveMQMessage outCommand; + ActiveMQMessage inCommand; + + Pointer producerId( new ProducerId() ); + producerId->setConnectionId( "ConnectionId" ); + producerId->setSessionId( 123 ); + producerId->setValue( 42 ); + + Pointer messageId( new MessageId() ); + messageId->setBrokerSequenceId( 1 ); + messageId->setProducerSequenceId( 3 ); + messageId->setProducerId( producerId ); + + outCommand.setMessageId( messageId ); + + try { + + // Marshal the dataStructure to a byte array. + ByteArrayOutputStream baos; + DataOutputStream dataOut( &baos ); + dataOut.writeByte( outCommand.getDataStructureType() ); + marshaller.looseMarshal( &openWireFormat, &outCommand, &dataOut ); + + // Now read it back in and make sure it's all right. + std::pair array = baos.toByteArray(); + ByteArrayInputStream bais( array.first, array.second, true ); + DataInputStream dataIn( &bais ); + unsigned char dataType = dataIn.readByte(); + CPPUNIT_ASSERT( dataType == outCommand.getDataStructureType() ); + marshaller.looseUnmarshal( &openWireFormat, &inCommand, &dataIn ); + + CPPUNIT_ASSERT( inCommand.equals( &outCommand ) == true ); + + } catch( ActiveMQException& e ) { + e.printStackTrace(); + CPPUNIT_ASSERT( false ); + } catch( ... ) { + CPPUNIT_ASSERT( false ); + } +} + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQMessageMarshallerTest::testTightMarshal() { + + ActiveMQMessageMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + ActiveMQMessage outCommand; + ActiveMQMessage inCommand; + + Pointer producerId( new ProducerId() ); + producerId->setConnectionId( "ConnectionId" ); + producerId->setSessionId( 123 ); + producerId->setValue( 42 ); + + Pointer messageId( new MessageId() ); + messageId->setBrokerSequenceId( 1 ); + messageId->setProducerSequenceId( 3 ); + messageId->setProducerId( producerId ); + + outCommand.setMessageId( messageId ); + + try { + + // Marshal the dataStructure to a byte array. + ByteArrayOutputStream baos; + DataOutputStream dataOut( &baos ); + // Phase 1 - count the size + int size = 1; + BooleanStream bs; + size += marshaller.tightMarshal1( &openWireFormat, &outCommand, &bs ); + size += bs.marshalledSize(); + // Phase 2 - marshal + dataOut.writeByte( outCommand.getDataStructureType() ); + bs.marshal( &dataOut ); + marshaller.tightMarshal2( &openWireFormat, &outCommand, &dataOut, &bs ); + + // Now read it back in and make sure it's all right. + std::pair array = baos.toByteArray(); + ByteArrayInputStream bais( array.first, array.second, true ); + DataInputStream dataIn( &bais ); + + unsigned char dataType = dataIn.readByte(); + CPPUNIT_ASSERT( dataType == outCommand.getDataStructureType() ); + bs.clear(); + bs.unmarshal( &dataIn ); + marshaller.tightUnmarshal( &openWireFormat, &inCommand, &dataIn, &bs ); + + CPPUNIT_ASSERT( inCommand.equals( &outCommand ) == true ); + + } catch( ActiveMQException& e ) { + e.printStackTrace(); + CPPUNIT_ASSERT( false ); + } catch( ... ) { + CPPUNIT_ASSERT( false ); + } +} + Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMessageMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMessageMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMessageMarshallerTest.h?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMessageMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMessageMarshallerTest.h Tue Jun 8 22:47:47 2010 @@ -0,0 +1,66 @@ +/* + * 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_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQMESSAGEMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQMESSAGEMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace wireformat{ +namespace openwire{ +namespace marshal{ +namespace v6{ + + /** + * Marshalling Test code for Open Wire Format for ActiveMQMessageMarshallerTest + * + * NOTE!: This file is autogenerated - do not modify! + * if you need to make a change, please see the Java Classes + * in the activemq-openwire-generator module + */ + class ActiveMQMessageMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( ActiveMQMessageMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + ActiveMQMessageMarshallerTest() {} + virtual ~ActiveMQMessageMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQMESSAGEMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQMessageMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQObjectMessageMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQObjectMessageMarshallerTest.cpp?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQObjectMessageMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQObjectMessageMarshallerTest.cpp Tue Jun 8 22:47:47 2010 @@ -0,0 +1,181 @@ +/* + * 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 + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +// NOTE!: This file is autogenerated - do not modify! +// if you need to make a change, please see the Java Classes in the +// activemq-core module +// + +using namespace std; +using namespace activemq; +using namespace activemq::util; +using namespace activemq::exceptions; +using namespace activemq::commands; +using namespace activemq::wireformat; +using namespace activemq::wireformat::openwire; +using namespace activemq::wireformat::openwire::marshal; +using namespace activemq::wireformat::openwire::utils; +using namespace activemq::wireformat::openwire::marshal::v6; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQObjectMessageMarshallerTest::test() { + + ActiveMQObjectMessageMarshaller myMarshaller; + ActiveMQObjectMessage myCommand; + ActiveMQObjectMessage* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQObjectMessageMarshallerTest::testLooseMarshal() { + + ActiveMQObjectMessageMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + ActiveMQObjectMessage outCommand; + ActiveMQObjectMessage inCommand; + + Pointer producerId( new ProducerId() ); + producerId->setConnectionId( "ConnectionId" ); + producerId->setSessionId( 123 ); + producerId->setValue( 42 ); + + Pointer messageId( new MessageId() ); + messageId->setBrokerSequenceId( 1 ); + messageId->setProducerSequenceId( 3 ); + messageId->setProducerId( producerId ); + + outCommand.setMessageId( messageId ); + + try { + + // Marshal the dataStructure to a byte array. + ByteArrayOutputStream baos; + DataOutputStream dataOut( &baos ); + dataOut.writeByte( outCommand.getDataStructureType() ); + marshaller.looseMarshal( &openWireFormat, &outCommand, &dataOut ); + + // Now read it back in and make sure it's all right. + std::pair array = baos.toByteArray(); + ByteArrayInputStream bais( array.first, array.second, true ); + DataInputStream dataIn( &bais ); + unsigned char dataType = dataIn.readByte(); + CPPUNIT_ASSERT( dataType == outCommand.getDataStructureType() ); + marshaller.looseUnmarshal( &openWireFormat, &inCommand, &dataIn ); + + CPPUNIT_ASSERT( inCommand.equals( &outCommand ) == true ); + + } catch( ActiveMQException& e ) { + e.printStackTrace(); + CPPUNIT_ASSERT( false ); + } catch( ... ) { + CPPUNIT_ASSERT( false ); + } +} + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQObjectMessageMarshallerTest::testTightMarshal() { + + ActiveMQObjectMessageMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + ActiveMQObjectMessage outCommand; + ActiveMQObjectMessage inCommand; + + Pointer producerId( new ProducerId() ); + producerId->setConnectionId( "ConnectionId" ); + producerId->setSessionId( 123 ); + producerId->setValue( 42 ); + + Pointer messageId( new MessageId() ); + messageId->setBrokerSequenceId( 1 ); + messageId->setProducerSequenceId( 3 ); + messageId->setProducerId( producerId ); + + outCommand.setMessageId( messageId ); + + try { + + // Marshal the dataStructure to a byte array. + ByteArrayOutputStream baos; + DataOutputStream dataOut( &baos ); + // Phase 1 - count the size + int size = 1; + BooleanStream bs; + size += marshaller.tightMarshal1( &openWireFormat, &outCommand, &bs ); + size += bs.marshalledSize(); + // Phase 2 - marshal + dataOut.writeByte( outCommand.getDataStructureType() ); + bs.marshal( &dataOut ); + marshaller.tightMarshal2( &openWireFormat, &outCommand, &dataOut, &bs ); + + // Now read it back in and make sure it's all right. + std::pair array = baos.toByteArray(); + ByteArrayInputStream bais( array.first, array.second, true ); + DataInputStream dataIn( &bais ); + + unsigned char dataType = dataIn.readByte(); + CPPUNIT_ASSERT( dataType == outCommand.getDataStructureType() ); + bs.clear(); + bs.unmarshal( &dataIn ); + marshaller.tightUnmarshal( &openWireFormat, &inCommand, &dataIn, &bs ); + + CPPUNIT_ASSERT( inCommand.equals( &outCommand ) == true ); + + } catch( ActiveMQException& e ) { + e.printStackTrace(); + CPPUNIT_ASSERT( false ); + } catch( ... ) { + CPPUNIT_ASSERT( false ); + } +} + Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQObjectMessageMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQObjectMessageMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQObjectMessageMarshallerTest.h?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQObjectMessageMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQObjectMessageMarshallerTest.h Tue Jun 8 22:47:47 2010 @@ -0,0 +1,66 @@ +/* + * 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_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQOBJECTMESSAGEMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQOBJECTMESSAGEMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace wireformat{ +namespace openwire{ +namespace marshal{ +namespace v6{ + + /** + * Marshalling Test code for Open Wire Format for ActiveMQObjectMessageMarshallerTest + * + * NOTE!: This file is autogenerated - do not modify! + * if you need to make a change, please see the Java Classes + * in the activemq-openwire-generator module + */ + class ActiveMQObjectMessageMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( ActiveMQObjectMessageMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + ActiveMQObjectMessageMarshallerTest() {} + virtual ~ActiveMQObjectMessageMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQOBJECTMESSAGEMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQObjectMessageMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQQueueMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQQueueMarshallerTest.cpp?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQQueueMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQQueueMarshallerTest.cpp Tue Jun 8 22:47:47 2010 @@ -0,0 +1,157 @@ +/* + * 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 + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +// NOTE!: This file is autogenerated - do not modify! +// if you need to make a change, please see the Java Classes in the +// activemq-core module +// + +using namespace std; +using namespace activemq; +using namespace activemq::util; +using namespace activemq::exceptions; +using namespace activemq::commands; +using namespace activemq::wireformat; +using namespace activemq::wireformat::openwire; +using namespace activemq::wireformat::openwire::marshal; +using namespace activemq::wireformat::openwire::utils; +using namespace activemq::wireformat::openwire::marshal::v6; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQQueueMarshallerTest::test() { + + ActiveMQQueueMarshaller myMarshaller; + ActiveMQQueue myCommand; + ActiveMQQueue* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQQueueMarshallerTest::testLooseMarshal() { + + ActiveMQQueueMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + ActiveMQQueue outCommand; + ActiveMQQueue inCommand; + + try { + + // Marshal the dataStructure to a byte array. + ByteArrayOutputStream baos; + DataOutputStream dataOut( &baos ); + dataOut.writeByte( outCommand.getDataStructureType() ); + marshaller.looseMarshal( &openWireFormat, &outCommand, &dataOut ); + + // Now read it back in and make sure it's all right. + std::pair array = baos.toByteArray(); + ByteArrayInputStream bais( array.first, array.second, true ); + DataInputStream dataIn( &bais ); + unsigned char dataType = dataIn.readByte(); + CPPUNIT_ASSERT( dataType == outCommand.getDataStructureType() ); + marshaller.looseUnmarshal( &openWireFormat, &inCommand, &dataIn ); + + CPPUNIT_ASSERT( inCommand.equals( &outCommand ) == true ); + + } catch( ActiveMQException& e ) { + e.printStackTrace(); + CPPUNIT_ASSERT( false ); + } catch( ... ) { + CPPUNIT_ASSERT( false ); + } +} + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQQueueMarshallerTest::testTightMarshal() { + + ActiveMQQueueMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + ActiveMQQueue outCommand; + ActiveMQQueue inCommand; + + try { + + // Marshal the dataStructure to a byte array. + ByteArrayOutputStream baos; + DataOutputStream dataOut( &baos ); + // Phase 1 - count the size + int size = 1; + BooleanStream bs; + size += marshaller.tightMarshal1( &openWireFormat, &outCommand, &bs ); + size += bs.marshalledSize(); + // Phase 2 - marshal + dataOut.writeByte( outCommand.getDataStructureType() ); + bs.marshal( &dataOut ); + marshaller.tightMarshal2( &openWireFormat, &outCommand, &dataOut, &bs ); + + // Now read it back in and make sure it's all right. + std::pair array = baos.toByteArray(); + ByteArrayInputStream bais( array.first, array.second, true ); + DataInputStream dataIn( &bais ); + + unsigned char dataType = dataIn.readByte(); + CPPUNIT_ASSERT( dataType == outCommand.getDataStructureType() ); + bs.clear(); + bs.unmarshal( &dataIn ); + marshaller.tightUnmarshal( &openWireFormat, &inCommand, &dataIn, &bs ); + + CPPUNIT_ASSERT( inCommand.equals( &outCommand ) == true ); + + } catch( ActiveMQException& e ) { + e.printStackTrace(); + CPPUNIT_ASSERT( false ); + } catch( ... ) { + CPPUNIT_ASSERT( false ); + } +} + Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQQueueMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQQueueMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQQueueMarshallerTest.h?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQQueueMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQQueueMarshallerTest.h Tue Jun 8 22:47:47 2010 @@ -0,0 +1,66 @@ +/* + * 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_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQQUEUEMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQQUEUEMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace wireformat{ +namespace openwire{ +namespace marshal{ +namespace v6{ + + /** + * Marshalling Test code for Open Wire Format for ActiveMQQueueMarshallerTest + * + * NOTE!: This file is autogenerated - do not modify! + * if you need to make a change, please see the Java Classes + * in the activemq-openwire-generator module + */ + class ActiveMQQueueMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( ActiveMQQueueMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + ActiveMQQueueMarshallerTest() {} + virtual ~ActiveMQQueueMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQQUEUEMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQQueueMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQStreamMessageMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQStreamMessageMarshallerTest.cpp?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQStreamMessageMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQStreamMessageMarshallerTest.cpp Tue Jun 8 22:47:47 2010 @@ -0,0 +1,181 @@ +/* + * 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 + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +// +// NOTE!: This file is autogenerated - do not modify! +// if you need to make a change, please see the Java Classes in the +// activemq-core module +// + +using namespace std; +using namespace activemq; +using namespace activemq::util; +using namespace activemq::exceptions; +using namespace activemq::commands; +using namespace activemq::wireformat; +using namespace activemq::wireformat::openwire; +using namespace activemq::wireformat::openwire::marshal; +using namespace activemq::wireformat::openwire::utils; +using namespace activemq::wireformat::openwire::marshal::v6; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQStreamMessageMarshallerTest::test() { + + ActiveMQStreamMessageMarshaller myMarshaller; + ActiveMQStreamMessage myCommand; + ActiveMQStreamMessage* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQStreamMessageMarshallerTest::testLooseMarshal() { + + ActiveMQStreamMessageMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + ActiveMQStreamMessage outCommand; + ActiveMQStreamMessage inCommand; + + Pointer producerId( new ProducerId() ); + producerId->setConnectionId( "ConnectionId" ); + producerId->setSessionId( 123 ); + producerId->setValue( 42 ); + + Pointer messageId( new MessageId() ); + messageId->setBrokerSequenceId( 1 ); + messageId->setProducerSequenceId( 3 ); + messageId->setProducerId( producerId ); + + outCommand.setMessageId( messageId ); + + try { + + // Marshal the dataStructure to a byte array. + ByteArrayOutputStream baos; + DataOutputStream dataOut( &baos ); + dataOut.writeByte( outCommand.getDataStructureType() ); + marshaller.looseMarshal( &openWireFormat, &outCommand, &dataOut ); + + // Now read it back in and make sure it's all right. + std::pair array = baos.toByteArray(); + ByteArrayInputStream bais( array.first, array.second, true ); + DataInputStream dataIn( &bais ); + unsigned char dataType = dataIn.readByte(); + CPPUNIT_ASSERT( dataType == outCommand.getDataStructureType() ); + marshaller.looseUnmarshal( &openWireFormat, &inCommand, &dataIn ); + + CPPUNIT_ASSERT( inCommand.equals( &outCommand ) == true ); + + } catch( ActiveMQException& e ) { + e.printStackTrace(); + CPPUNIT_ASSERT( false ); + } catch( ... ) { + CPPUNIT_ASSERT( false ); + } +} + +/////////////////////////////////////////////////////////////////////////////// +void ActiveMQStreamMessageMarshallerTest::testTightMarshal() { + + ActiveMQStreamMessageMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + ActiveMQStreamMessage outCommand; + ActiveMQStreamMessage inCommand; + + Pointer producerId( new ProducerId() ); + producerId->setConnectionId( "ConnectionId" ); + producerId->setSessionId( 123 ); + producerId->setValue( 42 ); + + Pointer messageId( new MessageId() ); + messageId->setBrokerSequenceId( 1 ); + messageId->setProducerSequenceId( 3 ); + messageId->setProducerId( producerId ); + + outCommand.setMessageId( messageId ); + + try { + + // Marshal the dataStructure to a byte array. + ByteArrayOutputStream baos; + DataOutputStream dataOut( &baos ); + // Phase 1 - count the size + int size = 1; + BooleanStream bs; + size += marshaller.tightMarshal1( &openWireFormat, &outCommand, &bs ); + size += bs.marshalledSize(); + // Phase 2 - marshal + dataOut.writeByte( outCommand.getDataStructureType() ); + bs.marshal( &dataOut ); + marshaller.tightMarshal2( &openWireFormat, &outCommand, &dataOut, &bs ); + + // Now read it back in and make sure it's all right. + std::pair array = baos.toByteArray(); + ByteArrayInputStream bais( array.first, array.second, true ); + DataInputStream dataIn( &bais ); + + unsigned char dataType = dataIn.readByte(); + CPPUNIT_ASSERT( dataType == outCommand.getDataStructureType() ); + bs.clear(); + bs.unmarshal( &dataIn ); + marshaller.tightUnmarshal( &openWireFormat, &inCommand, &dataIn, &bs ); + + CPPUNIT_ASSERT( inCommand.equals( &outCommand ) == true ); + + } catch( ActiveMQException& e ) { + e.printStackTrace(); + CPPUNIT_ASSERT( false ); + } catch( ... ) { + CPPUNIT_ASSERT( false ); + } +} + Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQStreamMessageMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQStreamMessageMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQStreamMessageMarshallerTest.h?rev=952853&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQStreamMessageMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQStreamMessageMarshallerTest.h Tue Jun 8 22:47:47 2010 @@ -0,0 +1,66 @@ +/* + * 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_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQSTREAMMESSAGEMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQSTREAMMESSAGEMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace wireformat{ +namespace openwire{ +namespace marshal{ +namespace v6{ + + /** + * Marshalling Test code for Open Wire Format for ActiveMQStreamMessageMarshallerTest + * + * NOTE!: This file is autogenerated - do not modify! + * if you need to make a change, please see the Java Classes + * in the activemq-openwire-generator module + */ + class ActiveMQStreamMessageMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( ActiveMQStreamMessageMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + ActiveMQStreamMessageMarshallerTest() {} + virtual ~ActiveMQStreamMessageMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_V6_ACTIVEMQSTREAMMESSAGEMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/v6/ActiveMQStreamMessageMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native