summaryrefslogtreecommitdiff
path: root/qpid/cpp/tests/TxPublishTest.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2007-03-30 15:50:07 +0000
committerGordon Sim <gsim@apache.org>2007-03-30 15:50:07 +0000
commit72bca07ee53fb9476f268133f244d55d8f53d3b9 (patch)
tree6e8400200b22188899144a025ecb1a6c5922cc7b /qpid/cpp/tests/TxPublishTest.cpp
parent61c7761f005dacfc5938a4d4d25b7120a8e21620 (diff)
downloadqpid-python-72bca07ee53fb9476f268133f244d55d8f53d3b9.tar.gz
Refactored the MessageStore interface to restrict visibility of broker core from store implementations.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@524139 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/tests/TxPublishTest.cpp')
-rw-r--r--qpid/cpp/tests/TxPublishTest.cpp31
1 files changed, 7 insertions, 24 deletions
diff --git a/qpid/cpp/tests/TxPublishTest.cpp b/qpid/cpp/tests/TxPublishTest.cpp
index d9d5607c06..8ce0da6508 100644
--- a/qpid/cpp/tests/TxPublishTest.cpp
+++ b/qpid/cpp/tests/TxPublishTest.cpp
@@ -35,22 +35,16 @@ using namespace qpid::framing;
class TxPublishTest : public CppUnit::TestCase
{
- struct Triple
- {
- string first;
- Message* second;
- const string* third;
- };
+ typedef std::pair<string, PersistableMessage*> msg_queue_pair;
class TestMessageStore : public NullMessageStore
{
public:
- vector<Triple> enqueued;
+ vector<msg_queue_pair> enqueued;
- void enqueue(TransactionContext*, Message* const msg, const Queue& queue, const string * const xid)
+ void enqueue(TransactionContext*, PersistableMessage& msg, const PersistableQueue& queue)
{
- Triple args = {queue.getName(), msg, xid};
- enqueued.push_back(args);
+ enqueued.push_back(msg_queue_pair(queue.getName(), &msg));
}
//dont care about any of the other methods:
@@ -60,7 +54,6 @@ class TxPublishTest : public CppUnit::TestCase
CPPUNIT_TEST_SUITE(TxPublishTest);
CPPUNIT_TEST(testPrepare);
- CPPUNIT_TEST(testPrepare2pc);
CPPUNIT_TEST(testCommit);
CPPUNIT_TEST_SUITE_END();
@@ -70,7 +63,6 @@ class TxPublishTest : public CppUnit::TestCase
Queue::shared_ptr queue2;
Message::shared_ptr const msg;
TxPublish op;
- string xid;
public:
@@ -79,7 +71,7 @@ public:
queue2(new Queue("queue2", false, &store, 0)),
msg(new BasicMessage(0, "exchange", "routing_key", false, false,
MockChannel::basicGetBody())),
- op(msg, &xid)
+ op(msg)
{
msg->setHeader(AMQHeaderBody::shared_ptr(new AMQHeaderBody(BASIC)));
msg->getHeaderProperties()->setDeliveryMode(PERSISTENT);
@@ -93,18 +85,9 @@ public:
op.prepare(0);
CPPUNIT_ASSERT_EQUAL((size_t) 2, store.enqueued.size());
CPPUNIT_ASSERT_EQUAL(string("queue1"), store.enqueued[0].first);
- CPPUNIT_ASSERT_EQUAL(msg.get(), store.enqueued[0].second);
+ CPPUNIT_ASSERT_EQUAL((PersistableMessage*) msg.get(), store.enqueued[0].second);
CPPUNIT_ASSERT_EQUAL(string("queue2"), store.enqueued[1].first);
- 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);
+ CPPUNIT_ASSERT_EQUAL((PersistableMessage*) msg.get(), store.enqueued[1].second);
}
void testCommit()