You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ai...@apache.org on 2009/09/17 18:21:21 UTC
svn commit: r816261 [3/8] - in /qpid/branches/java-network-refactor: ./
qpid/cpp/bindings/qmf/python/ qpid/cpp/bindings/qmf/ruby/
qpid/cpp/bindings/qmf/tests/ qpid/cpp/include/qpid/messaging/ qpid/cpp/src/
qpid/cpp/src/qmf/ qpid/cpp/src/qpid/acl/ qpid/...
Propchange: qpid/branches/java-network-refactor/qpid/cpp/src/qpid/management/ManagementAgent.cpp
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 17 16:21:13 2009
@@ -1,2 +1,2 @@
-/incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp:520691-726139
-/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp:805429-812920
+/incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp:443187-726139
+/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.cpp:805429-816233
Propchange: qpid/branches/java-network-refactor/qpid/cpp/src/qpid/management/ManagementAgent.h
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Sep 17 16:21:13 2009
@@ -1,2 +1,2 @@
-/incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.h:520691-726139
-/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.h:805429-812920
+/incubator/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.h:443187-726139
+/qpid/trunk/qpid/cpp/src/qpid/management/ManagementAgent.h:805429-816233
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Address.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Address.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Address.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Address.cpp Thu Sep 17 16:21:13 2009
@@ -21,9 +21,6 @@
#include "qpid/messaging/Address.h"
namespace qpid {
-namespace client {
-}
-
namespace messaging {
Address::Address() {}
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Receiver.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Receiver.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Receiver.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Receiver.cpp Thu Sep 17 16:21:13 2009
@@ -45,6 +45,9 @@
void Receiver::start() { impl->start(); }
void Receiver::stop() { impl->stop(); }
void Receiver::setCapacity(uint32_t c) { impl->setCapacity(c); }
+uint32_t Receiver::getCapacity() { return impl->getCapacity(); }
+uint32_t Receiver::available() { return impl->available(); }
+uint32_t Receiver::pendingAck() { return impl->pendingAck(); }
void Receiver::cancel() { impl->cancel(); }
void Receiver::setListener(MessageListener* listener) { impl->setListener(listener); }
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/ReceiverImpl.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/ReceiverImpl.h?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/ReceiverImpl.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/ReceiverImpl.h Thu Sep 17 16:21:13 2009
@@ -44,6 +44,9 @@
virtual void start() = 0;
virtual void stop() = 0;
virtual void setCapacity(uint32_t) = 0;
+ virtual uint32_t getCapacity() = 0;
+ virtual uint32_t available() = 0;
+ virtual uint32_t pendingAck() = 0;
virtual void cancel() = 0;
virtual void setListener(MessageListener*) = 0;
};
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Sender.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Sender.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Sender.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Sender.cpp Thu Sep 17 16:21:13 2009
@@ -40,5 +40,8 @@
Sender& Sender::operator=(const Sender& s) { return PI::assign(*this, s); }
void Sender::send(const Message& message) { impl->send(message); }
void Sender::cancel() { impl->cancel(); }
+void Sender::setCapacity(uint32_t c) { impl->setCapacity(c); }
+uint32_t Sender::getCapacity() { return impl->getCapacity(); }
+uint32_t Sender::pending() { return impl->pending(); }
}} // namespace qpid::messaging
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/SenderImpl.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/SenderImpl.h?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/SenderImpl.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/SenderImpl.h Thu Sep 17 16:21:13 2009
@@ -37,6 +37,9 @@
virtual ~SenderImpl() {}
virtual void send(const Message& message) = 0;
virtual void cancel() = 0;
+ virtual void setCapacity(uint32_t) = 0;
+ virtual uint32_t getCapacity() = 0;
+ virtual uint32_t pending() = 0;
private:
};
}} // namespace qpid::messaging
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Session.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Session.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Session.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/Session.cpp Thu Sep 17 16:21:13 2009
@@ -103,15 +103,7 @@
{
return impl->dispatch(timeout);
}
-
-void* Session::getLastConfirmedSent()
-{
- return impl->getLastConfirmedSent();
-}
-
-void* Session::getLastConfirmedAcknowledged()
-{
- return impl->getLastConfirmedAcknowledged();
-}
+uint32_t Session::available() { return impl->available(); }
+uint32_t Session::pendingAck() { return impl->pendingAck(); }
}} // namespace qpid::messaging
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/SessionImpl.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/SessionImpl.h?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/SessionImpl.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qpid/messaging/SessionImpl.h Thu Sep 17 16:21:13 2009
@@ -56,8 +56,8 @@
virtual Sender createSender(const Address& address, const VariantMap& options) = 0;
virtual Receiver createReceiver(const Address& address, const VariantMap& options) = 0;
virtual Receiver createReceiver(const Address& address, const Filter& filter, const VariantMap& options) = 0;
- virtual void* getLastConfirmedSent() = 0;
- virtual void* getLastConfirmedAcknowledged() = 0;
+ virtual uint32_t available() = 0;
+ virtual uint32_t pendingAck() = 0;
private:
};
}} // namespace qpid::messaging
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qpid/sys/rdma/RdmaClient.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qpid/sys/rdma/RdmaClient.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qpid/sys/rdma/RdmaClient.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qpid/sys/rdma/RdmaClient.cpp Thu Sep 17 16:21:13 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
@@ -45,6 +45,9 @@
using qpid::sys::TIME_SEC;
using qpid::sys::TIME_INFINITE;
+namespace qpid {
+namespace tests {
+
// count of messages
int64_t smsgs = 0;
int64_t sbytes = 0;
@@ -144,6 +147,10 @@
p->shutdown();
}
+}} // namespace qpid::tests
+
+using namespace qpid::tests;
+
int main(int argc, char* argv[]) {
vector<string> args(&argv[0], &argv[argc]);
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qpid/sys/rdma/RdmaServer.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qpid/sys/rdma/RdmaServer.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qpid/sys/rdma/RdmaServer.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qpid/sys/rdma/RdmaServer.cpp Thu Sep 17 16:21:13 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,6 +39,9 @@
using qpid::sys::Dispatcher;
// All the accepted connections
+namespace qpid {
+namespace tests {
+
struct ConRec {
Rdma::Connection::intrusive_ptr connection;
Rdma::AsynchIO* data;
@@ -134,6 +137,10 @@
cr->data->start(poller);
}
+}} // namespace qpid::tests
+
+using namespace qpid::tests;
+
int main(int argc, char* argv[]) {
vector<string> args(&argv[0], &argv[argc]);
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/qpid/xml/XmlExchange.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/qpid/xml/XmlExchange.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/qpid/xml/XmlExchange.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/qpid/xml/XmlExchange.cpp Thu Sep 17 16:21:13 2009
@@ -156,7 +156,7 @@
// This will parse the document using either Xerces or FastXDM, depending
// on your XQilla configuration. FastXDM can be as much as 10x faster.
-
+
Sequence seq(context->parseDocument(xml));
if(!seq.isEmpty() && seq.first()->isNode()) {
@@ -206,11 +206,11 @@
PreRoute pr(msg, this);
try {
XmlBinding::vector::ConstPtr p;
- {
+ {
RWlock::ScopedRlock l(lock);
- p = bindingsMap[routingKey].snapshot();
- if (!p) return;
- }
+ p = bindingsMap[routingKey].snapshot();
+ if (!p) return;
+ }
int count(0);
for (std::vector<XmlBinding::shared_ptr>::const_iterator i = p->begin(); i != p->end(); i++) {
@@ -222,24 +222,24 @@
if ((*i)->mgmtBinding != 0)
(*i)->mgmtBinding->inc_msgMatched ();
}
- }
- if (!count) {
- QPID_LOG(warning, "XMLExchange " << getName() << ": could not route message with query " << routingKey);
- if (mgmtExchange != 0) {
- mgmtExchange->inc_msgDrops ();
- mgmtExchange->inc_byteDrops (msg.contentSize ());
- }
- } else {
- if (mgmtExchange != 0) {
- mgmtExchange->inc_msgRoutes (count);
- mgmtExchange->inc_byteRoutes (count * msg.contentSize ());
- }
- }
-
- if (mgmtExchange != 0) {
- mgmtExchange->inc_msgReceives ();
- mgmtExchange->inc_byteReceives (msg.contentSize ());
- }
+ }
+ if (!count) {
+ QPID_LOG(warning, "XMLExchange " << getName() << ": could not route message with query " << routingKey);
+ if (mgmtExchange != 0) {
+ mgmtExchange->inc_msgDrops ();
+ mgmtExchange->inc_byteDrops (msg.contentSize ());
+ }
+ } else {
+ if (mgmtExchange != 0) {
+ mgmtExchange->inc_msgRoutes (count);
+ mgmtExchange->inc_byteRoutes (count * msg.contentSize ());
+ }
+ }
+
+ if (mgmtExchange != 0) {
+ mgmtExchange->inc_msgReceives ();
+ mgmtExchange->inc_byteReceives (msg.contentSize ());
+ }
} catch (...) {
QPID_LOG(warning, "XMLExchange " << getName() << ": exception routing message with query " << routingKey);
}
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/AccumulatedAckTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/AccumulatedAckTest.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/AccumulatedAckTest.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/AccumulatedAckTest.cpp Thu Sep 17 16:21:13 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
@@ -28,6 +28,9 @@
using namespace qpid::framing;
+namespace qpid {
+namespace tests {
+
bool covers(const AccumulatedAck& ack, int i)
{
return ack.covers(SequenceNumber(i));
@@ -97,7 +100,7 @@
ack.update(mark, ranges);
- for(int i = 0; i <= 15; i++) {
+ for(int i = 0; i <= 15; i++) {
BOOST_CHECK(covers(ack, i));
}
BOOST_CHECK(!covers(ack, 16));
@@ -221,7 +224,7 @@
ack.update(SequenceNumber(9), SequenceNumber(9));
ack.update(SequenceNumber(3), SequenceNumber(4));
- for(int i = 0; i <= 15; i++) {
+ for(int i = 0; i <= 15; i++) {
BOOST_CHECK(covers(ack, i));
}
BOOST_CHECK(!covers(ack, 16));
@@ -230,3 +233,5 @@
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/Array.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/Array.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/Array.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/Array.cpp Thu Sep 17 16:21:13 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 @@
#include "unit_test.h"
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(ArrayTestSuite)
using namespace qpid::framing;
@@ -69,7 +72,7 @@
Array a(data);
b = a;
BOOST_CHECK_EQUAL(a, b);
- }
+ }
std::vector<std::string> data2;
b.collect(data2);
//BOOST_CHECK_EQUAL(data, data2);
@@ -77,3 +80,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/AsyncCompletion.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/AsyncCompletion.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/AsyncCompletion.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/AsyncCompletion.cpp Thu Sep 17 16:21:13 2009
@@ -49,10 +49,13 @@
* message enqueues at the correct time.
*/
+namespace qpid {
+namespace tests {
+
class AsyncCompletionMessageStore : public NullMessageStore {
public:
sys::BlockingQueue<boost::intrusive_ptr<PersistableMessage> > enqueued;
-
+
AsyncCompletionMessageStore() : NullMessageStore() {}
~AsyncCompletionMessageStore(){}
@@ -82,10 +85,10 @@
transfers[i] = s.messageTransfer(arg::content=msg);
}
- // Get hold of the broker-side messages.
+ // Get hold of the broker-side messages.
typedef vector<intrusive_ptr<PersistableMessage> > BrokerMessages;
BrokerMessages enqueued;
- for (int j = 0; j < count; ++j)
+ for (int j = 0; j < count; ++j)
enqueued.push_back(store->enqueued.pop(TIME_SEC));
// Send a sync, make sure it does not complete till all messages are complete.
@@ -111,3 +114,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/AtomicValue.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/AtomicValue.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/AtomicValue.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/AtomicValue.cpp Thu Sep 17 16:21:13 2009
@@ -21,6 +21,9 @@
#include "test_tools.h"
#include "qpid/sys/AtomicValue.h"
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(AtomicValueTestSuite)
QPID_AUTO_TEST_CASE(test) {
@@ -47,3 +50,5 @@
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/BrokerFixture.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/BrokerFixture.h?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/BrokerFixture.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/BrokerFixture.h Thu Sep 17 16:21:13 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
@@ -35,6 +35,9 @@
#include "qpid/sys/Thread.h"
#include <boost/noncopyable.hpp>
+namespace qpid {
+namespace tests {
+
/**
* A fixture with an in-process broker.
*/
@@ -55,7 +58,7 @@
}
opts.port=0;
// Management doesn't play well with multiple in-process brokers.
- opts.enableMgmt=false;
+ opts.enableMgmt=false;
opts.workerThreads=1;
opts.dataDir="";
opts.auth=false;
@@ -144,5 +147,6 @@
typedef SessionFixtureT<LocalConnection> SessionFixture;
typedef SessionFixtureT<ProxyConnection> ProxySessionFixture;
+}} // namespace qpid::tests
#endif /*!TESTS_BROKERFIXTURE_H*/
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClientMessageTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClientMessageTest.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClientMessageTest.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClientMessageTest.cpp Thu Sep 17 16:21:13 2009
@@ -24,6 +24,9 @@
using namespace qpid::client;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(ClientMessageTestSuite)
QPID_AUTO_TEST_CASE(MessageCopyAssign) {
@@ -33,7 +36,7 @@
Message c(m);
BOOST_CHECK_EQUAL("foo", c.getData());
Message a;
- BOOST_CHECK_EQUAL("", a.getData());
+ BOOST_CHECK_EQUAL("", a.getData());
a = m;
BOOST_CHECK_EQUAL("foo", a.getData());
a.setData("a");
@@ -44,3 +47,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClientSessionTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClientSessionTest.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClientSessionTest.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClientSessionTest.cpp Thu Sep 17 16:21:13 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,6 +40,9 @@
#include <vector>
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(ClientSessionTest)
using namespace qpid::client;
@@ -122,12 +125,12 @@
ClientSessionFixture fix;
fix.session =fix.connection.newSession();
size_t count = 100;
- for (size_t i = 0; i < count; ++i)
+ for (size_t i = 0; i < count; ++i)
fix.session.messageTransfer(arg::content=Message(boost::lexical_cast<string>(i), "my-queue"));
DummyListener listener(fix.session, "my-queue", count);
listener.run();
- BOOST_CHECK_EQUAL(count, listener.messages.size());
- for (size_t i = 0; i < count; ++i)
+ BOOST_CHECK_EQUAL(count, listener.messages.size());
+ for (size_t i = 0; i < count; ++i)
BOOST_CHECK_EQUAL(boost::lexical_cast<string>(i), listener.messages[i].getData());
}
@@ -142,8 +145,8 @@
fix.session.messageTransfer(arg::content=Message(boost::lexical_cast<string>(i), "my-queue"));
}
t.join();
- BOOST_CHECK_EQUAL(count, listener.messages.size());
- for (size_t i = 0; i < count; ++i)
+ BOOST_CHECK_EQUAL(count, listener.messages.size());
+ for (size_t i = 0; i < count; ++i)
BOOST_CHECK_EQUAL(boost::lexical_cast<string>(i), listener.messages[i].getData());
}
@@ -215,7 +218,7 @@
BOOST_CHECK_EQUAL("foo1", lq.pop().getData());
BOOST_CHECK(lq.empty()); // Credit exhausted.
fix.subs.getSubscription("lq").setFlowControl(FlowControl::unlimited());
- BOOST_CHECK_EQUAL("foo2", lq.pop().getData());
+ BOOST_CHECK_EQUAL("foo2", lq.pop().getData());
}
struct DelayedTransfer : sys::Runnable
@@ -246,7 +249,7 @@
Thread t(sender);
//test timed get where message shows up after a short delay
BOOST_CHECK(fix.subs.get(got, "getq", 5*TIME_SEC));
- BOOST_CHECK_EQUAL("foo2", got.getData());
+ BOOST_CHECK_EQUAL("foo2", got.getData());
t.join();
}
@@ -271,8 +274,8 @@
ClientSessionFixture fix(opts);
fix.session.queueDeclare(arg::queue="my-queue", arg::exclusive=true, arg::autoDelete=true);
- for (uint i = 0; i < 10; i++) {
- Message m((boost::format("Message_%1%") % (i+1)).str(), "my-queue");
+ for (uint i = 0; i < 10; i++) {
+ Message m((boost::format("Message_%1%") % (i+1)).str(), "my-queue");
if (i % 2) m.getDeliveryProperties().setTtl(500);
fix.session.messageTransfer(arg::content=m);
}
@@ -286,15 +289,15 @@
ClientSessionFixture fix;
fix.session.queueDeclare(arg::queue="my-queue", arg::exclusive=true, arg::autoDelete=true);
- for (uint i = 0; i < 10; i++) {
- Message m((boost::format("Message_%1%") % (i+1)).str(), "my-queue");
+ for (uint i = 0; i < 10; i++) {
+ Message m((boost::format("Message_%1%") % (i+1)).str(), "my-queue");
if (i % 2) m.getDeliveryProperties().setTtl(200);
fix.session.messageTransfer(arg::content=m);
}
qpid::sys::usleep(300* 1000);
- for (uint i = 0; i < 10; i++) {
+ for (uint i = 0; i < 10; i++) {
if (i % 2) continue;
Message m;
BOOST_CHECK(fix.subs.get(m, "my-queue", TIME_SEC));
@@ -306,8 +309,8 @@
ClientSessionFixture fix;
const uint count=10;
- for (uint i = 0; i < count; i++) {
- Message m((boost::format("Message_%1%") % (i+1)).str(), "my-queue");
+ for (uint i = 0; i < count; i++) {
+ Message m((boost::format("Message_%1%") % (i+1)).str(), "my-queue");
fix.session.messageTransfer(arg::content=m);
}
@@ -334,7 +337,7 @@
for (uint i = 0; i < count; i++) {
BOOST_CHECK_EQUAL((boost::format("Message_%1%") % (i+1)).str(), l2.messages[i].getData());
}
-
+
fix.subs.stop();
fix.subs.wait();
fix.session.close();
@@ -344,8 +347,8 @@
ClientSessionFixture fix;
const uint count = 8;
const uint chunk = 4;
- for (uint i = 0; i < count; i++) {
- Message m((boost::format("Message_%1%") % (i+1)).str(), "my-queue");
+ for (uint i = 0; i < count; i++) {
+ Message m((boost::format("Message_%1%") % (i+1)).str(), "my-queue");
fix.session.messageTransfer(arg::content=m);
}
@@ -358,25 +361,25 @@
Subscription s = fix.subs.subscribe(q, "my-queue", settings);
fix.session.messageFlush(arg::destination=s.getName());
SequenceSet accepted;
- for (uint i = 0; i < chunk; i++) {
+ for (uint i = 0; i < chunk; i++) {
Message m;
BOOST_CHECK(q.get(m));
BOOST_CHECK_EQUAL((boost::format("Message_%1%") % (i+1)).str(), m.getData());
accepted.add(m.getId());
- }
+ }
Message m;
BOOST_CHECK(!q.get(m));
-
+
s.accept(accepted);
fix.session.messageFlush(arg::destination=s.getName());
accepted.clear();
-
- for (uint i = chunk; i < count; i++) {
+
+ for (uint i = chunk; i < count; i++) {
Message m;
BOOST_CHECK(q.get(m));
BOOST_CHECK_EQUAL((boost::format("Message_%1%") % (i+1)).str(), m.getData());
accepted.add(m.getId());
- }
+ }
fix.session.messageAccept(accepted);
}
@@ -424,7 +427,7 @@
connection.open(settings);
AsyncSession session = connection.newSession();
Message message(string(512, 'X'));
-
+
boost::ptr_vector<Publisher> publishers;
for (size_t i = 0; i < 5; i++) {
publishers.push_back(new Publisher(connection, message, 100));
@@ -447,7 +450,7 @@
ScopedSuppressLogging sl;
BOOST_CHECK_THROW(fix.subs.subscribe(q, "myq", "second"), ResourceLockedException);
;
-
+
}
QPID_AUTO_TEST_CASE(testExclusiveBinding) {
@@ -478,7 +481,7 @@
fix.subs.subscribe(p, "some-queue");
fix.subs.cancel("some-queue");
fix.subs.subscribe(q, "some-queue");
-
+
fix.session.messageTransfer(arg::content=Message("some-data", "some-queue"));
fix.session.messageFlush(arg::destination="some-queue");
@@ -542,10 +545,10 @@
std::ostringstream data;
size_t size = 100 - ((i % 10) * 10);
data << std::string(size, 'x');
-
+
Message m(data.str(), queue);
m.getHeaders().setString(key, "abc");
- fix.session.messageTransfer(arg::content=m);
+ fix.session.messageTransfer(arg::content=m);
}
}
@@ -594,7 +597,7 @@
ClientSessionFixture fix;
fix.session.queueDeclare(arg::queue="my-queue", arg::exclusive=true, arg::autoDelete=true);
- Message m("my-message", "my-queue");
+ Message m("my-message", "my-queue");
m.getDeliveryProperties().setTtl(60000);
m.getDeliveryProperties().setExpiration(12345);
fix.session.messageTransfer(arg::content=m);
@@ -606,4 +609,4 @@
QPID_AUTO_TEST_SUITE_END()
-
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClusterFailover.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClusterFailover.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClusterFailover.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClusterFailover.cpp Thu Sep 17 16:21:13 2009
@@ -32,6 +32,9 @@
#include <boost/algorithm/string.hpp>
#include <boost/bind.hpp>
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(ClusterFailoverTestSuite)
using namespace std;
@@ -60,3 +63,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClusterFixture.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClusterFixture.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClusterFixture.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClusterFixture.cpp Thu Sep 17 16:21:13 2009
@@ -61,6 +61,9 @@
#include "ClusterFixture.h"
+namespace qpid {
+namespace tests {
+
ClusterFixture::ClusterFixture(size_t n, const Args& args_, int localIndex_)
: name(Uuid(true).str()), localIndex(localIndex_), userArgs(args_)
{
@@ -152,3 +155,5 @@
s.insert((*i)[0].get<qpid::TcpAddress>()->port);
return s;
}
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClusterFixture.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClusterFixture.h?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClusterFixture.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/ClusterFixture.h Thu Sep 17 16:21:13 2009
@@ -60,6 +60,9 @@
using boost::shared_ptr;
using qpid::cluster::Cluster;
+namespace qpid {
+namespace tests {
+
/** Cluster fixture is a vector of ports for the replicas.
*
* At most one replica (by default replica 0) is in the current
@@ -107,4 +110,6 @@
*/
std::set<int> knownBrokerPorts(qpid::client::Connection& source, int n=-1);
+}} // namespace qpid::tests
+
#endif /*!CLUSTER_FIXTURE_H*/
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/ConnectionOptions.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/ConnectionOptions.h?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/ConnectionOptions.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/ConnectionOptions.h Thu Sep 17 16:21:13 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
@@ -25,6 +25,8 @@
#include "qpid/client/ConnectionSettings.h"
#include "qpid/Options.h"
+namespace qpid {
+
/**
* Options parser for ConnectionOptions.
*/
@@ -35,9 +37,9 @@
{
using namespace qpid;
addOptions()
- ("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")
- ("protocol,P", optValue(protocol, "tcp|rdma"), "Protocol to use for broker connection")
+ ("protocol,P", optValue(protocol, "tcp|rdma"), "Protocol to use for broker connection")
("virtualhost,v", optValue(virtualhost, "VHOST"), "virtual host")
("username", optValue(username, "USER"), "user name for broker log in.")
("password", optValue(password, "PASSWORD"), "password for broker log in.")
@@ -46,7 +48,7 @@
("max-channels", optValue(maxChannels, "N"), "the maximum number of channels the client requires.")
("heartbeat", optValue(heartbeat, "N"), "Desired heartbeat interval in seconds.")
("max-frame-size", optValue(maxFrameSize, "N"), "the maximum frame size to request.")
- ("bounds-multiplier", optValue(bounds, "N"),
+ ("bounds-multiplier", optValue(bounds, "N"),
"bound size of write queue (as a multiple of the max frame size).")
("tcp-nodelay", optValue(tcpNoDelay), "Turn on tcp-nodelay")
("service", optValue(service, "SERVICE-NAME"), "SASL service name.")
@@ -55,4 +57,6 @@
}
};
+} // namespace qpid
+
#endif /*!QPID_CLIENT_CONNECTIONOPTIONS_H*/
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/ConsoleTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/ConsoleTest.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/ConsoleTest.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/ConsoleTest.cpp Thu Sep 17 16:21:13 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
@@ -23,6 +23,9 @@
#include "qpid/console/ClassKey.h"
#include "unit_test.h"
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(ConsoleTestSuite)
using namespace qpid::framing;
@@ -40,4 +43,4 @@
QPID_AUTO_TEST_SUITE_END()
-
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/DeliveryRecordTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/DeliveryRecordTest.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/DeliveryRecordTest.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/DeliveryRecordTest.cpp Thu Sep 17 16:21:13 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
@@ -31,6 +31,9 @@
using boost::dynamic_pointer_cast;
using std::list;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(DeliveryRecordTestSuite)
QPID_AUTO_TEST_CASE(testSort)
@@ -60,3 +63,4 @@
QPID_AUTO_TEST_SUITE_END()
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/DispatcherTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/DispatcherTest.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/DispatcherTest.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/DispatcherTest.cpp Thu Sep 17 16:21:13 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,6 +39,9 @@
using namespace std;
using namespace qpid::sys;
+namespace qpid {
+namespace tests {
+
int writeALot(int fd, const string& s) {
int bytesWritten = 0;
do {
@@ -46,7 +49,7 @@
int lastWrite = ::write(fd, s.c_str(), s.size());
if ( lastWrite >= 0) {
bytesWritten += lastWrite;
- }
+ }
} while (errno != EAGAIN);
return bytesWritten;
}
@@ -54,13 +57,13 @@
int readALot(int fd) {
int bytesRead = 0;
char buf[10240];
-
+
do {
errno = 0;
int lastRead = ::read(fd, buf, sizeof(buf));
if ( lastRead >= 0) {
bytesRead += lastRead;
- }
+ }
} while (errno != EAGAIN);
return bytesRead;
}
@@ -83,7 +86,7 @@
}
void wInterrupt(DispatchHandle&) {
- cerr << "W";
+ cerr << "W";
}
DispatchHandle::Callback rcb = rInterrupt;
@@ -108,15 +111,19 @@
wh->call(wcb);
} else {
phase1finished = true;
- assert(::timer_delete(timer) == 0);
+ assert(::timer_delete(timer) == 0);
}
}
+}} // namespace qpid::tests
+
+using namespace qpid::tests;
+
int main(int /*argc*/, char** /*argv*/)
{
// Create poller
Poller::shared_ptr poller(new Poller);
-
+
// Create dispatcher thread
Dispatcher d(poller);
Dispatcher d1(poller);
@@ -131,14 +138,14 @@
int sv[2];
int rc = ::socketpair(AF_UNIX, SOCK_STREAM, 0, sv);
assert(rc >= 0);
-
+
// Set non-blocking
rc = ::fcntl(sv[0], F_SETFL, O_NONBLOCK);
assert(rc >= 0);
rc = ::fcntl(sv[1], F_SETFL, O_NONBLOCK);
assert(rc >= 0);
-
+
// Make up a large string
string testString = "This is only a test ... 1,2,3,4,5,6,7,8,9,10;";
for (int i = 0; i < 8; i++)
@@ -148,19 +155,19 @@
PosixIOHandle f1(sv[1]);
rh = new DispatchHandleRef(f0, boost::bind(reader, _1, sv[0]), 0, 0);
- wh = new DispatchHandleRef(f1, 0, boost::bind(writer, _1, sv[1], testString), 0);
+ wh = new DispatchHandleRef(f1, 0, boost::bind(writer, _1, sv[1], testString), 0);
rh->startWatch(poller);
wh->startWatch(poller);
// Set up a regular itimer interupt
-
+
// Ignore signal in this thread
::sigset_t sm;
::sigemptyset(&sm);
::sigaddset(&sm, SIGRTMIN);
::pthread_sigmask(SIG_BLOCK, &sm, 0);
-
+
// Signal handling
struct ::sigaction sa;
sa.sa_sigaction = timer_handler;
@@ -168,18 +175,18 @@
::sigemptyset(&sa.sa_mask);
rc = ::sigaction(SIGRTMIN, &sa,0);
assert(rc == 0);
-
+
::sigevent se;
::memset(&se, 0, sizeof(se)); // Clear to make valgrind happy (this *is* the neatest way to do this portably - sigh)
se.sigev_notify = SIGEV_SIGNAL;
se.sigev_signo = SIGRTMIN;
rc = ::timer_create(CLOCK_REALTIME, &se, &timer);
assert(rc == 0);
-
+
itimerspec ts = {
/*.it_value = */ {2, 0}, // s, ns
/*.it_interval = */ {2, 0}}; // s, ns
-
+
rc = ::timer_settime(timer, 0, &ts, 0);
assert(rc == 0);
@@ -200,11 +207,11 @@
sa.sa_sigaction = stop_handler;
rc = ::sigaction(SIGRTMIN, &sa,0);
assert(rc == 0);
-
+
itimerspec nts = {
/*.it_value = */ {30, 0}, // s, ns
/*.it_interval = */ {30, 0}}; // s, ns
-
+
rc = ::timer_create(CLOCK_REALTIME, &se, &timer);
assert(rc == 0);
rc = ::timer_settime(timer, 0, &nts, 0);
@@ -228,7 +235,7 @@
rc = ::timer_delete(timer);
assert(rc == 0);
-
+
poller->shutdown();
dt.join();
dt1.join();
@@ -237,6 +244,6 @@
cout << "\nWrote: " << writtenBytes << "\n";
cout << "Read: " << readBytes << "\n";
-
+
return 0;
}
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/DtxWorkRecordTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/DtxWorkRecordTest.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/DtxWorkRecordTest.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/DtxWorkRecordTest.cpp Thu Sep 17 16:21:13 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(DtxWorkRecordTestSuite)
QPID_AUTO_TEST_CASE(testOnePhaseCommit){
@@ -44,7 +47,7 @@
DtxBuffer::shared_ptr bufferB(new DtxBuffer());
bufferB->enlist(static_pointer_cast<TxOp>(opB));
bufferB->markEnded();
-
+
DtxWorkRecord work("my-xid", &store);
work.add(bufferA);
work.add(bufferB);
@@ -77,7 +80,7 @@
DtxBuffer::shared_ptr bufferC(new DtxBuffer());
bufferC->enlist(static_pointer_cast<TxOp>(opC));
bufferC->markEnded();
-
+
DtxWorkRecord work("my-xid", &store);
work.add(bufferA);
work.add(bufferB);
@@ -108,7 +111,7 @@
DtxBuffer::shared_ptr bufferB(new DtxBuffer());
bufferB->enlist(static_pointer_cast<TxOp>(opB));
bufferB->markEnded();
-
+
DtxWorkRecord work("my-xid", &store);
work.add(bufferA);
work.add(bufferB);
@@ -142,7 +145,7 @@
DtxBuffer::shared_ptr bufferC(new DtxBuffer());
bufferC->enlist(static_pointer_cast<TxOp>(opC));
bufferC->markEnded();
-
+
DtxWorkRecord work("my-xid", &store);
work.add(bufferA);
work.add(bufferB);
@@ -171,7 +174,7 @@
DtxBuffer::shared_ptr bufferB(new DtxBuffer());
bufferB->enlist(static_pointer_cast<TxOp>(opB));
bufferB->markEnded();
-
+
DtxWorkRecord work("my-xid", &store);
work.add(bufferA);
work.add(bufferB);
@@ -187,3 +190,4 @@
QPID_AUTO_TEST_SUITE_END()
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/ExchangeTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/ExchangeTest.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/ExchangeTest.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/ExchangeTest.cpp Thu Sep 17 16:21:13 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::sys;
using namespace qpid;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(ExchangeTestSuite)
-QPID_AUTO_TEST_CASE(testMe)
+QPID_AUTO_TEST_CASE(testMe)
{
Queue::shared_ptr queue(new Queue("queue", true));
Queue::shared_ptr queue2(new Queue("queue2", true));
@@ -70,7 +73,7 @@
Queue::shared_ptr b(new Queue("b", true));
Queue::shared_ptr c(new Queue("c", true));
Queue::shared_ptr d(new Queue("d", true));
-
+
string k1("abc");
string k2("def");
string k3("xyz");
@@ -139,7 +142,7 @@
headers.bind(a, "", &args3);
headers.bind(b, "", &args2);
headers.bind(c, "", &args1);
-
+
BOOST_CHECK(headers.isBound(a, 0, 0));
BOOST_CHECK(headers.isBound(a, 0, &args1));
BOOST_CHECK(headers.isBound(a, 0, &args3));
@@ -153,7 +156,7 @@
BOOST_CHECK(!headers.isBound(d, 0, &args3));
}
-QPID_AUTO_TEST_CASE(testDeleteGetAndRedeclare)
+QPID_AUTO_TEST_CASE(testDeleteGetAndRedeclare)
{
ExchangeRegistry exchanges;
exchanges.declare("my-exchange", "direct", false, FieldTable());
@@ -162,7 +165,7 @@
exchanges.get("my-exchange");
} catch (const NotFoundException&) {}
std::pair<Exchange::shared_ptr, bool> response = exchanges.declare("my-exchange", "direct", false, FieldTable());
- BOOST_CHECK_EQUAL(string("direct"), response.first->getType());
+ BOOST_CHECK_EQUAL(string("direct"), response.first->getType());
}
intrusive_ptr<Message> cmessage(std::string exchange, std::string routingKey) {
@@ -175,7 +178,7 @@
return msg;
}
-QPID_AUTO_TEST_CASE(testSequenceOptions)
+QPID_AUTO_TEST_CASE(testSequenceOptions)
{
FieldTable args;
args.setInt("qpid.msg_sequence",1);
@@ -225,22 +228,22 @@
direct.encode(buffer);
}
{
-
+
ExchangeRegistry exchanges;
buffer.reset();
DirectExchange::shared_ptr exch_dec = Exchange::decode(exchanges, buffer);
-
+
intrusive_ptr<Message> msg1 = cmessage("e", "A");
DeliverableMessage dmsg1(msg1);
exch_dec->route(dmsg1, "abc", 0);
BOOST_CHECK_EQUAL(4, msg1->getApplicationHeaders()->getAsInt64("qpid.msg_sequence"));
-
+
}
delete [] buff;
}
-QPID_AUTO_TEST_CASE(testIVEOption)
+QPID_AUTO_TEST_CASE(testIVEOption)
{
FieldTable args;
args.setInt("qpid.ive",1);
@@ -248,7 +251,7 @@
FanOutExchange fanout("fanout1", false, args);
HeadersExchange header("headers1", false, args);
TopicExchange topic ("topic1", false, args);
-
+
intrusive_ptr<Message> msg1 = cmessage("direct1", "abc");
msg1->getProperties<MessageProperties>()->getApplicationHeaders().setString("a", "abc");
DeliverableMessage dmsg1(msg1);
@@ -256,7 +259,7 @@
FieldTable args2;
args2.setString("x-match", "any");
args2.setString("a", "abc");
-
+
direct.route(dmsg1, "abc", 0);
fanout.route(dmsg1, "abc", 0);
header.route(dmsg1, "abc", &args2);
@@ -265,20 +268,22 @@
Queue::shared_ptr queue1(new Queue("queue1", true));
Queue::shared_ptr queue2(new Queue("queue2", true));
Queue::shared_ptr queue3(new Queue("queue3", true));
-
+
BOOST_CHECK(HeadersExchange::match(args2, msg1->getProperties<MessageProperties>()->getApplicationHeaders()));
-
+
BOOST_CHECK(direct.bind(queue, "abc", 0));
BOOST_CHECK(fanout.bind(queue1, "abc", 0));
BOOST_CHECK(header.bind(queue2, "", &args2));
BOOST_CHECK(topic.bind(queue3, "abc", 0));
-
+
BOOST_CHECK_EQUAL(1u,queue->getMessageCount());
BOOST_CHECK_EQUAL(1u,queue1->getMessageCount());
BOOST_CHECK_EQUAL(1u,queue2->getMessageCount());
BOOST_CHECK_EQUAL(1u,queue3->getMessageCount());
-
+
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/FieldTable.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/FieldTable.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/FieldTable.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/FieldTable.cpp Thu Sep 17 16:21:13 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
@@ -29,6 +29,9 @@
using namespace qpid::framing;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(FieldTableTestSuite)
QPID_AUTO_TEST_CASE(testMe)
@@ -57,7 +60,7 @@
a.setInt("B", 1234);
b = a;
a.setString("A", "CCCC");
-
+
BOOST_CHECK(string("CCCC") == a.getAsString("A"));
BOOST_CHECK(string("BBBB") == b.getAsString("A"));
BOOST_CHECK_EQUAL(1234, a.getAsInt("B"));
@@ -69,7 +72,7 @@
{
FieldTable c;
c = a;
-
+
char* buff = static_cast<char*>(::alloca(c.encodedSize()));
Buffer wbuffer(buff, c.encodedSize());
wbuffer.put(c);
@@ -102,7 +105,7 @@
list.push_back(List::ValuePtr(new Unsigned32Value(u)));
list.push_back(List::ValuePtr(new Str8Value("yellow")));
list.push_back(List::ValuePtr(new DoubleValue(d)));
-
+
a.setString("id", "A");
b.setString("id", "B");
a.setTable("B", b);
@@ -192,7 +195,7 @@
FieldTable args;
args.setInt64("a",100);
args.setInt64("b",-(int64_t) ((int64_t) 1<<34));
-
+
args.setUInt64("c",1u);
args.setUInt64("d",(uint64_t) ((uint64_t) 1<<34));
BOOST_CHECK_EQUAL(1u, args.getAsUInt64("c"));
@@ -204,5 +207,7 @@
BOOST_CHECK_EQUAL((int64_t) ((int64_t) 1<<34), args.getAsInt64("d"));
}
-
+
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/FieldValue.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/FieldValue.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/FieldValue.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/FieldValue.cpp Thu Sep 17 16:21:13 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
@@ -20,6 +20,9 @@
#include "unit_test.h"
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(FieldValueTestSuite)
using namespace qpid::framing;
@@ -32,7 +35,7 @@
QPID_AUTO_TEST_CASE(testStr16ValueEquals)
{
-
+
BOOST_CHECK(Str16Value("abc") == s);
BOOST_CHECK(Str16Value("foo") != s);
BOOST_CHECK(s != i);
@@ -73,7 +76,7 @@
BOOST_CHECK_EQUAL(std::string("FOO"),
ft.getValue().getString("foo"));
BOOST_CHECK_EQUAL(7, ft.getValue().getInt("magic"));
-
+
FieldTableValue f2;
BOOST_CHECK(ft != f2);
f2.getValue().setString("foo", "FOO");
@@ -88,3 +91,5 @@
#endif
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/ForkedBroker.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/ForkedBroker.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/ForkedBroker.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/ForkedBroker.cpp Thu Sep 17 16:21:13 2009
@@ -30,6 +30,16 @@
using namespace std;
using qpid::ErrnoException;
+namespace std {
+static ostream& operator<<(ostream& o, const qpid::tests::ForkedBroker::Args& a) {
+copy(a.begin(), a.end(), ostream_iterator<string>(o, " "));
+return o;
+}
+}
+
+namespace qpid {
+namespace tests {
+
ForkedBroker::ForkedBroker(const Args& constArgs) {
Args args(constArgs);
Args::iterator i = find(args.begin(), args.end(), string("TMP_DATA_DIR"));
@@ -71,12 +81,6 @@
throw qpid::Exception(QPID_MSG("Forked broker exited with: " << WEXITSTATUS(status)));
}
-namespace std {
-static ostream& operator<<(ostream& o, const ForkedBroker::Args& a) {
- copy(a.begin(), a.end(), ostream_iterator<string>(o, " "));
- return o;
-}
-
bool isLogOption(const std::string& s) {
const char * log_enable = "--log-enable",
* trace = "--trace";
@@ -85,8 +89,6 @@
);
}
-}
-
void ForkedBroker::init(const Args& userArgs) {
using qpid::ErrnoException;
port = 0;
@@ -125,3 +127,5 @@
::exit(1);
}
}
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/ForkedBroker.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/ForkedBroker.h?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/ForkedBroker.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/ForkedBroker.h Thu Sep 17 16:21:13 2009
@@ -11,9 +11,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,9 +31,12 @@
#include <stdio.h>
#include <sys/wait.h>
+namespace qpid {
+namespace tests {
+
/**
* Class to fork a broker child process.
- *
+ *
* For most tests a BrokerFixture may be more convenient as it starts
* a broker in the same process which allows you to easily debug into
* the broker.
@@ -42,17 +45,17 @@
* those brokers can't coexist in the same process (e.g. for cluster
* tests where CPG doesn't allow multiple group members in a single
* process.)
- *
+ *
*/
class ForkedBroker {
public:
typedef std::vector<std::string> Args;
// argv args are passed to broker.
- //
+ //
// Special value "TMP_DATA_DIR" is substituted with a temporary
// data directory for the broker.
- //
+ //
ForkedBroker(const Args& argv);
~ForkedBroker();
@@ -70,4 +73,6 @@
std::string dataDir;
};
+}} // namespace qpid::tests
+
#endif /*!TESTS_FORKEDBROKER_H*/
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/Frame.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/Frame.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/Frame.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/Frame.cpp Thu Sep 17 16:21:13 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
@@ -23,6 +23,9 @@
#include <boost/lexical_cast.hpp>
#include "unit_test.h"
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(FrameTestSuite)
using namespace std;
@@ -78,3 +81,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/FrameDecoder.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/FrameDecoder.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/FrameDecoder.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/FrameDecoder.cpp Thu Sep 17 16:21:13 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 @@
#include <string>
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(FrameDecoderTest)
using namespace std;
@@ -69,5 +72,7 @@
}
-
+
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/FramingTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/FramingTest.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/FramingTest.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/FramingTest.cpp Thu Sep 17 16:21:13 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,8 +39,11 @@
using namespace qpid::framing;
using namespace std;
+namespace qpid {
+namespace tests {
+
template <class T>
-std::string tostring(const T& x)
+std::string tostring(const T& x)
{
std::ostringstream out;
out << x;
@@ -49,7 +52,7 @@
QPID_AUTO_TEST_SUITE(FramingTestSuite)
-QPID_AUTO_TEST_CASE(testMessageTransferBody)
+QPID_AUTO_TEST_CASE(testMessageTransferBody)
{
char buffer[1024];
ProtocolVersion version(highestProtocolVersion);
@@ -62,8 +65,8 @@
out.decode(rbuff);
BOOST_CHECK_EQUAL(tostring(in), tostring(out));
}
-
-QPID_AUTO_TEST_CASE(testConnectionSecureBody)
+
+QPID_AUTO_TEST_CASE(testConnectionSecureBody)
{
char buffer[1024];
ProtocolVersion version(highestProtocolVersion);
@@ -88,10 +91,10 @@
Array hosts(0x95);
hosts.add(boost::shared_ptr<FieldValue>(new Str16Value(a)));
hosts.add(boost::shared_ptr<FieldValue>(new Str16Value(b)));
-
+
ConnectionRedirectBody in(version, a, hosts);
in.encode(wbuff);
-
+
Buffer rbuff(buffer, sizeof(buffer));
ConnectionRedirectBody out(version);
out.decode(rbuff);
@@ -111,7 +114,7 @@
out.decode(rbuff);
BOOST_CHECK_EQUAL(tostring(in), tostring(out));
}
-
+
QPID_AUTO_TEST_CASE(testConnectionRedirectBodyFrame)
{
char buffer[1024];
@@ -122,7 +125,7 @@
Array hosts(0x95);
hosts.add(boost::shared_ptr<FieldValue>(new Str16Value(a)));
hosts.add(boost::shared_ptr<FieldValue>(new Str16Value(b)));
-
+
AMQFrame in((ConnectionRedirectBody(version, a, hosts)));
in.setChannel(999);
in.encode(wbuff);
@@ -149,3 +152,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/HeaderTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/HeaderTest.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/HeaderTest.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/HeaderTest.cpp Thu Sep 17 16:21:13 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,9 +26,12 @@
using namespace qpid::framing;
using namespace std;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(HeaderTestSuite)
-QPID_AUTO_TEST_CASE(testGenericProperties)
+QPID_AUTO_TEST_CASE(testGenericProperties)
{
AMQHeaderBody body;
body.get<MessageProperties>(true)->getApplicationHeaders().setString(
@@ -47,10 +50,10 @@
props->getApplicationHeaders().get("A")->get<string>());
}
-QPID_AUTO_TEST_CASE(testMessageProperties)
+QPID_AUTO_TEST_CASE(testMessageProperties)
{
AMQFrame out((AMQHeaderBody()));
- MessageProperties* props1 =
+ MessageProperties* props1 =
out.castBody<AMQHeaderBody>()->get<MessageProperties>(true);
props1->setContentLength(42);
@@ -82,10 +85,10 @@
}
-QPID_AUTO_TEST_CASE(testDeliveryProperies)
+QPID_AUTO_TEST_CASE(testDeliveryProperies)
{
AMQFrame out((AMQHeaderBody()));
- DeliveryProperties* props1 =
+ DeliveryProperties* props1 =
out.castBody<AMQHeaderBody>()->get<DeliveryProperties>(true);
props1->setDiscardUnroutable(true);
@@ -108,3 +111,4 @@
QPID_AUTO_TEST_SUITE_END()
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/HeadersExchangeTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/HeadersExchangeTest.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/HeadersExchangeTest.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/HeadersExchangeTest.cpp Thu Sep 17 16:21:13 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,9 +28,12 @@
using namespace qpid::broker;
using namespace qpid::framing;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(HeadersExchangeTestSuite)
-
-QPID_AUTO_TEST_CASE(testMatchAll)
+
+QPID_AUTO_TEST_CASE(testMatchAll)
{
FieldTable b, m, n;
b.setString("x-match", "all");
@@ -43,7 +46,7 @@
// Ignore extras.
m.setString("extra", "x");
BOOST_CHECK(HeadersExchange::match(b, m));
-
+
// Fail mismatch, wrong value.
m.setString("foo", "NotFoo");
BOOST_CHECK(!HeadersExchange::match(b, m));
@@ -54,7 +57,7 @@
BOOST_CHECK(!HeadersExchange::match(b, n));
}
-QPID_AUTO_TEST_CASE(testMatchAny)
+QPID_AUTO_TEST_CASE(testMatchAny)
{
FieldTable b, m, n;
b.setString("x-match", "any");
@@ -67,7 +70,7 @@
BOOST_CHECK(HeadersExchange::match(b, m));
}
-QPID_AUTO_TEST_CASE(testMatchEmptyValue)
+QPID_AUTO_TEST_CASE(testMatchEmptyValue)
{
FieldTable b, m;
b.setString("x-match", "all");
@@ -82,23 +85,23 @@
{
FieldTable b, m;
m.setString("foo", "FOO");
-
+
b.setString("x-match", "all");
BOOST_CHECK(HeadersExchange::match(b, m));
b.setString("x-match", "any");
BOOST_CHECK(!HeadersExchange::match(b, m));
}
-
-QPID_AUTO_TEST_CASE(testMatchNoXMatch)
+
+QPID_AUTO_TEST_CASE(testMatchNoXMatch)
{
FieldTable b, m;
b.setString("foo", "FOO");
m.setString("foo", "FOO");
BOOST_CHECK(!HeadersExchange::match(b, m));
}
-
-QPID_AUTO_TEST_CASE(testBindNoXMatch)
+
+QPID_AUTO_TEST_CASE(testBindNoXMatch)
{
HeadersExchange exchange("test");
Queue::shared_ptr queue;
@@ -112,4 +115,6 @@
}
}
-QPID_AUTO_TEST_SUITE_END()
+QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/IncompleteMessageList.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/IncompleteMessageList.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/IncompleteMessageList.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/IncompleteMessageList.cpp Thu Sep 17 16:21:13 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 @@
#include "unit_test.h"
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(IncompleteMessageListTestSuite)
using namespace qpid::broker;
@@ -41,7 +44,7 @@
Checker(uint start, uint end) {
for (uint i = start; i <= end; i++) {
ids.push_back(i);
- }
+ }
}
Checker& expect(const SequenceNumber& id) {
@@ -49,11 +52,11 @@
return *this;
}
- void operator()(boost::intrusive_ptr<Message> msg) {
+ void operator()(boost::intrusive_ptr<Message> msg) {
BOOST_CHECK(!ids.empty());
BOOST_CHECK_EQUAL(msg->getCommandId(), ids.front());
ids.pop_front();
- }
+ }
};
QPID_AUTO_TEST_CASE(testProcessSimple)
@@ -91,7 +94,7 @@
list.process(Checker(1, 2), false);
//mark message complete and re-process to get remaining messages sent to listener
middle->enqueueComplete();
- list.process(Checker(3, 5), false);
+ list.process(Checker(3, 5), false);
}
@@ -127,3 +130,5 @@
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/InlineAllocator.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/InlineAllocator.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/InlineAllocator.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/InlineAllocator.cpp Thu Sep 17 16:21:13 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
@@ -22,6 +22,9 @@
#include "qpid/InlineAllocator.h"
#include "unit_test.h"
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(InlineAllocatorTestSuite)
using namespace qpid;
@@ -48,16 +51,18 @@
char* p = alloc.allocate(1);
BOOST_CHECK(p == (char*)&alloc);
-
+
char* q = alloc.allocate(1);
BOOST_CHECK(q != (char*)&alloc);
alloc.deallocate(p,1);
p = alloc.allocate(1);
BOOST_CHECK(p == (char*)&alloc);
-
+
alloc.deallocate(p,1);
alloc.deallocate(q,1);
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/InlineVector.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/InlineVector.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/InlineVector.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/InlineVector.cpp Thu Sep 17 16:21:13 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
@@ -22,6 +22,9 @@
#include "qpid/InlineVector.h"
#include "unit_test.h"
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(InlineVectorTestSuite)
using namespace qpid;
@@ -117,7 +120,9 @@
QPID_AUTO_TEST_CASE(testResize) {
Vec v;
v.resize(5);
- BOOST_CHECK(!isInline(v));
+ BOOST_CHECK(!isInline(v));
}
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/ManagementTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/ManagementTest.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/ManagementTest.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/ManagementTest.cpp Thu Sep 17 16:21:13 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
@@ -24,6 +24,9 @@
#include "qpid/console/ObjectId.h"
#include "unit_test.h"
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(ManagementTestSuite)
using namespace qpid::framing;
@@ -109,4 +112,4 @@
QPID_AUTO_TEST_SUITE_END()
-
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageBuilderTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageBuilderTest.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageBuilderTest.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageBuilderTest.cpp Thu Sep 17 16:21:13 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,15 +31,18 @@
using namespace qpid::framing;
using namespace qpid::sys;
+namespace qpid {
+namespace tests {
+
class MockMessageStore : public NullMessageStore
{
enum Op {STAGE=1, APPEND=2};
uint64_t id;
- boost::intrusive_ptr<PersistableMessage> expectedMsg;
+ boost::intrusive_ptr<PersistableMessage> expectedMsg;
string expectedData;
std::list<Op> ops;
-
+
void checkExpectation(Op actual)
{
BOOST_CHECK_EQUAL(ops.front(), actual);
@@ -49,17 +52,17 @@
public:
MockMessageStore() : id(0), expectedMsg(0) {}
- void expectStage(PersistableMessage& msg)
- {
+ void expectStage(PersistableMessage& msg)
+ {
expectedMsg = &msg;
- ops.push_back(STAGE);
+ ops.push_back(STAGE);
}
- void expectAppendContent(PersistableMessage& msg, const string& data)
- {
+ void expectAppendContent(PersistableMessage& msg, const string& data)
+ {
expectedMsg = &msg;
expectedData = data;
- ops.push_back(APPEND);
+ ops.push_back(APPEND);
}
void stage(const boost::intrusive_ptr<PersistableMessage>& msg)
@@ -74,7 +77,7 @@
{
checkExpectation(APPEND);
BOOST_CHECK_EQUAL(boost::static_pointer_cast<const PersistableMessage>(expectedMsg), msg);
- BOOST_CHECK_EQUAL(expectedData, data);
+ BOOST_CHECK_EQUAL(expectedData, data);
}
bool expectationsMet()
@@ -89,7 +92,7 @@
}
};
-
+
QPID_AUTO_TEST_SUITE(MessageBuilderTestSuite)
QPID_AUTO_TEST_CASE(testHeaderOnly)
@@ -103,7 +106,7 @@
AMQFrame method((MessageTransferBody(ProtocolVersion(), exchange, 0, 0)));
AMQFrame header((AMQHeaderBody()));
- header.castBody<AMQHeaderBody>()->get<MessageProperties>(true)->setContentLength(0);
+ header.castBody<AMQHeaderBody>()->get<MessageProperties>(true)->setContentLength(0);
header.castBody<AMQHeaderBody>()->get<DeliveryProperties>(true)->setRoutingKey(key);
builder.handle(method);
@@ -132,7 +135,7 @@
header.setEof(false);
content.setBof(false);
- header.castBody<AMQHeaderBody>()->get<MessageProperties>(true)->setContentLength(data.size());
+ header.castBody<AMQHeaderBody>()->get<MessageProperties>(true)->setContentLength(data.size());
header.castBody<AMQHeaderBody>()->get<DeliveryProperties>(true)->setRoutingKey(key);
builder.handle(method);
@@ -143,7 +146,7 @@
BOOST_CHECK(builder.getMessage());
BOOST_CHECK(!builder.getMessage()->getFrames().isComplete());
- builder.handle(content);
+ builder.handle(content);
BOOST_CHECK(builder.getMessage());
BOOST_CHECK(builder.getMessage()->getFrames().isComplete());
}
@@ -169,7 +172,7 @@
content1.setEof(false);
content2.setBof(false);
- header.castBody<AMQHeaderBody>()->get<MessageProperties>(true)->setContentLength(data1.size() + data2.size());
+ header.castBody<AMQHeaderBody>()->get<MessageProperties>(true)->setContentLength(data1.size() + data2.size());
header.castBody<AMQHeaderBody>()->get<DeliveryProperties>(true)->setRoutingKey(key);
builder.handle(method);
@@ -188,7 +191,7 @@
MockMessageStore store;
MessageBuilder builder(&store, 5);
builder.start(SequenceNumber());
-
+
std::string data1("abcdefg");
std::string data2("hijklmn");
std::string exchange("builder-exchange");
@@ -199,7 +202,7 @@
AMQFrame content1((AMQContentBody(data1)));
AMQFrame content2((AMQContentBody(data2)));
- header.castBody<AMQHeaderBody>()->get<MessageProperties>(true)->setContentLength(data1.size() + data2.size());
+ header.castBody<AMQHeaderBody>()->get<MessageProperties>(true)->setContentLength(data1.size() + data2.size());
header.castBody<AMQHeaderBody>()->get<DeliveryProperties>(true)->setRoutingKey(key);
builder.handle(method);
@@ -223,7 +226,7 @@
MockMessageStore store;
MessageBuilder builder(&store, 5);
builder.start(SequenceNumber());
-
+
std::string data1("abcdefg");
std::string exchange("qpid.management");
std::string key("builder-exchange");
@@ -232,7 +235,7 @@
AMQFrame header((AMQHeaderBody()));
AMQFrame content1((AMQContentBody(data1)));
- header.castBody<AMQHeaderBody>()->get<MessageProperties>(true)->setContentLength(data1.size());
+ header.castBody<AMQHeaderBody>()->get<MessageProperties>(true)->setContentLength(data1.size());
header.castBody<AMQHeaderBody>()->get<DeliveryProperties>(true)->setRoutingKey(key);
builder.handle(method);
@@ -242,4 +245,7 @@
BOOST_CHECK(store.expectationsMet());
BOOST_CHECK_EQUAL((uint64_t) 0, builder.getMessage()->getPersistenceId());
}
+
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageReplayTracker.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageReplayTracker.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageReplayTracker.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageReplayTracker.cpp Thu Sep 17 16:21:13 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
@@ -23,6 +23,9 @@
#include "qpid/client/MessageReplayTracker.h"
#include "qpid/sys/Time.h"
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(MessageReplayTrackerTests)
using namespace qpid::client;
@@ -53,8 +56,8 @@
MessageReplayTracker tracker(10);
tracker.init(fix.session);
- for (uint i = 0; i < 5; i++) {
- Message message((boost::format("Message_%1%") % (i+1)).str(), "my-queue");
+ for (uint i = 0; i < 5; i++) {
+ Message message((boost::format("Message_%1%") % (i+1)).str(), "my-queue");
tracker.send(message);
}
ReplayBufferChecker checker(1, 10);
@@ -62,7 +65,7 @@
tracker.replay(fix.session);
for (uint j = 0; j < 2; j++) {//each message should have been sent twice
- for (uint i = 0; i < 5; i++) {
+ for (uint i = 0; i < 5; i++) {
Message m;
BOOST_CHECK(fix.subs.get(m, "my-queue", TIME_SEC));
BOOST_CHECK_EQUAL((boost::format("Message_%1%") % (i+1)).str(), m.getData());
@@ -79,15 +82,15 @@
MessageReplayTracker tracker(10);
tracker.init(fix.session);
- for (uint i = 0; i < 5; i++) {
- Message message((boost::format("Message_%1%") % (i+1)).str(), "my-queue");
+ for (uint i = 0; i < 5; i++) {
+ Message message((boost::format("Message_%1%") % (i+1)).str(), "my-queue");
tracker.send(message);
}
fix.session.sync();//ensures all messages are complete
tracker.checkCompletion();
tracker.replay(fix.session);
Message received;
- for (uint i = 0; i < 5; i++) {
+ for (uint i = 0; i < 5; i++) {
BOOST_CHECK(fix.subs.get(received, "my-queue"));
BOOST_CHECK_EQUAL((boost::format("Message_%1%") % (i+1)).str(), received.getData());
}
@@ -96,4 +99,4 @@
QPID_AUTO_TEST_SUITE_END()
-
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageTest.cpp?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageTest.cpp (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageTest.cpp Thu Sep 17 16:21:13 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::broker;
using namespace qpid::framing;
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(MessageTestSuite)
QPID_AUTO_TEST_CASE(testEncodeDecode)
@@ -56,7 +59,7 @@
msg->getFrames().append(content2);
MessageProperties* mProps = msg->getFrames().getHeaders()->get<MessageProperties>(true);
- mProps->setContentLength(data1.size() + data2.size());
+ mProps->setContentLength(data1.size() + data2.size());
mProps->setMessageId(messageId);
FieldTable applicationHeaders;
applicationHeaders.setString("abc", "xyz");
@@ -69,7 +72,7 @@
char* buff = static_cast<char*>(::alloca(msg->encodedSize()));
Buffer wbuffer(buff, msg->encodedSize());
msg->encode(wbuffer);
-
+
Buffer rbuffer(buff, msg->encodedSize());
msg = new Message();
msg->decodeHeader(rbuffer);
@@ -86,3 +89,4 @@
QPID_AUTO_TEST_SUITE_END()
+}} // namespace qpid::tests
Modified: qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageUtils.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageUtils.h?rev=816261&r1=816260&r2=816261&view=diff
==============================================================================
--- qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageUtils.h (original)
+++ qpid/branches/java-network-refactor/qpid/cpp/src/tests/MessageUtils.h Thu Sep 17 16:21:13 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,9 +28,12 @@
using namespace broker;
using namespace framing;
+namespace qpid {
+namespace tests {
+
struct MessageUtils
{
- static boost::intrusive_ptr<Message> createMessage(const string& exchange="", const string& routingKey="",
+ static boost::intrusive_ptr<Message> createMessage(const string& exchange="", const string& routingKey="",
const Uuid& messageId=Uuid(true), uint64_t contentSize = 0)
{
boost::intrusive_ptr<broker::Message> msg(new broker::Message());
@@ -41,7 +44,7 @@
msg->getFrames().append(method);
msg->getFrames().append(header);
MessageProperties* props = msg->getFrames().getHeaders()->get<MessageProperties>(true);
- props->setContentLength(contentSize);
+ props->setContentLength(contentSize);
props->setMessageId(messageId);
msg->getFrames().getHeaders()->get<DeliveryProperties>(true)->setRoutingKey(routingKey);
return msg;
@@ -53,3 +56,5 @@
msg->getFrames().append(content);
}
};
+
+}} // namespace qpid::tests
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org