[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/transaction ...
Manik Surtani
msurtani at jboss.com
Fri Feb 9 08:47:14 EST 2007
User: msurtani
Date: 07/02/09 08:47:14
Modified: tests/functional/org/jboss/cache/transaction
TransactionTest.java
Log:
Added more tests
Revision Changes Path
1.28 +81 -2 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.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- TransactionTest.java 7 Feb 2007 22:06:43 -0000 1.27
+++ TransactionTest.java 9 Feb 2007 13:47:14 -0000 1.28
@@ -38,7 +38,7 @@
* Tests transactional access to a local CacheImpl.
* Note: we use DummpyTranasctionManager to replace jta
*
- * @version $Id: TransactionTest.java,v 1.27 2007/02/07 22:06:43 genman Exp $
+ * @version $Id: TransactionTest.java,v 1.28 2007/02/09 13:47:14 msurtani Exp $
*/
public class TransactionTest extends TestCase
{
@@ -73,7 +73,7 @@
cache.getConfiguration().setInitialStateRetrievalTimeout(10000);
cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
cache.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
- cache.getConfiguration().setLockParentForChildInsertRemove(true); // this test case is written to assume this.
+ cache.getConfiguration().setLockParentForChildInsertRemove(true);// this test case is written to assume this.
cache.create();
cache.start();
thread_ex = null;
@@ -988,6 +988,85 @@
}
}
+ 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