[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/eviction ...
Elias Ross
genman at noderunner.net
Sun Nov 19 22:53:56 EST 2006
User: genman
Date: 06/11/19 22:53:56
Modified: tests/functional/org/jboss/cache/eviction
ElementSizePolicyTest.java FIFOPolicyTest.java
Log:
JBCACHE-867, Move methods from the ProxyImpl to Node, refactor Node classes as well
Revision Changes Path
1.9 +4 -4 JBossCache/tests/functional/org/jboss/cache/eviction/ElementSizePolicyTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ElementSizePolicyTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/eviction/ElementSizePolicyTest.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- ElementSizePolicyTest.java 16 Nov 2006 18:41:25 -0000 1.8
+++ ElementSizePolicyTest.java 20 Nov 2006 03:53:56 -0000 1.9
@@ -96,7 +96,7 @@
{
if (i < 6)
{
- int numElements = node.numAttributes();
+ int numElements = node.getNodeSPI().getRawData().size();
assertEquals(i + 1, numElements);
}
else
@@ -106,7 +106,7 @@
}
else
{
- assertEquals(1, node.numAttributes());
+ assertEquals(1, node.getNodeSPI().getRawData().size());
}
}
}
@@ -144,7 +144,7 @@
}
else
{
- assertEquals(1 + i, node.numAttributes());
+ assertEquals(1 + i, node.getData().size());
}
}
@@ -154,7 +154,7 @@
}
DataNode node = cache.get("/org/jboss/data/" + Integer.toString(3));
- assertEquals(21, node.numAttributes());
+ assertEquals(21, node.getData().size());
_sleep(wakeupIntervalMillis + 500);
assertNull(cache.get("/org/jboss/data/" + Integer.toString(3)));
1.10 +21 -34 JBossCache/tests/functional/org/jboss/cache/eviction/FIFOPolicyTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FIFOPolicyTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/eviction/FIFOPolicyTest.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- FIFOPolicyTest.java 16 Nov 2006 18:41:25 -0000 1.9
+++ FIFOPolicyTest.java 20 Nov 2006 03:53:56 -0000 1.10
@@ -17,7 +17,7 @@
* Unit tests for FIFOPolicy.
*
* @author Daniel Huang (dhuang at jboss.org)
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
*/
public class FIFOPolicyTest extends TestCase
{
@@ -101,53 +101,40 @@
}
}
- public void testEviction2()
+ public void testEviction2() throws Exception
{
String rootStr = "/org/jboss/data";
- for (int i = 0; i < 10000; i++)
+ int maxNodes = 5000;
+ for (int i = 0; i < maxNodes * 2; i++)
{
String str = rootStr + i;
Fqn fqn = Fqn.fromString(str);
- try
- {
cache.put(fqn, str, str);
}
- catch (Exception e)
- {
- fail("Failed to insert data" + e);
- e.printStackTrace();
- }
- }
TestingUtil.sleepThread(wakeupIntervalMillis + 500);
- try
- {
- for (int i = 0; i < 5000; i++)
+ assertEquals("Number of nodes", maxNodes + 2, cache.getNumberOfNodes());
+ for (int i = 0; i < maxNodes; i++)
{
- assertNull("DataNode should be empty ",
- cache.get(rootStr + Integer.toString(i), rootStr + Integer.toString(i)));
+ String n = rootStr + i;
+ assertNull("DataNode should be empty " + cache.get(n) + " " + n,
+ cache.get(n, n));
}
- for (int i = 5000; i < 10000; i++)
+ for (int i = maxNodes; i < maxNodes * 2; i++)
{
assertNotNull(cache.get(rootStr + Integer.toString(i), rootStr + Integer.toString(i)));
}
// add another node to cache. this should push node 5000 out of cache.
cache.put(rootStr + "a", rootStr + "a", rootStr + "a");
- for (int i = 5001; i < 10000; i++)
+ for (int i = maxNodes + 1; i < maxNodes; i++)
{
assertNotNull(cache.get(rootStr + Integer.toString(i), rootStr + Integer.toString(i)));
}
assertNotNull(cache.get(rootStr + "a", rootStr + "a"));
}
- catch (Exception e)
- {
- e.printStackTrace();
- fail("Failed to get" + e);
- }
- }
public void testNodeVisited()
{
More information about the jboss-cvs-commits
mailing list