diff options
Diffstat (limited to 'cpp/src/tests')
13 files changed, 53 insertions, 100 deletions
diff --git a/cpp/src/tests/CMakeLists.txt b/cpp/src/tests/CMakeLists.txt index c9b4538b1d..2bce8c058e 100644 --- a/cpp/src/tests/CMakeLists.txt +++ b/cpp/src/tests/CMakeLists.txt @@ -379,12 +379,12 @@ endif (UNIX) # Async store perf test (asyncPerf) set (asyncStorePerf_SOURCES - storePerftools/asyncPerf/MessageContext.cpp + storePerftools/asyncPerf/MessageAsyncContext.cpp storePerftools/asyncPerf/MockPersistableMessage.cpp storePerftools/asyncPerf/MockPersistableQueue.cpp storePerftools/asyncPerf/MockTransactionContext.cpp storePerftools/asyncPerf/PerfTest.cpp - storePerftools/asyncPerf/QueueContext.cpp + storePerftools/asyncPerf/QueueAsyncContext.cpp storePerftools/asyncPerf/QueuedMessage.cpp storePerftools/asyncPerf/TestOptions.cpp storePerftools/asyncPerf/TestResult.cpp diff --git a/cpp/src/tests/storePerftools/asyncPerf/MessageContext.cpp b/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.cpp index 3d18213c7d..d88b6570a1 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MessageContext.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.cpp @@ -21,7 +21,7 @@ * \file MessageContext.cpp */ -#include "MessageContext.h" +#include "MessageAsyncContext.h" namespace tests { namespace storePerftools { diff --git a/cpp/src/tests/storePerftools/asyncPerf/MessageContext.h b/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.h index 49a00fa356..3a47b4dbe8 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MessageContext.h +++ b/cpp/src/tests/storePerftools/asyncPerf/MessageAsyncContext.h @@ -26,11 +26,14 @@ #include "MockPersistableMessage.h" +#include "qpid/asyncStore/AsyncOperation.h" +#include "qpid/broker/BrokerAsyncContext.h" + namespace tests { namespace storePerftools { namespace asyncPerf { -class MessageContext : public qpid::broker::BrokerContext +class MessageContext : public qpid::broker::BrokerAsyncContext { public: MessageContext(MockPersistableMessage::shared_ptr msg, diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.cpp b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.cpp index 564d133c76..e89a98d02d 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.cpp @@ -23,7 +23,7 @@ #include "MockPersistableMessage.h" -#include "MessageContext.h" +#include "MessageAsyncContext.h" #include "MockPersistableQueue.h" // debug statements in enqueueComplete() and dequeueComplete() #include "qpid/asyncStore/AsyncStoreImpl.h" @@ -48,7 +48,7 @@ MockPersistableMessage::~MockPersistableMessage() // static void MockPersistableMessage::handleAsyncResult(const qpid::broker::AsyncResult* res, - qpid::broker::BrokerContext* bc) + qpid::broker::BrokerAsyncContext* bc) { if (bc) { MessageContext* mc = dynamic_cast<MessageContext*>(bc); diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.h b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.h index 83ef189f9e..c98bb8e843 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.h +++ b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableMessage.h @@ -24,14 +24,10 @@ #ifndef tests_storePerftools_asyncPerf_MockPersistableMessage_h_ #define tests_storePerftools_asyncPerf_MockPersistableMessage_h_ -#include "qpid/asyncStore/AsyncOperation.h" #include "qpid/broker/AsyncStore.h" // qpid::broker::DataSource -#include "qpid/broker/BrokerContext.h" #include "qpid/broker/MessageHandle.h" #include "qpid/broker/PersistableMessage.h" -#include <stdint.h> // uint32_t - namespace qpid { namespace asyncStore { class AsyncStoreImpl; @@ -44,7 +40,7 @@ namespace asyncPerf { class MessageContext; class MockPersistableQueue; -class MockPersistableMessage: public qpid::broker::PersistableMessage, qpid::broker::DataSource +class MockPersistableMessage: public qpid::broker::PersistableMessage, public qpid::broker::DataSource { public: typedef boost::shared_ptr<MockPersistableMessage> shared_ptr; @@ -55,7 +51,7 @@ public: const bool persistent = true); virtual ~MockPersistableMessage(); static void handleAsyncResult(const qpid::broker::AsyncResult* res, - qpid::broker::BrokerContext* bc); + qpid::broker::BrokerAsyncContext* bc); qpid::broker::MessageHandle& getHandle(); // Interface Persistable diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.cpp b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.cpp index e607649cc7..ede0830045 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.cpp @@ -23,14 +23,15 @@ #include "MockPersistableQueue.h" -#include "MessageContext.h" +#include "MessageAsyncContext.h" #include "MockPersistableMessage.h" #include "MockTransactionContext.h" -#include "QueueContext.h" +#include "QueueAsyncContext.h" #include "QueuedMessage.h" #include "TestOptions.h" #include "qpid/asyncStore/AsyncStoreImpl.h" +#include "qpid/broker/BrokerAsyncContext.h" #include "qpid/broker/EnqueueHandle.h" namespace tests { @@ -65,10 +66,10 @@ MockPersistableQueue::~MockPersistableQueue() // static void MockPersistableQueue::handleAsyncResult(const qpid::broker::AsyncResult* res, - qpid::broker::BrokerContext* bc) + qpid::broker::BrokerAsyncContext* bc) { if (bc && res) { - QueueContext* qc = dynamic_cast<QueueContext*>(bc); + QueueAsyncContext* qc = dynamic_cast<QueueAsyncContext*>(bc); if (res->errNo) { // TODO: Handle async failure here std::cerr << "Queue name=\"" << qc->getQueue()->m_name << "\": Operation " << qc->getOpStr() << ": failure " @@ -108,7 +109,7 @@ MockPersistableQueue::asyncStoreCreate() m_store->submitCreate(m_queueHandle, this, &handleAsyncResult, - new QueueContext(this, qpid::asyncStore::AsyncOperation::QUEUE_CREATE)); + new QueueAsyncContext(this, qpid::asyncStore::AsyncOperation::QUEUE_CREATE)); } void @@ -116,7 +117,7 @@ MockPersistableQueue::asyncStoreDestroy() { m_store->submitDestroy(m_queueHandle, &handleAsyncResult, - new QueueContext(this, qpid::asyncStore::AsyncOperation::QUEUE_DESTROY)); + new QueueAsyncContext(this, qpid::asyncStore::AsyncOperation::QUEUE_DESTROY)); } void* @@ -140,11 +141,11 @@ MockPersistableQueue::runEnqueues() m_store->submitEnqueue(enqHandle, txn->getHandle(), &MockPersistableMessage::handleAsyncResult, - dynamic_cast<qpid::broker::BrokerContext*>(msgCtxt)); + dynamic_cast<qpid::broker::BrokerAsyncContext*>(msgCtxt)); } else { m_store->submitEnqueue(enqHandle, &MockPersistableMessage::handleAsyncResult, - dynamic_cast<qpid::broker::BrokerContext*>(msgCtxt)); + dynamic_cast<qpid::broker::BrokerAsyncContext*>(msgCtxt)); } QueuedMessagePtr qm(new QueuedMessage(msg, enqHandle, txn)); push(qm); @@ -177,7 +178,7 @@ MockPersistableQueue::runDequeues() pop(qm); if (qm.get()) { qpid::broker::EnqueueHandle enqHandle = qm->getEnqueueHandle(); - qpid::broker::BrokerContext* bc = new MessageContext(qm->getMessage(), + qpid::broker::BrokerAsyncContext* bc = new MessageContext(qm->getMessage(), qpid::asyncStore::AsyncOperation::MSG_DEQUEUE, this); if (useTxn) { @@ -277,7 +278,7 @@ MockPersistableQueue::write(char* target) // protected void -MockPersistableQueue::createComplete(const QueueContext* qc) +MockPersistableQueue::createComplete(const QueueAsyncContext* qc) { //std::cout << "~~~~~ Queue name=\"" << qc->m_q->getName() << "\": createComplete()" << std::endl << std::flush; assert(qc->getQueue().get() == this); @@ -285,7 +286,7 @@ MockPersistableQueue::createComplete(const QueueContext* qc) // protected void -MockPersistableQueue::flushComplete(const QueueContext* qc) +MockPersistableQueue::flushComplete(const QueueAsyncContext* qc) { //std::cout << "~~~~~ Queue name=\"" << qc->m_q->getName() << "\": flushComplete()" << std::endl << std::flush; assert(qc->getQueue().get() == this); @@ -293,7 +294,7 @@ MockPersistableQueue::flushComplete(const QueueContext* qc) // protected void -MockPersistableQueue::destroyComplete(const QueueContext* qc) +MockPersistableQueue::destroyComplete(const QueueAsyncContext* qc) { //std::cout << "~~~~~ Queue name=\"" << qc->m_q->getName() << "\": destroyComplete()" << 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/MockPersistableQueue.h index 3867cad08d..2d7b1f1c4e 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.h +++ b/cpp/src/tests/storePerftools/asyncPerf/MockPersistableQueue.h @@ -24,16 +24,13 @@ #ifndef tests_storePerftools_asyncPerf_MockPersistableQueue_h_ #define tests_storePerftools_asyncPerf_MockPersistableQueue_h_ -#include "qpid/asyncStore/AsyncOperation.h" #include "qpid/broker/AsyncStore.h" // qpid::broker::DataSource -#include "qpid/broker/BrokerContext.h" #include "qpid/broker/PersistableQueue.h" #include "qpid/broker/QueueHandle.h" #include "qpid/sys/Condition.h" #include "qpid/sys/Mutex.h" #include <boost/intrusive_ptr.hpp> -#include <boost/shared_ptr.hpp> #include <deque> namespace qpid { @@ -48,7 +45,7 @@ namespace tests { namespace storePerftools { namespace asyncPerf { -class QueueContext; +class QueueAsyncContext; class QueuedMessage; class TestOptions; @@ -68,7 +65,7 @@ public: // --- Async functionality --- static void handleAsyncResult(const qpid::broker::AsyncResult* res, - qpid::broker::BrokerContext* bc); + qpid::broker::BrokerAsyncContext* bc); qpid::broker::QueueHandle& getHandle(); void asyncStoreCreate(); void asyncStoreDestroy(); @@ -112,9 +109,9 @@ protected: qpid::sys::Condition m_dequeueCondition; // --- Ascnc op completions (called through handleAsyncResult) --- - void createComplete(const QueueContext* qc); - void flushComplete(const QueueContext* qc); - void destroyComplete(const QueueContext* qc); + void createComplete(const QueueAsyncContext* qc); + void flushComplete(const QueueAsyncContext* qc); + void destroyComplete(const QueueAsyncContext* qc); // --- Queue functionality --- void push(QueuedMessagePtr& msg); diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.cpp b/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.cpp index b1a375f04c..05f06e95a1 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.cpp @@ -27,39 +27,12 @@ #include "TransactionAsyncContext.h" #include "qpid/asyncStore/AsyncStoreImpl.h" +#include "qpid/broker/BrokerAsyncContext.h" namespace tests { namespace storePerftools { namespace asyncPerf { -// --- Inner class MockTransactionContext::QueueContext --- - -/* -MockTransactionContext::TransactionContext::TransactionContext(MockTransactionContext* tc, - const qpid::asyncStore::AsyncOperation::opCode op) : - m_tc(tc), - m_op(op) -{} - -MockTransactionContext::TransactionContext::~TransactionContext() -{} - -const char* -MockTransactionContext::TransactionContext::getOp() const -{ - return qpid::asyncStore::AsyncOperation::getOpStr(m_op); -} - -void -MockTransactionContext::TransactionContext::destroy() -{ - delete this; -} -*/ - -// --- Class MockTransactionContext --- - - MockTransactionContext::MockTransactionContext(qpid::asyncStore::AsyncStoreImpl* store, const std::string& xid) : m_store(store), @@ -76,7 +49,7 @@ MockTransactionContext::~MockTransactionContext() // static void MockTransactionContext::handleAsyncResult(const qpid::broker::AsyncResult* res, - qpid::broker::BrokerContext* bc) + qpid::broker::BrokerAsyncContext* bc) { if (bc && res) { TransactionAsyncContext* tac = dynamic_cast<TransactionAsyncContext*>(bc); @@ -155,7 +128,7 @@ MockTransactionContext::abort() } m_store->submitAbort(m_txnHandle, &handleAsyncResult, - dynamic_cast<qpid::broker::BrokerContext*>(new TransactionAsyncContext(this, qpid::asyncStore::AsyncOperation::TXN_ABORT))); + dynamic_cast<qpid::broker::BrokerAsyncContext*>(new TransactionAsyncContext(this, qpid::asyncStore::AsyncOperation::TXN_ABORT))); //std::cout << "*TXN* abort: xid=" << m_txnHandle.getXid() << "; 2PC=" << (m_txnHandle.is2pc()?"T":"F") << std::endl; } @@ -174,7 +147,7 @@ MockTransactionContext::commit() } m_store->submitCommit(m_txnHandle, &handleAsyncResult, - dynamic_cast<qpid::broker::BrokerContext*>(new TransactionAsyncContext(this, qpid::asyncStore::AsyncOperation::TXN_COMMIT))); + dynamic_cast<qpid::broker::BrokerAsyncContext*>(new TransactionAsyncContext(this, qpid::asyncStore::AsyncOperation::TXN_COMMIT))); //std::cout << "*TXN* commit: xid=" << m_txnHandle.getXid() << "; 2PC=" << (m_txnHandle.is2pc()?"T":"F") << std::endl; } @@ -185,7 +158,7 @@ MockTransactionContext::localPrepare() { m_store->submitPrepare(m_txnHandle, &handleAsyncResult, - dynamic_cast<qpid::broker::BrokerContext*>(new TransactionAsyncContext(this, qpid::asyncStore::AsyncOperation::TXN_PREPARE))); + dynamic_cast<qpid::broker::BrokerAsyncContext*>(new TransactionAsyncContext(this, qpid::asyncStore::AsyncOperation::TXN_PREPARE))); //std::cout << "*TXN* localPrepare: xid=" << m_txnHandle.getXid() << "; 2PC=" << (m_txnHandle.is2pc()?"T":"F") << std::endl; } diff --git a/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.h b/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.h index eb56645d47..2f8dd716f4 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.h +++ b/cpp/src/tests/storePerftools/asyncPerf/MockTransactionContext.h @@ -24,9 +24,7 @@ #ifndef tests_storePerftools_asyncPerf_MockTransactionContext_h_ #define tests_storePerftools_asyncPerf_MockTransactionContext_h_ -#include "qpid/asyncStore/AsyncOperation.h" - -#include "qpid/broker/BrokerContext.h" +#include "qpid/broker/AsyncStore.h" // qpid::broker::AsyncResult #include "qpid/broker/TransactionalStore.h" // qpid::broker::TransactionContext #include "qpid/broker/TxnHandle.h" #include "qpid/sys/Mutex.h" @@ -51,28 +49,11 @@ class MockTransactionContext : public qpid::broker::TransactionContext public: typedef boost::shared_ptr<MockTransactionContext> shared_ptr; - // NOTE: TransactionContext - Bad naming? This context is the async return handling context for class - // MockTransactionContext async ops. Other classes using this pattern simply use XXXContext for this class - // (e.g. QueueContext in MockPersistableQueue), but in this case it may be confusing. -/* - class TransactionContext : public qpid::broker::BrokerContext - { - public: - TransactionContext(MockTransactionContext* tc, - const qpid::asyncStore::AsyncOperation::opCode op); - virtual ~TransactionContext(); - const char* getOp() const; - void destroy(); - MockTransactionContext* m_tc; - const qpid::asyncStore::AsyncOperation::opCode m_op; - }; -*/ - MockTransactionContext(qpid::asyncStore::AsyncStoreImpl* store, const std::string& xid = std::string()); virtual ~MockTransactionContext(); static void handleAsyncResult(const qpid::broker::AsyncResult* res, - qpid::broker::BrokerContext* bc); + qpid::broker::BrokerAsyncContext* bc); qpid::broker::TxnHandle& getHandle(); bool is2pc() const; diff --git a/cpp/src/tests/storePerftools/asyncPerf/QueueContext.cpp b/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.cpp index 2b690a5d71..281fc03e2c 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/QueueContext.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.cpp @@ -21,44 +21,44 @@ * \file QueueContext.cpp */ -#include "QueueContext.h" +#include "QueueAsyncContext.h" namespace tests { namespace storePerftools { namespace asyncPerf { -QueueContext::QueueContext(MockPersistableQueue::intrusive_ptr q, +QueueAsyncContext::QueueAsyncContext(MockPersistableQueue::intrusive_ptr q, const qpid::asyncStore::AsyncOperation::opCode op) : - qpid::broker::BrokerContext(), + qpid::broker::BrokerAsyncContext(), m_q(q), m_op(op) { assert(m_q.get() != 0); } -QueueContext::~QueueContext() +QueueAsyncContext::~QueueAsyncContext() {} qpid::asyncStore::AsyncOperation::opCode -QueueContext::getOpCode() const +QueueAsyncContext::getOpCode() const { return m_op; } const char* -QueueContext::getOpStr() const +QueueAsyncContext::getOpStr() const { return qpid::asyncStore::AsyncOperation::getOpStr(m_op); } MockPersistableQueue::intrusive_ptr -QueueContext::getQueue() const +QueueAsyncContext::getQueue() const { return m_q; } void -QueueContext::destroy() +QueueAsyncContext::destroy() { delete this; } diff --git a/cpp/src/tests/storePerftools/asyncPerf/QueueContext.h b/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.h index 025a9dcf4f..657e80694a 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/QueueContext.h +++ b/cpp/src/tests/storePerftools/asyncPerf/QueueAsyncContext.h @@ -25,18 +25,19 @@ #define tests_storePerftools_asyncPerf_QueueContext_h_ #include "MockPersistableQueue.h" -#include "qpid/broker/BrokerContext.h" +#include "qpid/asyncStore/AsyncOperation.h" +#include "qpid/broker/BrokerAsyncContext.h" namespace tests { namespace storePerftools { namespace asyncPerf { -class QueueContext: public qpid::broker::BrokerContext +class QueueAsyncContext: public qpid::broker::BrokerAsyncContext { public: - QueueContext(MockPersistableQueue::intrusive_ptr q, + QueueAsyncContext(MockPersistableQueue::intrusive_ptr q, const qpid::asyncStore::AsyncOperation::opCode op); - virtual ~QueueContext(); + virtual ~QueueAsyncContext(); qpid::asyncStore::AsyncOperation::opCode getOpCode() const; const char* getOpStr() const; MockPersistableQueue::intrusive_ptr getQueue() const; diff --git a/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.cpp b/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.cpp index c0c94e3a18..118707b3d3 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.cpp +++ b/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.cpp @@ -6,7 +6,7 @@ namespace asyncPerf { TransactionAsyncContext::TransactionAsyncContext(MockTransactionContext* tc, const qpid::asyncStore::AsyncOperation::opCode op): - qpid::broker::BrokerContext(), + qpid::broker::BrokerAsyncContext(), m_tc(tc), m_op(op) { diff --git a/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.h b/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.h index 092958a93b..3bce23046e 100644 --- a/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.h +++ b/cpp/src/tests/storePerftools/asyncPerf/TransactionAsyncContext.h @@ -2,13 +2,14 @@ #define tests_storePerftools_asyncPerf_TransactionAsyncContext_h_ #include "MockTransactionContext.h" -#include "qpid/broker/BrokerContext.h" +#include "qpid/asyncStore/AsyncOperation.h" +#include "qpid/broker/BrokerAsyncContext.h" namespace tests { namespace storePerftools { namespace asyncPerf { -class TransactionAsyncContext: public qpid::broker::BrokerContext { +class TransactionAsyncContext: public qpid::broker::BrokerAsyncContext { public: TransactionAsyncContext(MockTransactionContext* tc, const qpid::asyncStore::AsyncOperation::opCode op); |