Author: galder.zamarreno(a)jboss.com
Date: 2009-12-07 04:26:19 -0500 (Mon, 07 Dec 2009)
New Revision: 8314
Modified:
pojo/trunk/src/test/java/org/jboss/cache/pojo/passivation/LocalTest.java
Log:
Added @NodeEvicted callback checks.
Modified: pojo/trunk/src/test/java/org/jboss/cache/pojo/passivation/LocalTest.java
===================================================================
--- pojo/trunk/src/test/java/org/jboss/cache/pojo/passivation/LocalTest.java 2009-12-04
06:38:43 UTC (rev 8313)
+++ pojo/trunk/src/test/java/org/jboss/cache/pojo/passivation/LocalTest.java 2009-12-07
09:26:19 UTC (rev 8314)
@@ -18,6 +18,7 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.notifications.annotation.CacheListener;
import org.jboss.cache.notifications.annotation.NodeActivated;
+import org.jboss.cache.notifications.annotation.NodeEvicted;
import org.jboss.cache.notifications.annotation.NodePassivated;
import org.jboss.cache.notifications.event.NodeEvent;
import org.jboss.cache.pojo.PojoCache;
@@ -84,7 +85,7 @@
private void sanityCheck()
{
- if (listener_.getActivationCount() == 0 || listener_.getPassivationCount() == 0)
+ if (listener_.getActivationCount() == 0 || listener_.getPassivationCount() == 0 ||
listener_.eviction == 0)
{
fail("Sanity checking for passivation failed. Counters: activation - "
+ listener_.getActivationCount()
+ " passivation - " + listener_.getPassivationCount());
@@ -248,6 +249,7 @@
{
int activation = 0;
int passivation = 0;
+ int eviction = 0;
public int getActivationCount()
{
@@ -285,5 +287,15 @@
passivation++;
}
}
+
+ @NodeEvicted
+ public void nodeEvicted(NodeEvent ne)
+ {
+ if (!ne.isPre())
+ {
+ System.out.println("nodeEvicted: " + ne.getFqn());
+ eviction++;
+ }
+ }
}
}