summaryrefslogtreecommitdiff
path: root/cpp/test
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2006-11-17 11:03:22 +0000
committerGordon Sim <gsim@apache.org>2006-11-17 11:03:22 +0000
commitbf74286e6a5eba055fd8bf9410c325205b8595d5 (patch)
tree46fafd1086d95b543e5b8c4927ba28daa50e7da9 /cpp/test
parentd965a29414762f0b3bbc840485f6327c3d523946 (diff)
downloadqpid-python-bf74286e6a5eba055fd8bf9410c325205b8595d5.tar.gz
Some fixes and tests for bugs uncovered during testing of persistence.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@476108 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/test')
-rw-r--r--cpp/test/unit/qpid/broker/TxBufferTest.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/cpp/test/unit/qpid/broker/TxBufferTest.cpp b/cpp/test/unit/qpid/broker/TxBufferTest.cpp
index ea3cd1e2b7..3789d340f8 100644
--- a/cpp/test/unit/qpid/broker/TxBufferTest.cpp
+++ b/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.