diff options
| author | Gordon Sim <gsim@apache.org> | 2006-12-11 10:44:03 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2006-12-11 10:44:03 +0000 |
| commit | d7c3d07b662a0e75bd6126646104d5facd917bc2 (patch) | |
| tree | 51b41e692d07135d78a22cbecd16bc1431aa6227 /qpid/cpp/tests/TxPublishTest.cpp | |
| parent | 1c314ef50aa7aa5aba1cc934fb9784597ca36987 (diff) | |
| download | qpid-python-d7c3d07b662a0e75bd6126646104d5facd917bc2.tar.gz | |
Allow xid to be associated with publication and acknowledgements.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@485594 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/tests/TxPublishTest.cpp')
| -rw-r--r-- | qpid/cpp/tests/TxPublishTest.cpp | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/qpid/cpp/tests/TxPublishTest.cpp b/qpid/cpp/tests/TxPublishTest.cpp index d33d84ec6e..3542e08f45 100644 --- a/qpid/cpp/tests/TxPublishTest.cpp +++ b/qpid/cpp/tests/TxPublishTest.cpp @@ -34,15 +34,22 @@ using namespace qpid::framing; class TxPublishTest : public CppUnit::TestCase { + struct Triple + { + string first; + Message* second; + const string* third; + }; class TestMessageStore : public NullMessageStore { public: - vector< pair<string, Message*> > enqueued; + vector<Triple> enqueued; - void enqueue(TransactionContext*, Message* const msg, const Queue& queue, const string * const /*xid*/) + void enqueue(TransactionContext*, Message* const msg, const Queue& queue, const string * const xid) { - enqueued.push_back(pair<string, Message*>(queue.getName(),msg)); + Triple args = {queue.getName(), msg, xid}; + enqueued.push_back(args); } //dont care about any of the other methods: @@ -52,6 +59,7 @@ class TxPublishTest : public CppUnit::TestCase CPPUNIT_TEST_SUITE(TxPublishTest); CPPUNIT_TEST(testPrepare); + CPPUNIT_TEST(testPrepare2pc); CPPUNIT_TEST(testCommit); CPPUNIT_TEST_SUITE_END(); @@ -61,14 +69,14 @@ class TxPublishTest : public CppUnit::TestCase Queue::shared_ptr queue2; Message::shared_ptr const msg; TxPublish op; - + string xid; public: TxPublishTest() : queue1(new Queue("queue1", false, &store, 0)), queue2(new Queue("queue2", false, &store, 0)), msg(new Message(0, "exchange", "routing_key", false, false)), - op(msg) + op(msg, &xid) { msg->setHeader(AMQHeaderBody::shared_ptr(new AMQHeaderBody(BASIC))); msg->getHeaderProperties()->setDeliveryMode(PERSISTENT); @@ -87,6 +95,15 @@ public: CPPUNIT_ASSERT_EQUAL(msg.get(), store.enqueued[1].second); } + void testPrepare2pc() + { + xid = "abcde"; + const string expected(xid); + testPrepare(); + CPPUNIT_ASSERT_EQUAL(expected, *store.enqueued[0].third); + CPPUNIT_ASSERT_EQUAL(expected, *store.enqueued[1].third); + } + void testCommit() { //ensure messages are delivered to queue |
