summaryrefslogtreecommitdiff
path: root/cpp/src/tests/QueueRegistryTest.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2008-05-30 08:13:21 +0000
committerGordon Sim <gsim@apache.org>2008-05-30 08:13:21 +0000
commit5d2f67ee3918516feebc4994d5b21a893ef97a5b (patch)
tree4c13e462ca37f7ce5e8a9564cec5f1e92410e5ab /cpp/src/tests/QueueRegistryTest.cpp
parent162cb3879f3e25cbd13a777b40e374196ab531c9 (diff)
downloadqpid-python-5d2f67ee3918516feebc4994d5b21a893ef97a5b.tar.gz
Convert remaining cppunit tests to boost test framework to reduce dependencies.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@661587 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/QueueRegistryTest.cpp')
-rw-r--r--cpp/src/tests/QueueRegistryTest.cpp121
1 files changed, 60 insertions, 61 deletions
diff --git a/cpp/src/tests/QueueRegistryTest.cpp b/cpp/src/tests/QueueRegistryTest.cpp
index 5fd861d6be..7ad4e0b89d 100644
--- a/cpp/src/tests/QueueRegistryTest.cpp
+++ b/cpp/src/tests/QueueRegistryTest.cpp
@@ -18,78 +18,77 @@
*/
#include "qpid/broker/QueueRegistry.h"
-#include "qpid_test_plugin.h"
+#include "unit_test.h"
#include <string>
using namespace qpid::broker;
-class QueueRegistryTest : public CppUnit::TestCase
-{
- CPPUNIT_TEST_SUITE(QueueRegistryTest);
- CPPUNIT_TEST(testDeclare);
- CPPUNIT_TEST(testDeclareTmp);
- CPPUNIT_TEST(testFind);
- CPPUNIT_TEST(testDestroy);
- CPPUNIT_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE(QueueRegistryTest)
- private:
- std::string foo, bar;
+QPID_AUTO_TEST_CASE(testDeclare)
+{
+ std::string foo("foo");
+ std::string bar("bar");
QueueRegistry reg;
std::pair<Queue::shared_ptr, bool> qc;
-
- public:
- void setUp() {
- foo = "foo";
- bar = "bar";
- }
-
- void testDeclare() {
- qc = reg.declare(foo, false, 0, 0);
- Queue::shared_ptr q = qc.first;
- CPPUNIT_ASSERT(q);
- CPPUNIT_ASSERT(qc.second); // New queue
- CPPUNIT_ASSERT_EQUAL(foo, q->getName());
- qc = reg.declare(foo, false, 0, 0);
- CPPUNIT_ASSERT_EQUAL(q, qc.first);
- CPPUNIT_ASSERT(!qc.second);
+ qc = reg.declare(foo, false, 0, 0);
+ Queue::shared_ptr q = qc.first;
+ BOOST_CHECK(q);
+ BOOST_CHECK(qc.second); // New queue
+ BOOST_CHECK_EQUAL(foo, q->getName());
+
+ qc = reg.declare(foo, false, 0, 0);
+ BOOST_CHECK_EQUAL(q, qc.first);
+ BOOST_CHECK(!qc.second);
- qc = reg.declare(bar, false, 0, 0);
- q = qc.first;
- CPPUNIT_ASSERT(q);
- CPPUNIT_ASSERT_EQUAL(true, qc.second);
- CPPUNIT_ASSERT_EQUAL(bar, q->getName());
- }
+ qc = reg.declare(bar, false, 0, 0);
+ q = qc.first;
+ BOOST_CHECK(q);
+ BOOST_CHECK_EQUAL(true, qc.second);
+ BOOST_CHECK_EQUAL(bar, q->getName());
+}
+
+QPID_AUTO_TEST_CASE(testDeclareTmp)
+{
+ QueueRegistry reg;
+ std::pair<Queue::shared_ptr, bool> qc;
- void testDeclareTmp()
- {
- qc = reg.declare(std::string(), false, 0, 0);
- CPPUNIT_ASSERT(qc.second);
- CPPUNIT_ASSERT_EQUAL(std::string("tmp_1"), qc.first->getName());
- }
+ qc = reg.declare(std::string(), false, 0, 0);
+ BOOST_CHECK(qc.second);
+ BOOST_CHECK_EQUAL(std::string("tmp_1"), qc.first->getName());
+}
- void testFind() {
- CPPUNIT_ASSERT(reg.find(foo) == 0);
+QPID_AUTO_TEST_CASE(testFind)
+{
+ std::string foo("foo");
+ std::string bar("bar");
+ QueueRegistry reg;
+ std::pair<Queue::shared_ptr, bool> qc;
+
+ BOOST_CHECK(reg.find(foo) == 0);
- reg.declare(foo, false, 0, 0);
- reg.declare(bar, false, 0, 0);
- Queue::shared_ptr q = reg.find(bar);
- CPPUNIT_ASSERT(q);
- CPPUNIT_ASSERT_EQUAL(bar, q->getName());
- }
+ reg.declare(foo, false, 0, 0);
+ reg.declare(bar, false, 0, 0);
+ Queue::shared_ptr q = reg.find(bar);
+ BOOST_CHECK(q);
+ BOOST_CHECK_EQUAL(bar, q->getName());
+}
+
+QPID_AUTO_TEST_CASE(testDestroy)
+{
+ std::string foo("foo");
+ QueueRegistry reg;
+ std::pair<Queue::shared_ptr, bool> qc;
- void testDestroy() {
- qc = reg.declare(foo, false, 0, 0);
- reg.destroy(foo);
- // Queue is gone from the registry.
- CPPUNIT_ASSERT(reg.find(foo) == 0);
- // Queue is not actually destroyed till we drop our reference.
- CPPUNIT_ASSERT_EQUAL(foo, qc.first->getName());
- // We shoud be the only reference.
- CPPUNIT_ASSERT_EQUAL(1L, qc.first.use_count());
- }
-};
+ qc = reg.declare(foo, false, 0, 0);
+ reg.destroy(foo);
+ // Queue is gone from the registry.
+ BOOST_CHECK(reg.find(foo) == 0);
+ // Queue is not actually destroyed till we drop our reference.
+ BOOST_CHECK_EQUAL(foo, qc.first->getName());
+ // We shoud be the only reference.
+ BOOST_CHECK_EQUAL(1L, qc.first.use_count());
+}
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(QueueRegistryTest);
+QPID_AUTO_TEST_SUITE_END()