summaryrefslogtreecommitdiff
path: root/cpp/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/tests')
-rw-r--r--cpp/tests/ClientChannelTest.cpp11
-rw-r--r--cpp/tests/HeaderTest.cpp4
-rw-r--r--cpp/tests/MessageTest.cpp3
-rw-r--r--cpp/tests/ProducerConsumerTest.cpp26
-rw-r--r--cpp/tests/setup3
-rwxr-xr-xcpp/tests/topictest3
6 files changed, 20 insertions, 30 deletions
diff --git a/cpp/tests/ClientChannelTest.cpp b/cpp/tests/ClientChannelTest.cpp
index 7f7cfeda89..d041106a23 100644
--- a/cpp/tests/ClientChannelTest.cpp
+++ b/cpp/tests/ClientChannelTest.cpp
@@ -166,20 +166,13 @@ class ClientChannelTest : public CppUnit::TestCase
void testGetFragmentedMessage() {
string longStr(FRAME_MAX*2, 'x'); // Longer than max frame size.
channel.publish(Message(longStr), exchange, qname);
- // FIXME aconway 2007-03-21: Remove couts.
- cout << "==== Fragmented publish:" << endl
- << connection.conversation << endl;
Message getMsg;
- cout << "==== Fragmented get:" << endl
- << connection.conversation << endl;
CPPUNIT_ASSERT(channel.get(getMsg, queue));
}
void testConsumeFragmentedMessage() {
string xx(FRAME_MAX*2, 'x');
channel.publish(Message(xx), exchange, qname);
- cout << "==== Fragmented publish:" << endl
- << connection.conversation << endl;
channel.start();
string tag;
channel.consume(queue, tag, &listener);
@@ -190,10 +183,6 @@ class ClientChannelTest : public CppUnit::TestCase
while (listener.messages.size() != 2)
CPPUNIT_ASSERT(listener.monitor.wait(1*TIME_SEC));
}
- // FIXME aconway 2007-03-21:
- cout << "==== Fragmented consme 2 messages:" << endl
- << connection.conversation << endl;
-
CPPUNIT_ASSERT_EQUAL(xx, listener.messages[0].getData());
CPPUNIT_ASSERT_EQUAL(yy, listener.messages[1].getData());
}
diff --git a/cpp/tests/HeaderTest.cpp b/cpp/tests/HeaderTest.cpp
index f77aaaedb4..77e68829c3 100644
--- a/cpp/tests/HeaderTest.cpp
+++ b/cpp/tests/HeaderTest.cpp
@@ -53,7 +53,7 @@ public:
void testAllSpecificProperties(){
string contentType("text/html");
string contentEncoding("UTF8");
- uint8_t deliveryMode(2);
+ DeliveryMode deliveryMode(PERSISTENT);
uint8_t priority(3);
string correlationId("abc");
string replyTo("no-address");
@@ -106,7 +106,7 @@ public:
void testSomeSpecificProperties(){
string contentType("application/octet-stream");
- uint8_t deliveryMode(5);
+ DeliveryMode deliveryMode(PERSISTENT);
uint8_t priority(6);
string expiration("Z");
uint64_t timestamp(0xabe4a34a);
diff --git a/cpp/tests/MessageTest.cpp b/cpp/tests/MessageTest.cpp
index a3bbfe4afc..9d200cf001 100644
--- a/cpp/tests/MessageTest.cpp
+++ b/cpp/tests/MessageTest.cpp
@@ -69,12 +69,11 @@ class MessageTest : public CppUnit::TestCase
CPPUNIT_ASSERT_EQUAL(exchange, msg->getExchange());
CPPUNIT_ASSERT_EQUAL(routingKey, msg->getRoutingKey());
CPPUNIT_ASSERT_EQUAL(messageId, msg->getHeaderProperties()->getMessageId());
- CPPUNIT_ASSERT_EQUAL((uint8_t) PERSISTENT, msg->getHeaderProperties()->getDeliveryMode());
+ CPPUNIT_ASSERT_EQUAL(PERSISTENT, msg->getHeaderProperties()->getDeliveryMode());
CPPUNIT_ASSERT_EQUAL(string("xyz"), msg->getHeaderProperties()->getHeaders().getString("abc"));
CPPUNIT_ASSERT_EQUAL((uint64_t) 14, msg->contentSize());
MockChannel channel(1);
- // FIXME aconway 2007-02-02: deliver should take ProtocolVersion
msg->deliver(channel, "ignore", 0, 100);
CPPUNIT_ASSERT_EQUAL((size_t) 3, channel.out.frames.size());
AMQContentBody::shared_ptr contentBody(dynamic_pointer_cast<AMQContentBody, AMQBody>(channel.out.frames[2]->getBody()));
diff --git a/cpp/tests/ProducerConsumerTest.cpp b/cpp/tests/ProducerConsumerTest.cpp
index 1f2aeffbc5..ee94a56c55 100644
--- a/cpp/tests/ProducerConsumerTest.cpp
+++ b/cpp/tests/ProducerConsumerTest.cpp
@@ -95,7 +95,7 @@ class ProducerConsumerTest : public CppUnit::TestCase
CPPUNIT_TEST_SUITE(ProducerConsumerTest);
CPPUNIT_TEST(testProduceConsume);
CPPUNIT_TEST(testTimeout);
- CPPUNIT_TEST(testStop);
+ CPPUNIT_TEST(testShutdown);
CPPUNIT_TEST(testCancel);
CPPUNIT_TEST_SUITE_END();
@@ -103,7 +103,7 @@ class ProducerConsumerTest : public CppUnit::TestCase
client::InProcessBrokerClient client;
ProducerConsumer pc;
- WatchedCounter stopped;
+ WatchedCounter shutdown;
WatchedCounter timeout;
WatchedCounter consumed;
WatchedCounter produced;
@@ -124,8 +124,8 @@ class ProducerConsumerTest : public CppUnit::TestCase
void consumeInternal(ProducerConsumer::ConsumerLock& consumer) {
- if (pc.isStopped()) {
- ++stopped;
+ if (pc.isShutdown()) {
+ ++shutdown;
return;
}
if (consumer.isTimedOut()) {
@@ -189,7 +189,7 @@ public:
produce();
CPPUNIT_ASSERT(consumed.waitFor(5));
join(threads);
- CPPUNIT_ASSERT_EQUAL(0, int(stopped));
+ CPPUNIT_ASSERT_EQUAL(0, int(shutdown));
}
void testTimeout() {
@@ -219,30 +219,30 @@ public:
}
- void testStop() {
+ void testShutdown() {
ConsumeRunnable runMe(*this);
vector<Thread> threads = startThreads(2, runMe);
while (pc.consumers() != 2)
Thread::yield();
- pc.stop();
- CPPUNIT_ASSERT(stopped.waitFor(2));
+ pc.shutdown();
+ CPPUNIT_ASSERT(shutdown.waitFor(2));
join(threads);
- threads = startThreads(1, runMe); // Should stop immediately.
- CPPUNIT_ASSERT(stopped.waitFor(3));
+ threads = startThreads(1, runMe); // Should shutdown immediately.
+ CPPUNIT_ASSERT(shutdown.waitFor(3));
join(threads);
- // Produce/consume while stopped should return isStopped and
+ // Produce/consume while shutdown should return isShutdown and
// throw on confirm.
try {
ProducerConsumer::ProducerLock p(pc);
- CPPUNIT_ASSERT(pc.isStopped());
+ CPPUNIT_ASSERT(pc.isShutdown());
CPPUNIT_FAIL("Expected exception");
}
catch (...) {} // Expected
try {
ProducerConsumer::ConsumerLock c(pc);
- CPPUNIT_ASSERT(pc.isStopped());
+ CPPUNIT_ASSERT(pc.isShutdown());
CPPUNIT_FAIL("Expected exception");
}
catch (...) {} // Expected
diff --git a/cpp/tests/setup b/cpp/tests/setup
index 9dde4758b1..a50aa8a5cc 100644
--- a/cpp/tests/setup
+++ b/cpp/tests/setup
@@ -16,12 +16,13 @@ cd $tmp || framework_failure=1
gen_supp=--gen-suppressions=all
# This option makes valgrind significantly slower.
full_leak_check=--leak-check=full
+demangle=--demangle=yes
vg_options="
--suppressions=$abs_srcdir/.vg-supp
--num-callers=25
- --demangle=no
--track-fds=yes
+ $demangle
$full_leak_check
$gen_supp
"
diff --git a/cpp/tests/topictest b/cpp/tests/topictest
index 76807b82bd..92e40b2c37 100755
--- a/cpp/tests/topictest
+++ b/cpp/tests/topictest
@@ -34,5 +34,6 @@ publish() {
for ((i=$SUBSCRIBERS ; i--; )); do
subscribe $i &
done
-
+# FIXME aconway 2007-03-27: Hack around startup race. Fix topic test.
+sleep 1
publish 2>&1 || exit 1