diff options
author | Kim van der Riet <kpvdr@apache.org> | 2012-06-08 19:09:23 +0000 |
---|---|---|
committer | Kim van der Riet <kpvdr@apache.org> | 2012-06-08 19:09:23 +0000 |
commit | 8d826b88be96ed9605fc267ccbe5be8bb8c95e76 (patch) | |
tree | 649d3a3b7631eb9b5f5dd9f62615379f198bd65d /cpp | |
parent | 4ca527d39453bcd49374c23ec01a4eacf615b650 (diff) | |
download | qpid-python-8d826b88be96ed9605fc267ccbe5be8bb8c95e76.tar.gz |
QPID-3858: WIP - tidy-up: renamed Mock* to Simple* (as the classes are not empty mocks)
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/asyncstore@1348194 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp')
21 files changed, 192 insertions, 241 deletions
diff --git a/cpp/src/tests/CMakeLists.txt b/cpp/src/tests/CMakeLists.txt index 057879a602..1d04828a49 100644 --- a/cpp/src/tests/CMakeLists.txt +++ b/cpp/src/tests/CMakeLists.txt @@ -383,12 +383,12 @@ set (asyncStorePerf_SOURCES storePerftools/asyncPerf/MessageConsumer.cpp storePerftools/asyncPerf/MessageDeque.cpp storePerftools/asyncPerf/MessageProducer.cpp - storePerftools/asyncPerf/MockPersistableMessage.cpp - storePerftools/asyncPerf/MockPersistableQueue.cpp - storePerftools/asyncPerf/MockTransactionContext.cpp storePerftools/asyncPerf/PerfTest.cpp storePerftools/asyncPerf/QueueAsyncContext.cpp storePerftools/asyncPerf/QueuedMessage.cpp + storePerftools/asyncPerf/SimplePersistableMessage.cpp + storePerftools/asyncPerf/SimplePersistableQueue.cpp + storePerftools/asyncPerf/SimpleTransactionContext.cpp storePerftools/asyncPerf/TestOptions.cpp storePerftools/asyncPerf/TestResult.cpp storePerftools/asyncPerf/TransactionAsyncContext.cpp diff --git a/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.cpp b/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.cpp index ad67bdd32f..8b14bff4f8 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.cpp @@ -29,9 +29,9 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -MessageAsyncContext::MessageAsyncContext(boost::shared_ptr<MockPersistableMessage> msg, +MessageAsyncContext::MessageAsyncContext(boost::shared_ptr<SimplePersistableMessage> msg, const qpid::asyncStore::AsyncOperation::opCode op, - boost::shared_ptr<MockPersistableQueue> q) : + boost::shared_ptr<SimplePersistableQueue> q) : m_msg(msg), m_op(op), m_q(q) @@ -55,13 +55,13 @@ MessageAsyncContext::getOpStr() const return qpid::asyncStore::AsyncOperation::getOpStr(m_op); } -boost::shared_ptr<MockPersistableMessage> +boost::shared_ptr<SimplePersistableMessage> MessageAsyncContext::getMessage() const { return m_msg; } -boost::shared_ptr<MockPersistableQueue> +boost::shared_ptr<SimplePersistableQueue> MessageAsyncContext::getQueue() const { return m_q; diff --git a/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.h b/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.h index 6b41ad9181..9d7958166e 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.h +++ b/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.h @@ -33,26 +33,26 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -class MockPersistableMessage; -class MockPersistableQueue; +class SimplePersistableMessage; +class SimplePersistableQueue; class MessageAsyncContext : public qpid::broker::BrokerAsyncContext { public: - MessageAsyncContext(boost::shared_ptr<MockPersistableMessage> msg, + MessageAsyncContext(boost::shared_ptr<SimplePersistableMessage> msg, const qpid::asyncStore::AsyncOperation::opCode op, - boost::shared_ptr<MockPersistableQueue> q); + boost::shared_ptr<SimplePersistableQueue> q); virtual ~MessageAsyncContext(); qpid::asyncStore::AsyncOperation::opCode getOpCode() const; const char* getOpStr() const; - boost::shared_ptr<MockPersistableMessage> getMessage() const; - boost::shared_ptr<MockPersistableQueue> getQueue() const; + boost::shared_ptr<SimplePersistableMessage> getMessage() const; + boost::shared_ptr<SimplePersistableQueue> getQueue() const; void destroy(); private: - boost::shared_ptr<MockPersistableMessage> m_msg; + boost::shared_ptr<SimplePersistableMessage> m_msg; const qpid::asyncStore::AsyncOperation::opCode m_op; - boost::shared_ptr<MockPersistableQueue> m_q; + boost::shared_ptr<SimplePersistableQueue> m_q; }; }}} // namespace tests::storePerftools::asyncPerf diff --git a/cpp/src/tests/storePerftools/asyncPerf/MessageConsumer.cpp b/cpp/src/tests/storePerftools/asyncPerf/MessageConsumer.cpp index 89b9b5b9b5..07baabf6d6 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MessageConsumer.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/MessageConsumer.cpp @@ -23,7 +23,7 @@ #include "MessageConsumer.h" -#include "MockPersistableQueue.h" +#include "SimplePersistableQueue.h" #include "TestOptions.h" #include <stdint.h> // uint32_t @@ -32,10 +32,10 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -class MockTransactionContext; +class SimpleTransactionContext; MessageConsumer::MessageConsumer(const TestOptions& perfTestParams, - boost::shared_ptr<MockPersistableQueue> queue) : + boost::shared_ptr<SimplePersistableQueue> queue) : m_perfTestParams(perfTestParams), m_queue(queue) {} diff --git a/cpp/src/tests/storePerftools/asyncPerf/MessageConsumer.h b/cpp/src/tests/storePerftools/asyncPerf/MessageConsumer.h index f11b605244..7f5816b6a0 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MessageConsumer.h +++ b/cpp/src/tests/storePerftools/asyncPerf/MessageConsumer.h @@ -30,21 +30,21 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -class MockPersistableQueue; +class SimplePersistableQueue; class TestOptions; class MessageConsumer { public: MessageConsumer(const TestOptions& perfTestParams, - boost::shared_ptr<MockPersistableQueue> queue); + boost::shared_ptr<SimplePersistableQueue> queue); virtual ~MessageConsumer(); void* runConsumers(); static void* startConsumers(void* ptr); private: const TestOptions& m_perfTestParams; - boost::shared_ptr<MockPersistableQueue> m_queue; + boost::shared_ptr<SimplePersistableQueue> m_queue; }; }}} // namespace tests::storePerftools::asyncPerf diff --git a/cpp/src/tests/storePerftools/asyncPerf/MessageProducer.cpp b/cpp/src/tests/storePerftools/asyncPerf/MessageProducer.cpp index 8540ff2b61..e75f773e23 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MessageProducer.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/MessageProducer.cpp @@ -23,8 +23,8 @@ #include "MessageProducer.h" -#include "MockPersistableMessage.h" -#include "MockPersistableQueue.h" +#include "SimplePersistableMessage.h" +#include "SimplePersistableQueue.h" #include "TestOptions.h" #include <stdint.h> // uint32_t @@ -33,12 +33,12 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -class MockTransactionContext; +class SimpleTransactionContext; MessageProducer::MessageProducer(const TestOptions& perfTestParams, const char* msgData, qpid::asyncStore::AsyncStoreImpl* store, - boost::shared_ptr<MockPersistableQueue> queue) : + boost::shared_ptr<SimplePersistableQueue> queue) : m_perfTestParams(perfTestParams), m_msgData(msgData), m_store(store), @@ -51,9 +51,9 @@ MessageProducer::~MessageProducer() void* MessageProducer::runProducers() { - boost::shared_ptr<MockTransactionContext> txn; + boost::shared_ptr<SimpleTransactionContext> txn; for (uint32_t numMsgs=0; numMsgs<m_perfTestParams.m_numMsgs; ++numMsgs) { - boost::shared_ptr<MockPersistableMessage> msg(new MockPersistableMessage(m_msgData, m_perfTestParams.m_msgSize, m_store)); + boost::shared_ptr<SimplePersistableMessage> msg(new SimplePersistableMessage(m_msgData, m_perfTestParams.m_msgSize, m_store)); m_queue->deliver(msg); } return 0; diff --git a/cpp/src/tests/storePerftools/asyncPerf/MessageProducer.h b/cpp/src/tests/storePerftools/asyncPerf/MessageProducer.h index 5cb6d7c5f8..746247e849 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MessageProducer.h +++ b/cpp/src/tests/storePerftools/asyncPerf/MessageProducer.h @@ -37,7 +37,7 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -class MockPersistableQueue; +class SimplePersistableQueue; class TestOptions; class MessageProducer @@ -46,7 +46,7 @@ public: MessageProducer(const TestOptions& perfTestParams, const char* msgData, qpid::asyncStore::AsyncStoreImpl* store, - boost::shared_ptr<MockPersistableQueue> queue); + boost::shared_ptr<SimplePersistableQueue> queue); virtual ~MessageProducer(); void* runProducers(); static void* startProducers(void* ptr); @@ -54,7 +54,7 @@ private: const TestOptions& m_perfTestParams; const char* m_msgData; qpid::asyncStore::AsyncStoreImpl* m_store; - boost::shared_ptr<MockPersistableQueue> m_queue; + boost::shared_ptr<SimplePersistableQueue> m_queue; }; }}} // namespace tests::storePerftools::asyncPerf diff --git a/cpp/src/tests/storePerftools/asyncPerf/PerfTest.cpp b/cpp/src/tests/storePerftools/asyncPerf/PerfTest.cpp index 0c91b29a1e..fbfebbac2b 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/PerfTest.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/PerfTest.cpp @@ -25,7 +25,7 @@ #include "MessageConsumer.h" #include "MessageProducer.h" -#include "MockPersistableQueue.h" +#include "SimplePersistableQueue.h" #include "tests/storePerftools/version.h" #include "tests/storePerftools/common/ScopedTimer.h" @@ -138,7 +138,7 @@ PerfTest::prepareQueues() for (uint16_t i = 0; i < m_testOpts.m_numQueues; ++i) { std::ostringstream qname; qname << "queue_" << std::setw(4) << std::setfill('0') << i; - boost::shared_ptr<MockPersistableQueue> mpq(new MockPersistableQueue(qname.str(), m_queueArgs, m_store, m_resultQueue)); + boost::shared_ptr<SimplePersistableQueue> mpq(new SimplePersistableQueue(qname.str(), m_queueArgs, m_store, m_resultQueue)); mpq->asyncCreate(); m_queueList.push_back(mpq); } diff --git a/cpp/src/tests/storePerftools/asyncPerf/PerfTest.h b/cpp/src/tests/storePerftools/asyncPerf/PerfTest.h index 8957d05792..e42db090d2 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/PerfTest.h +++ b/cpp/src/tests/storePerftools/asyncPerf/PerfTest.h @@ -48,7 +48,7 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -class MockPersistableQueue; +class SimplePersistableQueue; class MessageConsumer; class MessageProducer; class TestOptions; @@ -72,7 +72,7 @@ private: qpid::sys::Thread m_pollingThread; qpid::broker::AsyncResultQueueImpl m_resultQueue; qpid::asyncStore::AsyncStoreImpl* m_store; - std::deque<boost::shared_ptr<MockPersistableQueue> > m_queueList; + std::deque<boost::shared_ptr<SimplePersistableQueue> > m_queueList; std::deque<boost::shared_ptr<MessageProducer> > m_producers; std::deque<boost::shared_ptr<MessageConsumer> > m_consumers; diff --git a/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.cpp b/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.cpp index 513175ab41..a389f86739 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.cpp @@ -29,7 +29,7 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -QueueAsyncContext::QueueAsyncContext(boost::shared_ptr<MockPersistableQueue> q, +QueueAsyncContext::QueueAsyncContext(boost::shared_ptr<SimplePersistableQueue> q, const qpid::asyncStore::AsyncOperation::opCode op, qpid::broker::AsyncResultCallback rcb, qpid::broker::AsyncResultQueue* const arq) : @@ -41,8 +41,8 @@ QueueAsyncContext::QueueAsyncContext(boost::shared_ptr<MockPersistableQueue> q, assert(m_q.get() != 0); } -QueueAsyncContext::QueueAsyncContext(boost::shared_ptr<MockPersistableQueue> q, - boost::shared_ptr<MockPersistableMessage> msg, +QueueAsyncContext::QueueAsyncContext(boost::shared_ptr<SimplePersistableQueue> q, + boost::shared_ptr<SimplePersistableMessage> msg, const qpid::asyncStore::AsyncOperation::opCode op, qpid::broker::AsyncResultCallback rcb, qpid::broker::AsyncResultQueue* const arq) : @@ -71,13 +71,13 @@ QueueAsyncContext::getOpStr() const return qpid::asyncStore::AsyncOperation::getOpStr(m_op); } -boost::shared_ptr<MockPersistableQueue> +boost::shared_ptr<SimplePersistableQueue> QueueAsyncContext::getQueue() const { return m_q; } -boost::shared_ptr<MockPersistableMessage> +boost::shared_ptr<SimplePersistableMessage> QueueAsyncContext::getMessage() const { return m_msg; diff --git a/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.h b/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.h index b7a2205307..982aef3874 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.h +++ b/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.h @@ -35,34 +35,34 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -class MockPersistableMessage; -class MockPersistableQueue; +class SimplePersistableMessage; +class SimplePersistableQueue; class QueueAsyncContext: public qpid::broker::BrokerAsyncContext { public: - QueueAsyncContext(boost::shared_ptr<MockPersistableQueue> q, + QueueAsyncContext(boost::shared_ptr<SimplePersistableQueue> q, const qpid::asyncStore::AsyncOperation::opCode op, qpid::broker::AsyncResultCallback rcb, qpid::broker::AsyncResultQueue* const arq); - QueueAsyncContext(boost::shared_ptr<MockPersistableQueue> q, - boost::shared_ptr<MockPersistableMessage> msg, + QueueAsyncContext(boost::shared_ptr<SimplePersistableQueue> q, + boost::shared_ptr<SimplePersistableMessage> msg, const qpid::asyncStore::AsyncOperation::opCode op, qpid::broker::AsyncResultCallback rcb, qpid::broker::AsyncResultQueue* const arq); virtual ~QueueAsyncContext(); qpid::asyncStore::AsyncOperation::opCode getOpCode() const; const char* getOpStr() const; - boost::shared_ptr<MockPersistableQueue> getQueue() const; - boost::shared_ptr<MockPersistableMessage> getMessage() const; + boost::shared_ptr<SimplePersistableQueue> getQueue() const; + boost::shared_ptr<SimplePersistableMessage> getMessage() const; qpid::broker::AsyncResultQueue* getAsyncResultQueue() const; qpid::broker::AsyncResultCallback getAsyncResultCallback() const; void invokeCallback(const qpid::broker::AsyncResultHandle* const arh) const; void destroy(); private: - boost::shared_ptr<MockPersistableQueue> m_q; - boost::shared_ptr<MockPersistableMessage> m_msg; + boost::shared_ptr<SimplePersistableQueue> m_q; + boost::shared_ptr<SimplePersistableMessage> m_msg; const qpid::asyncStore::AsyncOperation::opCode m_op; qpid::broker::AsyncResultCallback m_rcb; qpid::broker::AsyncResultQueue* const m_arq; diff --git a/cpp/src/tests/storePerftools/asyncPerf/QueuedMessage.cpp b/cpp/src/tests/storePerftools/asyncPerf/QueuedMessage.cpp index 802279bbf9..8530051eec 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/QueuedMessage.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/QueuedMessage.cpp @@ -23,11 +23,10 @@ #include "QueuedMessage.h" -#include "MockPersistableMessage.h" -#include "MockPersistableQueue.h" +#include "SimplePersistableMessage.h" +#include "SimplePersistableQueue.h" #include "qpid/asyncStore/AsyncStoreImpl.h" -//#include "qpid/broker/EnqueueHandle.h" namespace tests { namespace storePerftools { @@ -37,8 +36,8 @@ QueuedMessage::QueuedMessage() : m_queue(0) {} -QueuedMessage::QueuedMessage(MockPersistableQueue* q, - boost::shared_ptr<MockPersistableMessage> msg) : +QueuedMessage::QueuedMessage(SimplePersistableQueue* q, + boost::shared_ptr<SimplePersistableMessage> msg) : m_queue(q), m_msg(msg), m_enqHandle(q->getStore() ? q->getStore()->createEnqueueHandle(msg->getHandle(), q->getHandle()) : qpid::broker::EnqueueHandle(0)) @@ -62,7 +61,7 @@ QueuedMessage::operator=(const QueuedMessage& rhs) return *this; } -boost::shared_ptr<MockPersistableMessage> +boost::shared_ptr<SimplePersistableMessage> QueuedMessage::payload() const { return m_msg; @@ -80,51 +79,4 @@ QueuedMessage::enqHandle() return m_enqHandle; } -/* -QueuedMessage::QueuedMessage(boost::shared_ptr<MockPersistableMessage> msg, - qpid::broker::EnqueueHandle& enqHandle, - boost::shared_ptr<MockTransactionContext> txn) : - m_msg(msg), - m_enqHandle(enqHandle), - m_txn(txn) -{ - if (txn.get()) { - txn->addEnqueuedMsg(this); - } -} - -QueuedMessage::~QueuedMessage() -{} - -boost::shared_ptr<MockPersistableMessage> -QueuedMessage::getMessage() const -{ - return m_msg; -} - -qpid::broker::EnqueueHandle -QueuedMessage::getEnqueueHandle() const -{ - return m_enqHandle; -} - -boost::shared_ptr<MockTransactionContext> -QueuedMessage::getTransactionContext() const -{ - return m_txn; -} - -bool -QueuedMessage::isTransactional() const -{ - return m_txn.get() != 0; -} - -void -QueuedMessage::clearTransaction() -{ - m_txn.reset(static_cast<MockTransactionContext*>(0)); -} -*/ - }}} // namespace tests::storePerfTools diff --git a/cpp/src/tests/storePerftools/asyncPerf/QueuedMessage.h b/cpp/src/tests/storePerftools/asyncPerf/QueuedMessage.h index f7b44e046b..b1e8a7226a 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/QueuedMessage.h +++ b/cpp/src/tests/storePerftools/asyncPerf/QueuedMessage.h @@ -32,25 +32,25 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -class MockPersistableMessage; -class MockPersistableQueue; +class SimplePersistableMessage; +class SimplePersistableQueue; class QueuedMessage { public: QueuedMessage(); - QueuedMessage(MockPersistableQueue* q, - boost::shared_ptr<MockPersistableMessage> msg); + QueuedMessage(SimplePersistableQueue* q, + boost::shared_ptr<SimplePersistableMessage> msg); QueuedMessage(const QueuedMessage& qm); ~QueuedMessage(); QueuedMessage& operator=(const QueuedMessage& rhs); - boost::shared_ptr<MockPersistableMessage> payload() const; + boost::shared_ptr<SimplePersistableMessage> payload() const; const qpid::broker::EnqueueHandle& enqHandle() const; qpid::broker::EnqueueHandle& enqHandle(); private: - MockPersistableQueue* m_queue; - boost::shared_ptr<MockPersistableMessage> m_msg; + SimplePersistableQueue* m_queue; + boost::shared_ptr<SimplePersistableMessage> m_msg; qpid::broker::EnqueueHandle m_enqHandle; }; diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.cpp b/cpp/src/tests/storePerftools/asyncPerf/SimplePersistableMessage.cpp index fc04bc746e..58aacabdcd 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/SimplePersistableMessage.cpp @@ -18,10 +18,10 @@ */ /** - * \file MockPersistableMessage.cpp + * \file SimplePersistableMessage.cpp */ -#include "MockPersistableMessage.h" +#include "SimplePersistableMessage.h" #include "qpid/asyncStore/AsyncStoreImpl.h" @@ -29,77 +29,77 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -MockPersistableMessage::MockPersistableMessage(const char* msgData, - const uint32_t msgSize, - qpid::asyncStore::AsyncStoreImpl* store) : +SimplePersistableMessage::SimplePersistableMessage(const char* msgData, + const uint32_t msgSize, + qpid::asyncStore::AsyncStoreImpl* store) : m_persistenceId(0ULL), m_msg(msgData, static_cast<size_t>(msgSize)), m_msgHandle(store ? store->createMessageHandle(this) : qpid::broker::MessageHandle(0)) {} -MockPersistableMessage::~MockPersistableMessage() +SimplePersistableMessage::~SimplePersistableMessage() {} const qpid::broker::MessageHandle& -MockPersistableMessage::getHandle() const +SimplePersistableMessage::getHandle() const { return m_msgHandle; } qpid::broker::MessageHandle& -MockPersistableMessage::getHandle() +SimplePersistableMessage::getHandle() { return m_msgHandle; } void -MockPersistableMessage::setPersistenceId(uint64_t id) const +SimplePersistableMessage::setPersistenceId(uint64_t id) const { m_persistenceId = id; } uint64_t -MockPersistableMessage::getPersistenceId() const +SimplePersistableMessage::getPersistenceId() const { return m_persistenceId; } void -MockPersistableMessage::encode(qpid::framing::Buffer& buffer) const +SimplePersistableMessage::encode(qpid::framing::Buffer& buffer) const { buffer.putRawData(m_msg); } uint32_t -MockPersistableMessage::encodedSize() const +SimplePersistableMessage::encodedSize() const { return static_cast<uint32_t>(m_msg.size()); } void -MockPersistableMessage::allDequeuesComplete() +SimplePersistableMessage::allDequeuesComplete() {} uint32_t -MockPersistableMessage::encodedHeaderSize() const +SimplePersistableMessage::encodedHeaderSize() const { return 0; } bool -MockPersistableMessage::isPersistent() const +SimplePersistableMessage::isPersistent() const { return m_msgHandle.isValid(); } uint64_t -MockPersistableMessage::getSize() +SimplePersistableMessage::getSize() { return m_msg.size(); } void -MockPersistableMessage::write(char* target) +SimplePersistableMessage::write(char* target) { ::memcpy(target, m_msg.data(), m_msg.size()); } diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.h b/cpp/src/tests/storePerftools/asyncPerf/SimplePersistableMessage.h index abaa93d3e3..f6258822ea 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.h +++ b/cpp/src/tests/storePerftools/asyncPerf/SimplePersistableMessage.h @@ -18,11 +18,11 @@ */ /** - * \file MockPersistableMessage.h + * \file SimplePersistableMessage.h */ -#ifndef tests_storePerftools_asyncPerf_MockPersistableMessage_h_ -#define tests_storePerftools_asyncPerf_MockPersistableMessage_h_ +#ifndef tests_storePerftools_asyncPerf_SimplePersistableMessage_h_ +#define tests_storePerftools_asyncPerf_SimplePersistableMessage_h_ #include "qpid/broker/AsyncStore.h" // qpid::broker::DataSource #include "qpid/broker/MessageHandle.h" @@ -39,16 +39,16 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -class MockPersistableQueue; +class SimplePersistableQueue; -class MockPersistableMessage: public qpid::broker::PersistableMessage, - public qpid::broker::DataSource +class SimplePersistableMessage: public qpid::broker::PersistableMessage, + public qpid::broker::DataSource { public: - MockPersistableMessage(const char* msgData, - const uint32_t msgSize, - qpid::asyncStore::AsyncStoreImpl* store); - virtual ~MockPersistableMessage(); + SimplePersistableMessage(const char* msgData, + const uint32_t msgSize, + qpid::asyncStore::AsyncStoreImpl* store); + virtual ~SimplePersistableMessage(); const qpid::broker::MessageHandle& getHandle() const; qpid::broker::MessageHandle& getHandle(); @@ -75,4 +75,4 @@ private: }}} // namespace tests::storePerftools::asyncPerf -#endif // tests_storePerfools_asyncPerf_MockPersistableMessage_h_ +#endif // tests_storePerftools_asyncPerf_SimplePersistableMessage_h_ diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.cpp b/cpp/src/tests/storePerftools/asyncPerf/SimplePersistableQueue.cpp index 4b22d63fe4..198c43b087 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/SimplePersistableQueue.cpp @@ -18,14 +18,14 @@ */ /** - * \file MockPersistableQueue.cpp + * \file SimplePersistableQueue.cpp */ -#include "MockPersistableQueue.h" +#include "SimplePersistableQueue.h" #include "MessageDeque.h" -#include "MockPersistableMessage.h" -#include "MockTransactionContext.h" +#include "SimplePersistableMessage.h" +#include "SimpleTransactionContext.h" #include "QueueAsyncContext.h" #include "QueuedMessage.h" @@ -36,10 +36,10 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -MockPersistableQueue::MockPersistableQueue(const std::string& name, - const qpid::framing::FieldTable& /*args*/, - qpid::asyncStore::AsyncStoreImpl* store, - qpid::broker::AsyncResultQueue& arq) : +SimplePersistableQueue::SimplePersistableQueue(const std::string& name, + const qpid::framing::FieldTable& /*args*/, + qpid::asyncStore::AsyncStoreImpl* store, + qpid::broker::AsyncResultQueue& arq) : qpid::broker::PersistableQueue(), m_name(name), m_store(store), @@ -58,7 +58,7 @@ MockPersistableQueue::MockPersistableQueue(const std::string& name, } } -MockPersistableQueue::~MockPersistableQueue() +SimplePersistableQueue::~SimplePersistableQueue() { // m_store->flush(*this); // TODO: Make destroying the store a test parameter @@ -68,7 +68,7 @@ MockPersistableQueue::~MockPersistableQueue() // static void -MockPersistableQueue::handleAsyncResult(const qpid::broker::AsyncResultHandle* const arh) +SimplePersistableQueue::handleAsyncResult(const qpid::broker::AsyncResultHandle* const arh) { if (arh) { boost::shared_ptr<QueueAsyncContext> qc = boost::dynamic_pointer_cast<QueueAsyncContext>(arh->getBrokerAsyncContext()); @@ -77,7 +77,7 @@ MockPersistableQueue::handleAsyncResult(const qpid::broker::AsyncResultHandle* c std::cerr << "Queue name=\"" << qc->getQueue()->m_name << "\": Operation " << qc->getOpStr() << ": failure " << arh->getErrNo() << " (" << arh->getErrMsg() << ")" << std::endl; } else { -//std::cout << "QQQ MockPersistableQueue::handleAsyncResult() op=" << qc->getOpStr() << std::endl << std::flush; +//std::cout << "QQQ SimplePersistableQueue::handleAsyncResult() op=" << qc->getOpStr() << std::endl << std::flush; // Handle async success here switch(qc->getOpCode()) { case qpid::asyncStore::AsyncOperation::QUEUE_CREATE: @@ -97,7 +97,7 @@ MockPersistableQueue::handleAsyncResult(const qpid::broker::AsyncResultHandle* c break; default: std::ostringstream oss; - oss << "tests::storePerftools::asyncPerf::MockPersistableQueue::handleAsyncResult(): Unknown async queue operation: " << qc->getOpCode(); + oss << "tests::storePerftools::asyncPerf::SimplePersistableQueue::handleAsyncResult(): Unknown async queue operation: " << qc->getOpCode(); throw qpid::Exception(oss.str()); }; } @@ -105,25 +105,25 @@ MockPersistableQueue::handleAsyncResult(const qpid::broker::AsyncResultHandle* c } const qpid::broker::QueueHandle& -MockPersistableQueue::getHandle() const +SimplePersistableQueue::getHandle() const { return m_queueHandle; } qpid::broker::QueueHandle& -MockPersistableQueue::getHandle() +SimplePersistableQueue::getHandle() { return m_queueHandle; } qpid::asyncStore::AsyncStoreImpl* -MockPersistableQueue::getStore() +SimplePersistableQueue::getStore() { return m_store; } void -MockPersistableQueue::asyncCreate() +SimplePersistableQueue::asyncCreate() { if (m_store) { boost::shared_ptr<QueueAsyncContext> qac(new QueueAsyncContext(shared_from_this(), @@ -138,7 +138,7 @@ MockPersistableQueue::asyncCreate() } void -MockPersistableQueue::asyncDestroy(const bool deleteQueue) +SimplePersistableQueue::asyncDestroy(const bool deleteQueue) { m_destroyPending = true; if (m_store) { @@ -156,26 +156,26 @@ MockPersistableQueue::asyncDestroy(const bool deleteQueue) } void -MockPersistableQueue::deliver(boost::shared_ptr<MockPersistableMessage> msg) +SimplePersistableQueue::deliver(boost::shared_ptr<SimplePersistableMessage> msg) { QueuedMessage qm(this, msg); - if(enqueue((MockTransactionContext*)0, qm)) { + if(enqueue((SimpleTransactionContext*)0, qm)) { push(qm); } } bool -MockPersistableQueue::dispatch() +SimplePersistableQueue::dispatch() { QueuedMessage qm; if (m_messages->consume(qm)) { - return dequeue((MockTransactionContext*)0, qm); + return dequeue((SimpleTransactionContext*)0, qm); } return false; } bool -MockPersistableQueue::enqueue(MockTransactionContext* ctxt, +SimplePersistableQueue::enqueue(SimpleTransactionContext* ctxt, QueuedMessage& qm) { ScopedUse u(m_barrier); @@ -190,7 +190,7 @@ MockPersistableQueue::enqueue(MockTransactionContext* ctxt, } bool -MockPersistableQueue::dequeue(MockTransactionContext* ctxt, +SimplePersistableQueue::dequeue(SimpleTransactionContext* ctxt, QueuedMessage& qm) { ScopedUse u(m_barrier); @@ -205,43 +205,43 @@ MockPersistableQueue::dequeue(MockTransactionContext* ctxt, } void -MockPersistableQueue::encode(qpid::framing::Buffer& buffer) const +SimplePersistableQueue::encode(qpid::framing::Buffer& buffer) const { buffer.putShortString(m_name); } uint32_t -MockPersistableQueue::encodedSize() const +SimplePersistableQueue::encodedSize() const { return m_name.size() + 1; } uint64_t -MockPersistableQueue::getPersistenceId() const +SimplePersistableQueue::getPersistenceId() const { return m_persistenceId; } void -MockPersistableQueue::setPersistenceId(uint64_t persistenceId) const +SimplePersistableQueue::setPersistenceId(uint64_t persistenceId) const { m_persistenceId = persistenceId; } void -MockPersistableQueue::flush() +SimplePersistableQueue::flush() { //if(m_store) m_store->flush(*this); } const std::string& -MockPersistableQueue::getName() const +SimplePersistableQueue::getName() const { return m_name; } void -MockPersistableQueue::setExternalQueueStore(qpid::broker::ExternalQueueStore* inst) +SimplePersistableQueue::setExternalQueueStore(qpid::broker::ExternalQueueStore* inst) { if (externalQueueStore != inst && externalQueueStore) delete externalQueueStore; @@ -249,13 +249,13 @@ MockPersistableQueue::setExternalQueueStore(qpid::broker::ExternalQueueStore* in } uint64_t -MockPersistableQueue::getSize() +SimplePersistableQueue::getSize() { return m_persistableData.size(); } void -MockPersistableQueue::write(char* target) +SimplePersistableQueue::write(char* target) { ::memcpy(target, m_persistableData.data(), m_persistableData.size()); } @@ -263,14 +263,14 @@ MockPersistableQueue::write(char* target) // --- Members & methods in msg handling path from qpid::Queue --- // protected -MockPersistableQueue::UsageBarrier::UsageBarrier(MockPersistableQueue& q) : +SimplePersistableQueue::UsageBarrier::UsageBarrier(SimplePersistableQueue& q) : m_parent(q), m_count(0) {} // protected bool -MockPersistableQueue::UsageBarrier::acquire() +SimplePersistableQueue::UsageBarrier::acquire() { qpid::sys::Monitor::ScopedLock l(m_monitor); if (m_parent.m_destroyed) { @@ -282,7 +282,7 @@ MockPersistableQueue::UsageBarrier::acquire() } // protected -void MockPersistableQueue::UsageBarrier::release() +void SimplePersistableQueue::UsageBarrier::release() { qpid::sys::Monitor::Monitor::ScopedLock l(m_monitor); if (--m_count == 0) { @@ -291,7 +291,7 @@ void MockPersistableQueue::UsageBarrier::release() } // protected -void MockPersistableQueue::UsageBarrier::destroy() +void SimplePersistableQueue::UsageBarrier::destroy() { qpid::sys::Monitor::Monitor::ScopedLock l(m_monitor); m_parent.m_destroyed = true; @@ -301,13 +301,13 @@ void MockPersistableQueue::UsageBarrier::destroy() } // protected -MockPersistableQueue::ScopedUse::ScopedUse(UsageBarrier& b) : +SimplePersistableQueue::ScopedUse::ScopedUse(UsageBarrier& b) : m_barrier(b), m_acquired(m_barrier.acquire()) {} // protected -MockPersistableQueue::ScopedUse::~ScopedUse() +SimplePersistableQueue::ScopedUse::~ScopedUse() { if (m_acquired) { m_barrier.release(); @@ -316,7 +316,7 @@ MockPersistableQueue::ScopedUse::~ScopedUse() // private void -MockPersistableQueue::push(QueuedMessage& qm, +SimplePersistableQueue::push(QueuedMessage& qm, bool /*isRecovery*/) { QueuedMessage removed; @@ -327,7 +327,7 @@ MockPersistableQueue::push(QueuedMessage& qm, // private bool -MockPersistableQueue::asyncEnqueue(MockTransactionContext* txn, +SimplePersistableQueue::asyncEnqueue(SimpleTransactionContext* txn, QueuedMessage& qm) { qm.payload()->setPersistenceId(m_store->getNextRid()); @@ -346,7 +346,7 @@ MockPersistableQueue::asyncEnqueue(MockTransactionContext* txn, // private bool -MockPersistableQueue::asyncDequeue(MockTransactionContext* txn, +SimplePersistableQueue::asyncDequeue(SimpleTransactionContext* txn, QueuedMessage& qm) { //std::cout << "QQQ Queue=\"" << m_name << "\": asyncDequeue() rid=0x" << std::hex << qm.payload()->getPersistenceId() << std::dec << std::endl << std::flush; @@ -364,7 +364,7 @@ MockPersistableQueue::asyncDequeue(MockTransactionContext* txn, // private void -MockPersistableQueue::destroyCheck(const std::string& opDescr) const +SimplePersistableQueue::destroyCheck(const std::string& opDescr) const { if (m_destroyPending || m_destroyed) { std::ostringstream oss; @@ -375,7 +375,7 @@ MockPersistableQueue::destroyCheck(const std::string& opDescr) const // private void -MockPersistableQueue::createComplete(const boost::shared_ptr<QueueAsyncContext> qc) +SimplePersistableQueue::createComplete(const boost::shared_ptr<QueueAsyncContext> qc) { //std::cout << "QQQ Queue name=\"" << qc->getQueue()->getName() << "\": createComplete()" << std::endl << std::flush; assert(qc->getQueue().get() == this); @@ -384,7 +384,7 @@ MockPersistableQueue::createComplete(const boost::shared_ptr<QueueAsyncContext> // private void -MockPersistableQueue::flushComplete(const boost::shared_ptr<QueueAsyncContext> qc) +SimplePersistableQueue::flushComplete(const boost::shared_ptr<QueueAsyncContext> qc) { //std::cout << "QQQ Queue name=\"" << qc->getQueue()->getName() << "\": flushComplete()" << std::endl << std::flush; assert(qc->getQueue().get() == this); @@ -393,7 +393,7 @@ MockPersistableQueue::flushComplete(const boost::shared_ptr<QueueAsyncContext> q // private void -MockPersistableQueue::destroyComplete(const boost::shared_ptr<QueueAsyncContext> qc) +SimplePersistableQueue::destroyComplete(const boost::shared_ptr<QueueAsyncContext> qc) { //std::cout << "QQQ Queue name=\"" << qc->getQueue()->getName() << "\": destroyComplete()" << std::endl << std::flush; assert(qc->getQueue().get() == this); @@ -403,7 +403,7 @@ MockPersistableQueue::destroyComplete(const boost::shared_ptr<QueueAsyncContext> // private void -MockPersistableQueue::enqueueComplete(const boost::shared_ptr<QueueAsyncContext> qc) +SimplePersistableQueue::enqueueComplete(const boost::shared_ptr<QueueAsyncContext> qc) { //std::cout << "QQQ Queue name=\"" << qc->getQueue()->getName() << "\": enqueueComplete() rid=0x" << std::hex << qc->getMessage()->getPersistenceId() << std::dec << std::endl << std::flush; assert(qc->getQueue().get() == this); @@ -412,7 +412,7 @@ MockPersistableQueue::enqueueComplete(const boost::shared_ptr<QueueAsyncContext> // private void -MockPersistableQueue::dequeueComplete(const boost::shared_ptr<QueueAsyncContext> qc) +SimplePersistableQueue::dequeueComplete(const boost::shared_ptr<QueueAsyncContext> qc) { //std::cout << "QQQ Queue name=\"" << qc->getQueue()->getName() << "\": dequeueComplete() rid=0x" << std::hex << qc->getMessage()->getPersistenceId() << std::dec << std::endl << std::flush; assert(qc->getQueue().get() == this); diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.h b/cpp/src/tests/storePerftools/asyncPerf/SimplePersistableQueue.h index 860d98b867..1366c7772b 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.h +++ b/cpp/src/tests/storePerftools/asyncPerf/SimplePersistableQueue.h @@ -18,11 +18,11 @@ */ /** - * \file MockPersistableQueue.h + * \file SimplePersistableQueue.h */ -#ifndef tests_storePerftools_asyncPerf_MockPersistableQueue_h_ -#define tests_storePerftools_asyncPerf_MockPersistableQueue_h_ +#ifndef tests_storePerftools_asyncPerf_SimplePersistableQueue_h_ +#define tests_storePerftools_asyncPerf_SimplePersistableQueue_h_ #include "AtomicCounter.h" // AsyncOpCounter @@ -50,22 +50,21 @@ namespace storePerftools { namespace asyncPerf { class Messages; -class MockPersistableMessage; -class MockPersistableQueue; -class MockTransactionContext; +class SimplePersistableMessage; +class SimpleTransactionContext; class QueueAsyncContext; class QueuedMessage; -class MockPersistableQueue : public boost::enable_shared_from_this<MockPersistableQueue>, - public qpid::broker::PersistableQueue, - public qpid::broker::DataSource +class SimplePersistableQueue : public boost::enable_shared_from_this<SimplePersistableQueue>, + public qpid::broker::PersistableQueue, + public qpid::broker::DataSource { public: - MockPersistableQueue(const std::string& name, + SimplePersistableQueue(const std::string& name, const qpid::framing::FieldTable& args, qpid::asyncStore::AsyncStoreImpl* store, qpid::broker::AsyncResultQueue& arq); - virtual ~MockPersistableQueue(); + virtual ~SimplePersistableQueue(); static void handleAsyncResult(const qpid::broker::AsyncResultHandle* const res); const qpid::broker::QueueHandle& getHandle() const; @@ -76,11 +75,11 @@ public: void asyncDestroy(const bool deleteQueue); // --- Methods in msg handling path from qpid::Queue --- - void deliver(boost::shared_ptr<MockPersistableMessage> msg); + void deliver(boost::shared_ptr<SimplePersistableMessage> msg); bool dispatch(); // similar to qpid::broker::Queue::distpatch(Consumer&) but without Consumer param - bool enqueue(MockTransactionContext* ctxt, + bool enqueue(SimpleTransactionContext* ctxt, QueuedMessage& qm); - bool dequeue(MockTransactionContext* ctxt, + bool dequeue(SimpleTransactionContext* ctxt, QueuedMessage& qm); // --- Interface qpid::broker::Persistable --- @@ -112,10 +111,10 @@ private: // --- Members & methods in msg handling path copied from qpid::Queue --- struct UsageBarrier { - MockPersistableQueue& m_parent; + SimplePersistableQueue& m_parent; uint32_t m_count; qpid::sys::Monitor m_monitor; - UsageBarrier(MockPersistableQueue& q); + UsageBarrier(SimplePersistableQueue& q); bool acquire(); void release(); void destroy(); @@ -133,9 +132,9 @@ private: bool isRecovery = false); // -- Async ops --- - bool asyncEnqueue(MockTransactionContext* txn, + bool asyncEnqueue(SimpleTransactionContext* txn, QueuedMessage& qm); - bool asyncDequeue(MockTransactionContext* txn, + bool asyncDequeue(SimpleTransactionContext* txn, QueuedMessage& qm); // --- Async op counter --- @@ -151,4 +150,4 @@ private: }}} // namespace tests::storePerftools::asyncPerf -#endif // tests_storePerftools_asyncPerf_MockPersistableQueue_h_ +#endif // tests_storePerftools_asyncPerf_SimplePersistableQueue_h_ diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.cpp b/cpp/src/tests/storePerftools/asyncPerf/SimpleTransactionContext.cpp index 7e0db4a154..2aea14bc21 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/SimpleTransactionContext.cpp @@ -18,10 +18,10 @@ */ /** - * \file MockTransactionContext.cpp + * \file SimpleTransactionContext.cpp */ -#include "MockTransactionContext.h" +#include "SimpleTransactionContext.h" #include "TransactionAsyncContext.h" @@ -33,7 +33,7 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -MockTransactionContext::MockTransactionContext(const std::string& xid) : +SimpleTransactionContext::SimpleTransactionContext(const std::string& xid) : qpid::broker::TransactionContext(), m_xid(xid), m_tpcFlag(!xid.empty()), @@ -48,8 +48,8 @@ MockTransactionContext::MockTransactionContext(const std::string& xid) : //std::cout << "*TXN* begin: xid=" << getXid() << "; 2PC=" << (is2pc()?"T":"F") << std::endl; } -MockTransactionContext::MockTransactionContext(qpid::asyncStore::AsyncStoreImpl* store, - const std::string& xid) : +SimpleTransactionContext::SimpleTransactionContext(qpid::asyncStore::AsyncStoreImpl* store, + const std::string& xid) : m_store(store), m_prepared(false), m_enqueuedMsgs() @@ -60,14 +60,14 @@ MockTransactionContext::MockTransactionContext(qpid::asyncStore::AsyncStoreImpl* } } -MockTransactionContext::~MockTransactionContext() +SimpleTransactionContext::~SimpleTransactionContext() {} // static /* void -MockTransactionContext::handleAsyncResult(const qpid::broker::AsyncResult* res, - qpid::broker::BrokerAsyncContext* bc) +SimpleTransactionContext::handleAsyncResult(const qpid::broker::AsyncResult* res, + qpid::broker::BrokerAsyncContext* bc) { if (bc && res) { TransactionAsyncContext* tac = dynamic_cast<TransactionAsyncContext*>(bc); @@ -89,7 +89,7 @@ MockTransactionContext::handleAsyncResult(const qpid::broker::AsyncResult* res, break; default: std::ostringstream oss; - oss << "tests::storePerftools::asyncPerf::MockTransactionContext::handleAsyncResult(): Unknown async operation: " << tac->getOpCode(); + oss << "tests::storePerftools::asyncPerf::SimpleTransactionContext::handleAsyncResult(): Unknown async operation: " << tac->getOpCode(); throw qpid::Exception(oss.str()); }; } @@ -100,51 +100,51 @@ MockTransactionContext::handleAsyncResult(const qpid::broker::AsyncResult* res, */ const qpid::broker::TxnHandle& -MockTransactionContext::getHandle() const +SimpleTransactionContext::getHandle() const { return m_txnHandle; } qpid::broker::TxnHandle& -MockTransactionContext::getHandle() +SimpleTransactionContext::getHandle() { return m_txnHandle; } bool -MockTransactionContext::is2pc() const +SimpleTransactionContext::is2pc() const { return m_tpcFlag; } const std::string& -MockTransactionContext::getXid() const +SimpleTransactionContext::getXid() const { return m_xid; } void -MockTransactionContext::addEnqueuedMsg(QueuedMessage* qm) +SimpleTransactionContext::addEnqueuedMsg(QueuedMessage* qm) { qpid::sys::ScopedLock<qpid::sys::Mutex> l(m_enqueuedMsgsMutex); m_enqueuedMsgs.push_back(qm); } void -MockTransactionContext::prepare() +SimpleTransactionContext::prepare() { if (m_tpcFlag) { localPrepare(); m_prepared = true; } std::ostringstream oss; - oss << "MockTransactionContext::prepare(): xid=\"" << getXid() + oss << "SimpleTransactionContext::prepare(): xid=\"" << getXid() << "\": Transaction Error: called prepare() on local transaction"; throw qpid::Exception(oss.str()); } void -MockTransactionContext::abort() +SimpleTransactionContext::abort() { // TODO: Check the following XA transaction semantics: // Assuming 2PC aborts can occur without a prepare. Do local prepare if not already prepared. @@ -160,12 +160,12 @@ MockTransactionContext::abort() } void -MockTransactionContext::commit() +SimpleTransactionContext::commit() { if (is2pc()) { if (!m_prepared) { std::ostringstream oss; - oss << "MockTransactionContext::abort(): xid=\"" << getXid() + oss << "SimpleTransactionContext::abort(): xid=\"" << getXid() << "\": Transaction Error: called commit() without prepare() on 2PC transaction"; throw qpid::Exception(oss.str()); } @@ -183,7 +183,7 @@ MockTransactionContext::commit() // private void -MockTransactionContext::localPrepare() +SimpleTransactionContext::localPrepare() { if (m_store != 0) { // m_store->submitPrepare(m_txnHandle, @@ -195,7 +195,7 @@ MockTransactionContext::localPrepare() // private void -MockTransactionContext::setLocalXid() +SimpleTransactionContext::setLocalXid() { uuid_t uuid; // TODO: Valgrind warning: Possible race condition in uuid_generate_random() - is it thread-safe, and if not, does it matter? @@ -208,7 +208,7 @@ MockTransactionContext::setLocalXid() // private void -MockTransactionContext::prepareComplete(const TransactionAsyncContext* /*tc*/) +SimpleTransactionContext::prepareComplete(const TransactionAsyncContext* /*tc*/) { qpid::sys::ScopedLock<qpid::sys::Mutex> l(m_enqueuedMsgsMutex); // while (!m_enqueuedMsgs.empty()) { @@ -222,7 +222,7 @@ MockTransactionContext::prepareComplete(const TransactionAsyncContext* /*tc*/) // private void -MockTransactionContext::abortComplete(const TransactionAsyncContext* tc) +SimpleTransactionContext::abortComplete(const TransactionAsyncContext* tc) { //std::cout << "~~~~~ Transaction xid=\"" << tc->m_tc->getXid() << "\": abortComplete()" << std::endl << std::flush; assert(tc->getTransactionContext().get() == this); @@ -231,7 +231,7 @@ MockTransactionContext::abortComplete(const TransactionAsyncContext* tc) // private void -MockTransactionContext::commitComplete(const TransactionAsyncContext* tc) +SimpleTransactionContext::commitComplete(const TransactionAsyncContext* tc) { //std::cout << "~~~~~ Transaction xid=\"" << tc->m_tc->getXid() << "\": commitComplete()" << std::endl << std::flush; assert(tc->getTransactionContext().get() == this); diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.h b/cpp/src/tests/storePerftools/asyncPerf/SimpleTransactionContext.h index c57a37e084..49fee9c720 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.h +++ b/cpp/src/tests/storePerftools/asyncPerf/SimpleTransactionContext.h @@ -18,11 +18,11 @@ */ /** - * \file MockTransactionContext.h + * \file SimpleTransactionContext.h */ -#ifndef tests_storePerftools_asyncPerf_MockTransactionContext_h_ -#define tests_storePerftools_asyncPerf_MockTransactionContext_h_ +#ifndef tests_storePerftools_asyncPerf_SimpleTransactionContext_h_ +#define tests_storePerftools_asyncPerf_SimpleTransactionContext_h_ #include "qpid/broker/TransactionalStore.h" // qpid::broker::TransactionContext #include "qpid/broker/TxnHandle.h" @@ -46,13 +46,13 @@ namespace asyncPerf { class QueuedMessage; class TransactionAsyncContext; -class MockTransactionContext : public qpid::broker::TransactionContext +class SimpleTransactionContext : public qpid::broker::TransactionContext { public: - MockTransactionContext(const std::string& xid = std::string()); - MockTransactionContext(qpid::asyncStore::AsyncStoreImpl* store, - const std::string& xid = std::string()); - virtual ~MockTransactionContext(); + SimpleTransactionContext(const std::string& xid = std::string()); + SimpleTransactionContext(qpid::asyncStore::AsyncStoreImpl* store, + const std::string& xid = std::string()); + virtual ~SimpleTransactionContext(); // static void handleAsyncResult(const qpid::broker::AsyncResult* res, // qpid::broker::BrokerAsyncContext* bc); @@ -87,4 +87,4 @@ private: }}} // namespace tests:storePerftools::asyncPerf -#endif // tests_storePerftools_asyncPerf_MockTransactionContext_h_ +#endif // tests_storePerftools_asyncPerf_SimpleTransactionContext_h_ diff --git a/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.cpp b/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.cpp index 51a5791403..f150a34027 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.cpp @@ -29,7 +29,7 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -TransactionAsyncContext::TransactionAsyncContext(boost::shared_ptr<MockTransactionContext> tc, +TransactionAsyncContext::TransactionAsyncContext(boost::shared_ptr<SimpleTransactionContext> tc, const qpid::asyncStore::AsyncOperation::opCode op): m_tc(tc), m_op(op) @@ -52,7 +52,7 @@ TransactionAsyncContext::getOpStr() const return qpid::asyncStore::AsyncOperation::getOpStr(m_op); } -boost::shared_ptr<MockTransactionContext> +boost::shared_ptr<SimpleTransactionContext> TransactionAsyncContext::getTransactionContext() const { return m_tc; diff --git a/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.h b/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.h index b1e74d6844..186a8141cf 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.h +++ b/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.h @@ -33,21 +33,21 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -class MockTransactionContext; +class SimpleTransactionContext; class TransactionAsyncContext: public qpid::broker::BrokerAsyncContext { public: - TransactionAsyncContext(boost::shared_ptr<MockTransactionContext> tc, + TransactionAsyncContext(boost::shared_ptr<SimpleTransactionContext> tc, const qpid::asyncStore::AsyncOperation::opCode op); virtual ~TransactionAsyncContext(); qpid::asyncStore::AsyncOperation::opCode getOpCode() const; const char* getOpStr() const; - boost::shared_ptr<MockTransactionContext> getTransactionContext() const; + boost::shared_ptr<SimpleTransactionContext> getTransactionContext() const; void destroy(); private: - boost::shared_ptr<MockTransactionContext> m_tc; + boost::shared_ptr<SimpleTransactionContext> m_tc; const qpid::asyncStore::AsyncOperation::opCode m_op; }; |