[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/api ...
Manik Surtani
manik at jboss.org
Thu Jun 28 12:53:39 EDT 2007
User: msurtani
Date: 07/06/28 12:53:39
Modified: tests/functional/org/jboss/cache/api CacheAPITest.java
Log:
Notification changes
Revision Changes Path
1.17 +19 -13 JBossCache/tests/functional/org/jboss/cache/api/CacheAPITest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CacheAPITest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/api/CacheAPITest.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- CacheAPITest.java 8 Jun 2007 16:26:41 -0000 1.16
+++ CacheAPITest.java 28 Jun 2007 16:53:39 -0000 1.17
@@ -1,17 +1,18 @@
package org.jboss.cache.api;
import junit.framework.TestCase;
-import org.jboss.cache.AbstractCacheListener;
import org.jboss.cache.Cache;
import org.jboss.cache.CacheFactory;
import org.jboss.cache.CacheImpl;
-import org.jboss.cache.CacheListener;
import org.jboss.cache.DefaultCacheFactory;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.jboss.cache.Region;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.config.ConfigurationException;
+import org.jboss.cache.notifications.annotation.CacheListener;
+import org.jboss.cache.notifications.annotation.NodeCreated;
+import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.transaction.GenericTransactionManagerLookup;
import java.util.ArrayList;
@@ -80,13 +81,18 @@
final List<String> events = new ArrayList<String>();
- CacheListener dummy = new AbstractCacheListener()
+ Object dummy = new Object();
+
+ @CacheListener
+ class Listener
{
- public void nodeCreated(Fqn fqn, boolean pre, boolean isLocal)
+
+ @NodeCreated
+ public void nodeCreated(Event e)
{
- if (pre) events.add("Created");
+ if (e.isPre()) events.add("Created");
+ }
}
- };
cache.addCacheListener(dummy);
@@ -120,11 +126,14 @@
// expected
}
- try
+ @CacheListener
+ class TestListener
{
- cache.addCacheListener(Fqn.ROOT, new AbstractCacheListener()
+ }
+
+ try
{
- });
+ cache.addCacheListener(Fqn.ROOT, new TestListener());
fail("Fqn-based cache listener operation should throw an exception");
}
catch (Exception e)
@@ -134,9 +143,7 @@
try
{
- cache.removeCacheListener(Fqn.ROOT, new AbstractCacheListener()
- {
- });
+ cache.removeCacheListener(Fqn.ROOT, new TestListener());
fail("Fqn-based cache listener operation should throw an exception");
}
catch (Exception e)
@@ -346,5 +353,4 @@
assertTrue(cache.getRoot().getData().isEmpty());
assertTrue(cache.getRoot().getChildren().isEmpty());
}
-
}
More information about the jboss-cvs-commits
mailing list