[jbosscache-commits] JBoss Cache SVN: r4631 - core/trunk/src/test/java/org/jboss/cache/replicated.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Wed Oct 17 10:58:56 EDT 2007
Author: bstansberry at jboss.com
Date: 2007-10-17 10:58:56 -0400 (Wed, 17 Oct 2007)
New Revision: 4631
Modified:
core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java
Log:
Add test of expected propagation of Cache.removeNode calls.
Modified: core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java
===================================================================
--- core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java 2007-10-17 14:56:50 UTC (rev 4630)
+++ core/trunk/src/test/java/org/jboss/cache/replicated/SyncReplTest.java 2007-10-17 14:58:56 UTC (rev 4631)
@@ -7,8 +7,10 @@
package org.jboss.cache.replicated;
import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
import static org.testng.AssertJUnit.assertNotNull;
import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.assertTrue;
import org.jboss.cache.Cache;
import org.jboss.cache.DefaultCacheFactory;
@@ -96,6 +98,35 @@
assertEquals("Value should have replicated", 38, caches[1].get(fqn, "age"));
}
+ /**
+ * Checks for expected propagation of removeNode calls.
+ */
+ @SuppressWarnings("unchecked")
+ public void testNodeConvenienceNodeRemoval()
+ {
+ // this fqn is relative, but since it is from the root it may as well be absolute
+ Fqn<String> fqn = Fqn.fromString("/test/fqn");
+ caches[0].getRoot().addChild(fqn);
+ assertTrue(caches[0].getRoot().hasChild(fqn));
+ assertTrue(caches[1].getRoot().hasChild(fqn));
+
+ assertEquals(true, caches[0].removeNode(fqn));
+ assertFalse(caches[0].getRoot().hasChild(fqn));
+ assertFalse(caches[1].getRoot().hasChild(fqn));
+ assertEquals(false, caches[0].removeNode(fqn));
+
+ // Confirm it works as expected if the removed node has a child
+ Fqn<String> child = Fqn.fromString("/test/fqn/child");
+ caches[0].getRoot().addChild(child);
+ assertTrue(caches[0].getRoot().hasChild(child));
+ assertTrue(caches[1].getRoot().hasChild(child));
+
+ assertEquals(true, caches[0].removeNode(fqn));
+ assertFalse(caches[0].getRoot().hasChild(fqn));
+ assertFalse(caches[1].getRoot().hasChild(fqn));
+ assertEquals(false, caches[0].removeNode(fqn));
+ }
+
private void assertClusterSize(String message, int size)
{
for (Cache c : caches)
More information about the jbosscache-commits
mailing list