You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2009/10/05 14:52:10 UTC
svn commit: r821779 [6/11] - in /qpid/branches/java-broker-0-10/qpid: ./
cpp/ cpp/bindings/qmf/ cpp/bindings/qmf/python/
cpp/bindings/qmf/python/qmf/ cpp/bindings/qmf/ruby/ cpp/bindings/qmf/tests/
cpp/examples/messaging/ cpp/include/qmf/ cpp/include/qp...
Modified: qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ClusterFixture.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ClusterFixture.h?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ClusterFixture.h (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ClusterFixture.h Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/ConnectionOptions.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ConnectionOptions.h?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ConnectionOptions.h (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ConnectionOptions.h Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/ConsoleTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ConsoleTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ConsoleTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ConsoleTest.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/DeliveryRecordTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/DeliveryRecordTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/DeliveryRecordTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/DeliveryRecordTest.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/DispatcherTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/DispatcherTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/DispatcherTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/DispatcherTest.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/DtxWorkRecordTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/DtxWorkRecordTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/DtxWorkRecordTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/DtxWorkRecordTest.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/ExchangeTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ExchangeTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ExchangeTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ExchangeTest.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/FieldTable.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/FieldTable.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/FieldTable.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/FieldTable.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/FieldValue.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/FieldValue.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/FieldValue.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/FieldValue.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/ForkedBroker.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ForkedBroker.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ForkedBroker.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ForkedBroker.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/ForkedBroker.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ForkedBroker.h?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ForkedBroker.h (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ForkedBroker.h Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/Frame.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/Frame.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/Frame.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/Frame.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/FrameDecoder.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/FrameDecoder.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/FrameDecoder.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/FrameDecoder.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/FramingTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/FramingTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/FramingTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/FramingTest.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/HeaderTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/HeaderTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/HeaderTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/HeaderTest.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/HeadersExchangeTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/HeadersExchangeTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/HeadersExchangeTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/HeadersExchangeTest.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/IncompleteMessageList.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/IncompleteMessageList.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/IncompleteMessageList.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/IncompleteMessageList.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/InlineAllocator.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/InlineAllocator.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/InlineAllocator.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/InlineAllocator.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/InlineVector.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/InlineVector.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/InlineVector.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/InlineVector.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/Makefile.am
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/Makefile.am?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/Makefile.am (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/Makefile.am Mon Oct 5 12:51:57 2009
@@ -270,6 +270,11 @@
qrsh_SOURCES=qrsh.cpp
qrsh_LDADD=$(lib_client)
+check_PROGRAMS+=qpid_stream
+qpid_stream_INCLUDES=$(PUBLIC_INCLUDES)
+qpid_stream_SOURCES=qpid_stream.cpp
+qpid_stream_LDADD=$(lib_client)
+
TESTS_ENVIRONMENT = \
VALGRIND=$(VALGRIND) \
Modified: qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ManagementTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ManagementTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ManagementTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ManagementTest.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/MessageBuilderTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessageBuilderTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessageBuilderTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessageBuilderTest.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/MessageReplayTracker.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessageReplayTracker.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessageReplayTracker.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessageReplayTracker.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/MessageTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessageTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessageTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessageTest.cpp Mon Oct 5 12:51:57 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-broker-0-10/qpid/cpp/src/tests/MessageUtils.h
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessageUtils.h?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessageUtils.h (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessageUtils.h Mon Oct 5 12:51:57 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
Modified: qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessagingSessionTests.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessagingSessionTests.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessagingSessionTests.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/MessagingSessionTests.cpp Mon Oct 5 12:51:57 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 @@
#include <string>
#include <vector>
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(MessagingSessionTests)
using namespace qpid::messaging;
@@ -86,7 +89,7 @@
Session session;
BrokerAdmin admin;
- MessagingFixture(Broker::Options opts = Broker::Options()) :
+ MessagingFixture(Broker::Options opts = Broker::Options()) :
BrokerFixture(opts),
connection(Connection::open((boost::format("amqp:tcp:localhost:%1%") % (broker->getPort(Broker::TCP_TRANSPORT))).str())),
session(connection.newSession()),
@@ -133,7 +136,7 @@
struct MultiQueueFixture : MessagingFixture
{
- typedef std::vector<std::string>::const_iterator const_iterator;
+ typedef std::vector<std::string>::const_iterator const_iterator;
std::vector<std::string> queues;
MultiQueueFixture(const std::vector<std::string>& names = boost::assign::list_of<std::string>("q1")("q2")("q3")) : queues(names)
@@ -161,7 +164,7 @@
}
};
-std::vector<std::string> fetch(Receiver& receiver, int count, qpid::sys::Duration timeout=qpid::sys::TIME_SEC*5)
+std::vector<std::string> fetch(Receiver& receiver, int count, qpid::sys::Duration timeout=qpid::sys::TIME_SEC*5)
{
std::vector<std::string> data;
Message message;
@@ -183,6 +186,25 @@
BOOST_CHECK_EQUAL(in.getBytes(), out.getBytes());
}
+QPID_AUTO_TEST_CASE(testSendReceiveHeaders)
+{
+ QueueFixture fix;
+ Sender sender = fix.session.createSender(fix.queue);
+ Message out("test-message");
+ for (uint i = 0; i < 10; ++i) {
+ out.getHeaders()["a"] = i;
+ sender.send(out);
+ }
+ Receiver receiver = fix.session.createReceiver(fix.queue);
+ Message in;
+ for (uint i = 0; i < 10; ++i) {
+ BOOST_CHECK(receiver.fetch(in, 5 * qpid::sys::TIME_SEC));
+ BOOST_CHECK_EQUAL(in.getBytes(), out.getBytes());
+ BOOST_CHECK_EQUAL(in.getHeaders()["a"].asUint32(), i);
+ fix.session.acknowledge();
+ }
+}
+
QPID_AUTO_TEST_CASE(testSenderError)
{
MessagingFixture fix;
@@ -229,14 +251,14 @@
Message in;
BOOST_CHECK(!sub2.fetch(in, 0));//TODO: or should this raise an error?
-
+
//TODO: check pending messages...
}
QPID_AUTO_TEST_CASE(testSessionFetch)
{
MultiQueueFixture fix;
-
+
for (uint i = 0; i < fix.queues.size(); i++) {
Receiver r = fix.session.createReceiver(fix.queues[i]);
r.setCapacity(10u);
@@ -247,8 +269,8 @@
Sender s = fix.session.createSender(fix.queues[i]);
Message msg((boost::format("Message_%1%") % (i+1)).str());
s.send(msg);
- }
-
+ }
+
for (uint i = 0; i < fix.queues.size(); i++) {
Message msg;
BOOST_CHECK(fix.session.fetch(msg, qpid::sys::TIME_SEC));
@@ -259,7 +281,7 @@
QPID_AUTO_TEST_CASE(testSessionDispatch)
{
MultiQueueFixture fix;
-
+
MessageDataCollector collector;
for (uint i = 0; i < fix.queues.size(); i++) {
Receiver r = fix.session.createReceiver(fix.queues[i]);
@@ -272,10 +294,10 @@
Sender s = fix.session.createSender(fix.queues[i]);
Message msg((boost::format("Message_%1%") % (i+1)).str());
s.send(msg);
- }
+ }
while (fix.session.dispatch(qpid::sys::TIME_SEC)) ;
-
+
BOOST_CHECK_EQUAL(collector.messageData, boost::assign::list_of<std::string>("Message_1")("Message_2")("Message_3"));
}
@@ -289,8 +311,7 @@
out.getContent().asMap()["pi"] = 3.14f;
sender.send(out);
Receiver receiver = fix.session.createReceiver(fix.queue);
- Message in = receiver.fetch(5 * qpid::sys::TIME_SEC);
- BOOST_CHECK_EQUAL(in.getBytes(), out.getBytes());
+ Message in = receiver.fetch(5 * qpid::sys::TIME_SEC);
BOOST_CHECK_EQUAL(in.getContent().asMap()["abc"].asString(), "def");
BOOST_CHECK_EQUAL(in.getContent().asMap()["pi"].asFloat(), 3.14f);
fix.session.acknowledge();
@@ -305,12 +326,11 @@
out.getContent() << "abc";
out.getContent() << 1234;
out.getContent() << "def";
- out.getContent() << 56.789;
+ out.getContent() << 56.789;
sender.send(out);
Receiver receiver = fix.session.createReceiver(fix.queue);
- Message in = receiver.fetch(5 * qpid::sys::TIME_SEC);
- BOOST_CHECK_EQUAL(in.getBytes(), out.getBytes());
- Variant::List& list = in.getContent().asList();
+ Message in = receiver.fetch(5 * qpid::sys::TIME_SEC);
+ Variant::List& list = in.getContent().asList();
BOOST_CHECK_EQUAL(list.size(), out.getContent().asList().size());
BOOST_CHECK_EQUAL(list.front().asString(), "abc");
list.pop_front();
@@ -322,4 +342,100 @@
fix.session.acknowledge();
}
+QPID_AUTO_TEST_CASE(testReject)
+{
+ QueueFixture fix;
+ Sender sender = fix.session.createSender(fix.queue);
+ Message m1("reject-me");
+ sender.send(m1);
+ Message m2("accept-me");
+ sender.send(m2);
+ Receiver receiver = fix.session.createReceiver(fix.queue);
+ Message in = receiver.fetch(5 * qpid::sys::TIME_SEC);
+ BOOST_CHECK_EQUAL(in.getBytes(), m1.getBytes());
+ fix.session.reject(in);
+ in = receiver.fetch(5 * qpid::sys::TIME_SEC);
+ BOOST_CHECK_EQUAL(in.getBytes(), m2.getBytes());
+ fix.session.acknowledge();
+}
+
+QPID_AUTO_TEST_CASE(testAvailable)
+{
+ MultiQueueFixture fix;
+
+ Receiver r1 = fix.session.createReceiver(fix.queues[0]);
+ r1.setCapacity(100);
+ r1.start();
+
+ Receiver r2 = fix.session.createReceiver(fix.queues[1]);
+ r2.setCapacity(100);
+ r2.start();
+
+ Sender s1 = fix.session.createSender(fix.queues[0]);
+ Sender s2 = fix.session.createSender(fix.queues[1]);
+
+ for (uint i = 0; i < 10; ++i) {
+ s1.send(Message((boost::format("A_%1%") % (i+1)).str()));
+ }
+ for (uint i = 0; i < 5; ++i) {
+ s2.send(Message((boost::format("B_%1%") % (i+1)).str()));
+ }
+ qpid::sys::sleep(1);//is there any avoid an arbitrary sleep while waiting for messages to be dispatched?
+ for (uint i = 0; i < 5; ++i) {
+ BOOST_CHECK_EQUAL(fix.session.available(), 15u - 2*i);
+ BOOST_CHECK_EQUAL(r1.available(), 10u - i);
+ BOOST_CHECK_EQUAL(r1.fetch().getBytes(), (boost::format("A_%1%") % (i+1)).str());
+ BOOST_CHECK_EQUAL(r2.available(), 5u - i);
+ BOOST_CHECK_EQUAL(r2.fetch().getBytes(), (boost::format("B_%1%") % (i+1)).str());
+ fix.session.acknowledge();
+ }
+ for (uint i = 5; i < 10; ++i) {
+ BOOST_CHECK_EQUAL(fix.session.available(), 10u - i);
+ BOOST_CHECK_EQUAL(r1.available(), 10u - i);
+ BOOST_CHECK_EQUAL(r1.fetch().getBytes(), (boost::format("A_%1%") % (i+1)).str());
+ }
+}
+
+QPID_AUTO_TEST_CASE(testPendingAck)
+{
+ QueueFixture fix;
+ Sender sender = fix.session.createSender(fix.queue);
+ for (uint i = 0; i < 10; ++i) {
+ sender.send(Message((boost::format("Message_%1%") % (i+1)).str()));
+ }
+ Receiver receiver = fix.session.createReceiver(fix.queue);
+ for (uint i = 0; i < 10; ++i) {
+ BOOST_CHECK_EQUAL(receiver.fetch().getBytes(), (boost::format("Message_%1%") % (i+1)).str());
+ }
+ BOOST_CHECK_EQUAL(fix.session.pendingAck(), 0u);
+ fix.session.acknowledge();
+ BOOST_CHECK_EQUAL(fix.session.pendingAck(), 10u);
+ fix.session.sync();
+ BOOST_CHECK_EQUAL(fix.session.pendingAck(), 0u);
+}
+
+QPID_AUTO_TEST_CASE(testPendingSend)
+{
+ QueueFixture fix;
+ Sender sender = fix.session.createSender(fix.queue);
+ for (uint i = 0; i < 10; ++i) {
+ sender.send(Message((boost::format("Message_%1%") % (i+1)).str()));
+ }
+ //Note: this test relies on 'inside knowledge' of the sender
+ //implementation and the fact that the simple test case makes it
+ //possible to predict when completion information will be sent to
+ //the client. TODO: is there a better way of testing this?
+ BOOST_CHECK_EQUAL(sender.pending(), 10u);
+ fix.session.sync();
+ BOOST_CHECK_EQUAL(sender.pending(), 0u);
+
+ Receiver receiver = fix.session.createReceiver(fix.queue);
+ for (uint i = 0; i < 10; ++i) {
+ BOOST_CHECK_EQUAL(receiver.fetch().getBytes(), (boost::format("Message_%1%") % (i+1)).str());
+ }
+ fix.session.acknowledge();
+}
+
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-broker-0-10/qpid/cpp/src/tests/PartialFailure.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/PartialFailure.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/PartialFailure.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/PartialFailure.cpp Mon Oct 5 12:51:57 2009
@@ -31,6 +31,9 @@
#include <boost/algorithm/string.hpp>
#include <boost/bind.hpp>
+namespace qpid {
+namespace tests {
+
QPID_AUTO_TEST_SUITE(PartialFailureTestSuite)
using namespace std;
@@ -257,3 +260,5 @@
#endif
#endif // FIXME aconway 2009-07-30:
QPID_AUTO_TEST_SUITE_END()
+
+}} // namespace qpid::tests
Modified: qpid/branches/java-broker-0-10/qpid/cpp/src/tests/PollableCondition.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/PollableCondition.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/PollableCondition.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/PollableCondition.cpp Mon Oct 5 12:51:57 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/branches/java-broker-0-10/qpid/cpp/src/tests/ProxyTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ProxyTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ProxyTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/ProxyTest.cpp Mon Oct 5 12:51:57 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/branches/java-broker-0-10/qpid/cpp/src/tests/QueueEvents.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/QueueEvents.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/QueueEvents.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/QueueEvents.cpp Mon Oct 5 12:51:57 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/branches/java-broker-0-10/qpid/cpp/src/tests/QueueOptionsTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/QueueOptionsTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/QueueOptionsTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/QueueOptionsTest.cpp Mon Oct 5 12:51:57 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/branches/java-broker-0-10/qpid/cpp/src/tests/QueuePolicyTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/QueuePolicyTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/QueuePolicyTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/QueuePolicyTest.cpp Mon Oct 5 12:51:57 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/branches/java-broker-0-10/qpid/cpp/src/tests/QueueRegistryTest.cpp
URL: http://svn.apache.org/viewvc/qpid/branches/java-broker-0-10/qpid/cpp/src/tests/QueueRegistryTest.cpp?rev=821779&r1=821778&r2=821779&view=diff
==============================================================================
--- qpid/branches/java-broker-0-10/qpid/cpp/src/tests/QueueRegistryTest.cpp (original)
+++ qpid/branches/java-broker-0-10/qpid/cpp/src/tests/QueueRegistryTest.cpp Mon Oct 5 12:51:57 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
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org