[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/transaction ...
Manik Surtani
msurtani at jboss.com
Fri Nov 24 20:33:42 EST 2006
User: msurtani
Date: 06/11/24 20:33:42
Modified: tests/functional/org/jboss/cache/transaction Tag:
Branch_JBossCache_1_3_0 TransactionTest.java
Log:
Added new test method
Revision Changes Path
No revision
No revision
1.9.2.4 +35 -1 JBossCache/tests/functional/org/jboss/cache/transaction/TransactionTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TransactionTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/transaction/TransactionTest.java,v
retrieving revision 1.9.2.3
retrieving revision 1.9.2.4
diff -u -b -r1.9.2.3 -r1.9.2.4
--- TransactionTest.java 24 Nov 2006 14:19:30 -0000 1.9.2.3
+++ TransactionTest.java 25 Nov 2006 01:33:42 -0000 1.9.2.4
@@ -27,7 +27,7 @@
* Tests transactional access to a local TreeCache.
* Note: we use DummpyTranasctionManager to replace jta
*
- * @version $Id: TransactionTest.java,v 1.9.2.3 2006/11/24 14:19:30 msurtani Exp $
+ * @version $Id: TransactionTest.java,v 1.9.2.4 2006/11/25 01:33:42 msurtani Exp $
*/
public class TransactionTest extends TestCase {
TreeCache cache=null;
@@ -121,6 +121,40 @@
}
}
+ public void testGetAfterRemovalRollback() throws Exception
+ {
+ cache.put("/a/b", null);
+ assertTrue(cache.exists("/a/b"));
+ tx.begin();
+ cache.remove("/a/b");
+ assertFalse(cache.exists("/a/b"));
+ tx.rollback();
+ assertTrue(cache.exists("/a/b"));
+ assertEquals(0, cache.getNumberOfLocksHeld());
+ // new tx in new thread
+ Thread th = new Thread()
+ {
+ public void run()
+ {
+ try
+ {
+ cache.getTransactionManager().begin();
+ assertNotNull(cache.get("/a/b"));
+ cache.getTransactionManager().rollback();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ fail("Caught exception");
+ }
+ }
+ };
+
+ th.start();
+ th.join();
+
+ assertEquals(0, cache.getNumberOfLocksHeld());
+ }
public void testRollbackTx2() {
try {
More information about the jboss-cvs-commits
mailing list