[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/transaction ...
Manik Surtani
msurtani at jboss.com
Fri Feb 9 08:49:35 EST 2007
User: msurtani
Date: 07/02/09 08:49:35
Modified: tests/functional/org/jboss/cache/transaction Tag:
Branch_JBossCache_1_4_0 TransactionTest.java
Log:
JBCACHE-974
Revision Changes Path
No revision
No revision
1.9.4.3 +81 -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.4.2
retrieving revision 1.9.4.3
diff -u -b -r1.9.4.2 -r1.9.4.3
--- TransactionTest.java 31 Jan 2007 02:09:57 -0000 1.9.4.2
+++ TransactionTest.java 9 Feb 2007 13:49:35 -0000 1.9.4.3
@@ -37,7 +37,7 @@
* Tests transactional access to a local TreeCache.
* Note: we use DummpyTranasctionManager to replace jta
*
- * @version $Id: TransactionTest.java,v 1.9.4.2 2007/01/31 02:09:57 msurtani Exp $
+ * @version $Id: TransactionTest.java,v 1.9.4.3 2007/02/09 13:49:35 msurtani Exp $
*/
public class TransactionTest extends TestCase {
TreeCache cache=null;
@@ -901,6 +901,86 @@
throw thread_ex;
}
+ public void testRemoveAndGetInTx() throws Exception
+ {
+ Fqn A_B = Fqn.fromString("/a/b");
+ Fqn A = Fqn.fromString("/a");
+
+ cache.put(A_B, "k", "v");
+
+ assertTrue(cache.exists(A_B));
+ assertTrue(cache.exists(A));
+
+ cache.getTransactionManager().begin();
+ cache.remove(A);
+ cache.get(A_B, "k");
+ cache.getTransactionManager().commit();
+ }
+
+ public void testRemoveAndPutInTx() throws Exception
+ {
+ Fqn A_B = Fqn.fromString("/a/b");
+ Fqn A = Fqn.fromString("/a");
+
+ cache.put(A_B, "k", "v");
+
+ assertTrue(cache.exists(A_B));
+ assertTrue(cache.exists(A));
+
+ cache.getTransactionManager().begin();
+ cache.remove(A_B);
+ cache.put(A_B, "k", "v2");
+ cache.getTransactionManager().commit();
+
+ assertTrue(cache.exists(A_B));
+ assertTrue(cache.exists(A));
+
+ assertEquals("v2", cache.get(A_B, "k"));
+ }
+
+ public void testRemoveParentAndPutInTx() throws Exception
+ {
+ Fqn A_B = Fqn.fromString("/a/b");
+ Fqn A = Fqn.fromString("/a");
+
+ cache.put(A_B, "k", "v");
+
+ assertTrue(cache.exists(A_B));
+ assertTrue(cache.exists(A));
+
+ cache.getTransactionManager().begin();
+ cache.remove(A);
+ cache.put(A_B, "k", "v2");
+ cache.getTransactionManager().commit();
+
+ assertTrue(cache.exists(A_B));
+ assertTrue(cache.exists(A));
+
+ assertEquals("v2", cache.get(A_B, "k"));
+ }
+
+ public void testRemoveGrandParentAndPutInTx() throws Exception
+ {
+ Fqn A_B_C = Fqn.fromString("/a/b/c");
+ Fqn A = Fqn.fromString("/a");
+
+ cache.put(A_B_C, "k", "v");
+
+ assertTrue(cache.exists(A_B_C));
+ assertTrue(cache.exists(A));
+
+ cache.getTransactionManager().begin();
+ cache.remove(A);
+ cache.put(A_B_C, "k", "v2");
+ cache.getTransactionManager().commit();
+
+ assertTrue(cache.exists(A_B_C));
+ assertTrue(cache.exists(A));
+
+ assertEquals("v2", cache.get(A_B_C, "k"));
+ }
+
+
/* public void testConcurrentReadAccess() throws Exception {
cache.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
More information about the jboss-cvs-commits
mailing list