[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/invalidation ...
Manik Surtani
msurtani at jboss.com
Tue Aug 8 11:32:55 EDT 2006
User: msurtani
Date: 06/08/08 11:32:55
Modified: tests/functional/org/jboss/cache/invalidation Tag:
Branch_JBossCache_1_4_0
InvalidationInterceptorTest.java
Log:
JBCACHE-715
Revision Changes Path
No revision
No revision
1.14.2.1 +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.14
retrieving revision 1.14.2.1
diff -u -b -r1.14 -r1.14.2.1
--- InvalidationInterceptorTest.java 5 May 2006 12:06:58 -0000 1.14
+++ InvalidationInterceptorTest.java 8 Aug 2006 15:32:55 -0000 1.14.2.1
@@ -519,6 +519,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].setUseRegionBasedMarshalling(true);
+ caches[1].setUseRegionBasedMarshalling(true);
+
+ if (optimistic)
+ {
+ caches[0].setNodeLockingScheme("OPTIMISTIC");
+ caches[1].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("MyCluster", null, 3000);
More information about the jboss-cvs-commits
mailing list