Author: kpvdr
Date: 2007-11-07 15:03:15 -0500 (Wed, 07 Nov 2007)
New Revision: 1263
Added:
store/trunk/cpp/tests/jrnl/JournalSystemTests.hpp
Log:
OOPS! (need I add more?)
Added: store/trunk/cpp/tests/jrnl/JournalSystemTests.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/JournalSystemTests.hpp (rev 0)
+++ store/trunk/cpp/tests/jrnl/JournalSystemTests.hpp 2007-11-07 20:03:15 UTC (rev 1263)
@@ -0,0 +1,92 @@
+/**
+* \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>
+
+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 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