[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/loader ...
Manik Surtani
manik at jboss.org
Thu Jul 12 13:04:36 EDT 2007
User: msurtani
Date: 07/07/12 13:04:36
Modified: tests/functional/org/jboss/cache/loader
UnnecessaryLoadingTest.java
Log:
JBCACHE-1120
Revision Changes Path
1.4 +28 -0 JBossCache/tests/functional/org/jboss/cache/loader/UnnecessaryLoadingTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: UnnecessaryLoadingTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/loader/UnnecessaryLoadingTest.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- UnnecessaryLoadingTest.java 12 Jul 2007 16:35:19 -0000 1.3
+++ UnnecessaryLoadingTest.java 12 Jul 2007 17:04:36 -0000 1.4
@@ -182,4 +182,32 @@
assertTrue(cache.peek(child, false).isDataLoaded());
}
+ public void testDontLoadDataWhenGettingNode()
+ {
+ mockCacheLoader.expects(never()).method("get").withAnyArguments();
+ mockCacheLoader.expects(never()).method("getChildrenNames").withAnyArguments();
+ mockCacheLoader.expects(never()).method("exists").withAnyArguments();
+ mockCacheLoader.expects(never()).method("remove").withAnyArguments();
+ mockCacheLoader.expects(never()).method("removeData").withAnyArguments();
+ mockCacheLoader.expects(never()).method("put").withAnyArguments();
+
+ mockCacheLoader.expects(once()).method("put").with(eq(parent), eq(k), eq(v));
+
+ // create parent and child with data
+ // new nodes being created, will result in loading them from the cache loader first
+ mockCacheLoader.expects(once()).method("get").with(eq(parent));
+
+ cache.put(parent, k, v);
+ assertTrue(cache.peek(parent, false).isDataLoaded());
+ // evict the parent
+ cache.evict(parent, false);
+ assertNull(cache.peek(parent, false));
+
+ mockCacheLoader.expects(once()).method("exists").with(eq(parent)).will(returnValue(true));
+ // now get node.
+ Node n = cache.getRoot().getChild(parent);
+ assertNotNull(n);
+ assertFalse(cache.peek(parent, false).isDataLoaded());
+ }
+
}
More information about the jboss-cvs-commits
mailing list