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

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Sun Jan 18 11:31:43 EST 2009


Author: mircea.markus
Date: 2009-01-18 11:31:42 -0500 (Sun, 18 Jan 2009)
New Revision: 7498

Modified:
   core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java
Log:
more strict eviction controll

Modified: core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java	2009-01-18 16:14:57 UTC (rev 7497)
+++ core/trunk/src/test/java/org/jboss/cache/buddyreplication/EvictionOfBuddyBackupsTest.java	2009-01-18 16:31:42 UTC (rev 7498)
@@ -8,6 +8,7 @@
 import org.jboss.cache.eviction.LRUAlgorithmConfig;
 import org.jboss.cache.eviction.NullEvictionAlgorithmConfig;
 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;
@@ -22,15 +23,19 @@
 {
    private CacheSPI cache1, cache2;
    private Fqn fqn = Fqn.fromString("/a/b/c");
+  private EvictionController ec1;
+  private EvictionController ec2;
 
-   @BeforeMethod
+  @BeforeMethod
    public void setUp() throws Exception
    {
       cache1 = createCache(1, null, true, false);
       cache1.getConfiguration().setEvictionConfig(getEvictionConfig());
       cache1.start();
+      ec1 = new EvictionController(cache1);
 
-      cache2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), getClass());
+     cache2 = (CacheSPI) new UnitTestCacheFactory<Object, Object>().createCache(cache1.getConfiguration().clone(), getClass());
+     ec2 = new EvictionController(cache2);
 
       TestingUtil.blockUntilViewsReceived(60000, cache1, cache2);
    }
@@ -50,7 +55,7 @@
       EvictionConfig c = new EvictionConfig();
       EvictionRegionConfig defaultRegion = new EvictionRegionConfig(Fqn.ROOT, new NullEvictionAlgorithmConfig());
       c.setDefaultEvictionRegionConfig(defaultRegion);
-      c.setWakeupInterval(1000);
+      c.setWakeupInterval(0);
 
       LRUAlgorithmConfig lru = new LRUAlgorithmConfig(1000, 1000);
       EvictionRegionConfig subregion = new EvictionRegionConfig(fqn, lru);
@@ -66,7 +71,9 @@
       assert cache2.peek(fqnTransformer.getBackupFqn(cache1.getLocalAddress(), fqn), false, false) != null : "Node should exist on backup";
 
       // now wait for eviction to kick in - for up to 2 secs
-      TestingUtil.sleepThread(2000);
+      TestingUtil.sleepThread(1100);
+      ec1.startEviction();
+      ec2.startEviction();
 
       assert cache1.peek(fqn, false, false) == null : "Node should have evicted";
       assert cache2.peek(fqnTransformer.getBackupFqn(cache1.getLocalAddress(), fqn), false, false) == null : "Node should have evicted on backup";




More information about the jbosscache-commits mailing list