diff options
author | Alan Conway <aconway@apache.org> | 2007-03-21 02:05:56 +0000 |
---|---|---|
committer | Alan Conway <aconway@apache.org> | 2007-03-21 02:05:56 +0000 |
commit | 732544fe86089ab86c03fcc48d5ca4c72667c275 (patch) | |
tree | dd2ee2d8872f69b6f297ef39b0a84b95bddf4b77 /qpid/cpp/tests/FramingTest.cpp | |
parent | 698283620afcb267bda2752b746c3e19641150ef (diff) | |
download | qpid-python-732544fe86089ab86c03fcc48d5ca4c72667c275.tar.gz |
* cpp: svn removed, will rename cpp-0-9
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@520705 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/tests/FramingTest.cpp')
-rw-r--r-- | qpid/cpp/tests/FramingTest.cpp | 150 |
1 files changed, 0 insertions, 150 deletions
diff --git a/qpid/cpp/tests/FramingTest.cpp b/qpid/cpp/tests/FramingTest.cpp deleted file mode 100644 index e4d289d3d5..0000000000 --- a/qpid/cpp/tests/FramingTest.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/* - * - * 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 <ConnectionRedirectBody.h> -#include <ProtocolVersion.h> -#include <amqp_framing.h> -#include <iostream> -#include <qpid_test_plugin.h> -#include <sstream> -#include <typeinfo> -#include <AMQP_HighestVersion.h> - - -using namespace qpid::framing; - -template <class T> -std::string tostring(const T& x) -{ - std::ostringstream out; - out << x; - return out.str(); -} - -class FramingTest : public CppUnit::TestCase -{ - CPPUNIT_TEST_SUITE(FramingTest); - CPPUNIT_TEST(testBasicQosBody); - CPPUNIT_TEST(testConnectionSecureBody); - CPPUNIT_TEST(testConnectionRedirectBody); - CPPUNIT_TEST(testAccessRequestBody); - CPPUNIT_TEST(testBasicConsumeBody); - CPPUNIT_TEST(testConnectionRedirectBodyFrame); - CPPUNIT_TEST(testBasicConsumeOkBodyFrame); - CPPUNIT_TEST_SUITE_END(); - - private: - Buffer buffer; - ProtocolVersion v; - - public: - - FramingTest() : buffer(100), v(qpid::framing::highestProtocolVersion){} - - void testBasicQosBody() - { - BasicQosBody in(v, 0xCAFEBABE, 0xABBA, true); - in.encodeContent(buffer); - buffer.flip(); - BasicQosBody out(v); - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void testConnectionSecureBody() - { - std::string s = "security credential"; - ConnectionSecureBody in(v, s); - in.encodeContent(buffer); - buffer.flip(); - ConnectionSecureBody out(v); - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void testConnectionRedirectBody() - { - std::string a = "hostA"; - std::string b = "hostB"; - ConnectionRedirectBody in(v, a, b); - in.encodeContent(buffer); - buffer.flip(); - ConnectionRedirectBody out(v); - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void testAccessRequestBody() - { - std::string s = "text"; - AccessRequestBody in(v, s, true, false, true, false, true); - in.encodeContent(buffer); - buffer.flip(); - AccessRequestBody out(v); - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void testBasicConsumeBody() - { - std::string q = "queue"; - std::string t = "tag"; - BasicConsumeBody in(v, 0, q, t, false, true, false, false, - FieldTable()); - in.encodeContent(buffer); - buffer.flip(); - BasicConsumeBody out(v); - out.decodeContent(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - - void testConnectionRedirectBodyFrame() - { - std::string a = "hostA"; - std::string b = "hostB"; - AMQFrame in(highestProtocolVersion, 999, new ConnectionRedirectBody(v, a, b)); - in.encode(buffer); - buffer.flip(); - AMQFrame out; - out.decode(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - - void testBasicConsumeOkBodyFrame() - { - std::string s = "hostA"; - AMQFrame in(highestProtocolVersion, 999, new BasicConsumeOkBody(v, s)); - in.encode(buffer); - buffer.flip(); - AMQFrame out; - for(int i = 0; i < 5; i++){ - out.decode(buffer); - CPPUNIT_ASSERT_EQUAL(tostring(in), tostring(out)); - } - } -}; - -// Make this test suite a plugin. -CPPUNIT_PLUGIN_IMPLEMENT(); -CPPUNIT_TEST_SUITE_REGISTRATION(FramingTest); - - - |