Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 2929 invoked from network); 15 Jun 2010 21:56:02 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 Jun 2010 21:56:02 -0000 Received: (qmail 59931 invoked by uid 500); 15 Jun 2010 21:56:02 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 59912 invoked by uid 500); 15 Jun 2010 21:56:01 -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 59898 invoked by uid 99); 15 Jun 2010 21:56:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Jun 2010 21:56:01 +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, 15 Jun 2010 21:55:41 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2C2452388B4E; Tue, 15 Jun 2010 21:54:25 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r955066 [15/21] - in /activemq/activemq-cpp/trunk/activemq-cpp: ./ src/main/ src/main/activemq/wireformat/openwire/ src/main/activemq/wireformat/openwire/marshal/universal/ src/main/activemq/wireformat/openwire/marshal/v1/ src/main/activemq... Date: Tue, 15 Jun 2010 21:54:21 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100615215425.2C2452388B4E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerIdMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerIdMarshallerTest.cpp?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerIdMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerIdMarshallerTest.cpp Tue Jun 15 21:54:15 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::universal; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void BrokerIdMarshallerTest::test() { + + BrokerIdMarshaller myMarshaller; + BrokerId myCommand; + BrokerId* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void BrokerIdMarshallerTest::testLooseMarshal() { + + BrokerIdMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + BrokerId outCommand; + BrokerId 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 BrokerIdMarshallerTest::testTightMarshal() { + + BrokerIdMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + BrokerId outCommand; + BrokerId 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/universal/BrokerIdMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerIdMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerIdMarshallerTest.h?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerIdMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerIdMarshallerTest.h Tue Jun 15 21:54:15 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_UNIVERSAL_BROKERIDMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_BROKERIDMARSHALLERTEST_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 universal{ + + /** + * Marshalling Test code for Open Wire Format for BrokerIdMarshallerTest + * + * 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 BrokerIdMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( BrokerIdMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + BrokerIdMarshallerTest() {} + virtual ~BrokerIdMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_BROKERIDMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerIdMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerInfoMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerInfoMarshallerTest.cpp?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerInfoMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerInfoMarshallerTest.cpp Tue Jun 15 21:54:15 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::universal; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void BrokerInfoMarshallerTest::test() { + + BrokerInfoMarshaller myMarshaller; + BrokerInfo myCommand; + BrokerInfo* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void BrokerInfoMarshallerTest::testLooseMarshal() { + + BrokerInfoMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + BrokerInfo outCommand; + BrokerInfo 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 BrokerInfoMarshallerTest::testTightMarshal() { + + BrokerInfoMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + BrokerInfo outCommand; + BrokerInfo 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/universal/BrokerInfoMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerInfoMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerInfoMarshallerTest.h?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerInfoMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerInfoMarshallerTest.h Tue Jun 15 21:54:15 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_UNIVERSAL_BROKERINFOMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_BROKERINFOMARSHALLERTEST_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 universal{ + + /** + * Marshalling Test code for Open Wire Format for BrokerInfoMarshallerTest + * + * 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 BrokerInfoMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( BrokerInfoMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + BrokerInfoMarshallerTest() {} + virtual ~BrokerInfoMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_BROKERINFOMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/BrokerInfoMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionControlMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionControlMarshallerTest.cpp?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionControlMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionControlMarshallerTest.cpp Tue Jun 15 21:54:15 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::universal; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void ConnectionControlMarshallerTest::test() { + + ConnectionControlMarshaller myMarshaller; + ConnectionControl myCommand; + ConnectionControl* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void ConnectionControlMarshallerTest::testLooseMarshal() { + + ConnectionControlMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + ConnectionControl outCommand; + ConnectionControl 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 ConnectionControlMarshallerTest::testTightMarshal() { + + ConnectionControlMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + ConnectionControl outCommand; + ConnectionControl 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/universal/ConnectionControlMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionControlMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionControlMarshallerTest.h?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionControlMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionControlMarshallerTest.h Tue Jun 15 21:54:15 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_UNIVERSAL_CONNECTIONCONTROLMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_CONNECTIONCONTROLMARSHALLERTEST_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 universal{ + + /** + * Marshalling Test code for Open Wire Format for ConnectionControlMarshallerTest + * + * 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 ConnectionControlMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( ConnectionControlMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + ConnectionControlMarshallerTest() {} + virtual ~ConnectionControlMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_CONNECTIONCONTROLMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionControlMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionErrorMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionErrorMarshallerTest.cpp?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionErrorMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionErrorMarshallerTest.cpp Tue Jun 15 21:54:15 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::universal; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void ConnectionErrorMarshallerTest::test() { + + ConnectionErrorMarshaller myMarshaller; + ConnectionError myCommand; + ConnectionError* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void ConnectionErrorMarshallerTest::testLooseMarshal() { + + ConnectionErrorMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + ConnectionError outCommand; + ConnectionError 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 ConnectionErrorMarshallerTest::testTightMarshal() { + + ConnectionErrorMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + ConnectionError outCommand; + ConnectionError 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/universal/ConnectionErrorMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionErrorMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionErrorMarshallerTest.h?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionErrorMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionErrorMarshallerTest.h Tue Jun 15 21:54:15 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_UNIVERSAL_CONNECTIONERRORMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_CONNECTIONERRORMARSHALLERTEST_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 universal{ + + /** + * Marshalling Test code for Open Wire Format for ConnectionErrorMarshallerTest + * + * 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 ConnectionErrorMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( ConnectionErrorMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + ConnectionErrorMarshallerTest() {} + virtual ~ConnectionErrorMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_CONNECTIONERRORMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionErrorMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionIdMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionIdMarshallerTest.cpp?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionIdMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionIdMarshallerTest.cpp Tue Jun 15 21:54:15 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::universal; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void ConnectionIdMarshallerTest::test() { + + ConnectionIdMarshaller myMarshaller; + ConnectionId myCommand; + ConnectionId* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void ConnectionIdMarshallerTest::testLooseMarshal() { + + ConnectionIdMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + ConnectionId outCommand; + ConnectionId 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 ConnectionIdMarshallerTest::testTightMarshal() { + + ConnectionIdMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + ConnectionId outCommand; + ConnectionId 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/universal/ConnectionIdMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionIdMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionIdMarshallerTest.h?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionIdMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionIdMarshallerTest.h Tue Jun 15 21:54:15 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_UNIVERSAL_CONNECTIONIDMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_CONNECTIONIDMARSHALLERTEST_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 universal{ + + /** + * Marshalling Test code for Open Wire Format for ConnectionIdMarshallerTest + * + * 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 ConnectionIdMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( ConnectionIdMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + ConnectionIdMarshallerTest() {} + virtual ~ConnectionIdMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_CONNECTIONIDMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionIdMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionInfoMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionInfoMarshallerTest.cpp?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionInfoMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionInfoMarshallerTest.cpp Tue Jun 15 21:54:15 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::universal; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void ConnectionInfoMarshallerTest::test() { + + ConnectionInfoMarshaller myMarshaller; + ConnectionInfo myCommand; + ConnectionInfo* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void ConnectionInfoMarshallerTest::testLooseMarshal() { + + ConnectionInfoMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + ConnectionInfo outCommand; + ConnectionInfo 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 ConnectionInfoMarshallerTest::testTightMarshal() { + + ConnectionInfoMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + ConnectionInfo outCommand; + ConnectionInfo 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/universal/ConnectionInfoMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionInfoMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionInfoMarshallerTest.h?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionInfoMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionInfoMarshallerTest.h Tue Jun 15 21:54:15 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_UNIVERSAL_CONNECTIONINFOMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_CONNECTIONINFOMARSHALLERTEST_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 universal{ + + /** + * Marshalling Test code for Open Wire Format for ConnectionInfoMarshallerTest + * + * 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 ConnectionInfoMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( ConnectionInfoMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + ConnectionInfoMarshallerTest() {} + virtual ~ConnectionInfoMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_CONNECTIONINFOMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConnectionInfoMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerControlMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerControlMarshallerTest.cpp?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerControlMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerControlMarshallerTest.cpp Tue Jun 15 21:54:15 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::universal; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void ConsumerControlMarshallerTest::test() { + + ConsumerControlMarshaller myMarshaller; + ConsumerControl myCommand; + ConsumerControl* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void ConsumerControlMarshallerTest::testLooseMarshal() { + + ConsumerControlMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + ConsumerControl outCommand; + ConsumerControl 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 ConsumerControlMarshallerTest::testTightMarshal() { + + ConsumerControlMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + ConsumerControl outCommand; + ConsumerControl 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/universal/ConsumerControlMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerControlMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerControlMarshallerTest.h?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerControlMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerControlMarshallerTest.h Tue Jun 15 21:54:15 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_UNIVERSAL_CONSUMERCONTROLMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_CONSUMERCONTROLMARSHALLERTEST_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 universal{ + + /** + * Marshalling Test code for Open Wire Format for ConsumerControlMarshallerTest + * + * 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 ConsumerControlMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( ConsumerControlMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + ConsumerControlMarshallerTest() {} + virtual ~ConsumerControlMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_CONSUMERCONTROLMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerControlMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerIdMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerIdMarshallerTest.cpp?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerIdMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerIdMarshallerTest.cpp Tue Jun 15 21:54:15 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::universal; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void ConsumerIdMarshallerTest::test() { + + ConsumerIdMarshaller myMarshaller; + ConsumerId myCommand; + ConsumerId* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void ConsumerIdMarshallerTest::testLooseMarshal() { + + ConsumerIdMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + ConsumerId outCommand; + ConsumerId 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 ConsumerIdMarshallerTest::testTightMarshal() { + + ConsumerIdMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + ConsumerId outCommand; + ConsumerId 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/universal/ConsumerIdMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerIdMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerIdMarshallerTest.h?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerIdMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerIdMarshallerTest.h Tue Jun 15 21:54:15 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_UNIVERSAL_CONSUMERIDMARSHALLERTEST_H_ +#define _ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_CONSUMERIDMARSHALLERTEST_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 universal{ + + /** + * Marshalling Test code for Open Wire Format for ConsumerIdMarshallerTest + * + * 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 ConsumerIdMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( ConsumerIdMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + ConsumerIdMarshallerTest() {} + virtual ~ConsumerIdMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_WIREFORMAT_OPENWIRE_MARSAHAL_UNIVERSAL_CONSUMERIDMARSHALLERTEST_H_*/ Propchange: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerIdMarshallerTest.h ------------------------------------------------------------------------------ svn:eol-style = native Added: activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerInfoMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerInfoMarshallerTest.cpp?rev=955066&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerInfoMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/wireformat/openwire/marshal/universal/ConsumerInfoMarshallerTest.cpp Tue Jun 15 21:54:15 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::universal; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void ConsumerInfoMarshallerTest::test() { + + ConsumerInfoMarshaller myMarshaller; + ConsumerInfo myCommand; + ConsumerInfo* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void ConsumerInfoMarshallerTest::testLooseMarshal() { + + ConsumerInfoMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( false ); + + ConsumerInfo outCommand; + ConsumerInfo 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 ConsumerInfoMarshallerTest::testTightMarshal() { + + ConsumerInfoMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 6 ); + openWireFormat.setTightEncodingEnabled( true ); + + ConsumerInfo outCommand; + ConsumerInfo 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/universal/ConsumerInfoMarshallerTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native