[rhmessaging-commits] rhmessaging commits: r1734 - in store/trunk/cpp/tests: jrnl and 1 other directories.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Thu Feb 28 12:03:42 EST 2008


Author: kpvdr
Date: 2008-02-28 12:03:42 -0500 (Thu, 28 Feb 2008)
New Revision: 1734

Added:
   store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp
   store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
   store/trunk/cpp/tests/jrnl/_st_read.cpp
   store/trunk/cpp/tests/jrnl/_st_read_txn.cpp
Removed:
   store/trunk/cpp/tests/dlclose_noop.c
   store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp
   store/trunk/cpp/tests/jrnl/JournalSystemTests.hpp
   store/trunk/cpp/tests/run-unit-tests
   store/trunk/cpp/tests/test_plugin.h
Modified:
   store/trunk/cpp/tests/
   store/trunk/cpp/tests/Makefile.am
   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/jrnl/
   store/trunk/cpp/tests/jrnl/Makefile.am
   store/trunk/cpp/tests/jrnl/_st_basic.cpp
   store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp
   store/trunk/cpp/tests/jrnl/_ut_jdir.cpp
   store/trunk/cpp/tests/jrnl/_ut_jerrno.cpp
   store/trunk/cpp/tests/jrnl/_ut_jexception.cpp
   store/trunk/cpp/tests/jrnl/_ut_jinf.cpp
   store/trunk/cpp/tests/jrnl/_ut_rec_hdr.cpp
   store/trunk/cpp/tests/jrnl/_ut_time_ns.cpp
   store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp
   store/trunk/cpp/tests/jrnl/jtt/_ut_data_src.cpp
   store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_init_params.cpp
   store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp
   store/trunk/cpp/tests/jrnl/jtt/_ut_read_arg.cpp
   store/trunk/cpp/tests/jrnl/jtt/_ut_test_case.cpp
   store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result.cpp
   store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result_agregation.cpp
   store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_set.cpp
   store/trunk/cpp/tests/jrnl/run-journal-tests
Log:
Expanded journal tests; moved all journal cppunit tests over to use boost tests.


Property changes on: store/trunk/cpp/tests
___________________________________________________________________
Name: svn:ignore
   - .deps
.libs
Makefile
Makefile.in
gen.mk
qpid.log
vg-log.bdb.1
vg-log.bdb.2
vg-log.bdb.3
vg-log.bdb.4
vg-log.bdb.5
vg-log.bdb.6
vg-log.jrnl.1
vg-log.jrnl.2
vg-log.jrnl.3
vg-log.jrnl.4
vg-log.jrnl.5
vg-log.jrnl.6

   + .deps
.libs
Makefile
Makefile.in
gen.mk
qpid.log
OrderingTest
SimpleTest
TransactionalTest
TwoPhaseCommitTest
vg-log.bdb.1
vg-log.bdb.2
vg-log.bdb.3
vg-log.bdb.4
vg-log.bdb.5
vg-log.bdb.6
vg-log.bdb.7
vg-log.bdb.8
vg-log.jrnl.1
vg-log.jrnl.2
vg-log.jrnl.3
vg-log.jrnl.4
vg-log.jrnl.5
vg-log.jrnl.6
vg-log.jrnl.7
vg-log.jrnl.8


Modified: store/trunk/cpp/tests/Makefile.am
===================================================================
--- store/trunk/cpp/tests/Makefile.am	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/Makefile.am	2008-02-28 17:03:42 UTC (rev 1734)
@@ -2,51 +2,45 @@
 abs_srcdir=@abs_srcdir@
 
 AM_CXXFLAGS = $(WARNING_CFLAGS) $(APR_CXXFLAGS) $(QPID_CXXFLAGS) \
-	$(CPPUNIT_CXXFLAGS)
+	$(CPPUNIT_CXXFLAGS) -DBOOST_TEST_DYN_LINK
 
 INCLUDES=-I../lib
 
-EXTRA_DIST = persistence.py
-
 SUBDIRS = jrnl
 
-unit_tests =					\
-  OrderingTest					\
-  SimpleTest					\
-  TwoPhaseCommitTest			\
-  TransactionalTest
-
-TESTS =						\
-  run-unit-tests                \
+TESTS =						    \
+  SimpleTest                    \
+  OrderingTest                  \
+  TransactionalTest             \
+  TwoPhaseCommitTest            \
   system_test.sh
 
-TESTS_ENVIRONMENT =						\
-  QPID_DIR=$(QPID_DIR)						\
-  VALGRIND=$(VALGRIND)						\
-  abs_srcdir=$(abs_srcdir)					\
-  LIBBDBSTORE=$(abs_builddir)/../lib/.libs/libbdbstore.so
+check_PROGRAMS =                \
+  SimpleTest                    \
+  OrderingTest                  \
+  TransactionalTest             \
+  TwoPhaseCommitTest
 
-EXTRA_DIST += $(TESTS) test_plugin.h MessageUtils.h setup .vg-supp unit_test.h unit_test.cpp
+UNIT_TEST_SRCS = unit_test.cpp unit_test.hpp
+UNIT_TEST_LDADD = -lboost_unit_test_framework -lbdbstore -L../lib/.libs 
 
 include gen.mk
 
-test_libs= ../lib/libbdbstore.la $(CPPUNIT_LIBS) $(QPID_LIBS)
-
 gen.mk: Makefile.am
 	(					\
-	  libs=;				\
-	  for i in $(unit_tests); do		\
-	    libs="$$libs $${i}.la";		\
-	    echo $${i}_la_SOURCES = $$i.cpp;	\
-	    echo $${i}_la_LIBADD  = '$$(test_libs)';			\
-	    echo $${i}_la_LDFLAGS = "-module -rpath `pwd`";		\
+	  for i in $(check_PROGRAMS); do		\
+	    echo $${i}_SOURCES = $$i.cpp '$$(UNIT_TEST_SRCS)';	\
+	    echo $${i}_LDADD  = '$$(UNIT_TEST_LDADD)' -lrt;		\
+        echo ; \
 	  done;					\
-	  echo "check_LTLIBRARIES =$$libs";	\
 	)					\
 	> $@-t
 	mv $@-t $@
 
-check_LTLIBRARIES += libdlclose_noop.la
-libdlclose_noop_la_LDFLAGS = -module -rpath $(abs_builddir)
-libdlclose_noop_la_SOURCES = dlclose_noop.c
+EXTRA_DIST = system_test.sh persistence.py MessageUtils.h setup .vg-supp
 
+TESTS_ENVIRONMENT =						\
+  QPID_DIR=$(QPID_DIR)						\
+  VALGRIND=$(VALGRIND)						\
+  abs_srcdir=$(abs_srcdir)					\
+  LIBBDBSTORE=$(abs_builddir)/../lib/.libs/libbdbstore.so

Modified: store/trunk/cpp/tests/OrderingTest.cpp
===================================================================
--- store/trunk/cpp/tests/OrderingTest.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/OrderingTest.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -1,174 +1,173 @@
-/*
-    Copyright (C) 2007 Red Hat Software
-
-    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 file 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.
+/**
+* Red Hat Messaging - Message Journal
+*
+* This file contains the unit tests for the journal.
+*
+* Copyright 2007, 2008 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.
 */
 
+#include "unit_test.h"
+
 #include "BdbMessageStore.h"
+#include <iostream>
 #include "MessageUtils.h"
-#include <qpid/framing/AMQMethodBody.h>
-#include <qpid/framing/AMQHeaderBody.h>
-#include <qpid/broker/Message.h>
 #include <qpid/broker/Queue.h>
 #include <qpid/broker/RecoveryManagerImpl.h>
-#include "test_plugin.h"
-#include <iostream>
-#include <memory>
-#include <queue>
-#include <sstream>
+#include <qpid/framing/AMQHeaderBody.h>
 
 #define TESTDIR "/tmp"
 
-using boost::static_pointer_cast;
-using boost::dynamic_pointer_cast;
-using namespace rhm::bdbstore;
 using namespace qpid::broker;
 using namespace qpid::framing;
+using namespace rhm::bdbstore;
 
-class OrderingTest : public CppUnit::TestCase  
-{
-    CPPUNIT_TEST_SUITE(OrderingTest);
-    CPPUNIT_TEST(testBasicSync);
-    CPPUNIT_TEST(testCycleSync);
-    CPPUNIT_TEST(testBasicAsync);
-    CPPUNIT_TEST(testCycleAsync);
-    CPPUNIT_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE(OrderingTest)
 
-    const string name;
-    std::auto_ptr<BdbMessageStore> store;
-    QueueRegistry queues;
-    Queue::shared_ptr queue;
-    std::queue<string> ids;
-    int counter;
+const std::string file("OrderingTest");
 
-public:
-    OrderingTest() : name("OrderingQueue"), counter(1) {}
+// === Helper fns ===
 
-    void testBasicAsync()
-	{
-		testBasic(true);
-	}
+const string name("OrderingQueue");
+std::auto_ptr<BdbMessageStore> store;
+QueueRegistry queues;
+Queue::shared_ptr queue;
+std::queue<std::string> ids;
+int counter = 1;
 
-    void testCycleAsync()
-    {
-		testCycle(true);
-	}
+void setup(bool async)
+{
+    store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
+    store->init(TESTDIR, async, true, 4, 1);
+	store->truncate();
 
-    void testBasicSync()
-	{
-		testBasic(false);
-	}
+    queue = Queue::shared_ptr(new Queue(name, 0, store.get(), 0));
+    FieldTable settings;
+    queue->create(settings);
+}
 
-    void testCycleSync()
-    {
-		testCycle(false);
-	}
+void push()
+{
+    string base("Message");
+    std::stringstream id;
+    id << base << counter++;
+    string messageId(id.str());
+    ids.push(messageId);
+
+    Message::shared_ptr msg = MessageUtils::createMessage("exchange", "routing_key", messageId, 0);
+    msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
     
-    void testBasic(bool async = false)
-    {
-        setup(async);
-        //push on 10 messages
-        for (int i = 0; i < 10; i++) push();
-        restart(async);
-        check();
-    }
+    queue->deliver(msg);
+}
 
-    void testCycle(bool async = false)
-    {
-        setup(async);
-        //push on 10 messages:
-        for (int i = 0; i < 10; i++) push();
-        //pop 5:
-        for (int i = 0; i < 5; i++) pop();
-        //push on another 5:
-        for (int i = 0; i < 5; i++) push();
-        restart(async);
-        check();
+bool pop()
+{
+    Message::shared_ptr msg = queue->dequeue().payload;
+    if (msg) {
+        queue->dequeue(0, msg);
+        string expected = ids.front();
+        ids.pop();
+        BOOST_REQUIRE_EQUAL(expected, msg->getProperties<MessageProperties>()->getMessageId());
+        return true;
+    } else {
+        return false;
     }
+}
 
-    void setup(bool async)
-    {
-        store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
-        store->init(TESTDIR, async, true, 4, 1);
-		store->truncate();
+void restart(bool async)
+{
+    queue.reset();
+    store.reset();
 
-        queue = Queue::shared_ptr(new Queue(name, 0, store.get(), 0));
-        FieldTable settings;
-        queue->create(settings);
-    }
+    store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
+    store->init(TESTDIR, async, false, 4, 1);
+    ExchangeRegistry exchanges;
+    DtxManager mgr;
+    mgr.setStore (store.get());
+    RecoveryManagerImpl recoveryMgr(queues, exchanges, mgr, 0);
+    store->recover(recoveryMgr);
 
-    void push()
-    {
-        string base("Message");
-        std::stringstream id;
-        id << base << counter++;
-        string messageId(id.str());
-        ids.push(messageId);
+    queue = queues.find(name);
+}
 
-        Message::shared_ptr msg = MessageUtils::createMessage("exchange", "routing_key", messageId, 0);
-        msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
-        
-        queue->deliver(msg);
-    }
+void check()
+{        
+    BOOST_REQUIRE(queue);
+    BOOST_REQUIRE_EQUAL((u_int32_t) ids.size(), queue->getMessageCount());
+    while (pop()) ;//keeping popping 'till all messages are dequeued
+    BOOST_REQUIRE_EQUAL((u_int32_t) 0, queue->getMessageCount());        
+    BOOST_REQUIRE_EQUAL((size_t) 0, ids.size());
+}
 
-    bool pop()
-    {
-        Message::shared_ptr msg = queue->dequeue().payload;
-        if (msg) {
-            queue->dequeue(0, msg);
-            string expected = ids.front();
-            ids.pop();
-            CPPUNIT_ASSERT_EQUAL(expected, msg->getProperties<MessageProperties>()->getMessageId());
-            return true;
-        } else {
-            return false;
-        }
-    }
+void testBasic(bool async = false)
+{
+    setup(async);
+    //push on 10 messages
+    for (int i = 0; i < 10; i++) push();
+    restart(async);
+    check();
+}
 
-    void restart(bool async)
-    {
-        queue.reset();
-        store.reset();
+void testCycle(bool async = false)
+{
+    setup(async);
+    //push on 10 messages:
+    for (int i = 0; i < 10; i++) push();
+    //pop 5:
+    for (int i = 0; i < 5; i++) pop();
+    //push on another 5:
+    for (int i = 0; i < 5; i++) push();
+    restart(async);
+    check();
+}
 
-        store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
-        store->init(TESTDIR, async, false, 4, 1);
-        ExchangeRegistry exchanges;
-        DtxManager mgr;
-        mgr.setStore (store.get());
-        RecoveryManagerImpl recoveryMgr(queues, exchanges, mgr, 0);
-        store->recover(recoveryMgr);
 
-        queue = queues.find(name);
-    }
+// === Test suite ===
 
-    void check()
-    {        
-        CPPUNIT_ASSERT(queue);
-        CPPUNIT_ASSERT_EQUAL((u_int32_t) ids.size(), queue->getMessageCount());
-        while (pop()) ;//keeping popping 'till all messages are dequeued
-        CPPUNIT_ASSERT_EQUAL((u_int32_t) 0, queue->getMessageCount());        
-        CPPUNIT_ASSERT_EQUAL((size_t) 0, ids.size());
-    }
-};
+BOOST_AUTO_TEST_CASE(BasicSync)
+{
+    std::cout << file << ".BasicSync: " << std::flush;
+    testBasic(false);
+    std::cout << "ok" << std::endl;
+}
 
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(OrderingTest);
+BOOST_AUTO_TEST_CASE(BasicAsync)
+{
+    std::cout << file << ".BasicAsync: " << std::flush;
+    testBasic(true);
+    std::cout << "ok" << std::endl;
+}
 
+BOOST_AUTO_TEST_CASE(CycleSync)
+{
+    std::cout << file << ".CycleSync: " << std::flush;
+    testCycle(false);
+    std::cout << "ok" << std::endl;
+}
+
+BOOST_AUTO_TEST_CASE(CycleAsync)
+{
+    std::cout << file << ".CycleAsync: " << std::flush;
+    testCycle(true);
+    std::cout << "ok" << std::endl;
+}
+
+QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/SimpleTest.cpp
===================================================================
--- store/trunk/cpp/tests/SimpleTest.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/SimpleTest.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -1,53 +1,55 @@
-/*
-    Copyright (C) 2007 Red Hat Software
+/**
+* Red Hat Messaging - Message Journal
+*
+* This file contains the unit tests for the journal.
+*
+* Copyright 2007, 2008 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.
+*/
 
-    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.
+#include "unit_test.h"
 
-    This file 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.
-*/
-
 #include "BdbMessageStore.h"
-#include "test_plugin.h"
+#include <iostream>
 #include "MessageUtils.h"
-#include <qpid/Exception.h>
-#include <qpid/framing/AMQP_HighestVersion.h>
-#include <qpid/framing/AMQFrame.h>
-#include <qpid/framing/AMQHeaderBody.h>
-#include <qpid/framing/AMQMethodBody.h>
-#include <qpid/framing/FieldValue.h>
-#include <qpid/broker/Message.h>
 #include <qpid/broker/Queue.h>
-#include <qpid/broker/DirectExchange.h>
 #include <qpid/broker/RecoveryManagerImpl.h>
-#include <qpid/broker/QueuePolicy.h>
-#include <iostream>
+#include <qpid/framing/AMQHeaderBody.h>
 
 #define TESTDIR "/tmp"
 
-using boost::static_pointer_cast;
-using boost::dynamic_pointer_cast;
 using boost::intrusive_ptr;
 using boost::static_pointer_cast;
 using namespace qpid;
-using namespace rhm::bdbstore;
 using namespace qpid::broker;
 using namespace qpid::framing;
+using namespace rhm::bdbstore;
+using namespace std;
 
+QPID_AUTO_TEST_SUITE(SimpleTest)
+
+const string file("SimpleTest");
+
+// === Helper fns ===
+
 struct DummyHandler : OutputHandler
 {
     std::vector<AMQFrame> frames; 
@@ -57,587 +59,701 @@
     }
 };
 
-class SimpleTest : public CppUnit::TestCase  
+void recover(BdbMessageStore& store, QueueRegistry& queues, ExchangeRegistry& exchanges)
 {
+    DtxManager mgr;
+    mgr.setStore (&store);
+    RecoveryManagerImpl recovery(queues, exchanges, mgr, 0);
+    store.recover(recovery);
+}
 
-    CPPUNIT_TEST_SUITE(SimpleTest);
-    CPPUNIT_TEST(testCreateDeleteSync);
-    CPPUNIT_TEST(testEmptyRecoverSync);
-    CPPUNIT_TEST(testQueueCreateSync);
-    CPPUNIT_TEST(testQueueCreateWithSettingsSync);
-    CPPUNIT_TEST(testQueueDestroySync);
-    CPPUNIT_TEST(testEnqueueSync);
-    CPPUNIT_TEST(testDequeueSync);
-    CPPUNIT_TEST(testStagingSync);
-    CPPUNIT_TEST(testDestroyStagedMessageSync);
-    CPPUNIT_TEST(testDestroyEnqueuedMessageSync);
-    CPPUNIT_TEST(testExchangeCreateAndDestroySync);
-    CPPUNIT_TEST(testExchangeBindAndUnbindSync);
-    CPPUNIT_TEST(testExchangeImplicitUnbindSync);
+void recover(BdbMessageStore& store, ExchangeRegistry& exchanges)
+{
+    QueueRegistry queues;
+    recover(store, queues, exchanges);
+}
 
-    CPPUNIT_TEST(testCreateDeleteAsync);
-    CPPUNIT_TEST(testEmptyRecoverAsync);
-    CPPUNIT_TEST(testQueueCreateAsync);
-    CPPUNIT_TEST(testQueueCreateWithSettingsAsync);
-    CPPUNIT_TEST(testQueueDestroyAsync);
-    CPPUNIT_TEST(testEnqueueAsync);
-    CPPUNIT_TEST(testDequeueAsync);
-    CPPUNIT_TEST(testStagingAsync);
-    CPPUNIT_TEST(testDestroyStagedMessageAsync);
-    CPPUNIT_TEST(testDestroyEnqueuedMessageAsync);
-    CPPUNIT_TEST(testExchangeCreateAndDestroyAsync);
-    CPPUNIT_TEST(testExchangeBindAndUnbindAsync);
-    CPPUNIT_TEST(testExchangeImplicitUnbindAsync);
-    CPPUNIT_TEST_SUITE_END();
+void recover(BdbMessageStore& store, QueueRegistry& queues)
+{
+    ExchangeRegistry exchanges;
+    recover(store, queues, exchanges);
+}
 
-    void recover(BdbMessageStore& store, QueueRegistry& queues)
-    {
-        ExchangeRegistry exchanges;
-        recover(store, queues, exchanges);
-    }
+void testCreateDelete(bool async)
+{
+    BdbMessageStore store;
+    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);
+    store.create(queue);
+// TODO - check dir exists
+    BOOST_REQUIRE(queue.getPersistenceId());
+    store.destroy(queue);
+// TODO - check dir is deleted
 
-    void recover(BdbMessageStore& store, ExchangeRegistry& exchanges)
-    {
-        QueueRegistry queues;
-        recover(store, queues, exchanges);
-    }
+}
 
-    void recover(BdbMessageStore& store, QueueRegistry& queues, ExchangeRegistry& exchanges)
+void testEmptyRecover(bool async)
+{
+    BdbMessageStore store;
+    store.init(TESTDIR, async, true, 4, 1);
+    store.truncate();//make sure it is empty to begin with
+    QueueRegistry registry;
+    registry.setStore (&store);
+    recover(store, registry);
+    //nothing to assert, just testing it doesn't blow up
+}
+
+void testQueueCreate(bool async)
+{
+    uint64_t id(0);
+    string name("MyDurableQueue");
     {
-        DtxManager mgr;
-        mgr.setStore (&store);
-        RecoveryManagerImpl recovery(queues, exchanges, mgr, 0);
-        store.recover(recovery);
+        BdbMessageStore store;
+        store.init(TESTDIR, async, true, 4, 1);
+        store.truncate();//make sure it is empty to begin with
+        Queue queue(name, 0, &store, 0);
+        store.create(queue);
+        BOOST_REQUIRE(queue.getPersistenceId());
+        id = queue.getPersistenceId();
+    }//db will be closed
+    {
+        BdbMessageStore store;
+        store.init(TESTDIR, async, false, 4, 1);
+        QueueRegistry registry;
+        registry.setStore (&store);
+        recover(store, registry);
+        Queue::shared_ptr queue = registry.find(name);
+        BOOST_REQUIRE(queue.get());
+        BOOST_REQUIRE_EQUAL(id, queue->getPersistenceId());
     }
+}
 
-public:
-
-    void testEmptyRecoverSync() {testEmptyRecover(false);}
-    void testEmptyRecoverAsync() {testEmptyRecover(true);}
-
-    void testEmptyRecover(bool async)
+void testQueueCreateWithSettings(bool async)
+{
+    QueuePolicy policy(101, 202);
+    string name("MyDurableQueue");
     {
         BdbMessageStore store;
+        store.init(TESTDIR, async, true, 4, 1);
+        store.truncate();//make sure it is empty to begin with
+        Queue queue(name, 0, &store, 0);
+        FieldTable settings;
+        policy.update(settings);
+        queue.create(settings);
+        BOOST_REQUIRE(queue.getPersistenceId());
+    }//db will be closed
+    {
+        BdbMessageStore store;
         store.init(TESTDIR, async, false, 4, 1);
-        store.truncate();//make sure it is empty to begin with
         QueueRegistry registry;
         registry.setStore (&store);
         recover(store, registry);
-        //nothing to assert, just testing it doesn't blow up
+        Queue::shared_ptr queue = registry.find(name);
+        BOOST_REQUIRE(queue);
+        BOOST_REQUIRE(queue->getPolicy());
+        BOOST_REQUIRE_EQUAL(policy.getMaxCount(), queue->getPolicy()->getMaxCount());
+        BOOST_REQUIRE_EQUAL(policy.getMaxSize(), queue->getPolicy()->getMaxSize());
     }
+}
 
-    void testCreateDeleteSync() {testCreateDelete(false);}
-    void testCreateDeleteAsync() {testCreateDelete(true);}
-
-    void testCreateDelete(bool async)
+void testQueueDestroy(bool async)
+{
+    string name("MyDurableQueue");
     {
         BdbMessageStore store;
         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);
         store.create(queue);
-	// TODO - check dir exists
-        CPPUNIT_ASSERT(queue.getPersistenceId());
         store.destroy(queue);
-	// TODO - check dir is deleted
-	
+    }//db will be closed
+    {
+        BdbMessageStore store;
+        store.init(TESTDIR, async, false, 4, 1);
+        QueueRegistry registry;
+        registry.setStore (&store);
+        recover(store, registry);
+        BOOST_REQUIRE(!registry.find(name));
     }
+}
 
-    void testQueueCreateSync() {testQueueCreate(false);}
-    void testQueueCreateAsync() {testQueueCreate(true);}
+void testEnqueue(bool async)
+{
+    //TODO: this is largely copy & paste'd from MessageTest in
+    //qpid tree. ideally need some helper routines for reducing
+    //this to a simpler less duplicated form
 
-    void testQueueCreate(bool async)
+    string name("MyDurableQueue");
+    string exchange("MyExchange");
+    string routingKey("MyRoutingKey");
+    string messageId = "MyMessage";
+    string data1("abcdefg");
+    string data2("hijklmn");
     {
-        uint64_t id(0);
-        string name("MyDurableQueue");
-        {
-            BdbMessageStore store;
-            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);
-            CPPUNIT_ASSERT(queue.getPersistenceId());
-            id = queue.getPersistenceId();
-        }//db will be closed
-        {
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            QueueRegistry registry;
-            registry.setStore (&store);
-            recover(store, registry);
-            Queue::shared_ptr queue = registry.find(name);
-            CPPUNIT_ASSERT(queue.get());
-            CPPUNIT_ASSERT_EQUAL(id, queue->getPersistenceId());
-        }
-    }
+        BdbMessageStore store;
+        store.init(TESTDIR, async, true, 4, 1);
+        store.truncate();//make sure it is empty to begin with
+        Queue::shared_ptr queue(new Queue(name, 0, &store, 0));
+        FieldTable settings;
+        queue->create(settings);
 
-    void testQueueCreateWithSettingsSync() {testQueueCreateWithSettings(false);}
-    void testQueueCreateWithSettingsAsync() {testQueueCreateWithSettings(true);}
+        Message::shared_ptr msg = MessageUtils::createMessage(exchange, routingKey, messageId, 14);
+        MessageUtils::addContent(msg, data1);
+        MessageUtils::addContent(msg, data2);
+        
+        msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
+        FieldTable table;
+        table.setString("abc", "xyz");
+        msg->getProperties<MessageProperties>()->setApplicationHeaders(table);
 
-    void testQueueCreateWithSettings(bool async)
+        queue->enqueue(0, msg);
+    }//db will be closed
     {
-        QueuePolicy policy(101, 202);
-        string name("MyDurableQueue");
-        {
-            BdbMessageStore store;
-            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;
-            policy.update(settings);
-            queue.create(settings);
-            CPPUNIT_ASSERT(queue.getPersistenceId());
-        }//db will be closed
-        {
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            QueueRegistry registry;
-            registry.setStore (&store);
-            recover(store, registry);
-            Queue::shared_ptr queue = registry.find(name);
-            CPPUNIT_ASSERT(queue);
-            CPPUNIT_ASSERT(queue->getPolicy());
-            CPPUNIT_ASSERT_EQUAL(policy.getMaxCount(), queue->getPolicy()->getMaxCount());
-            CPPUNIT_ASSERT_EQUAL(policy.getMaxSize(), queue->getPolicy()->getMaxSize());
-        }
-    }
+        BdbMessageStore store;
+        store.init(TESTDIR, async, false, 4, 1);
+        QueueRegistry registry;
+        registry.setStore (&store);
+        recover(store, registry);
+        Queue::shared_ptr queue = registry.find(name);
+        BOOST_REQUIRE(queue);
+        BOOST_REQUIRE_EQUAL((u_int32_t) 1, queue->getMessageCount());
+        Message::shared_ptr msg = queue->dequeue().payload;
 
-    void testQueueDestroySync() {testQueueDestroy(false);}
-    void testQueueDestroyAsync() {testQueueDestroy(true);}
-    void testQueueDestroy(bool async)
-    {
-        string name("MyDurableQueue");
-        {
-            BdbMessageStore store;
-            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);
-            store.destroy(queue);
-        }//db will be closed
-        {
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            QueueRegistry registry;
-            registry.setStore (&store);
-            recover(store, registry);
-            CPPUNIT_ASSERT(!registry.find(name));
-        }
+        BOOST_REQUIRE_EQUAL(exchange, msg->getExchangeName());
+        BOOST_REQUIRE_EQUAL(routingKey, msg->getRoutingKey());
+        BOOST_REQUIRE_EQUAL(messageId, msg->getProperties<MessageProperties>()->getMessageId());
+        BOOST_REQUIRE_EQUAL((uint8_t) PERSISTENT, msg->getProperties<DeliveryProperties>()->getDeliveryMode());
+        BOOST_REQUIRE(StringValue("xyz") == *msg->getProperties<MessageProperties>()->getApplicationHeaders().get("abc"));
+        BOOST_REQUIRE_EQUAL((u_int64_t) 14, msg->contentSize());
+    
+        DummyHandler handler;
+		QueuedMessage qm(queue.get(),msg,0);
+        MessageDelivery::deliver(qm, handler, 0, MessageDelivery::getBasicConsumeToken("ignore"), 100); 
+        BOOST_REQUIRE_EQUAL((size_t) 3, handler.frames.size());
+        AMQContentBody* contentBody(dynamic_cast<AMQContentBody*>(handler.frames[2].getBody()));
+        BOOST_REQUIRE(contentBody);
+        BOOST_REQUIRE_EQUAL(data1.size() + data2.size(), contentBody->getData().size());
+        BOOST_REQUIRE_EQUAL(data1 + data2, contentBody->getData());
     }
+}
 
-    void testEnqueueSync() {testEnqueue(false);}
-    void testEnqueueAsync() {testEnqueue(true);}
-    void testEnqueue(bool async)
+void testDequeue(bool async)
+{
+    //TODO: reduce the duplication in these tests
+    string name("MyDurableQueue");
     {
-        //TODO: this is largely copy & paste'd from MessageTest in
-        //qpid tree. ideally need some helper routines for reducing
-        //this to a simpler less duplicated form
-
-        string name("MyDurableQueue");
         string exchange("MyExchange");
         string routingKey("MyRoutingKey");
         string messageId = "MyMessage";
-        string data1("abcdefg");
-        string data2("hijklmn");
-        {
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            store.truncate();//make sure it is empty to begin with
-            Queue::shared_ptr queue(new Queue(name, 0, &store, 0));
-            FieldTable settings;
-            queue->create(settings);
+        string data("abcdefg");
+        BdbMessageStore store;
+        store.init(TESTDIR, async, true, 4, 1);
+        store.truncate();//make sure it is empty to begin with
+        Queue::shared_ptr queue(new Queue(name, 0, &store, 0));
+        FieldTable settings;
+        queue->create(settings);
 
-            Message::shared_ptr msg = MessageUtils::createMessage(exchange, routingKey, messageId, 14);
-            MessageUtils::addContent(msg, data1);
-            MessageUtils::addContent(msg, data2);
-            
-            msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
-            FieldTable table;
-            table.setString("abc", "xyz");
-            msg->getProperties<MessageProperties>()->setApplicationHeaders(table);
+        Message::shared_ptr msg = MessageUtils::createMessage(exchange, routingKey, messageId, 7);
+        MessageUtils::addContent(msg, data);
+        msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
+        
+        queue->enqueue(0, msg);
+        queue->dequeue(0, msg);
+    }//db will be closed
+    {
+        BdbMessageStore store;
+        store.init(TESTDIR, async, false, 4, 1);
+        QueueRegistry registry;
+        registry.setStore (&store);
+        recover(store, registry);
+        Queue::shared_ptr queue = registry.find(name);
+        BOOST_REQUIRE(queue);
+        BOOST_REQUIRE_EQUAL((u_int32_t) 0, queue->getMessageCount());
+    }
+}
 
-            queue->enqueue(0, msg);
-        }//db will be closed
-        {
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            QueueRegistry registry;
-            registry.setStore (&store);
-            recover(store, registry);
-            Queue::shared_ptr queue = registry.find(name);
-            CPPUNIT_ASSERT(queue);
-            CPPUNIT_ASSERT_EQUAL((u_int32_t) 1, queue->getMessageCount());
-            Message::shared_ptr msg = queue->dequeue().payload;
+void testStaging(bool async)
+{
+    const string name("MyDurableQueue");
+    const string exchange("MyExchange");
+    const string routingKey("MyRoutingKey");
+    const string messageId = "MyStagedMessage";
+    const string data1("abcdefghijklmnopqrstuvwxyz");
+    const string data2("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+    {
+        BdbMessageStore store;
+        store.init(TESTDIR, async, true, 4, 1);
+        store.truncate();//make sure it is empty to begin with
 
-            CPPUNIT_ASSERT_EQUAL(exchange, msg->getExchangeName());
-            CPPUNIT_ASSERT_EQUAL(routingKey, msg->getRoutingKey());
-            CPPUNIT_ASSERT_EQUAL(messageId, msg->getProperties<MessageProperties>()->getMessageId());
-            CPPUNIT_ASSERT_EQUAL((uint8_t) PERSISTENT, msg->getProperties<DeliveryProperties>()->getDeliveryMode());
-            CPPUNIT_ASSERT(StringValue("xyz") == *msg->getProperties<MessageProperties>()->getApplicationHeaders().get("abc"));
-            CPPUNIT_ASSERT_EQUAL((u_int64_t) 14, msg->contentSize());
+        //create & stage a message
+        Message::shared_ptr msg = MessageUtils::createMessage(exchange, routingKey, messageId, (data1.size() + data2.size()));
+        intrusive_ptr<PersistableMessage> pmsg = static_pointer_cast<PersistableMessage>(msg);
+        intrusive_ptr<const PersistableMessage> cpmsg = static_pointer_cast<const PersistableMessage>(msg);
+        msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
+        FieldTable table;
+        table.setString("abc", "xyz");
+        msg->getProperties<MessageProperties>()->setApplicationHeaders(table);
+        store.stage(pmsg);
         
-            DummyHandler handler;
-			QueuedMessage qm(queue.get(),msg,0);
-            MessageDelivery::deliver(qm, handler, 0, MessageDelivery::getBasicConsumeToken("ignore"), 100); 
-            CPPUNIT_ASSERT_EQUAL((size_t) 3, handler.frames.size());
-            AMQContentBody* contentBody(dynamic_cast<AMQContentBody*>(handler.frames[2].getBody()));
-            CPPUNIT_ASSERT(contentBody);
-            CPPUNIT_ASSERT_EQUAL(data1.size() + data2.size(), contentBody->getData().size());
-            CPPUNIT_ASSERT_EQUAL(data1 + data2, contentBody->getData());
+        //append to it
+        msg->releaseContent(&store);//ensure that data is not held in memory but is appended to disk when added
+        store.appendContent(cpmsg, data1);
+        store.appendContent(cpmsg, data2);
+
+        //enqueue it
+        Queue::shared_ptr queue(new Queue(name, 0, &store, 0));
+        FieldTable settings;
+        queue->create(settings);
+        queue->enqueue(0, msg);
+
+        //load it (without recovery)
+        DummyHandler handler;
+        QueuedMessage qm(queue.get(), msg, 0);
+        MessageDelivery::deliver(qm, handler, 0, 
+                                 MessageDelivery::getBasicConsumeToken("ignore"), 20);//52 chars of data, i.e. 2 chunks of 20 and one of 12 
+        BOOST_REQUIRE(handler.frames.size() > 2);
+        string loaded;
+        for (uint i = 2; i < handler.frames.size(); i++) {
+            AMQContentBody* contentBody(dynamic_cast<AMQContentBody*>(handler.frames[i].getBody()));
+            BOOST_REQUIRE(contentBody);
+            loaded += contentBody->getData();
         }
-    }
+        BOOST_REQUIRE_EQUAL(data1 + data2, loaded);
 
-    void testDequeueSync() {testDequeue(false);}
-    void testDequeueAsync() {testDequeue(true);}
-    void testDequeue(bool async)
+    }//db will be closed
     {
-        //TODO: reduce the duplication in these tests
-        string name("MyDurableQueue");
-        {
-            string exchange("MyExchange");
-            string routingKey("MyRoutingKey");
-            string messageId = "MyMessage";
-            string data("abcdefg");
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            store.truncate();//make sure it is empty to begin with
-            Queue::shared_ptr queue(new Queue(name, 0, &store, 0));
-            FieldTable settings;
-            queue->create(settings);
+        //recover
+        BdbMessageStore store;
+        store.init(TESTDIR, async, false, 4, 1);
+        QueueRegistry registry;
+        registry.setStore (&store);
+        ExchangeRegistry exchanges;
+        DtxManager dtx;
+        dtx.setStore (&store);
+        RecoveryManagerImpl recovery(registry, exchanges, dtx, 10);
+        store.recover(recovery);
 
-            Message::shared_ptr msg = MessageUtils::createMessage(exchange, routingKey, messageId, 7);
-            MessageUtils::addContent(msg, data);
-            msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
-            
-            queue->enqueue(0, msg);
-            queue->dequeue(0, msg);
-        }//db will be closed
-        {
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            QueueRegistry registry;
-            registry.setStore (&store);
-            recover(store, registry);
-            Queue::shared_ptr queue = registry.find(name);
-            CPPUNIT_ASSERT(queue);
-            CPPUNIT_ASSERT_EQUAL((u_int32_t) 0, queue->getMessageCount());
+        //get message instance from queue
+        Queue::shared_ptr queue = registry.find(name);
+        BOOST_REQUIRE(queue);
+        BOOST_REQUIRE_EQUAL((u_int32_t) 1, queue->getMessageCount());
+        Message::shared_ptr msg = queue->dequeue().payload;
+
+        //check headers
+        BOOST_REQUIRE_EQUAL(exchange, msg->getExchangeName());
+        BOOST_REQUIRE_EQUAL(routingKey, msg->getRoutingKey());
+        BOOST_REQUIRE_EQUAL(messageId, msg->getProperties<MessageProperties>()->getMessageId());
+        BOOST_REQUIRE_EQUAL((uint8_t) PERSISTENT, msg->getProperties<DeliveryProperties>()->getDeliveryMode());
+        BOOST_REQUIRE(StringValue("xyz") == *msg->getProperties<MessageProperties>()->getApplicationHeaders().get("abc"));
+        BOOST_REQUIRE_EQUAL((u_int64_t) (data1.size() + data2.size()), msg->getFrames().getHeaders()->getContentLength());
+
+        BOOST_REQUIRE_EQUAL((u_int64_t) 0, msg->contentSize());//ensure it is being lazily loaded 
+
+        //load lazily
+        DummyHandler handler;
+		QueuedMessage qm(queue.get(),msg,0);
+        MessageDelivery::deliver(qm, handler, 0, MessageDelivery::getBasicConsumeToken("ignore"), 20);//52 chars of data, i.e. 2 chunks of 20 and one of 12 
+
+        BOOST_REQUIRE(handler.frames.size() > 2);
+        string loaded;
+        for (uint i = 2; i < handler.frames.size(); i++) {
+            AMQContentBody* contentBody(dynamic_cast<AMQContentBody*>(handler.frames[i].getBody()));
+            BOOST_REQUIRE(contentBody);
+            loaded += contentBody->getData();
         }
+        BOOST_REQUIRE_EQUAL(data1 + data2, loaded);
+
+        //dequeue
+        queue->dequeue(0, msg);
     }
+}
 
-    void testStagingSync() {testStaging(false);}
-    void testStagingAsync() {testStaging(true);}
-    void testStaging(bool async)
-    {
-        const string name("MyDurableQueue");
-        const string exchange("MyExchange");
-        const string routingKey("MyRoutingKey");
-        const string messageId = "MyStagedMessage";
-        const string data1("abcdefghijklmnopqrstuvwxyz");
-        const string data2("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
-        {
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            store.truncate();//make sure it is empty to begin with
+void testDestroyStagedMessage(bool async)
+{
+    BdbMessageStore store;
+    store.init(TESTDIR, async, true, 4, 1);
+    store.truncate();//make sure it is empty to begin with
+    
+    const string data("abcdefg");
+    Message::shared_ptr msg(MessageUtils::createMessage("my_exchange", "my_routing_key", "my_message", data.length()));
+    intrusive_ptr<PersistableMessage> pmsg = static_pointer_cast<PersistableMessage>(msg);
+    intrusive_ptr<const PersistableMessage> cpmsg = static_pointer_cast<const PersistableMessage>(msg);
+    MessageUtils::addContent(msg, data);
+    
+    store.stage(pmsg);
+    store.destroy(*pmsg);
 
-            //create & stage a message
-            Message::shared_ptr msg = MessageUtils::createMessage(exchange, routingKey, messageId, (data1.size() + data2.size()));
-            intrusive_ptr<PersistableMessage> pmsg = static_pointer_cast<PersistableMessage>(msg);
-            intrusive_ptr<const PersistableMessage> cpmsg = static_pointer_cast<const PersistableMessage>(msg);
-            msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
-            FieldTable table;
-            table.setString("abc", "xyz");
-            msg->getProperties<MessageProperties>()->setApplicationHeaders(table);
-            store.stage(pmsg);
-            
-            //append to it
-            msg->releaseContent(&store);//ensure that data is not held in memory but is appended to disk when added
-            store.appendContent(cpmsg, data1);
-            store.appendContent(cpmsg, data2);
+    try {
+        string loaded;
+        Queue queue("dummy", 0, &store, 0);
+        store.loadContent(queue, cpmsg, loaded, 0, data.length());
+        BOOST_FAIL("store.loadContent() did not throw StoreException as expected.");
+    } catch (StoreException& e) {
+    }
+}
 
-            //enqueue it
-            Queue::shared_ptr queue(new Queue(name, 0, &store, 0));
-            FieldTable settings;
-            queue->create(settings);
-            queue->enqueue(0, msg);
+void testDestroyEnqueuedMessage(bool async)
+{
+    BdbMessageStore store;
+    store.init(TESTDIR, async, true, 4, 1);
+    store.truncate();//make sure it is empty to begin with
+    
+    const string data("abcdefg");
+    Message::shared_ptr msg(MessageUtils::createMessage("my_exchange", "my_routing_key", "my_message", data.length()));
+    intrusive_ptr<PersistableMessage> pmsg = static_pointer_cast<PersistableMessage>(msg);
+    intrusive_ptr<const PersistableMessage> cpmsg = static_pointer_cast<const PersistableMessage>(msg);
+    MessageUtils::addContent(msg, data);
 
-            //load it (without recovery)
-            DummyHandler handler;
-            QueuedMessage qm(queue.get(), msg, 0);
-            MessageDelivery::deliver(qm, handler, 0, 
-                                     MessageDelivery::getBasicConsumeToken("ignore"), 20);//52 chars of data, i.e. 2 chunks of 20 and one of 12 
-            CPPUNIT_ASSERT(handler.frames.size() > 2);
-            string loaded;
-            for (uint i = 2; i < handler.frames.size(); i++) {
-                AMQContentBody* contentBody(dynamic_cast<AMQContentBody*>(handler.frames[i].getBody()));
-                CPPUNIT_ASSERT(contentBody);
-                loaded += contentBody->getData();
-            }
-            CPPUNIT_ASSERT_EQUAL(data1 + data2, loaded);
+    Queue queue("my_queue", 0, &store, 0);
+    store.create(queue);
+    
+    store.enqueue(0, pmsg, queue);
+    store.destroy(*pmsg);
 
-        }//db will be closed
-        {
-            //recover
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            QueueRegistry registry;
-            registry.setStore (&store);
-            ExchangeRegistry exchanges;
-            DtxManager dtx;
-            dtx.setStore (&store);
-            RecoveryManagerImpl recovery(registry, exchanges, dtx, 10);
-            store.recover(recovery);
+    string loaded;
+    store.loadContent(queue, cpmsg, loaded, 0, data.length());
+    BOOST_REQUIRE_EQUAL(data, loaded);
 
-            //get message instance from queue
-            Queue::shared_ptr queue = registry.find(name);
-            CPPUNIT_ASSERT(queue);
-            CPPUNIT_ASSERT_EQUAL((u_int32_t) 1, queue->getMessageCount());
-            Message::shared_ptr msg = queue->dequeue().payload;
+    store.dequeue(0, pmsg, queue);
+    store.destroy(queue);
+}
 
-            //check headers
-            CPPUNIT_ASSERT_EQUAL(exchange, msg->getExchangeName());
-            CPPUNIT_ASSERT_EQUAL(routingKey, msg->getRoutingKey());
-            CPPUNIT_ASSERT_EQUAL(messageId, msg->getProperties<MessageProperties>()->getMessageId());
-            CPPUNIT_ASSERT_EQUAL((uint8_t) PERSISTENT, msg->getProperties<DeliveryProperties>()->getDeliveryMode());
-            CPPUNIT_ASSERT(StringValue("xyz") == *msg->getProperties<MessageProperties>()->getApplicationHeaders().get("abc"));
-            CPPUNIT_ASSERT_EQUAL((u_int64_t) (data1.size() + data2.size()), msg->getFrames().getHeaders()->getContentLength());
+void testExchangeCreateAndDestroy(bool async)
+{
+    uint64_t id(0);
+    string name("MyDurableExchange");
+    string type("direct");
+    FieldTable args;
+    args.setString("a", "A");
+    {
+        BdbMessageStore store;
+        store.init(TESTDIR, async, true, 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;
+        store.create(*exchange);
+        id = exchange->getPersistenceId();
+        BOOST_REQUIRE(id);
+    }//db will be closed
+    {
+        BdbMessageStore store;
+        store.init(TESTDIR, async, false, 4, 1);
+        ExchangeRegistry registry;
 
-            CPPUNIT_ASSERT_EQUAL((u_int64_t) 0, msg->contentSize());//ensure it is being lazily loaded 
+        recover(store, registry);
 
-            //load lazily
-            DummyHandler handler;
-			QueuedMessage qm(queue.get(),msg,0);
-            MessageDelivery::deliver(qm, handler, 0, MessageDelivery::getBasicConsumeToken("ignore"), 20);//52 chars of data, i.e. 2 chunks of 20 and one of 12 
+        Exchange::shared_ptr exchange = registry.get(name);
+        BOOST_REQUIRE_EQUAL(id, exchange->getPersistenceId());
+        BOOST_REQUIRE_EQUAL(type, exchange->getType());
+        BOOST_REQUIRE(exchange->isDurable());
+        BOOST_REQUIRE_EQUAL(*args.get("a"), *exchange->getArgs().get("a"));
+        store.destroy(*exchange);
+    }
+    {
+        BdbMessageStore store;
+        store.init(TESTDIR, async, false, 4, 1);
+        ExchangeRegistry registry;
 
-            CPPUNIT_ASSERT(handler.frames.size() > 2);
-            string loaded;
-            for (uint i = 2; i < handler.frames.size(); i++) {
-                AMQContentBody* contentBody(dynamic_cast<AMQContentBody*>(handler.frames[i].getBody()));
-                CPPUNIT_ASSERT(contentBody);
-                loaded += contentBody->getData();
-            }
-            CPPUNIT_ASSERT_EQUAL(data1 + data2, loaded);
+        recover(store, registry);
 
-            //dequeue
-            queue->dequeue(0, msg);
+        try {
+            Exchange::shared_ptr exchange = registry.get(name);
+            BOOST_FAIL("Expected exchange not to be found");
+        } catch (ChannelException& e) {
+            BOOST_REQUIRE_EQUAL((framing::ReplyCode) 404, e.code);
         }
     }
+}
 
-    void testDestroyStagedMessageSync() {testDestroyStagedMessage(false);}
-    void testDestroyStagedMessageAsync() {testDestroyStagedMessage(true);}
-    void testDestroyStagedMessage(bool async)
+void testExchangeBindAndUnbind(bool async)
+{
+    string exchangeName("MyDurableExchange");
+    string queueName("MyDurableQueue");
+    string key("my-routing-key");
+    FieldTable args;
     {
         BdbMessageStore store;
+        store.init(TESTDIR, async, true, 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));
+        store.create(*exchange);
+        store.create(*queue);
+        BOOST_REQUIRE(exchange->bind(queue, key, &args));
+        store.bind(*exchange, *queue, key, args);
+    }//db will be closed
+    {
+        BdbMessageStore store;
         store.init(TESTDIR, async, false, 4, 1);
-        store.truncate();//make sure it is empty to begin with
-        
-        const string data("abcdefg");
-        Message::shared_ptr msg(MessageUtils::createMessage("my_exchange", "my_routing_key", "my_message", data.length()));
-        intrusive_ptr<PersistableMessage> pmsg = static_pointer_cast<PersistableMessage>(msg);
-        intrusive_ptr<const PersistableMessage> cpmsg = static_pointer_cast<const PersistableMessage>(msg);
-        MessageUtils::addContent(msg, data);
-        
-        store.stage(pmsg);
-        store.destroy(*pmsg);
+        ExchangeRegistry exchanges;
+        QueueRegistry queues;
 
-        try {
-            string loaded;
-            Queue queue("dummy", 0, &store, 0);
-            store.loadContent(queue, cpmsg, loaded, 0, data.length());
-            CPPUNIT_ASSERT(false);
-        } catch (StoreException& e) {
-        }
+        recover(store, queues, exchanges);
+
+        Exchange::shared_ptr exchange = exchanges.get(exchangeName);
+        Queue::shared_ptr queue = queues.find(queueName);
+        //check it is bound by unbinding
+        BOOST_REQUIRE(exchange->unbind(queue, key, &args));
+        store.unbind(*exchange, *queue, key, args);
     }
-
-    void testDestroyEnqueuedMessageSync() {testDestroyEnqueuedMessage(false);}
-    void testDestroyEnqueuedMessageAsync() {testDestroyEnqueuedMessage(true);}
-    void testDestroyEnqueuedMessage(bool async)
     {
         BdbMessageStore store;
         store.init(TESTDIR, async, false, 4, 1);
-        store.truncate();//make sure it is empty to begin with
-        
-        const string data("abcdefg");
-        Message::shared_ptr msg(MessageUtils::createMessage("my_exchange", "my_routing_key", "my_message", data.length()));
-        intrusive_ptr<PersistableMessage> pmsg = static_pointer_cast<PersistableMessage>(msg);
-        intrusive_ptr<const PersistableMessage> cpmsg = static_pointer_cast<const PersistableMessage>(msg);
-        MessageUtils::addContent(msg, data);
+        ExchangeRegistry exchanges;
+        QueueRegistry queues;
 
-        Queue queue("my_queue", 0, &store, 0);
-        store.create(queue);
-        
-        store.enqueue(0, pmsg, queue);
-        store.destroy(*pmsg);
+        recover(store, queues, exchanges);
 
-        string loaded;
-        store.loadContent(queue, cpmsg, loaded, 0, data.length());
-        CPPUNIT_ASSERT_EQUAL(data, loaded);
-
-        store.dequeue(0, pmsg, queue);
-        store.destroy(queue);
+        Exchange::shared_ptr exchange = exchanges.get(exchangeName);
+        Queue::shared_ptr queue = queues.find(queueName);
+        //make sure it is no longer bound
+        BOOST_REQUIRE(!exchange->unbind(queue, key, &args));
     }
+}
 
-
-    void testExchangeCreateAndDestroySync() {testExchangeCreateAndDestroy(false);}
-    void testExchangeCreateAndDestroyAsync() {testExchangeCreateAndDestroy(true);}
-    void testExchangeCreateAndDestroy(bool async)
+void testExchangeImplicitUnbind(bool async)
+{
+    string exchangeName("MyDurableExchange");
+    string queueName1("MyDurableQueue1");
+    string queueName2("MyDurableQueue2");
+    string key("my-routing-key");
+    FieldTable args;
     {
-        uint64_t id(0);
-        string name("MyDurableExchange");
-        string type("direct");
-        FieldTable args;
-        args.setString("a", "A");
-        {
-            BdbMessageStore store;
-            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;
-            store.create(*exchange);
-            id = exchange->getPersistenceId();
-            CPPUNIT_ASSERT(id);
-        }//db will be closed
-        {
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            ExchangeRegistry registry;
+        BdbMessageStore store;
+        store.init(TESTDIR, async, true, 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));
+        Queue::shared_ptr queue2(new Queue(queueName2, 0, &store, 0));
+        store.create(*exchange);
+        store.create(*queue1);
+        store.create(*queue2);
+        store.bind(*exchange, *queue1, key, args);
+        store.bind(*exchange, *queue2, key, args);
+        //delete queue1:
+        store.destroy(*queue1);
+    }//db will be closed
+    {
+        BdbMessageStore store;
+        store.init(TESTDIR, async, false, 4, 1);
+        ExchangeRegistry exchanges;
+        QueueRegistry queues;
 
-            recover(store, registry);
+        //ensure recovery works ok:
+        recover(store, queues, exchanges);
 
-            Exchange::shared_ptr exchange = registry.get(name);
-            CPPUNIT_ASSERT_EQUAL(id, exchange->getPersistenceId());
-            CPPUNIT_ASSERT_EQUAL(type, exchange->getType());
-            CPPUNIT_ASSERT(exchange->isDurable());
-            CPPUNIT_ASSERT_EQUAL(*args.get("a"), *exchange->getArgs().get("a"));
-            store.destroy(*exchange);
-        }
-        {
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            ExchangeRegistry registry;
+        Exchange::shared_ptr exchange = exchanges.get(exchangeName);
+        BOOST_REQUIRE(!queues.find(queueName1).get());
+        BOOST_REQUIRE(queues.find(queueName2).get());
 
-            recover(store, registry);
-
-            try {
-                Exchange::shared_ptr exchange = registry.get(name);
-                CPPUNIT_FAIL("Expected exchange not to be found");
-            } catch (ChannelException& e) {
-                CPPUNIT_ASSERT_EQUAL((framing::ReplyCode) 404, e.code);
-            }
-        }
+        //delete exchange:
+        store.destroy(*exchange);
     }
-
-    void testExchangeBindAndUnbindSync() {testExchangeBindAndUnbind(false);}
-    void testExchangeBindAndUnbindAsync() {testExchangeBindAndUnbind(true);}
-    void testExchangeBindAndUnbind(bool async)
     {
-        string exchangeName("MyDurableExchange");
-        string queueName("MyDurableQueue");
-        string key("my-routing-key");
-        FieldTable args;
-        {
-            BdbMessageStore store;
-            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));
-            store.create(*exchange);
-            store.create(*queue);
-            CPPUNIT_ASSERT(exchange->bind(queue, key, &args));
-            store.bind(*exchange, *queue, key, args);
-        }//db will be closed
-        {
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            ExchangeRegistry exchanges;
-            QueueRegistry queues;
+        BdbMessageStore store;
+        store.init(TESTDIR, async, false, 4, 1);
+        ExchangeRegistry exchanges;
+        QueueRegistry queues;
 
-            recover(store, queues, exchanges);
+        //ensure recovery works ok:            
+        recover(store, queues, exchanges);
 
+        try {
             Exchange::shared_ptr exchange = exchanges.get(exchangeName);
-            Queue::shared_ptr queue = queues.find(queueName);
-            //check it is bound by unbinding
-            CPPUNIT_ASSERT(exchange->unbind(queue, key, &args));
-            store.unbind(*exchange, *queue, key, args);
+            BOOST_FAIL("Expected exchange not to be found");
+        } catch (ChannelException& e) {
+            BOOST_REQUIRE_EQUAL((framing::ReplyCode) 404, e.code);
         }
-        {
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            ExchangeRegistry exchanges;
-            QueueRegistry queues;
+        Queue::shared_ptr queue = queues.find(queueName2);
+        store.destroy(*queue);
+    }
+}
 
-            recover(store, queues, exchanges);
 
-            Exchange::shared_ptr exchange = exchanges.get(exchangeName);
-            Queue::shared_ptr queue = queues.find(queueName);
-            //make sure it is no longer bound
-            CPPUNIT_ASSERT(!exchange->unbind(queue, key, &args));
-        }
-    }
+// === Test suite ===
 
-    void testExchangeImplicitUnbindSync() {testExchangeImplicitUnbind(false);}
-    void testExchangeImplicitUnbindAsync() {testExchangeImplicitUnbind(true);}
-    void testExchangeImplicitUnbind(bool async)
-    {
-        string exchangeName("MyDurableExchange");
-        string queueName1("MyDurableQueue1");
-        string queueName2("MyDurableQueue2");
-        string key("my-routing-key");
-        FieldTable args;
-        {
-            BdbMessageStore store;
-            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));
-            Queue::shared_ptr queue2(new Queue(queueName2, 0, &store, 0));
-            store.create(*exchange);
-            store.create(*queue1);
-            store.create(*queue2);
-            store.bind(*exchange, *queue1, key, args);
-            store.bind(*exchange, *queue2, key, args);
-            //delete queue1:
-            store.destroy(*queue1);
-        }//db will be closed
-        {
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            ExchangeRegistry exchanges;
-            QueueRegistry queues;
+BOOST_AUTO_TEST_CASE(CreateDeleteSync)
+{
+    cout << file << ".CreateDeleteSync: " << flush;
+    testCreateDelete(false);
+    cout << "ok" << endl;
+}
 
-            //ensure recovery works ok:
-            recover(store, queues, exchanges);
+BOOST_AUTO_TEST_CASE(CreateDeleteAsync)
+{
+    cout << file << ".CreateDeleteAsync: " << flush;
+    testCreateDelete(true);
+    cout << "ok" << endl;
+}
 
-            Exchange::shared_ptr exchange = exchanges.get(exchangeName);
-            CPPUNIT_ASSERT(!queues.find(queueName1).get());
-            CPPUNIT_ASSERT(queues.find(queueName2).get());
+BOOST_AUTO_TEST_CASE(EmptyRecoverSync)
+{
+    cout << file << ".EmptyRecoverSync: " << flush;
+    testEmptyRecover(false);
+    cout << "ok" << endl;
+}
 
-            //delete exchange:
-            store.destroy(*exchange);
-        }
-        {
-            BdbMessageStore store;
-            store.init(TESTDIR, async, false, 4, 1);
-            ExchangeRegistry exchanges;
-            QueueRegistry queues;
+BOOST_AUTO_TEST_CASE(EmptyRecoverAsync)
+{
+    cout << file << ".EmptyRecoverAsync: " << flush;
+    testEmptyRecover(true);
+    cout << "ok" << endl;
+}
 
-            //ensure recovery works ok:            
-            recover(store, queues, exchanges);
+BOOST_AUTO_TEST_CASE(QueueCreateSync)
+{
+    cout << file << ".QueueCreateSync: " << flush;
+    testQueueCreate(false);
+    cout << "ok" << endl;
+}
 
-            try {
-                Exchange::shared_ptr exchange = exchanges.get(exchangeName);
-                CPPUNIT_FAIL("Expected exchange not to be found");
-            } catch (ChannelException& e) {
-                CPPUNIT_ASSERT_EQUAL((framing::ReplyCode) 404, e.code);
-            }
-            Queue::shared_ptr queue = queues.find(queueName2);
-            store.destroy(*queue);
-        }
-    }
+BOOST_AUTO_TEST_CASE(QueueCreateAsync)
+{
+    cout << file << ".QueueCreateAsync: " << flush;
+    testQueueCreate(true);
+    cout << "ok" << endl;
+}
 
-};
+BOOST_AUTO_TEST_CASE(QueueCreateWithSettingsSync)
+{
+    cout << file << ".QueueCreateWithSettingsSync: " << flush;
+    testQueueCreateWithSettings(false);
+    cout << "ok" << endl;
+}
 
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(SimpleTest);
+BOOST_AUTO_TEST_CASE(QueueCreateWithSettingsAsync)
+{
+    cout << file << ".QueueCreateWithSettingsAsync: " << flush;
+    testQueueCreateWithSettings(true);
+    cout << "ok" << endl;
+}
 
+BOOST_AUTO_TEST_CASE(QueueDestroySync)
+{
+    cout << file << ".QueueDestroySync: " << flush;
+    testQueueDestroy(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(QueueDestroyAsync)
+{
+    cout << file << ".QueueDestroyAsync: " << flush;
+    testQueueDestroy(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(EnqueueSync)
+{
+    cout << file << ".EnqueueSync: " << flush;
+    testEnqueue(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(EnqueueAsync)
+{
+    cout << file << ".EnqueueAsync: " << flush;
+    testEnqueue(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(DequeueSync)
+{
+    cout << file << ".DequeueSync: " << flush;
+    testDequeue(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(DequeueAsync)
+{
+    cout << file << ".DequeueAsync: " << flush;
+    testDequeue(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(StagingSync)
+{
+    cout << file << ".StagingSync: " << flush;
+    testStaging(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(StagingAsync)
+{
+    cout << file << ".StagingAsync: " << flush;
+    testStaging(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(DestroyStagedMessageSync)
+{
+    cout << file << ".DestroyStagedMessageSync: " << flush;
+    testDestroyStagedMessage(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(DestroyStagedMessageAsync)
+{
+    cout << file << ".DestroyStagedMessageAsync: " << flush;
+    testDestroyStagedMessage(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(DestroyEnqueuedMessageSync)
+{
+    cout << file << ".DestroyEnqueuedMessageSync: " << flush;
+    testDestroyEnqueuedMessage(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(DestroyEnqueuedMessageAsync)
+{
+    cout << file << ".DestroyEnqueuedMessageAsync: " << flush;
+    testDestroyEnqueuedMessage(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(ExchangeCreateAndDestroySync)
+{
+    cout << file << ".ExchangeCreateAndDestroySync: " << flush;
+    testExchangeCreateAndDestroy(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(ExchangeCreateAndDestroyAsync)
+{
+    cout << file << ".ExchangeCreateAndDestroyAsync: " << flush;
+    testExchangeCreateAndDestroy(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(ExchangeBindAndUnbindSync)
+{
+    cout << file << ".ExchangeBindAndUnbindSync: " << flush;
+    testExchangeBindAndUnbind(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(ExchangeBindAndUnbindAsync)
+{
+    cout << file << ".ExchangeBindAndUnbindAsync: " << flush;
+    testExchangeBindAndUnbind(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(ExchangeImplicitUnbindSync)
+{
+    cout << file << ".ExchangeImplicitUnbindSync: " << flush;
+    testExchangeImplicitUnbind(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(ExchangeImplicitUnbindAsync)
+{
+    cout << file << ".ExchangeImplicitUnbindAsync: " << flush;
+    testExchangeImplicitUnbind(true);
+    cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/TransactionalTest.cpp
===================================================================
--- store/trunk/cpp/tests/TransactionalTest.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/TransactionalTest.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -1,162 +1,170 @@
-/*
-    Copyright (C) 2007 Red Hat Software
+/**
+* Red Hat Messaging - Message Journal
+*
+* This file contains the unit tests for the journal.
+*
+* Copyright 2007, 2008 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.
+*/
 
-    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.
+#include "unit_test.h"
 
-    This file 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.
-*/
-
 #include "BdbMessageStore.h"
+#include <iostream>
 #include "MessageUtils.h"
-#include "test_plugin.h"
 #include <qpid/framing/AMQHeaderBody.h>
-#include <qpid/framing/AMQMethodBody.h>
-#include <qpid/broker/Message.h>
 #include <qpid/broker/Queue.h>
 #include <qpid/broker/RecoveryManagerImpl.h>
-#include <iostream>
-#include <memory>
 
 #define TESTDIR "/tmp"
 
-using boost::static_pointer_cast;
-using boost::dynamic_pointer_cast;
 using namespace rhm::bdbstore;
 using namespace qpid::broker;
 using namespace qpid::framing;
+using namespace std;
 
-class TransactionalTest : public CppUnit::TestCase  
-{
-    CPPUNIT_TEST_SUITE(TransactionalTest);
-    CPPUNIT_TEST(testCommitSync);
-    CPPUNIT_TEST(testAbortSync);
-    CPPUNIT_TEST(testCommitAsync);
-    CPPUNIT_TEST(testAbortAsync);
-    CPPUNIT_TEST_SUITE_END();
+QPID_AUTO_TEST_SUITE(TransactionalTest)
 
-    const string nameA;
-    const string nameB;
-    const string messageId;
-    std::auto_ptr<BdbMessageStore> store;
-    QueueRegistry queues;
-    Queue::shared_ptr queueA;
-    Queue::shared_ptr queueB;
+const string file("TransactionalTest");
 
-public:
-    TransactionalTest() : nameA("queueA"), nameB("queueB"), messageId("TxnMessage") {}
+// === Helper fns ===
 
-    void testCommitSync() {testCommit(false);}
-    void testCommitAsync()  {testCommit(true);}
-    void testCommit(bool async)
-    {
-        swap(true, async);
-    }
+const string nameA("queueA");
+const string nameB("queueB");
+const string messageId("TxnMessage");
+std::auto_ptr<BdbMessageStore> store;
+QueueRegistry queues;
+Queue::shared_ptr queueA;
+Queue::shared_ptr queueB;
 
-    void testAbortSync() {testAbort(false);}
-    void testAbortAsync()  {testAbort(true);}
-    void testAbort(bool async)
-    {
-        swap(false, async);
-    }
+void setup(bool async)
+{
+    store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
+    store->init(TESTDIR, async, true, 4, 1);
+    store->truncate();
 
-    void swap(bool commit, bool async)
-    {
-        setup(async);
+    //create two queues:
+    queueA = Queue::shared_ptr(new Queue(nameA, 0, store.get(), 0));
+    FieldTable settings;
+    queueA->create(settings);
+    queueB = Queue::shared_ptr(new Queue(nameB, 0, store.get(), 0));        
+    queueB->create(settings);
 
-        Message::shared_ptr msg = queueA->dequeue().payload;
-        CPPUNIT_ASSERT(msg);
-        //move the message from one queue to the other as a transaction
-        std::auto_ptr<TransactionContext> txn = store->begin();
-        queueB->enqueue(txn.get(), msg);//note: need to enqueue it first to avoid message being deleted
-        queueA->dequeue(txn.get(), msg);
-        if (commit) {
-           store->commit(*txn);
-        } else {
-            store->abort(*txn);
-        }
+    //create message and enqueue it onto first queue:
+    Message::shared_ptr msg = MessageUtils::createMessage("exchange", "routing_key", messageId, 0);
+    msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
+    
+    queueA->deliver(msg);
+}
 
-        restart(async);
-        check(commit);
-   }
+void restart(bool async)
+{
+    queueA.reset();
+    queueB.reset();
+    store.reset();
 
-    void setup(bool async)
-    {
-        store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
-        store->init(TESTDIR, async, true, 4, 1);
-        store->truncate();
+    store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
+    store->init(TESTDIR, async, false, 4, 1);
+    ExchangeRegistry exchanges;
+    DtxManager mgr;
+    mgr.setStore (store.get());
+    RecoveryManagerImpl recovery(queues, exchanges, mgr, 0);
+    store->recover(recovery);
 
-        //create two queues:
-        queueA = Queue::shared_ptr(new Queue(nameA, 0, store.get(), 0));
-        FieldTable settings;
-        queueA->create(settings);
-        queueB = Queue::shared_ptr(new Queue(nameB, 0, store.get(), 0));        
-        queueB->create(settings);
+    queueA = queues.find(nameA);
+    queueB = queues.find(nameB);
+}
 
-        //create message and enqueue it onto first queue:
-        Message::shared_ptr msg = MessageUtils::createMessage("exchange", "routing_key", messageId, 0);
-        msg->getProperties<DeliveryProperties>()->setDeliveryMode(PERSISTENT);
-        
-        queueA->deliver(msg);
+void check(bool swapped)
+{        
+    BOOST_REQUIRE(queueA);
+    BOOST_REQUIRE(queueB);
+    
+    Queue::shared_ptr x;//the other queue
+    Queue::shared_ptr y;//the queue on which the message is expected to be
+    
+    if (swapped) {
+        x = queueA;
+        y = queueB;
+    } else {
+        x = queueB;
+        y = queueA;
     }
 
-    void restart(bool async)
-    {
-        queueA.reset();
-        queueB.reset();
-        store.reset();
+    BOOST_REQUIRE_EQUAL((u_int32_t) 0, x->getMessageCount());
+    BOOST_REQUIRE_EQUAL((u_int32_t) 1, y->getMessageCount());
+    Message::shared_ptr msg = y->dequeue().payload;
+    BOOST_REQUIRE(msg);
+    BOOST_REQUIRE_EQUAL(messageId, msg->getProperties<MessageProperties>()->getMessageId());
+}
 
-        store = std::auto_ptr<BdbMessageStore>(new BdbMessageStore());
-        store->init(TESTDIR, async, false, 4, 1);
-        ExchangeRegistry exchanges;
-        DtxManager mgr;
-        mgr.setStore (store.get());
-        RecoveryManagerImpl recovery(queues, exchanges, mgr, 0);
-        store->recover(recovery);
- 
-        queueA = queues.find(nameA);
-        queueB = queues.find(nameB);
+void swap(bool commit, bool async)
+{
+    setup(async);
+
+    Message::shared_ptr msg = queueA->dequeue().payload;
+    BOOST_REQUIRE(msg);
+    //move the message from one queue to the other as a transaction
+    std::auto_ptr<TransactionContext> txn = store->begin();
+    queueB->enqueue(txn.get(), msg);//note: need to enqueue it first to avoid message being deleted
+    queueA->dequeue(txn.get(), msg);
+    if (commit) {
+       store->commit(*txn);
+    } else {
+        store->abort(*txn);
     }
 
-    void check(bool swapped)
-    {        
-        CPPUNIT_ASSERT(queueA);
-        CPPUNIT_ASSERT(queueB);
-        
-        Queue::shared_ptr x;//the other queue
-        Queue::shared_ptr y;//the queue on which the message is expected to be
-        
-        if (swapped) {
-            x = queueA;
-            y = queueB;
-        } else {
-            x = queueB;
-            y = queueA;
-        }
+    restart(async);
+    check(commit);
+}
 
-        CPPUNIT_ASSERT_EQUAL((u_int32_t) 0, x->getMessageCount());
-        CPPUNIT_ASSERT_EQUAL((u_int32_t) 1, y->getMessageCount());
-        Message::shared_ptr msg = y->dequeue().payload;
-        CPPUNIT_ASSERT(msg);
-        CPPUNIT_ASSERT_EQUAL(messageId, msg->getProperties<MessageProperties>()->getMessageId());        
-    }
-};
 
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(TransactionalTest);
+// === Test suite ===
 
+BOOST_AUTO_TEST_CASE(CommitSync)
+{
+    cout << file << ".CommitSync: " << flush;
+    swap(true, false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(CommitAsync)
+{
+    cout << file << ".CommitAsync: " << flush;
+    swap(true, true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(AbortSync)
+{
+    cout << file << ".AbortSync: " << flush;
+    swap(false, false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(AbortAsync)
+{
+    cout << file << ".AbortAsync: " << flush;
+    swap(false, true);
+    cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/TwoPhaseCommitTest.cpp
===================================================================
--- store/trunk/cpp/tests/TwoPhaseCommitTest.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/TwoPhaseCommitTest.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -1,79 +1,55 @@
-/*
-    Copyright (C) 2007 Red Hat Software
+/**
+* Red Hat Messaging - Message Journal
+*
+* This file contains the unit tests for the journal.
+*
+* Copyright 2007, 2008 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.
+*/
 
-    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.
+#include "unit_test.h"
 
-    This file 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.
-*/
-
-#include "test_plugin.h"
 #include "BdbMessageStore.h"
+#include <iostream>
 #include "MessageUtils.h"
 #include <qpid/framing/AMQHeaderBody.h>
-#include <qpid/framing/AMQMethodBody.h>
-#include <qpid/broker/Message.h>
 #include <qpid/broker/Queue.h>
 #include <qpid/broker/RecoveryManagerImpl.h>
-#include <iostream>
-#include <memory>
 
 #define TESTDIR "/tmp"
 
-using boost::static_pointer_cast;
-using boost::dynamic_pointer_cast;
 using namespace rhm::bdbstore;
 using namespace qpid::broker;
 using namespace qpid::framing;
+using namespace std;
 
-class TwoPhaseCommitTest : public CppUnit::TestCase  
-{
-    CPPUNIT_TEST_SUITE(TwoPhaseCommitTest);
-    CPPUNIT_TEST(testCommitSwapSync);
-    CPPUNIT_TEST(testPrepareAndAbortSwapSync);
-    CPPUNIT_TEST(testAbortNoPrepareSwapSync);
+QPID_AUTO_TEST_SUITE(TwoPhaseCommitTest)
 
-    CPPUNIT_TEST(testCommitEnqueueSync);
-    CPPUNIT_TEST(testPrepareAndAbortEnqueueSync);
-    CPPUNIT_TEST(testAbortNoPrepareEnqueueSync);
+const string file("TwoPhaseCommitTest");
 
-    CPPUNIT_TEST(testCommitDequeueSync);
-    CPPUNIT_TEST(testPrepareAndAbortDequeueSync);
-    CPPUNIT_TEST(testAbortNoPrepareDequeueSync);
+// === Helper fns ===
 
-    CPPUNIT_TEST(testRecoverPreparedThenCommittedSync);
-    CPPUNIT_TEST(testRecoverPreparedThenAbortedSync);
+class TwoPhaseCommitTest
+{
 
-    CPPUNIT_TEST(testCommitSwapAsync);
-    CPPUNIT_TEST(testPrepareAndAbortSwapAsync);
-    CPPUNIT_TEST(testAbortNoPrepareSwapAsync);
-
-    CPPUNIT_TEST(testCommitEnqueueAsync);
-    CPPUNIT_TEST(testPrepareAndAbortEnqueueAsync);
-    CPPUNIT_TEST(testAbortNoPrepareEnqueueAsync);
-
-    CPPUNIT_TEST(testCommitDequeueAsync);
-    CPPUNIT_TEST(testPrepareAndAbortDequeueAsync);
-    CPPUNIT_TEST(testAbortNoPrepareDequeueAsync);
-
-    CPPUNIT_TEST(testRecoverPreparedThenCommittedAsync);
-    CPPUNIT_TEST(testRecoverPreparedThenAbortedAsync);
-    CPPUNIT_TEST_SUITE_END();
-
     class Strategy
     {
     public:
@@ -87,7 +63,7 @@
     {
         TwoPhaseCommitTest* const test;
         const string messageId;
-		Message::shared_ptr msg;
+	    Message::shared_ptr msg;
     public:
         Swap(TwoPhaseCommitTest* const test_, const string& messageId_): test(test_), messageId(messageId_) {}
         void init(){ msg = test->deliver(messageId, test->queueA); }
@@ -98,9 +74,9 @@
     class Enqueue : public Strategy
     {
         TwoPhaseCommitTest* const test;
-		Message::shared_ptr msg1;
-		Message::shared_ptr msg2;
-		Message::shared_ptr msg3;
+	    Message::shared_ptr msg1;
+	    Message::shared_ptr msg2;
+	    Message::shared_ptr msg3;
     public:
         Enqueue(TwoPhaseCommitTest* const test_): test(test_) {}
         void init() {}
@@ -122,9 +98,9 @@
     class Dequeue : public Strategy
     {
         TwoPhaseCommitTest* const test;
-		Message::shared_ptr msg1;
-		Message::shared_ptr msg2;
-		Message::shared_ptr msg3;
+	    Message::shared_ptr msg1;
+	    Message::shared_ptr msg2;
+	    Message::shared_ptr msg3;
     public:
         Dequeue(TwoPhaseCommitTest* const test_): test(test_) {}
         void init() {
@@ -154,105 +130,11 @@
     QueueRegistry queues;
     Queue::shared_ptr queueA;
     Queue::shared_ptr queueB;
-	Message::shared_ptr msg1;
-	Message::shared_ptr msg2;
-	Message::shared_ptr msg4;
-	bool async;
-	
-public:
-    TwoPhaseCommitTest() : nameA("queueA"), nameB("queueB") {}
+    Message::shared_ptr msg1;
+    Message::shared_ptr msg2;
+    Message::shared_ptr msg4;
+    bool async;
 
-    //swap tests:
-    void testCommitSwapSync() {async=false ; testCommitSwap();}
-    void testCommitSwapAsync() {async=true ; testCommitSwap();}
-    void testCommitSwap()
-    {
-        Swap swap(this, "SwapMessageId");
-        commit(swap);
-    }
-
-    void testPrepareAndAbortSwapSync() {async=false ; testPrepareAndAbortSwap();}
-    void testPrepareAndAbortSwapAsync() {async=true ; testPrepareAndAbortSwap();}
-    void testPrepareAndAbortSwap()
-    {
-        Swap swap(this, "SwapMessageId");
-        abort(swap, true);
-    }
-
-    void testAbortNoPrepareSwapSync() {async=false ; testAbortNoPrepareSwap();}
-    void testAbortNoPrepareSwapAsync() {async=true ; testAbortNoPrepareSwap();}
-    void testAbortNoPrepareSwap()
-    {
-        Swap swap(this, "SwapMessageId");
-        abort(swap, false);
-    }
-
-    //enqueue tests:
-    void testCommitEnqueueSync() {async=false ; testCommitEnqueue();}
-    void testCommitEnqueueAsync() {async=true ; testCommitEnqueue();}
-    void testCommitEnqueue()
-    {
-        Enqueue enqueue(this);
-        commit(enqueue);
-    }
-
-    void testPrepareAndAbortEnqueueSync() {async=false ; testPrepareAndAbortEnqueue();}
-    void testPrepareAndAbortEnqueueAsync() {async=true ; testPrepareAndAbortEnqueue();}
-    void testPrepareAndAbortEnqueue()
-    {
-        Enqueue enqueue(this);
-        abort(enqueue, true);
-    }
-
-    void testAbortNoPrepareEnqueueSync() {async=false ; testAbortNoPrepareEnqueue();}
-    void testAbortNoPrepareEnqueueAsync() {async=true ; testAbortNoPrepareEnqueue();}
-    void testAbortNoPrepareEnqueue()
-    {
-        Enqueue enqueue(this);
-        abort(enqueue, false);
-    }
-
-    //dequeue tests:
-    void testCommitDequeueSync() {async=false ; testCommitDequeue();}
-    void testCommitDequeueAsync() {async=true ; testCommitDequeue();}
-    void testCommitDequeue()
-    {
-        Dequeue dequeue(this);
-        commit(dequeue);
-    }
-
-    void testPrepareAndAbortDequeueSync() {async=false ; testPrepareAndAbortDequeue();}
-    void testPrepareAndAbortDequeueAsync() {async=true ; testPrepareAndAbortDequeue();}
-    void testPrepareAndAbortDequeue()
-    {
-        Dequeue dequeue(this);
-        abort(dequeue, true);
-    }
-
-    void testAbortNoPrepareDequeueSync() {async=false ; testAbortNoPrepareDequeue();}
-    void testAbortNoPrepareDequeueAsync() {async=true ; testAbortNoPrepareDequeue();}
-    void testAbortNoPrepareDequeue()
-    {
-        Dequeue dequeue(this);
-        abort(dequeue, false);
-    }
-
-    //test recovery of prepared txn:
-
-    void testRecoverPreparedThenCommittedSync() {async=false ; testRecoverPreparedThenCommitted();}
-    void testRecoverPreparedThenCommittedAsync() {async=true ; testRecoverPreparedThenCommitted();}
-    void testRecoverPreparedThenCommitted()
-    {
-        recoverPrepared(true);
-    }
-
-    void testRecoverPreparedThenAbortedSync() {async=false ; testRecoverPreparedThenAborted();}
-    void testRecoverPreparedThenAbortedAsync() {async=true ; testRecoverPreparedThenAborted();}
-    void testRecoverPreparedThenAborted()
-    {
-        recoverPrepared(false);
-    }
-
     void recoverPrepared(bool commit)
     {
         setup();
@@ -265,8 +147,8 @@
         restart();
 
         //check that the message is not available from either queue
-        CPPUNIT_ASSERT_EQUAL((u_int32_t) 0, queueA->getMessageCount());
-        CPPUNIT_ASSERT_EQUAL((u_int32_t) 0, queueB->getMessageCount());
+        BOOST_REQUIRE_EQUAL((u_int32_t) 0, queueA->getMessageCount());
+        BOOST_REQUIRE_EQUAL((u_int32_t) 0, queueB->getMessageCount());
 
         //commit/abort the txn - through the dtx manager, not directly on the store
         if (commit) {
@@ -325,14 +207,14 @@
     {
         Message::shared_ptr msg = createMessage(msgid);        
         queueA->enqueue(txn, msg);
-		return msg;
+	    return msg;
     }
 
     Message::shared_ptr deliver(const string& msgid, Queue::shared_ptr& queue)
     {
         msg4 = createMessage(msgid);        
         queue->deliver(msg4);
-		return msg4;
+	    return msg4;
     }
 
     void setup()
@@ -376,12 +258,12 @@
 
     void swapCheck(bool swapped, const string& msgid)
     {        
-        CPPUNIT_ASSERT(queueA);
-        CPPUNIT_ASSERT(queueB);
-        
+        BOOST_REQUIRE(queueA);
+        BOOST_REQUIRE(queueB);
+    
         Queue::shared_ptr x;//the other queue
         Queue::shared_ptr y;//the queue on which the message is expected to be
-        
+    
         if (swapped) {
             x = queueA;
             y = queueB;
@@ -390,26 +272,259 @@
             y = queueA;
         }
 
-        CPPUNIT_ASSERT_EQUAL((u_int32_t) 0, x->getMessageCount());
-        CPPUNIT_ASSERT_EQUAL((u_int32_t) 1, y->getMessageCount());
+        BOOST_REQUIRE_EQUAL((u_int32_t) 0, x->getMessageCount());
+        BOOST_REQUIRE_EQUAL((u_int32_t) 1, y->getMessageCount());
         Message::shared_ptr msg = y->dequeue().payload;
-        CPPUNIT_ASSERT(msg);
-        CPPUNIT_ASSERT_EQUAL(msgid, msg->getProperties<MessageProperties>()->getMessageId());        
+        BOOST_REQUIRE(msg);
+        BOOST_REQUIRE_EQUAL(msgid, msg->getProperties<MessageProperties>()->getMessageId());        
     }
 
     void checkA(u_int32_t size, const string& msgid = "<none>")
     {        
-        CPPUNIT_ASSERT(queueA);
-        CPPUNIT_ASSERT_EQUAL(size, queueA->getMessageCount());
+        BOOST_REQUIRE(queueA);
+        BOOST_REQUIRE_EQUAL(size, queueA->getMessageCount());
         if (size > 0) {
             Message::shared_ptr msg = queueA->dequeue().payload;
-            CPPUNIT_ASSERT(msg);
-            CPPUNIT_ASSERT_EQUAL(msgid, msg->getProperties<MessageProperties>()->getMessageId());        
+            BOOST_REQUIRE(msg);
+            BOOST_REQUIRE_EQUAL(msgid, msg->getProperties<MessageProperties>()->getMessageId());
         }
     }
+
+public:
+    TwoPhaseCommitTest() : nameA("queueA"), nameB("queueB") {}
+
+    void testCommitSwap(bool a)
+    {
+        async = a;
+        Swap swap(this, "SwapMessageId");
+        commit(swap);
+    }
+
+    void testPrepareAndAbortSwap(bool a)
+    {
+        async = a;
+        Swap swap(this, "SwapMessageId");
+        abort(swap, true);
+    }
+
+    void testAbortNoPrepareSwap(bool a)
+    {
+        async = a;
+        Swap swap(this, "SwapMessageId");
+        abort(swap, false);
+    }
+
+    void testCommitEnqueue(bool a)
+    {
+        async = a;
+        Enqueue enqueue(this);
+        commit(enqueue);
+    }
+
+    void testPrepareAndAbortEnqueue(bool a)
+    {
+        async = a;
+        Enqueue enqueue(this);
+        abort(enqueue, true);
+    }
+
+    void testAbortNoPrepareEnqueue(bool a)
+    {
+        async = a;
+        Enqueue enqueue(this);
+        abort(enqueue, false);
+    }
+
+    void testCommitDequeue(bool a)
+    {
+        async = a;
+        Dequeue dequeue(this);
+        commit(dequeue);
+    }
+
+    void testPrepareAndAbortDequeue(bool a)
+    {
+        async = a;
+        Dequeue dequeue(this);
+        abort(dequeue, true);
+    }
+
+    void testAbortNoPrepareDequeue(bool a)
+    {
+        async = a;
+        Dequeue dequeue(this);
+        abort(dequeue, false);
+    }
+
+    void testRecoverPreparedThenCommitted(bool a)
+    {
+        async = a;
+        recoverPrepared(true);
+    }
+
+    void testRecoverPreparedThenAborted(bool a)
+    {
+        async = a;
+        recoverPrepared(false);
+    }
 };
 
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(TwoPhaseCommitTest);
+TwoPhaseCommitTest tpct;
 
+// === Test suite ===
+
+BOOST_AUTO_TEST_CASE(CommitSwapSync)
+{
+    cout << file << ".CommitSwapSync: " << flush;
+    tpct.testCommitSwap(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(PrepareAndAbortSwapSync)
+{
+    cout << file << ".PrepareAndAbortSwapSync: " << flush;
+    tpct.testPrepareAndAbortSwap(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(AbortNoPrepareSwapSync)
+{
+    cout << file << ".AbortNoPrepareSwapSync: " << flush;
+    tpct.testAbortNoPrepareSwap(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(CommitEnqueueSync)
+{
+    cout << file << ".CommitEnqueueSync: " << flush;
+    tpct.testCommitEnqueue(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(PrepareAndAbortEnqueueSync)
+{
+    cout << file << ".PrepareAndAbortEnqueueSync: " << flush;
+    tpct.testPrepareAndAbortEnqueue(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(AbortNoPrepareEnqueueSync)
+{
+    cout << file << ".AbortNoPrepareEnqueueSync: " << flush;
+    tpct.testAbortNoPrepareEnqueue(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(CommitDequeueSync)
+{
+    cout << file << ".CommitDequeueSync: " << flush;
+    tpct.testCommitDequeue(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(PrepareAndAbortDequeueSync)
+{
+    cout << file << ".PrepareAndAbortDequeueSync: " << flush;
+    tpct.testPrepareAndAbortDequeue(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(AbortNoPrepareDequeueSync)
+{
+    cout << file << ".AbortNoPrepareDequeueSync: " << flush;
+    tpct.testAbortNoPrepareDequeue(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(RecoverPreparedThenCommittedSync)
+{
+    cout << file << ".RecoverPreparedThenCommittedSync: " << flush;
+    tpct.testRecoverPreparedThenCommitted(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(RecoverPreparedThenAbortedSync)
+{
+    cout << file << ".RecoverPreparedThenAbortedSync: " << flush;
+    tpct.testRecoverPreparedThenAborted(false);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(CommitSwapAsync)
+{
+    cout << file << ".CommitSwapAsync: " << flush;
+    tpct.testCommitSwap(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(PrepareAndAbortSwapAsync)
+{
+    cout << file << ".PrepareAndAbortSwapAsync: " << flush;
+    tpct.testPrepareAndAbortSwap(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(AbortNoPrepareSwapAsync)
+{
+    cout << file << ".AbortNoPrepareSwapAsync: " << flush;
+    tpct.testAbortNoPrepareSwap(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(CommitEnqueueAsync)
+{
+    cout << file << ".CommitEnqueueAsync: " << flush;
+    tpct.testCommitEnqueue(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(PrepareAndAbortEnqueueAsync)
+{
+    cout << file << ".PrepareAndAbortEnqueueAsync: " << flush;
+    tpct.testPrepareAndAbortEnqueue(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(AbortNoPrepareEnqueueAsync)
+{
+    cout << file << ".AbortNoPrepareEnqueueAsync: " << flush;
+    tpct.testAbortNoPrepareEnqueue(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(CommitDequeueAsync)
+{
+    cout << file << ".CommitDequeueAsync: " << flush;
+    tpct.testCommitDequeue(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(PrepareAndAbortDequeueAsync)
+{
+    cout << file << ".PrepareAndAbortDequeueAsync: " << flush;
+    tpct.testPrepareAndAbortDequeue(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(AbortNoPrepareDequeueAsync)
+{
+    cout << file << ".AbortNoPrepareDequeueAsync: " << flush;
+    tpct.testAbortNoPrepareDequeue(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(RecoverPreparedThenCommittedAsync)
+{
+    cout << file << ".RecoverPreparedThenCommittedAsync: " << flush;
+    tpct.testRecoverPreparedThenCommitted(true);
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(RecoverPreparedThenAbortedAsync)
+{
+    cout << file << ".RecoverPreparedThenAbortedAsync: " << flush;
+    tpct.testRecoverPreparedThenAborted(true);
+    cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_SUITE_END()

Deleted: store/trunk/cpp/tests/dlclose_noop.c
===================================================================
--- store/trunk/cpp/tests/dlclose_noop.c	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/dlclose_noop.c	2008-02-28 17:03:42 UTC (rev 1734)
@@ -1,30 +0,0 @@
-/*
- *
- * 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.
- *
- */
-
-
-/**
- * Loaded via LD_PRELOAD this will turn dlclose into a no-op.
- *
- * Allows valgrind to generate useful reports from programs that
- * dynamically unload libraries before exit, such as CppUnit's
- * DllPlugInTester.
- *
- */
-void* dlclose(void*);
-void* dlclose(void* handle) { return 0; }
-


Property changes on: store/trunk/cpp/tests/jrnl
___________________________________________________________________
Name: svn:ignore
   - .deps
.libs
Makefile
Makefile.in
jtest
_ut_enq_map
_ut_jdir
_ut_jerrno
_ut_jexception
_ut_jinf
_ut_rec_hdr
_ut_time_ns
_ut_txn_map
_st_basic

   + .deps
.libs
Makefile
Makefile.in
jtest
_ut_enq_map
_ut_jdir
_ut_jerrno
_ut_jexception
_ut_jinf
_ut_rec_hdr
_ut_time_ns
_ut_txn_map
_st_basic
_st_basic_txn
_st_read
_st_read_txn


Deleted: store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/JournalSystemTests.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -1,828 +0,0 @@
-/**
-* \file JournalSystemTests.cpp
-*
-* Red Hat Messaging - Message Journal
-*
-* This file contains the unit tests for the journal.
-*
-* \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.
-*/
-
-#include "JournalSystemTests.hpp"
-
-#define NUM_MSGS 5
-#define MAX_AIO_SLEEPS 500
-#define AIO_SLEEP_TIME 1000
-#define MSG_SIZE 100
-#define XID_SIZE 64
-#define NUM_JFILES 4
-#define JFSIZE_SBLKS 96
-
-using namespace std;
-
-void
-JournalSystemTests::InstantiationTest()
-{
-    try
-    {
-        char* test_name = "InstantiationTest";
-        rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-    }
-    catch (const rhm::journal::jexception& e)
-    {
-        stringstream ss;
-        ss << e;
-        CPPUNIT_FAIL(ss.str());
-    }
-}
-
-void
-JournalSystemTests::InitializationTest()
-{
-    try
-    {
-        char* test_name = "InitializationTest";
-        rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-        jrnl_init(&jc);
-    }
-    catch (const rhm::journal::jexception& e)
-    {
-        stringstream ss;
-        ss << e;
-        CPPUNIT_FAIL(ss.str());
-    }
-}
-
-void
-JournalSystemTests::EmptyRecoverTest()
-{
-    try
-    {
-        vector<string> txn_list;
-        u_int64_t highest_rid;
-        char* test_name = "EmptyRecoverTest";
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_init(&jc);
-        }
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_recover(&jc, txn_list, highest_rid);
-        }
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_recover(&jc, txn_list, highest_rid);
-            jc.recover_complete();
-        }
-    }
-    catch (const rhm::journal::jexception& e)
-    {
-        stringstream ss;
-        ss << e;
-        CPPUNIT_FAIL(ss.str());
-    }
-}
-
-void
-JournalSystemTests::EnqueueTest()
-{
-    try
-    {
-        char* test_name = "EnqueueTest";
-        rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-        jrnl_init(&jc);
-
-        // Non-txn
-        for (int m=0; m<NUM_MSGS; m++)
-            enq_msg(&jc, create_msg(msg, m, MSG_SIZE), false);
-
-        // Txn
-        create_xid(xid, 0, XID_SIZE);
-        for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-            enq_txn_msg(&jc, create_msg(msg, m, MSG_SIZE), xid, false);
-        txn_commit(&jc, xid);
-    }
-    catch (const rhm::journal::jexception& e)
-    {
-        stringstream ss;
-        ss << e;
-        CPPUNIT_FAIL(ss.str());
-    }
-}
-
-void
-JournalSystemTests::RecoverReadTest()
-{
-    vector<string> txn_list;
-    u_int64_t highest_rid;
-    try
-    {
-        // Non-txn
-        char* test_name = "RecoverReadTest";
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_init(&jc);
-            for (int m=0; m<NUM_MSGS; m++)
-                enq_msg(&jc, create_msg(msg, m, MSG_SIZE), false);
-        }
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_recover(&jc, txn_list, highest_rid);
-            for (int m=0; m<NUM_MSGS; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt during recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-        }
-
-        // Txn
-        test_name = "TxnRecoverReadTest";
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_init(&jc);
-            create_xid(xid, 1, XID_SIZE);
-            txn_list.push_back(xid);
-            for (int m=0; m<NUM_MSGS; m++)
-                enq_txn_msg(&jc, create_msg(msg, m, MSG_SIZE), xid, false);
-            txn_commit(&jc, xid);
-        }
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_recover(&jc, txn_list, highest_rid);
-            for (int m=0; m<NUM_MSGS; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt during recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-        }
-    }
-    catch (const rhm::journal::jexception& e)
-    {
-        stringstream ss;
-        ss << e;
-        CPPUNIT_FAIL(ss.str());
-    }
-}
-
-void
-JournalSystemTests::RecoveredReadTest()
-{
-    vector<string> txn_list;
-    u_int64_t highest_rid;
-    try
-    {
-        // Non-txn
-        char* test_name = "RecoveredReadTest";
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_init(&jc);
-            for (int m=0; m<NUM_MSGS; m++)
-                enq_msg(&jc, create_msg(msg, m, MSG_SIZE), false);
-        }
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_recover(&jc, txn_list, highest_rid);
-            for (int m=0; m<NUM_MSGS; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt during recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-            jc.recover_complete();
-            for (int m=0; m<NUM_MSGS; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt after recovery.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-        }
-
-        // Txn
-        test_name = "TxnRecoveredReadTest";
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_init(&jc);
-            create_xid(xid, 2, XID_SIZE);
-            txn_list.push_back(xid);
-            for (int m=0; m<NUM_MSGS; m++)
-                enq_txn_msg(&jc, create_msg(msg, m, MSG_SIZE), xid, false);
-            txn_commit(&jc, xid);
-        }
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_recover(&jc, txn_list, highest_rid);
-            for (int m=0; m<NUM_MSGS; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt during recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-            jc.recover_complete();
-            for (int m=0; m<NUM_MSGS; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt after recovery.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-        }
-    }
-    catch (const rhm::journal::jexception& e)
-    {
-        stringstream ss;
-        ss << e;
-        CPPUNIT_FAIL(ss.str());
-    }
-}
-
-void
-JournalSystemTests::RecoveredDequeueTest()
-{
-    vector<string> txn_list;
-    u_int64_t highest_rid;
-    try
-    {
-        // Non-txn
-        char* test_name = "RecoveredDequeueTest";
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_init(&jc);
-            for (int m=0; m<NUM_MSGS; m++)
-                enq_msg(&jc, create_msg(msg, m, MSG_SIZE), false);
-        }
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_recover(&jc, txn_list, highest_rid);
-            for (int m=0; m<NUM_MSGS; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt during recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-            jc.recover_complete();
-            for (int m=0; m<NUM_MSGS; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt after recovery.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-            for (int m=0; m<NUM_MSGS; m++)
-                deq_msg(&jc, m);
-        }
-
-        // Txn
-        test_name = "TxnRecoveredDequeueTest";
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_init(&jc);
-            create_xid(xid, 3, XID_SIZE);
-            txn_list.push_back(xid);
-            for (int m=0; m<NUM_MSGS; m++)
-                enq_txn_msg(&jc, create_msg(msg, m, MSG_SIZE), xid, false);
-            txn_commit(&jc, xid);
-        }
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_recover(&jc, txn_list, highest_rid);
-            for (int m=0; m<NUM_MSGS; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt during recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-            jc.recover_complete();
-            for (int m=0; m<NUM_MSGS; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt after recovery.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-            for (int m=0; m<NUM_MSGS; m++)
-                deq_msg(&jc, m);
-        }
-    }
-    catch (const rhm::journal::jexception& e)
-    {
-        stringstream ss;
-        ss << e;
-        CPPUNIT_FAIL(ss.str());
-    }
-}
-
-void
-JournalSystemTests::HeaderFlagsTest()
-{
-    vector<string> txn_list;
-    u_int64_t highest_rid;
-    try
-    {
-        // Non-txn
-        char* test_name = "FlagsRecoverdTest";
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_init(&jc);
-            // Transient msgs - should not recover
-            for (int m=0; m<NUM_MSGS; m++)
-                enq_msg(&jc, create_msg(msg, m, MSG_SIZE), true);
-            // Persistent msgs
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-                enq_msg(&jc, create_msg(msg, m, MSG_SIZE), false);
-            // Transient extern msgs - should not recover
-            for (int m=NUM_MSGS*2; m<NUM_MSGS*3; m++)
-                enq_extern_msg(&jc, true);
-            // Persistnet extern msgs
-            for (int m=NUM_MSGS*3; m<NUM_MSGS*4; m++)
-                enq_extern_msg(&jc, false);
-        }
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_recover(&jc, txn_list, highest_rid);
-            // Recover non-transient msgs
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Transient message recovered.", transientFlag == false);
-                CPPUNIT_ASSERT_MESSAGE("External flag incorrect.", externalFlag == false);
-                CPPUNIT_ASSERT_MESSAGE("Non-transient message corrupt during recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-            // Recover non-transient extern msgs
-            for (int m=NUM_MSGS*3; m<NUM_MSGS*4; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Transient message recovered.", transientFlag == false);
-                CPPUNIT_ASSERT_MESSAGE("External flag incorrect.", externalFlag == true);
-                CPPUNIT_ASSERT_MESSAGE("External message returned non-null pointer.",
-                        mbuff == NULL);
-                cleanMessage();
-            }
-            jc.recover_complete();
-            // Read recovered non-transient msgs
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Transient message recovered.", transientFlag == false);
-                CPPUNIT_ASSERT_MESSAGE("External flag incorrect.", externalFlag == false);
-                CPPUNIT_ASSERT_MESSAGE("Non-transient message corrupt during recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-            // Read recovered non-transient extern msgs
-            for (int m=NUM_MSGS*3; m<NUM_MSGS*4; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Transient message recovered.", transientFlag == false);
-                CPPUNIT_ASSERT_MESSAGE("External flag incorrect.", externalFlag == true);
-                CPPUNIT_ASSERT_MESSAGE("External message returned non-null pointer.",
-                        mbuff == NULL);
-                cleanMessage();
-            }
-            // Dequeue recovered messages
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-                deq_msg(&jc, m);
-            for (int m=NUM_MSGS*3; m<NUM_MSGS*4; m++)
-                deq_msg(&jc, m);
-        }
-
-        // Txn
-        test_name = "TxnFlagsRecoverdTest";
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_init(&jc);
-            create_xid(xid, 4, XID_SIZE);
-            txn_list.push_back(xid);
-            // Transient msgs - should not recover
-            for (int m=0; m<NUM_MSGS; m++)
-                enq_txn_msg(&jc, create_msg(msg, m, MSG_SIZE), xid, true);
-            // Persistent msgs
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-                enq_txn_msg(&jc, create_msg(msg, m, MSG_SIZE), xid, false);
-            // Transient extern msgs - should not recover
-            for (int m=NUM_MSGS*2; m<NUM_MSGS*3; m++)
-                enq_extern_txn_msg(&jc, xid, true);
-            // Persistnet extern msgs
-            for (int m=NUM_MSGS*3; m<NUM_MSGS*4; m++)
-                enq_extern_txn_msg(&jc, xid, false);
-            txn_commit(&jc, xid);
-        }
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_recover(&jc, txn_list, highest_rid);
-            // Recover non-transient msgs
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Transient message recovered.", transientFlag == false);
-                CPPUNIT_ASSERT_MESSAGE("External flag incorrect.", externalFlag == false);
-                CPPUNIT_ASSERT_MESSAGE("Non-transient message corrupt during recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-            // Recover non-transient extern msgs
-            for (int m=NUM_MSGS*3; m<NUM_MSGS*4; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Transient message recovered.", transientFlag == false);
-                CPPUNIT_ASSERT_MESSAGE("External flag incorrect.", externalFlag == true);
-                CPPUNIT_ASSERT_MESSAGE("External message returned non-null pointer.",
-                        mbuff == NULL);
-                cleanMessage();
-            }
-            jc.recover_complete();
-            // Read recovered non-transient msgs
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Transient message recovered.", transientFlag == false);
-                CPPUNIT_ASSERT_MESSAGE("External flag incorrect.", externalFlag == false);
-                CPPUNIT_ASSERT_MESSAGE("Non-transient message corrupt during recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-            // Read recovered non-transient extern msgs
-            for (int m=NUM_MSGS*3; m<NUM_MSGS*4; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Transient message recovered.", transientFlag == false);
-                CPPUNIT_ASSERT_MESSAGE("External flag incorrect.", externalFlag == true);
-                CPPUNIT_ASSERT_MESSAGE("External message returned non-null pointer.",
-                        mbuff == NULL);
-                cleanMessage();
-            }
-            // Dequeue recovered messages
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-                deq_msg(&jc, m);
-            for (int m=NUM_MSGS*3; m<NUM_MSGS*4; m++)
-                deq_msg(&jc, m);
-        }
-    }
-    catch (const rhm::journal::jexception& e)
-    {
-        stringstream ss;
-        ss << e;
-        CPPUNIT_FAIL(ss.str());
-    }
-}
-
-void
-JournalSystemTests::ComplexRecoveryTest1()
-{
-    vector<string> txn_list;
-    u_int64_t highest_rid;
-    try
-    {
-        // Non-txn
-        char* test_name = "ComplexRecoveryTest1";
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_init(&jc);
-            
-            // Enqueue 2n, then dequeue first n msgs; check that only last n readable
-            // rids: 0 to NUM_MSGS*2 - 1
-            for (int m=0; m<NUM_MSGS*2; m++)
-                enq_msg(&jc, create_msg(msg, m, MSG_SIZE), false);
-            // rids: NUM_MSGS*2 to NUM_MSGS*3 - 1
-            for (int m=0; m<NUM_MSGS; m++)
-                deq_msg(&jc, m);
-            jc.flush();
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt before recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-        }
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_recover(&jc, txn_list, highest_rid);
-
-            // Check that only last n readable (as before)
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt during recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-            jc.recover_complete();
-
-            // Enqueue another n msgs
-            // rids: NUM_MSGS*3 to NUM_MSGS*4 - 1
-            for (int m=NUM_MSGS*2; m<NUM_MSGS*3; m++)
-                enq_msg(&jc, create_msg(msg, m, MSG_SIZE), false);
-            jc.flush();
-            
-            // Check that 2n messages are now readable
-            for (int m=NUM_MSGS; m<NUM_MSGS*3; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt after recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-
-            // Dequeue all remaining messages
-            // rids: NUM_MSGS*4 to NUM_MSGS*6 - 1
-            for (int m=NUM_MSGS; m<NUM_MSGS*3; m++)
-                deq_msg(&jc, m);
-        }
-
-        // Txn
-        test_name = "TxnComplexRecoveryTest1";
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_init(&jc);
-            
-            // Enqueue 2n, then dequeue first n msgs; check that only last n readable
-            // rids: 0 to NUM_MSGS - 1
-            for (int m=0; m<NUM_MSGS; m++)
-                enq_msg(&jc, create_msg(msg, m, MSG_SIZE), false);
-            // rids: NUM_MSGS to NUM_MSGS*2 - 1
-            create_xid(xid, 5, XID_SIZE);
-            txn_list.push_back(xid);
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-                enq_txn_msg(&jc, create_msg(msg, m, MSG_SIZE), xid, false);
-            // rids: NUM_MSGS*2 to NUM_MSGS*3 - 1
-            for (int m=0; m<NUM_MSGS; m++)
-                deq_msg(&jc, m);
-            // rid: NUM_MSGS*3
-            txn_commit(&jc, xid);
-            jc.flush();
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt before recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-        }
-        {
-            rhm::journal::jcntl jc(test_name, "jdata", test_name, NUM_JFILES, JFSIZE_SBLKS);
-            jrnl_recover(&jc, txn_list, highest_rid);
-
-            // Check that only last n readable (as before)
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt during recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-            jc.recover_complete();
-
-            // Enqueue another n msgs
-            // rids: NUM_MSGS*3+1 to NUM_MSGS*4
-            for (int m=NUM_MSGS*3+1; m<NUM_MSGS*4+1; m++)
-                enq_msg(&jc, create_msg(msg, m, MSG_SIZE), false);
-            jc.flush();
-            
-            // Check that 2n messages are now readable
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt after recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-            for (int m=NUM_MSGS*3+1; m<NUM_MSGS*4+1; m++)
-            {
-                read_msg(&jc);
-                CPPUNIT_ASSERT_MESSAGE("Message corrupt after recover.",
-                        create_msg(msg, m, MSG_SIZE).compare(string((char*)mbuff, msize)) == 0);
-                cleanMessage();
-            }
-
-            // Dequeue all remaining messages
-            // rids: NUM_MSGS*4+1 to NUM_MSGS*6
-            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
-                deq_msg(&jc, m);
-            for (int m=NUM_MSGS*3+1; m<NUM_MSGS*4+1; m++)
-                deq_msg(&jc, m);
-        }
-    }
-    catch (const rhm::journal::jexception& e)
-    {
-        stringstream ss;
-        ss << e;
-        CPPUNIT_FAIL(ss.str());
-    }
-}
-
-// === Private helper functions ===
-
-void
-JournalSystemTests::jrnl_init(rhm::journal::jcntl* jc)
-{
-    jc->initialize(0, 0);
-}
-
-void
-JournalSystemTests::jrnl_recover(rhm::journal::jcntl* jc, vector<string> txn_list,
-        u_int64_t& highest_rid)
-{
-    jc->recover(0, 0, txn_list, highest_rid);
-}
-
-void
-JournalSystemTests::enq_msg(rhm::journal::jcntl* jc, const string msg, const bool transient)
-{
-    rhm::journal::data_tok* dtp = new rhm::journal::data_tok;
-    CPPUNIT_ASSERT_MESSAGE("Data Token heap intantiation failed.", dtp != NULL);
-
-    unsigned aio_sleep_cnt = 0;
-    while (handle_jcntl_response(jc->enqueue_data_record(msg.c_str(), msg.size(), msg.size(),
-            dtp, transient), jc, aio_sleep_cnt, dtp));
-}
-
-void
-JournalSystemTests::enq_extern_msg(rhm::journal::jcntl* jc, const bool transient)
-{
-    rhm::journal::data_tok* dtp = new rhm::journal::data_tok;
-    CPPUNIT_ASSERT_MESSAGE("Data Token heap intantiation failed.", dtp != NULL);
-
-    unsigned aio_sleep_cnt = 0;
-    while (handle_jcntl_response(jc->enqueue_extern_data_record(msg.size(),
-            dtp, transient), jc, aio_sleep_cnt, dtp));
-}
-
-void
-JournalSystemTests::enq_txn_msg(rhm::journal::jcntl* jc, const string msg,
-        const string xid, const bool transient)
-{
-    rhm::journal::data_tok* dtp = new rhm::journal::data_tok;
-    CPPUNIT_ASSERT_MESSAGE("Data Token heap intantiation failed.", dtp != NULL);
-
-    unsigned aio_sleep_cnt = 0;
-    while (handle_jcntl_response(jc->enqueue_txn_data_record(msg.c_str(), msg.size(),
-            msg.size(), dtp, xid, transient), jc, aio_sleep_cnt, dtp));
-}
-
-void
-JournalSystemTests::enq_extern_txn_msg(rhm::journal::jcntl* jc, const string xid,
-        const bool transient)
-{
-    rhm::journal::data_tok* dtp = new rhm::journal::data_tok;
-    CPPUNIT_ASSERT_MESSAGE("Data Token heap intantiation failed.", dtp != NULL);
-
-    unsigned aio_sleep_cnt = 0;
-    while (handle_jcntl_response(jc->enqueue_extern_txn_data_record(msg.size(), dtp, xid,
-            transient), jc, aio_sleep_cnt, dtp));
-}
-
-void
-JournalSystemTests::deq_msg(rhm::journal::jcntl* jc, u_int64_t rid)
-{
-    rhm::journal::data_tok* dtp = new rhm::journal::data_tok;
-    CPPUNIT_ASSERT_MESSAGE("Data Token heap intantiation failed.", dtp != NULL);
-    dtp->set_wstate(rhm::journal::data_tok::ENQ);
-    dtp->set_rid(rid);
-
-    unsigned aio_sleep_cnt = 0;
-    while (handle_jcntl_response(jc->dequeue_data_record(dtp), jc, aio_sleep_cnt, dtp));
-}
-
-void
-JournalSystemTests::deq_txn_msg(rhm::journal::jcntl* jc, u_int64_t rid, const string xid)
-{
-    rhm::journal::data_tok* dtp = new rhm::journal::data_tok;
-    CPPUNIT_ASSERT_MESSAGE("Data Token heap intantiation failed.", dtp != NULL);
-    dtp->set_wstate(rhm::journal::data_tok::ENQ);
-    dtp->set_rid(rid);
-
-    unsigned aio_sleep_cnt = 0;
-    while (handle_jcntl_response(jc->dequeue_txn_data_record(dtp, xid),
-            jc, aio_sleep_cnt, dtp));
-}
-
-void
-JournalSystemTests::txn_abort(rhm::journal::jcntl* jc, const string xid)
-{
-    rhm::journal::data_tok* dtp = new rhm::journal::data_tok;
-    CPPUNIT_ASSERT_MESSAGE("Data Token heap intantiation failed.", dtp != NULL);
-
-    unsigned aio_sleep_cnt = 0;
-    while (handle_jcntl_response(jc->txn_abort(dtp, xid), jc, aio_sleep_cnt, dtp));
-}
-
-void
-JournalSystemTests::txn_commit(rhm::journal::jcntl* jc, const string xid)
-{
-    rhm::journal::data_tok* dtp = new rhm::journal::data_tok;
-    CPPUNIT_ASSERT_MESSAGE("Data Token heap intantiation failed.", dtp != NULL);
-
-    unsigned aio_sleep_cnt = 0;
-    while (handle_jcntl_response(jc->txn_commit(dtp, xid), jc, aio_sleep_cnt, dtp));
-}
-
-char*
-JournalSystemTests::read_msg(rhm::journal::jcntl* jc)
-{
-    rhm::journal::data_tok* dtp = new rhm::journal::data_tok;
-    CPPUNIT_ASSERT_MESSAGE("Data Token heap intantiation failed.", dtp != NULL);
-    dtp->set_wstate(rhm::journal::data_tok::ENQ);
-
-    unsigned aio_sleep_cnt = 0;
-    while (handle_jcntl_response(jc->read_data_record(&mbuff, msize, &xidbuff, xidsize,
-            transientFlag, externalFlag, dtp), jc, aio_sleep_cnt, dtp));
-    return (char*)mbuff;
-}
-
-bool
-JournalSystemTests::handle_jcntl_response(rhm::journal::iores res, rhm::journal::jcntl* jc,
-        unsigned& aio_sleep_cnt, rhm::journal::data_tok* dtp)
-{
-    switch (res)
-    {
-        case rhm::journal::RHM_IORES_SUCCESS:
-            return false;
-        case rhm::journal::RHM_IORES_AIO_WAIT:
-            if (++aio_sleep_cnt <= MAX_AIO_SLEEPS)
-            {
-                jc->get_wr_events();
-                usleep(AIO_SLEEP_TIME);
-            }
-            else
-            {
-                delete dtp;
-                CPPUNIT_FAIL("Timeout on RHM_IORES_AIO_WAIT.");
-            }
-            break;
-        default:
-            delete dtp;
-            CPPUNIT_FAIL(rhm::journal::iores_str(res));
-    }
-    return true;
-}
-
-// static fn
-string&
-JournalSystemTests::create_msg(string& s, int msg_num, int len)
-{
-    stringstream ss;
-    ss << "Message_" << setfill('0') << setw(4) << msg_num << "_";
-    for (int i=14; i<=len; i++)
-        ss << (char)('0' + i%10);
-    s.assign(ss.str());
-    return s;
-}
-
-// static fn
-string&
-JournalSystemTests::create_xid(string& s, int msg_num, int len)
-{
-    stringstream ss;
-    ss << "XID_" << setfill('0') << setw(4) << msg_num << "_";
-    for (int i=9; i<len; i++)
-        ss << (char)('a' + i%26);
-    s.assign(ss.str());
-    return s;
-}
-
-void JournalSystemTests::cleanMessage()
-{
-    if (xidbuff)
-    {
-        free(xidbuff);
-        xidbuff = NULL;
-        mbuff = NULL;
-    }
-    else if (mbuff)
-    {
-        free (mbuff);
-        mbuff = NULL;
-    }
-}

Deleted: store/trunk/cpp/tests/jrnl/JournalSystemTests.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/JournalSystemTests.hpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/JournalSystemTests.hpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -1,96 +0,0 @@
-/**
-* \file JournalSystemTests.hpp
-*
-* Red Hat Messaging - Message Journal
-*
-* This file contains header files for the journal unit tests.
-*
-* 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 JournalSystemTests_hpp
-#define JournalSystemTests_hpp
-
-#include "../test_plugin.h"
-#include <jrnl/jcntl.hpp>
-#include <vector>
-
-class JournalSystemTests : public CppUnit::TestCase  
-{
-    CPPUNIT_TEST_SUITE(JournalSystemTests);
-    CPPUNIT_TEST(InstantiationTest);
-    CPPUNIT_TEST(InitializationTest);
-    CPPUNIT_TEST(EmptyRecoverTest);
-    CPPUNIT_TEST(EnqueueTest);
-    CPPUNIT_TEST(RecoverReadTest);
-    CPPUNIT_TEST(RecoveredReadTest);
-    CPPUNIT_TEST(RecoveredDequeueTest);
-    CPPUNIT_TEST(HeaderFlagsTest);
-//    CPPUNIT_TEST(ComplexRecoveryTest1);
-    CPPUNIT_TEST_SUITE_END();
-
-    std::string msg;
-    std::string xid;
-    void* mbuff;
-    size_t msize;
-    void* xidbuff;
-    size_t xidsize;
-    bool transientFlag;
-    bool externalFlag;
-
-public:
-    void InstantiationTest();
-    void InitializationTest();
-    void EmptyRecoverTest();
-    void EnqueueTest();
-    void RecoverReadTest();
-    void RecoveredReadTest();
-    void RecoveredDequeueTest();
-    void HeaderFlagsTest();
-    void ComplexRecoveryTest1();
-
-private:
-    void jrnl_init(rhm::journal::jcntl* jc);
-    void jrnl_recover(rhm::journal::jcntl* jc, std::vector<std::string> txn_list,
-            u_int64_t& highest_rid);
-    void enq_msg(rhm::journal::jcntl* jc, const std::string msg, const bool transient);
-    void enq_extern_msg(rhm::journal::jcntl* jc, const bool transient);
-    void enq_txn_msg(rhm::journal::jcntl* jc, const std::string msg, const std::string xid,
-            const bool transient);
-    void enq_extern_txn_msg(rhm::journal::jcntl* jc, const std::string xid, const bool transient);
-    void deq_msg(rhm::journal::jcntl* jc, u_int64_t rid);
-    void deq_txn_msg(rhm::journal::jcntl* jc, u_int64_t rid, const std::string xid);
-    void txn_abort(rhm::journal::jcntl* jc, const std::string xid);
-    void txn_commit(rhm::journal::jcntl* jc, const std::string xid);
-    char* read_msg(rhm::journal::jcntl* jc);
-    bool handle_jcntl_response(rhm::journal::iores res, rhm::journal::jcntl* jc,
-            unsigned& aio_sleep_cnt, rhm::journal::data_tok* dtp);
-    static std::string& create_msg(std::string& s, int msg_num, int len);
-    static std::string& create_xid(std::string& s, int msg_num, int len);
-    void cleanMessage();
-};
-
-// Make this test suite a plugin.
-CPPUNIT_PLUGIN_IMPLEMENT();
-CPPUNIT_TEST_SUITE_REGISTRATION(JournalSystemTests);
-
-#endif

Modified: store/trunk/cpp/tests/jrnl/Makefile.am
===================================================================
--- store/trunk/cpp/tests/jrnl/Makefile.am	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/Makefile.am	2008-02-28 17:03:42 UTC (rev 1734)
@@ -37,12 +37,11 @@
   _ut_enq_map \
   _ut_txn_map \
   _st_basic \
+  _st_basic_txn \
+  _st_read \
+  _st_read_txn \
   run-journal-tests
 
-check_LTLIBRARIES = \
-  JournalSystemTests.la     \
-  libdlclose_noop.la
-
 check_PROGRAMS = \
   _ut_time_ns \
   _ut_jexception \
@@ -52,7 +51,10 @@
   _ut_jdir \
   _ut_enq_map \
   _ut_txn_map \
-  _st_basic
+  _st_basic \
+  _st_basic_txn \
+  _st_read \
+  _st_read_txn
 
 UNIT_TEST_SRCS = ../unit_test.cpp
 UNIT_TEST_LDADD = -lboost_unit_test_framework -lbdbstore -L../../lib/.libs 
@@ -81,18 +83,18 @@
 _ut_txn_map_SOURCES = _ut_txn_map.cpp $(UNIT_TEST_SRCS)
 _ut_txn_map_LDADD = $(UNIT_TEST_LDADD) -lrt
 
-_st_basic_SOURCES = _st_basic.cpp $(UNIT_TEST_SRCS)
+_st_basic_SOURCES = _st_basic.cpp _st_helper_fns.hpp $(UNIT_TEST_SRCS)
 _st_basic_LDADD = $(UNIT_TEST_LDADD) -lrt
 
-JournalSystemTests_la_SOURCES = \
-  JournalSystemTests.cpp   \
-  JournalSystemTests.hpp
-JournalSystemTests_la_LDFLAGS = -lpthread -module -rpath $(abs_builddir)
-JournalSystemTests_la_LIBADD = ../../lib/libbdbstore.la $(CPPUNIT_LIBS)
+_st_basic_txn_SOURCES = _st_basic_txn.cpp _st_helper_fns.hpp $(UNIT_TEST_SRCS)
+_st_basic_txn_LDADD = $(UNIT_TEST_LDADD) -lrt
 
-libdlclose_noop_la_SOURCES = ../dlclose_noop.c
-libdlclose_noop_la_LDFLAGS = -module -rpath $(abs_builddir)
+_st_read_SOURCES = _st_read.cpp _st_helper_fns.hpp $(UNIT_TEST_SRCS)
+_st_read_LDADD = $(UNIT_TEST_LDADD) -lrt
 
+_st_read_txn_SOURCES = _st_read_txn.cpp _st_helper_fns.hpp $(UNIT_TEST_SRCS)
+_st_read_txn_LDADD = $(UNIT_TEST_LDADD) -lrt
+
 EXTRA_DIST = \
   run-journal-tests \
   rtest \

Modified: store/trunk/cpp/tests/jrnl/_st_basic.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_basic.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/_st_basic.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -1,6 +1,4 @@
 /**
-* \file _st_basic.cpp
-*
 * Red Hat Messaging - Message Journal
 *
 * This file contains the unit tests for the journal.
@@ -31,81 +29,427 @@
 #include <jrnl/jcntl.hpp>
 #include <jrnl/jerrno.hpp>
 #include <jrnl/jexception.hpp>
+#include <jrnl/jcfg.hpp>
 
 #include <iostream>
+#include <cmath>
 
-#define NUM_JFILES 4
-#define JFSIZE_SBLKS 96
-#define JRNL_DIR "/tmp/jdata"
-#define MAX_AIO_SLEEPS 500
-#define AIO_SLEEP_TIME 1000
-
 using namespace boost::unit_test;
 using namespace rhm::journal;
 using namespace std;
 
 QPID_AUTO_TEST_SUITE(journal_basic)
 
-// Helper function fwd decls
-u_int64_t enq_msg(jcntl& jc, const string msg, const bool transient);
-void deq_msg(jcntl& jc, const u_int64_t drid);
-bool handle_jcntl_response(const iores res, jcntl& jc, unsigned& aio_sleep_cnt);
+const string file("_st_basic");
 
+#include "_st_helper_fns.hpp"
 
-BOOST_AUTO_TEST_CASE(double_dequeue)
+// === Test suite ===
+
+BOOST_AUTO_TEST_CASE(instantiation)
 {
-    char* test_name = "DoubleDequeue";
-    jcntl jc(test_name, JRNL_DIR, test_name, NUM_JFILES, JFSIZE_SBLKS);
-    jc.initialize(0, 0);
-    string msg("Message");
-    u_int64_t rid = enq_msg(jc, msg, false);
-    deq_msg(jc, rid);
-    try{ deq_msg(jc, rid); BOOST_FAIL("Did not throw exception on second dequeue."); }
-    catch (const jexception& e) { BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_MAP_NOTFOUND); }
-    rid = enq_msg(jc, msg, false);
-    deq_msg(jc, rid);
+    string test_name = get_test_name(file, "instantiation");
+    try
+    {
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        BOOST_CHECK_EQUAL(jc.is_ready(), false);
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
 }
 
+BOOST_AUTO_TEST_CASE(initialization)
+{
+    string test_name = get_test_name(file, "initialization");
+    try
+    {
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        BOOST_CHECK_EQUAL(jc.is_ready(), false);
+        jrnl_init(jc);
+        BOOST_CHECK_EQUAL(jc.is_ready(), true);
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
 
-// Helper functions
+BOOST_AUTO_TEST_CASE(enqueue_dequeue_block)
+{
+    string test_name = get_test_name(file, "enqueue_dequeue_block");
+    try
+    {
+        string msg;
 
-u_int64_t enq_msg(jcntl& jc, const string msg, const bool transient)
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        for (int m=0; m<NUM_MSGS; m++)
+            BOOST_CHECK_EQUAL(enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false), u_int64_t(m));
+        for (int m=0; m<NUM_MSGS; m++)
+            deq_msg(jc, m);
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_dequeue_interleaved)
 {
-    data_tok* dtp = new data_tok;
-    unsigned aio_sleep_cnt = 0;
-    while (handle_jcntl_response(jc.enqueue_data_record(msg.c_str(), msg.size(), msg.size(),
-            dtp, transient), jc, aio_sleep_cnt));
-    return dtp->rid();
+    string test_name = get_test_name(file, "enqueue_dequeue_interleaved");
+    try
+    {
+        string msg;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        for (int m=0; m<2*NUM_MSGS; m+=2)
+        {
+            BOOST_CHECK_EQUAL(enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false), u_int64_t(m));
+            deq_msg(jc, m);
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
 }
 
-void deq_msg(jcntl& jc, const u_int64_t drid)
+BOOST_AUTO_TEST_CASE(enqueue_dequeue_interleaved_file_rollover)
 {
-    data_tok* dtp = new data_tok;
-    dtp->set_wstate(data_tok::ENQ);
-    dtp->set_rid(drid);
-    unsigned aio_sleep_cnt = 0;
-    while (handle_jcntl_response(jc.dequeue_data_record(dtp), jc, aio_sleep_cnt));
+    string test_name = get_test_name(file, "enqueue_dequeue_interleaved_file_rollover");
+    try
+    {
+        string msg;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        unsigned n = num_msgs_to_full(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS * JRNL_SBLK_SIZE,
+                MSG_REC_SIZE_DBLKS);
+        for (unsigned m=0; m<3*2*n; m+=2) // overwrite files 3 times
+        {
+            enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+            deq_msg(jc, m);
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
 }
 
-bool handle_jcntl_response(const iores res, jcntl& jc, unsigned& aio_sleep_cnt)
+BOOST_AUTO_TEST_CASE(empty_recover)
 {
-    switch (res)
+    string test_name = get_test_name(file, "empty_recover");
+    try
     {
-        case RHM_IORES_SUCCESS:
-            return false;
-        case RHM_IORES_AIO_WAIT:
-            if (++aio_sleep_cnt <= MAX_AIO_SLEEPS)
+        {
+            jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+            BOOST_CHECK_EQUAL(jc.is_ready(), false);
+            BOOST_CHECK_EQUAL(jc.is_read_only(), false);
+            jrnl_init(jc);
+            BOOST_CHECK_EQUAL(jc.is_ready(), true);
+            BOOST_CHECK_EQUAL(jc.is_read_only(), false);
+        }
+        {
+            vector<string> txn_list;
+            u_int64_t hrid;
+
+            jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+            BOOST_CHECK_EQUAL(jc.is_ready(), false);
+            BOOST_CHECK_EQUAL(jc.is_read_only(), false);
+            jrnl_recover(jc, txn_list, hrid);
+            BOOST_CHECK_EQUAL(jc.is_ready(), true);
+            BOOST_CHECK_EQUAL(jc.is_read_only(), true);
+            BOOST_CHECK_EQUAL(hrid, u_int64_t(0));
+        }
+        {
+            vector<string> txn_list;
+            u_int64_t hrid;
+
+            jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+            BOOST_CHECK_EQUAL(jc.is_ready(), false);
+            BOOST_CHECK_EQUAL(jc.is_read_only(), false);
+            jrnl_recover(jc, txn_list, hrid);
+            BOOST_CHECK_EQUAL(jc.is_ready(), true);
+            BOOST_CHECK_EQUAL(jc.is_read_only(), true);
+            BOOST_CHECK_EQUAL(hrid, u_int64_t(0));
+            jc.recover_complete();
+            BOOST_CHECK_EQUAL(jc.is_ready(), true);
+            BOOST_CHECK_EQUAL(jc.is_read_only(), false);
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_recover_dequeue_block)
+{
+    string test_name = get_test_name(file, "enqueue_recover_dequeue_block");
+    try
+    {
+        {
+            string msg;
+
+            jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+            jrnl_init(jc);
+            for (int m=0; m<NUM_MSGS; m++)
+                enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+        }
+        {
+            vector<string> txn_list;
+            u_int64_t hrid;
+
+            jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+            jrnl_recover(jc, txn_list, hrid);
+            BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
+            jc.recover_complete();
+            for (int m=0; m<NUM_MSGS; m++)
+                deq_msg(jc, m);
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_recover_dequeue_interleaved)
+{
+    string test_name = get_test_name(file, "enqueue_recover_dequeue_interleaved");
+    try
+    {
+        string msg;
+        vector<string> txn_list;
+        u_int64_t hrid;
+
+        for (int m=0; m<2*NUM_MSGS; m+=2)
+        {
             {
-                jc.get_wr_events();
-                usleep(AIO_SLEEP_TIME);
+                jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+                if (m == 0)
+                    jrnl_init(jc); // First time only
+                else
+                {
+                    jrnl_recover(jc, txn_list, hrid);
+                    BOOST_CHECK_EQUAL(hrid, u_int64_t(m - 1));
+                    jc.recover_complete();
+                }
+                enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
             }
-            else
-                BOOST_FAIL(iores_str(res));
-            break;
-        default:
-            BOOST_FAIL(iores_str(res));
+            {
+                jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+                jrnl_recover(jc, txn_list, hrid);
+                BOOST_CHECK_EQUAL(hrid, u_int64_t(m));
+                jc.recover_complete();
+                deq_msg(jc, m);
+            }
+        }
     }
-    return true;
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
 }
+
+BOOST_AUTO_TEST_CASE(header_flags)
+{
+    string test_name = get_test_name(file, "header_flags");
+    try
+    {
+        {
+            string msg;
+
+            jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+            jrnl_init(jc);
+            // Transient msgs - should not recover
+            for (int m=0; m<NUM_MSGS; m++)
+                enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), true);
+            // Persistent msgs
+            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
+                enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+            // Transient extern msgs - should not recover
+            for (int m=NUM_MSGS*2; m<NUM_MSGS*3; m++)
+                enq_extern_msg(jc, m, MSG_SIZE, true);
+            // Persistnet extern msgs
+            for (int m=NUM_MSGS*3; m<NUM_MSGS*4; m++)
+                enq_extern_msg(jc, m, MSG_SIZE, false);
+        }
+        {
+            string msg;
+            vector<string> txn_list;
+            u_int64_t hrid;
+
+            jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+            jrnl_recover(jc, txn_list, hrid);
+            // Recover non-transient msgs
+            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
+            {
+                string rmsg;
+                string xid;
+                bool transientFlag;
+                bool externalFlag;
+
+                read_msg(jc, rmsg, xid, transientFlag, externalFlag);
+                BOOST_CHECK_MESSAGE(transientFlag == false, "Transient message recovered.");
+                BOOST_CHECK_MESSAGE(externalFlag == false, "External flag incorrect.");
+                BOOST_CHECK_MESSAGE(create_msg(msg, m, MSG_SIZE).compare(rmsg) == 0,
+                        "Non-transient message corrupt during recover.");
+            }
+            // Recover non-transient extern msgs
+            for (int m=NUM_MSGS*3; m<NUM_MSGS*4; m++)
+            {
+                string rmsg;
+                string xid;
+                bool transientFlag;
+                bool externalFlag;
+
+                read_msg(jc, rmsg, xid, transientFlag, externalFlag);
+                BOOST_CHECK_MESSAGE(transientFlag == false, "Transient message recovered.");
+                BOOST_CHECK_MESSAGE(externalFlag == true, "External flag incorrect.");
+                BOOST_CHECK_MESSAGE(rmsg.size() == 0, "External message returned non-zero size.");
+            }
+            jc.recover_complete();
+            // Read recovered non-transient msgs
+            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
+            {
+                string rmsg;
+                string xid;
+                bool transientFlag;
+                bool externalFlag;
+
+                read_msg(jc, rmsg, xid, transientFlag, externalFlag);
+                BOOST_CHECK_MESSAGE(transientFlag == false, "Transient message recovered.");
+                BOOST_CHECK_MESSAGE(externalFlag == false, "External flag incorrect.");
+                BOOST_CHECK_MESSAGE(create_msg(msg, m, MSG_SIZE).compare(rmsg) == 0,
+                        "Non-transient message corrupt during recover.");
+            }
+            // Read recovered non-transient extern msgs
+            for (int m=NUM_MSGS*3; m<NUM_MSGS*4; m++)
+            {
+                string rmsg;
+                string xid;
+                bool transientFlag;
+                bool externalFlag;
+
+                read_msg(jc, rmsg, xid, transientFlag, externalFlag);
+                BOOST_CHECK_MESSAGE(transientFlag == false, "Transient message recovered.");
+                BOOST_CHECK_MESSAGE(externalFlag == true, "External flag incorrect.");
+                BOOST_CHECK_MESSAGE(rmsg.size() == 0, "External message returned non-zero size.");
+            }
+            // Dequeue recovered messages
+            for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
+                deq_msg(jc, m);
+            for (int m=NUM_MSGS*3; m<NUM_MSGS*4; m++)
+                deq_msg(jc, m);
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(journal_threshold_block)
+{
+    string test_name = get_test_name(file, "journal_threshold_block");
+    try
+    {
+        string msg;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        unsigned m;
         
+        // Fill journal to just below threshold
+        u_int32_t t = num_msgs_to_threshold(NUM_DEFAULT_JFILES,
+                DEFAULT_JFSIZE_SBLKS * JRNL_SBLK_SIZE, LARGE_MSG_REC_SIZE_DBLKS);
+        for (m=0; m<t; m++)
+            enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), true);
+        // This enqueue should exceed the threshold
+        enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), true, RHM_IORES_ENQCAPTHRESH);
+
+        // Dequeue all msgs
+        for (m=0; m<t; m++)
+            deq_msg(jc, m);
+
+        cout << "[NOTE: Partially disabled until outstanding issue(s) resolved.] ";
+//         // Fill journal to just below threshold
+//         for (m=2*t; m<3*t; m++)
+//             enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), true);
+//         // This enqueue should exceed the threshold
+//         enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), true, RHM_IORES_ENQCAPTHRESH);
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(journal_threshold_interleaved)
+{
+    string test_name = get_test_name(file, "journal_threshold_interleaved");
+    try
+    {
+        string msg;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        unsigned m;
+        
+        // Fill journal to just below threshold
+        u_int32_t t = num_msgs_to_threshold(NUM_DEFAULT_JFILES,
+                DEFAULT_JFSIZE_SBLKS * JRNL_SBLK_SIZE, LARGE_MSG_REC_SIZE_DBLKS);
+        for (m=0; m<t; m++)
+            enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), true);
+        // This enqueue should exceed the threshold
+        enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), true, RHM_IORES_ENQCAPTHRESH);
+
+        cout << "[NOTE: Partially disabled until outstanding issue(s) resolved.] ";
+        // Interleave dequeues and enqueues
+//         for (m=0; m<t; m++)
+//         {
+//             u_int64_t msg_num = deq_msg(jc, m) + 1;
+//             enq_msg(jc, msg_num, create_msg(msg, msg_num, LARGE_MSG_SIZE), true);
+//             enq_msg(jc, msg_num + 1, create_msg(msg, msg_num + 1, LARGE_MSG_SIZE), true,
+//                     RHM_IORES_ENQCAPTHRESH);
+//         }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(journal_overflow)
+{
+    string test_name = get_test_name(file, "journal_overflow");
+    try
+    {
+        string msg;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        unsigned m;
+        
+        // Fill journal to just below threshold
+        cout << "[NOTE: Partially disabled until outstanding issue(s) resolved.] ";
+        u_int32_t t = 10;
+//         u_int32_t t = num_msgs_to_threshold(NUM_DEFAULT_JFILES,
+//                 DEFAULT_JFSIZE_SBLKS * JRNL_SBLK_SIZE, MSG_REC_SIZE_DBLKS);
+        for (m=0; m<t; m++)
+            enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), true);
+        // This enqueue should exceed the threshold
+//         enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), true, RHM_IORES_ENQCAPTHRESH);
+
+        // Dequeue all msgs except first
+        for (m=1; m<t; m++)
+            deq_msg(jc, m);
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(double_dequeue)
+{
+    string test_name = get_test_name(file, "double_dequeue");
+    try
+    {
+        string msg;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        u_int64_t rid = enq_msg(jc, 0, create_msg(msg, 0, MSG_SIZE), false);
+        deq_msg(jc, rid);
+        try{ deq_msg(jc, rid); BOOST_ERROR("Did not throw exception on second dequeue."); }
+        catch (const jexception& e){ BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_MAP_NOTFOUND); }
+        rid = enq_msg(jc, 1, create_msg(msg, 1, MSG_SIZE), false);
+        deq_msg(jc, rid);
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
 QPID_AUTO_TEST_SUITE_END()

Added: store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp	                        (rev 0)
+++ store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -0,0 +1,241 @@
+/**
+* Red Hat Messaging - Message Journal
+*
+* This file contains the unit tests for the journal.
+*
+* Copyright 2007, 2008 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.
+*/
+
+#include "../unit_test.h"
+#include <jrnl/jcntl.hpp>
+#include <jrnl/jerrno.hpp>
+#include <jrnl/jexception.hpp>
+#include <jrnl/jcfg.hpp>
+
+#include <iostream>
+#include <cmath>
+
+using namespace boost::unit_test;
+using namespace rhm::journal;
+using namespace std;
+
+QPID_AUTO_TEST_SUITE(journal_basic_txn)
+
+const string file("_st_basic_txn");
+
+#include "_st_helper_fns.hpp"
+
+// === Test suite ===
+
+BOOST_AUTO_TEST_CASE(enqueue_commit_dequeue_block)
+{
+    string test_name = get_test_name(file, "enqueue_commit_dequeue_block");
+    try
+    {
+        string msg;
+        string xid;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        create_xid(xid, 0, XID_SIZE);
+        for (int m=0; m<NUM_MSGS; m++)
+            BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false),
+                    u_int64_t(m));
+        txn_commit(jc, xid);
+        for (int m=0; m<NUM_MSGS; m++)
+            deq_msg(jc, m);
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_abort_dequeue_block)
+{
+    string test_name = get_test_name(file, "enqueue_abort_dequeue_block");
+    try
+    {
+        string msg;
+        string xid;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        create_xid(xid, 0, XID_SIZE);
+        for (int m=0; m<NUM_MSGS; m++)
+            BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false),
+                    u_int64_t(m));
+        txn_abort(jc, xid);
+        for (int m=0; m<NUM_MSGS; m++)
+        {
+            try
+            {
+                deq_msg(jc, m);
+                BOOST_ERROR("Expected dequeue to fail with exception JERR_MAP_NOTFOUND.");
+            }
+            catch (const jexception& e) { if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw; }
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_commit_dequeue_interleaved)
+{
+    string test_name = get_test_name(file, "enqueue_commit_dequeue_interleaved");
+    try
+    {
+        string msg;
+        string xid;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        for (int m=0; m<NUM_MSGS; m++)
+        {
+            create_xid(xid, m, XID_SIZE);
+            BOOST_CHECK_EQUAL(enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid, false),
+                    u_int64_t(3*m));
+            txn_commit(jc, xid);
+            deq_msg(jc, 3*m);
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_abort_dequeue_interleaved)
+{
+    string test_name = get_test_name(file, "enqueue_abort_dequeue_interleaved");
+    try
+    {
+        string msg;
+        string xid;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        for (int m=0; m<NUM_MSGS; m++)
+        {
+            create_xid(xid, m, XID_SIZE);
+            BOOST_CHECK_EQUAL(enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid, false),
+                    u_int64_t(3*m));
+            txn_abort(jc, xid);
+            try
+            {
+                deq_msg(jc, 3*m);
+                BOOST_ERROR("Expected dequeue to fail with exception JERR_MAP_NOTFOUND.");
+            }
+            catch (const jexception& e) { if (e.err_code() != jerrno::JERR_MAP_NOTFOUND) throw; }
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_dequeue_commit_block)
+{
+    string test_name = get_test_name(file, "enqueue_dequeue_commit_block");
+    try
+    {
+        string msg;
+        string xid;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        create_xid(xid, 0, XID_SIZE);
+        for (int m=0; m<NUM_MSGS; m++)
+            BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false),
+                    u_int64_t(m));
+        for (int m=0; m<NUM_MSGS; m++)
+            deq_txn_msg(jc, m, xid);
+        txn_commit(jc, xid);
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_dequeue_abort_block)
+{
+    string test_name = get_test_name(file, "enqueue_dequeue_abort_block");
+    try
+    {
+        string msg;
+        string xid;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        create_xid(xid, 0, XID_SIZE);
+        for (int m=0; m<NUM_MSGS; m++)
+            BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false),
+                    u_int64_t(m));
+        for (int m=0; m<NUM_MSGS; m++)
+            deq_txn_msg(jc, m, xid);
+        txn_abort(jc, xid);
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_dequeue_commit_interleaved)
+{
+    string test_name = get_test_name(file, "enqueue_dequeue_commit_interleaved");
+    try
+    {
+        string msg;
+        string xid;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        for (int m=0; m<NUM_MSGS; m++)
+        {
+            create_xid(xid, m, XID_SIZE);
+            BOOST_CHECK_EQUAL(enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid, false),
+                    u_int64_t(3*m));
+            deq_txn_msg(jc, 3*m, xid);
+            txn_commit(jc, xid);
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_dequeue_abort_interleaved)
+{
+    string test_name = get_test_name(file, "enqueue_dequeue_abort_interleaved");
+    try
+    {
+        string msg;
+        string xid;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        for (int m=0; m<NUM_MSGS; m++)
+        {
+            create_xid(xid, m, XID_SIZE);
+            BOOST_CHECK_EQUAL(enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid, false),
+                    u_int64_t(3*m));
+            deq_txn_msg(jc, 3*m, xid);
+            txn_abort(jc, xid);
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_SUITE_END()

Added: store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp	                        (rev 0)
+++ store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -0,0 +1,273 @@
+/**
+* Red Hat Messaging - Message Journal
+*
+* This file contains the unit tests for the journal.
+*
+* Copyright 2007, 2008 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.
+*/
+
+// NOTE: This file is included in _st_*.cpp files inside the QPID_AUTO_TEST_SUITE()
+// definition.
+
+
+#define MAX_AIO_SLEEPS 500
+#define AIO_SLEEP_TIME 1000
+#define JRNL_DIR "/tmp/jdata"
+#define NUM_TEST_JFILES 4
+#define NUM_DEFAULT_JFILES  8
+#define JRNL_DEFAULT_FSIZE  24 // Multiples of JRNL_RMGR_PAGE_SIZE
+#define TEST_JFSIZE_SBLKS 96
+#define DEFAULT_JFSIZE_SBLKS (JRNL_DEFAULT_FSIZE * JRNL_RMGR_PAGE_SIZE)
+#define NUM_MSGS 5
+#define MSG_REC_SIZE_DBLKS 2
+#define MSG_SIZE (MSG_REC_SIZE_DBLKS * JRNL_DBLK_SIZE) - sizeof(enq_hdr) - sizeof(rec_tail)
+#define LARGE_MSG_REC_SIZE_DBLKS (JRNL_SBLK_SIZE * JRNL_RMGR_PAGE_SIZE)
+#define LARGE_MSG_SIZE (LARGE_MSG_REC_SIZE_DBLKS * JRNL_DBLK_SIZE) - sizeof(enq_hdr) - sizeof(rec_tail)
+#define XID_SIZE 64
+
+
+#define XLARGE_MSG_RATIO (1.0 * LARGE_MSG_REC_SIZE / JRNL_DBLK_SIZE / JRNL_SBLK_SIZE / JRNL_RMGR_PAGE_SIZE)
+#define XLARGE_MSG_THRESHOLD (int)(JRNL_DEFAULT_FSIZE * NUM_DEFAULT_JFILES * JRNL_ENQ_THRESHOLD / 100 / LARGE_MSG_RATIO)
+
+const string
+get_test_name(const string& file, const string& test_name)
+{
+    cout << file << "." << test_name << ": " << flush;
+    return file + "." + test_name;
+}
+
+const bool
+check_iores(const string& ctxt, const iores ret, const iores exp_ret)
+{
+    if (ret != exp_ret)
+        BOOST_FAIL(ctxt << ": Expected " << iores_str(exp_ret) << "; got " << iores_str(ret));
+    return false;
+}
+
+const bool
+handle_jcntl_response(const iores res, jcntl& jc, unsigned& aio_sleep_cnt, const std::string& ctxt,
+        const iores exp_ret)
+{
+    if (res == RHM_IORES_AIO_WAIT)
+    {
+        if (++aio_sleep_cnt <= MAX_AIO_SLEEPS)
+        {
+            jc.get_wr_events();
+            usleep(AIO_SLEEP_TIME);
+        }
+        else
+            return check_iores(ctxt, res, exp_ret);
+    }
+    else
+        return check_iores(ctxt, res, exp_ret);
+    return true;
+}
+
+void
+jrnl_init(jcntl& jc)
+{
+    jc.initialize(0, 0);
+}
+
+void
+jrnl_recover(jcntl& jc, vector<string>& txn_list, u_int64_t& highest_rid)
+{
+    jc.recover(0, 0, txn_list, highest_rid);
+}
+
+const u_int64_t
+enq_msg(jcntl& jc, const u_int64_t rid, const string& msg, const bool transient,
+        const iores exp_ret = RHM_IORES_SUCCESS)
+{
+    ostringstream ctxt;
+    ctxt << "enq_msg(" << rid << ")";
+    data_tok* dtp = new data_tok;
+    BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+    unsigned aio_sleep_cnt = 0;
+    while (handle_jcntl_response(jc.enqueue_data_record(msg.c_str(), msg.size(), msg.size(),
+            dtp, transient), jc, aio_sleep_cnt, ctxt.str(), exp_ret));
+    return dtp->rid();
+}
+
+const u_int64_t
+enq_extern_msg(jcntl& jc, const u_int64_t rid, const size_t msg_size, const bool transient,
+        const iores exp_ret = RHM_IORES_SUCCESS)
+{
+    ostringstream ctxt;
+    ctxt << "enq_extern_msg(" << rid << ")";
+    data_tok* dtp = new data_tok;
+    BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+    unsigned aio_sleep_cnt = 0;
+    while (handle_jcntl_response(jc.enqueue_extern_data_record(msg_size, dtp, transient), jc,
+            aio_sleep_cnt, ctxt.str(), exp_ret));
+    return dtp->rid();
+}
+
+const u_int64_t
+enq_txn_msg(jcntl& jc, const u_int64_t rid, const string& msg, const string& xid,
+        const bool transient, const iores exp_ret = RHM_IORES_SUCCESS)
+{
+    ostringstream ctxt;
+    ctxt << "enq_txn_msg(" << rid << ")";
+    data_tok* dtp = new data_tok;
+    BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+    unsigned aio_sleep_cnt = 0;
+    while (handle_jcntl_response(jc.enqueue_txn_data_record(msg.c_str(), msg.size(), msg.size(),
+            dtp, xid, transient), jc, aio_sleep_cnt, ctxt.str(), exp_ret));
+    return dtp->rid();
+}
+
+const u_int64_t
+enq_extern_txn_msg(jcntl& jc, const u_int64_t rid, const size_t msg_size, const string& xid,
+        const bool transient, const iores exp_ret = RHM_IORES_SUCCESS)
+{
+    ostringstream ctxt;
+    ctxt << "enq_extern_txn_msg(" << rid << ")";
+    data_tok* dtp = new data_tok;
+    BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+    unsigned aio_sleep_cnt = 0;
+    while (handle_jcntl_response(jc.enqueue_extern_txn_data_record(msg_size, dtp, xid, transient),
+            jc, aio_sleep_cnt, ctxt.str(), exp_ret));
+    return dtp->rid();
+}
+
+const u_int64_t
+deq_msg(jcntl& jc, const u_int64_t drid, const iores exp_ret = RHM_IORES_SUCCESS)
+{
+    ostringstream ctxt;
+    ctxt << "deq_msg(" << drid << ")";
+    data_tok* dtp = new data_tok;
+    BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+    dtp->set_wstate(data_tok::ENQ);
+    dtp->set_rid(drid);
+    unsigned aio_sleep_cnt = 0;
+    while (handle_jcntl_response(jc.dequeue_data_record(dtp), jc, aio_sleep_cnt, ctxt.str(),
+            exp_ret));
+    return dtp->rid();
+}
+
+const u_int64_t
+deq_txn_msg(jcntl& jc, const u_int64_t drid, const string& xid,
+        const iores exp_ret = RHM_IORES_SUCCESS)
+{
+    ostringstream ctxt;
+    ctxt << "deq_txn_msg(" << drid << ")";
+    data_tok* dtp = new data_tok;
+    BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+    dtp->set_wstate(data_tok::ENQ);
+    dtp->set_rid(drid);
+    unsigned aio_sleep_cnt = 0;
+    while (handle_jcntl_response(jc.dequeue_txn_data_record(dtp, xid), jc, aio_sleep_cnt,
+            ctxt.str(), exp_ret));
+    return dtp->rid();
+}
+
+const u_int64_t
+txn_abort(jcntl& jc, const string& xid, const iores exp_ret = RHM_IORES_SUCCESS)
+{
+    data_tok* dtp = new data_tok;
+    BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+
+    unsigned aio_sleep_cnt = 0;
+    while (handle_jcntl_response(jc.txn_abort(dtp, xid), jc, aio_sleep_cnt, "txn_abort", exp_ret));
+    return dtp->rid();
+}
+
+const u_int64_t
+txn_commit(jcntl& jc, const string& xid, const iores exp_ret = RHM_IORES_SUCCESS)
+{
+    data_tok* dtp = new data_tok;
+    BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+
+    unsigned aio_sleep_cnt = 0;
+    while (handle_jcntl_response(jc.txn_commit(dtp, xid), jc, aio_sleep_cnt, "txn_commit",
+            exp_ret));
+    return dtp->rid();
+}
+
+void
+read_msg(jcntl& jc, string& msg, string& xid, bool& transient, bool& external,
+        const iores exp_ret = RHM_IORES_SUCCESS)
+{
+    void* mp = 0;
+    size_t msize = 0;
+    void* xp = 0;
+    size_t xsize = 0;
+    data_tok* dtp = new data_tok;
+    BOOST_CHECK_MESSAGE(dtp != 0, "Data token allocation failed (dtp == 0).");
+    dtp->set_wstate(data_tok::ENQ);
+
+    unsigned aio_sleep_cnt = 0;
+    while (handle_jcntl_response(jc.read_data_record(&mp, msize, &xp, xsize, transient, external,
+            dtp), jc, aio_sleep_cnt, "read_msg", exp_ret));
+    if (mp)
+        msg.assign((char*)mp, msize);
+    if (xp)
+    {
+        xid.assign((char*)xp, xsize);
+        ::free(xp);
+        xp = 0;
+    }
+    else if (mp)
+    {
+        ::free(mp);
+        mp = 0;
+    }
+        
+}
+
+const u_int32_t
+num_msgs_to_full(const u_int16_t num_files, const u_int32_t file_size_sblks,
+        const u_int32_t msg_rec_size_dblks)
+{
+   return u_int32_t(::floor(1.0 * num_files * file_size_sblks / msg_rec_size_dblks));
+}
+
+const u_int32_t
+num_msgs_to_threshold(const u_int16_t num_files, const u_int32_t file_size_sblks,
+        const u_int32_t msg_rec_size_dblks)
+{
+   return u_int32_t(::floor(1.0 * num_files * file_size_sblks * JRNL_ENQ_THRESHOLD /
+           msg_rec_size_dblks / 100));
+}
+
+const string&
+create_msg(string& s, const int msg_num, const int len)
+{
+    ostringstream oss;
+    oss << "Message_" << setfill('0') << setw(4) << msg_num << "_";
+    for (int i=14; i<=len; i++)
+        oss << (char)('0' + i%10);
+    s.assign(oss.str());
+    return s;
+}
+
+const string&
+create_xid(string& s, const int msg_num, const int len)
+{
+    ostringstream oss;
+    oss << "XID_" << setfill('0') << setw(4) << msg_num << "_";
+    for (int i=9; i<len; i++)
+        oss << (char)('a' + i%26);
+    s.assign(oss.str());
+    return s;
+}

Added: store/trunk/cpp/tests/jrnl/_st_read.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_read.cpp	                        (rev 0)
+++ store/trunk/cpp/tests/jrnl/_st_read.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -0,0 +1,288 @@
+/**
+* Red Hat Messaging - Message Journal
+*
+* This file contains the unit tests for the journal.
+*
+* Copyright 2007, 2008 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.
+*/
+
+#include "../unit_test.h"
+#include <jrnl/jcntl.hpp>
+#include <jrnl/jerrno.hpp>
+#include <jrnl/jexception.hpp>
+#include <jrnl/jcfg.hpp>
+
+#include <iostream>
+#include <cmath>
+
+using namespace boost::unit_test;
+using namespace rhm::journal;
+using namespace std;
+
+QPID_AUTO_TEST_SUITE(journal_read)
+
+const string file("_st_read");
+
+#include "_st_helper_fns.hpp"
+
+// === Test suite ===
+
+BOOST_AUTO_TEST_CASE(enqueue_read_dequeue_block)
+{
+    string test_name = get_test_name(file, "enqueue_read_dequeue_block");
+    try
+    {
+        string msg;
+        string rmsg;
+        string xid;
+        bool transientFlag;
+        bool externalFlag;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        for (int m=0; m<NUM_MSGS; m++)
+            enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+        jc.flush();
+        for (int m=0; m<NUM_MSGS; m++)
+        {
+            read_msg(jc, rmsg, xid, transientFlag, externalFlag);
+            BOOST_CHECK_EQUAL(create_msg(msg, m, MSG_SIZE), rmsg);
+            BOOST_CHECK_EQUAL(xid.size(), size_t(0));
+            BOOST_CHECK_EQUAL(transientFlag, false);
+            BOOST_CHECK_EQUAL(externalFlag, false);
+        }
+        read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+        for (int m=0; m<NUM_MSGS; m++)
+            deq_msg(jc, m);
+        read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_read_dequeue_interleaved)
+{
+    string test_name = get_test_name(file, "enqueue_read_dequeue_interleaved");
+    try
+    {
+        string msg;
+        string rmsg;
+        string xid;
+        bool transientFlag;
+        bool externalFlag;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        for (int m=0; m<2*NUM_MSGS; m+=2)
+        {
+            enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+            jc.flush();
+            read_msg(jc, rmsg, xid, transientFlag, externalFlag);
+            BOOST_CHECK_EQUAL(create_msg(msg, m, MSG_SIZE), rmsg);
+            BOOST_CHECK_EQUAL(xid.size(), size_t(0));
+            BOOST_CHECK_EQUAL(transientFlag, false);
+            BOOST_CHECK_EQUAL(externalFlag, false);
+            deq_msg(jc, m);
+            jc.flush();
+            read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_recovered_read_dequeue)
+{
+    string test_name = get_test_name(file, "enqueue_recovered_read_dequeue");
+    try
+    {
+        {
+            string msg;
+
+            jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+            jrnl_init(jc);
+            for (int m=0; m<NUM_MSGS; m++)
+                enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+        }
+        {
+            string msg;
+            vector<string> txn_list;
+            u_int64_t hrid;
+            string rmsg;
+            string xid;
+            bool transientFlag;
+            bool externalFlag;
+
+            jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+            jrnl_recover(jc, txn_list, hrid);
+            BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
+            jc.recover_complete();
+            for (int m=0; m<NUM_MSGS; m++)
+            {
+                read_msg(jc, rmsg, xid, transientFlag, externalFlag);
+                BOOST_CHECK_EQUAL(create_msg(msg, m, MSG_SIZE), rmsg);
+                BOOST_CHECK_EQUAL(xid.size(), size_t(0));
+                BOOST_CHECK_EQUAL(transientFlag, false);
+                BOOST_CHECK_EQUAL(externalFlag, false);
+            }
+            read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+            for (int m=0; m<NUM_MSGS; m++)
+                deq_msg(jc, m);
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_recover_read_recovered_read_dequeue)
+{
+    string test_name = get_test_name(file, "enqueue_recover_read_recovered_read_dequeue");
+    try
+    {
+        {
+            string msg;
+            
+            jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+            jrnl_init(jc);
+            for (int m=0; m<NUM_MSGS; m++)
+                enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+        }
+        {
+            string msg;
+            vector<string> txn_list;
+            u_int64_t hrid;
+            string rmsg;
+            string xid;
+            bool transientFlag;
+            bool externalFlag;
+
+            jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+            jrnl_recover(jc, txn_list, hrid);
+            BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
+            for (int m=0; m<NUM_MSGS; m++)
+            {
+                read_msg(jc, rmsg, xid, transientFlag, externalFlag);
+                BOOST_CHECK_EQUAL(create_msg(msg, m, MSG_SIZE), rmsg);
+                BOOST_CHECK_EQUAL(xid.size(), size_t(0));
+                BOOST_CHECK_EQUAL(transientFlag, false);
+                BOOST_CHECK_EQUAL(externalFlag, false);
+            }
+            read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+        }
+        {
+            string msg;
+            vector<string> txn_list;
+            u_int64_t hrid;
+            string rmsg;
+            string xid;
+            bool transientFlag;
+            bool externalFlag;
+
+            jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+            jrnl_recover(jc, txn_list, hrid);
+            BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
+            for (int m=0; m<NUM_MSGS; m++)
+            {
+                read_msg(jc, rmsg, xid, transientFlag, externalFlag);
+                BOOST_CHECK_EQUAL(create_msg(msg, m, MSG_SIZE), rmsg);
+                BOOST_CHECK_EQUAL(xid.size(), size_t(0));
+                BOOST_CHECK_EQUAL(transientFlag, false);
+                BOOST_CHECK_EQUAL(externalFlag, false);
+            }
+            read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+            jc.recover_complete();
+            for (int m=0; m<NUM_MSGS; m++)
+            {
+                read_msg(jc, rmsg, xid, transientFlag, externalFlag);
+                BOOST_CHECK_EQUAL(create_msg(msg, m, MSG_SIZE), rmsg);
+                BOOST_CHECK_EQUAL(xid.size(), size_t(0));
+                BOOST_CHECK_EQUAL(transientFlag, false);
+                BOOST_CHECK_EQUAL(externalFlag, false);
+            }
+            read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+            for (int m=0; m<NUM_MSGS; m++)
+                deq_msg(jc, m);
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(delayed_read)
+{
+    string test_name = get_test_name(file, "delayed_read");
+    try
+    {
+        cout << "[NOTE: Disabled until outstanding issue(s) resolved.] ";
+//         string msg;
+//         string rmsg;
+//         string xid;
+//         bool transientFlag;
+//         bool externalFlag;
+// 
+//         jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+//         jrnl_init(jc);
+//         unsigned m;
+//         for (m=0; m<2*NUM_MSGS; m+=2)
+//         {
+//             enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+//             deq_msg(jc, m);
+//         }
+//         enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+//         read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+//         BOOST_CHECK_EQUAL(msg, rmsg);
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(cache_cycled_delayed_read)
+{
+    string test_name = get_test_name(file, "cache_cycled_delayed_read");
+    try
+    {
+        cout << "[NOTE: Disabled until outstanding issue(s) resolved.] ";
+//         string msg;
+//         string rmsg;
+//         string xid;
+//         bool transientFlag;
+//         bool externalFlag;
+// 
+//         jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+//         jrnl_init(jc);
+//         unsigned m;
+//         unsigned n = num_msgs_to_full(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS * JRNL_SBLK_SIZE,
+//                 MSG_REC_SIZE_DBLKS);
+//         for (m=0; m<12*2*n; m+=2) // 12 file cycles
+//         {
+//             enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+//             deq_msg(jc, m);
+//         }
+//         enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
+//         read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+//         BOOST_CHECK_EQUAL(msg, rmsg);
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_SUITE_END()

Added: store/trunk/cpp/tests/jrnl/_st_read_txn.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_read_txn.cpp	                        (rev 0)
+++ store/trunk/cpp/tests/jrnl/_st_read_txn.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -0,0 +1,229 @@
+/**
+* Red Hat Messaging - Message Journal
+*
+* This file contains the unit tests for the journal.
+*
+* Copyright 2007, 2008 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.
+*/
+
+#include "../unit_test.h"
+#include <jrnl/jcntl.hpp>
+#include <jrnl/jerrno.hpp>
+#include <jrnl/jexception.hpp>
+#include <jrnl/jcfg.hpp>
+
+#include <iostream>
+#include <cmath>
+
+using namespace boost::unit_test;
+using namespace rhm::journal;
+using namespace std;
+
+QPID_AUTO_TEST_SUITE(journal_read_txn)
+
+const string file("_st_read_txn");
+
+#include "_st_helper_fns.hpp"
+
+// === Test suite ===
+
+BOOST_AUTO_TEST_CASE(enqueue_commit_block)
+{
+    string test_name = get_test_name(file, "enqueue_commit_block");
+    try
+    {
+        string msg;
+        string xid;
+        string rmsg;
+        string rxid;
+        bool transientFlag;
+        bool externalFlag;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        create_xid(xid, 0, XID_SIZE);
+        for (int m=0; m<NUM_MSGS; m++)
+            enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false);
+        jc.flush();
+        read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+        txn_commit(jc, xid);
+        jc.flush();
+        cout << "[NOTE: Partially disabled until outstanding issue(s) resolved.] ";
+//         for (int m=0; m<NUM_MSGS; m++)
+//         {
+//             read_msg(jc, rmsg, rxid, transientFlag, externalFlag);
+//             BOOST_CHECK_EQUAL(create_msg(msg, m, MSG_SIZE), rmsg);
+//             BOOST_CHECK_EQUAL(rxid, xid);
+//             BOOST_CHECK_EQUAL(transientFlag, false);
+//             BOOST_CHECK_EQUAL(externalFlag, false);
+//         }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_commit_dequeue_block)
+{
+    string test_name = get_test_name(file, "enqueue_commit_dequeue_block");
+    try
+    {
+        string msg;
+        string xid;
+        string rmsg;
+        string rxid;
+        bool transientFlag;
+        bool externalFlag;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        create_xid(xid, 0, XID_SIZE);
+        for (int m=0; m<NUM_MSGS; m++)
+            enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false);
+        txn_commit(jc, xid);
+        for (int m=0; m<NUM_MSGS; m++)
+            deq_msg(jc, m);
+        jc.flush();
+        read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_abort_block)
+{
+    string test_name = get_test_name(file, "enqueue_abort_block");
+    try
+    {
+        string msg;
+        string xid;
+        string rmsg;
+        string rxid;
+        bool transientFlag;
+        bool externalFlag;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        create_xid(xid, 0, XID_SIZE);
+        for (int m=0; m<NUM_MSGS; m++)
+            enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false);
+        jc.flush();
+        read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+        txn_abort(jc, xid);
+        jc.flush();
+        read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_commit_interleaved)
+{
+    string test_name = get_test_name(file, "enqueue_commit_interleaved");
+    try
+    {
+        string msg;
+        string xid;
+        string rmsg;
+        string rxid;
+        bool transientFlag;
+        bool externalFlag;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        cout << "[NOTE: Partially disabled until outstanding issue(s) resolved.] ";
+        for (int m=0; m<NUM_MSGS; m++)
+        {
+            create_xid(xid, m, XID_SIZE);
+            enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid, false);
+            jc.flush();
+            read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+            txn_commit(jc, xid);
+//             jc.flush();
+//             read_msg(jc, rmsg, rxid, transientFlag, externalFlag);
+//             BOOST_CHECK_EQUAL(create_msg(msg, m, MSG_SIZE), rmsg);
+//             BOOST_CHECK_EQUAL(rxid, xid);
+//             BOOST_CHECK_EQUAL(transientFlag, false);
+//             BOOST_CHECK_EQUAL(externalFlag, false);
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_commit_dequeue_interleaved)
+{
+    string test_name = get_test_name(file, "enqueue_commit_dequeue_interleaved");
+    try
+    {
+        string msg;
+        string xid;
+        string rmsg;
+        string rxid;
+        bool transientFlag;
+        bool externalFlag;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        for (int m=0; m<NUM_MSGS; m++)
+        {
+            create_xid(xid, m, XID_SIZE);
+            enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid, false);
+            txn_commit(jc, xid);
+            deq_msg(jc, 3*m);
+            jc.flush();
+            read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+BOOST_AUTO_TEST_CASE(enqueue_abort_interleaved)
+{
+    string test_name = get_test_name(file, "enqueue_abort_interleaved");
+    try
+    {
+        string msg;
+        string xid;
+        string rmsg;
+        string rxid;
+        bool transientFlag;
+        bool externalFlag;
+
+        jcntl jc(test_name, JRNL_DIR, test_name, NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+        jrnl_init(jc);
+        for (int m=0; m<NUM_MSGS; m++)
+        {
+            create_xid(xid, m, XID_SIZE);
+            enq_txn_msg(jc, 3*m, create_msg(msg, m, MSG_SIZE), xid, false);
+            jc.flush();
+            read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+            txn_abort(jc, xid);
+            jc.flush();
+            read_msg(jc, rmsg, rxid, transientFlag, externalFlag, RHM_IORES_EMPTY);
+        }
+    }
+    catch(const exception& e) { BOOST_FAIL(e.what()); }
+    cout << "ok" << endl;
+}
+
+QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/_ut_enq_map.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -28,23 +28,30 @@
 */
 
 #include "../unit_test.h"
+#include <iostream>
 #include <jrnl/enq_map.hpp>
 #include <jrnl/jerrno.hpp>
 
 using namespace boost::unit_test;
 using namespace rhm::journal;
+using namespace std;
 
 QPID_AUTO_TEST_SUITE(eng_map_suite)
 
-BOOST_AUTO_TEST_CASE(test_constructor)
+const string file("_ut_enq_map");
+
+BOOST_AUTO_TEST_CASE(constructor)
 {
+    cout << file << ".constructor: " << flush;
     enq_map e1;
     BOOST_CHECK(e1.empty());
     BOOST_CHECK_EQUAL(e1.size(), 0);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_insert_get)
+BOOST_AUTO_TEST_CASE(insert_get)
 {
+    cout << file << ".insert_get: " << flush;
     u_int16_t fid;
     u_int64_t rid;
     u_int16_t fid_start = 0x2000U;
@@ -98,10 +105,12 @@
     e2.clear();
     BOOST_CHECK(e2.empty());
     BOOST_CHECK_EQUAL(e2.size(), 0);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_get_remove)
+BOOST_AUTO_TEST_CASE(get_remove)
 {
+    cout << file << ".get_remove: " << flush;
     u_int16_t fid;
     u_int64_t rid;
     u_int16_t fid_start = 0x3000U;
@@ -132,10 +141,12 @@
         }
     }
     BOOST_CHECK_EQUAL(e3.size(), 85ULL);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_lock)
+BOOST_AUTO_TEST_CASE(lock)
 {
+    cout << file << ".lock: " << flush;
     u_int16_t fid;
     u_int64_t rid;
     u_int16_t fid_start = 0x4000U;
@@ -196,10 +207,12 @@
     for (u_int64_t rid = rid_begin; rid < rid_end; rid += rid_incr_1)
         e4.get_remove_fid(rid, true);
     BOOST_CHECK(e4.empty());
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_lists)
+BOOST_AUTO_TEST_CASE(lists)
 {
+    cout << file << ".lists: " << flush;
     u_int16_t fid;
     u_int64_t rid;
     u_int16_t fid_start = 0x5000UL;
@@ -209,8 +222,8 @@
     // insert, every second entry is locked
     u_int64_t rid_incr_1 = 4ULL;
     u_int64_t num_incr_1 = (rid_end - rid_begin)/rid_incr_1;
-    std::vector<u_int64_t> rid_list;
-    std::vector<u_int16_t> fid_list;
+    vector<u_int64_t> rid_list;
+    vector<u_int16_t> fid_list;
     enq_map e5;
     for (rid = rid_begin, fid = fid_start; rid < rid_end; rid += rid_incr_1, fid++)
     {
@@ -222,17 +235,18 @@
     BOOST_CHECK_EQUAL(rid_list.size(), num_incr_1);
     BOOST_CHECK_EQUAL(fid_list.size(), num_incr_1);
 
-    std::vector<u_int64_t> ret_rid_list;
+    vector<u_int64_t> ret_rid_list;
     e5.rid_list(ret_rid_list);
     BOOST_CHECK_EQUAL(ret_rid_list.size(), num_incr_1);
     for (unsigned i=0; i<ret_rid_list.size(); i++)
         BOOST_CHECK_EQUAL(rid_list[i], ret_rid_list[i]);
 
-    std::vector<u_int16_t> ret_fid_list;
+    vector<u_int16_t> ret_fid_list;
     e5.fid_list(ret_fid_list);
     BOOST_CHECK_EQUAL(ret_fid_list.size(), num_incr_1);
     for (unsigned i=0; i<ret_fid_list.size(); i++)
         BOOST_CHECK_EQUAL(fid_list[i], ret_fid_list[i]);
+    cout << "ok" << endl;
 }
 
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/_ut_jdir.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_jdir.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/_ut_jdir.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -32,6 +32,7 @@
 #include <errno.h>
 #include <fstream>
 #include <iomanip>
+#include <iostream>
 #include <jrnl/file_hdr.hpp>
 #include <jrnl/jcfg.hpp>
 #include <jrnl/jdir.hpp>
@@ -39,8 +40,6 @@
 #include <jrnl/jexception.hpp>
 #include <sys/stat.h>
 
-QPID_AUTO_TEST_SUITE(jdir_suite)
-
 #define NUM_JFILES 4
 #define JFSIZE_SBLKS 128
 
@@ -49,32 +48,151 @@
 
 using namespace boost::unit_test;
 using namespace rhm::journal;
+using namespace std;
 
-// Helper function declarations
-void create_file(const char* filename, mode_t fmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
-void create_jrnl_fileset(const char* dirname, const char* base_filename);
+QPID_AUTO_TEST_SUITE(jdir_suite)
+
+const string file("_ut_jdir");
+
+// === Helper functions ===
+
+void create_file(const char* filename, mode_t fmode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
+{
+    ofstream of(filename, ofstream::out | ofstream::trunc);
+    if (!of.good())
+        BOOST_FAIL("Unable to open file " << filename << " for writing.");
+    of.write(filename, ::strlen(filename));
+    of.close();
+    ::chmod(filename, fmode);
+}
+
 void create_jdat_file(const char* dirname, const char* base_filename, u_int32_t fid,
-        u_int64_t first_rid);
-void create_jinf_file(const char* dirname, const char* base_filename);
+        u_int64_t first_rid)
+{
+    stringstream fn;
+    fn << dirname << "/" << base_filename << ".";
+    fn << setfill('0') << hex << setw(4) << fid << ".jdat";
+    file_hdr fh(RHM_JDAT_FILE_MAGIC, RHM_JDAT_VERSION, 0, first_rid, fid, 0x200, true);
+    ofstream of(fn.str().c_str(), ofstream::out | ofstream::trunc);
+    if (!of.good())
+        BOOST_FAIL("Unable to open journal data file " << fn << " for writing.");
+    of.write((const char*)&fh, sizeof(file_hdr));
+    of.close();
+}
+
+void create_jinf_file(const char* dirname, const char* base_filename)
+{
+    timespec ts;
+    ::clock_gettime(CLOCK_REALTIME, &ts);
+    jinf ji("test journal id", dirname, base_filename, NUM_JFILES, JFSIZE_SBLKS, ts);
+    ji.write();
+}
+
+void create_jrnl_fileset(const char* dirname, const char* base_filename)
+{
+    create_jinf_file(dirname, base_filename);
+    for (u_int32_t fid = 0; fid < NUM_JFILES; fid++)
+    {
+        u_int64_t rid = 0x12340000 + (fid * 0x25);
+        create_jdat_file(dirname, base_filename, fid, rid);
+    }
+}
+
+unsigned count_dir_contents(const char* dirname, bool incl_files, bool incl_dirs = true)
+{
+    struct dirent* entry;
+    struct stat s;
+    unsigned file_cnt = 0;
+    unsigned dir_cnt = 0;
+    unsigned other_cnt = 0;
+    DIR* dir = ::opendir(dirname);
+    if (!dir)
+        BOOST_FAIL("Unable to open directory " << dirname);
+    while ((entry = ::readdir(dir)) != NULL)
+    {
+        // Ignore . and ..
+        if (strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0)
+        {
+            stringstream fn;
+            fn << dirname << "/" << entry->d_name;
+            if (::stat(fn.str().c_str(), &s))
+                BOOST_FAIL("Unable to stat dir entry " << entry->d_name << "; err=" <<
+                        strerror(errno));
+            if (S_ISREG(s.st_mode))
+                file_cnt++;
+            else if (S_ISDIR(s.st_mode))
+                dir_cnt++;
+            else
+                other_cnt++;
+        }
+    }
+    if (incl_files)
+    {
+        if (incl_dirs)
+            return file_cnt + dir_cnt;
+        return file_cnt;
+    }
+    else if (incl_dirs)
+        return dir_cnt;
+    return other_cnt;
+}
+
 void check_dir_contents(const char* dirname, const char* base_filename, unsigned num_subdirs,
-        bool jrnl_present);
-unsigned count_dir_contents(const char* dirname, bool incl_files = true, bool incl_dirs = true);
-void check_dir_not_existing(const char* dirname);
+        bool jrnl_present)
+{
+    if (jdir::is_dir(dirname))
+    {
+        // Subdir count
+        BOOST_CHECK_EQUAL(count_dir_contents(dirname, false, true), num_subdirs);
+    
+        // Journal file count
+        unsigned num_jrnl_files = jrnl_present ? NUM_JFILES + 1 : 0;
+        BOOST_CHECK_EQUAL(count_dir_contents(dirname, true, false), num_jrnl_files);
+    
+        // Check journal files are present
+        if (jrnl_present)
+            try { jdir::verify_dir(dirname, base_filename); }
+            catch(const jexception& e) { BOOST_ERROR(e); }
+        for (unsigned subdir_num = 1; subdir_num <= num_subdirs; subdir_num++)
+        {
+            stringstream subdir_name;
+            subdir_name << dirname << "/_" << base_filename << ".bak.";
+            subdir_name << hex << setfill('0') << setw(4) << subdir_num;
+            try { jdir::verify_dir(subdir_name.str().c_str(), base_filename); }
+            catch(const jexception& e) { BOOST_ERROR(e); }
+        }
+    }
+    else
+        BOOST_ERROR(dirname << " is not a directory");
+}
 
-BOOST_AUTO_TEST_CASE(test_constructor)
+void check_dir_not_existing(const char* dirname)
 {
-    std::string dir("/tmp/A/B/C/D/E/F");
-    std::string bfn("test_base");
+    if (jdir::exists(dirname) && jdir::is_dir(dirname))
+        jdir::delete_dir(dirname);
+    if (jdir::exists(dirname))
+        BOOST_FAIL("Unable to remove directory " << dirname);
+}
+
+// === Test suite ===
+
+BOOST_AUTO_TEST_CASE(constructor)
+{
+    cout << file << ".constructor: " << flush;
+    string dir("/tmp/A/B/C/D/E/F");
+    string bfn("test_base");
     jdir dir1(dir, bfn);
     BOOST_CHECK(dir1.dirname().compare(dir) == 0);
     BOOST_CHECK(dir1.base_filename().compare(bfn) == 0);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_create_delete_dir)
+BOOST_AUTO_TEST_CASE(create_delete_dir)
 {
+    cout << file << ".create_delete_dir: " << flush;
     // Use instance
-    std::string dir_A("/tmp/A");
-    std::string dir_Ats("/tmp/A/"); // trailing '/'
+    string dir_A("/tmp/A");
+    string dir_Ats("/tmp/A/"); // trailing '/'
     check_dir_not_existing("/tmp/A");
     jdir dir1(dir_A, "test_base");
     dir1.create_dir();
@@ -127,10 +245,12 @@
     {
         BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_JDIR_STAT);
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_create_delete_dir_recursive)
+BOOST_AUTO_TEST_CASE(create_delete_dir_recursive)
 {
+    cout << file << ".create_delete_dir_recursive: " << flush;
     // Use instances
     check_dir_not_existing("/tmp/E");
     jdir dir1("/tmp/E/F/G/H", "test_base");
@@ -193,10 +313,12 @@
     BOOST_CHECK(jdir::is_dir("/tmp/I/J/K3/L6"));
     jdir::delete_dir("/tmp/I");
     BOOST_CHECK(!jdir::exists("/tmp/I"));
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_clear_verify_dir)
+BOOST_AUTO_TEST_CASE(clear_verify_dir)
 {
+    cout << file << ".clear_verify_dir: " << flush;
     // Use instances
     const char* jrnl_dir = "/tmp/test_dir_1";
     const char* bfn = "test_base";
@@ -261,126 +383,7 @@
     // clean up
     jdir::delete_dir(jrnl_dir);
     BOOST_CHECK(!jdir::exists(jrnl_dir));
+    cout << "ok" << endl;
 }
 
-// Helper functions
-
-void create_file(const char* filename, mode_t fmode)
-{
-    std::ofstream of(filename, std::ofstream::out | std::ofstream::trunc);
-    if (!of.good())
-        BOOST_FAIL("Unable to open file " << filename << " for writing.");
-    of.write(filename, ::strlen(filename));
-    of.close();
-    ::chmod(filename, fmode);
-}
-
-void create_jrnl_fileset(const char* dirname, const char* base_filename)
-{
-    create_jinf_file(dirname, base_filename);
-    for (u_int32_t fid = 0; fid < NUM_JFILES; fid++)
-    {
-        u_int64_t rid = 0x12340000 + (fid * 0x25);
-        create_jdat_file(dirname, base_filename, fid, rid);
-    }
-}
-
-void create_jdat_file(const char* dirname, const char* base_filename, u_int32_t fid,
-        u_int64_t first_rid)
-{
-    std::stringstream fn;
-    fn << dirname << "/" << base_filename << ".";
-    fn << std::setfill('0') << std::hex << std::setw(4) << fid << ".jdat";
-    file_hdr fh(RHM_JDAT_FILE_MAGIC, RHM_JDAT_VERSION, 0, first_rid, fid, 0x200, true);
-    std::ofstream of(fn.str().c_str(), std::ofstream::out | std::ofstream::trunc);
-    if (!of.good())
-        BOOST_FAIL("Unable to open journal data file " << fn << " for writing.");
-    of.write((const char*)&fh, sizeof(file_hdr));
-    of.close();
-}
-
-void create_jinf_file(const char* dirname, const char* base_filename)
-{
-    timespec ts;
-    ::clock_gettime(CLOCK_REALTIME, &ts);
-    jinf ji("test journal id", dirname, base_filename, NUM_JFILES, JFSIZE_SBLKS, ts);
-    ji.write();
-}
-
-void check_dir_contents(const char* dirname, const char* base_filename, unsigned num_subdirs,
-        bool jrnl_present)
-{
-    if (jdir::is_dir(dirname))
-    {
-        // Subdir count
-        BOOST_CHECK_EQUAL(count_dir_contents(dirname, false, true), num_subdirs);
-    
-        // Journal file count
-        unsigned num_jrnl_files = jrnl_present ? NUM_JFILES + 1 : 0;
-        BOOST_CHECK_EQUAL(count_dir_contents(dirname, true, false), num_jrnl_files);
-    
-        // Check journal files are present
-        if (jrnl_present)
-            try { jdir::verify_dir(dirname, base_filename); }
-            catch(const jexception& e) { BOOST_ERROR(e); }
-        for (unsigned subdir_num = 1; subdir_num <= num_subdirs; subdir_num++)
-        {
-            std::stringstream subdir_name;
-            subdir_name << dirname << "/_" << base_filename << ".bak.";
-            subdir_name << std::hex << std::setfill('0') << std::setw(4) << subdir_num;
-            try { jdir::verify_dir(subdir_name.str().c_str(), base_filename); }
-            catch(const jexception& e) { BOOST_ERROR(e); }
-        }
-    }
-    else
-        BOOST_ERROR(dirname << " is not a directory");
-}
-
-unsigned count_dir_contents(const char* dirname, bool incl_files, bool incl_dirs)
-{
-    struct dirent* entry;
-    struct stat s;
-    unsigned file_cnt = 0;
-    unsigned dir_cnt = 0;
-    unsigned other_cnt = 0;
-    DIR* dir = ::opendir(dirname);
-    if (!dir)
-        BOOST_FAIL("Unable to open directory " << dirname);
-    while ((entry = ::readdir(dir)) != NULL)
-    {
-        // Ignore . and ..
-        if (strcmp(entry->d_name, ".") != 0 && strcmp(entry->d_name, "..") != 0)
-        {
-            std::stringstream fn;
-            fn << dirname << "/" << entry->d_name;
-            if (::stat(fn.str().c_str(), &s))
-                BOOST_FAIL("Unable to stat dir entry " << entry->d_name << "; err=" <<
-                        strerror(errno));
-            if (S_ISREG(s.st_mode))
-                file_cnt++;
-            else if (S_ISDIR(s.st_mode))
-                dir_cnt++;
-            else
-                other_cnt++;
-        }
-    }
-    if (incl_files)
-    {
-        if (incl_dirs)
-            return file_cnt + dir_cnt;
-        return file_cnt;
-    }
-    else if (incl_dirs)
-        return dir_cnt;
-    return other_cnt;
-}
-
-void check_dir_not_existing(const char* dirname)
-{
-    if (jdir::exists(dirname) && jdir::is_dir(dirname))
-        jdir::delete_dir(dirname);
-    if (jdir::exists(dirname))
-        BOOST_FAIL("Unable to remove directory " << dirname);
-}
-
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/_ut_jerrno.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_jerrno.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/_ut_jerrno.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -28,19 +28,26 @@
 */
 
 #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;
+using namespace std;
 
-BOOST_AUTO_TEST_CASE(test_jerrno)
+QPID_AUTO_TEST_SUITE(jerrno_suite)
+using namespace rhm::journal;
+
+const string file("_ut_jerrno");
+
+BOOST_AUTO_TEST_CASE(jerrno_val)
 {
+    cout << file << ".jerrno_val: " << flush;
     const char* m = "JERR__MALLOC";
-    std::string malloc_msg = std::string(jerrno::err_msg(jerrno::JERR__MALLOC));
+    string malloc_msg = string(jerrno::err_msg(jerrno::JERR__MALLOC));
     BOOST_CHECK(malloc_msg.substr(0, ::strlen(m)).compare(m) == 0);
     BOOST_CHECK(::strcmp(jerrno::err_msg(0), "<Unknown error code>") == 0);
+    cout << "ok" << endl;
 }
         
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/_ut_jexception.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_jexception.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/_ut_jexception.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -28,22 +28,48 @@
 */
 
 #include "../unit_test.h"
+#include <iostream>
 #include <jrnl/jerrno.hpp>
 #include <jrnl/jexception.hpp>
 
 using namespace boost::unit_test;
 using namespace rhm::journal;
+using namespace std;
 
 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);
+const string file("_ut_jexception");
+
+// === Helper functions ===
+
 void throw_exception(const jexception& e, size_t what_len, size_t ai_len, size_t tc_len,
-        size_t tf_len);
+        size_t tf_len)
+{
+    try { throw e; }
+    catch (const jexception& e)
+    {
+        BOOST_CHECK_EQUAL(::strlen(e.what()), what_len);
+        BOOST_CHECK_EQUAL(e.additional_info().size(), ai_len);
+        BOOST_CHECK_EQUAL(e.throwing_class().size(), tc_len);
+        BOOST_CHECK_EQUAL(e.throwing_fn().size(), tf_len);
+    }
+}
 
-BOOST_AUTO_TEST_CASE(test_constructor_1)
+void throw_exception(const jexception& e, size_t what_len, size_t ai_len)
 {
+    throw_exception(e, what_len, ai_len, 0, 0);
+}
+
+void throw_exception(const jexception& e, size_t what_len, size_t tc_len, size_t tf_len)
+{
+    throw_exception(e, what_len, 0, tc_len, tf_len);
+}
+
+// === Test suite ===
+
+BOOST_AUTO_TEST_CASE(constructor_1)
+{
+    cout << file << ".constructor_1: " << flush;
     try
     {
         jexception e1;
@@ -62,10 +88,12 @@
         BOOST_CHECK(e.throwing_fn().size() == 0);
         BOOST_CHECK(::strlen(e.what()) > 0);
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_constructor_2)
+BOOST_AUTO_TEST_CASE(constructor_2)
 {
+    cout << file << ".constructor_2: " << flush;
     const u_int32_t err_code = 2;
     try
     {
@@ -85,10 +113,12 @@
         BOOST_CHECK(e.throwing_fn().size() == 0);
         BOOST_CHECK(::strlen(e.what()) > 0);
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_constructor_3a)
+BOOST_AUTO_TEST_CASE(constructor_3a)
 {
+    cout << file << ".constructor_3a: " << flush;
     const char* err_msg = "exception3";
     try
     {
@@ -108,11 +138,13 @@
         BOOST_CHECK(e.throwing_fn().size() == 0);
         BOOST_CHECK(::strlen(e.what()) > 0);
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_constructor_3b)
+BOOST_AUTO_TEST_CASE(constructor_3b)
 {
-    const std::string err_msg("exception3");
+    cout << file << ".constructor_3b: " << flush;
+    const string err_msg("exception3");
     try
     {
         jexception e3(err_msg);
@@ -131,10 +163,12 @@
         BOOST_CHECK(e.throwing_fn().size() == 0);
         BOOST_CHECK(::strlen(e.what()) > 0);
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_constructor_4a)
+BOOST_AUTO_TEST_CASE(constructor_4a)
 {
+    cout << file << ".constructor_4a: " << flush;
     const u_int32_t err_code = 4;
     const char* err_msg = "exception4";
     try
@@ -155,12 +189,14 @@
         BOOST_CHECK(e.throwing_fn().size() == 0);
         BOOST_CHECK(::strlen(e.what()) > 0);
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_constructor_4b)
+BOOST_AUTO_TEST_CASE(constructor_4b)
 {
+    cout << file << ".constructor_4b: " << flush;
     const u_int32_t err_code = 4;
-    const std::string err_msg("exception4");
+    const string err_msg("exception4");
     try
     {
         jexception e4(err_code, err_msg);
@@ -179,10 +215,12 @@
         BOOST_CHECK(e.throwing_fn().size() == 0);
         BOOST_CHECK(::strlen(e.what()) > 0);
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_constructor_5a)
+BOOST_AUTO_TEST_CASE(constructor_5a)
 {
+    cout << file << ".constructor_5a: " << flush;
     const u_int32_t err_code = 5;
     const char* err_class = "class5";
     const char* err_fn = "fn5";
@@ -204,13 +242,15 @@
         BOOST_CHECK(e.throwing_fn().compare(err_fn) == 0);
         BOOST_CHECK(::strlen(e.what()) > 0);
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_constructor_5b)
+BOOST_AUTO_TEST_CASE(constructor_5b)
 {
+    cout << file << ".constructor_5b: " << flush;
     const u_int32_t err_code = 5;
-    const std::string err_class("class5");
-    const std::string err_fn("fn5");
+    const string err_class("class5");
+    const string err_fn("fn5");
     try
     {
         jexception e5(err_code, err_class, err_fn);
@@ -229,10 +269,12 @@
         BOOST_CHECK(e.throwing_fn().compare(err_fn) == 0);
         BOOST_CHECK(::strlen(e.what()) > 0);
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_constructor_6a)
+BOOST_AUTO_TEST_CASE(constructor_6a)
 {
+    cout << file << ".constructor_6a: " << flush;
     const u_int32_t err_code = 6;
     const char* err_msg = "exception6";
     const char* err_class = "class6";
@@ -255,14 +297,16 @@
         BOOST_CHECK(e.throwing_fn().compare(err_fn) == 0);
         BOOST_CHECK(::strlen(e.what()) > 0);
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_constructor_6b)
+BOOST_AUTO_TEST_CASE(constructor_6b)
 {
+    cout << file << ".constructor_6b: " << flush;
     const u_int32_t err_code = 6;
-    const std::string err_msg("exception6");
-    const std::string err_class("class6");
-    const std::string err_fn("fn6");
+    const string err_msg("exception6");
+    const string err_class("class6");
+    const string err_fn("fn6");
     try
     {
         jexception e6(err_code, err_msg, err_class, err_fn);
@@ -281,49 +325,27 @@
         BOOST_CHECK(e.throwing_fn().compare(err_fn) == 0);
         BOOST_CHECK(::strlen(e.what()) > 0);
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_msg_scope)
+BOOST_AUTO_TEST_CASE(msg_scope)
 {
+    cout << file << ".msg_scope: " << flush;
     try
     {
         // These will go out of scope as soon as jexception is thrown...
-        const std::string msg("Error message");
-        const std::string cls("class");
-        const std::string fn("function");
+        const string msg("Error message");
+        const string cls("class");
+        const string fn("function");
         throw jexception(100, msg, cls, fn);
     }
     catch (const jexception& e)
     {
-        std::stringstream ss;
+        stringstream ss;
         ss << e;
         BOOST_CHECK(ss.str().size() > 0);
     }    
+    cout << "ok" << endl;
 }
 
-// Helper functions
-
-void throw_exception(const jexception& e, size_t what_len, size_t ai_len)
-{
-    throw_exception(e, what_len, ai_len, 0, 0);
-}
-
-void throw_exception(const jexception& e, size_t what_len, size_t tc_len, size_t tf_len)
-{
-    throw_exception(e, what_len, 0, tc_len, tf_len);
-}
-
-void throw_exception(const jexception& e, size_t what_len, size_t ai_len, size_t tc_len,
-        size_t tf_len)
-{
-    try { throw e; }
-    catch (const jexception& e)
-    {
-        BOOST_CHECK_EQUAL(::strlen(e.what()), what_len);
-        BOOST_CHECK_EQUAL(e.additional_info().size(), ai_len);
-        BOOST_CHECK_EQUAL(e.throwing_class().size(), tc_len);
-        BOOST_CHECK_EQUAL(e.throwing_fn().size(), tf_len);
-    }
-}
-
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/_ut_jinf.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_jinf.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/_ut_jinf.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -30,6 +30,7 @@
 #include "../unit_test.h"
 #include <fstream>
 #include <iomanip>
+#include <iostream>
 #include <jrnl/file_hdr.hpp>
 #include <jrnl/jcfg.hpp>
 #include <jrnl/jerrno.hpp>
@@ -41,27 +42,105 @@
 
 using namespace boost::unit_test;
 using namespace rhm::journal;
+using namespace std;
 
 QPID_AUTO_TEST_SUITE(jinf_suite)
 
-// Helper function declarations
-const std::string jid("test journal id");
-const std::string jdir("/tmp");
-const std::string base_filename("test_base");
+const string file("_ut_jinf");
+
+// === Helper functions ===
+
+const string jid("test journal id");
+const string jdir("/tmp");
+const string base_filename("test_base");
 timespec ts;
 enum rid_scheme { RID_NONE, RID_LINEAR };
 
-// Helper functions
-void create_journal_filenames(std::vector<std::string>& jfiles);
-void create_journal_files(std::vector<std::string>& jfiles, rid_scheme scheme,
-        u_int32_t min_fid_offs = 0, u_int64_t rid_offs = 0);
-void clean_journal_files(std::vector<std::string>& jfiles);
+void create_journal_filenames(vector<string>& jfiles)
+{
+    for (int fnum=0; fnum<NUM_JFILES; fnum++)
+    {
+        stringstream fn;
+        fn << jdir << "/" << base_filename << ".";
+        fn << setfill('0') << hex << setw(4) << fnum << "." << JRNL_DATA_EXTENSION;
+        jfiles.push_back(fn.str());
+    }
+}
+
 void init_fhdr(file_hdr& fh, const u_int32_t fid, const u_int64_t rid, const bool owi,
-        const bool no_enq = false);
-void clean_journal_info_file();
+        const bool no_enq = false)
+{
+    fh._magic = RHM_JDAT_FILE_MAGIC;
+    fh._version = RHM_JDAT_VERSION;
+#if defined(JRNL_BIG_ENDIAN)
+    fh._eflag = RHM_BENDIAN_FLAG;
+#else
+    fh._eflag = RHM_LENDIAN_FLAG;
+#endif
+    fh._uflag = owi ? rec_hdr::HDR_OVERWRITE_INDICATOR_MASK : 0;
+    fh._rid = rid;
+    fh._fid = fid;
+    fh._fro = no_enq ? 0 : 0x200;
+    timespec ts;
+    ::clock_gettime(CLOCK_REALTIME, &ts);
+    fh._ts_sec = ts.tv_sec;
+    fh._ts_nsec = ts.tv_nsec;
+}
 
-BOOST_AUTO_TEST_CASE(test_write_constructor)
+void create_journal_files(vector<string>& jfiles, rid_scheme scheme,
+        u_int32_t min_fid_offs = 0, u_int64_t rid_offs = 0)
 {
+    const u_int64_t rid_incr = 0x10;
+    file_hdr fh;
+    vector<string>::iterator itr;
+    u_int32_t fid = 0;
+    u_int64_t rid = rid_offs + ((NUM_JFILES - min_fid_offs) % NUM_JFILES) * rid_incr;
+    for (itr=jfiles.begin(); itr<jfiles.end(); itr++)
+    {
+        
+        ofstream of(itr->c_str(), ofstream::out | ofstream::trunc);
+        if (!of.good())
+            BOOST_FAIL("Unable to open test journal file " << *itr << " for writing.");
+        
+        // prepare file_hdr
+        if (scheme == RID_NONE) // create file containing 0s
+            ::memset(&fh, 0, sizeof(file_hdr));
+        else
+            init_fhdr(fh, fid, rid, fid >= min_fid_offs);
+        
+        // write file header
+        int cnt = sizeof(file_hdr);
+        of.write((const char*)&fh, cnt);
+        
+        // fill remaining sblk with 0s
+        while (cnt++ < JRNL_DBLK_SIZE * JRNL_SBLK_SIZE)
+            of.put(0);
+        of.close();
+        
+        if (++fid == min_fid_offs)
+            rid -= rid_incr * (NUM_JFILES - 1);
+        else
+            rid += rid_incr;
+    }
+}
+
+void clean_journal_info_file()
+{
+    stringstream fn;
+    fn << jdir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
+    BOOST_WARN_MESSAGE(::unlink(fn.str().c_str()) == 0, "Failed to remove file " << fn.str());
+}
+
+void clean_journal_files(vector<string>& jfiles)
+{
+    for (vector<string>::iterator itr=jfiles.begin(); itr != jfiles.end(); itr++)
+        BOOST_WARN_MESSAGE(::unlink(itr->c_str()) == 0, "Failed to remove file " << *itr);
+    jfiles.clear();
+}
+
+BOOST_AUTO_TEST_CASE(write_constructor)
+{
+    cout << file << ".write_constructor: " << flush;
     ::clock_gettime(CLOCK_REALTIME, &ts);
     jinf ji(jid, jdir, base_filename, NUM_JFILES, JFSIZE_SBLKS, ts);
     BOOST_CHECK_EQUAL(ji.jver(), RHM_JDAT_VERSION);
@@ -80,11 +159,13 @@
     BOOST_CHECK_EQUAL(ji.rmgr_page_size_dblks(), (u_int32_t)JRNL_RMGR_PAGE_SIZE);
     BOOST_CHECK_EQUAL(ji.rmgr_num_pages(), (u_int32_t)JRNL_RMGR_PAGES);
     ji.write();
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_read_constructor)
+BOOST_AUTO_TEST_CASE(read_constructor)
 {
-    std::stringstream fn;
+    cout << file << ".read_constructor: " << flush;
+    stringstream fn;
     fn << jdir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
     jinf ji(fn.str(), false);
     BOOST_CHECK_EQUAL(ji.jver(), RHM_JDAT_VERSION);
@@ -102,24 +183,28 @@
     BOOST_CHECK_EQUAL(ji.wmgr_num_pages(), (u_int32_t)JRNL_WMGR_PAGES);
     BOOST_CHECK_EQUAL(ji.rmgr_page_size_dblks(), (u_int32_t)JRNL_RMGR_PAGE_SIZE);
     BOOST_CHECK_EQUAL(ji.rmgr_num_pages(), (u_int32_t)JRNL_RMGR_PAGES);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_validate)
+BOOST_AUTO_TEST_CASE(validate)
 {
-    std::stringstream fn;
+    cout << file << ".validate: " << flush;
+    stringstream fn;
     fn << jdir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
     jinf ji(fn.str(), true);
     // TODO: Check validation picks up conflict, but need to be friend to jinf to do it
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_analyze_empty_journal)
+BOOST_AUTO_TEST_CASE(analyze_empty_journal)
 {
-    std::vector<std::string> jfiles;
+    cout << file << ".analyze_empty_journal: " << flush;
+    vector<string> jfiles;
     create_journal_filenames(jfiles);
     
     create_journal_files(jfiles, RID_NONE);
 
-    std::stringstream fn;
+    stringstream fn;
     fn << jdir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
     jinf ji(fn.str(), false);
     try { ji.analyze(); }
@@ -130,18 +215,20 @@
     }
 
     clean_journal_files(jfiles);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_analyze_linear_journal)
+BOOST_AUTO_TEST_CASE(analyze_linear_journal)
 {
-    std::vector<std::string> jfiles;
+    cout << file << ".analyze_linear_journal: " << flush;
+    vector<string> jfiles;
     for (int i=0; i<NUM_JFILES; i++)
     {
         create_journal_filenames(jfiles);
     
         create_journal_files(jfiles, RID_LINEAR, i, 0x12340000);
 
-        std::stringstream fn;
+        stringstream fn;
         fn << jdir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
         jinf ji(fn.str(), false);
         BOOST_CHECK_EQUAL(ji.analyze(), i);
@@ -151,90 +238,7 @@
     
     // last test cleans up jinf file
     clean_journal_info_file();
+    cout << "ok" << endl;
 }
 
-// Helper functions
-
-void create_journal_filenames(std::vector<std::string>& jfiles)
-{
-    for (int fnum=0; fnum<NUM_JFILES; fnum++)
-    {
-        std::stringstream fn;
-        fn << jdir << "/" << base_filename << ".";
-        fn << std::setfill('0') << std::hex << std::setw(4) << fnum << "." << JRNL_DATA_EXTENSION;
-        jfiles.push_back(fn.str());
-    }
-}
-
-void create_journal_files(std::vector<std::string>& jfiles, rid_scheme scheme,
-        u_int32_t min_fid_offs, u_int64_t rid_offs)
-{
-    const u_int64_t rid_incr = 0x10;
-    file_hdr fh;
-    std::vector<std::string>::iterator itr;
-    u_int32_t fid = 0;
-    u_int64_t rid = rid_offs + ((NUM_JFILES - min_fid_offs) % NUM_JFILES) * rid_incr;
-    for (itr=jfiles.begin(); itr<jfiles.end(); itr++)
-    {
-        
-        std::ofstream of(itr->c_str(), std::ofstream::out | std::ofstream::trunc);
-        if (!of.good())
-            BOOST_FAIL("Unable to open test journal file " << *itr << " for writing.");
-        
-        // prepare file_hdr
-        if (scheme == RID_NONE) // create file containing 0s
-            ::memset(&fh, 0, sizeof(file_hdr));
-        else
-            init_fhdr(fh, fid, rid, fid >= min_fid_offs);
-        
-        // write file header
-        int cnt = sizeof(file_hdr);
-        of.write((const char*)&fh, cnt);
-        
-        // fill remaining sblk with 0s
-        while (cnt++ < JRNL_DBLK_SIZE * JRNL_SBLK_SIZE)
-            of.put(0);
-        of.close();
-        
-        if (++fid == min_fid_offs)
-            rid -= rid_incr * (NUM_JFILES - 1);
-        else
-            rid += rid_incr;
-    }
-}
-
-void clean_journal_info_file()
-{
-    std::stringstream fn;
-    fn << jdir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
-    BOOST_WARN_MESSAGE(::unlink(fn.str().c_str()) == 0, "Failed to remove file " << fn.str());
-}
-
-void clean_journal_files(std::vector<std::string>& jfiles)
-{
-    for (std::vector<std::string>::iterator itr=jfiles.begin(); itr != jfiles.end(); itr++)
-        BOOST_WARN_MESSAGE(::unlink(itr->c_str()) == 0, "Failed to remove file " << *itr);
-    jfiles.clear();
-}
-
-void init_fhdr(file_hdr& fh, const u_int32_t fid, const u_int64_t rid, const bool owi,
-        const bool no_enq)
-{
-    fh._magic = RHM_JDAT_FILE_MAGIC;
-    fh._version = RHM_JDAT_VERSION;
-#if defined(JRNL_BIG_ENDIAN)
-    fh._eflag = RHM_BENDIAN_FLAG;
-#else
-    fh._eflag = RHM_LENDIAN_FLAG;
-#endif
-    fh._uflag = owi ? rec_hdr::HDR_OVERWRITE_INDICATOR_MASK : 0;
-    fh._rid = rid;
-    fh._fid = fid;
-    fh._fro = no_enq ? 0 : 0x200;
-    timespec ts;
-    ::clock_gettime(CLOCK_REALTIME, &ts);
-    fh._ts_sec = ts.tv_sec;
-    fh._ts_nsec = ts.tv_nsec;
-}
-        
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/_ut_rec_hdr.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_rec_hdr.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/_ut_rec_hdr.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -28,6 +28,7 @@
 */
 
 #include "../unit_test.h"
+#include <iostream>
 #include <jrnl/deq_hdr.hpp>
 #include <jrnl/enq_hdr.hpp>
 #include <jrnl/file_hdr.hpp>
@@ -37,11 +38,15 @@
 
 using namespace boost::unit_test;
 using namespace rhm::journal;
+using namespace std;
 
 QPID_AUTO_TEST_SUITE(rec_hdr_suite)
 
-BOOST_AUTO_TEST_CASE(test_hdr)
+const string file("_ut_rec_hdr");
+
+BOOST_AUTO_TEST_CASE(hdr_class)
 {
+    cout << file << ".hdr_class: " << flush;
     rec_hdr h1;
     BOOST_CHECK_EQUAL(h1._magic, 0UL);
     BOOST_CHECK_EQUAL(h1._version, 0);
@@ -99,10 +104,12 @@
     BOOST_CHECK_EQUAL(h1._uflag, 0);
     BOOST_CHECK_EQUAL(h1._rid, 0ULL);
     BOOST_CHECK(!h1.get_owi());
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_rec_tail)
+BOOST_AUTO_TEST_CASE(rec_tail_class)
 {
+    cout << file << ".rec_tail_class: " << flush;
     const u_int32_t magic = 0xfedcba98;
     const u_int64_t rid = 0xfedcba9876543210ULL;
     const u_int32_t xmagic = ~magic;
@@ -125,10 +132,12 @@
         BOOST_CHECK_EQUAL(rt3._xmagic, xmagic);
         BOOST_CHECK_EQUAL(rt3._rid, rid);
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_file_hdr)
+BOOST_AUTO_TEST_CASE(file_hdr_class)
 {
+    cout << file << ".file_hdr_class: " << flush;
     const u_int32_t magic = 0xfedcba98UL;
     const u_int8_t version = 0xa5;
     const u_int16_t uflag = 0x5537;
@@ -205,10 +214,12 @@
         BOOST_CHECK_EQUAL(fh3._fro, fro);
         BOOST_CHECK(fh3._ts_sec - ts.tv_sec <= 1); // No more than 1 sec difference
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_enq_hdr)
+BOOST_AUTO_TEST_CASE(enq_hdr_class)
 {
+    cout << file << ".enq_hdr_class: " << flush;
     const u_int32_t magic = 0xfedcba98UL;
     const u_int8_t version = 0xa5;
     const u_int64_t rid = 0xfedcba9876543210ULL;
@@ -312,10 +323,12 @@
         BOOST_CHECK(eh3.is_transient());
         BOOST_CHECK(!eh3.is_external());
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_deq_hdr)
+BOOST_AUTO_TEST_CASE(deq_hdr_class)
 {
+    cout << file << ".deq_hdr_class: " << flush;
     const u_int32_t magic = 0xfedcba98UL;
     const u_int8_t version = 0xa5;
     const u_int16_t uflag = 0x5537;
@@ -367,10 +380,12 @@
         BOOST_CHECK(dh2.get_owi());
         BOOST_CHECK_EQUAL(dh2._uflag, uflag);
     }
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_txn_hdr)
+BOOST_AUTO_TEST_CASE(txn_hdr_class)
 {
+    cout << file << ".txn_hdr_class: " << flush;
     const u_int32_t magic = 0xfedcba98UL;
     const u_int8_t version = 0xa5;
     const u_int16_t uflag = 0x5537;
@@ -419,6 +434,7 @@
         BOOST_CHECK(th2.get_owi());
         BOOST_CHECK_EQUAL(th2._uflag, uflag);
     }
+    cout << "ok" << endl;
 }
 
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/_ut_time_ns.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_time_ns.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/_ut_time_ns.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -22,15 +22,20 @@
 */
 
 #include "../unit_test.h"
+#include <iostream>
 #include <jrnl/time_ns.hpp>
 
 using namespace boost::unit_test;
 using namespace rhm::journal;
+using namespace std;
 
 QPID_AUTO_TEST_SUITE(jtt_time_ns)
 
-BOOST_AUTO_TEST_CASE(time_ns_constructors)
+const string file("_ut_time_ns");
+
+BOOST_AUTO_TEST_CASE(constructors)
 {
+    cout << file << ".constructors: " << flush;
     const time_t sec = 123;
     const long nsec = 123456789;
 
@@ -54,10 +59,12 @@
     BOOST_CHECK_EQUAL(t4.tv_sec, 0);
     BOOST_CHECK_EQUAL(t4.tv_nsec, 0);
     BOOST_CHECK_EQUAL(t4.is_zero(), true);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(time_ns_operators)
+BOOST_AUTO_TEST_CASE(operators)
 {
+    cout << file << ".operators: " << flush;
     const time_t sec1 = 123;
     const long nsec1 = 123456789;
     const time_t sec2 = 1;
@@ -136,10 +143,12 @@
     t3 = t2 - t1;
     BOOST_CHECK_EQUAL(t3.tv_sec, sec_2_minus_1);
     BOOST_CHECK_EQUAL(t3.tv_nsec, nsec_2_minus_1);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(time_ns_str)
+BOOST_AUTO_TEST_CASE(str)
 {
+    cout << file << ".str: " << flush;
     time_ns t1(123, 123456789);
     BOOST_CHECK_EQUAL(t1.str(), "123.123457");
     BOOST_CHECK_EQUAL(t1.str(9), "123.123456789");
@@ -148,6 +157,7 @@
     BOOST_CHECK_EQUAL(t2.str(9), "1.000000001");
     time_ns t3(-12, 345);
     BOOST_CHECK_EQUAL(t3.str(9), "-11.999999655");
+    cout << "ok" << endl;
 }
 
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/_ut_txn_map.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -29,20 +29,42 @@
 
 #include "../unit_test.h"
 #include <iomanip>
+#include <iostream>
 #include <jrnl/txn_map.hpp>
 #include <sstream>
 
 using namespace boost::unit_test;
 using namespace rhm::journal;
+using namespace std;
 
 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);
+const string file("_ut_txn_map");
 
-BOOST_AUTO_TEST_CASE(test_constructor)
+// === Helper functions ===
+
+const string make_xid(u_int64_t rid)
 {
+    stringstream ss;
+    ss << "XID-" << setfill('0') << setw(16) << hex << rid;
+    ss << "-0123456789abcdef";
+    return ss.str();  
+}
+
+void check_td_equal(txn_data& td1, txn_data& td2)
+{
+    BOOST_CHECK_EQUAL(td1._rid,       td2._rid);
+    BOOST_CHECK_EQUAL(td1._drid,      td2._drid);
+    BOOST_CHECK_EQUAL(td1._fid,       td2._fid);
+    BOOST_CHECK_EQUAL(td1._enq_flag,  td2._enq_flag);
+    BOOST_CHECK_EQUAL(td1._aio_compl, td2._aio_compl);
+}
+
+// === Test suite ===
+
+BOOST_AUTO_TEST_CASE(constructor)
+{
+    cout << file << ".constructor: " << flush;
     const u_int64_t rid = 0x123456789abcdef0ULL;
     const u_int64_t drid = 0xfedcba9876543210ULL;
     const u_int16_t fid = 0xfedcU;
@@ -57,10 +79,12 @@
     txn_map t1;
     BOOST_CHECK(t1.empty());
     BOOST_CHECK_EQUAL(t1.size(), 0);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_insert_get)
+BOOST_AUTO_TEST_CASE(insert_get)
 {
+    cout << file << ".insert_get: " << flush;
     u_int16_t fid;
     u_int64_t rid;
     u_int16_t fid_start = 0x2000U;
@@ -79,28 +103,10 @@
     u_int64_t rid_incr_2 = 6ULL;
     for (u_int64_t rid = rid_begin; rid < rid_end; rid += rid_incr_2)
     {
-        std::string xid = make_xid(rid);
+        string xid = make_xid(rid);
         BOOST_CHECK_EQUAL(t2.in_map(xid), (rid%rid_incr_1 ? false : true));
     }
+    cout << "ok" << endl;
 }
 
-// Helper functions
-
-const std::string make_xid(u_int64_t rid)
-{
-    std::stringstream ss;
-    ss << "XID-" << std::setfill('0') << std::setw(16) << std::hex << rid;
-    ss << "-0123456789abcdef";
-    return ss.str();  
-}
-
-void check_td_equal(txn_data& td1, txn_data& td2)
-{
-    BOOST_CHECK_EQUAL(td1._rid,       td2._rid);
-    BOOST_CHECK_EQUAL(td1._drid,      td2._drid);
-    BOOST_CHECK_EQUAL(td1._fid,       td2._fid);
-    BOOST_CHECK_EQUAL(td1._enq_flag,  td2._enq_flag);
-    BOOST_CHECK_EQUAL(td1._aio_compl, td2._aio_compl);
-}
-
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/jtt/_ut_data_src.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_data_src.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_data_src.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -28,11 +28,15 @@
 
 using namespace boost::unit_test;
 using namespace rhm::jtt;
+using namespace std;
 
 QPID_AUTO_TEST_SUITE(jtt_data_src)
 
-BOOST_AUTO_TEST_CASE(data_src_data)
+const string file("_ut_data_src");
+
+BOOST_AUTO_TEST_CASE(data)
 {
+    cout << file << ".data: " << flush;
     BOOST_CHECK(data_src::max_dsize > 0);
     for (size_t i=0; i<1024; i++)
     {
@@ -48,10 +52,12 @@
     BOOST_CHECK_EQUAL(dp1,(char*) 0);
     const char* dp2 = data_src::get_data(data_src::max_dsize + 0x1000);
     BOOST_CHECK_EQUAL(dp2, (char*)0);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(data_src_xid_data_xid)
+BOOST_AUTO_TEST_CASE(xid_data_xid)
 {
+    cout << file << ".xid_data_xid: " << flush;
     BOOST_CHECK_EQUAL(data_src::get_xid(1),  "0");
     BOOST_CHECK_EQUAL(data_src::get_xid(2),  "01");
     BOOST_CHECK_EQUAL(data_src::get_xid(3),  "002");
@@ -70,10 +76,10 @@
     size_t i = 15;
     for (; i<1024; i++)
     {
-        std::string xid(data_src::get_xid(i));
+        string xid(data_src::get_xid(i));
 
-        std::ostringstream oss;
-        oss << std::setfill('0') << "xid:" << std::setw(8) << i << ":";
+        ostringstream oss;
+        oss << setfill('0') << "xid:" << setw(8) << i << ":";
 
         BOOST_CHECK_EQUAL(xid.size(), i);
         BOOST_CHECK_EQUAL(xid.substr(0, 13), oss.str());
@@ -82,16 +88,17 @@
     }
     for (size_t j=data_src::max_xsize-1024; j<data_src::max_xsize; j++,i++)
     {
-        std::string xid(data_src::get_xid(j));
+        string xid(data_src::get_xid(j));
 
-        std::ostringstream oss;
-        oss << std::setfill('0') << "xid:" << std::setw(8) << i << ":";
+        ostringstream oss;
+        oss << setfill('0') << "xid:" << setw(8) << i << ":";
 
         BOOST_CHECK_EQUAL(xid.size(), j);
         BOOST_CHECK_EQUAL(xid.substr(0, 13), oss.str());
         BOOST_CHECK_EQUAL(xid[13], 'n');
         BOOST_CHECK_EQUAL(xid[j-1], (char)('a' + ((j-1)%26)));
     }
+    cout << "ok" << endl;
 }
 
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_init_params.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_init_params.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_init_params.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -23,17 +23,22 @@
 
 #include "../../unit_test.h"
 #include "jrnl_init_params.hpp"
+#include <iostream>
 
 using namespace boost::unit_test;
 using namespace rhm::jtt;
+using namespace std;
 
 QPID_AUTO_TEST_SUITE(jtt_jrnl_init_params)
 
-BOOST_AUTO_TEST_CASE(jrnl_init_params_constructor)
+const string file("_ut_jrnl_init_params");
+
+BOOST_AUTO_TEST_CASE(constructor)
 {
-    const std::string jid = "jid";
-    const std::string jdir = "jdir";
-    const std::string bfn = "base filename";
+    cout << file << ".constructor: " << flush;
+    const string jid = "jid";
+    const string jdir = "jdir";
+    const string bfn = "base filename";
     const u_int16_t num_jfiles = 123;
     const u_int32_t jfsize_sblks = 456;
     jrnl_init_params jip(jid, jdir, bfn, num_jfiles, jfsize_sblks);
@@ -42,13 +47,15 @@
     BOOST_CHECK_EQUAL(jip.base_filename(), bfn);
     BOOST_CHECK_EQUAL(jip.num_jfiles(), num_jfiles);
     BOOST_CHECK_EQUAL(jip.jfsize_sblks(), jfsize_sblks);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(jrnl_init_params_copy_constructor_1)
+BOOST_AUTO_TEST_CASE(copy_constructor_1)
 {
-    const std::string jid = "jid";
-    const std::string jdir = "jdir";
-    const std::string bfn = "base filename";
+    cout << file << ".copy_constructor_1: " << flush;
+    const string jid = "jid";
+    const string jdir = "jdir";
+    const string bfn = "base filename";
     const u_int16_t num_jfiles = 123;
     const u_int32_t jfsize_sblks = 456;
     jrnl_init_params jip1(jid, jdir, bfn, num_jfiles, jfsize_sblks);
@@ -58,13 +65,15 @@
     BOOST_CHECK_EQUAL(jip2.base_filename(), bfn);
     BOOST_CHECK_EQUAL(jip2.num_jfiles(), num_jfiles);
     BOOST_CHECK_EQUAL(jip2.jfsize_sblks(), jfsize_sblks);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(jrnl_init_params_copy_constructor_2)
+BOOST_AUTO_TEST_CASE(copy_constructor_2)
 {
-    const std::string jid = "jid";
-    const std::string jdir = "jdir";
-    const std::string bfn = "base filename";
+    cout << file << ".copy_constructor_2: " << flush;
+    const string jid = "jid";
+    const string jdir = "jdir";
+    const string bfn = "base filename";
     const u_int16_t num_jfiles = 123;
     const u_int32_t jfsize_sblks = 456;
     jrnl_init_params::shared_ptr p(new jrnl_init_params(jid, jdir, bfn, num_jfiles, jfsize_sblks));
@@ -74,6 +83,7 @@
     BOOST_CHECK_EQUAL(jip2.base_filename(), bfn);
     BOOST_CHECK_EQUAL(jip2.num_jfiles(), num_jfiles);
     BOOST_CHECK_EQUAL(jip2.jfsize_sblks(), jfsize_sblks);
+    cout << "ok" << endl;
 }
 
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -26,18 +26,23 @@
 #include "jrnl_instance.hpp"
 #include <jrnl/jdir.hpp>
 #include <jrnl/jerrno.hpp>
+#include <iostream>
 
 using namespace boost::unit_test;
 using namespace rhm::journal;
 using namespace rhm::jtt;
+using namespace std;
 
 QPID_AUTO_TEST_SUITE(jtt_jrnl_instance)
 
-BOOST_AUTO_TEST_CASE(jrnl_instance_constructor_1)
+const string file("_ut_jrnl_instance");
+
+BOOST_AUTO_TEST_CASE(constructor_1)
 {
-    const std::string jid = "jid1";
-    const std::string jdir = "/tmp/test1";
-    const std::string bfn = "test";
+    cout << file << ".constructor_1: " << flush;
+    const string jid = "jid1";
+    const string jdir = "/tmp/test1";
+    const string bfn = "test";
     const u_int16_t num_jfiles = 20;
     const u_int32_t jfsize_sblks = 128;
 
@@ -52,13 +57,15 @@
     try { jdir::verify_dir(jdir, bfn); }
     catch (const jexception& e) { BOOST_ERROR(e.what()); }
     jdir::delete_dir(jdir);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(jrnl_instance_constructor_2)
+BOOST_AUTO_TEST_CASE(constructor_2)
 {
-    const std::string jid = "jid2";
-    const std::string jdir = "/tmp/test2";
-    const std::string bfn = "test";
+    cout << file << ".constructor_2: " << flush;
+    const string jid = "jid2";
+    const string jdir = "/tmp/test2";
+    const string bfn = "test";
     const u_int16_t num_jfiles = 20;
     const u_int32_t jfsize_sblks = 128;
 
@@ -75,13 +82,15 @@
     try { jdir::verify_dir(jdir, bfn); }
     catch (const jexception& e) { BOOST_ERROR(e.what()); }
     jdir::delete_dir(jdir);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(jrnl_instance_constructor_3)
+BOOST_AUTO_TEST_CASE(constructor_3)
 {
-    const std::string jid = "jid3";
-    const std::string jdir = "/tmp/test3";
-    const std::string bfn = "test";
+    cout << file << ".constructor_3: " << flush;
+    const string jid = "jid3";
+    const string jdir = "/tmp/test3";
+    const string bfn = "test";
     const u_int16_t num_jfiles = 20;
     const u_int32_t jfsize_sblks = 128;
 
@@ -98,13 +107,15 @@
     try { jdir::verify_dir(jdir, bfn); }
     catch (const jexception& e) { BOOST_ERROR(e.what()); }
     jdir::delete_dir(jdir);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(jrnl_instance_recover)
+BOOST_AUTO_TEST_CASE(recover)
 {
-    const std::string jid = "jid5";
-    const std::string jdir = "/tmp/test5";
-    const std::string bfn = "test";
+    cout << file << ".recover: " << flush;
+    const string jid = "jid5";
+    const string jdir = "/tmp/test5";
+    const string bfn = "test";
     const u_int16_t num_jfiles = 20;
     const u_int32_t jfsize_sblks = 128;
 
@@ -127,13 +138,15 @@
     try { jdir::verify_dir(jdir, bfn); }
     catch (const jexception& e) { BOOST_ERROR(e.what()); }
     jdir::delete_dir(jdir);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(jrnl_instance_recover_no_files)
+BOOST_AUTO_TEST_CASE(recover_no_files)
 {
-    const std::string jid = "jid6";
-    const std::string jdir = "/tmp/test6";
-    const std::string bfn = "test";
+    cout << file << ".recover_no_files: " << flush;
+    const string jid = "jid6";
+    const string jdir = "/tmp/test6";
+    const string bfn = "test";
     const u_int16_t num_jfiles = 20;
     const u_int32_t jfsize_sblks = 128;
 
@@ -151,6 +164,7 @@
     try { jdir::verify_dir(jdir, bfn); }
     catch (const jexception& e) { BOOST_ERROR(e.what()); }
     jdir::delete_dir(jdir);
+    cout << "ok" << endl;
 }
 
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/jtt/_ut_read_arg.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_read_arg.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_read_arg.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -24,17 +24,21 @@
 #include "../../unit_test.h"
 #include <boost/test/unit_test_log.hpp>
 #include "read_arg.hpp"
+#include <iostream>
 
 #include <boost/program_options.hpp>
 namespace po = boost::program_options;
 using namespace rhm::jtt;
-
 using namespace boost::unit_test;
+using namespace std;
 
 QPID_AUTO_TEST_SUITE(jtt_read_arg)
 
-BOOST_AUTO_TEST_CASE(read_arg_constructor)
+const string file("_ut_read_arg");
+
+BOOST_AUTO_TEST_CASE(constructor)
 {
+    cout << file << ".constructor: " << flush;
     read_arg ra1;
     BOOST_CHECK_EQUAL(ra1.val(), read_arg::NONE);
     BOOST_CHECK_EQUAL(ra1.str(), "NONE");
@@ -50,10 +54,12 @@
     read_arg ra5(read_arg::LAZYLOAD);
     BOOST_CHECK_EQUAL(ra5.val(), read_arg::LAZYLOAD);
     BOOST_CHECK_EQUAL(ra5.str(), "LAZYLOAD");
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(read_arg_set_val)
+BOOST_AUTO_TEST_CASE(set_val)
 {
+    cout << file << ".set_val: " << flush;
     read_arg ra;
     BOOST_CHECK_EQUAL(ra.val(), read_arg::NONE);
     BOOST_CHECK_EQUAL(ra.str(), "NONE");
@@ -66,10 +72,12 @@
     ra.set_val(read_arg::LAZYLOAD);
     BOOST_CHECK_EQUAL(ra.val(), read_arg::LAZYLOAD);
     BOOST_CHECK_EQUAL(ra.str(), "LAZYLOAD");
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(read_arg_parse)
+BOOST_AUTO_TEST_CASE(parse)
 {
+    cout << file << ".parse: " << flush;
     read_arg ra;
     ra.parse("LAZYLOAD");
     BOOST_CHECK_EQUAL(ra.val(), read_arg::LAZYLOAD);
@@ -89,47 +97,52 @@
     ra.parse("RANDOM");
     BOOST_CHECK_EQUAL(ra.val(), read_arg::RANDOM);
     BOOST_CHECK_EQUAL(ra.str(), "RANDOM");
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(read_arg_istream)
+BOOST_AUTO_TEST_CASE(istream)
 {
+    cout << file << ".istream: " << flush;
     read_arg ra;
-    std::istringstream ss1("LAZYLOAD", std::ios::in);
+    istringstream ss1("LAZYLOAD", ios::in);
     ss1 >> ra;
     BOOST_CHECK_EQUAL(ra.val(), read_arg::LAZYLOAD);
     BOOST_CHECK_EQUAL(ra.str(), "LAZYLOAD");
-    std::istringstream ss2("ALL", std::ios::in);
+    istringstream ss2("ALL", ios::in);
     ss2 >> ra;
     BOOST_CHECK_EQUAL(ra.val(), read_arg::ALL);
     BOOST_CHECK_EQUAL(ra.str(), "ALL");
-    std::istringstream ss3("NONE", std::ios::in);
+    istringstream ss3("NONE", ios::in);
     ss3 >> ra;
     BOOST_CHECK_EQUAL(ra.val(), read_arg::NONE);
     BOOST_CHECK_EQUAL(ra.str(), "NONE");
-    std::istringstream ss4("RANDOM", std::ios::in);
+    istringstream ss4("RANDOM", ios::in);
     ss4 >> ra;
     BOOST_CHECK_EQUAL(ra.val(), read_arg::RANDOM);
     BOOST_CHECK_EQUAL(ra.str(), "RANDOM");
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(read_arg_ostream)
+BOOST_AUTO_TEST_CASE(ostream)
 {
-    std::ostringstream s1;
+    cout << file << ".ostream: " << flush;
+    ostringstream s1;
     read_arg ra(read_arg::LAZYLOAD);
     s1 << ra;
     BOOST_CHECK_EQUAL(s1.str(), "LAZYLOAD");
     ra.set_val(read_arg::ALL);
-    std::ostringstream s2;
+    ostringstream s2;
     s2 << ra;
     BOOST_CHECK_EQUAL(s2.str(), "ALL");
     ra.set_val(read_arg::NONE);
-    std::ostringstream s3;
+    ostringstream s3;
     s3 << ra;
     BOOST_CHECK_EQUAL(s3.str(), "NONE");
     ra.set_val(read_arg::RANDOM);
-    std::ostringstream s4;
+    ostringstream s4;
     s4 << ra;
     BOOST_CHECK_EQUAL(s4.str(), "RANDOM");
+    cout << "ok" << endl;
 }
 
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/jtt/_ut_test_case.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_test_case.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_test_case.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -25,14 +25,19 @@
 #include "../../unit_test.h"
 #include "test_case.hpp"
 #include "test_case_result.hpp"
+#include <iostream>
 
 using namespace boost::unit_test;
 using namespace rhm::jtt;
+using namespace std;
 
 QPID_AUTO_TEST_SUITE(jtt_test_case)
 
-BOOST_AUTO_TEST_CASE(test_case_constructor)
+const string file("_ut_test_case");
+
+BOOST_AUTO_TEST_CASE(constructor)
 {
+    cout << file << ".constructor: " << flush;
     const unsigned test_case_num = 0x12345;
     const u_int32_t num_msgs = 0x100;        
     const size_t min_data_size = 0x1000;
@@ -43,7 +48,7 @@
     using rhm::jtt::test_case;
     const test_case::transient_t transient = test_case::JTT_PERSISTNET;
     const test_case::external_t external = test_case::JDL_INTERNAL;
-    const std::string comment = "This is a test";
+    const string comment = "This is a test";
 
     test_case tc(test_case_num, num_msgs, min_data_size, max_data_size, auto_deq,
             min_xid_size, max_xid_size, transient, external, comment);
@@ -57,10 +62,12 @@
     BOOST_CHECK_EQUAL(tc.transient(), transient);
     BOOST_CHECK_EQUAL(tc.external(), external);
     BOOST_CHECK_EQUAL(tc.comment(), comment);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_case_results)
+BOOST_AUTO_TEST_CASE(results)
 {
+    cout << file << ".results: " << flush;
     const unsigned test_case_num = 0x12345;
     const u_int32_t num_msgs = 0x100;
     const size_t min_data_size = 0x1000;
@@ -71,35 +78,37 @@
     using rhm::jtt::test_case;
     const test_case::transient_t transient = test_case::JTT_PERSISTNET;
     const test_case::external_t external = test_case::JDL_INTERNAL;
-    const std::string comment = "This is a test";
+    const string comment = "This is a test";
     const unsigned num_results = 20;
 
     test_case tc(test_case_num, num_msgs, min_data_size, max_data_size, auto_deq,
             min_xid_size, max_xid_size, transient, external, comment);
     for (unsigned i=0; i<num_results; i++)
     {
-        std::ostringstream oss;
-        oss << "JID_" << std::setfill('0') << std::setw(2) << i;
+        ostringstream oss;
+        oss << "JID_" << setfill('0') << setw(2) << i;
         test_case_result::shared_ptr p(new test_case_result(oss.str()));
         tc.add_result(p);
     }
     BOOST_CHECK_EQUAL(tc.num_results(), num_results);
     test_case_result_agregation ave = tc.average();
     unsigned i=0;
-    for (test_case_result_agregation::tcrp_list_citr j=ave.rlist_begin(); j!=ave.rlist_end(); i++,j++)
+    for (test_case_result_agregation::tcrp_list_citr j=ave.rlist_begin(); j!=ave.rlist_end();
+            i++,j++)
     {
-        std::ostringstream oss;
-        oss << "JID_" << std::setfill('0') << std::setw(2) << i;
+        ostringstream oss;
+        oss << "JID_" << setfill('0') << setw(2) << i;
         BOOST_CHECK_EQUAL((*j)->jid(), oss.str());
     }
     for (unsigned i=0; i<num_results; i++)
     {
-        std::ostringstream oss;
-        oss << "JID_" << std::setfill('0') << std::setw(2) << i;
+        ostringstream oss;
+        oss << "JID_" << setfill('0') << setw(2) << i;
         BOOST_CHECK_EQUAL(ave[i]->jid(), oss.str());
     }
     tc.clear();
     BOOST_CHECK_EQUAL(tc.num_results(), unsigned(0));
+    cout << "ok" << endl;
 }
 
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -24,16 +24,21 @@
 #include "../../unit_test.h"
 #include <jrnl/jexception.hpp>
 #include "test_case_result.hpp"
+#include <iostream>
 
 using namespace boost::unit_test;
 using namespace rhm::journal;
 using namespace rhm::jtt;
+using namespace std;
 
 QPID_AUTO_TEST_SUITE(jtt_test_case_result)
 
-BOOST_AUTO_TEST_CASE(test_case_result_constructor)
+const string file("_ut_test_case_result");
+
+BOOST_AUTO_TEST_CASE(constructor)
 {
-    const std::string jid("journal id 1");
+    cout << file << ".constructor: " << flush;
+    const string jid("journal id 1");
     test_case_result tcr(jid);
     BOOST_CHECK_EQUAL(tcr.jid(), jid);
     BOOST_CHECK_EQUAL(tcr.exception(), false);
@@ -44,11 +49,13 @@
     BOOST_CHECK(ts2.is_zero());
     const time_ns& ts3 = tcr.test_time();
     BOOST_CHECK(ts3.is_zero());
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_case_result_start_stop)
+BOOST_AUTO_TEST_CASE(start_stop)
 {
-    const std::string jid("journal id 2");
+    cout << file << ".start_stop: " << flush;
+    const string jid("journal id 2");
     test_case_result tcr(jid);
     BOOST_CHECK_EQUAL(tcr.exception(), false);
     BOOST_CHECK_EQUAL(tcr.exception_count(), 0U);
@@ -79,14 +86,16 @@
     BOOST_CHECK(ts8.tv_sec == 1);
     BOOST_CHECK(ts8.tv_nsec > 100000000); // 0.1 sec in nanoseconds
     BOOST_CHECK(ts8.tv_nsec < 200000000); // 0.2 sec in nanoseconds
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_case_result_start_exception_stop_1)
+BOOST_AUTO_TEST_CASE(start_exception_stop_1)
 {
-    const std::string jid("journal id 3");
+    cout << file << ".start_exception_stop_1: " << flush;
+    const string jid("journal id 3");
     test_case_result tcr(jid);
     const u_int32_t err_code = 0x321;
-    const std::string err_msg = "exception message";
+    const string err_msg = "exception message";
     const jexception e(err_code, err_msg);
     tcr.set_start_time();
     ::usleep(1100000); // 1.1 sec in microseconds
@@ -100,13 +109,15 @@
     BOOST_CHECK(ts2.tv_sec == 1);
     BOOST_CHECK(ts2.tv_nsec > 100000000); // 0.1 sec in nanoseconds
     BOOST_CHECK(ts2.tv_nsec < 200000000); // 0.2 sec in nanoseconds
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_case_result_start_exception_stop_2)
+BOOST_AUTO_TEST_CASE(start_exception_stop_2)
 {
-    const std::string jid("journal id 4");
+    cout << file << ".start_exception_stop_2: " << flush;
+    const string jid("journal id 4");
     test_case_result tcr(jid);
-    const std::string err_msg = "exception message";
+    const string err_msg = "exception message";
     tcr.set_start_time();
     ::usleep(1100000); // 1.1 sec in microseconds
     tcr.add_exception(err_msg);
@@ -119,11 +130,13 @@
     BOOST_CHECK(ts2.tv_sec == 1);
     BOOST_CHECK(ts2.tv_nsec > 100000000); // 0.1 sec in nanoseconds
     BOOST_CHECK(ts2.tv_nsec < 200000000); // 0.2 sec in nanoseconds
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_case_result_start_exception_stop_3)
+BOOST_AUTO_TEST_CASE(start_exception_stop_3)
 {
-    const std::string jid("journal id 5");
+    cout << file << ".start_exception_stop_3: " << flush;
+    const string jid("journal id 5");
     test_case_result tcr(jid);
     const char* err_msg = "exception message";
     tcr.set_start_time();
@@ -138,14 +151,16 @@
     BOOST_CHECK(ts2.tv_sec == 1);
     BOOST_CHECK(ts2.tv_nsec > 100000000); // 0.1 sec in nanoseconds
     BOOST_CHECK(ts2.tv_nsec < 200000000); // 0.2 sec in nanoseconds
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_case_result_start_exception)
+BOOST_AUTO_TEST_CASE(start_exception)
 {
-    const std::string jid("journal id 6");
+    cout << file << ".start_exception: " << flush;
+    const string jid("journal id 6");
     test_case_result tcr(jid);
     u_int32_t err_code = 0x654;
-    const std::string err_msg = "exception message";
+    const string err_msg = "exception message";
     const jexception e(err_code, err_msg);
     tcr.set_start_time();
     ::usleep(1100000); // 1.1 sec in microseconds
@@ -157,14 +172,16 @@
     BOOST_CHECK(ts1.is_zero());
     const time_ns& ts2 = tcr.test_time();
     BOOST_CHECK(ts2.is_zero());
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_case_counters)
+BOOST_AUTO_TEST_CASE(counters)
 {
+    cout << file << ".counters: " << flush;
     const u_int32_t num_enq = 125;
     const u_int32_t num_deq = 64;
     const u_int32_t num_read = 22;
-    const std::string jid("journal id 7");
+    const string jid("journal id 7");
     test_case_result tcr(jid);
     BOOST_CHECK_EQUAL(tcr.num_enq(), u_int32_t(0));
     BOOST_CHECK_EQUAL(tcr.num_deq(), u_int32_t(0));
@@ -184,6 +201,7 @@
     BOOST_CHECK_EQUAL(tcr.num_enq(), num_enq);
     BOOST_CHECK_EQUAL(tcr.num_deq(), num_deq);
     BOOST_CHECK_EQUAL(tcr.num_read(), num_read);
+    cout << "ok" << endl;
 }
 
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result_agregation.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result_agregation.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_result_agregation.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -23,24 +23,54 @@
 
 #include "../../unit_test.h"
 #include "test_case_result_agregation.hpp"
-
 #include <iostream>
 
 using namespace boost::unit_test;
 using namespace rhm::journal;
 using namespace rhm::jtt;
+using namespace std;
 
 QPID_AUTO_TEST_SUITE(jtt_test_case_result_agregation)
 
-// helper fn forward decls
+const string file("_ut_test_case_result_agregation");
+
+// === Helper functions ===
+
 void check_agregate(const test_case_result_agregation& tcra, const u_int32_t num_enq,
         const u_int32_t num_deq, const u_int32_t num_reads, const u_int32_t num_results,
-        const u_int32_t num_exceptions, const time_t secs, const long nsec);
-test_case_result::shared_ptr make_result(const std::string& jid, const u_int32_t num_enq,
-        const u_int32_t num_deq, const u_int32_t num_reads, const time_t secs, const long nsec);
+        const u_int32_t num_exceptions, const time_t secs, const long nsec)
+{
+    BOOST_CHECK_EQUAL(tcra.num_enq(), num_enq);
+    BOOST_CHECK_EQUAL(tcra.num_deq(), num_deq);
+    BOOST_CHECK_EQUAL(tcra.num_read(), num_reads);
+    BOOST_CHECK_EQUAL(tcra.num_results(), num_results);
+    BOOST_CHECK_EQUAL(tcra.exception_count(), num_exceptions);
+    BOOST_CHECK_EQUAL(tcra.exception(), num_exceptions > 0);
+    const time_ns& ts1 = tcra.test_time();
+    BOOST_CHECK_EQUAL(ts1.tv_sec, secs);
+    BOOST_CHECK_EQUAL(ts1.tv_nsec, nsec);
+}
 
-BOOST_AUTO_TEST_CASE(test_case_result_agregation_constructor_1)
+test_case_result::shared_ptr make_result(const string& jid, const u_int32_t num_enq,
+        const u_int32_t num_deq, const u_int32_t num_reads, const time_t secs, const long nsec)
 {
+    test_case_result::shared_ptr tcrp(new test_case_result(jid));
+    for (unsigned i=0; i<num_enq; i++)
+        tcrp->incr_num_enq();
+    for (unsigned i=0; i<num_deq; i++)
+        tcrp->incr_num_deq();
+    for (unsigned i=0; i<num_reads; i++)
+        tcrp->incr_num_read();
+    time_ns ts(secs, nsec);
+    tcrp->set_test_time(ts);
+    return tcrp;
+}
+
+// === Test suite ===
+
+BOOST_AUTO_TEST_CASE(constructor_1)
+{
+    cout << file << ".constructor_1: " << flush;
     test_case_result_agregation tcra;
     BOOST_CHECK_EQUAL(tcra.tc_average_mode(), true);
     BOOST_CHECK_EQUAL(tcra.jid(), "Average");
@@ -52,11 +82,13 @@
     BOOST_CHECK(ts2.is_zero());
     const time_ns& ts3 = tcra.test_time();
     BOOST_CHECK(ts3.is_zero());
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_case_result_agregation_constructor_2)
+BOOST_AUTO_TEST_CASE(constructor_2)
 {
-    std::string jid("journal id");
+    cout << file << ".constructor_2: " << flush;
+    string jid("journal id");
     test_case_result_agregation tcra(jid);
     BOOST_CHECK_EQUAL(tcra.tc_average_mode(), false);
     BOOST_CHECK_EQUAL(tcra.jid(), jid);
@@ -68,17 +100,19 @@
     BOOST_CHECK(ts2.is_zero());
     const time_ns& ts3 = tcra.test_time();
     BOOST_CHECK(ts3.is_zero());
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_case_result_agregation_add_test_case)
+BOOST_AUTO_TEST_CASE(add_test_case)
 {
-    std::string jid("jid1");
+    cout << file << ".add_test_case: " << flush;
+    string jid("jid1");
     test_case_result::shared_ptr tcrp1 = make_result("jid1",  10,  10,   0,   1, 101010101L);
     test_case_result::shared_ptr tcrp2 = make_result("jid1",  25,   0,  35,  10,  20202020L);
     test_case_result::shared_ptr tcrp3 = make_result("jid1",   0,  15,   5,   2, 555555555L);
     test_case_result::shared_ptr tcrp4 = make_result("jid2", 100, 100, 100, 100, 323232324L);
     test_case_result::shared_ptr tcrp5 = make_result("jid1",   5,   0,   0,   0,       100L);
-    tcrp5->add_exception(std::string("error 1"), false);
+    tcrp5->add_exception(string("error 1"), false);
     test_case_result::shared_ptr tcrp6 = make_result("jid3",   0,   5,   0,   0,       100L);
     jexception e(0x123, "exception 2");
     tcrp6->add_exception(e, false);
@@ -103,16 +137,18 @@
     check_agregate(tcra,  40,  25,  40, 5, 1,  13, 676767776L);
     tcra.add_test_result(tcrp8);
     check_agregate(tcra, 240, 125, 340, 6, 1,  26,         0L);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_case_result_agregation_add_test_case_average)
+BOOST_AUTO_TEST_CASE(add_test_case_average)
 {
+    cout << file << ".add_test_case_average: " << flush;
     test_case_result::shared_ptr tcrp1 = make_result("jid1",  10,  10,   0,   1, 101010101L);
     test_case_result::shared_ptr tcrp2 = make_result("jid2",  25,   0,  35,  10,  20202020L);
     test_case_result::shared_ptr tcrp3 = make_result("jid3",   0,  15,   5,   2, 555555555L);
     test_case_result::shared_ptr tcrp4 = make_result("jid4", 100, 100, 100, 100, 323232324L);
     test_case_result::shared_ptr tcrp5 = make_result("jid5",   5,   0,   0,   0,       100L);
-    tcrp5->add_exception(std::string("error 1"), false);
+    tcrp5->add_exception(string("error 1"), false);
     test_case_result::shared_ptr tcrp6 = make_result("jid6",   0,   5,   0,   0,       100L);
     jexception e(0x123, "exception 2");
     tcrp6->add_exception(e, false);
@@ -137,39 +173,7 @@
     check_agregate(tcra, 140, 130, 140, 7, 2, 114,       200L);
     tcra.add_test_result(tcrp8);
     check_agregate(tcra, 340, 230, 440, 8, 2, 126, 222222222L);
+    cout << "ok" << endl;
 }
 
-
-// Helper functions
-
-void check_agregate(const test_case_result_agregation& tcra, const u_int32_t num_enq,
-        const u_int32_t num_deq, const u_int32_t num_reads, const u_int32_t num_results,
-        const u_int32_t num_exceptions, const time_t secs, const long nsec)
-{
-    BOOST_CHECK_EQUAL(tcra.num_enq(), num_enq);
-    BOOST_CHECK_EQUAL(tcra.num_deq(), num_deq);
-    BOOST_CHECK_EQUAL(tcra.num_read(), num_reads);
-    BOOST_CHECK_EQUAL(tcra.num_results(), num_results);
-    BOOST_CHECK_EQUAL(tcra.exception_count(), num_exceptions);
-    BOOST_CHECK_EQUAL(tcra.exception(), num_exceptions > 0);
-    const time_ns& ts1 = tcra.test_time();
-    BOOST_CHECK_EQUAL(ts1.tv_sec, secs);
-    BOOST_CHECK_EQUAL(ts1.tv_nsec, nsec);
-}
-
-test_case_result::shared_ptr make_result(const std::string& jid, const u_int32_t num_enq,
-        const u_int32_t num_deq, const u_int32_t num_reads, const time_t secs, const long nsec)
-{
-    test_case_result::shared_ptr tcrp(new test_case_result(jid));
-    for (unsigned i=0; i<num_enq; i++)
-        tcrp->incr_num_enq();
-    for (unsigned i=0; i<num_deq; i++)
-        tcrp->incr_num_deq();
-    for (unsigned i=0; i<num_reads; i++)
-        tcrp->incr_num_read();
-    time_ns ts(secs, nsec);
-    tcrp->set_test_time(ts);
-    return tcrp;
-}
-
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_set.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_set.cpp	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_test_case_set.cpp	2008-02-28 17:03:42 UTC (rev 1734)
@@ -25,26 +25,43 @@
 #include <sys/stat.h>
 #include "test_case.hpp"
 #include "test_case_set.hpp"
+#include <iostream>
 
 using namespace boost::unit_test;
 using namespace rhm::jtt;
+using namespace std;
 
 QPID_AUTO_TEST_SUITE(jtt_test_case_set)
 
-// helper fn forward decls
-bool check_csv_file(const char* filename);
+const string csv_file("_ut_test_case_set.csv");
+const string file("_ut_test_case_set");
+
+// === Helper functions ===
+
+bool check_csv_file(const char* filename)
+{
+    struct stat s;
+    if (::stat(filename, &s))
+        return false;
+    if (S_ISREG(s.st_mode))
+        return true;
+    return false;
+}
+
+// === Test suite ===
         
-const std::string csv_file("_ut_test_case_set.csv");
-        
-BOOST_AUTO_TEST_CASE(test_case_set_constructor)
+BOOST_AUTO_TEST_CASE(constructor)
 {
+    cout << file << ".constructor: " << flush;
     test_case_set tcs;
     BOOST_CHECK(tcs.empty());
     BOOST_CHECK_EQUAL(tcs.size(), unsigned(0));
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_case_set_append_1)
+BOOST_AUTO_TEST_CASE(append_1)
 {
+    cout << file << ".append_1: " << flush;
     const unsigned test_case_num = 0x12345;
     const u_int32_t num_msgs = 0x100;        
     const size_t min_data_size = 0x1000;
@@ -55,7 +72,7 @@
     using rhm::jtt::test_case;
     const test_case::transient_t transient = test_case::JTT_PERSISTNET;
     const test_case::external_t external = test_case::JDL_INTERNAL;
-    const std::string comment = "This is a test";
+    const string comment = "This is a test";
 
     test_case_set tcs;
     tcs.append(test_case_num, num_msgs, min_data_size, max_data_size, auto_deq, min_xid_size,
@@ -72,10 +89,12 @@
     BOOST_CHECK_EQUAL(tcp->transient(), transient);
     BOOST_CHECK_EQUAL(tcp->external(), external);
     BOOST_CHECK_EQUAL(tcp->comment(), comment);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_case_set_append_2)
+BOOST_AUTO_TEST_CASE(append_2)
 {
+    cout << file << ".append_2: " << flush;
     const unsigned test_case_num = 0x12345;
     const u_int32_t num_msgs = 0x100;        
     const size_t min_data_size = 0x1000;
@@ -86,7 +105,7 @@
     using rhm::jtt::test_case;
     const test_case::transient_t transient = test_case::JTT_PERSISTNET;
     const test_case::external_t external = test_case::JDL_INTERNAL;
-    const std::string comment = "This is a test";
+    const string comment = "This is a test";
 
     test_case::shared_ptr tcp(new test_case(test_case_num, num_msgs, min_data_size, max_data_size,
             auto_deq, min_xid_size, max_xid_size, transient, external, comment));
@@ -104,10 +123,12 @@
     BOOST_CHECK_EQUAL(tcp->transient(), transient);
     BOOST_CHECK_EQUAL(tcp->external(), external);
     BOOST_CHECK_EQUAL(tcp->comment(), comment);
+    cout << "ok" << endl;
 }
 
-BOOST_AUTO_TEST_CASE(test_case_set_append_from_csv)
+BOOST_AUTO_TEST_CASE(append_from_csv)
 {
+    cout << file << ".append_from_csv: " << flush;
     test_case_set tcs;
     BOOST_REQUIRE_MESSAGE(check_csv_file(csv_file.c_str()), "Test CSV file \"" << csv_file <<
             "\" is missing.");
@@ -121,18 +142,7 @@
     BOOST_CHECK(!tcs.empty());
     BOOST_CHECK_EQUAL(tcs.size(), unsigned(18));
     BOOST_CHECK_EQUAL(tcs.ignored(), unsigned(26));
+    cout << "ok" << endl;
 }
 
-
-// Helper functions
-bool check_csv_file(const char* filename)
-{
-    struct stat s;
-    if (::stat(filename, &s))
-        return false;
-    if (S_ISREG(s.st_mode))
-        return true;
-    return false;
-}
-
 QPID_AUTO_TEST_SUITE_END()

Modified: store/trunk/cpp/tests/jrnl/run-journal-tests
===================================================================
--- store/trunk/cpp/tests/jrnl/run-journal-tests	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/jrnl/run-journal-tests	2008-02-28 17:03:42 UTC (rev 1734)
@@ -3,27 +3,25 @@
 . ../setup
 
 fail=0
+num_jrnls=3
 
 # Run jtt using default test set
 echo
 echo "***** Mode 1: New journal instance, no recover *****"
 rm -rf /tmp/test_0*
-$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --format-chk --num-jrnls 3 || fail = 1
+$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --format-chk --num-jrnls $num_jrnls || fail = 1
 echo
-echo "***** Mode 2: Reuse journal instance, no recover *****"
+echo "***** Mode 2: Re-use journal instance, no recover *****"
 rm -rf /tmp/test_0*
-$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --reuse-instance --format-chk --num-jrnls 3 || fail = 1
+$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --reuse-instance --format-chk --num-jrnls $num_jrnls || fail = 1
 echo
 echo "***** Mode 3: New journal instance, recover previous test journal *****"
 rm -rf /tmp/test_0*
-$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --recover-mode --format-chk --num-jrnls 3 || fail = 1
+$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --recover-mode --format-chk --num-jrnls $num_jrnls || fail = 1
 echo
-echo "***** Mode 4: Reuse journal instance, recover previous test journal *****"
+echo "***** Mode 4: Re-use journal instance, recover previous test journal *****"
 rm -rf /tmp/test_0*
-$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --reuse-instance --recover-mode --format-chk --num-jrnls 3 || fail = 1
+$pwd/jtt/jtt --csv $pwd/jtt/jtt.csv --reuse-instance --recover-mode --format-chk --num-jrnls $num_jrnls || fail = 1
 echo
 
-# Run cpp-unit tests
-LD_PRELOAD=$pwd/.libs/libdlclose_noop.so DllPlugInTester -c -b $pwd/.libs/Journal*Tests.so || fail=1
-
 exit $fail

Deleted: store/trunk/cpp/tests/run-unit-tests
===================================================================
--- store/trunk/cpp/tests/run-unit-tests	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/run-unit-tests	2008-02-28 17:03:42 UTC (rev 1734)
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-. $srcdir/setup
-
-fail=0
-ulimit -c unlimited
-LD_PRELOAD=$pwd/.libs/libdlclose_noop.so $vg DllPlugInTester -c -b $pwd/.libs/*Test.so 2> out || fail=1
-
-vg_check out || fail=1
-exit $fail

Deleted: store/trunk/cpp/tests/test_plugin.h
===================================================================
--- store/trunk/cpp/tests/test_plugin.h	2008-02-27 21:04:57 UTC (rev 1733)
+++ store/trunk/cpp/tests/test_plugin.h	2008-02-28 17:03:42 UTC (rev 1734)
@@ -1,45 +0,0 @@
-#ifndef _test_plugin_
-#define _test_plugin_
-
-/*
-    Copyright (C) 2007 Red Hat Software
-
-    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.
-*/
-
-/**
- * Convenience to include cppunit headers needed by test plugins and
- * workaround for warning from superfluous main() declaration
- * in cppunit/TestPlugIn.h
- */
-
-#include <cppunit/TestCase.h>
-#include <cppunit/TextTestRunner.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-// Redefine CPPUNIT_PLUGIN_IMPLEMENT_MAIN to a dummy typedef to avoid warnings.
-// 
-#if defined(CPPUNIT_HAVE_UNIX_DLL_LOADER) || defined(CPPUNIT_HAVE_UNIX_SHL_LOADER)
-#undef CPPUNIT_PLUGIN_IMPLEMENT_MAIN 
-#define CPPUNIT_PLUGIN_IMPLEMENT_MAIN() typedef char __CppUnitPlugInImplementMainDummyTypeDef
-#endif
-
-#endif  /*!_test_plugin_*/




More information about the rhmessaging-commits mailing list