[jbosscache-commits] JBoss Cache SVN: r7099 - core/trunk/src/test/java/org/jboss/cache/invalidation.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Mon Nov 10 04:44:39 EST 2008
Author: mircea.markus
Date: 2008-11-10 04:44:39 -0500 (Mon, 10 Nov 2008)
New Revision: 7099
Modified:
core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java
Log:
fixed intermittent failure - controlled eviction
Modified: core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java 2008-11-10 08:55:21 UTC (rev 7098)
+++ core/trunk/src/test/java/org/jboss/cache/invalidation/TombstoneEvictionTest.java 2008-11-10 09:44:39 UTC (rev 7099)
@@ -11,6 +11,7 @@
import org.jboss.cache.eviction.FIFOAlgorithmConfig;
import org.jboss.cache.transaction.DummyTransactionManagerLookup;
import org.jboss.cache.util.TestingUtil;
+import org.jboss.cache.util.internals.EvictionController;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -30,7 +31,8 @@
private CacheSPI c1, c2;
private Fqn fqn = Fqn.fromString("/data/test");
private Fqn dummy = Fqn.fromString("/data/dummy");
- private long evictionWaitTime = 4100;
+ private EvictionController ec1;
+ private EvictionController ec2;
@BeforeMethod
public void setUp() throws Exception
@@ -69,7 +71,10 @@
c1.start();
c2.start();
+ ec1 = new EvictionController(c1);
+ ec2 = new EvictionController(c2);
+
TestingUtil.blockUntilViewsReceived(60000, c1, c2);
}
@@ -93,10 +98,8 @@
assert c1.peek(fqn, false, true) != null : "Node should exist";
assert c1.peek(dummy, false, true) != null : "Node should exist";
- log.trace("***** testControl() right before sleeping");
- TestingUtil.sleepThread(evictionWaitTime);
- log.trace("***** testControl() right after sleeping");
+ ec1.startEviction();
assert c1.peek(fqn, false, true) == null : "Should have evicted";
assert c1.peek(dummy, false, true) != null : "Node should exist";
@@ -115,7 +118,8 @@
assert c2.peek(fqn, false, true) != null : "Node should exist";
assert c2.peek(dummy, false, true) != null : "Node should exist";
- TestingUtil.sleepThread(evictionWaitTime);
+ ec1.startEviction();
+ ec2.startEviction();
assert c1.peek(fqn, false, true) == null : "Should have evicted";
assert c1.peek(dummy, false, true) != null : "Node should exist";
@@ -136,7 +140,8 @@
assert c2.peek(fqn, false, true) != null : "Node should exist";
assert c2.peek(dummy, false, true) != null : "Node should exist";
- TestingUtil.sleepThread(evictionWaitTime);
+ ec1.startEviction();
+ ec2.startEviction();
assert c1.peek(fqn, false, true) == null : "Should have evicted";
assert c1.peek(dummy, false, true) != null : "Node should exist";
More information about the jbosscache-commits
mailing list