[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/pojo/notification ...
Jason Thomas Greene
jgreene at jboss.com
Fri Jun 29 00:34:01 EDT 2007
User: jgreene
Date: 07/06/29 00:34:01
Modified: tests/functional/org/jboss/cache/pojo/notification
ListTest.java Listener.java MapTest.java
ObjectTest.java ReplicatedListTest.java
ReplicatedMapTest.java ReplicatedObjectTest.java
ReplicatedSetTest.java SetTest.java
Log:
Implement new POJO Annotation Notification API
Revision Changes Path
1.2 +40 -40 JBossCache/tests/functional/org/jboss/cache/pojo/notification/ListTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ListTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/notification/ListTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ListTest.java 7 Jun 2007 05:50:20 -0000 1.1
+++ ListTest.java 29 Jun 2007 04:34:01 -0000 1.2
@@ -30,13 +30,13 @@
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.notification.AttachNotification;
-import org.jboss.cache.pojo.notification.DetachNotification;
-import org.jboss.cache.pojo.notification.ListModifyNotification;
-import org.jboss.cache.pojo.notification.Notification;
+import org.jboss.cache.pojo.notification.event.AttachedEvent;
+import org.jboss.cache.pojo.notification.event.DetachedEvent;
+import org.jboss.cache.pojo.notification.event.ListModifiedEvent;
+import org.jboss.cache.pojo.notification.event.Event;
import org.jboss.cache.pojo.test.Person;
-//$Id: ListTest.java,v 1.1 2007/06/07 05:50:20 jgreene Exp $
+//$Id: ListTest.java,v 1.2 2007/06/29 04:34:01 jgreene Exp $
/**
* Tests list notifications
@@ -69,7 +69,7 @@
cache.stop();
}
- private <T extends Notification> T takeNotification(Class<T> clazz)
+ private <T extends Event> T takeNotification(Class<T> clazz)
{
T notification = listener.take(clazz);
verifyNotification(notification);
@@ -77,7 +77,7 @@
return notification;
}
- protected void verifyNotification(Notification notification)
+ protected void verifyNotification(Event notification)
{
assertSame(cache, notification.getContext().getPojoCache());
assertEquals(true, notification.isLocal());
@@ -95,27 +95,27 @@
list = (List) cache.find("a");
// String attach
- AttachNotification attach = (AttachNotification) takeNotification(AttachNotification.class);
+ AttachedEvent attach = (AttachedEvent) takeNotification(AttachedEvent.class);
assertEquals(test1, attach.getSource());
// List add
- ListModifyNotification modify = takeNotification(ListModifyNotification.class);
- assertEquals(ListModifyNotification.Operation.ADD, modify.getOperation());
+ ListModifiedEvent modify = takeNotification(ListModifiedEvent.class);
+ assertEquals(ListModifiedEvent.Operation.ADD, modify.getOperation());
assertEquals(test1, modify.getValue());
assertEquals(0, modify.getIndex());
// String attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(test2, attach.getSource());
// List add
- modify = takeNotification(ListModifyNotification.class);
- assertEquals(ListModifyNotification.Operation.ADD, modify.getOperation());
+ modify = takeNotification(ListModifiedEvent.class);
+ assertEquals(ListModifiedEvent.Operation.ADD, modify.getOperation());
assertEquals(test2, modify.getValue());
assertEquals(1, modify.getIndex());
// List Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(list, attach.getSource());
}
@@ -132,30 +132,30 @@
list.set(0, test2);
// String attach
- AttachNotification attach = takeNotification(AttachNotification.class);
+ AttachedEvent attach = takeNotification(AttachedEvent.class);
assertEquals(test1, attach.getSource());
// List add
- ListModifyNotification modify = takeNotification(ListModifyNotification.class);
- assertEquals(ListModifyNotification.Operation.ADD, modify.getOperation());
+ ListModifiedEvent modify = takeNotification(ListModifiedEvent.class);
+ assertEquals(ListModifiedEvent.Operation.ADD, modify.getOperation());
assertEquals(test1, modify.getValue());
assertEquals(0, modify.getIndex());
// List Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(list, attach.getSource());
// String detach
- DetachNotification detach = takeNotification(DetachNotification.class);
+ DetachedEvent detach = takeNotification(DetachedEvent.class);
assertEquals(test1, detach.getSource());
// String attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(test2, attach.getSource());
// List set
- modify = takeNotification(ListModifyNotification.class);
- assertEquals(ListModifyNotification.Operation.SET, modify.getOperation());
+ modify = takeNotification(ListModifiedEvent.class);
+ assertEquals(ListModifiedEvent.Operation.SET, modify.getOperation());
assertEquals(test2, modify.getValue());
assertEquals(0, modify.getIndex());
}
@@ -173,37 +173,37 @@
list.remove(1);
// String attach
- AttachNotification attach = takeNotification(AttachNotification.class);
+ AttachedEvent attach = takeNotification(AttachedEvent.class);
assertEquals(test1, attach.getSource());
// List add
- ListModifyNotification modify = takeNotification(ListModifyNotification.class);
- assertEquals(ListModifyNotification.Operation.ADD, modify.getOperation());
+ ListModifiedEvent modify = takeNotification(ListModifiedEvent.class);
+ assertEquals(ListModifiedEvent.Operation.ADD, modify.getOperation());
assertEquals(test1, modify.getValue());
assertEquals(0, modify.getIndex());
// String attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(test2, attach.getSource());
// List add
- modify = takeNotification(ListModifyNotification.class);
- assertEquals(ListModifyNotification.Operation.ADD, modify.getOperation());
+ modify = takeNotification(ListModifiedEvent.class);
+ assertEquals(ListModifiedEvent.Operation.ADD, modify.getOperation());
assertEquals(test2, modify.getValue());
assertEquals(1, modify.getIndex());
// List Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(list, attach.getSource());
// List remove
- modify = takeNotification(ListModifyNotification.class);
- assertEquals(ListModifyNotification.Operation.REMOVE, modify.getOperation());
+ modify = takeNotification(ListModifiedEvent.class);
+ assertEquals(ListModifiedEvent.Operation.REMOVE, modify.getOperation());
assertEquals(test2, modify.getValue());
assertEquals(1, modify.getIndex());
// String detach
- DetachNotification detach = takeNotification(DetachNotification.class);
+ DetachedEvent detach = takeNotification(DetachedEvent.class);
assertEquals(test2, detach.getSource());
}
@@ -225,31 +225,31 @@
cache.attach("a", test);
// String attach
- AttachNotification attach = takeNotification(AttachNotification.class);
+ AttachedEvent attach = takeNotification(AttachedEvent.class);
assertEquals(english, attach.getSource());
// List add
- ListModifyNotification modify = takeNotification(ListModifyNotification.class);
- assertEquals(ListModifyNotification.Operation.ADD, modify.getOperation());
+ ListModifiedEvent modify = takeNotification(ListModifiedEvent.class);
+ assertEquals(ListModifiedEvent.Operation.ADD, modify.getOperation());
assertEquals(english, modify.getValue());
assertEquals(0, modify.getIndex());
// String attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(taiwanese, attach.getSource());
// List add
- modify = takeNotification(ListModifyNotification.class);
- assertEquals(ListModifyNotification.Operation.ADD, modify.getOperation());
+ modify = takeNotification(ListModifiedEvent.class);
+ assertEquals(ListModifiedEvent.Operation.ADD, modify.getOperation());
assertEquals(taiwanese, modify.getValue());
assertEquals(1, modify.getIndex());
// List Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(test.getLanguages(), attach.getSource());
// Person Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(test, attach.getSource());
}
1.2 +22 -48 JBossCache/tests/functional/org/jboss/cache/pojo/notification/Listener.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Listener.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/notification/Listener.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Listener.java 7 Jun 2007 05:50:20 -0000 1.1
+++ Listener.java 29 Jun 2007 04:34:01 -0000 1.2
@@ -25,33 +25,31 @@
import java.util.LinkedList;
import java.util.Queue;
-import junit.framework.AssertionFailedError;
+import org.jboss.cache.pojo.notification.annotation.Attached;
+import org.jboss.cache.pojo.notification.annotation.Detached;
+import org.jboss.cache.pojo.notification.annotation.FieldModified;
+import org.jboss.cache.pojo.notification.annotation.ListModified;
+import org.jboss.cache.pojo.notification.annotation.MapModified;
+import org.jboss.cache.pojo.notification.annotation.PojoCacheListener;
+import org.jboss.cache.pojo.notification.annotation.SetModified;
+import org.jboss.cache.pojo.notification.event.Event;
-import org.jboss.cache.pojo.PojoCacheListener;
-import org.jboss.cache.pojo.notification.ArrayModifyNotification;
-import org.jboss.cache.pojo.notification.AttachNotification;
-import org.jboss.cache.pojo.notification.DetachNotification;
-import org.jboss.cache.pojo.notification.FieldModifyNotification;
-import org.jboss.cache.pojo.notification.ListModifyNotification;
-import org.jboss.cache.pojo.notification.MapModifyNotification;
-import org.jboss.cache.pojo.notification.Notification;
-import org.jboss.cache.pojo.notification.SetModifyNotification;
-
-// $Id: Listener.java,v 1.1 2007/06/07 05:50:20 jgreene Exp $
+// $Id: Listener.java,v 1.2 2007/06/29 04:34:01 jgreene Exp $
/**
* A recoding Listener for notification test package.
*
* @author Jason T. Greene
*/
-class Listener implements PojoCacheListener
+ at PojoCacheListener
+public class Listener
{
- private Queue<Notification> events = new LinkedList<Notification>();
+ private Queue<Event> events = new LinkedList<Event>();
@SuppressWarnings("unchecked")
- public <T extends Notification> T take(Class<T> t)
+ public <T extends Event> T take(Class<T> t)
{
- Notification notification = events.remove();
+ Event notification = events.remove();
if (!t.isInstance(notification))
throw new IllegalStateException("Expected notification type: " + t.getSimpleName() + " but was: " + notification.getClass().getSimpleName());
@@ -63,38 +61,14 @@
events.clear();
}
- public void attach(AttachNotification attach)
- {
- events.offer(attach);
- }
-
- public void detach(DetachNotification detach)
- {
- events.offer(detach);
- }
-
- public void modify(FieldModifyNotification field)
- {
- events.offer(field);
- }
-
- public void modify(SetModifyNotification set)
- {
- events.offer(set);
- }
-
- public void modify(ListModifyNotification list)
- {
- events.offer(list);
- }
-
- public void modify(MapModifyNotification map)
- {
- events.offer(map);
- }
-
- public void modify(ArrayModifyNotification notification)
+ @Attached
+ @Detached
+ @FieldModified
+ @ListModified
+ @SetModified
+ @MapModified
+ public void handle(Event event)
{
- events.offer(notification);
+ events.offer(event);
}
}
\ No newline at end of file
1.2 +32 -32 JBossCache/tests/functional/org/jboss/cache/pojo/notification/MapTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: MapTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/notification/MapTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- MapTest.java 7 Jun 2007 05:50:20 -0000 1.1
+++ MapTest.java 29 Jun 2007 04:34:01 -0000 1.2
@@ -30,13 +30,13 @@
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.notification.AttachNotification;
-import org.jboss.cache.pojo.notification.DetachNotification;
-import org.jboss.cache.pojo.notification.MapModifyNotification;
-import org.jboss.cache.pojo.notification.Notification;
+import org.jboss.cache.pojo.notification.event.AttachedEvent;
+import org.jboss.cache.pojo.notification.event.DetachedEvent;
+import org.jboss.cache.pojo.notification.event.MapModifiedEvent;
+import org.jboss.cache.pojo.notification.event.Event;
import org.jboss.cache.pojo.test.Person;
-//$Id: MapTest.java,v 1.1 2007/06/07 05:50:20 jgreene Exp $
+//$Id: MapTest.java,v 1.2 2007/06/29 04:34:01 jgreene Exp $
/**
* Tests map notifications
@@ -70,7 +70,7 @@
cache.stop();
}
- private <T extends Notification> T takeNotification(Class<T> clazz)
+ private <T extends Event> T takeNotification(Class<T> clazz)
{
T notification = listener.take(clazz);
verifyNotification(notification);
@@ -78,7 +78,7 @@
return notification;
}
- protected void verifyNotification(Notification notification)
+ protected void verifyNotification(Event notification)
{
assertSame(cache, notification.getContext().getPojoCache());
assertEquals(true, notification.isLocal());
@@ -98,27 +98,27 @@
map = (Map) cache.find("a");
// String attach
- AttachNotification attach = takeNotification(AttachNotification.class);
+ AttachedEvent attach = takeNotification(AttachedEvent.class);
assertEquals(test1, attach.getSource());
// Map put
- MapModifyNotification modify = takeNotification(MapModifyNotification.class);
- assertEquals(MapModifyNotification.Operation.PUT, modify.getOperation());
+ MapModifiedEvent modify = takeNotification(MapModifiedEvent.class);
+ assertEquals(MapModifiedEvent.Operation.PUT, modify.getOperation());
assertEquals(key1, modify.getKey());
assertEquals(test1, modify.getValue());
// String attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(test2, attach.getSource());
// Map put
- modify = takeNotification(MapModifyNotification.class);
- assertEquals(MapModifyNotification.Operation.PUT, modify.getOperation());
+ modify = takeNotification(MapModifiedEvent.class);
+ assertEquals(MapModifiedEvent.Operation.PUT, modify.getOperation());
assertEquals(key2, modify.getKey());
assertEquals(test2, modify.getValue());
// Map Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertSame(map, attach.getSource());
}
@@ -138,37 +138,37 @@
map.remove(key2);
// String attach
- AttachNotification attach = takeNotification(AttachNotification.class);
+ AttachedEvent attach = takeNotification(AttachedEvent.class);
assertEquals(test1, attach.getSource());
// Map put
- MapModifyNotification modify = takeNotification(MapModifyNotification.class);
- assertEquals(MapModifyNotification.Operation.PUT, modify.getOperation());
+ MapModifiedEvent modify = takeNotification(MapModifiedEvent.class);
+ assertEquals(MapModifiedEvent.Operation.PUT, modify.getOperation());
assertEquals(key1, modify.getKey());
assertEquals(test1, modify.getValue());
// String attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(test2, attach.getSource());
// Map put
- modify = takeNotification(MapModifyNotification.class);
- assertEquals(MapModifyNotification.Operation.PUT, modify.getOperation());
+ modify = takeNotification(MapModifiedEvent.class);
+ assertEquals(MapModifiedEvent.Operation.PUT, modify.getOperation());
assertEquals(key2, modify.getKey());
assertEquals(test2, modify.getValue());
// Map Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertSame(map, attach.getSource());
// Map remove
- modify = takeNotification(MapModifyNotification.class);
- assertEquals(MapModifyNotification.Operation.REMOVE, modify.getOperation());
+ modify = takeNotification(MapModifiedEvent.class);
+ assertEquals(MapModifiedEvent.Operation.REMOVE, modify.getOperation());
assertEquals(key2, modify.getKey());
assertEquals(test2, modify.getValue());
// String detach
- DetachNotification detach = takeNotification(DetachNotification.class);
+ DetachedEvent detach = takeNotification(DetachedEvent.class);
assertEquals(test2, detach.getSource());
}
@@ -190,31 +190,31 @@
cache.attach("a", test);
// String attach
- AttachNotification attach = takeNotification(AttachNotification.class);
+ AttachedEvent attach = takeNotification(AttachedEvent.class);
assertEquals(drumming, attach.getSource());
// Map put
- MapModifyNotification modify = takeNotification(MapModifyNotification.class);
- assertEquals(MapModifyNotification.Operation.PUT, modify.getOperation());
+ MapModifiedEvent modify = takeNotification(MapModifiedEvent.class);
+ assertEquals(MapModifiedEvent.Operation.PUT, modify.getOperation());
assertEquals(key1, modify.getKey());
assertEquals(drumming, modify.getValue());
// String attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(engineering, attach.getSource());
// Map put
- modify = takeNotification(MapModifyNotification.class);
+ modify = takeNotification(MapModifiedEvent.class);
assertEquals(key2, modify.getKey());
- assertEquals(MapModifyNotification.Operation.PUT, modify.getOperation());
+ assertEquals(MapModifiedEvent.Operation.PUT, modify.getOperation());
assertEquals(engineering, modify.getValue());
// Map Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(test.getHobbies(), attach.getSource());
// Person Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(test, attach.getSource());
}
1.2 +17 -16 JBossCache/tests/functional/org/jboss/cache/pojo/notification/ObjectTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ObjectTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/notification/ObjectTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ObjectTest.java 7 Jun 2007 05:50:20 -0000 1.1
+++ ObjectTest.java 29 Jun 2007 04:34:01 -0000 1.2
@@ -13,14 +13,14 @@
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.notification.AttachNotification;
-import org.jboss.cache.pojo.notification.DetachNotification;
-import org.jboss.cache.pojo.notification.FieldModifyNotification;
-import org.jboss.cache.pojo.notification.Notification;
+import org.jboss.cache.pojo.notification.event.AttachedEvent;
+import org.jboss.cache.pojo.notification.event.DetachedEvent;
+import org.jboss.cache.pojo.notification.event.FieldModifiedEvent;
+import org.jboss.cache.pojo.notification.event.Event;
import org.jboss.cache.pojo.test.Address;
import org.jboss.cache.pojo.test.Person;
-// $Id: ObjectTest.java,v 1.1 2007/06/07 05:50:20 jgreene Exp $
+// $Id: ObjectTest.java,v 1.2 2007/06/29 04:34:01 jgreene Exp $
/**
* Tests attach, detach, and field modify notifications
@@ -43,13 +43,14 @@
String configFile = "META-INF/local-service.xml";
boolean toStart = false;
cache = PojoCacheFactory.createCache(configFile, toStart);
+ cache.getCache().getConfiguration().setNodeLockingOptimistic(true);
cache.start();
listener = new Listener();
cache.addListener(listener);
}
- private <T extends Notification> T takeNotification(Class<T> clazz)
+ private <T extends Event> T takeNotification(Class<T> clazz)
{
T notification = listener.take(clazz);
verifyNotification(notification);
@@ -57,7 +58,7 @@
return notification;
}
- protected void verifyNotification(Notification notification)
+ protected void verifyNotification(Event notification)
{
assertSame(cache, notification.getContext().getPojoCache());
assertEquals(true, notification.isLocal());
@@ -85,7 +86,7 @@
test.setName("Ben");
test.setAge(10);
cache.attach("/a", test);
- AttachNotification attach = takeNotification(AttachNotification.class);
+ AttachedEvent attach = takeNotification(AttachedEvent.class);
assertEquals(test, attach.getSource());
}
@@ -99,11 +100,11 @@
cache.attach("/a", test);
// Address Attach
- AttachNotification attach = takeNotification(AttachNotification.class);
+ AttachedEvent attach = takeNotification(AttachedEvent.class);
assertEquals(addr, attach.getSource());
// Person Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(test, attach.getSource());
}
@@ -115,13 +116,13 @@
cache.attach("/a", test);
// Person Attach
- AttachNotification attach = takeNotification(AttachNotification.class);
+ AttachedEvent attach = takeNotification(AttachedEvent.class);
assertEquals(test, attach.getSource());
cache.detach("/a");
// Person Detach
- DetachNotification detach = takeNotification(DetachNotification.class);
+ DetachedEvent detach = takeNotification(DetachedEvent.class);
assertEquals(test, detach.getSource());
}
@@ -133,12 +134,12 @@
cache.attach("/a", test);
// Person Attach
- AttachNotification attach = takeNotification(AttachNotification.class);
+ AttachedEvent attach = takeNotification(AttachedEvent.class);
assertEquals(test, attach.getSource());
// Field modification
test.setAge(20);
- FieldModifyNotification modify = takeNotification(FieldModifyNotification.class);
+ FieldModifiedEvent modify = takeNotification(FieldModifiedEvent.class);
assertEquals(test, modify.getSource());
assertEquals(test.getClass().getDeclaredField("age"), modify.getField());
assertEquals(20, modify.getValue());
@@ -151,11 +152,11 @@
test.setAddress(addr);
// First Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(addr, attach.getSource());
// Then Modify
- modify = takeNotification(FieldModifyNotification.class);
+ modify = takeNotification(FieldModifiedEvent.class);
assertEquals(test, modify.getSource());
assertEquals(test.getClass().getDeclaredField("address"), modify.getField());
assertEquals(addr, modify.getValue());
1.2 +3 -3 JBossCache/tests/functional/org/jboss/cache/pojo/notification/ReplicatedListTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ReplicatedListTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/notification/ReplicatedListTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ReplicatedListTest.java 7 Jun 2007 05:50:20 -0000 1.1
+++ ReplicatedListTest.java 29 Jun 2007 04:34:01 -0000 1.2
@@ -28,9 +28,9 @@
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.notification.Notification;
+import org.jboss.cache.pojo.notification.event.Event;
-//$Id: ReplicatedListTest.java,v 1.1 2007/06/07 05:50:20 jgreene Exp $
+//$Id: ReplicatedListTest.java,v 1.2 2007/06/29 04:34:01 jgreene Exp $
/**
* Tests replicated list notifications
@@ -64,7 +64,7 @@
listenerCache.stop();
}
- protected void verifyNotification(Notification notification)
+ protected void verifyNotification(Event notification)
{
assertSame(listenerCache, notification.getContext().getPojoCache());
assertEquals(false, notification.isLocal());
1.2 +3 -3 JBossCache/tests/functional/org/jboss/cache/pojo/notification/ReplicatedMapTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ReplicatedMapTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/notification/ReplicatedMapTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ReplicatedMapTest.java 7 Jun 2007 05:50:20 -0000 1.1
+++ ReplicatedMapTest.java 29 Jun 2007 04:34:01 -0000 1.2
@@ -28,9 +28,9 @@
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.notification.Notification;
+import org.jboss.cache.pojo.notification.event.Event;
-//$Id: ReplicatedMapTest.java,v 1.1 2007/06/07 05:50:20 jgreene Exp $
+//$Id: ReplicatedMapTest.java,v 1.2 2007/06/29 04:34:01 jgreene Exp $
/**
* Tests replicated map notifications
@@ -64,7 +64,7 @@
listenerCache.stop();
}
- protected void verifyNotification(Notification notification)
+ protected void verifyNotification(Event notification)
{
assertSame(listenerCache, notification.getContext().getPojoCache());
assertEquals(false, notification.isLocal());
1.2 +3 -3 JBossCache/tests/functional/org/jboss/cache/pojo/notification/ReplicatedObjectTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ReplicatedObjectTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/notification/ReplicatedObjectTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ReplicatedObjectTest.java 7 Jun 2007 05:50:20 -0000 1.1
+++ ReplicatedObjectTest.java 29 Jun 2007 04:34:01 -0000 1.2
@@ -28,9 +28,9 @@
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.notification.Notification;
+import org.jboss.cache.pojo.notification.event.Event;
-//$Id: ReplicatedObjectTest.java,v 1.1 2007/06/07 05:50:20 jgreene Exp $
+//$Id: ReplicatedObjectTest.java,v 1.2 2007/06/29 04:34:01 jgreene Exp $
/**
* Tests replicated set notifications
@@ -64,7 +64,7 @@
listenerCache.stop();
}
- protected void verifyNotification(Notification notification)
+ protected void verifyNotification(Event notification)
{
assertSame(listenerCache, notification.getContext().getPojoCache());
assertEquals(false, notification.isLocal());
1.2 +3 -3 JBossCache/tests/functional/org/jboss/cache/pojo/notification/ReplicatedSetTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ReplicatedSetTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/notification/ReplicatedSetTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- ReplicatedSetTest.java 7 Jun 2007 05:50:20 -0000 1.1
+++ ReplicatedSetTest.java 29 Jun 2007 04:34:01 -0000 1.2
@@ -28,9 +28,9 @@
import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheFactory;
-import org.jboss.cache.pojo.notification.Notification;
+import org.jboss.cache.pojo.notification.event.Event;
-//$Id: ReplicatedSetTest.java,v 1.1 2007/06/07 05:50:20 jgreene Exp $
+//$Id: ReplicatedSetTest.java,v 1.2 2007/06/29 04:34:01 jgreene Exp $
/**
* Tests replicated set notifications
@@ -64,7 +64,7 @@
listenerCache.stop();
}
- protected void verifyNotification(Notification notification)
+ protected void verifyNotification(Event notification)
{
assertSame(listenerCache, notification.getContext().getPojoCache());
assertEquals(false, notification.isLocal());
1.2 +32 -28 JBossCache/tests/functional/org/jboss/cache/pojo/notification/SetTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SetTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/pojo/notification/SetTest.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- SetTest.java 7 Jun 2007 05:50:20 -0000 1.1
+++ SetTest.java 29 Jun 2007 04:34:01 -0000 1.2
@@ -30,9 +30,13 @@
import org.jboss.cache.pojo.PojoCache;
import org.jboss.cache.pojo.PojoCacheFactory;
+import org.jboss.cache.pojo.notification.event.AttachedEvent;
+import org.jboss.cache.pojo.notification.event.DetachedEvent;
+import org.jboss.cache.pojo.notification.event.Event;
+import org.jboss.cache.pojo.notification.event.SetModifiedEvent;
import org.jboss.cache.pojo.test.Person;
-//$Id: SetTest.java,v 1.1 2007/06/07 05:50:20 jgreene Exp $
+//$Id: SetTest.java,v 1.2 2007/06/29 04:34:01 jgreene Exp $
/**
* Tests set notifications
@@ -65,7 +69,7 @@
cache.stop();
}
- private <T extends Notification> T takeNotification(Class<T> clazz)
+ private <T extends Event> T takeNotification(Class<T> clazz)
{
T notification = listener.take(clazz);
verifyNotification(notification);
@@ -73,7 +77,7 @@
return notification;
}
- protected void verifyNotification(Notification notification)
+ protected void verifyNotification(Event notification)
{
assertSame(cache, notification.getContext().getPojoCache());
assertEquals(true, notification.isLocal());
@@ -92,25 +96,25 @@
set = (Set) cache.find("a");
// String attach
- AttachNotification attach = takeNotification(AttachNotification.class);
+ AttachedEvent attach = takeNotification(AttachedEvent.class);
assertEquals(test1, attach.getSource());
// Set add
- SetModifyNotification modify = takeNotification(SetModifyNotification.class);
- assertEquals(SetModifyNotification.Operation.ADD, modify.getOperation());
+ SetModifiedEvent modify = takeNotification(SetModifiedEvent.class);
+ assertEquals(SetModifiedEvent.Operation.ADD, modify.getOperation());
assertEquals(test1, modify.getValue());
// String attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(test2, attach.getSource());
// Set add
- modify = takeNotification(SetModifyNotification.class);
- assertEquals(SetModifyNotification.Operation.ADD, modify.getOperation());
+ modify = takeNotification(SetModifiedEvent.class);
+ assertEquals(SetModifiedEvent.Operation.ADD, modify.getOperation());
assertEquals(test2, modify.getValue());
// Set Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertSame(set, attach.getSource());
}
@@ -130,34 +134,34 @@
set.remove(test2);
// String attach
- AttachNotification attach = takeNotification(AttachNotification.class);
+ AttachedEvent attach = takeNotification(AttachedEvent.class);
assertEquals(test1, attach.getSource());
// Set add
- SetModifyNotification modify = takeNotification(SetModifyNotification.class);
- assertEquals(SetModifyNotification.Operation.ADD, modify.getOperation());
+ SetModifiedEvent modify = takeNotification(SetModifiedEvent.class);
+ assertEquals(SetModifiedEvent.Operation.ADD, modify.getOperation());
assertEquals(test1, modify.getValue());
// String attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(test2, attach.getSource());
// Set add
- modify = takeNotification(SetModifyNotification.class);
- assertEquals(SetModifyNotification.Operation.ADD, modify.getOperation());
+ modify = takeNotification(SetModifiedEvent.class);
+ assertEquals(SetModifiedEvent.Operation.ADD, modify.getOperation());
assertEquals(test2, modify.getValue());
// Set Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertSame(set, attach.getSource());
// Set remove
- modify = takeNotification(SetModifyNotification.class);
- assertEquals(SetModifyNotification.Operation.REMOVE, modify.getOperation());
+ modify = takeNotification(SetModifiedEvent.class);
+ assertEquals(SetModifiedEvent.Operation.REMOVE, modify.getOperation());
assertEquals(test2, modify.getValue());
// String detach
- DetachNotification detach = takeNotification(DetachNotification.class);
+ DetachedEvent detach = takeNotification(DetachedEvent.class);
assertEquals(test2, detach.getSource());
}
@@ -177,29 +181,29 @@
cache.attach("a", test);
// String attach
- AttachNotification attach = takeNotification(AttachNotification.class);
+ AttachedEvent attach = takeNotification(AttachedEvent.class);
assertEquals(drumming, attach.getSource());
// List add
- SetModifyNotification modify = takeNotification(SetModifyNotification.class);
- assertEquals(SetModifyNotification.Operation.ADD, modify.getOperation());
+ SetModifiedEvent modify = takeNotification(SetModifiedEvent.class);
+ assertEquals(SetModifiedEvent.Operation.ADD, modify.getOperation());
assertEquals(drumming, modify.getValue());
// String attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(engineering, attach.getSource());
// List add
- modify = takeNotification(SetModifyNotification.class);
- assertEquals(SetModifyNotification.Operation.ADD, modify.getOperation());
+ modify = takeNotification(SetModifiedEvent.class);
+ assertEquals(SetModifiedEvent.Operation.ADD, modify.getOperation());
assertEquals(engineering, modify.getValue());
// List Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(test.getSkills(), attach.getSource());
// Person Attach
- attach = takeNotification(AttachNotification.class);
+ attach = takeNotification(AttachedEvent.class);
assertEquals(test, attach.getSource());
}
More information about the jboss-cvs-commits
mailing list