Author: manik.surtani(a)jboss.com
Date: 2008-07-31 04:29:26 -0400 (Thu, 31 Jul 2008)
New Revision: 6456
Modified:
core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTestBase.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/ReadCommittedLockParentTest.java
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/RepeatableReadLockParentTest.java
Log:
Test for concurrent remove and insert
Modified: core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTestBase.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTestBase.java 2008-07-31
00:06:35 UTC (rev 6455)
+++ core/trunk/src/test/java/org/jboss/cache/api/mvcc/LockTestBase.java 2008-07-31
08:29:26 UTC (rev 6456)
@@ -624,4 +624,56 @@
assert "v2".equals(cache.get(AB, "k"));
assert "v".equals(cache.get(ABC, "k"));
}
+
+ public void testConcurrentInsertRemove1() throws Exception
+ {
+ cache.put(AB, "k", "v");
+
+ tm.begin();
+ cache.put(ABC, "k", "v");
+ assert "v".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
+ Transaction t1 = tm.suspend();
+
+ tm.begin();
+ cache.removeNode(AB);
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
+ tm.commit();
+
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
+
+ tm.resume(t1);
+ t1.commit();
+
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
+ }
+
+ public void testConcurrentInsertRemove2() throws Exception
+ {
+ cache.put(AB, "k", "v");
+
+ tm.begin();
+ cache.removeNode(AB);
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
+ Transaction t1 = tm.suspend();
+
+ tm.begin();
+ assert "v".equals(cache.get(AB, "k"));
+ cache.put(ABC, "k", "v");
+ assert "v".equals(cache.get(ABC, "k"));
+ tm.commit();
+
+ assert "v".equals(cache.get(AB, "k"));
+ assert "v".equals(cache.get(ABC, "k"));
+
+ tm.resume(t1);
+ t1.commit();
+
+ assert null == cache.get(ABC, "k");
+ assert null == cache.get(AB, "k");
+ }
}
Modified:
core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/ReadCommittedLockParentTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/ReadCommittedLockParentTest.java 2008-07-31
00:06:35 UTC (rev 6455)
+++
core/trunk/src/test/java/org/jboss/cache/api/mvcc/read_committed/ReadCommittedLockParentTest.java 2008-07-31
08:29:26 UTC (rev 6456)
@@ -13,18 +13,30 @@
@Override
public void testOverwritingOnInsert()
{
- // no op since a locked parent makes tis test irrelevant.
+ // no op since a locked parent makes this test irrelevant.
}
@Override
public void testOverwritingOnInsert2()
{
- // no op since a locked parent makes tis test irrelevant.
+ // no op since a locked parent makes this test irrelevant.
}
@Override
public void testOverwritingOnInsert3()
{
- // no op since a locked parent makes tis test irrelevant.
+ // no op since a locked parent makes this test irrelevant.
}
+
+ @Override
+ public void testConcurrentInsertRemove1()
+ {
+ // no op since a locked parent makes this test irrelevant.
+ }
+
+ @Override
+ public void testConcurrentInsertRemove2()
+ {
+ // no op since a locked parent makes this test irrelevant.
+ }
}
Modified:
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/RepeatableReadLockParentTest.java
===================================================================
---
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/RepeatableReadLockParentTest.java 2008-07-31
00:06:35 UTC (rev 6455)
+++
core/trunk/src/test/java/org/jboss/cache/api/mvcc/repeatable_read/RepeatableReadLockParentTest.java 2008-07-31
08:29:26 UTC (rev 6456)
@@ -13,20 +13,32 @@
@Override
public void testOverwritingOnInsert()
{
- // no op since a locked parent makes tis test irrelevant.
+ // no op since a locked parent makes this test irrelevant.
}
@Override
public void testOverwritingOnInsert2()
{
- // no op since a locked parent makes tis test irrelevant.
+ // no op since a locked parent makes this test irrelevant.
}
@Override
public void testOverwritingOnInsert3()
{
- // no op since a locked parent makes tis test irrelevant.
+ // no op since a locked parent makes this test irrelevant.
}
+
+ @Override
+ public void testConcurrentInsertRemove1()
+ {
+ // no op since a locked parent makes this test irrelevant.
+ }
+
+ @Override
+ public void testConcurrentInsertRemove2()
+ {
+ // no op since a locked parent makes this test irrelevant.
+ }
}
Show replies by date