[jbosscache-commits] JBoss Cache SVN: r5885 - core/trunk/src/test/java/org/jboss/cache/api.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Fri May 23 10:49:47 EDT 2008


Author: mircea.markus
Date: 2008-05-23 10:49:47 -0400 (Fri, 23 May 2008)
New Revision: 5885

Modified:
   core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
Log:
JBCACHE-1338 - removed thread sleep statments

Modified: core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java	2008-05-23 14:30:16 UTC (rev 5884)
+++ core/trunk/src/test/java/org/jboss/cache/api/ResidentNodesTest.java	2008-05-23 14:49:47 UTC (rev 5885)
@@ -4,6 +4,7 @@
 import org.jboss.cache.CacheSPI;
 import org.jboss.cache.DefaultCacheFactory;
 import org.jboss.cache.Fqn;
+import org.jboss.cache.util.internals.EvictionController;
 import org.jboss.cache.config.Configuration;
 import org.jboss.cache.config.EvictionConfig;
 import org.jboss.cache.config.EvictionRegionConfig;
@@ -27,6 +28,7 @@
 public class ResidentNodesTest
 {
    private CacheSPI<Object, Object> cache;
+   private EvictionController evController;
 
    private final String TEST_NODES_ROOT = "residentNodesTest";
    private Cache[] caches = {};
@@ -40,6 +42,7 @@
       cache.getConfiguration().getEvictionConfig().setWakeupIntervalSeconds(1);
       createNewRegion();
       cache.start();
+      evController = new EvictionController(cache);
    }
 
    /**
@@ -91,7 +94,7 @@
       cache.put(getSubFqn("/h"), "k_h", "v_h");
       cache.put(getSubFqn("/i"), "k_i", "v_i");
 
-      Thread.sleep(3000);//so that eviction is activated
+      evController.startEviction();
 
       assertTrue(cache.exists(getSubFqn("/a")));
       assertTrue(cache.exists(getSubFqn("/b")));
@@ -113,7 +116,9 @@
       cache.put(getSubFqn("/b"), "k_b", "v_b");
       cache.put(getSubFqn("/c"), "k_c", "v_c");
       cache.put(getSubFqn("/d"), "k_d", "v_d");
-      Thread.sleep(3000);//so that eviction is activated
+
+      evController.startEviction();
+
       assertFalse(cache.exists(getSubFqn("/a")));
       assertTrue(cache.exists(getSubFqn("/b")));
       assertTrue(cache.exists(getSubFqn("/c")));
@@ -145,7 +150,7 @@
       cache.getNode(getSubFqn("/a"));
       cache.getNode(getSubFqn("/b"));
 
-      TestingUtil.sleepThread(3000);//so that eviction is activated
+      evController.startEviction();
 
       //a and b should exist as those were marked resident. Also they shouldn't be caunted as nodes in the eviction
       // queue




More information about the jbosscache-commits mailing list