[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/notifications ...
Manik Surtani
manik at jboss.org
Tue Jul 3 06:54:10 EDT 2007
User: msurtani
Date: 07/07/03 06:54:10
Modified: tests/functional/org/jboss/cache/notifications
AnnotationsTest.java
Log:
Tests multiple annotations
Revision Changes Path
1.3 +71 -0 JBossCache/tests/functional/org/jboss/cache/notifications/AnnotationsTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AnnotationsTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/notifications/AnnotationsTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- AnnotationsTest.java 2 Jul 2007 10:49:04 -0000 1.2
+++ AnnotationsTest.java 3 Jul 2007 10:54:10 -0000 1.3
@@ -10,6 +10,8 @@
import org.jboss.cache.notifications.event.Event;
import org.jboss.cache.notifications.event.NodeMovedEvent;
+import java.util.List;
+
/**
* Tests both correct and incorrect annotations for listeners
*
@@ -171,6 +173,37 @@
}
}
+ public void testMultipleMethods()
+ {
+ Object l = new TestMultipleMethodsListener();
+ n.addCacheListener(l);
+ List invocations = (List) n.listenerInvocations.get(CacheStarted.class);
+ assertEquals(1, invocations.size());
+ invocations = (List) n.listenerInvocations.get(CacheStopped.class);
+ assertEquals(1, invocations.size());
+ assertEquals(1, n.getCacheListeners().size());
+ }
+
+ public void testMultipleAnnotationsOneMethod()
+ {
+ Object l = new TestMultipleAnnotationsOneMethodListener();
+ n.addCacheListener(l);
+ List invocations = (List) n.listenerInvocations.get(CacheStarted.class);
+ assertEquals(1, invocations.size());
+ invocations = (List) n.listenerInvocations.get(CacheStopped.class);
+ assertEquals(1, invocations.size());
+ assertEquals(1, n.getCacheListeners().size());
+ }
+
+ public void testMultipleMethodsOneAnnotation()
+ {
+ Object l = new TestMultipleMethodsOneAnnotationListener();
+ n.addCacheListener(l);
+ List invocations = (List) n.listenerInvocations.get(CacheStarted.class);
+ assertEquals(2, invocations.size());
+ assertEquals(1, n.getCacheListeners().size());
+ }
+
@CacheListener
public class TestControlListener
{
@@ -272,4 +305,42 @@
{
}
}
+
+ @CacheListener
+ public class TestMultipleMethodsListener
+ {
+ @CacheStarted
+ public void callback1(Event e)
+ {
+ }
+
+ @CacheStopped
+ public void callback2(Event e)
+ {
+ }
+ }
+
+ @CacheListener
+ public class TestMultipleAnnotationsOneMethodListener
+ {
+ @CacheStopped
+ @CacheStarted
+ public void callback(Event nme)
+ {
+ }
+ }
+
+ @CacheListener
+ public class TestMultipleMethodsOneAnnotationListener
+ {
+ @CacheStarted
+ public void callback1(Event e)
+ {
+ }
+
+ @CacheStarted
+ public void callback2(Event e)
+ {
+ }
+ }
}
More information about the jboss-cvs-commits
mailing list