Author: dereed
Date: 2010-04-09 18:53:15 -0400 (Fri, 09 Apr 2010)
New Revision: 8365
Modified:
core/trunk/src/test/java/org/jboss/cache/eviction/LRUAlgorithmTest.java
Log:
[JBCACHE-1576] Fix LRUAlgorithmTest
Modified: core/trunk/src/test/java/org/jboss/cache/eviction/LRUAlgorithmTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/eviction/LRUAlgorithmTest.java 2010-04-08
09:54:11 UTC (rev 8364)
+++ core/trunk/src/test/java/org/jboss/cache/eviction/LRUAlgorithmTest.java 2010-04-09
22:53:15 UTC (rev 8365)
@@ -71,14 +71,14 @@
/**
- * maxNodes = 0 case
+ * maxNodes = -1 case
*/
public void testMaxNode1() throws EvictionException
{
Fqn fqn1 = Fqn.fromString("/a/b/c");
Fqn fqn2 = Fqn.fromString("/a/b/d");
RegionImpl region = (RegionImpl) regionManager.getRegion("/a/b", true);
- config.setMaxNodes(0);
+ config.setMaxNodes(-1);
region.registerEvictionEvent(fqn1, EvictionEvent.Type.ADD_NODE_EVENT);
region.registerEvictionEvent(fqn2, EvictionEvent.Type.ADD_NODE_EVENT);
@@ -88,12 +88,29 @@
}
/**
- * maxNodes = 1
+ * maxNodes = 0 case
*/
public void testMaxNode2() throws EvictionException
{
Fqn fqn1 = Fqn.fromString("/a/b/c");
Fqn fqn2 = Fqn.fromString("/a/b/d");
+ RegionImpl region = (RegionImpl) regionManager.getRegion("/a/b", true);
+ config.setMaxNodes(0);
+ region.registerEvictionEvent(fqn1, EvictionEvent.Type.ADD_NODE_EVENT);
+ region.registerEvictionEvent(fqn2, EvictionEvent.Type.ADD_NODE_EVENT);
+
+ algorithm.process(region.getEvictionEventQueue());
+
+ assertEquals("Queue size should be ", 0,
algorithm.getEvictionQueue().getNumberOfNodes());
+ }
+
+ /**
+ * maxNodes = 1
+ */
+ public void testMaxNode3() throws EvictionException
+ {
+ Fqn fqn1 = Fqn.fromString("/a/b/c");
+ Fqn fqn2 = Fqn.fromString("/a/b/d");
Fqn fqn3 = Fqn.fromString("/a/b/e");
RegionImpl region = (RegionImpl) regionManager.getRegion("/a/b", true);
config.setMaxNodes(1);
@@ -140,7 +157,7 @@
Fqn fqn2 = Fqn.fromString("/a/b/d");
Fqn fqn3 = Fqn.fromString("/a/b/e");
RegionImpl region = (RegionImpl) regionManager.getRegion("/a/b", true);
- config.setMaxNodes(0);
+ config.setMaxNodes(-1);
config.setTimeToLive(1000);
region.registerEvictionEvent(fqn1, EvictionEvent.Type.ADD_NODE_EVENT);
region.registerEvictionEvent(fqn2, EvictionEvent.Type.ADD_NODE_EVENT);
@@ -165,7 +182,7 @@
Fqn fqn2 = Fqn.fromString("/a/b/d");
Fqn fqn3 = Fqn.fromString("/a/b/e");
RegionImpl region = (RegionImpl) regionManager.getRegion("/a/b", true);
- config.setMaxNodes(0);
+ config.setMaxNodes(-1);
config.setTimeToLive(1000);
region.registerEvictionEvent(fqn1, EvictionEvent.Type.ADD_NODE_EVENT);
region.registerEvictionEvent(fqn2, EvictionEvent.Type.ADD_NODE_EVENT);
@@ -353,4 +370,4 @@
queue.removeNodeEntry(ne);
}
}
-}
\ No newline at end of file
+}
Show replies by date