You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2009/09/09 21:46:59 UTC
svn commit: r813094 [2/3] - in /qpid/trunk/qpid/cpp/src: qpid/broker/
qpid/sys/rdma/ tests/
Modified: qpid/trunk/qpid/cpp/src/tests/PollableCondition.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/PollableCondition.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/PollableCondition.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/PollableCondition.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -28,6 +28,8 @@
#include "qpid/sys/Thread.h"
#include <boost/bind.hpp>
+namespace qpid {
+namespace tests {
QPID_AUTO_TEST_SUITE(PollableConditionTest)
@@ -37,7 +39,7 @@
const Duration LONG = TIME_SEC/10;
class Callback {
- public:
+ public:
enum Action { NONE, CLEAR };
Callback() : count(), action(NONE) {}
@@ -46,7 +48,7 @@
Mutex::ScopedLock l(lock);
++count;
switch(action) {
- case NONE: break;
+ case NONE: break;
case CLEAR: pc.clear(); break;
}
action = NONE;
@@ -62,9 +64,9 @@
action = a;
return wait(LONG);
}
-
+
private:
- bool wait(Duration timeout) {
+ bool wait(Duration timeout) {
int n = count;
AbsTime deadline(now(), timeout);
while (n == count && lock.wait(deadline))
@@ -83,7 +85,7 @@
PollableCondition pc(boost::bind(&Callback::call, &callback, _1), poller);
Thread runner = Thread(*poller);
-
+
BOOST_CHECK(callback.isNotCalling()); // condition is not set.
pc.set();
@@ -104,4 +106,4 @@
QPID_AUTO_TEST_SUITE_END()
-
+}} //namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/ProxyTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/ProxyTest.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/ProxyTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/ProxyTest.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -28,6 +28,9 @@
using namespace qpid::framing;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(ProxyTestSuite)
@@ -47,5 +50,7 @@
Proxy::ScopedSync s(p);
p.send(ExecutionSyncBody(p.getVersion()));
}
-
+
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/QueueEvents.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/QueueEvents.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/QueueEvents.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/QueueEvents.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -31,6 +31,9 @@
#include <boost/bind.hpp>
#include <boost/format.hpp>
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(QueueEventsSuite)
using namespace qpid::client;
@@ -156,7 +159,7 @@
fixture.session.queueDeclare(arg::queue=q, arg::arguments=options);
//send and consume some messages
LocalQueue incoming;
- Subscription sub = fixture.subs.subscribe(incoming, q);
+ Subscription sub = fixture.subs.subscribe(incoming, q);
for (int i = 0; i < 5; i++) {
fixture.session.messageTransfer(arg::content=client::Message((boost::format("%1%_%2%") % "Message" % (i+1)).str(), q));
}
@@ -177,7 +180,7 @@
SequenceNumber dequeueId(1);
for (int i = 0; i < 5; i++) {
listener.checkEnqueue(q, (boost::format("%1%_%2%") % "Message" % (i+1)).str(), enqueueId++);
- }
+ }
for (int i = 0; i < 3; i++) {
listener.checkDequeue(q, (boost::format("%1%_%2%") % "Message" % (i+1)).str(), dequeueId++);
}
@@ -203,7 +206,7 @@
fixture.session.queueDeclare(arg::queue=q, arg::arguments=options);
//send and consume some messages
LocalQueue incoming;
- Subscription sub = fixture.subs.subscribe(incoming, q);
+ Subscription sub = fixture.subs.subscribe(incoming, q);
for (int i = 0; i < 5; i++) {
fixture.session.messageTransfer(arg::content=client::Message((boost::format("%1%_%2%") % "Message" % (i+1)).str(), q));
}
@@ -224,7 +227,7 @@
SequenceNumber dequeueId(1);
for (int i = 0; i < 5; i++) {
listener.checkEnqueue(q, (boost::format("%1%_%2%") % "Message" % (i+1)).str(), enqueueId++);
- }
+ }
for (int i = 5; i < 10; i++) {
listener.checkEnqueue(q, (boost::format("%1%_%2%") % "Message" % (i+1)).str(), enqueueId++);
}
@@ -232,4 +235,4 @@
QPID_AUTO_TEST_SUITE_END()
-
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/QueueOptionsTest.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -27,14 +27,17 @@
using namespace qpid::client;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(QueueOptionsTestSuite)
QPID_AUTO_TEST_CASE(testSizePolicy)
{
QueueOptions ft;
-
+
ft.setSizePolicy(REJECT,1,2);
-
+
BOOST_CHECK(QueueOptions::strREJECT == ft.getAsString(QueueOptions::strTypeKey));
BOOST_CHECK(1 == ft.getAsInt(QueueOptions::strMaxSizeKey));
BOOST_CHECK(2 == ft.getAsInt(QueueOptions::strMaxCountKey));
@@ -49,7 +52,7 @@
ft.setSizePolicy(RING_STRICT,1,0);
BOOST_CHECK(QueueOptions::strRING_STRICT == ft.getAsString(QueueOptions::strTypeKey));
-
+
ft.clearSizePolicy();
BOOST_CHECK(!ft.isSet(QueueOptions::strTypeKey));
BOOST_CHECK(!ft.isSet(QueueOptions::strMaxSizeKey));
@@ -59,13 +62,13 @@
QPID_AUTO_TEST_CASE(testFlags)
{
QueueOptions ft;
-
+
ft.setPersistLastNode();
ft.setOrdering(LVQ);
-
+
BOOST_CHECK(1 == ft.getAsInt(QueueOptions::strPersistLastNode));
BOOST_CHECK(1 == ft.getAsInt(QueueOptions::strLastValueQueue));
-
+
ft.clearPersistLastNode();
ft.setOrdering(FIFO);
@@ -78,8 +81,8 @@
{
//ensure setOrdering(FIFO) works even if not preceded by a call to
//setOrdering(LVQ)
- QueueOptions ft;
- ft.setOrdering(FIFO);
+ QueueOptions ft;
+ ft.setOrdering(FIFO);
BOOST_CHECK(!ft.isSet(QueueOptions::strLastValueQueue));
}
@@ -88,10 +91,12 @@
{
//ensure clear works even if not preceded by the setting on the
//option
- QueueOptions ft;
+ QueueOptions ft;
ft.clearPersistLastNode();
BOOST_CHECK(!ft.isSet(QueueOptions::strPersistLastNode));
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/QueuePolicyTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/QueuePolicyTest.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/QueuePolicyTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/QueuePolicyTest.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -32,6 +32,9 @@
using namespace qpid::client;
using namespace qpid::framing;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(QueuePolicyTestSuite)
QueuedMessage createMessage(uint32_t size)
@@ -50,11 +53,11 @@
BOOST_CHECK_EQUAL((uint32_t) 5, policy->getMaxCount());
QueuedMessage msg = createMessage(10);
- for (size_t i = 0; i < 5; i++) {
+ for (size_t i = 0; i < 5; i++) {
policy->tryEnqueue(msg);
}
try {
- policy->tryEnqueue(msg);
+ policy->tryEnqueue(msg);
BOOST_FAIL("Policy did not fail on enqueuing sixth message");
} catch (const ResourceLimitExceededException&) {}
@@ -62,7 +65,7 @@
policy->tryEnqueue(msg);
try {
- policy->tryEnqueue(msg);
+ policy->tryEnqueue(msg);
BOOST_FAIL("Policy did not fail on enqueuing sixth message (after dequeue)");
} catch (const ResourceLimitExceededException&) {}
}
@@ -71,12 +74,12 @@
{
std::auto_ptr<QueuePolicy> policy(QueuePolicy::createQueuePolicy(0, 50));
QueuedMessage msg = createMessage(10);
-
- for (size_t i = 0; i < 5; i++) {
+
+ for (size_t i = 0; i < 5; i++) {
policy->tryEnqueue(msg);
}
try {
- policy->tryEnqueue(msg);
+ policy->tryEnqueue(msg);
BOOST_FAIL("Policy did not fail on aggregate size exceeding 50. " << *policy);
} catch (const ResourceLimitExceededException&) {}
@@ -84,7 +87,7 @@
policy->tryEnqueue(msg);
try {
- policy->tryEnqueue(msg);
+ policy->tryEnqueue(msg);
BOOST_FAIL("Policy did not fail on aggregate size exceeding 50 (after dequeue). " << *policy);
} catch (const ResourceLimitExceededException&) {}
}
@@ -104,7 +107,7 @@
messages.push_back(createMessage(11));
messages.push_back(createMessage(2));
messages.push_back(createMessage(7));
- for (size_t i = 0; i < messages.size(); i++) {
+ for (size_t i = 0; i < messages.size(); i++) {
policy->tryEnqueue(messages[i]);
}
//size = 45 at this point, count = 5
@@ -140,7 +143,7 @@
BOOST_CHECK_EQUAL(a->getMaxSize(), b->getMaxSize());
}
-QPID_AUTO_TEST_CASE(testRingPolicy)
+QPID_AUTO_TEST_CASE(testRingPolicy)
{
FieldTable args;
std::auto_ptr<QueuePolicy> policy = QueuePolicy::createQueuePolicy(5, 0, QueuePolicy::RING);
@@ -169,7 +172,7 @@
BOOST_CHECK(!f.subs.get(msg, q));
}
-QPID_AUTO_TEST_CASE(testStrictRingPolicy)
+QPID_AUTO_TEST_CASE(testStrictRingPolicy)
{
FieldTable args;
std::auto_ptr<QueuePolicy> policy = QueuePolicy::createQueuePolicy(5, 0, QueuePolicy::RING_STRICT);
@@ -181,7 +184,7 @@
LocalQueue incoming;
SubscriptionSettings settings(FlowControl::unlimited());
settings.autoAck = 0; // no auto ack.
- Subscription sub = f.subs.subscribe(incoming, q, settings);
+ Subscription sub = f.subs.subscribe(incoming, q, settings);
for (int i = 0; i < 5; i++) {
f.session.messageTransfer(arg::content=client::Message((boost::format("%1%_%2%") % "Message" % (i+1)).str(), q));
}
@@ -192,10 +195,10 @@
ScopedSuppressLogging sl; // Suppress messages for expected errors.
f.session.messageTransfer(arg::content=client::Message("Message_6", q));
BOOST_FAIL("expecting ResourceLimitExceededException.");
- } catch (const ResourceLimitExceededException&) {}
+ } catch (const ResourceLimitExceededException&) {}
}
-QPID_AUTO_TEST_CASE(testPolicyWithDtx)
+QPID_AUTO_TEST_CASE(testPolicyWithDtx)
{
FieldTable args;
std::auto_ptr<QueuePolicy> policy = QueuePolicy::createQueuePolicy(5, 0, QueuePolicy::REJECT);
@@ -207,7 +210,7 @@
LocalQueue incoming;
SubscriptionSettings settings(FlowControl::unlimited());
settings.autoAck = 0; // no auto ack.
- Subscription sub = f.subs.subscribe(incoming, q, settings);
+ Subscription sub = f.subs.subscribe(incoming, q, settings);
f.session.dtxSelect();
Xid tx1(1, "test-dtx-mgr", "tx1");
f.session.dtxStart(arg::xid=tx1);
@@ -244,7 +247,7 @@
ScopedSuppressLogging sl; // Suppress messages for expected errors.
other.messageTransfer(arg::content=client::Message("Message_6", q));
BOOST_FAIL("expecting ResourceLimitExceededException.");
- } catch (const ResourceLimitExceededException&) {}
+ } catch (const ResourceLimitExceededException&) {}
f.session.dtxCommit(arg::xid=tx3);
//now retry and this time should succeed
@@ -252,7 +255,7 @@
other.messageTransfer(arg::content=client::Message("Message_6", q));
}
-QPID_AUTO_TEST_CASE(testFlowToDiskWithNoStore)
+QPID_AUTO_TEST_CASE(testFlowToDiskWithNoStore)
{
//Ensure that with no store loaded, we don't flow to disk but
//fallback to rejecting messages
@@ -265,7 +268,7 @@
LocalQueue incoming;
SubscriptionSettings settings(FlowControl::unlimited());
settings.autoAck = 0; // no auto ack.
- Subscription sub = f.subs.subscribe(incoming, q, settings);
+ Subscription sub = f.subs.subscribe(incoming, q, settings);
for (int i = 0; i < 5; i++) {
f.session.messageTransfer(arg::content=client::Message((boost::format("%1%_%2%") % "Message" % (i+1)).str(), q));
}
@@ -276,8 +279,10 @@
ScopedSuppressLogging sl; // Suppress messages for expected errors.
f.session.messageTransfer(arg::content=client::Message("Message_6", q));
BOOST_FAIL("expecting ResourceLimitExceededException.");
- } catch (const ResourceLimitExceededException&) {}
+ } catch (const ResourceLimitExceededException&) {}
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/QueueRegistryTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/QueueRegistryTest.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/QueueRegistryTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/QueueRegistryTest.cpp Wed Sep 9 19:46:56 2009
@@ -6,9 +6,9 @@
* 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
@@ -23,6 +23,9 @@
using namespace qpid::broker;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(QueueRegistryTest)
QPID_AUTO_TEST_CASE(testDeclare)
@@ -49,7 +52,7 @@
BOOST_CHECK_EQUAL(bar, q->getName());
}
-QPID_AUTO_TEST_CASE(testDeclareTmp)
+QPID_AUTO_TEST_CASE(testDeclareTmp)
{
QueueRegistry reg;
std::pair<Queue::shared_ptr, bool> qc;
@@ -58,8 +61,8 @@
BOOST_CHECK(qc.second);
BOOST_CHECK_EQUAL(std::string("tmp_1"), qc.first->getName());
}
-
-QPID_AUTO_TEST_CASE(testFind)
+
+QPID_AUTO_TEST_CASE(testFind)
{
std::string foo("foo");
std::string bar("bar");
@@ -75,7 +78,7 @@
BOOST_CHECK_EQUAL(bar, q->getName());
}
-QPID_AUTO_TEST_CASE(testDestroy)
+QPID_AUTO_TEST_CASE(testDestroy)
{
std::string foo("foo");
QueueRegistry reg;
@@ -92,3 +95,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/QueueTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/QueueTest.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/QueueTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/QueueTest.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -39,9 +39,12 @@
using namespace qpid::framing;
using namespace qpid::sys;
+namespace qpid {
+namespace tests {
+
class TestConsumer : public virtual Consumer{
public:
- typedef boost::shared_ptr<TestConsumer> shared_ptr;
+ typedef boost::shared_ptr<TestConsumer> shared_ptr;
intrusive_ptr<Message> last;
bool received;
@@ -82,68 +85,68 @@
QPID_AUTO_TEST_CASE(testAsyncMessage) {
Queue::shared_ptr queue(new Queue("my_test_queue", true));
intrusive_ptr<Message> received;
-
+
TestConsumer::shared_ptr c1(new TestConsumer());
queue->consume(c1);
-
-
+
+
//Test basic delivery:
intrusive_ptr<Message> msg1 = create_message("e", "A");
msg1->enqueueAsync(queue, 0);//this is done on enqueue which is not called from process
queue->process(msg1);
sleep(2);
-
+
BOOST_CHECK(!c1->received);
msg1->enqueueComplete();
-
+
received = queue->get().payload;
- BOOST_CHECK_EQUAL(msg1.get(), received.get());
+ BOOST_CHECK_EQUAL(msg1.get(), received.get());
}
-
-
+
+
QPID_AUTO_TEST_CASE(testAsyncMessageCount){
Queue::shared_ptr queue(new Queue("my_test_queue", true));
intrusive_ptr<Message> msg1 = create_message("e", "A");
msg1->enqueueAsync(queue, 0);//this is done on enqueue which is not called from process
-
+
queue->process(msg1);
sleep(2);
uint32_t compval=0;
BOOST_CHECK_EQUAL(compval, queue->getMessageCount());
msg1->enqueueComplete();
compval=1;
- BOOST_CHECK_EQUAL(compval, queue->getMessageCount());
+ BOOST_CHECK_EQUAL(compval, queue->getMessageCount());
}
QPID_AUTO_TEST_CASE(testConsumers){
Queue::shared_ptr queue(new Queue("my_queue", true));
-
+
//Test adding consumers:
TestConsumer::shared_ptr c1(new TestConsumer());
TestConsumer::shared_ptr c2(new TestConsumer());
queue->consume(c1);
queue->consume(c2);
-
+
BOOST_CHECK_EQUAL(uint32_t(2), queue->getConsumerCount());
-
+
//Test basic delivery:
intrusive_ptr<Message> msg1 = create_message("e", "A");
intrusive_ptr<Message> msg2 = create_message("e", "B");
intrusive_ptr<Message> msg3 = create_message("e", "C");
-
+
queue->deliver(msg1);
BOOST_CHECK(queue->dispatch(c1));
BOOST_CHECK_EQUAL(msg1.get(), c1->last.get());
-
+
queue->deliver(msg2);
BOOST_CHECK(queue->dispatch(c2));
BOOST_CHECK_EQUAL(msg2.get(), c2->last.get());
-
+
c1->received = false;
queue->deliver(msg3);
BOOST_CHECK(queue->dispatch(c1));
- BOOST_CHECK_EQUAL(msg3.get(), c1->last.get());
-
+ BOOST_CHECK_EQUAL(msg3.get(), c1->last.get());
+
//Test cancellation:
queue->cancel(c1);
BOOST_CHECK_EQUAL(uint32_t(1), queue->getConsumerCount());
@@ -157,15 +160,15 @@
registry.declare("queue1", true, true);
registry.declare("queue2", true, true);
registry.declare("queue3", true, true);
-
+
BOOST_CHECK(registry.find("queue1"));
BOOST_CHECK(registry.find("queue2"));
BOOST_CHECK(registry.find("queue3"));
-
+
registry.destroy("queue1");
registry.destroy("queue2");
registry.destroy("queue3");
-
+
BOOST_CHECK(!registry.find("queue1"));
BOOST_CHECK(!registry.find("queue2"));
BOOST_CHECK(!registry.find("queue3"));
@@ -177,13 +180,13 @@
intrusive_ptr<Message> msg2 = create_message("e", "B");
intrusive_ptr<Message> msg3 = create_message("e", "C");
intrusive_ptr<Message> received;
-
+
queue->deliver(msg1);
queue->deliver(msg2);
queue->deliver(msg3);
-
+
BOOST_CHECK_EQUAL(uint32_t(3), queue->getMessageCount());
-
+
received = queue->get().payload;
BOOST_CHECK_EQUAL(msg1.get(), received.get());
BOOST_CHECK_EQUAL(uint32_t(2), queue->getMessageCount());
@@ -204,7 +207,7 @@
received = queue->get().payload;
BOOST_CHECK(!received);
BOOST_CHECK_EQUAL(uint32_t(0), queue->getMessageCount());
-
+
}
QPID_AUTO_TEST_CASE(testBound)
@@ -236,7 +239,7 @@
queue->unbind(exchanges, queue);
//ensure the remaining exchanges don't still have the queue bound to them:
- FailOnDeliver deliverable;
+ FailOnDeliver deliverable;
exchange1->route(deliverable, key, &args);
exchange3->route(deliverable, key, &args);
}
@@ -245,10 +248,10 @@
client::QueueOptions args;
args.setPersistLastNode();
-
+
Queue::shared_ptr queue(new Queue("my-queue", true));
queue->configure(args);
-
+
intrusive_ptr<Message> msg1 = create_message("e", "A");
intrusive_ptr<Message> msg2 = create_message("e", "B");
intrusive_ptr<Message> msg3 = create_message("e", "C");
@@ -256,13 +259,13 @@
//enqueue 2 messages
queue->deliver(msg1);
queue->deliver(msg2);
-
+
//change mode
queue->setLastNodeFailure();
-
+
//enqueue 1 message
queue->deliver(msg3);
-
+
//check all have persistent ids.
BOOST_CHECK(msg1->isPersistent());
BOOST_CHECK(msg2->isPersistent());
@@ -277,7 +280,7 @@
uint enqCnt;
uint deqCnt;
bool error;
-
+
virtual void dequeue(TransactionContext*,
const boost::intrusive_ptr<PersistableMessage>& /*msg*/,
const PersistableQueue& /*queue*/)
@@ -298,7 +301,7 @@
{
error=true;
}
-
+
TestMessageStoreOC() : NullMessageStore(),enqCnt(0),deqCnt(0),error(false) {}
~TestMessageStoreOC(){}
};
@@ -312,7 +315,7 @@
Queue::shared_ptr queue(new Queue("my-queue", true ));
queue->configure(args);
-
+
intrusive_ptr<Message> msg1 = create_message("e", "A");
intrusive_ptr<Message> msg2 = create_message("e", "B");
intrusive_ptr<Message> msg3 = create_message("e", "C");
@@ -324,27 +327,27 @@
string key;
args.getLVQKey(key);
BOOST_CHECK_EQUAL(key, "qpid.LVQ_key");
-
+
msg1->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"a");
msg2->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"b");
msg3->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"c");
msg4->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"a");
-
+
//enqueue 4 message
queue->deliver(msg1);
queue->deliver(msg2);
queue->deliver(msg3);
queue->deliver(msg4);
-
+
BOOST_CHECK_EQUAL(queue->getMessageCount(), 3u);
-
+
received = queue->get().payload;
BOOST_CHECK_EQUAL(msg4.get(), received.get());
received = queue->get().payload;
BOOST_CHECK_EQUAL(msg2.get(), received.get());
-
+
received = queue->get().payload;
BOOST_CHECK_EQUAL(msg3.get(), received.get());
@@ -357,18 +360,18 @@
queue->deliver(msg5);
queue->deliver(msg6);
queue->deliver(msg7);
-
+
BOOST_CHECK_EQUAL(queue->getMessageCount(), 3u);
-
+
received = queue->get().payload;
BOOST_CHECK_EQUAL(msg5.get(), received.get());
received = queue->get().payload;
BOOST_CHECK_EQUAL(msg6.get(), received.get());
-
+
received = queue->get().payload;
BOOST_CHECK_EQUAL(msg7.get(), received.get());
-
+
}
QPID_AUTO_TEST_CASE(testLVQEmptyKey){
@@ -379,20 +382,20 @@
Queue::shared_ptr queue(new Queue("my-queue", true ));
queue->configure(args);
-
+
intrusive_ptr<Message> msg1 = create_message("e", "A");
intrusive_ptr<Message> msg2 = create_message("e", "B");
string key;
args.getLVQKey(key);
BOOST_CHECK_EQUAL(key, "qpid.LVQ_key");
-
+
msg1->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"a");
queue->deliver(msg1);
queue->deliver(msg2);
BOOST_CHECK_EQUAL(queue->getMessageCount(), 2u);
-
+
}
QPID_AUTO_TEST_CASE(testLVQAcquire){
@@ -403,7 +406,7 @@
Queue::shared_ptr queue(new Queue("my-queue", true ));
queue->configure(args);
-
+
intrusive_ptr<Message> msg1 = create_message("e", "A");
intrusive_ptr<Message> msg2 = create_message("e", "B");
intrusive_ptr<Message> msg3 = create_message("e", "C");
@@ -416,7 +419,7 @@
string key;
args.getLVQKey(key);
BOOST_CHECK_EQUAL(key, "qpid.LVQ_key");
-
+
msg1->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"a");
msg2->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"b");
@@ -424,13 +427,13 @@
msg4->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"a");
msg5->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"b");
msg6->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"c");
-
+
//enqueue 4 message
queue->deliver(msg1);
queue->deliver(msg2);
queue->deliver(msg3);
queue->deliver(msg4);
-
+
BOOST_CHECK_EQUAL(queue->getMessageCount(), 3u);
framing::SequenceNumber sequence(1);
@@ -439,9 +442,9 @@
BOOST_CHECK(!queue->acquire(qmsg));
BOOST_CHECK(queue->acquire(qmsg2));
-
+
BOOST_CHECK_EQUAL(queue->getMessageCount(), 2u);
-
+
queue->deliver(msg5);
BOOST_CHECK_EQUAL(queue->getMessageCount(), 3u);
@@ -449,11 +452,11 @@
args.setOrdering(client::LVQ_NO_BROWSE);
queue->configure(args);
TestConsumer::shared_ptr c1(new TestConsumer(false));
-
+
queue->dispatch(c1);
queue->dispatch(c1);
queue->dispatch(c1);
-
+
queue->deliver(msg6);
BOOST_CHECK_EQUAL(queue->getMessageCount(), 3u);
@@ -474,7 +477,7 @@
intrusive_ptr<Message> received;
queue1->configure(args);
queue2->configure(args);
-
+
intrusive_ptr<Message> msg1 = create_message("e", "A");
intrusive_ptr<Message> msg2 = create_message("e", "A");
@@ -484,17 +487,17 @@
msg1->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"a");
msg2->getProperties<MessageProperties>()->getApplicationHeaders().setString(key,"a");
-
+
queue1->deliver(msg1);
queue2->deliver(msg1);
queue1->deliver(msg2);
-
+
received = queue1->get().payload;
BOOST_CHECK_EQUAL(msg2.get(), received.get());
received = queue2->get().payload;
BOOST_CHECK_EQUAL(msg1.get(), received.get());
-
+
}
QPID_AUTO_TEST_CASE(testLVQRecover){
@@ -518,7 +521,7 @@
Queue::shared_ptr queue1(new Queue("my-queue", true, &testStore));
intrusive_ptr<Message> received;
queue1->configure(args);
-
+
intrusive_ptr<Message> msg1 = create_message("e", "A");
intrusive_ptr<Message> msg2 = create_message("e", "A");
// 2
@@ -544,7 +547,7 @@
BOOST_CHECK_EQUAL(testStore.deqCnt, 1u);
}
-void addMessagesToQueue(uint count, Queue& queue, uint oddTtl = 200, uint evenTtl = 0)
+void addMessagesToQueue(uint count, Queue& queue, uint oddTtl = 200, uint evenTtl = 0)
{
for (uint i = 0; i < count; i++) {
intrusive_ptr<Message> m = create_message("exchange", "key");
@@ -592,7 +595,7 @@
queue1->configure(args);
Queue::shared_ptr queue2(new Queue("queue2", true, &testStore ));
queue2->configure(args);
-
+
intrusive_ptr<Message> msg1 = create_message("e", "A");
queue1->deliver(msg1);
@@ -623,7 +626,7 @@
// check no failure messages are stored
queue1->clearLastNodeFailure();
queue2->clearLastNodeFailure();
-
+
intrusive_ptr<Message> msg3 = create_message("e", "B");
queue1->deliver(msg3);
queue2->deliver(msg3);
@@ -631,7 +634,7 @@
queue1->setLastNodeFailure();
queue2->setLastNodeFailure();
BOOST_CHECK_EQUAL(testStore.enqCnt, 6u);
-
+
// check requeue 1
intrusive_ptr<Message> msg4 = create_message("e", "C");
intrusive_ptr<Message> msg5 = create_message("e", "D");
@@ -639,17 +642,17 @@
framing::SequenceNumber sequence(1);
QueuedMessage qmsg1(queue1.get(), msg4, sequence);
QueuedMessage qmsg2(queue2.get(), msg5, ++sequence);
-
+
queue1->requeue(qmsg1);
BOOST_CHECK_EQUAL(testStore.enqCnt, 7u);
-
+
// check requeue 2
queue2->clearLastNodeFailure();
queue2->requeue(qmsg2);
BOOST_CHECK_EQUAL(testStore.enqCnt, 7u);
queue2->setLastNodeFailure();
BOOST_CHECK_EQUAL(testStore.enqCnt, 8u);
-
+
queue2->clearLastNodeFailure();
queue2->setLastNodeFailure();
BOOST_CHECK_EQUAL(testStore.enqCnt, 8u);
@@ -664,8 +667,8 @@
4. stop and recover remaining node
5. add another node
6. kill that new node again
-make sure that an attempt to re-enqueue a message does not happen which will
-result in the last man standing exiting with an error.
+make sure that an attempt to re-enqueue a message does not happen which will
+result in the last man standing exiting with an error.
we need to make sure that recover is safe, i.e. messages are
not requeued to the store.
@@ -678,7 +681,7 @@
Queue::shared_ptr queue1(new Queue("my-queue", true, &testStore));
intrusive_ptr<Message> received;
queue1->configure(args);
-
+
// check requeue 1
intrusive_ptr<Message> msg1 = create_message("e", "C");
intrusive_ptr<Message> msg2 = create_message("e", "D");
@@ -711,17 +714,19 @@
Queue::shared_ptr queue1(new Queue("my-queue", true, &testStore));
intrusive_ptr<Message> received;
queue1->configure(args);
-
+
// check requeue 1
intrusive_ptr<Message> msg1 = create_message("e", "C");
queue1->deliver(msg1);
testStore.createError();
-
+
ScopedSuppressLogging sl; // Suppress messages for expected errors.
queue1->setLastNodeFailure();
BOOST_CHECK_EQUAL(testStore.enqCnt, 0u);
-}QPID_AUTO_TEST_SUITE_END()
+}
+QPID_AUTO_TEST_SUITE_END()
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/RangeSet.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/RangeSet.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/RangeSet.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/RangeSet.cpp Wed Sep 9 19:46:56 2009
@@ -24,6 +24,9 @@
using namespace std;
using namespace qpid;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(RangeSetTestSuite)
typedef qpid::Range<int> TestRange;
@@ -44,8 +47,8 @@
BOOST_CHECK_MESSAGE(r.contains(TestRange(3,4)), r);
BOOST_CHECK(!r.empty());
r += 5;
- BOOST_CHECK_MESSAGE(r.contains(5), r);
- BOOST_CHECK_MESSAGE(r.contains(TestRange(5,6)), r);
+ BOOST_CHECK_MESSAGE(r.contains(5), r);
+ BOOST_CHECK_MESSAGE(r.contains(TestRange(5,6)), r);
BOOST_CHECK_MESSAGE(!r.contains(TestRange(3,6)), r);
r += 4;
BOOST_CHECK_MESSAGE(r.contains(TestRange(3,6)), r);
@@ -139,3 +142,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/RateFlowcontrolTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/RateFlowcontrolTest.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/RateFlowcontrolTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/RateFlowcontrolTest.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -27,25 +27,28 @@
using namespace qpid::broker;
using namespace qpid::sys;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(RateFlowcontrolTestSuite)
QPID_AUTO_TEST_CASE(RateFlowcontrolTest)
{
// BOOST_CHECK(predicate);
// BOOST_CHECK_EQUAL(a, b);
-
+
RateFlowcontrol fc(100);
AbsTime n=AbsTime::now();
-
+
BOOST_CHECK_EQUAL( fc.receivedMessage(n, 0), 0U );
-
+
fc.sentCredit(n, 0);
-
+
BOOST_CHECK_EQUAL( fc.receivedMessage(n, 0), 0U );
fc.sentCredit(n, 50);
Duration d=250*TIME_MSEC;
-
+
n = AbsTime(n,d);
BOOST_CHECK_EQUAL( fc.receivedMessage(n, 25), 0U );
BOOST_CHECK_EQUAL( fc.availableCredit(n), 25U );
@@ -64,3 +67,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/RefCounted.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/RefCounted.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/RefCounted.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/RefCounted.cpp Wed Sep 9 19:46:56 2009
@@ -27,6 +27,9 @@
using namespace std;
using namespace qpid;
+namespace qpid {
+namespace tests {
+
struct CountMe : public RefCounted {
static int instances;
CountMe() { ++instances; }
@@ -48,3 +51,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/ReplicationTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/ReplicationTest.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/ReplicationTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/ReplicationTest.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -42,6 +42,9 @@
using namespace qpid::replication::constants;
using boost::assign::list_of;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(ReplicationTestSuite)
// The CMake-based build passes in the module suffix; if it's not there, this
@@ -63,7 +66,7 @@
return opts;
}
-QPID_AUTO_TEST_CASE(testReplicationExchange)
+QPID_AUTO_TEST_CASE(testReplicationExchange)
{
qpid::broker::Broker::Options brokerOpts(getBrokerOpts(list_of<string>("qpidd")
("--replication-exchange-name=qpid.replication")));
@@ -79,7 +82,7 @@
f.session.queueDeclare(arg::queue=eventQ, arg::exclusive=true, arg::autoDelete=true, arg::arguments=eventQopts);
f.session.exchangeBind(arg::exchange="qpid.replication", arg::queue=eventQ, arg::bindingKey=dataQ);
-
+
f.session.queueDeclare(arg::queue=eventQ2, arg::exclusive=true, arg::autoDelete=true, arg::arguments=eventQopts);
f.session.exchangeBind(arg::exchange="qpid.replication", arg::queue=eventQ2, arg::bindingKey=dataQ2);
@@ -133,3 +136,5 @@
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/RetryList.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/RetryList.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/RetryList.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/RetryList.cpp Wed Sep 9 19:46:56 2009
@@ -24,6 +24,9 @@
using namespace qpid;
using namespace qpid::broker;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(RetryListTestSuite)
struct RetryListFixture
@@ -36,7 +39,7 @@
{
urls.push_back(Url(s));
}
-
+
void addExpectation(const std::string& host, uint16_t port)
{
expected.push_back(TcpAddress(host, port));
@@ -57,7 +60,7 @@
}
};
-QPID_AUTO_TEST_CASE(testWithSingleAddress)
+QPID_AUTO_TEST_CASE(testWithSingleAddress)
{
RetryListFixture test;
test.addUrl("amqp:host:5673");
@@ -65,7 +68,7 @@
test.check();
}
-QPID_AUTO_TEST_CASE(testWithSingleUrlOfMultipleAddresses)
+QPID_AUTO_TEST_CASE(testWithSingleUrlOfMultipleAddresses)
{
RetryListFixture test;
test.addUrl("amqp:host1,host2:2222,tcp:host3:5673,host4:1");
@@ -78,7 +81,7 @@
test.check();
}
-QPID_AUTO_TEST_CASE(testWithMultipleUrlsOfMultipleAddresses)
+QPID_AUTO_TEST_CASE(testWithMultipleUrlsOfMultipleAddresses)
{
RetryListFixture test;
test.addUrl("amqp:my-host");
@@ -97,10 +100,12 @@
test.check();
}
-QPID_AUTO_TEST_CASE(testEmptyList)
+QPID_AUTO_TEST_CASE(testEmptyList)
{
RetryListFixture test;
test.check();
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/SequenceNumberTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/SequenceNumberTest.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/SequenceNumberTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/SequenceNumberTest.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -26,6 +26,8 @@
using namespace qpid::framing;
+namespace qpid {
+namespace tests {
void checkDifference(SequenceNumber& a, SequenceNumber& b, int gap)
{
@@ -54,7 +56,7 @@
BOOST_CHECK(++a < ++b);//test prefix
}
//keep incrementing until a also wraps around
- for (int i = 0; i < (gap + 2); i++) {
+ for (int i = 0; i < (gap + 2); i++) {
BOOST_CHECK(a++ < b++);//test postfix
}
//let a 'catch up'
@@ -91,7 +93,7 @@
BOOST_CHECK(b != c);
}
-QPID_AUTO_TEST_CASE(testIncrementPrefix)
+QPID_AUTO_TEST_CASE(testIncrementPrefix)
{
SequenceNumber a;
SequenceNumber b;
@@ -203,3 +205,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/SequenceSet.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/SequenceSet.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/SequenceSet.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/SequenceSet.cpp Wed Sep 9 19:46:56 2009
@@ -20,6 +20,9 @@
#include "unit_test.h"
#include <list>
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(SequenceSetTestSuite)
using namespace qpid::framing;
@@ -72,7 +75,7 @@
BOOST_CHECK(!s.contains(i));
RangeExpectations().expect(2, 5).expect(8, 8).check(s);
-
+
SequenceSet t;
t.add(6, 10);
t.add(s);
@@ -90,7 +93,7 @@
SequenceSet s;
s.add(7,6);
s.add(4,4);
- s.add(3,10);
+ s.add(3,10);
s.add(2);
RangeExpectations().expect(2, 10).check(s);
}
@@ -137,4 +140,4 @@
QPID_AUTO_TEST_SUITE_END()
-
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/SessionState.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/SessionState.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/SessionState.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/SessionState.cpp Wed Sep 9 19:46:56 2009
@@ -28,6 +28,9 @@
#include <functional>
#include <numeric>
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(SessionStateTestSuite)
using namespace std;
@@ -94,7 +97,7 @@
size_t transfer1Char(qpid::SessionState& s, char content) {
return transfer1(s, string(1,content));
}
-
+
// Send transfer frame with multiple single-byte content frames.
size_t transferN(qpid::SessionState& s, string content) {
size_t size=send(s, transferFrame(!content.empty()));
@@ -134,7 +137,7 @@
BOOST_CHECK_EQUAL(str(s.senderExpected(SessionPoint(0,0))),"CabcCdCeCfCxyz");
// Ignore controls.
s.senderRecord(AMQFrame(new SessionFlushBody()));
- BOOST_CHECK_EQUAL(str(s.senderExpected(SessionPoint(2,0))),"CeCfCxyz");
+ BOOST_CHECK_EQUAL(str(s.senderExpected(SessionPoint(2,0))),"CeCfCxyz");
}
QPID_AUTO_TEST_CASE(testNeedFlush) {
@@ -185,7 +188,7 @@
s.senderConfirmed(SessionPoint(5));
BOOST_CHECK_EQUAL(str(s.senderExpected(SessionPoint(5,0))), "CxCy");
BOOST_CHECK(s.senderNeedFlush());
-
+
s.senderConfirmed(SessionPoint(6));
BOOST_CHECK_EQUAL(str(s.senderExpected(SessionPoint(6,0))), "Cy");
BOOST_CHECK(!s.senderNeedFlush());
@@ -195,7 +198,7 @@
qpid::SessionState s;
s.setTimeout(1);
s.senderGetCommandPoint();
- // Completion implies confirmation
+ // Completion implies confirmation
transfers(s, "abc");
BOOST_CHECK_EQUAL(str(s.senderExpected(SessionPoint(0,0))), "CaCbCc");
SequenceSet set(SequenceSet() + 0 + 1);
@@ -205,7 +208,7 @@
transfers(s, "def");
// We dont do out-of-order confirmation, so this will only confirm up to 3:
set = SequenceSet(SequenceSet() + 2 + 3 + 5);
- s.senderCompleted(set);
+ s.senderCompleted(set);
BOOST_CHECK_EQUAL(str(s.senderExpected(SessionPoint(4,0))), "CeCf");
}
@@ -215,11 +218,11 @@
s.receiverSetCommandPoint(SessionPoint());
BOOST_CHECK_EQUAL(s.receiverGetExpected(), SessionPoint(0));
BOOST_CHECK_EQUAL(s.receiverGetReceived(), SessionPoint(0));
-
+
BOOST_CHECK(s.receiverRecord(transferFrame(false)));
BOOST_CHECK_EQUAL(s.receiverGetExpected(), SessionPoint(1));
BOOST_CHECK_EQUAL(s.receiverGetReceived(), SessionPoint(1));
-
+
BOOST_CHECK(s.receiverRecord(transferFrame(true)));
SessionPoint point = SessionPoint(1, transferFrameSize());
BOOST_CHECK_EQUAL(s.receiverGetExpected(), point);
@@ -297,3 +300,5 @@
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/Shlib.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/Shlib.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/Shlib.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/Shlib.cpp Wed Sep 9 19:46:56 2009
@@ -24,6 +24,9 @@
#include "unit_test.h"
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(ShlibTestSuite)
using namespace qpid::sys;
@@ -51,7 +54,7 @@
}
catch (const qpid::Exception&) {}
}
-
+
QPID_AUTO_TEST_CASE(testAutoShlib) {
int unloaded = 0;
{
@@ -66,6 +69,8 @@
}
BOOST_CHECK_EQUAL(42, unloaded);
}
-
+
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/SocketProxy.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/SocketProxy.h?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/SocketProxy.h (original)
+++ qpid/trunk/qpid/cpp/src/tests/SocketProxy.h Wed Sep 9 19:46:56 2009
@@ -35,8 +35,11 @@
#include "qpid/sys/Mutex.h"
#include "qpid/log/Statement.h"
+namespace qpid {
+namespace tests {
+
/**
- * A simple socket proxy that forwards to another socket.
+ * A simple socket proxy that forwards to another socket.
* Used between client & local broker to simulate network failures.
*/
class SocketProxy : private qpid::sys::Runnable
@@ -59,7 +62,7 @@
joined = false;
thread = qpid::sys::Thread(static_cast<qpid::sys::Runnable*>(this));
}
-
+
~SocketProxy() { close(); if (!joined) thread.join(); }
/** Simulate a network disconnect. */
@@ -88,7 +91,7 @@
}
uint16_t getPort() const { return port; }
-
+
private:
static void throwErrno(const std::string& msg) {
throw qpid::Exception(msg+":"+qpid::sys::strError(errno));
@@ -153,7 +156,7 @@
}
try {
if (server.get()) server->close();
- close();
+ close();
}
catch (const std::exception& e) {
QPID_LOG(debug, "SocketProxy::run exception in client/server close()" << e.what());
@@ -169,4 +172,6 @@
bool dropClient, dropServer;
};
+}} // namespace qpid::tests
+
#endif
Modified: qpid/trunk/qpid/cpp/src/tests/TestMessageStore.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/TestMessageStore.h?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/TestMessageStore.h (original)
+++ qpid/trunk/qpid/cpp/src/tests/TestMessageStore.h Wed Sep 9 19:46:56 2009
@@ -10,9 +10,9 @@
* 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
@@ -28,6 +28,9 @@
using namespace qpid::broker;
using namespace qpid::framing;
+namespace qpid {
+namespace tests {
+
typedef std::pair<string, boost::intrusive_ptr<PersistableMessage> > msg_queue_pair;
class TestMessageStore : public NullMessageStore
@@ -35,7 +38,7 @@
public:
std::vector<boost::intrusive_ptr<PersistableMessage> > dequeued;
std::vector<msg_queue_pair> enqueued;
-
+
void dequeue(TransactionContext*,
const boost::intrusive_ptr<PersistableMessage>& msg,
const PersistableQueue& /*queue*/)
@@ -47,7 +50,7 @@
const boost::intrusive_ptr<PersistableMessage>& msg,
const PersistableQueue& queue)
{
- msg->enqueueComplete();
+ msg->enqueueComplete();
enqueued.push_back(msg_queue_pair(queue.getName(), msg));
}
@@ -55,4 +58,6 @@
~TestMessageStore(){}
};
+}} // namespace qpid::tests
+
#endif
Modified: qpid/trunk/qpid/cpp/src/tests/TestOptions.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/TestOptions.h?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/TestOptions.h (original)
+++ qpid/trunk/qpid/cpp/src/tests/TestOptions.h Wed Sep 9 19:46:56 2009
@@ -9,9 +9,9 @@
* 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
@@ -67,7 +67,7 @@
connection.open(con);
}
-
+
bool help;
ConnectionOptions con;
qpid::log::Options log;
Modified: qpid/trunk/qpid/cpp/src/tests/TimerTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/TimerTest.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/TimerTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/TimerTest.cpp Wed Sep 9 19:46:56 2009
@@ -8,9 +8,9 @@
* 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
@@ -32,6 +32,9 @@
using boost::intrusive_ptr;
using boost::dynamic_pointer_cast;
+namespace qpid {
+namespace tests {
+
class Counter
{
Mutex lock;
@@ -44,7 +47,7 @@
return ++counter;
}
};
-
+
class TestTask : public TimerTask
{
const AbsTime start;
@@ -56,7 +59,7 @@
Counter& counter;
public:
- TestTask(Duration timeout, Counter& _counter)
+ TestTask(Duration timeout, Counter& _counter)
: TimerTask(timeout), start(now()), expected(timeout), end(start), fired(false), counter(_counter) {}
void fire()
@@ -106,14 +109,14 @@
intrusive_ptr<TestTask> task2(new TestTask(Duration(1 * TIME_SEC), counter));
intrusive_ptr<TestTask> task3(new TestTask(Duration(4 * TIME_SEC), counter));
intrusive_ptr<TestTask> task4(new TestTask(Duration(2 * TIME_SEC), counter));
-
+
timer.add(task1);
timer.add(task2);
timer.add(task3);
timer.add(task4);
-
+
dynamic_pointer_cast<TestTask>(task3)->wait(Duration(6 * TIME_SEC));
-
+
dynamic_pointer_cast<TestTask>(task1)->check(3);
dynamic_pointer_cast<TestTask>(task2)->check(1);
dynamic_pointer_cast<TestTask>(task3)->check(4);
@@ -121,3 +124,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/TopicExchangeTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/TopicExchangeTest.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/TopicExchangeTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/TopicExchangeTest.cpp Wed Sep 9 19:46:56 2009
@@ -6,9 +6,9 @@
* 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
@@ -22,11 +22,15 @@
using namespace qpid::broker;
using namespace std;
+
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(TopicExchangeTestSuite)
#define CHECK_NORMALIZED(expect, pattern) BOOST_CHECK_EQUAL(expect, TopicExchange::normalize(pattern));
-QPID_AUTO_TEST_CASE(testNormalize)
+QPID_AUTO_TEST_CASE(testNormalize)
{
CHECK_NORMALIZED("", "");
CHECK_NORMALIZED("a.b.c", "a.b.c");
@@ -38,8 +42,8 @@
CHECK_NORMALIZED("a.*.*.*.#", "a.*.#.*.#.*");
CHECK_NORMALIZED("*.*.*.#", "*.#.#.*.*.#");
}
-
-QPID_AUTO_TEST_CASE(testPlain)
+
+QPID_AUTO_TEST_CASE(testPlain)
{
string pattern("ab.cd.e");
BOOST_CHECK(TopicExchange::match(pattern, "ab.cd.e"));
@@ -57,7 +61,7 @@
}
-QPID_AUTO_TEST_CASE(testStar)
+QPID_AUTO_TEST_CASE(testStar)
{
string pattern("a.*.b");
BOOST_CHECK(TopicExchange::match(pattern, "a.xx.b"));
@@ -75,7 +79,7 @@
BOOST_CHECK(!TopicExchange::match(pattern, "q.x.y"));
}
-QPID_AUTO_TEST_CASE(testHash)
+QPID_AUTO_TEST_CASE(testHash)
{
string pattern("a.#.b");
BOOST_CHECK(TopicExchange::match(pattern, "a.b"));
@@ -99,7 +103,7 @@
BOOST_CHECK(TopicExchange::match(pattern, "a.x.x.b.y.y.c"));
}
-QPID_AUTO_TEST_CASE(testMixed)
+QPID_AUTO_TEST_CASE(testMixed)
{
string pattern("*.x.#.y");
BOOST_CHECK(TopicExchange::match(pattern, "a.x.y"));
@@ -119,3 +123,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/TxBufferTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/TxBufferTest.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/TxBufferTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/TxBufferTest.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -27,6 +27,9 @@
using namespace qpid::broker;
using boost::static_pointer_cast;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(TxBufferTestSuite)
QPID_AUTO_TEST_CASE(testCommitLocal)
@@ -174,3 +177,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/TxMocks.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/TxMocks.h?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/TxMocks.h (original)
+++ qpid/trunk/qpid/cpp/src/tests/TxMocks.h Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -32,6 +32,9 @@
using boost::static_pointer_cast;
using std::string;
+namespace qpid {
+namespace tests {
+
template <class T> void assertEqualVector(std::vector<T>& expected, std::vector<T>& actual){
unsigned int i = 0;
while(i < expected.size() && i < actual.size()){
@@ -62,15 +65,15 @@
string debugName;
public:
typedef boost::shared_ptr<MockTxOp> shared_ptr;
-
+
MockTxOp() : failOnPrepare(false) {}
MockTxOp(bool _failOnPrepare) : failOnPrepare(_failOnPrepare) {}
-
+
void setDebugName(string name){
debugName = name;
}
- void printExpected(){
+ void printExpected(){
std::cout << std::endl << "MockTxOp[" << debugName << "] expects: ";
for (std::vector<string>::iterator i = expected.begin(); i < expected.end(); i++) {
if(i != expected.begin()) std::cout << ", ";
@@ -79,7 +82,7 @@
std::cout << std::endl;
}
- void printActual(){
+ void printActual(){
std::cout << std::endl << "MockTxOp[" << debugName << "] actual: ";
for (std::vector<string>::iterator i = actual.begin(); i < actual.end(); i++) {
if(i != actual.begin()) std::cout << ", ";
@@ -87,7 +90,7 @@
}
std::cout << std::endl;
}
-
+
bool prepare(TransactionContext*) throw(){
actual.push_back(PREPARE);
return !failOnPrepare;
@@ -116,8 +119,8 @@
}
void accept(TxOpConstVisitor&) const {}
-
- ~MockTxOp(){}
+
+ ~MockTxOp(){}
};
class MockTransactionalStore : public TransactionalStore{
@@ -128,10 +131,10 @@
const string ABORT;
std::vector<string> expected;
std::vector<string> actual;
-
+
enum states {OPEN = 1, PREPARED = 2, COMMITTED = 3, ABORTED = 4};
int state;
-
+
class TestTransactionContext : public TPCTransactionContext{
MockTransactionalStore* store;
public:
@@ -145,29 +148,29 @@
if(!store->isOpen() && !store->isPrepared()) throw "txn already completed";
store->state = COMMITTED;
}
-
+
void abort(){
if(!store->isOpen() && !store->isPrepared()) throw "txn already completed";
store->state = ABORTED;
}
~TestTransactionContext(){}
};
-
+
public:
MockTransactionalStore() :
BEGIN("BEGIN"), BEGIN2PC("BEGIN2PC"), PREPARE("PREPARE"), COMMIT("COMMIT"), ABORT("ABORT"), state(OPEN){}
void collectPreparedXids(std::set<std::string>&)
{
- throw "Operation not supported";
+ throw "Operation not supported";
}
-
- std::auto_ptr<TPCTransactionContext> begin(const std::string&){
+
+ std::auto_ptr<TPCTransactionContext> begin(const std::string&){
actual.push_back(BEGIN2PC);
std::auto_ptr<TPCTransactionContext> txn(new TestTransactionContext(this));
return txn;
}
- std::auto_ptr<TransactionContext> begin(){
+ std::auto_ptr<TransactionContext> begin(){
actual.push_back(BEGIN);
std::auto_ptr<TransactionContext> txn(new TestTransactionContext(this));
return txn;
@@ -183,7 +186,7 @@
void abort(TransactionContext& ctxt){
actual.push_back(ABORT);
dynamic_cast<TestTransactionContext&>(ctxt).abort();
- }
+ }
MockTransactionalStore& expectBegin(){
expected.push_back(BEGIN);
return *this;
@@ -207,23 +210,25 @@
void check(){
assertEqualVector(expected, actual);
}
-
+
bool isPrepared(){
return state == PREPARED;
}
-
+
bool isCommitted(){
return state == COMMITTED;
}
-
+
bool isAborted(){
return state == ABORTED;
}
-
+
bool isOpen() const{
return state == OPEN;
}
~MockTransactionalStore(){}
};
+}} // namespace qpid::tests
+
#endif
Modified: qpid/trunk/qpid/cpp/src/tests/TxPublishTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/TxPublishTest.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/TxPublishTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/TxPublishTest.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -35,30 +35,33 @@
using namespace qpid::broker;
using namespace qpid::framing;
+namespace qpid {
+namespace tests {
+
struct TxPublishTest
{
-
+
TestMessageStore store;
Queue::shared_ptr queue1;
Queue::shared_ptr queue2;
intrusive_ptr<Message> msg;
TxPublish op;
-
+
TxPublishTest() :
- queue1(new Queue("queue1", false, &store, 0)),
- queue2(new Queue("queue2", false, &store, 0)),
+ queue1(new Queue("queue1", false, &store, 0)),
+ queue2(new Queue("queue2", false, &store, 0)),
msg(MessageUtils::createMessage("exchange", "routing_key", "id")),
op(msg)
{
msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
op.deliverTo(queue1);
op.deliverTo(queue2);
- }
+ }
};
QPID_AUTO_TEST_SUITE(TxPublishTestSuite)
-
+
QPID_AUTO_TEST_CASE(testPrepare)
{
TxPublishTest t;
@@ -88,7 +91,9 @@
BOOST_CHECK_EQUAL(t.msg, msg_dequeue);
BOOST_CHECK_EQUAL((uint32_t) 1, t.queue2->getMessageCount());
- BOOST_CHECK_EQUAL(t.msg, t.queue2->get().payload);
+ BOOST_CHECK_EQUAL(t.msg, t.queue2->get().payload);
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/Url.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/Url.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/Url.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/Url.cpp Wed Sep 9 19:46:56 2009
@@ -26,6 +26,9 @@
using namespace qpid;
using namespace boost::assign;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(UrlTestSuite)
#define URL_CHECK_STR(STR) BOOST_CHECK_EQUAL(Url(STR).str(), STR)
@@ -65,3 +68,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/Uuid.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/Uuid.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/Uuid.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/Uuid.cpp Wed Sep 9 19:46:56 2009
@@ -24,6 +24,9 @@
#include <set>
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(UuidTestSuite)
using namespace std;
@@ -77,3 +80,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/Variant.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/Variant.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/Variant.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/Variant.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -25,6 +25,9 @@
using namespace qpid::messaging;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(VariantSuite)
QPID_AUTO_TEST_CASE(testConversions)
@@ -94,11 +97,11 @@
const uint32_t i(1000);
value = i;
BOOST_CHECK_EQUAL(VAR_UINT32, value.getType());
- BOOST_CHECK_EQUAL(VAR_STRING, other.getType());
+ BOOST_CHECK_EQUAL(VAR_STRING, other.getType());
}
QPID_AUTO_TEST_CASE(testList)
-{
+{
const std::string s("abc");
const float f(9.876f);
const int16_t x(1000);
@@ -108,7 +111,7 @@
value.asList().push_back(Variant(f));
value.asList().push_back(Variant(x));
BOOST_CHECK_EQUAL(3u, value.asList().size());
- Variant::List::const_iterator i = value.asList().begin();
+ Variant::List::const_iterator i = value.asList().begin();
BOOST_CHECK(i != value.asList().end());
BOOST_CHECK_EQUAL(VAR_STRING, i->getType());
@@ -129,7 +132,7 @@
}
QPID_AUTO_TEST_CASE(testMap)
-{
+{
const std::string red("red");
const float pi(3.14f);
const int16_t x(1000);
@@ -145,7 +148,7 @@
BOOST_CHECK_EQUAL(VAR_FLOAT, value.asMap()["pi"].getType());
BOOST_CHECK_EQUAL(pi, value.asMap()["pi"].asFloat());
-
+
BOOST_CHECK_EQUAL(VAR_INT16, value.asMap()["my-key"].getType());
BOOST_CHECK_EQUAL(x, value.asMap()["my-key"].asInt16());
@@ -153,5 +156,7 @@
BOOST_CHECK_EQUAL(VAR_STRING, value.asMap()["my-key"].getType());
BOOST_CHECK_EQUAL(std::string("now it's a string"), value.asMap()["my-key"].asString());
}
-
+
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/XmlClientSessionTest.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -52,6 +52,9 @@
using std::cout;
using std::endl;
+namespace qpid {
+namespace tests {
+
#if defined (QPID_MODULE_SUFFIX)
Shlib shlib("../xml" QPID_MODULE_SUFFIX);
#else
@@ -118,10 +121,10 @@
FieldTable binding;
binding.setString("xquery", "declare variable $color external;"
"(./message/id mod 2 = 1) and ($color = 'blue')");
- f.session.exchangeBind(qpid::client::arg::exchange="xml", qpid::client::arg::queue="odd_blue", qpid::client::arg::bindingKey="query_name", qpid::client::arg::arguments=binding);
+ f.session.exchangeBind(qpid::client::arg::exchange="xml", qpid::client::arg::queue="odd_blue", qpid::client::arg::bindingKey="query_name", qpid::client::arg::arguments=binding);
Message message;
- message.getDeliveryProperties().setRoutingKey("query_name");
+ message.getDeliveryProperties().setRoutingKey("query_name");
message.getHeaders().setString("color", "blue");
string m = "<message><id>1</id></message>";
@@ -130,7 +133,7 @@
f.session.messageTransfer(qpid::client::arg::content=message, qpid::client::arg::destination="xml");
Message m2 = localQueue.get();
- BOOST_CHECK_EQUAL(m, m2.getData());
+ BOOST_CHECK_EQUAL(m, m2.getData());
}
/**
@@ -146,10 +149,10 @@
FieldTable blue;
blue.setString("xquery", "./colour = 'blue'");
- f.session.exchangeBind(arg::exchange="xml", arg::queue="blue", arg::bindingKey="by-colour", arg::arguments=blue);
+ f.session.exchangeBind(arg::exchange="xml", arg::queue="blue", arg::bindingKey="by-colour", arg::arguments=blue);
FieldTable red;
red.setString("xquery", "./colour = 'red'");
- f.session.exchangeBind(arg::exchange="xml", arg::queue="red", arg::bindingKey="by-colour", arg::arguments=red);
+ f.session.exchangeBind(arg::exchange="xml", arg::queue="red", arg::bindingKey="by-colour", arg::arguments=red);
Message sent1("<colour>blue</colour>", "by-colour");
f.session.messageTransfer(arg::content=sent1, arg::destination="xml");
@@ -223,3 +226,4 @@
QPID_AUTO_TEST_SUITE_END()
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/client_test.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/client_test.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/client_test.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/client_test.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -40,13 +40,16 @@
using namespace qpid::framing;
using std::string;
+namespace qpid {
+namespace tests {
+
struct Args : public TestOptions {
uint msgSize;
bool verbose;
Args() : TestOptions("Simple test of Qpid c++ client; sends and receives a single message."), msgSize(26)
{
- addOptions()
+ addOptions()
("size", optValue(msgSize, "N"), "message size")
("verbose", optValue(verbose), "print out some status messages");
}
@@ -58,7 +61,7 @@
{
if (size < chars.length()) {
return chars.substr(0, size);
- }
+ }
std::string data;
for (uint i = 0; i < (size / chars.length()); i++) {
data += chars;
@@ -78,6 +81,10 @@
std::cout << std::endl;
}
+}} // namespace qpid::tests
+
+using namespace qpid::tests;
+
int main(int argc, char** argv)
{
try {
@@ -92,7 +99,7 @@
//Create and open a session on the connection through which
//most functionality is exposed:
Session session = connection.newSession();
- if (opts.verbose) std::cout << "Opened session." << std::endl;
+ if (opts.verbose) std::cout << "Opened session." << std::endl;
//'declare' the exchange and the queue, which will create them
@@ -116,13 +123,13 @@
// Using the SubscriptionManager, get the message from the queue.
SubscriptionManager subs(session);
Message msgIn = subs.get("MyQueue");
- if (msgIn.getData() == msgOut.getData())
+ if (msgIn.getData() == msgOut.getData())
if (opts.verbose) std::cout << "Received the exepected message." << std::endl;
//close the session & connection
session.close();
if (opts.verbose) std::cout << "Closed session." << std::endl;
- connection.close();
+ connection.close();
if (opts.verbose) std::cout << "Closed connection." << std::endl;
return 0;
} catch(const std::exception& e) {
Modified: qpid/trunk/qpid/cpp/src/tests/cluster_test.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/cluster_test.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/cluster_test.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/cluster_test.cpp Wed Sep 9 19:46:56 2009
@@ -59,8 +59,6 @@
ostream& operator<<(ostream& o, const std::set<T>& s) { return seqPrint(o, s); }
}
-QPID_AUTO_TEST_SUITE(cluster_test)
-
using namespace std;
using namespace qpid;
using namespace qpid::cluster;
@@ -70,6 +68,11 @@
using broker::Broker;
using boost::shared_ptr;
+namespace qpid {
+namespace tests {
+
+QPID_AUTO_TEST_SUITE(cluster_test)
+
bool durableFlag = std::getenv("STORE_LIB") != 0;
void prepareArgs(ClusterFixture::Args& args, const bool durableFlag = false) {
@@ -1098,3 +1101,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/trunk/qpid/cpp/src/tests/consume.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/consume.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/consume.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/consume.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -36,6 +36,9 @@
using namespace qpid::sys;
using namespace std;
+namespace qpid {
+namespace tests {
+
typedef vector<string> StringSet;
struct Args : public qpid::TestOptions {
@@ -46,7 +49,7 @@
bool summary;
bool print;
bool durable;
-
+
Args() : count(1000), ack(0), queue("publish-consume"),
declare(false), summary(false), print(false)
{
@@ -63,12 +66,12 @@
Args opts;
-struct Client
+struct Client
{
Connection connection;
Session session;
- Client()
+ Client()
{
opts.open(connection);
session = connection.newSession();
@@ -85,7 +88,7 @@
settings.flowControl = FlowControl(opts.count, SubscriptionManager::UNLIMITED,false);
Subscription sub = subs.subscribe(lq, opts.queue, settings);
Message msg;
- AbsTime begin=now();
+ AbsTime begin=now();
for (size_t i = 0; i < opts.count; ++i) {
msg=lq.pop();
QPID_LOG(info, "Received: " << msg.getMessageProperties().getCorrelationId());
@@ -99,7 +102,7 @@
else cout << "Time: " << secs << "s Rate: " << opts.count/secs << endl;
}
- ~Client()
+ ~Client()
{
try{
session.close();
@@ -110,6 +113,10 @@
}
};
+}} // namespace qpid::tests
+
+using namespace qpid::tests;
+
int main(int argc, char** argv)
{
try {
Modified: qpid/trunk/qpid/cpp/src/tests/datagen.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/datagen.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/datagen.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/datagen.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -25,7 +25,10 @@
#include <time.h>
#include "qpid/Options.h"
-struct Args : public qpid::Options
+namespace qpid {
+namespace tests {
+
+struct Args : public qpid::Options
{
uint count;
uint minSize;
@@ -34,12 +37,12 @@
uint maxChar;
bool help;
- Args() : qpid::Options("Random data generator"),
- count(1), minSize(8), maxSize(4096),
+ Args() : qpid::Options("Random data generator"),
+ count(1), minSize(8), maxSize(4096),
minChar(32), maxChar(126),//safely printable ascii chars
help(false)
{
- addOptions()
+ addOptions()
("count", qpid::optValue(count, "N"), "number of data strings to generate")
("min-size", qpid::optValue(minSize, "N"), "minimum size of data string")
("max-size", qpid::optValue(maxSize, "N"), "maximum size of data string")
@@ -81,6 +84,10 @@
return data;
}
+}} // namespace qpid::tests
+
+using namespace qpid::tests;
+
int main(int argc, char** argv)
{
Args opts;
Modified: qpid/trunk/qpid/cpp/src/tests/echotest.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/echotest.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/echotest.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/echotest.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -33,6 +33,9 @@
using namespace qpid::sys;
using namespace std;
+namespace qpid {
+namespace tests {
+
struct Args : public qpid::Options,
public qpid::client::ConnectionSettings
{
@@ -48,7 +51,7 @@
("help", optValue(help), "Print this usage statement")
("count", optValue(count, "N"), "Number of messages to send")
("size", optValue(count, "N"), "Size of messages")
- ("broker,b", optValue(host, "HOST"), "Broker host to connect to")
+ ("broker,b", optValue(host, "HOST"), "Broker host to connect to")
("port,p", optValue(port, "PORT"), "Broker port to connect to")
("username", optValue(username, "USER"), "user name for broker log in.")
("password", optValue(password, "PASSWORD"), "password for broker log in.")
@@ -75,7 +78,7 @@
Message request;
double total, min, max;
bool summary;
-
+
public:
Listener(Session& session, uint limit, bool summary);
void start(uint size);
@@ -92,7 +95,7 @@
{
session.queueDeclare(arg::queue=queue, arg::exclusive=true, arg::autoDelete=true);
request.getDeliveryProperties().setRoutingKey(queue);
- subscriptions.subscribe(*this, queue, SubscriptionSettings(FlowControl::unlimited(), ACCEPT_MODE_NONE));
+ subscriptions.subscribe(*this, queue, SubscriptionSettings(FlowControl::unlimited(), ACCEPT_MODE_NONE));
request.getDeliveryProperties().setTimestamp(current_time());
if (size) request.setData(std::string(size, 'X'));
@@ -100,7 +103,7 @@
subscriptions.run();
}
-void Listener::received(Message& response)
+void Listener::received(Message& response)
{
//extract timestamp and compute latency:
uint64_t sentAt = response.getDeliveryProperties().getTimestamp();
@@ -122,7 +125,11 @@
}
}
-int main(int argc, char** argv)
+}} // namespace qpid::tests
+
+using namespace qpid::tests;
+
+int main(int argc, char** argv)
{
Args opts;
opts.parse(argc, argv);
Modified: qpid/trunk/qpid/cpp/src/tests/exception_test.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/exception_test.cpp?rev=813094&r1=813093&r2=813094&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/exception_test.cpp (original)
+++ qpid/trunk/qpid/cpp/src/tests/exception_test.cpp Wed Sep 9 19:46:56 2009
@@ -7,9 +7,9 @@
* 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
@@ -28,6 +28,9 @@
#include "qpid/sys/Thread.h"
#include "qpid/framing/reply_exceptions.h"
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(exception_test)
// FIXME aconway 2008-06-12: need to update our exception handling to
@@ -49,12 +52,12 @@
function<void ()> f;
bool caught;
Thread thread;
-
+
Catcher(function<void ()> f_) : f(f_), caught(false), thread(this) {}
~Catcher() { join(); }
-
+
void run() {
- try {
+ try {
ScopedSuppressLogging sl; // Suppress messages for expected errors.
f();
}
@@ -110,7 +113,7 @@
Catcher<TransportFailure> runner(bind(&SubscriptionManager::run, boost::ref(fix.subs)));
fix.connection.proxy.close();
runner.join();
- BOOST_CHECK_THROW(fix.session.close(), TransportFailure);
+ BOOST_CHECK_THROW(fix.session.close(), TransportFailure);
}
QPID_AUTO_TEST_CASE(NoSuchQueueTest) {
@@ -120,3 +123,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org