From 39afa34d1965ee3d97b8cc488ec33e46ea908699 Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Fri, 17 Nov 2006 11:03:22 +0000 Subject: Some fixes and tests for bugs uncovered during testing of persistence. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@476108 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/test/unit/qpid/broker/TxBufferTest.cpp | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'qpid/cpp/test') diff --git a/qpid/cpp/test/unit/qpid/broker/TxBufferTest.cpp b/qpid/cpp/test/unit/qpid/broker/TxBufferTest.cpp index ea3cd1e2b7..3789d340f8 100644 --- a/qpid/cpp/test/unit/qpid/broker/TxBufferTest.cpp +++ b/qpid/cpp/test/unit/qpid/broker/TxBufferTest.cpp @@ -153,6 +153,8 @@ class TxBufferTest : public CppUnit::TestCase CPPUNIT_TEST(testPrepareAndCommit); CPPUNIT_TEST(testFailOnPrepare); CPPUNIT_TEST(testRollback); + CPPUNIT_TEST(testBufferIsClearedAfterRollback); + CPPUNIT_TEST(testBufferIsClearedAfterCommit); CPPUNIT_TEST_SUITE_END(); public: @@ -224,6 +226,38 @@ class TxBufferTest : public CppUnit::TestCase opB.check(); opC.check(); } + + void testBufferIsClearedAfterRollback(){ + MockTxOp opA; + opA.expectRollback(); + MockTxOp opB; + opB.expectRollback(); + + TxBuffer buffer; + buffer.enlist(&opA); + buffer.enlist(&opB); + + buffer.rollback(); + buffer.commit();//second call should not reach ops + opA.check(); + opB.check(); + } + + void testBufferIsClearedAfterCommit(){ + MockTxOp opA; + opA.expectCommit(); + MockTxOp opB; + opB.expectCommit(); + + TxBuffer buffer; + buffer.enlist(&opA); + buffer.enlist(&opB); + + buffer.commit(); + buffer.rollback();//second call should not reach ops + opA.check(); + opB.check(); + } }; // Make this test suite a plugin. -- cgit v1.2.1