[jboss-cvs] JBossCache/tests/functional/org/jboss/cache ...
Manik Surtani
msurtani at jboss.com
Tue Jul 18 06:50:47 EDT 2006
User: msurtani
Date: 06/07/18 06:50:47
Modified: tests/functional/org/jboss/cache CallbackTest.java
TreeCacheListenerTest.java
Log:
Checked in new Habanero interfaces
Updated codebase to deal with new interfaces
Revision Changes Path
1.8 +36 -32 JBossCache/tests/functional/org/jboss/cache/CallbackTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: CallbackTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/CallbackTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- CallbackTest.java 5 May 2006 12:06:59 -0000 1.7
+++ CallbackTest.java 18 Jul 2006 10:50:47 -0000 1.8
@@ -12,7 +12,7 @@
/**
* Tests whether modifications within callbacks (TreeCacheListener) are handled correctly
* @author Bela Ban
- * @version $Id: CallbackTest.java,v 1.7 2006/05/05 12:06:59 msurtani Exp $
+ * @version $Id: CallbackTest.java,v 1.8 2006/07/18 10:50:47 msurtani Exp $
*/
public class CallbackTest extends TestCase {
TreeCache cache=null, cache2;
@@ -185,14 +185,16 @@
- class ExceptionListener extends AbstractTreeCacheListener {
- public void nodeCreated(Fqn fqn) {
- throw new RuntimeException("this will cause the TX to rollback");
+ class ExceptionListener extends AbstractCacheListener {
+ public void nodeCreated(Fqn fqn, boolean pre, boolean isLocal)
+ {
+ if (pre) throw new RuntimeException("this will cause the TX to rollback");
}
}
- class GetListener extends AbstractTreeCacheListener {
+ class GetListener extends AbstractCacheListener
+ {
TreeCache c;
Fqn my_fqn;
@@ -201,26 +203,34 @@
this.my_fqn=my_fqn;
}
- public void nodeCreated(Fqn fqn) {
- try {
+ public void nodeCreated(Fqn fqn, boolean pre, boolean isLocal) {
+ if (!pre)
+ {
+ try
+ {
TreeNode n=c.get(this.my_fqn);
assertNotNull(n);
}
- catch(CacheException e) {
+ catch(CacheException e)
+ {
fail("listener was unable to do a get(" + my_fqn + ") during callback: " + e);
}
}
+ }
}
- class PutListener extends AbstractTreeCacheListener {
+ class PutListener extends AbstractCacheListener {
TreeCache c;
public PutListener(TreeCache c) {
this.c=c;
}
- public void nodeCreated(Fqn fqn) {
+ public void nodeCreated(Fqn fqn, boolean pre, boolean isLocal)
+ {
+ if (!pre)
+ {
try {
if(!c.exists(FQN_B)) {
System.out.println("PutListener: creating node " + FQN_B);
@@ -232,18 +242,12 @@
fail("listener was unable to update cache during callback: " + e);
}
}
-
}
-
-
+ }
public static Test suite() {
return new TestSuite(CallbackTest.class);
}
- //public static void main(String[] args) {
- // junit.textui.TestRunner.run(suite());
- //}
-
}
1.6 +64 -49 JBossCache/tests/functional/org/jboss/cache/TreeCacheListenerTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: TreeCacheListenerTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/TreeCacheListenerTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- TreeCacheListenerTest.java 6 Apr 2006 16:24:19 -0000 1.5
+++ TreeCacheListenerTest.java 18 Jul 2006 10:50:47 -0000 1.6
@@ -17,10 +17,11 @@
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* @author <a href="mailto:julien at jboss.org">Julien Viet</a>
- * @version $Id: TreeCacheListenerTest.java,v 1.5 2006/04/06 16:24:19 msurtani Exp $
+ * @version $Id: TreeCacheListenerTest.java,v 1.6 2006/07/18 10:50:47 msurtani Exp $
*/
public class TreeCacheListenerTest extends TestCase
{
@@ -101,53 +102,67 @@
el.events.clear();
}
- public static class EventLog extends AbstractTreeCacheListener
+ public static class EventLog implements CacheListener
{
- public final List events = new ArrayList();
- public void nodeCreated(Fqn fqn)
+ public final List<String> events = new ArrayList<String>();
+
+ public void nodeCreated(Fqn fqn, boolean pre, boolean isLocal)
+ {
+ if (!pre)
{
events.add("created " + fqn);
}
- public void nodeRemove(Fqn fqn, boolean pre, boolean isLocal)
+ }
+
+ public void nodeModified(Fqn fqn, boolean pre, boolean isLocal, Map data)
{
- events.add("remove "+
- (pre? "about to remove " : "Removed ") +
+ events.add("modify "+
+ (pre? "about to modify " : "Modified ") +
(isLocal? "local " : "remote ") + fqn);
}
- public void nodeRemoved(Fqn fqn)
+
+ public void nodeRemoved(Fqn fqn, boolean pre, boolean isLocal, Map data)
{
- events.add("removed " + fqn);
+ events.add("remove "+
+ (pre? "about to remove " : "Removed ") +
+ (isLocal? "local " : "remote ") + fqn);
}
- public void nodeLoaded(Fqn fqn)
+
+ public void nodeVisited(Fqn fqn, boolean pre)
{
throw new UnsupportedOperationException();
}
- public void nodeEvicted(Fqn fqn)
+
+ public void nodeEvicted(Fqn fqn, boolean pre, boolean isLocal)
{
throw new UnsupportedOperationException();
}
- public void nodeModify(Fqn fqn, boolean pre, boolean isLocal)
+
+ public void nodeLoaded(Fqn fqn, boolean pre, Map data)
{
- events.add("modify "+
- (pre? "about to modify " : "Modified ") +
- (isLocal? "local " : "remote ") + fqn);
+ throw new UnsupportedOperationException();
}
- public void nodeModified(Fqn fqn)
+
+ public void nodeActivated(Fqn fqn, boolean pre)
{
- events.add("modified " + fqn);
+ throw new UnsupportedOperationException();
}
- public void nodeVisited(Fqn fqn)
+
+ public void nodePassivated(Fqn fqn, boolean pre)
{
throw new UnsupportedOperationException();
}
- public void cacheStarted(TreeCache treeCache)
+
+ public void cacheStarted(CacheSPI cache)
{
throw new UnsupportedOperationException();
}
- public void cacheStopped(TreeCache treeCache)
+
+ public void cacheStopped(CacheSPI cache)
{
throw new UnsupportedOperationException();
}
+
public void viewChange(View view)
{
throw new UnsupportedOperationException();
More information about the jboss-cvs-commits
mailing list