[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/pojo/passivation ...
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/pojo/passivation
LocalTest.java ReplicatedTest.java
Log:
Notification changes
Revision Changes Path
1.6 +10 -5 JBossCache/tests/functional/org/jboss/cache/pojo/passivation/LocalTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: LocalTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/passivation/LocalTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- LocalTest.java 30 May 2007 11:35:15 -0000 1.5
+++ LocalTest.java 28 Jun 2007 16:53:37 -0000 1.6
@@ -12,9 +12,11 @@
import junit.framework.TestSuite;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.AbstractCacheListener;
import org.jboss.cache.CacheSPI;
import org.jboss.cache.Fqn;
+import org.jboss.cache.notifications.annotation.CacheListener;
+import org.jboss.cache.notifications.annotation.NodeActivated;
+import org.jboss.cache.notifications.event.NodeEvent;
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheFactory;
import org.jboss.cache.pojo.test.Address;
@@ -248,7 +250,8 @@
junit.textui.TestRunner.run(org.jboss.cache.pojo.passivation.LocalTest.suite());
}
- public class MyCacheListener extends AbstractCacheListener
+ @CacheListener
+ public class MyCacheListener
{
int activation = 0;
int passivation = 0;
@@ -269,9 +272,11 @@
passivation = 0;
}
- public void nodeActivated(Fqn fqn, boolean pre, Map<Object, Object> data)
+ @NodeActivated
+ public void nodeActivated(NodeEvent ne)
{
- if (!pre)
+ Fqn fqn = ne.getFqn();
+ if (!ne.isPre())
{
System.out.println("nodeActivated: " + fqn);
activation++;
1.6 +23 -27 JBossCache/tests/functional/org/jboss/cache/pojo/passivation/ReplicatedTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ReplicatedTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/passivation/ReplicatedTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- ReplicatedTest.java 30 May 2007 11:35:15 -0000 1.5
+++ ReplicatedTest.java 28 Jun 2007 16:53:37 -0000 1.6
@@ -27,16 +27,20 @@
import junit.framework.TestSuite;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.cache.AbstractCacheListener;
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.NodeCreated;
+import org.jboss.cache.notifications.annotation.NodeEvicted;
+import org.jboss.cache.notifications.annotation.NodeModified;
+import org.jboss.cache.notifications.annotation.NodePassivated;
+import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheFactory;
import org.jboss.cache.pojo.test.Address;
import org.jboss.cache.pojo.test.Link;
import org.jboss.cache.pojo.test.Person;
-import java.util.Map;
-
/**
* Replicated passivation test.
*
@@ -256,7 +260,8 @@
junit.textui.TestRunner.run(suite());
}
- public class MyCacheListener extends AbstractCacheListener
+ @CacheListener
+ public class MyCacheListener
{
int activation = 0;
int passivation = 0;
@@ -278,39 +283,30 @@
}
- @Override
- public void nodeCreated(Fqn fqn, boolean pre, boolean isLocal)
- {
- System.out.println("Created: " + fqn + " [" + pre + "][" + isLocal + "]");
- }
-
- @Override
- public void nodeEvicted(Fqn fqn, boolean pre, boolean isLocal)
- {
- if (!pre)
- System.out.println("nodeEvicted: " + fqn);
- }
-
- @Override
- public void nodeModified(Fqn fqn, boolean pre, boolean isLocal, ModificationType modType, Map data)
+ @NodeCreated
+ @NodeEvicted
+ @NodeModified
+ public void nodeAccessed(Event e)
{
- System.out.println("Modified: " + fqn + " [" + pre + "][" + isLocal + "] " + modType + " " + data);
+ System.out.println("Event: " + e);
}
- public void nodeActivated(Fqn fqn, boolean pre, Map<Object, Object> data)
+ @NodeActivated
+ public void nodeActivated(Event e)
{
- if (!pre)
+ nodeAccessed(e);
+ if (!e.isPre())
{
- System.out.println("nodeActivated: " + fqn);
activation++;
}
}
- public void nodePassivated(Fqn fqn, boolean pre, Map<Object, Object> data)
+ @NodePassivated
+ public void nodePassivated(Event e)
{
- if (pre)
+ nodeAccessed(e);
+ if (e.isPre())
{
- System.out.println("nodePassivated: " + fqn);
passivation++;
}
}
More information about the jboss-cvs-commits
mailing list