[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/eviction ...
Manik Surtani
manik at jboss.org
Thu Jun 28 12:53:37 EDT 2007
User: msurtani
Date: 07/06/28 12:53:37
Modified: tests/functional/org/jboss/cache/eviction
ReplicatedLRUPolicyTest.java
Log:
Notification changes
Revision Changes Path
1.21 +12 -7 JBossCache/tests/functional/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ReplicatedLRUPolicyTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/eviction/ReplicatedLRUPolicyTest.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- ReplicatedLRUPolicyTest.java 16 Apr 2007 17:37:13 -0000 1.20
+++ ReplicatedLRUPolicyTest.java 28 Jun 2007 16:53:37 -0000 1.21
@@ -1,13 +1,15 @@
package org.jboss.cache.eviction;
import junit.framework.TestCase;
-import org.jboss.cache.AbstractCacheListener;
import org.jboss.cache.CacheImpl;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.config.Configuration.CacheMode;
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.notifications.annotation.CacheListener;
+import org.jboss.cache.notifications.annotation.NodeEvicted;
+import org.jboss.cache.notifications.event.Event;
/**
* @author Ben Wang, Feb 11, 2004
@@ -71,10 +73,10 @@
cache_.put(str, str, str);
TestingUtil.sleepThread(30000);
- String val = (String) cache_.get(str, str);
- assertNull("DataNode should be evicted already ", val);
+ Object node = cache_.peek(Fqn.fromString(str), false);
+ assertNull("DataNode should be evicted already ", node);
assertEquals("Eviction counter ", 1, listener_.getCounter());
- val = (String) cache2_.get(str, str);
+ String val = (String) cache2_.get(str, str);
assertNotNull("DataNode should not be evicted here ", val);
assertEquals("Eviction counter ", 1, listener_.getCounter());
}
@@ -123,7 +125,8 @@
System.out.println("-- " + msg);
}
- class EvictionListener extends AbstractCacheListener
+ @CacheListener
+ class EvictionListener
{
int counter = 0;
@@ -137,9 +140,11 @@
counter = 0;
}
- public void nodeEvicted(Fqn fqn, boolean pre, boolean isLocal)
+ @NodeEvicted
+ public void nodeEvicted(Event e)
{
- if (pre) counter++;
+ System.out.println(e);
+ if (e.isPre()) counter++;
}
}
}
More information about the jboss-cvs-commits
mailing list