Author: tabish Date: Sat Jan 20 15:05:40 2007 New Revision: 498205 URL: http://svn.apache.org/viewvc?view=rev&rev=498205 Log: http://issues.apache.org/activemq/browse/AMQCPP-30
Added: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/OpenwireStringSupportTest.cpp (with props) incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/OpenwireStringSupportTest.h (with props) Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/HexTableTest.cpp incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/HexTableTest.h Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/HexTableTest.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/HexTableTest.cpp?view=diff&rev=498205&r1=498204&r2=498205 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/HexTableTest.cpp (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/HexTableTest.cpp Sat Jan 20 15:05:40 2007 @@ -18,3 +18,30 @@ #include "HexTableTest.h" CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::openwire::utils::HexTableTest ); + +using namespace activemq; +using namespace activemq::connector; +using namespace activemq::connector::openwire; +using namespace activemq::connector::openwire::utils; + +//////////////////////////////////////////////////////////////////////////////// +void HexTableTest::test(){ + + HexTable table; + + CPPUNIT_ASSERT( table[0] == "00" ); + CPPUNIT_ASSERT( table[32] == "20" ); + CPPUNIT_ASSERT( table[55] == "37" ); + CPPUNIT_ASSERT( table[96] == "60" ); + CPPUNIT_ASSERT( table[156] == "9c" ); + CPPUNIT_ASSERT( table[232] == "e8" ); + CPPUNIT_ASSERT( table[255] == "ff" ); + + CPPUNIT_ASSERT( table.size() == 256 ); + + try{ + std::string test = table[277]; + CPPUNIT_ASSERT( false ); + } + catch(...) {} +} Modified: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/HexTableTest.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/HexTableTest.h?view=diff&rev=498205&r1=498204&r2=498205 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/HexTableTest.h (original) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/HexTableTest.h Sat Jan 20 15:05:40 2007 @@ -39,27 +39,8 @@ HexTableTest() {} virtual ~HexTableTest() {} - void test(){ - - HexTable table; - - CPPUNIT_ASSERT( table[0] == "00" ); - CPPUNIT_ASSERT( table[32] == "20" ); - CPPUNIT_ASSERT( table[55] == "37" ); - CPPUNIT_ASSERT( table[96] == "60" ); - CPPUNIT_ASSERT( table[156] == "9c" ); - CPPUNIT_ASSERT( table[232] == "e8" ); - CPPUNIT_ASSERT( table[255] == "ff" ); - - CPPUNIT_ASSERT( table.size() == 256 ); - - try{ - std::string test = table[277]; - CPPUNIT_ASSERT( false ); - } - catch(...) {} - } - + void test(); + }; }}}} Added: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/OpenwireStringSupportTest.cpp URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/OpenwireStringSupportTest.cpp?view=auto&rev=498205 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/OpenwireStringSupportTest.cpp (added) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/OpenwireStringSupportTest.cpp Sat Jan 20 15:05:40 2007 @@ -0,0 +1,55 @@ +/* + * 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 "OpenwireStringSupportTest.h" + +CPPUNIT_TEST_SUITE_REGISTRATION( activemq::connector::openwire::utils::OpenwireStringSupportTest ); + +#include <activemq/connector/openwire/utils/OpenwireStringSupport.h> + +#include <activemq/io/ByteArrayInputStream.h> +#include <activemq/io/ByteArrayOutputStream.h> +#include <activemq/io/DataInputStream.h> +#include <activemq/io/DataOutputStream.h> + +using namespace std; +using namespace activemq; +using namespace activemq::io; +using namespace activemq::connector; +using namespace activemq::connector::openwire; +using namespace activemq::connector::openwire::utils; + +//////////////////////////////////////////////////////////////////////////////// +void OpenwireStringSupportTest::test() +{ + ByteArrayInputStream bytesIn; + ByteArrayOutputStream bytesOut; + + DataInputStream dataIn( &bytesIn ); + DataOutputStream dataOut( &bytesOut ); + + string testStr = "This is a test string for Openwire"; + + OpenwireStringSupport::writeString( dataOut, &testStr ); + + // Move the output back to the input. + bytesIn.setByteArray( bytesOut.getByteArray(), bytesOut.getByteArraySize() ); + + string resultStr = OpenwireStringSupport::readString( dataIn ); + + CPPUNIT_ASSERT( testStr == resultStr ); +} Propchange: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/OpenwireStringSupportTest.cpp ------------------------------------------------------------------------------ svn:eol-style = native Added: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/OpenwireStringSupportTest.h URL: http://svn.apache.org/viewvc/incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/OpenwireStringSupportTest.h?view=auto&rev=498205 ============================================================================== --- incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/OpenwireStringSupportTest.h (added) +++ incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/OpenwireStringSupportTest.h Sat Jan 20 15:05:40 2007 @@ -0,0 +1,46 @@ +/* + * 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_UTILS_OPENWIRESTRINGSUPPORTTEST_H_ +#define _ACTIVEMQ_CONNECTOR_OPENWIRE_UTILS_OPENWIRESTRINGSUPPORTTEST_H_ + +#include <cppunit/TestFixture.h> +#include <cppunit/extensions/HelperMacros.h> + +namespace activemq{ +namespace connector{ +namespace openwire{ +namespace utils{ + + class OpenwireStringSupportTest : public CppUnit::TestFixture { + + CPPUNIT_TEST_SUITE( OpenwireStringSupportTest ); + CPPUNIT_TEST( test ); + CPPUNIT_TEST_SUITE_END(); + + public: + + OpenwireStringSupportTest() {} + virtual ~OpenwireStringSupportTest() {} + + void test(); + + }; + +}}}} + +#endif /*_ACTIVEMQ_CONNECTOR_OPENWIRE_UTILS_OPENWIRESTRINGSUPPORTTEST_H_*/ Propchange: incubator/activemq/activemq-cpp/trunk/activemq-cpp/src/test/activemq/connector/openwire/utils/OpenwireStringSupportTest.h ------------------------------------------------------------------------------ svn:eol-style = native