rhmessaging commits: r1476 - store/trunk/cpp/tests.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2007-12-13 08:32:57 -0500 (Thu, 13 Dec 2007)
New Revision: 1476
Modified:
store/trunk/cpp/tests/OrderingTest.cpp
store/trunk/cpp/tests/SimpleTest.cpp
store/trunk/cpp/tests/TransactionalTest.cpp
store/trunk/cpp/tests/TwoPhaseCommitTest.cpp
store/trunk/cpp/tests/system_test.sh
Log:
Changed location for tests from /var/rhm to /tmp/rhm. This location will work out-of-the-box without root having to first create a directory.
Modified: store/trunk/cpp/tests/OrderingTest.cpp
===================================================================
--- store/trunk/cpp/tests/OrderingTest.cpp 2007-12-13 09:49:19 UTC (rev 1475)
+++ store/trunk/cpp/tests/OrderingTest.cpp 2007-12-13 13:32:57 UTC (rev 1476)
@@ -34,6 +34,8 @@
#include <queue>
#include <sstream>
+#define TESTDIR "/tmp"
+
using boost::static_pointer_cast;
using boost::dynamic_pointer_cast;
using namespace rhm::bdbstore;
@@ -104,7 +106,7 @@
void setup(bool async)
{
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- store->init("/var", async, true, 4, 1);
+ store->init(TESTDIR, async, true, 4, 1);
store->truncate();
queue = Queue::shared_ptr(new Queue(name, 0, store.get(), 0));
@@ -146,7 +148,7 @@
store.reset();
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- store->init("/var", async, false, 4, 1);
+ store->init(TESTDIR, async, false, 4, 1);
ExchangeRegistry exchanges;
DtxManager mgr(store.get());
RecoveryManagerImpl recoveryMgr(queues, exchanges, mgr, 0);
Modified: store/trunk/cpp/tests/SimpleTest.cpp
===================================================================
--- store/trunk/cpp/tests/SimpleTest.cpp 2007-12-13 09:49:19 UTC (rev 1475)
+++ store/trunk/cpp/tests/SimpleTest.cpp 2007-12-13 13:32:57 UTC (rev 1476)
@@ -38,6 +38,8 @@
#include <qpid/broker/QueuePolicy.h>
#include <iostream>
+#define TESTDIR "/tmp"
+
using boost::static_pointer_cast;
using boost::dynamic_pointer_cast;
using boost::intrusive_ptr;
@@ -116,7 +118,7 @@
void testEmptyRecover(bool async)
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
store.truncate();//make sure it is empty to begin with
QueueRegistry registry(&store);
recover(store, registry);
@@ -129,7 +131,7 @@
void testCreateDelete(bool async)
{
BdbMessageStore store;
- store.init("/var", async, true, 4, 1);
+ store.init(TESTDIR, async, true, 4, 1);
store.truncate();//make sure it is empty to begin with
string name("CreateDeleteQueue");
Queue queue(name, 0, &store, 0);
@@ -150,7 +152,7 @@
string name("MyDurableQueue");
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
store.create(queue);
@@ -159,7 +161,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
QueueRegistry registry(&store);
recover(store, registry);
Queue::shared_ptr queue = registry.find(name);
@@ -177,7 +179,7 @@
string name("MyDurableQueue");
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
FieldTable settings;
@@ -187,7 +189,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
QueueRegistry registry(&store);
recover(store, registry);
Queue::shared_ptr queue = registry.find(name);
@@ -205,7 +207,7 @@
string name("MyDurableQueue");
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
store.create(queue);
@@ -213,7 +215,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
QueueRegistry registry(&store);
recover(store, registry);
CPPUNIT_ASSERT(!registry.find(name));
@@ -236,7 +238,7 @@
string data2("hijklmn");
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
FieldTable settings;
@@ -255,7 +257,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
QueueRegistry registry(&store);
recover(store, registry);
Queue::shared_ptr queue = registry.find(name);
@@ -293,7 +295,7 @@
string messageId = "MyMessage";
string data("abcdefg");
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
store.truncate();//make sure it is empty to begin with
Queue queue(name, 0, &store, 0);
FieldTable settings;
@@ -308,7 +310,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
QueueRegistry registry(&store);
recover(store, registry);
Queue::shared_ptr queue = registry.find(name);
@@ -329,7 +331,7 @@
const string data2("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
store.truncate();//make sure it is empty to begin with
//create & stage a message
@@ -376,7 +378,7 @@
{
//recover
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
QueueRegistry registry(&store);
ExchangeRegistry exchanges;
DtxManager dtx(&store);
@@ -423,7 +425,7 @@
void testDestroyStagedMessage(bool async)
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
store.truncate();//make sure it is empty to begin with
const string data("abcdefg");
@@ -449,7 +451,7 @@
void testDestroyEnqueuedMessage(bool async)
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
store.truncate();//make sure it is empty to begin with
const string data("abcdefg");
@@ -484,7 +486,7 @@
args.setString("a", "A");
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
store.truncate();//make sure it is empty to begin with
ExchangeRegistry registry;
Exchange::shared_ptr exchange = registry.declare(name, type, true, args).first;
@@ -494,7 +496,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
ExchangeRegistry registry;
recover(store, registry);
@@ -508,7 +510,7 @@
}
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
ExchangeRegistry registry;
recover(store, registry);
@@ -532,7 +534,7 @@
FieldTable args;
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
store.truncate();//make sure it is empty to begin with
Exchange::shared_ptr exchange(new DirectExchange(exchangeName, true, args));
Queue::shared_ptr queue(new Queue(queueName, 0, &store, 0));
@@ -543,7 +545,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
ExchangeRegistry exchanges;
QueueRegistry queues;
@@ -557,7 +559,7 @@
}
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
ExchangeRegistry exchanges;
QueueRegistry queues;
@@ -581,7 +583,7 @@
FieldTable args;
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
store.truncate();//make sure it is empty to begin with
Exchange::shared_ptr exchange(new DirectExchange(exchangeName, true, args));
Queue::shared_ptr queue1(new Queue(queueName1, 0, &store, 0));
@@ -596,7 +598,7 @@
}//db will be closed
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
ExchangeRegistry exchanges;
QueueRegistry queues;
@@ -612,7 +614,7 @@
}
{
BdbMessageStore store;
- store.init("/var", async, false, 4, 1);
+ store.init(TESTDIR, async, false, 4, 1);
ExchangeRegistry exchanges;
QueueRegistry queues;
Modified: store/trunk/cpp/tests/TransactionalTest.cpp
===================================================================
--- store/trunk/cpp/tests/TransactionalTest.cpp 2007-12-13 09:49:19 UTC (rev 1475)
+++ store/trunk/cpp/tests/TransactionalTest.cpp 2007-12-13 13:32:57 UTC (rev 1476)
@@ -32,6 +32,8 @@
#include <iostream>
#include <memory>
+#define TESTDIR "/tmp"
+
using boost::static_pointer_cast;
using boost::dynamic_pointer_cast;
using namespace rhm::bdbstore;
@@ -95,7 +97,7 @@
void setup(bool async)
{
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- store->init("/var", async, true, 4, 1);
+ store->init(TESTDIR, async, true, 4, 1);
store->truncate();
//create two queues:
@@ -119,7 +121,7 @@
store.reset();
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- store->init("/var", async, false, 4, 1);
+ store->init(TESTDIR, async, false, 4, 1);
ExchangeRegistry exchanges;
DtxManager mgr(store.get());
RecoveryManagerImpl recovery(queues, exchanges, mgr, 0);
Modified: store/trunk/cpp/tests/TwoPhaseCommitTest.cpp
===================================================================
--- store/trunk/cpp/tests/TwoPhaseCommitTest.cpp 2007-12-13 09:49:19 UTC (rev 1475)
+++ store/trunk/cpp/tests/TwoPhaseCommitTest.cpp 2007-12-13 13:32:57 UTC (rev 1476)
@@ -32,6 +32,8 @@
#include <iostream>
#include <memory>
+#define TESTDIR "/tmp"
+
using boost::static_pointer_cast;
using boost::dynamic_pointer_cast;
using namespace rhm::bdbstore;
@@ -336,7 +338,7 @@
void setup()
{
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- store->init("/var", async, true, 4, 1);
+ store->init(TESTDIR, async, true, 4, 1);
store->truncate();
//create two queues:
@@ -361,7 +363,7 @@
store.reset();
store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
- store->init("/var", async, false, 4, 1);
+ store->init(TESTDIR, async, false, 4, 1);
ExchangeRegistry exchanges;
dtxmgr = std::auto_ptr<DtxManager>(new DtxManager(store.get()));
RecoveryManagerImpl recovery(queues, exchanges, *dtxmgr, 0);
Modified: store/trunk/cpp/tests/system_test.sh
===================================================================
--- store/trunk/cpp/tests/system_test.sh 2007-12-13 09:49:19 UTC (rev 1475)
+++ store/trunk/cpp/tests/system_test.sh 2007-12-13 13:32:57 UTC (rev 1476)
@@ -27,7 +27,7 @@
exit
fi
-WORKING_DIR=/var/rhm
+WORKING_DIR=/tmp
QPIDD=$QPID_DIR/cpp/src/qpidd
if test "$VERBOSE" = yes; then
@@ -44,6 +44,12 @@
export DB_HOME=dbdata
export PYTHONPATH=$QPID_DIR/python
+# Set up working dir for test
+if [ -d ${WORKING_DIR}/rhm ]; then
+ rm -rf ${WORKING_DIR}/rhm/*
+else
+ mkdir -p ${WORKING_DIR}/rhm
+fi
mkdir -p $DB_HOME || framework_failure=1
if test $framework_failure = 1; then
@@ -58,11 +64,11 @@
while ((sync <= 1)); do
echo
if ((sync == 1)); then
- JRNLFLAGS='--store-async yes --store-force yes'
+ JRNLFLAGS="--store-directory ${WORKING_DIR} --store-async yes --store-force yes"
mode='jrnl'
echo 'Journal (AIO) persistence...'
else
- JRNLFLAGS='--store-force yes'
+ JRNLFLAGS="--store-directory ${WORKING_DIR} --store-force yes"
mode='bdb'
echo 'BDB persistence...'
fi
18 years, 4 months
rhmessaging commits: r1475 - store/trunk/cpp/tests.
by rhmessaging-commits@lists.jboss.org
Author: gordonsim
Date: 2007-12-13 04:49:19 -0500 (Thu, 13 Dec 2007)
New Revision: 1475
Modified:
store/trunk/cpp/tests/Makefile.am
Log:
Add missing files to those distributed
Modified: store/trunk/cpp/tests/Makefile.am
===================================================================
--- store/trunk/cpp/tests/Makefile.am 2007-12-12 22:22:30 UTC (rev 1474)
+++ store/trunk/cpp/tests/Makefile.am 2007-12-13 09:49:19 UTC (rev 1475)
@@ -26,7 +26,7 @@
abs_srcdir=$(abs_srcdir) \
LIBBDBSTORE=$(abs_builddir)/../lib/.libs/libbdbstore.so
-EXTRA_DIST += $(TESTS) test_plugin.h MessageUtils.h setup .vg-supp
+EXTRA_DIST += $(TESTS) test_plugin.h MessageUtils.h setup .vg-supp unit_test.h unit_test.cpp
include gen.mk
18 years, 4 months
rhmessaging commits: r1474 - in store/trunk/cpp: lib/jrnl and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2007-12-12 17:22:30 -0500 (Wed, 12 Dec 2007)
New Revision: 1474
Added:
store/trunk/cpp/lib/jrnl/enums.hpp
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/Makefile.am
store/trunk/cpp/lib/jrnl/enq_rec.cpp
store/trunk/cpp/lib/jrnl/enq_rec.hpp
store/trunk/cpp/lib/jrnl/jcfg.hpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/pmgr.cpp
store/trunk/cpp/lib/jrnl/pmgr.hpp
store/trunk/cpp/lib/jrnl/rmgr.hpp
store/trunk/cpp/lib/jrnl/rrfc.cpp
store/trunk/cpp/lib/jrnl/rrfc.hpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.hpp
store/trunk/cpp/lib/jrnl/wrfc.cpp
store/trunk/cpp/lib/jrnl/wrfc.hpp
store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp
Log:
First go at a strategy to prevent the journal from filling up... it will close the producer connection when the proposed enqueue operation would take the journal to > 80% full. Consumers may contunue to dequeue, however.
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -977,12 +977,11 @@
try {
- if ( queue && usingJrnl()){
- //std::cout << "E" << std::flush;
+ if ( queue && usingJrnl()) {
boost::intrusive_ptr<DataTokenImpl> dtokp(new DataTokenImpl);
dtokp->addRef();
- dtokp->setSourceMessage(message);
- dtokp->set_rid(message->getPersistenceId()); // set the messageID into the Journal header (record-id)
+ dtokp->setSourceMessage(message);
+ dtokp->set_rid(message->getPersistenceId()); // set the messageID into the Journal header (record-id)
bool written = false;
unsigned aio_sleep_cnt = 0;
@@ -1026,12 +1025,15 @@
THROW_STORE_EXCEPTION("Timeout waiting for mutex: RHM_IORES_BUSY");
usleep(AIO_SLEEP_TIME); // TODO add sleep time to get events call as option
break;
+ case rhm::journal::RHM_IORES_ENQCAPTHRESH:
+ std::cerr << "Enqueue: Error storing record -- Enqueue capacity threshold exceeded on queue \"" << queue->getName() << "\"." << std::endl << std::flush;
+ THROW_STORE_FULL_EXCEPTION("Enqueue: Error storing record -- Enqueue capacity threshold exceeded on queue \"" + queue->getName() + "\".");
case rhm::journal::RHM_IORES_FULL:
std::cerr << "Enqueue: Error storing record -- Journal full on queue \"" << queue->getName() << "\"." << std::endl << std::flush;
THROW_STORE_FULL_EXCEPTION("Enqueue: Error storing record -- Journal full on queue \"" + queue->getName() + "\".");
break;
default:
- assert( "Store Error: Unexpected msg state");
+ assert("Store Error: Unexpected msg state");
}
}
@@ -1173,7 +1175,7 @@
THROW_STORE_FULL_EXCEPTION("Dequeue: Error storing record -- Journal full on queue \"" + queue.getName() + "\".");
break;
default:
- assert( "Store Error: Unexpected msg state");
+ assert("Store Error: Unexpected msg state");
}
}
}
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -146,13 +146,13 @@
usleep(AIO_SLEEP_TIME);
} else {
std::stringstream ss;
- ss << "read_data_record() returned " << journal::pmgr::iores_str(res);
+ ss << "read_data_record() returned " << journal::iores_str(res);
ss << "; exceeded maximum wait time";
throw jexception(0, ss.str().c_str(), "JournalImpl", "loadMsgContent");
}
} else {
std::stringstream ss;
- ss << "read_data_record() returned " << journal::pmgr::iores_str(res);
+ ss << "read_data_record() returned " << journal::iores_str(res);
throw jexception(0, ss.str().c_str(), "JournalImpl", "loadMsgContent");
}
}
Modified: store/trunk/cpp/lib/Makefile.am
===================================================================
--- store/trunk/cpp/lib/Makefile.am 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/Makefile.am 2007-12-12 22:22:30 UTC (rev 1474)
@@ -63,6 +63,7 @@
jrnl/enq_hdr.hpp \
jrnl/enq_map.hpp \
jrnl/enq_rec.hpp \
+ jrnl/enums.hpp \
jrnl/file_hdr.hpp \
jrnl/jcfg.hpp \
jrnl/jcntl.hpp \
Modified: store/trunk/cpp/lib/jrnl/enq_rec.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_rec.cpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/jrnl/enq_rec.cpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -565,11 +565,17 @@
const size_t
enq_rec::rec_size() const
{
- if (_enq_hdr.is_external())
- return enq_hdr::size() + _enq_hdr._xidsize + rec_tail::size();
- return enq_hdr::size() + _enq_hdr._xidsize + _enq_hdr._dsize + rec_tail::size();
+ return rec_size(_enq_hdr._xidsize, _enq_hdr._dsize, _enq_hdr.is_external());
}
+const size_t
+enq_rec::rec_size(const size_t xidsize, const size_t dsize, const bool external)
+{
+ if (external)
+ return enq_hdr::size() + xidsize + rec_tail::size();
+ return enq_hdr::size() + xidsize + dsize + rec_tail::size();
+}
+
void
enq_rec::set_rid(const u_int64_t rid)
{
Modified: store/trunk/cpp/lib/jrnl/enq_rec.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enq_rec.hpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/jrnl/enq_rec.hpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -100,6 +100,7 @@
const size_t data_size() const;
const size_t xid_size() const;
const size_t rec_size() const;
+ static const size_t rec_size(const size_t xidsize, const size_t dsize, const bool external);
inline const u_int64_t rid() const { return _enq_hdr._rid; }
void set_rid(const u_int64_t rid);
Added: store/trunk/cpp/lib/jrnl/enums.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/enums.hpp (rev 0)
+++ store/trunk/cpp/lib/jrnl/enums.hpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -0,0 +1,76 @@
+/**
+* \file enums.hpp
+*
+* Red Hat Messaging - Message Journal
+*
+* File containing definitions for namespace rhm::journal enums.
+*
+* \author Kim van der Riet
+*
+* Copyright 2007 Red Hat, Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+* USA
+*
+* The GNU Lesser General Public License is available in the file COPYING.
+*/
+
+#ifndef rhm_journal_enums_hpp
+#define rhm_journal_enums_hpp
+
+namespace rhm
+{
+namespace journal
+{
+
+ // TODO: Change this to flags, as multiple of these conditions may exist simultaneously
+ /**
+ * \brief Enumeration of possilbe return states from journal read and write operations.
+ */
+ enum _iores
+ {
+ RHM_IORES_SUCCESS = 0, ///< Success: IO operation completed noramlly.
+ RHM_IORES_AIO_WAIT, ///< IO operation suspended - all pages are waiting for AIO.
+ RHM_IORES_EMPTY, ///< During read operations, nothing further is available to read.
+ RHM_IORES_ENQCAPTHRESH, ///< Enqueue capacity threshold (limit) reached.
+ RHM_IORES_FULL, ///< During write operations, the journal files are full.
+ RHM_IORES_BUSY, ///< Another blocking operation is in progress.
+ RHM_IORES_TXPENDING, ///< Operation blocked by pending transaction.
+ RHM_IORES_NOTIMPL ///< Function is not yet implemented.
+ };
+ typedef _iores iores;
+
+ static inline const char* iores_str(iores res)
+ {
+ switch (res)
+ {
+ case RHM_IORES_SUCCESS: return "RHM_IORES_SUCCESS";
+ case RHM_IORES_AIO_WAIT: return "RHM_IORES_AIO_WAIT";
+ case RHM_IORES_EMPTY: return "RHM_IORES_EMPTY";
+ case RHM_IORES_ENQCAPTHRESH: return "RHM_IORES_ENQCAPTHRESH";
+ case RHM_IORES_FULL: return "RHM_IORES_FULL";
+ case RHM_IORES_BUSY: return "RHM_IORES_BUSY";
+ case RHM_IORES_TXPENDING: return "RHM_IORES_TXPENDING";
+ case RHM_IORES_NOTIMPL: return "RHM_IORES_NOTIMPL";
+ }
+ return "<iores unknown>";
+ }
+
+} // namespace journal
+} // namespace rhm
+
+#endif // ifndef rhm_journal_enums_hpp
Modified: store/trunk/cpp/lib/jrnl/jcfg.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcfg.hpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/jrnl/jcfg.hpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -61,9 +61,7 @@
#define JRNL_SBLK_SIZE 4 ///< Disk softblock size in multiples of JRNL_DBLK_SIZE
#define JRNL_MIN_FILE_SIZE 128 ///< Min. jrnl file size in sblks (excl. file_hdr)
#define JRNL_MIN_NUM_FILES 4 ///< Min. number of journal files
-// The following are now parameterized in the jcntl constructor, and no longer needed here.
-//#define JRNL_FILE_SIZE 3072 ///< Journal file size in softblocks excl. file_hdr
-//#define JRNL_NUM_FILES 8 ///< Number of journal files
+#define JRNL_ENQ_THRESHOLD 80 ///< Percent full when enqueue connection will be closed
// NOTE: JRNL_RMGR_PAGE_SIZE must be a multiple of JRNL_WMGR_PAGE_SIZE.
#define JRNL_RMGR_PAGE_SIZE 128 ///< Journal page size in softblocks
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -120,7 +120,7 @@
// NOTE: The write RFC must initialize first. This sets all the file handle object
// (lfh) counters and pointers for both read and write, since write activity
// constrains read activity (i.e. one can't read what has not yet been written).
- _wrfc.initialize(_num_jfiles, (nlfh**)_datafh);
+ _wrfc.initialize(_num_jfiles, _jfsize_sblks, (nlfh**)_datafh);
_rrfc.initialize(_num_jfiles, (nlfh**)_datafh);
_rmgr.initialize(rdtoklp, rd_cb, 0);
_wmgr.initialize(wdtoklp, wr_cb, JRNL_WMGR_MAXDTOKPP, JRNL_WMGR_MAXWAITUS);
@@ -171,7 +171,7 @@
// NOTE: The write RFC must initialize first. This sets all the file handle object
// (lfh) counters and pointers for both read and write, since write activity
// constrains read activity (i.e. one can't read what has not yet been written).
- _wrfc.initialize(_num_jfiles, (nlfh**)_datafh, &_rcvdat);
+ _wrfc.initialize(_num_jfiles, _jfsize_sblks, (nlfh**)_datafh, &_rcvdat);
_rrfc.initialize(_num_jfiles, (nlfh**)_datafh, _rcvdat._ffid);
_rmgr.initialize(rdtoklp, rd_cb, _rcvdat._fro);
_wmgr.initialize(wdtoklp, wr_cb, JRNL_WMGR_MAXDTOKPP, JRNL_WMGR_MAXWAITUS, _rcvdat._eo);
@@ -187,7 +187,7 @@
throw jexception(jerrno::JERR_JCNTL_NOTRECOVERED, "jcntl", "recover_complete");
for (u_int16_t i=0; i<_num_jfiles; i++)
_datafh[i]->reset(&_rcvdat);
- _wrfc.initialize(_num_jfiles, (nlfh**)_datafh, &_rcvdat);
+ _wrfc.initialize(_num_jfiles, _jfsize_sblks, (nlfh**)_datafh, &_rcvdat);
_rrfc.initialize(_num_jfiles, (nlfh**)_datafh, _rcvdat._ffid);
_rmgr.recover_complete(_rcvdat._fro);
_readonly_flag = false;
Modified: store/trunk/cpp/lib/jrnl/pmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/pmgr.cpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/jrnl/pmgr.cpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -239,28 +239,5 @@
return "<page_state unknown>";
}
-const char*
-pmgr::iores_str(iores res)
-{
- switch (res)
- {
- case RHM_IORES_SUCCESS:
- return "RHM_IORES_SUCCESS";
- case RHM_IORES_AIO_WAIT:
- return "RHM_IORES_AIO_WAIT";
- case RHM_IORES_EMPTY:
- return "RHM_IORES_EMPTY";
- case RHM_IORES_FULL:
- return "RHM_IORES_FULL";
- case RHM_IORES_BUSY:
- return "RHM_IORES_BUSY";
- case RHM_IORES_TXPENDING:
- return "RHM_IORES_TXPENDING";
- case RHM_IORES_NOTIMPL:
- return "RHM_IORES_NOTIMPL";
- }
- return "<iores unknown>";
-}
-
} // namespace journal
} // namespace rhm
Modified: store/trunk/cpp/lib/jrnl/pmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/pmgr.hpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/jrnl/pmgr.hpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -57,21 +57,6 @@
{
namespace journal
{
- // TODO: Change this to flags, as multiple of these conditions may exist simultaneously
- /**
- * \brief Enumeration of possilbe return states from journal read and write operations.
- */
- enum _iores
- {
- RHM_IORES_SUCCESS = 0, ///< Success: IO operation completed noramlly.
- RHM_IORES_AIO_WAIT, ///< IO operation suspended - all pages are waiting for AIO.
- RHM_IORES_EMPTY, ///< During read operations, nothing further is available to read.
- RHM_IORES_FULL, ///< During write operations, the journal files are full.
- RHM_IORES_BUSY, ///< Another blocking operation is in progress.
- RHM_IORES_TXPENDING, ///< Operation blocked by pending transaction.
- RHM_IORES_NOTIMPL ///< Not yet implemented.
- };
- typedef _iores iores;
/**
* \brief Abstract class for managing either read or write page cache of arbitrary size and
@@ -146,7 +131,6 @@
virtual const u_int32_t get_events(page_state state) = 0;
inline const u_int32_t get_aio_evt_rem() const { return _aio_evt_rem; }
static const char* page_state_str(page_state ps);
- static const char* iores_str(iores res);
protected:
virtual void initialize();
Modified: store/trunk/cpp/lib/jrnl/rmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.hpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/jrnl/rmgr.hpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -41,6 +41,7 @@
}
}
+#include <jrnl/enums.hpp>
#include <jrnl/pmgr.hpp>
#include <jrnl/rec_hdr.hpp>
#include <jrnl/rrfc.hpp>
Modified: store/trunk/cpp/lib/jrnl/rrfc.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rrfc.cpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/jrnl/rrfc.cpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -51,7 +51,7 @@
rrfc::~rrfc() {}
void
-rrfc::initialize(u_int32_t nfiles, nlfh** fh_arr, u_int32_t fh_index)
+rrfc::initialize(const u_int16_t nfiles, nlfh** fh_arr, u_int32_t fh_index)
{
_nfiles = nfiles;
_fh_arr = fh_arr;
Modified: store/trunk/cpp/lib/jrnl/rrfc.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rrfc.hpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/jrnl/rrfc.hpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -55,7 +55,7 @@
class rrfc
{
protected:
- u_int32_t _nfiles; ///< Number of data files
+ u_int16_t _nfiles; ///< Number of data files
nlfh** _fh_arr; ///< Array of pointers to data file handles
u_int16_t _fh_index; ///< Index of current file handle
nlfh* _curr_fh; ///< Pointer to current file handle
@@ -71,7 +71,7 @@
* each of which correspond to one of the physical files.
* \param fh_index Initial index of journal file. Default = 0.
*/
- void initialize(u_int32_t nfiles, nlfh** fh_arr, u_int32_t fh_index = 0);
+ void initialize(const u_int16_t nfiles, nlfh** fh_arr, u_int32_t fh_index = 0);
/**
* \brief Rotate active file handle to next file in rotating file group.
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -119,7 +119,7 @@
if (this_data_len != tot_data_len && !external)
return RHM_IORES_NOTIMPL;
- iores res = pre_write_check(WMGR_ENQUEUE, dtokp);
+ iores res = pre_write_check(WMGR_ENQUEUE, dtokp, xid_len, tot_data_len, external);
if (res != RHM_IORES_SUCCESS)
return res;
@@ -926,7 +926,8 @@
}
const iores
-wmgr::pre_write_check(_op_type op, data_tok* dtokp)
+wmgr::pre_write_check(const _op_type op, const data_tok* const dtokp, const size_t xidsize,
+ const size_t dsize, const bool external) const
{
// Check status of current file
if (!_wrfc.is_reset())
@@ -955,13 +956,20 @@
switch (op)
{
case WMGR_ENQUEUE:
- if (!dtokp->is_writable())
{
- std::ostringstream oss;
- oss << "op=" << _op_str[op] << " dtok_id=" << dtokp->id();
- oss << " dtok_state=" << dtokp->wstate_str();
- throw jexception(jerrno::JERR_WMGR_BADDTOKSTATE, oss.str(), "wmgr",
+ // Check for enqueue reaching cutoff threshold
+ u_int32_t size_dblks = jrec::size_dblks(enq_rec::rec_size(xidsize, dsize,
+ external));
+ if (_wrfc.enq_threshold(_cached_offset_dblks + size_dblks))
+ return RHM_IORES_ENQCAPTHRESH;
+ if (!dtokp->is_writable())
+ {
+ std::ostringstream oss;
+ oss << "op=" << _op_str[op] << " dtok_id=" << dtokp->id();
+ oss << " dtok_state=" << dtokp->wstate_str();
+ throw jexception(jerrno::JERR_WMGR_BADDTOKSTATE, oss.str(), "wmgr",
"pre_write_check");
+ }
}
break;
case WMGR_DEQUEUE:
Modified: store/trunk/cpp/lib/jrnl/wmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.hpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/jrnl/wmgr.hpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -41,6 +41,7 @@
}
}
+#include <jrnl/enums.hpp>
#include <jrnl/pmgr.hpp>
#include <jrnl/wrfc.hpp>
#include <set>
@@ -117,7 +118,9 @@
private:
void initialize();
- const iores pre_write_check(_op_type op, data_tok* dtokp);
+ const iores pre_write_check(const _op_type op, const data_tok* const dtokp,
+ const size_t xidsize = 0, const size_t dsize = 0, const bool external = false)
+ const;
const u_int64_t initialize_rid(const bool cont, data_tok* dtokp);
const iores write_flush();
const iores rotate_file();
Modified: store/trunk/cpp/lib/jrnl/wrfc.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wrfc.cpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/jrnl/wrfc.cpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -30,6 +30,7 @@
* The GNU Lesser General Public License is available in the file COPYING.
*/
+#include <iostream> // TODO: remove later, for debug only.
#include <jrnl/wrfc.hpp>
#include <jrnl/jerrno.hpp>
@@ -42,6 +43,9 @@
wrfc::wrfc():
rrfc(),
+ _fsize_sblks(0),
+ _fsize_dblks(0),
+ _enq_cap_offs_dblks(0),
#ifdef DRHM_TESTVALS
// TODO: Find method of specifying 64-bit literals under gcc with -pedantic option
_rid(u_int64_t(0xffeeddcc) << 32), // For testing high rids
@@ -55,7 +59,7 @@
wrfc::~wrfc() {}
void
-wrfc::initialize(u_int32_t nfiles, nlfh** fh_arr, rcvdat* rdp)
+wrfc::initialize(const u_int16_t nfiles, const u_int32_t fsize_sblks, nlfh** fh_arr, rcvdat* rdp)
{
if (rdp)
{
@@ -74,6 +78,12 @@
#endif
_reset_ok = false;
}
+ _fsize_sblks = fsize_sblks;
+ _fsize_dblks = fsize_sblks * JRNL_SBLK_SIZE;
+ _enq_cap_offs_dblks = _fsize_dblks * _nfiles * (100 - JRNL_ENQ_THRESHOLD) / 100;
+ // Check the offset is at least one file; if not, make it so
+ if (_enq_cap_offs_dblks < _fsize_dblks)
+ _enq_cap_offs_dblks = _fsize_dblks;
}
bool
@@ -85,7 +95,7 @@
if (_fh_index == _nfiles)
{
_fh_index = 0;
- _owi = !_owi; // flip owi
+ _owi = !_owi;
}
_curr_fh = _fh_arr[_fh_index];
return reset(); //Checks if file is still in use (ie not fully dequeued yet)
@@ -98,5 +108,29 @@
return _reset_ok;
}
+const bool
+wrfc::enq_threshold(const u_int32_t enq_dsize_dblks) const
+{
+ u_int32_t subm_dblks = subm_cnt_dblks();
+ // This compensates for new files which don't have their file headers written yet,
+ // as file header space cannot be included in this calculation.
+ if (subm_dblks == 0)
+ subm_dblks = 4;
+ u_int32_t fwd_dblks = subm_dblks + enq_dsize_dblks + _enq_cap_offs_dblks;
+ u_int16_t findex = _fh_index;
+ nlfh* fhp = _curr_fh;
+ while (fwd_dblks && !(findex != _fh_index && fhp->enqcnt()))
+ {
+ fwd_dblks -= fwd_dblks > _fsize_dblks ? _fsize_dblks : fwd_dblks;
+ if (fwd_dblks)
+ {
+ if (++findex == _nfiles)
+ findex = 0;
+ fhp = _fh_arr[findex];
+ }
+ }
+ return findex != _fh_index && fhp->enqcnt() > 0;
+}
+
} // namespace journal
} // namespace rhm
Modified: store/trunk/cpp/lib/jrnl/wrfc.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wrfc.hpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/lib/jrnl/wrfc.hpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -55,9 +55,12 @@
class wrfc : public rrfc
{
private:
- u_int64_t _rid; ///< Master counter for record ID (rid)
- bool _reset_ok; ///< Flag set when reset succeeds
- bool _owi; ///< Overwrite indicator
+ u_int32_t _fsize_sblks; ///< Size of journal files in sblks
+ u_int32_t _fsize_dblks; ///< Size of journal files in dblks
+ u_int32_t _enq_cap_offs_dblks; ///< Enqueue capacity offset
+ u_int64_t _rid; ///< Master counter for record ID (rid)
+ bool _reset_ok; ///< Flag set when reset succeeds
+ bool _owi; ///< Overwrite indicator
public:
wrfc();
@@ -66,12 +69,14 @@
/**
* \brief Initialize the controller.
* \param nfiles Number of files in the rotating file group.
+ * \param fsize_sblks Size of each journal file in sblks.
* \param fh_arr Pointer to an array of file handles (nlogging_fh or subclasses),
* each of which correspond to one of the physical files.
* \param rdp Struct carrying restore information. Optional for non-restore use, defaults to
* NULL.
*/
- void initialize(u_int32_t nfiles, nlfh** fh_arr, rcvdat* rdp = NULL);
+ void initialize(const u_int16_t nfiles, const u_int32_t fsize_sblks, nlfh** fh_arr,
+ rcvdat* rdp = NULL);
/**
* \brief Rotate active file handle to next file in rotating file group.
@@ -106,6 +111,7 @@
inline const u_int32_t aio_outstanding_dblks() const
{ return _curr_fh->wr_aio_outstanding_dblks(); }
inline const bool file_rotate() const { return _curr_fh->wr_file_rotate(); }
+ const bool enq_threshold(const u_int32_t enq_dsize_dblks) const;
}; // class wrfc
} // namespace journal
Modified: store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp 2007-12-12 21:47:23 UTC (rev 1473)
+++ store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp 2007-12-12 22:22:30 UTC (rev 1474)
@@ -758,7 +758,6 @@
switch (res)
{
case rhm::journal::RHM_IORES_SUCCESS:
- //((char*)mbuff)[msize] = '\0';
return false;
case rhm::journal::RHM_IORES_AIO_WAIT:
if (++aio_sleep_cnt <= MAX_AIO_SLEEPS)
@@ -772,21 +771,9 @@
CPPUNIT_FAIL("Timeout on RHM_IORES_AIO_WAIT.");
}
break;
- case rhm::journal::RHM_IORES_EMPTY:
- delete dtp;
- CPPUNIT_FAIL("RHM_IORES_EMPTY");
- case rhm::journal::RHM_IORES_FULL:
- delete dtp;
- CPPUNIT_FAIL("RHM_IORES_FULL");
- case rhm::journal::RHM_IORES_BUSY:
- delete dtp;
- CPPUNIT_FAIL("RHM_IORES_BUSY");
- case rhm::journal::RHM_IORES_TXPENDING:
- delete dtp;
- CPPUNIT_FAIL("RHM_IORES_TXPENDING");
default:
delete dtp;
- CPPUNIT_FAIL("unknown return value");
+ CPPUNIT_FAIL(rhm::journal::iores_str(res));
}
return true;
}
18 years, 4 months
rhmessaging commits: r1473 - store/trunk/cpp/tests.
by rhmessaging-commits@lists.jboss.org
Author: aconway
Date: 2007-12-12 16:47:23 -0500 (Wed, 12 Dec 2007)
New Revision: 1473
Added:
store/trunk/cpp/tests/unit_test.cpp
store/trunk/cpp/tests/unit_test.h
Log:
Files missed in previous commit.
Added: store/trunk/cpp/tests/unit_test.cpp
===================================================================
--- store/trunk/cpp/tests/unit_test.cpp (rev 0)
+++ store/trunk/cpp/tests/unit_test.cpp 2007-12-12 21:47:23 UTC (rev 1473)
@@ -0,0 +1,24 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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 KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// Defines test_main function to link with actual unit test code.
+#define BOOST_AUTO_TEST_MAIN // Boost 1.33
+#define BOOST_TEST_MAIN
+
+#include "unit_test.h"
+
Property changes on: store/trunk/cpp/tests/unit_test.cpp
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
Added: store/trunk/cpp/tests/unit_test.h
===================================================================
--- store/trunk/cpp/tests/unit_test.h (rev 0)
+++ store/trunk/cpp/tests/unit_test.h 2007-12-12 21:47:23 UTC (rev 1473)
@@ -0,0 +1,45 @@
+#ifndef QPIPD_TEST_UNIT_TEST_H_
+#define QPIPD_TEST_UNIT_TEST_H_
+
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * 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
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+// Workaround so we can build against boost 1.33 and boost 1.34.
+// Remove when we no longer need to support 1.33.
+//
+#include <boost/version.hpp>
+
+#if (BOOST_VERSION < 103400)
+
+# include <boost/test/auto_unit_test.hpp>
+
+# define QPID_AUTO_TEST_SUITE(name) BOOST_AUTO_TEST_SUITE(name);
+# define QPID_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END();
+
+#else
+
+# define QPID_AUTO_TEST_SUITE(name) BOOST_AUTO_TEST_SUITE(name)
+# define QPID_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE_END()
+
+# include <boost/test/unit_test.hpp>
+#endif
+
+#endif /*!QPIPD_TEST_UNIT_TEST_H_*/
Property changes on: store/trunk/cpp/tests/unit_test.h
___________________________________________________________________
Name: svn:keywords
+ Rev Date
Name: svn:eol-style
+ native
18 years, 4 months
rhmessaging commits: r1472 - store/trunk/cpp/tests/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: aconway
Date: 2007-12-12 16:33:29 -0500 (Wed, 12 Dec 2007)
New Revision: 1472
Modified:
store/trunk/cpp/tests/jrnl/Makefile.am
store/trunk/cpp/tests/jrnl/unit_test_enq_map.cpp
store/trunk/cpp/tests/jrnl/unit_test_jdir.cpp
store/trunk/cpp/tests/jrnl/unit_test_jerrno.cpp
store/trunk/cpp/tests/jrnl/unit_test_jexception.cpp
store/trunk/cpp/tests/jrnl/unit_test_jinf.cpp
store/trunk/cpp/tests/jrnl/unit_test_rec_hdr.cpp
store/trunk/cpp/tests/jrnl/unit_test_txn_map.cpp
Log:
Fixed tests to work with boost 1.34 as well as 1.33.
Modified: store/trunk/cpp/tests/jrnl/Makefile.am
===================================================================
--- store/trunk/cpp/tests/jrnl/Makefile.am 2007-12-12 20:34:17 UTC (rev 1471)
+++ store/trunk/cpp/tests/jrnl/Makefile.am 2007-12-12 21:33:29 UTC (rev 1472)
@@ -21,7 +21,7 @@
abs_builddir=@abs_builddir@
-AM_CXXFLAGS = $(WARNING_CFLAGS) $(CPPUNIT_CXXFLAGS) $(QPID_CXXFLAGS) -pthread
+AM_CXXFLAGS = $(WARNING_CFLAGS) $(CPPUNIT_CXXFLAGS) $(QPID_CXXFLAGS) -pthread -DBOOST_TEST_DYN_LINK
INCLUDES=-I../../lib
@@ -48,27 +48,30 @@
unit_test_enq_map \
unit_test_txn_map
-unit_test_jexception_SOURCES = unit_test_jexception.cpp
-unit_test_jexception_LDFLAGS = -lboost_unit_test_framework -lbdbstore -L../../lib/.libs
+UNIT_TEST_SRCS=../unit_test.cpp
+UNIT_TEST_LDADD= -lboost_unit_test_framework -lbdbstore -L../../lib/.libs
-unit_test_jerrno_SOURCES = unit_test_jerrno.cpp
-unit_test_jerrno_LDFLAGS = -lboost_unit_test_framework -lbdbstore -L../../lib/.libs
+unit_test_jexception_SOURCES = unit_test_jexception.cpp $(UNIT_TEST_SRCS)
+unit_test_jexception_LDFLAGS = $(UNIT_TEST_LDADD)
-unit_test_rec_hdr_SOURCES = unit_test_rec_hdr.cpp
-unit_test_rec_hdr_LDFLAGS = -lboost_unit_test_framework -lbdbstore -lrt -L../../lib/.libs
+unit_test_jerrno_SOURCES = unit_test_jerrno.cpp $(UNIT_TEST_SRCS)
+unit_test_jerrno_LDADD = $(UNIT_TEST_LDADD)
-unit_test_jinf_SOURCES = unit_test_jinf.cpp
-unit_test_jinf_LDFLAGS = -lboost_unit_test_framework -lbdbstore -lrt -L../../lib/.libs
+unit_test_rec_hdr_SOURCES = unit_test_rec_hdr.cpp $(UNIT_TEST_SRCS)
+unit_test_rec_hdr_LDADD = $(UNIT_TEST_LDADD) -lrt
-unit_test_jdir_SOURCES = unit_test_jdir.cpp
-unit_test_jdir_LDFLAGS = -lboost_unit_test_framework -lbdbstore -lrt -L../../lib/.libs
+unit_test_jinf_SOURCES = unit_test_jinf.cpp $(UNIT_TEST_SRCS)
+unit_test_jinf_LDADD = $(UNIT_TEST_LDADD) -lrt
-unit_test_enq_map_SOURCES = unit_test_enq_map.cpp
-unit_test_enq_map_LDFLAGS = -lboost_unit_test_framework -lbdbstore -lrt -L../../lib/.libs
+unit_test_jdir_SOURCES = unit_test_jdir.cpp $(UNIT_TEST_SRCS)
+unit_test_jdir_LDADD = $(UNIT_TEST_LDADD) -lrt
-unit_test_txn_map_SOURCES = unit_test_txn_map.cpp
-unit_test_txn_map_LDFLAGS = -lboost_unit_test_framework -lbdbstore -lrt -L../../lib/.libs
+unit_test_enq_map_SOURCES = unit_test_enq_map.cpp $(UNIT_TEST_SRCS)
+unit_test_enq_map_LDADD = $(UNIT_TEST_LDADD) -lrt
+unit_test_txn_map_SOURCES = unit_test_txn_map.cpp $(UNIT_TEST_SRCS)
+unit_test_txn_map_LDADD = $(UNIT_TEST_LDADD) -lrt
+
JournalSystemTests_la_SOURCES = \
JournalSystemTests.cpp \
JournalSystemTests.hpp
Modified: store/trunk/cpp/tests/jrnl/unit_test_enq_map.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/unit_test_enq_map.cpp 2007-12-12 20:34:17 UTC (rev 1471)
+++ store/trunk/cpp/tests/jrnl/unit_test_enq_map.cpp 2007-12-12 21:33:29 UTC (rev 1472)
@@ -29,9 +29,7 @@
* The GNU Lesser General Public License is available in the file COPYING.
*/
-#include <boost/test/results_reporter.hpp>
-#include <boost/test/unit_test.hpp>
-#include <boost/test/unit_test_log.hpp>
+#include "../unit_test.h"
#include <iostream>
#include <jrnl/enq_map.hpp>
#include <jrnl/jerrno.hpp>
@@ -39,17 +37,19 @@
using namespace boost::unit_test;
using namespace rhm::journal;
+QPID_AUTO_TEST_SUITE(eng_map_suite)
+
// Test functions of the form
// void fn() {...}
-void test_constructor()
+BOOST_AUTO_TEST_CASE(test_constructor)
{
enq_map e1;
BOOST_CHECK(e1.empty());
BOOST_CHECK_EQUAL(e1.size(), 0);
}
-void test_insert_get()
+BOOST_AUTO_TEST_CASE(test_insert_get)
{
u_int16_t fid;
u_int64_t rid;
@@ -106,7 +106,7 @@
BOOST_CHECK_EQUAL(e2.size(), 0);
}
-void test_get_remove()
+BOOST_AUTO_TEST_CASE(test_get_remove)
{
u_int16_t fid;
u_int64_t rid;
@@ -140,7 +140,7 @@
BOOST_CHECK_EQUAL(e3.size(), 85ULL);
}
-void test_lock()
+BOOST_AUTO_TEST_CASE(test_lock)
{
u_int16_t fid;
u_int64_t rid;
@@ -204,7 +204,7 @@
BOOST_CHECK(e4.empty());
}
-void test_lists()
+BOOST_AUTO_TEST_CASE(test_lists)
{
u_int16_t fid;
u_int64_t rid;
@@ -241,21 +241,4 @@
BOOST_CHECK_EQUAL(fid_list[i], ret_fid_list[i]);
}
-// Initialize test suite and include test functions
-
-test_suite* init_unit_test_suite(int, char**)
-{
- std::cout << "--------" << std::endl << "unit_test_enq_map: ";
- test_suite* ts = BOOST_TEST_SUITE("unit_test_enq_map");
-
- results_reporter::set_level(SHORT_REPORT);
- unit_test_log_t::instance().set_threshold_level(log_messages);
-
- ts->add(BOOST_TEST_CASE(&test_constructor));
- ts->add(BOOST_TEST_CASE(&test_insert_get));
- ts->add(BOOST_TEST_CASE(&test_get_remove));
- ts->add(BOOST_TEST_CASE(&test_lock));
- ts->add(BOOST_TEST_CASE(&test_lists));
-
- return ts;
-}
+QPID_AUTO_TEST_SUITE_END()
Modified: store/trunk/cpp/tests/jrnl/unit_test_jdir.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/unit_test_jdir.cpp 2007-12-12 20:34:17 UTC (rev 1471)
+++ store/trunk/cpp/tests/jrnl/unit_test_jdir.cpp 2007-12-12 21:33:29 UTC (rev 1472)
@@ -29,9 +29,7 @@
* The GNU Lesser General Public License is available in the file COPYING.
*/
-#include <boost/test/results_reporter.hpp>
-#include <boost/test/unit_test.hpp>
-#include <boost/test/unit_test_log.hpp>
+#include "../unit_test.h"
#include <dirent.h>
#include <errno.h>
#include <fstream>
@@ -44,6 +42,8 @@
#include <jrnl/jexception.hpp>
#include <sys/stat.h>
+QPID_AUTO_TEST_SUITE(jdir_suite)
+
#define NUM_JFILES 4
#define JFSIZE_SBLKS 128
@@ -67,7 +67,7 @@
// Test functions of the form
// void fn() {...}
-void test_constructor()
+BOOST_AUTO_TEST_CASE(test_constructor)
{
std::string dir("/tmp/A/B/C/D/E/F");
std::string bfn("test_base");
@@ -76,7 +76,7 @@
BOOST_CHECK(dir1.base_filename().compare(bfn) == 0);
}
-void test_create_delete_dir()
+BOOST_AUTO_TEST_CASE(test_create_delete_dir)
{
// Use instance
std::string dir_A("/tmp/A");
@@ -135,7 +135,7 @@
}
}
-void test_create_delete_dir_recursive()
+BOOST_AUTO_TEST_CASE(test_create_delete_dir_recursive)
{
// Use instances
check_dir_not_existing("/tmp/E");
@@ -201,7 +201,7 @@
BOOST_CHECK(!jdir::exists("/tmp/I"));
}
-void test_clear_verify_dir()
+BOOST_AUTO_TEST_CASE(test_clear_verify_dir)
{
// Use instances
const char* jrnl_dir = "/tmp/test_dir_1";
@@ -389,20 +389,4 @@
BOOST_FAIL("Unable to remove directory " << dirname);
}
-// Initialize test suite and include test functions
-
-test_suite* init_unit_test_suite(int, char**)
-{
- std::cout << "--------" << std::endl << "unit_test_jdir: ";
- test_suite* ts = BOOST_TEST_SUITE("unit_test_jdir");
-
- results_reporter::set_level(SHORT_REPORT);
- unit_test_log_t::instance().set_threshold_level(log_messages);
-
- ts->add(BOOST_TEST_CASE(&test_constructor));
- ts->add(BOOST_TEST_CASE(&test_create_delete_dir));
- ts->add(BOOST_TEST_CASE(&test_create_delete_dir_recursive));
- ts->add(BOOST_TEST_CASE(&test_clear_verify_dir));
-
- return ts;
-}
+QPID_AUTO_TEST_SUITE_END()
Modified: store/trunk/cpp/tests/jrnl/unit_test_jerrno.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/unit_test_jerrno.cpp 2007-12-12 20:34:17 UTC (rev 1471)
+++ store/trunk/cpp/tests/jrnl/unit_test_jerrno.cpp 2007-12-12 21:33:29 UTC (rev 1472)
@@ -29,19 +29,19 @@
* The GNU Lesser General Public License is available in the file COPYING.
*/
-#include <boost/test/results_reporter.hpp>
-#include <boost/test/unit_test.hpp>
-#include <boost/test/unit_test_log.hpp>
+#include "../unit_test.h"
#include <iostream>
#include <jrnl/jerrno.hpp>
+QPID_AUTO_TEST_SUITE(jerrno_suite)
+
using namespace boost::unit_test;
using namespace rhm::journal;
// Test functions of the form
// void fn() {...}
-void test_jerrno()
+BOOST_AUTO_TEST_CASE(test_jerrno)
{
const char* m = "JERR__MALLOC";
std::string malloc_msg = std::string(jerrno::err_msg(jerrno::JERR__MALLOC));
@@ -49,17 +49,4 @@
BOOST_CHECK(::strcmp(jerrno::err_msg(0), "<Unknown error code>") == 0);
}
-// Initialize test suite and include test functions
-
-test_suite* init_unit_test_suite(int, char**)
-{
- std::cout << "--------" << std::endl << "unit_test_jerrno: ";
- test_suite* ts = BOOST_TEST_SUITE("unit_test_jerrno");
-
- results_reporter::set_level(SHORT_REPORT);
- unit_test_log_t::instance().set_threshold_level(log_messages);
-
- ts->add(BOOST_TEST_CASE(&test_jerrno));
-
- return ts;
-}
+QPID_AUTO_TEST_SUITE_END()
Modified: store/trunk/cpp/tests/jrnl/unit_test_jexception.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/unit_test_jexception.cpp 2007-12-12 20:34:17 UTC (rev 1471)
+++ store/trunk/cpp/tests/jrnl/unit_test_jexception.cpp 2007-12-12 21:33:29 UTC (rev 1472)
@@ -29,9 +29,7 @@
* The GNU Lesser General Public License is available in the file COPYING.
*/
-#include <boost/test/results_reporter.hpp>
-#include <boost/test/unit_test.hpp>
-#include <boost/test/unit_test_log.hpp>
+#include "../unit_test.h"
#include <iostream>
#include <jrnl/jerrno.hpp>
#include <jrnl/jexception.hpp>
@@ -39,6 +37,8 @@
using namespace boost::unit_test;
using namespace rhm::journal;
+QPID_AUTO_TEST_SUITE(jexception_suite)
+
// Helper function declarations
void throw_exception(const jexception& e, size_t what_len, size_t ai_len);
void throw_exception(const jexception& e, size_t what_len, size_t tc_len, size_t tf_len);
@@ -48,7 +48,7 @@
// Test functions of the form
// void fn() {...}
-void test_constructor_1()
+BOOST_AUTO_TEST_CASE(test_constructor_1)
{
try
{
@@ -70,7 +70,7 @@
}
}
-void test_constructor_2()
+BOOST_AUTO_TEST_CASE(test_constructor_2)
{
const u_int32_t err_code = 2;
try
@@ -93,7 +93,7 @@
}
}
-void test_constructor_3a()
+BOOST_AUTO_TEST_CASE(test_constructor_3a)
{
const char* err_msg = "exception3";
try
@@ -116,7 +116,7 @@
}
}
-void test_constructor_3b()
+BOOST_AUTO_TEST_CASE(test_constructor_3b)
{
const std::string err_msg("exception3");
try
@@ -139,7 +139,7 @@
}
}
-void test_constructor_4a()
+BOOST_AUTO_TEST_CASE(test_constructor_4a)
{
const u_int32_t err_code = 4;
const char* err_msg = "exception4";
@@ -163,7 +163,7 @@
}
}
-void test_constructor_4b()
+BOOST_AUTO_TEST_CASE(test_constructor_4b)
{
const u_int32_t err_code = 4;
const std::string err_msg("exception4");
@@ -187,7 +187,7 @@
}
}
-void test_constructor_5a()
+BOOST_AUTO_TEST_CASE(test_constructor_5a)
{
const u_int32_t err_code = 5;
const char* err_class = "class5";
@@ -212,7 +212,7 @@
}
}
-void test_constructor_5b()
+BOOST_AUTO_TEST_CASE(test_constructor_5b)
{
const u_int32_t err_code = 5;
const std::string err_class("class5");
@@ -237,7 +237,7 @@
}
}
-void test_constructor_6a()
+BOOST_AUTO_TEST_CASE(test_constructor_6a)
{
const u_int32_t err_code = 6;
const char* err_msg = "exception6";
@@ -263,7 +263,7 @@
}
}
-void test_constructor_6b()
+BOOST_AUTO_TEST_CASE(test_constructor_6b)
{
const u_int32_t err_code = 6;
const std::string err_msg("exception6");
@@ -289,7 +289,7 @@
}
}
-void test_msg_scope()
+BOOST_AUTO_TEST_CASE(test_msg_scope)
{
try
{
@@ -331,28 +331,5 @@
BOOST_CHECK_EQUAL(e.throwing_fn().size(), tf_len);
}
}
-
-// Initialize test suite and include test functions
-test_suite* init_unit_test_suite(int, char**)
-{
- std::cout << "--------" << std::endl << "unit_test_jexception: ";
- test_suite* ts = BOOST_TEST_SUITE("unit_test_jexception");
-
- results_reporter::set_level(SHORT_REPORT);
- unit_test_log_t::instance().set_threshold_level(log_messages);
-
- ts->add(BOOST_TEST_CASE(&test_constructor_1));
- ts->add(BOOST_TEST_CASE(&test_constructor_2));
- ts->add(BOOST_TEST_CASE(&test_constructor_3a));
- ts->add(BOOST_TEST_CASE(&test_constructor_3b));
- ts->add(BOOST_TEST_CASE(&test_constructor_4a));
- ts->add(BOOST_TEST_CASE(&test_constructor_4b));
- ts->add(BOOST_TEST_CASE(&test_constructor_5a));
- ts->add(BOOST_TEST_CASE(&test_constructor_5b));
- ts->add(BOOST_TEST_CASE(&test_constructor_6a));
- ts->add(BOOST_TEST_CASE(&test_constructor_6b));
- ts->add(BOOST_TEST_CASE(&test_msg_scope));
-
- return ts;
-}
+QPID_AUTO_TEST_SUITE_END()
Modified: store/trunk/cpp/tests/jrnl/unit_test_jinf.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/unit_test_jinf.cpp 2007-12-12 20:34:17 UTC (rev 1471)
+++ store/trunk/cpp/tests/jrnl/unit_test_jinf.cpp 2007-12-12 21:33:29 UTC (rev 1472)
@@ -29,9 +29,7 @@
* The GNU Lesser General Public License is available in the file COPYING.
*/
-#include <boost/test/results_reporter.hpp>
-#include <boost/test/unit_test.hpp>
-#include <boost/test/unit_test_log.hpp>
+#include "../unit_test.h"
#include <fstream>
#include <iomanip>
#include <iostream>
@@ -47,6 +45,8 @@
using namespace boost::unit_test;
using namespace rhm::journal;
+QPID_AUTO_TEST_SUITE(jinf_suite)
+
// Helper function declarations
const std::string jid("test journal id");
const std::string jdir("/tmp");
@@ -67,7 +67,7 @@
// Test functions of the form
// void fn() {...}
-void test_write_constructor()
+BOOST_AUTO_TEST_CASE(test_write_constructor)
{
::clock_gettime(CLOCK_REALTIME, &ts);
jinf ji(jid, jdir, base_filename, NUM_JFILES, JFSIZE_SBLKS, ts);
@@ -89,7 +89,7 @@
ji.write();
}
-void test_read_constructor()
+BOOST_AUTO_TEST_CASE(test_read_constructor)
{
std::stringstream fn;
fn << jdir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
@@ -111,7 +111,7 @@
BOOST_CHECK_EQUAL(ji.rmgr_num_pages(), (u_int32_t)JRNL_RMGR_PAGES);
}
-void test_validate()
+BOOST_AUTO_TEST_CASE(test_validate)
{
std::stringstream fn;
fn << jdir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
@@ -119,7 +119,7 @@
// TODO: Check validation picks up conflict, but need to be friend to jinf to do it
}
-void test_analyze_empty_journal()
+BOOST_AUTO_TEST_CASE(test_analyze_empty_journal)
{
std::vector<std::string> jfiles;
create_journal_filenames(jfiles);
@@ -139,7 +139,7 @@
clean_journal_files(jfiles);
}
-void test_analyze_linear_journal()
+BOOST_AUTO_TEST_CASE(test_analyze_linear_journal)
{
std::vector<std::string> jfiles;
for (int i=0; i<NUM_JFILES; i++)
@@ -244,21 +244,4 @@
fh._ts_nsec = ts.tv_nsec;
}
-// Initialize test suite and include test functions
-
-test_suite* init_unit_test_suite(int, char**)
-{
- std::cout << "--------" << std::endl << "unit_test_jinf: ";
- test_suite* ts = BOOST_TEST_SUITE("unit_test_jinf");
-
- results_reporter::set_level(SHORT_REPORT);
- unit_test_log_t::instance().set_threshold_level(log_messages);
-
- ts->add(BOOST_TEST_CASE(&test_write_constructor));
- ts->add(BOOST_TEST_CASE(&test_read_constructor));
- ts->add(BOOST_TEST_CASE(&test_validate));
- ts->add(BOOST_TEST_CASE(&test_analyze_empty_journal));
- ts->add(BOOST_TEST_CASE(&test_analyze_linear_journal));
-
- return ts;
-}
+QPID_AUTO_TEST_SUITE_END()
Modified: store/trunk/cpp/tests/jrnl/unit_test_rec_hdr.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/unit_test_rec_hdr.cpp 2007-12-12 20:34:17 UTC (rev 1471)
+++ store/trunk/cpp/tests/jrnl/unit_test_rec_hdr.cpp 2007-12-12 21:33:29 UTC (rev 1472)
@@ -29,9 +29,7 @@
* The GNU Lesser General Public License is available in the file COPYING.
*/
-#include <boost/test/results_reporter.hpp>
-#include <boost/test/unit_test.hpp>
-#include <boost/test/unit_test_log.hpp>
+#include "../unit_test.h"
#include <iostream>
#include <jrnl/deq_hdr.hpp>
#include <jrnl/enq_hdr.hpp>
@@ -43,10 +41,12 @@
using namespace boost::unit_test;
using namespace rhm::journal;
+QPID_AUTO_TEST_SUITE(rec_hdr_suite)
+
// Test functions of the form
// void fn() {...}
-void test_hdr()
+BOOST_AUTO_TEST_CASE(test_hdr)
{
rec_hdr h1;
BOOST_CHECK_EQUAL(h1._magic, 0UL);
@@ -107,7 +107,7 @@
BOOST_CHECK(!h1.get_owi());
}
-void test_rec_tail()
+BOOST_AUTO_TEST_CASE(test_rec_tail)
{
const u_int32_t magic = 0xfedcba98;
const u_int64_t rid = 0xfedcba9876543210ULL;
@@ -133,7 +133,7 @@
}
}
-void test_file_hdr()
+BOOST_AUTO_TEST_CASE(test_file_hdr)
{
const u_int32_t magic = 0xfedcba98UL;
const u_int8_t version = 0xa5;
@@ -213,7 +213,7 @@
}
}
-void test_enq_hdr()
+BOOST_AUTO_TEST_CASE(test_enq_hdr)
{
const u_int32_t magic = 0xfedcba98UL;
const u_int8_t version = 0xa5;
@@ -320,7 +320,7 @@
}
}
-void test_deq_hdr()
+BOOST_AUTO_TEST_CASE(test_deq_hdr)
{
const u_int32_t magic = 0xfedcba98UL;
const u_int8_t version = 0xa5;
@@ -375,7 +375,7 @@
}
}
-void test_txn_hdr()
+BOOST_AUTO_TEST_CASE(test_txn_hdr)
{
const u_int32_t magic = 0xfedcba98UL;
const u_int8_t version = 0xa5;
@@ -427,22 +427,4 @@
}
}
-// Initialize test suite and include test functions
-
-test_suite* init_unit_test_suite(int, char**)
-{
- std::cout << "--------" << std::endl << "unit_test_rec_hdr: ";
- test_suite* ts = BOOST_TEST_SUITE("unit_test_rec_hdr");
-
- results_reporter::set_level(SHORT_REPORT);
- unit_test_log_t::instance().set_threshold_level(log_messages);
-
- ts->add(BOOST_TEST_CASE(&test_hdr));
- ts->add(BOOST_TEST_CASE(&test_rec_tail));
- ts->add(BOOST_TEST_CASE(&test_file_hdr));
- ts->add(BOOST_TEST_CASE(&test_enq_hdr));
- ts->add(BOOST_TEST_CASE(&test_deq_hdr));
- ts->add(BOOST_TEST_CASE(&test_txn_hdr));
-
- return ts;
-}
+QPID_AUTO_TEST_SUITE_END()
Modified: store/trunk/cpp/tests/jrnl/unit_test_txn_map.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/unit_test_txn_map.cpp 2007-12-12 20:34:17 UTC (rev 1471)
+++ store/trunk/cpp/tests/jrnl/unit_test_txn_map.cpp 2007-12-12 21:33:29 UTC (rev 1472)
@@ -29,9 +29,7 @@
* The GNU Lesser General Public License is available in the file COPYING.
*/
-#include <boost/test/results_reporter.hpp>
-#include <boost/test/unit_test.hpp>
-#include <boost/test/unit_test_log.hpp>
+#include "../unit_test.h"
#include <iostream>
#include <iomanip>
#include <jrnl/txn_map.hpp>
@@ -40,6 +38,8 @@
using namespace boost::unit_test;
using namespace rhm::journal;
+QPID_AUTO_TEST_SUITE(txn_map_suite)
+
// Helper function declarations
const std::string make_xid(u_int64_t rid);
void check_td_equal(txn_data& td1, txn_data& td2);
@@ -47,7 +47,7 @@
// Test functions of the form
// void fn() {...}
-void test_constructor()
+BOOST_AUTO_TEST_CASE(test_constructor)
{
const u_int64_t rid = 0x123456789abcdef0ULL;
const u_int64_t drid = 0xfedcba9876543210ULL;
@@ -65,7 +65,7 @@
BOOST_CHECK_EQUAL(t1.size(), 0);
}
-void test_insert_get()
+BOOST_AUTO_TEST_CASE(test_insert_get)
{
u_int16_t fid;
u_int64_t rid;
@@ -109,18 +109,4 @@
BOOST_CHECK_EQUAL(td1._aio_compl, td2._aio_compl);
}
-// Initialize test suite and include test functions
-
-test_suite* init_unit_test_suite(int, char**)
-{
- std::cout << "--------" << std::endl << "unit_test_txn_map: ";
- test_suite* ts = BOOST_TEST_SUITE("unit_test_txn_map");
-
- results_reporter::set_level(SHORT_REPORT);
- unit_test_log_t::instance().set_threshold_level(log_messages);
-
- ts->add(BOOST_TEST_CASE(&test_constructor));
- ts->add(BOOST_TEST_CASE(&test_insert_get));
-
- return ts;
-}
+QPID_AUTO_TEST_SUITE_END()
18 years, 4 months
rhmessaging commits: r1471 - mgmt/notes.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-12-12 15:34:17 -0500 (Wed, 12 Dec 2007)
New Revision: 1471
Modified:
mgmt/notes/justin-todo.txt
Log:
Updates todo items.
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2007-12-12 19:27:06 UTC (rev 1470)
+++ mgmt/notes/justin-todo.txt 2007-12-12 20:34:17 UTC (rev 1471)
@@ -24,6 +24,8 @@
* Paginate clients
+ * Paginate sessions
+
* Prevent users from mapping a broker to a group more than once
* Deal with problem of calling method on broker that is not there
@@ -40,6 +42,13 @@
* Ask tross to take some prints out of ManagedBroker.start
* Get rid of CuminClass.mint_stats_class
+
+ * Add inactive state to some status lights
+
+ * Fix session and client naming
+
+ * Group form submit has different behaviors between hitting enter and
+ clicking submit
Deferred
18 years, 4 months
rhmessaging commits: r1470 - mgmt/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-12-12 14:27:06 -0500 (Wed, 12 Dec 2007)
New Revision: 1470
Modified:
mgmt/mint/Makefile
Log:
Renames MINT_XML_SCHEMA to MINT_SCHEMA_XML since that's what I kept
trying to type.
Modified: mgmt/mint/Makefile
===================================================================
--- mgmt/mint/Makefile 2007-12-12 19:26:03 UTC (rev 1469)
+++ mgmt/mint/Makefile 2007-12-12 19:27:06 UTC (rev 1470)
@@ -2,18 +2,18 @@
dsn := "postgresql://localhost/"
-ifndef MINT_XML_SCHEMA
- $(error "MINT_XML_SCHEMA is not set")
+ifndef MINT_SCHEMA_XML
+ $(error "MINT_SCHEMA_XML is not set")
endif
message:
@echo "Run 'make schema' to regenerate the schema from the file indicated in the"
- @echo "variable MINT_XML_SCHEMA."
+ @echo "variable MINT_SCHEMA_XML."
schema: schema-python schema-sql
schema-python:
- python python/mint/schemaparser.py ${MINT_XML_SCHEMA} python/mint/schema.py ${dsn}
+ python python/mint/schemaparser.py ${MINT_SCHEMA_XML} python/mint/schema.py ${dsn}
schema-sql: python/mint/schema.py
sqlobject-admin sql -m mint -m mint.schema -c ${dsn} | sed -e '1,2d' > python/mint/schema.sql
18 years, 4 months
rhmessaging commits: r1469 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-12-12 14:26:03 -0500 (Wed, 12 Dec 2007)
New Revision: 1469
Modified:
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/model.py
Log:
A bunch of fixes to make clients work again, now that we have real
client data from the broker.
Adds client stat ui metadata.
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2007-12-12 19:24:20 UTC (rev 1468)
+++ mgmt/cumin/python/cumin/client.py 2007-12-12 19:26:03 UTC (rev 1469)
@@ -51,13 +51,13 @@
def render_item_produced(self, session, client):
unit = self.unit.get(session)
key = unit == "b" and "bytesProduced" or "msgsProduced"
- value = getattr(client.mintClientStats, key)
+ value = self.app.model.client.get_stat(key).rate(client)
return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
def render_item_consumed(self, session, client):
unit = self.unit.get(session)
key = unit == "b" and "bytesConsumed" or "msgsConsumed"
- value = getattr(client.mintClientStats, key)
+ value = self.app.model.client.get_stat(key).rate(client)
return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
def render_item_status(self, session, client):
@@ -80,20 +80,20 @@
class ClientStatus(CuminStatus):
def render_messages_produced(self, session, client):
- value = client.mintClientStats.msgsProduced
- return fmt_rate(value, "msg", "sec")
+ stat = self.app.model.client.get_stat("msgsProduced")
+ return fmt_rate(stat.rate(client), "msg", "sec")
def render_messages_consumed(self, session, client):
- value = client.mintClientStats.msgsConsumed
- return fmt_rate(value, "msg", "sec")
+ stat = self.app.model.client.get_stat("msgsConsumed")
+ return fmt_rate(stat.rate(client), "msg", "sec")
def render_bytes_produced(self, session, client):
- value = client.mintClientStats.bytesProduced
- return fmt_rate(value, "byte", "sec")
+ stat = self.app.model.client.get_stat("bytesProduced")
+ return fmt_rate(stat.rate(client), "byte", "sec")
def render_bytes_consumed(self, session, client):
- value = client.mintClientStats.bytesConsumed
- return fmt_rate(value, "byte", "sec")
+ stat = self.app.model.client.get_stat("bytesConsumed")
+ return fmt_rate(stat.rate(client), "byte", "sec")
class ClientView(Widget):
def __init__(self, app, name):
@@ -165,24 +165,28 @@
class ClientSessionSet(ItemSet):
def get_title(self, session, client):
- return "Sessions %s" % fmt_count(len(client.session_items()))
+ return "Sessions %s" % fmt_count(self.get_item_count(session, client))
+ def get_item_count(self, session, client):
+ return Session.select(Session.q.clientID == client.id).count()
+
def do_get_items(self, session, client):
- return sorted_by(client.session_items())
+ return Session.select(Session.q.clientID == client.id)
def render_item_name(self, session, session_):
return session_.name
def render_item_remaining_lifespan(self, session, session_):
- value = session_.mintSessionStats.remainingLifespan
- return fmt_duration(value)
+ stat = self.app.model.session.get_stat("remainingLifespan")
+ return fmt_duration(stat.value(session_))
def render_item_frames_outstanding(self, session, session_):
- return session_.mintSessionStats.framesOutstanding
+ stat = self.app.model.session.get_stat("framesOutstanding")
+ return stat.value(session_)
def render_item_attached(self, session, session_):
- value = session_.mintSessionStats.attached
- return fmt_predicate(value)
+ stat = self.app.model.session.get_stat("attached")
+ return fmt_predicate(stat.value(session_))
def render_item_status(self, session, session_):
return fmt_ostatus(session_)
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-12-12 19:24:20 UTC (rev 1468)
+++ mgmt/cumin/python/cumin/model.py 2007-12-12 19:26:03 UTC (rev 1469)
@@ -12,6 +12,8 @@
self.queue = CuminQueue(self)
self.exchange = CuminExchange(self)
self.binding = CuminBinding(self)
+ self.client = CuminClient(self)
+ self.session = CuminSession(self)
def add_class(self, cls):
self.classes[cls.mint_class] = cls
@@ -65,7 +67,10 @@
self.cumin_class.add_stat(self)
def value(self, object):
- return nvl(getattr(object.statsCurr, self.name, -1), -1)
+ try:
+ return nvl(getattr(object.statsCurr, self.name), -1)
+ except AttributeError:
+ return -1
def samples(self, object, limit=None):
name = self.cumin_class.name
@@ -85,20 +90,23 @@
return samples
def rate(self, object):
- if object.statsCurr:
- curr = getattr(object.statsCurr, self.name)
+ try:
+ if object.statsCurr:
+ curr = getattr(object.statsCurr, self.name)
- if object.statsPrev:
- prev = getattr(object.statsPrev, self.name)
+ if object.statsPrev:
+ prev = getattr(object.statsPrev, self.name)
- if curr is not None and prev is not None:
- return (curr - prev) / float(1)
+ if curr is not None and prev is not None:
+ return (curr - prev) / float(1)
+ else:
+ return 0
else:
return 0
else:
return 0
- else:
- return 0
+ except AttributeError:
+ return -1
def write_xml(self, object, writer):
writer.write("<stat name=\"%s\" value=\"%i\" rate=\"%i\"/>" \
@@ -339,3 +347,49 @@
stat.title = "Msgs. Matched"
stat.unit = "message"
stat.categories = ("general")
+
+class CuminClient(CuminClass):
+ def __init__(self, model):
+ super(CuminClient, self).__init__(model, "client", Client)
+
+ self.mint_stats_class = ClientStats
+
+ stat = CuminStat(self, "bytesProduced", "int")
+ stat.title = "Bytes Produced"
+ stat.unit = "byte"
+ stat.categories = ("general")
+
+ stat = CuminStat(self, "bytesConsumed", "int")
+ stat.title = "Bytes Consumed"
+ stat.unit = "byte"
+ stat.categories = ("general")
+
+ stat = CuminStat(self, "msgsProduced", "int")
+ stat.title = "Msgs. Produced"
+ stat.unit = "message"
+ stat.categories = ("general")
+
+ stat = CuminStat(self, "msgsConsumed", "int")
+ stat.title = "Msgs. Produced"
+ stat.unit = "message"
+ stat.categories = ("general")
+
+class CuminSession(CuminClass):
+ def __init__(self, model):
+ super(CuminSession, self).__init__(model, "session", Session)
+
+ self.mint_stats_class = SessionStats
+
+ stat = CuminStat(self, "remainingLifespan", "int")
+ stat.title = "Remaining Lifespan"
+ stat.unit = "second"
+ stat.categories = ("general")
+
+ stat = CuminStat(self, "framesOutstanding", "int")
+ stat.title = "Frames Outstanding"
+ stat.unit = "frame"
+ stat.categories = ("general")
+
+ stat = CuminStat(self, "attached", "bool")
+ stat.title = "Attached"
+ stat.categories = ("general")
18 years, 4 months
rhmessaging commits: r1468 - mgmt/notes.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-12-12 14:24:20 -0500 (Wed, 12 Dec 2007)
New Revision: 1468
Modified:
mgmt/notes/justin-todo.txt
Log:
Adds some todo items.
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2007-12-12 18:42:44 UTC (rev 1467)
+++ mgmt/notes/justin-todo.txt 2007-12-12 19:24:20 UTC (rev 1468)
@@ -37,6 +37,10 @@
* Need to handle exceptions in broker connect thread, so it doesn't
stop trying
+ * Ask tross to take some prints out of ManagedBroker.start
+
+ * Get rid of CuminClass.mint_stats_class
+
Deferred
* Add a do_get_item_count, and cache result for use by get_item_count
18 years, 4 months
rhmessaging commits: r1467 - mgmt/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-12-12 13:42:44 -0500 (Wed, 12 Dec 2007)
New Revision: 1467
Modified:
mgmt/mint/python/mint/__init__.py
Log:
Adds a comment describing a instrument callback problem.
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2007-12-12 18:28:51 UTC (rev 1466)
+++ mgmt/mint/python/mint/__init__.py 2007-12-12 18:42:44 UTC (rev 1467)
@@ -174,6 +174,11 @@
objNameStats = eval("schema.%sStats" % (schema.schemaNameToClassMap[objectName].__name__))
objStats = objNameStats.__new__(objNameStats)
objStats.__init__()
+
+ # XXX the following statement blows up with an "unexpected keyword
+ # argument" error if the broker sends down stats that we don't
+ # know about; we should simply carry on, instead
+
objStats.set(**d)
d = dict()
if (timestamps[2] != 0):
18 years, 4 months