[infinispan-commits] Infinispan SVN: r341 - in trunk/core/src/test/java/org/infinispan: test and 1 other directory.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Tue May 26 07:30:45 EDT 2009
Author: vblagojevic at jboss.com
Date: 2009-05-26 07:30:45 -0400 (Tue, 26 May 2009)
New Revision: 341
Modified:
trunk/core/src/test/java/org/infinispan/replication/SyncReplImplicitLockingTest.java
trunk/core/src/test/java/org/infinispan/test/MultipleCacheManagersTest.java
Log:
[ISPN-70] - Transparent eager locking for transactions
unit test tuning
Modified: trunk/core/src/test/java/org/infinispan/replication/SyncReplImplicitLockingTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/replication/SyncReplImplicitLockingTest.java 2009-05-26 11:22:05 UTC (rev 340)
+++ trunk/core/src/test/java/org/infinispan/replication/SyncReplImplicitLockingTest.java 2009-05-26 11:30:45 UTC (rev 341)
@@ -60,16 +60,11 @@
cache2 = manager(1).getCache("replication.SyncReplImplicitLockingTest");
}
- public void testLocksReleasedWithoutExplicitUnlock() throws Exception {
- locksReleasedWithoutExplicitUnlockHelper(false);
- locksReleasedWithoutExplicitUnlockHelper(true);
+ public void testBasicOperation() throws Exception {
+ testBasicOperationHelper(false);
+ testBasicOperationHelper(true);
}
- public void testConcurrentNonTxLocking() throws Exception {
- concurrentLockingHelper(false, false);
- concurrentLockingHelper(true, false);
- }
-
public void testConcurrentTxLocking() throws Exception {
concurrentLockingHelper(false, true);
concurrentLockingHelper(true, true);
@@ -133,8 +128,10 @@
String name = "Infinispan";
TransactionManager mgr = TestingUtil.getTransactionManager(cache1);
mgr.begin();
- // lock node and start other thread whose write should now block
+ // lock node implicitly and start other thread whose write should now block
cache1.put(k, name);
+ //automatically locked on another cache node
+ assertLocked(cache2, k);
t.start();
// wait till the put in thread t times out
@@ -147,7 +144,7 @@
cleanup();
}
- private void locksReleasedWithoutExplicitUnlockHelper(boolean useCommit) throws Exception {
+ private void testBasicOperationHelper(boolean useCommit) throws Exception {
assertClusterSize("Should only be 2 caches in the cluster!!!", 2);
assertNull("Should be null", cache1.get(k));
@@ -159,6 +156,9 @@
cache1.put(k, name);
+ //automatically locked on another cache node
+ assertLocked(cache2, k);
+
if (useCommit)
mgr.commit();
else
Modified: trunk/core/src/test/java/org/infinispan/test/MultipleCacheManagersTest.java
===================================================================
--- trunk/core/src/test/java/org/infinispan/test/MultipleCacheManagersTest.java 2009-05-26 11:22:05 UTC (rev 340)
+++ trunk/core/src/test/java/org/infinispan/test/MultipleCacheManagersTest.java 2009-05-26 11:30:45 UTC (rev 341)
@@ -176,4 +176,9 @@
LockManager lockManager = TestingUtil.extractLockManager(cache);
assert !lockManager.isLocked(key) : "expected key '" + key + "' not to be locked, and it is by: " + lockManager.getOwner(key);
}
+
+ protected void assertLocked(Cache cache, Object key) {
+ LockManager lockManager = TestingUtil.extractLockManager(cache);
+ assert lockManager.isLocked(key) : "expected key '" + key + "' to be locked, but it is not";
+ }
}
More information about the infinispan-commits
mailing list