summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-02-28 17:53:47 +0000
committerAlan Conway <aconway@apache.org>2008-02-28 17:53:47 +0000
commit1820dd421a096ed184a08deee9512e809312fed2 (patch)
tree3d7ec12c8fbfa3e55b8c6374ce1c73fe0fe4f7f3 /cpp/src
parenta9b496076e65aba6b23eea2284c2f3de39a0a79d (diff)
downloadqpid-python-1820dd421a096ed184a08deee9512e809312fed2.tar.gz
amqp_0_10::ProxyTemplate - tested & functional.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@632075 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/tests/Makefile.am3
-rw-r--r--cpp/src/tests/ProxyTemplate.cpp49
2 files changed, 51 insertions, 1 deletions
diff --git a/cpp/src/tests/Makefile.am b/cpp/src/tests/Makefile.am
index 3ce86b9da1..4a47797350 100644
--- a/cpp/src/tests/Makefile.am
+++ b/cpp/src/tests/Makefile.am
@@ -38,7 +38,8 @@ unit_test_SOURCES= unit_test.cpp unit_test.h \
InlineVector.cpp \
ISList.cpp IList.cpp \
ClientSessionTest.cpp \
- serialize.cpp
+ serialize.cpp \
+ ProxyTemplate.cpp
# FIXME aconway 2008-02-20: removed RefCountedMap.cpp due to valgrind error.
check_LTLIBRARIES += libshlibtest.la
diff --git a/cpp/src/tests/ProxyTemplate.cpp b/cpp/src/tests/ProxyTemplate.cpp
new file mode 100644
index 0000000000..cab87b6511
--- /dev/null
+++ b/cpp/src/tests/ProxyTemplate.cpp
@@ -0,0 +1,49 @@
+/*
+ *
+ * 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 "unit_test.h"
+#include "qpid/amqp_0_10/ProxyTemplate.h"
+#include <boost/any.hpp>
+
+QPID_AUTO_TEST_SUITE(ProxyTemplateTestSuite)
+
+using namespace qpid::amqp_0_10;
+
+struct ToAny {
+ template <class T>
+ boost::any operator()(const T& t) { return boost::any(t); }
+};
+
+struct AnyProxy : public ProxyTemplate<ToAny, boost::any> {};
+
+BOOST_AUTO_TEST_CASE(testAnyProxy) {
+ AnyProxy p;
+ boost::any a=p.connectionTune(1,2,3,4);
+ BOOST_CHECK_EQUAL(a.type().name(), typeid(connection::Tune).name());
+ connection::Tune* tune=boost::any_cast<connection::Tune>(&a);
+ BOOST_REQUIRE(tune);
+ BOOST_CHECK_EQUAL(tune->channelMax, 1u);
+ BOOST_CHECK_EQUAL(tune->maxFrameSize, 2u);
+ BOOST_CHECK_EQUAL(tune->heartbeatMin, 3u);
+ BOOST_CHECK_EQUAL(tune->heartbeatMax, 4u);
+}
+
+QPID_AUTO_TEST_SUITE_END()