[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/invalidation ...
Manik Surtani
msurtani at jboss.com
Wed Aug 9 10:50:00 EDT 2006
User: msurtani
Date: 06/08/09 10:50:00
Modified: tests/functional/org/jboss/cache/invalidation
InvalidationInterceptorTest.java
Log:
Merged in fixes from 1.4.0.SP1
Revision Changes Path
1.16 +53 -0 JBossCache/tests/functional/org/jboss/cache/invalidation/InvalidationInterceptorTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: InvalidationInterceptorTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/invalidation/InvalidationInterceptorTest.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- InvalidationInterceptorTest.java 20 Jul 2006 09:03:53 -0000 1.15
+++ InvalidationInterceptorTest.java 9 Aug 2006 14:50:00 -0000 1.16
@@ -520,6 +520,59 @@
caches[1] = null;
}
+ public void testInvalidationWithRegionBasedMarshalling() throws Exception
+ {
+ doRegionBasedTest(false);
+ }
+
+ public void testInvalidationWithRegionBasedMarshallingOptimistic() throws Exception
+ {
+ doRegionBasedTest(true);
+ }
+
+ protected void doRegionBasedTest(boolean optimistic) throws Exception
+ {
+ TreeCache[] caches = new TreeCache[2];
+ caches[0] = createUnstartedCache(false);
+ caches[1] = createUnstartedCache(false);
+
+ caches[0].getConfiguration().setUseRegionBasedMarshalling(true);
+ caches[1].getConfiguration().setUseRegionBasedMarshalling(true);
+
+ if (optimistic)
+ {
+ caches[0].getConfiguration().setNodeLockingScheme("OPTIMISTIC");
+ caches[1].getConfiguration().setNodeLockingScheme("OPTIMISTIC");
+ }
+
+ caches[0].startService();
+ caches[1].startService();
+
+ TestingUtil.blockUntilViewsReceived(caches, 5000);
+
+ Fqn fqn = Fqn.fromString("/a/b");
+
+ assertNull("Should be null", caches[0].get(fqn));
+ assertNull("Should be null", caches[1].get(fqn));
+
+ caches[0].put(fqn, "key", "value");
+ assertEquals("expecting value", "value", caches[0].get(fqn, "key"));
+ assertNull("Should be null", caches[1].get(fqn));
+
+ // now put in caches[1], should fire an eviction
+ caches[1].put(fqn, "key", "value2");
+ assertEquals("expecting value2", "value2", caches[1].get(fqn, "key"));
+ assertNull("Should be null", caches[0].get(fqn));
+
+ // clean up.
+ caches[0].remove(fqn);
+ caches[1].remove(fqn);
+ caches[0].stopService();
+ caches[1].stopService();
+ caches[0] = null;
+ caches[1] = null;
+ }
+
protected TreeCache createUnstartedCache(boolean optimistic) throws Exception
{
TreeCache cache = new TreeCache();
More information about the jboss-cvs-commits
mailing list