Return-Path: Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: (qmail 94322 invoked from network); 13 Aug 2008 23:44:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Aug 2008 23:44:21 -0000 Received: (qmail 34041 invoked by uid 500); 13 Aug 2008 23:44:20 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 34012 invoked by uid 500); 13 Aug 2008 23:44:20 -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 34001 invoked by uid 99); 13 Aug 2008 23:44:20 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Aug 2008 16:44:20 -0700 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; Wed, 13 Aug 2008 23:43:28 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8C7282388AC0; Wed, 13 Aug 2008 16:43:13 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r685729 [14/17] - in /activemq/activemq-cpp/trunk/src: main/ main/activemq/connector/openwire/ main/activemq/connector/openwire/commands/ main/activemq/connector/openwire/marshal/v3/ main/java/org/apache/activemq/openwire/tool/ test/ test/a... Date: Wed, 13 Aug 2008 23:43:02 -0000 To: commits@activemq.apache.org From: tabish@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080813234313.8C7282388AC0@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/IntegerResponseMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/IntegerResponseMarshallerTest.cpp?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/IntegerResponseMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/IntegerResponseMarshallerTest.cpp Wed Aug 13 16:42:56 2008 @@ -0,0 +1,154 @@ +/* + * 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 + +CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::openwire::marshal::v3::IntegerResponseMarshallerTest ); + +#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::connector; +using namespace activemq::connector::openwire; +using namespace activemq::connector::openwire::commands; +using namespace activemq::connector::openwire::marshal; +using namespace activemq::connector::openwire::utils; +using namespace activemq::connector::openwire::marshal::v3; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void IntegerResponseMarshallerTest::test() { + + IntegerResponseMarshaller myMarshaller; + IntegerResponse myCommand; + IntegerResponse* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void IntegerResponseMarshallerTest::testLooseMarshal() { + + IntegerResponseMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( false ); + + IntegerResponse outCommand; + IntegerResponse 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 IntegerResponseMarshallerTest::testTightMarshal() { + + IntegerResponseMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( true ); + + IntegerResponse outCommand; + IntegerResponse 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 ); + } +} + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/IntegerResponseMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/IntegerResponseMarshallerTest.h?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/IntegerResponseMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/IntegerResponseMarshallerTest.h Wed Aug 13 16:42:56 2008 @@ -0,0 +1,67 @@ +/* + * 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_CONNECTOR_OPENWIRE_MARSAHAL_V3_INTEGERRESPONSEMARSHALLERTEST_H_ +#define _ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_INTEGERRESPONSEMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace connector{ +namespace openwire{ +namespace marshal{ +namespace v3{ + + /** + * Marshalling Test code for Open Wire Format for IntegerResponseMarshallerTest + * + * 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 IntegerResponseMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( IntegerResponseMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + IntegerResponseMarshallerTest() {} + virtual ~IntegerResponseMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_INTEGERRESPONSEMARSHALLERTEST_H_*/ + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalQueueAckMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalQueueAckMarshallerTest.cpp?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalQueueAckMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalQueueAckMarshallerTest.cpp Wed Aug 13 16:42:56 2008 @@ -0,0 +1,154 @@ +/* + * 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 + +CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::openwire::marshal::v3::JournalQueueAckMarshallerTest ); + +#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::connector; +using namespace activemq::connector::openwire; +using namespace activemq::connector::openwire::commands; +using namespace activemq::connector::openwire::marshal; +using namespace activemq::connector::openwire::utils; +using namespace activemq::connector::openwire::marshal::v3; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void JournalQueueAckMarshallerTest::test() { + + JournalQueueAckMarshaller myMarshaller; + JournalQueueAck myCommand; + JournalQueueAck* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void JournalQueueAckMarshallerTest::testLooseMarshal() { + + JournalQueueAckMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( false ); + + JournalQueueAck outCommand; + JournalQueueAck 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 JournalQueueAckMarshallerTest::testTightMarshal() { + + JournalQueueAckMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( true ); + + JournalQueueAck outCommand; + JournalQueueAck 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 ); + } +} + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalQueueAckMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalQueueAckMarshallerTest.h?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalQueueAckMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalQueueAckMarshallerTest.h Wed Aug 13 16:42:56 2008 @@ -0,0 +1,67 @@ +/* + * 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_CONNECTOR_OPENWIRE_MARSAHAL_V3_JOURNALQUEUEACKMARSHALLERTEST_H_ +#define _ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_JOURNALQUEUEACKMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace connector{ +namespace openwire{ +namespace marshal{ +namespace v3{ + + /** + * Marshalling Test code for Open Wire Format for JournalQueueAckMarshallerTest + * + * 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 JournalQueueAckMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( JournalQueueAckMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + JournalQueueAckMarshallerTest() {} + virtual ~JournalQueueAckMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_JOURNALQUEUEACKMARSHALLERTEST_H_*/ + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTopicAckMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTopicAckMarshallerTest.cpp?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTopicAckMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTopicAckMarshallerTest.cpp Wed Aug 13 16:42:56 2008 @@ -0,0 +1,154 @@ +/* + * 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 + +CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::openwire::marshal::v3::JournalTopicAckMarshallerTest ); + +#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::connector; +using namespace activemq::connector::openwire; +using namespace activemq::connector::openwire::commands; +using namespace activemq::connector::openwire::marshal; +using namespace activemq::connector::openwire::utils; +using namespace activemq::connector::openwire::marshal::v3; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void JournalTopicAckMarshallerTest::test() { + + JournalTopicAckMarshaller myMarshaller; + JournalTopicAck myCommand; + JournalTopicAck* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void JournalTopicAckMarshallerTest::testLooseMarshal() { + + JournalTopicAckMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( false ); + + JournalTopicAck outCommand; + JournalTopicAck 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 JournalTopicAckMarshallerTest::testTightMarshal() { + + JournalTopicAckMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( true ); + + JournalTopicAck outCommand; + JournalTopicAck 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 ); + } +} + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTopicAckMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTopicAckMarshallerTest.h?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTopicAckMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTopicAckMarshallerTest.h Wed Aug 13 16:42:56 2008 @@ -0,0 +1,67 @@ +/* + * 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_CONNECTOR_OPENWIRE_MARSAHAL_V3_JOURNALTOPICACKMARSHALLERTEST_H_ +#define _ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_JOURNALTOPICACKMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace connector{ +namespace openwire{ +namespace marshal{ +namespace v3{ + + /** + * Marshalling Test code for Open Wire Format for JournalTopicAckMarshallerTest + * + * 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 JournalTopicAckMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( JournalTopicAckMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + JournalTopicAckMarshallerTest() {} + virtual ~JournalTopicAckMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_JOURNALTOPICACKMARSHALLERTEST_H_*/ + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTraceMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTraceMarshallerTest.cpp?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTraceMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTraceMarshallerTest.cpp Wed Aug 13 16:42:56 2008 @@ -0,0 +1,154 @@ +/* + * 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 + +CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::openwire::marshal::v3::JournalTraceMarshallerTest ); + +#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::connector; +using namespace activemq::connector::openwire; +using namespace activemq::connector::openwire::commands; +using namespace activemq::connector::openwire::marshal; +using namespace activemq::connector::openwire::utils; +using namespace activemq::connector::openwire::marshal::v3; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void JournalTraceMarshallerTest::test() { + + JournalTraceMarshaller myMarshaller; + JournalTrace myCommand; + JournalTrace* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void JournalTraceMarshallerTest::testLooseMarshal() { + + JournalTraceMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( false ); + + JournalTrace outCommand; + JournalTrace 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 JournalTraceMarshallerTest::testTightMarshal() { + + JournalTraceMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( true ); + + JournalTrace outCommand; + JournalTrace 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 ); + } +} + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTraceMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTraceMarshallerTest.h?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTraceMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTraceMarshallerTest.h Wed Aug 13 16:42:56 2008 @@ -0,0 +1,67 @@ +/* + * 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_CONNECTOR_OPENWIRE_MARSAHAL_V3_JOURNALTRACEMARSHALLERTEST_H_ +#define _ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_JOURNALTRACEMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace connector{ +namespace openwire{ +namespace marshal{ +namespace v3{ + + /** + * Marshalling Test code for Open Wire Format for JournalTraceMarshallerTest + * + * 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 JournalTraceMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( JournalTraceMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + JournalTraceMarshallerTest() {} + virtual ~JournalTraceMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_JOURNALTRACEMARSHALLERTEST_H_*/ + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTransactionMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTransactionMarshallerTest.cpp?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTransactionMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTransactionMarshallerTest.cpp Wed Aug 13 16:42:56 2008 @@ -0,0 +1,154 @@ +/* + * 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 + +CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::openwire::marshal::v3::JournalTransactionMarshallerTest ); + +#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::connector; +using namespace activemq::connector::openwire; +using namespace activemq::connector::openwire::commands; +using namespace activemq::connector::openwire::marshal; +using namespace activemq::connector::openwire::utils; +using namespace activemq::connector::openwire::marshal::v3; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void JournalTransactionMarshallerTest::test() { + + JournalTransactionMarshaller myMarshaller; + JournalTransaction myCommand; + JournalTransaction* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void JournalTransactionMarshallerTest::testLooseMarshal() { + + JournalTransactionMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( false ); + + JournalTransaction outCommand; + JournalTransaction 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 JournalTransactionMarshallerTest::testTightMarshal() { + + JournalTransactionMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( true ); + + JournalTransaction outCommand; + JournalTransaction 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 ); + } +} + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTransactionMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTransactionMarshallerTest.h?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTransactionMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/JournalTransactionMarshallerTest.h Wed Aug 13 16:42:56 2008 @@ -0,0 +1,67 @@ +/* + * 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_CONNECTOR_OPENWIRE_MARSAHAL_V3_JOURNALTRANSACTIONMARSHALLERTEST_H_ +#define _ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_JOURNALTRANSACTIONMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace connector{ +namespace openwire{ +namespace marshal{ +namespace v3{ + + /** + * Marshalling Test code for Open Wire Format for JournalTransactionMarshallerTest + * + * 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 JournalTransactionMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( JournalTransactionMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + JournalTransactionMarshallerTest() {} + virtual ~JournalTransactionMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_JOURNALTRANSACTIONMARSHALLERTEST_H_*/ + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/KeepAliveInfoMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/KeepAliveInfoMarshallerTest.cpp?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/KeepAliveInfoMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/KeepAliveInfoMarshallerTest.cpp Wed Aug 13 16:42:56 2008 @@ -0,0 +1,154 @@ +/* + * 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 + +CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::openwire::marshal::v3::KeepAliveInfoMarshallerTest ); + +#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::connector; +using namespace activemq::connector::openwire; +using namespace activemq::connector::openwire::commands; +using namespace activemq::connector::openwire::marshal; +using namespace activemq::connector::openwire::utils; +using namespace activemq::connector::openwire::marshal::v3; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void KeepAliveInfoMarshallerTest::test() { + + KeepAliveInfoMarshaller myMarshaller; + KeepAliveInfo myCommand; + KeepAliveInfo* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void KeepAliveInfoMarshallerTest::testLooseMarshal() { + + KeepAliveInfoMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( false ); + + KeepAliveInfo outCommand; + KeepAliveInfo 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 KeepAliveInfoMarshallerTest::testTightMarshal() { + + KeepAliveInfoMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( true ); + + KeepAliveInfo outCommand; + KeepAliveInfo 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 ); + } +} + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/KeepAliveInfoMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/KeepAliveInfoMarshallerTest.h?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/KeepAliveInfoMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/KeepAliveInfoMarshallerTest.h Wed Aug 13 16:42:56 2008 @@ -0,0 +1,67 @@ +/* + * 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_CONNECTOR_OPENWIRE_MARSAHAL_V3_KEEPALIVEINFOMARSHALLERTEST_H_ +#define _ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_KEEPALIVEINFOMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace connector{ +namespace openwire{ +namespace marshal{ +namespace v3{ + + /** + * Marshalling Test code for Open Wire Format for KeepAliveInfoMarshallerTest + * + * 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 KeepAliveInfoMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( KeepAliveInfoMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + KeepAliveInfoMarshallerTest() {} + virtual ~KeepAliveInfoMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_KEEPALIVEINFOMARSHALLERTEST_H_*/ + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LastPartialCommandMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LastPartialCommandMarshallerTest.cpp?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LastPartialCommandMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LastPartialCommandMarshallerTest.cpp Wed Aug 13 16:42:56 2008 @@ -0,0 +1,154 @@ +/* + * 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 + +CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::openwire::marshal::v3::LastPartialCommandMarshallerTest ); + +#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::connector; +using namespace activemq::connector::openwire; +using namespace activemq::connector::openwire::commands; +using namespace activemq::connector::openwire::marshal; +using namespace activemq::connector::openwire::utils; +using namespace activemq::connector::openwire::marshal::v3; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void LastPartialCommandMarshallerTest::test() { + + LastPartialCommandMarshaller myMarshaller; + LastPartialCommand myCommand; + LastPartialCommand* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void LastPartialCommandMarshallerTest::testLooseMarshal() { + + LastPartialCommandMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( false ); + + LastPartialCommand outCommand; + LastPartialCommand 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 LastPartialCommandMarshallerTest::testTightMarshal() { + + LastPartialCommandMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( true ); + + LastPartialCommand outCommand; + LastPartialCommand 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 ); + } +} + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LastPartialCommandMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LastPartialCommandMarshallerTest.h?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LastPartialCommandMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LastPartialCommandMarshallerTest.h Wed Aug 13 16:42:56 2008 @@ -0,0 +1,67 @@ +/* + * 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_CONNECTOR_OPENWIRE_MARSAHAL_V3_LASTPARTIALCOMMANDMARSHALLERTEST_H_ +#define _ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_LASTPARTIALCOMMANDMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace connector{ +namespace openwire{ +namespace marshal{ +namespace v3{ + + /** + * Marshalling Test code for Open Wire Format for LastPartialCommandMarshallerTest + * + * 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 LastPartialCommandMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( LastPartialCommandMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + LastPartialCommandMarshallerTest() {} + virtual ~LastPartialCommandMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_LASTPARTIALCOMMANDMARSHALLERTEST_H_*/ + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LocalTransactionIdMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LocalTransactionIdMarshallerTest.cpp?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LocalTransactionIdMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LocalTransactionIdMarshallerTest.cpp Wed Aug 13 16:42:56 2008 @@ -0,0 +1,154 @@ +/* + * 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 + +CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::openwire::marshal::v3::LocalTransactionIdMarshallerTest ); + +#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::connector; +using namespace activemq::connector::openwire; +using namespace activemq::connector::openwire::commands; +using namespace activemq::connector::openwire::marshal; +using namespace activemq::connector::openwire::utils; +using namespace activemq::connector::openwire::marshal::v3; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void LocalTransactionIdMarshallerTest::test() { + + LocalTransactionIdMarshaller myMarshaller; + LocalTransactionId myCommand; + LocalTransactionId* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void LocalTransactionIdMarshallerTest::testLooseMarshal() { + + LocalTransactionIdMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( false ); + + LocalTransactionId outCommand; + LocalTransactionId 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 LocalTransactionIdMarshallerTest::testTightMarshal() { + + LocalTransactionIdMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( true ); + + LocalTransactionId outCommand; + LocalTransactionId 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 ); + } +} + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LocalTransactionIdMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LocalTransactionIdMarshallerTest.h?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LocalTransactionIdMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/LocalTransactionIdMarshallerTest.h Wed Aug 13 16:42:56 2008 @@ -0,0 +1,67 @@ +/* + * 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_CONNECTOR_OPENWIRE_MARSAHAL_V3_LOCALTRANSACTIONIDMARSHALLERTEST_H_ +#define _ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_LOCALTRANSACTIONIDMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace connector{ +namespace openwire{ +namespace marshal{ +namespace v3{ + + /** + * Marshalling Test code for Open Wire Format for LocalTransactionIdMarshallerTest + * + * 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 LocalTransactionIdMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( LocalTransactionIdMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + LocalTransactionIdMarshallerTest() {} + virtual ~LocalTransactionIdMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_LOCALTRANSACTIONIDMARSHALLERTEST_H_*/ + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/MessageAckMarshallerTest.cpp URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/MessageAckMarshallerTest.cpp?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/MessageAckMarshallerTest.cpp (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/MessageAckMarshallerTest.cpp Wed Aug 13 16:42:56 2008 @@ -0,0 +1,154 @@ +/* + * 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 + +CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::openwire::marshal::v3::MessageAckMarshallerTest ); + +#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::connector; +using namespace activemq::connector::openwire; +using namespace activemq::connector::openwire::commands; +using namespace activemq::connector::openwire::marshal; +using namespace activemq::connector::openwire::utils; +using namespace activemq::connector::openwire::marshal::v3; +using namespace decaf::io; +using namespace decaf::lang; +using namespace decaf::util; + +/////////////////////////////////////////////////////////////////////////////// +void MessageAckMarshallerTest::test() { + + MessageAckMarshaller myMarshaller; + MessageAck myCommand; + MessageAck* myCommand2; + + CPPUNIT_ASSERT( myMarshaller.getDataStructureType() == myCommand.getDataStructureType() ); + myCommand2 = dynamic_cast( myMarshaller.createObject() ); + CPPUNIT_ASSERT( myCommand2 != NULL ); + delete myCommand2; +} + +/////////////////////////////////////////////////////////////////////////////// +void MessageAckMarshallerTest::testLooseMarshal() { + + MessageAckMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( false ); + + MessageAck outCommand; + MessageAck 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 MessageAckMarshallerTest::testTightMarshal() { + + MessageAckMarshaller marshaller; + Properties props; + OpenWireFormat openWireFormat( props ); + + // Configure for this test. + openWireFormat.setVersion( 3 ); + openWireFormat.setTightEncodingEnabled( true ); + + MessageAck outCommand; + MessageAck 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. + ByteArrayInputStream bais( baos.toByteArray(), baos.size() ); + 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 ); + } +} + Added: activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/MessageAckMarshallerTest.h URL: http://svn.apache.org/viewvc/activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/MessageAckMarshallerTest.h?rev=685729&view=auto ============================================================================== --- activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/MessageAckMarshallerTest.h (added) +++ activemq/activemq-cpp/trunk/src/test/activemq/connector/openwire/marshal/v3/MessageAckMarshallerTest.h Wed Aug 13 16:42:56 2008 @@ -0,0 +1,67 @@ +/* + * 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_CONNECTOR_OPENWIRE_MARSAHAL_V3_MESSAGEACKMARSHALLERTEST_H_ +#define _ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_MESSAGEACKMARSHALLERTEST_H_ + +// Turn off warning message for ignored exception specification +#ifdef _MSC_VER +#pragma warning( disable : 4290 ) +#endif + +#include +#include + +namespace activemq{ +namespace connector{ +namespace openwire{ +namespace marshal{ +namespace v3{ + + /** + * Marshalling Test code for Open Wire Format for MessageAckMarshallerTest + * + * 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 MessageAckMarshallerTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( MessageAckMarshallerTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST( testLooseMarshal ); + CPPUNIT_TEST( testTightMarshal ); + CPPUNIT_TEST_SUITE_END(); + + public: + + MessageAckMarshallerTest() {} + virtual ~MessageAckMarshallerTest() {} + + /** + * Test the marshaller and its marshalled type. + */ + virtual void test(); + virtual void testLooseMarshal(); + virtual void testTightMarshal(); + + }; + +}}}}} + +#endif /*_ACTIVEMQ_CONNECTOR_OPENWIRE_MARSAHAL_V3_MESSAGEACKMARSHALLERTEST_H_*/ +