[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/api ...
Manik Surtani
msurtani at jboss.com
Sat Dec 30 12:49:53 EST 2006
User: msurtani
Date: 06/12/30 12:49:53
Modified: tests/functional/org/jboss/cache/api
SyncReplTxTest.java NodeAPITest.java
NodeReplicatedMoveTest.java CacheAPITest.java
NodeMoveAPITest.java SyncReplTest.java
Log:
Major changes to restructure cache and node object model
Revision Changes Path
1.3 +14 -17 JBossCache/tests/functional/org/jboss/cache/api/SyncReplTxTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SyncReplTxTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/api/SyncReplTxTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- SyncReplTxTest.java 31 Oct 2006 06:57:28 -0000 1.2
+++ SyncReplTxTest.java 30 Dec 2006 17:49:53 -0000 1.3
@@ -9,24 +9,21 @@
import junit.framework.TestCase;
import org.jboss.cache.Cache;
-import org.jboss.cache.Fqn;
-import org.jboss.cache.Node;
import org.jboss.cache.CacheSPI;
-import org.jboss.cache.TreeCacheProxyImpl;
+import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
-import org.jboss.cache.transaction.DummyTransactionManager;
+import org.jboss.cache.Node;
import org.jboss.cache.config.Option;
-import org.jboss.cache.misc.TestingUtil;
import org.jboss.cache.factories.DefaultCacheFactory;
+import org.jboss.cache.misc.TestingUtil;
+import org.jboss.cache.transaction.DummyTransactionManager;
-import javax.transaction.Transaction;
-import javax.transaction.SystemException;
-import javax.transaction.NotSupportedException;
import javax.transaction.HeuristicMixedException;
import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
import javax.transaction.RollbackException;
-import java.util.Map;
-import java.util.HashMap;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
/**
* @author <a href="mailto:manik at jboss.org">Manik Surtani (manik at jboss.org)</a>
@@ -76,16 +73,16 @@
Fqn f = Fqn.fromString("/test/data");
String k = "key", v = "value";
- assertNull("Should be null", caches[0].getChild(f));
- assertNull("Should be null", caches[1].getChild(f));
+ assertNull("Should be null", caches[0].getRoot().getChild(f));
+ assertNull("Should be null", caches[1].getRoot().getChild(f));
- Node node = caches[0].addChild(f);
+ Node node = caches[0].getRoot().addChild(f);
assertNotNull("Should not be null", node);
Transaction tx = beginTransaction();
node.put(k, v);
- Transaction tx1 = ((CacheSPI)caches[0]).getInvocationContext().getTransaction();
+ Transaction tx1 = caches[0].getInvocationContext().getTransaction();
assertNotNull("Transaction can't be null ", tx1);
tx.commit();
@@ -98,13 +95,13 @@
{
for (Cache c : caches)
{
- assertClusterSize(message, size, (TreeCacheProxyImpl) c);
+ assertClusterSize(message, size, c);
}
}
- private void assertClusterSize(String message, int size, TreeCacheProxyImpl tcpi)
+ private void assertClusterSize(String message, int size, Cache c)
{
- assertEquals(message, size, tcpi.treeCache.getMembers().size());
+ assertEquals(message, size, c.getMembers().size());
}
private void assertInvocationContextInitState()
1.7 +6 -10 JBossCache/tests/functional/org/jboss/cache/api/NodeAPITest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: NodeAPITest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/api/NodeAPITest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- NodeAPITest.java 22 Dec 2006 03:53:30 -0000 1.6
+++ NodeAPITest.java 30 Dec 2006 17:49:53 -0000 1.7
@@ -1,11 +1,9 @@
package org.jboss.cache.api;
import junit.framework.TestCase;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheImpl;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
-import org.jboss.cache.TreeCache;
-import org.jboss.cache.TreeCacheProxyImpl;
import org.jboss.cache.factories.DefaultCacheFactory;
import javax.transaction.TransactionManager;
@@ -21,8 +19,7 @@
{
private Node rootNode;
- private CacheSPI cache;
- private TreeCache treeCache;
+ private CacheImpl cache;
private TransactionManager tm;
@@ -32,10 +29,9 @@
protected void setUp()
{
// start a single cache instance
- cache = (CacheSPI) DefaultCacheFactory.createCache("META-INF/local-tx-service.xml");
+ cache = (CacheImpl) DefaultCacheFactory.createCache("META-INF/local-tx-service.xml");
rootNode = cache.getRoot();
tm = cache.getTransactionManager();
- treeCache = ((TreeCacheProxyImpl) cache).treeCache;
}
protected void tearDown()
@@ -96,13 +92,13 @@
Node nodeC = nodeB.addChild(C);
assertEquals(3, cache.getNumberOfNodes());
- assertEquals(4, treeCache.getNumberOfLocksHeld());
+ assertEquals(4, cache.getNumberOfLocksHeld());
tm.commit();
tm.begin();
- assertEquals(0, treeCache.getNumberOfLocksHeld());
+ assertEquals(0, cache.getNumberOfLocksHeld());
nodeC.put("key", "value");
- assertEquals(4, treeCache.getNumberOfLocksHeld());
+ assertEquals(4, cache.getNumberOfLocksHeld());
tm.commit();
}
1.6 +38 -38 JBossCache/tests/functional/org/jboss/cache/api/NodeReplicatedMoveTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: NodeReplicatedMoveTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/api/NodeReplicatedMoveTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- NodeReplicatedMoveTest.java 16 Nov 2006 13:43:22 -0000 1.5
+++ NodeReplicatedMoveTest.java 30 Dec 2006 17:49:53 -0000 1.6
@@ -62,20 +62,20 @@
nodeA.put(k, vA);
nodeB.put(k, vB);
- assertEquals(vA, cache[0].getChild(A).get(k));
- assertEquals(vB, cache[0].getChild(A).getChild(B).get(k));
+ assertEquals(vA, cache[0].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[0].getRoot().getChild(A).getChild(B).get(k));
- assertEquals(vA, cache[1].getChild(A).get(k));
- assertEquals(vB, cache[1].getChild(A).getChild(B).get(k));
+ assertEquals(vA, cache[1].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[1].getRoot().getChild(A).getChild(B).get(k));
// now move...
nodeB.move(rootNode);
- assertEquals(vA, cache[0].getChild(A).get(k));
- assertEquals(vB, cache[0].getChild(B).get(k));
+ assertEquals(vA, cache[0].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[0].getRoot().getChild(B).get(k));
- assertEquals(vA, cache[1].getChild(A).get(k));
- assertEquals(vB, cache[1].getChild(B).get(k));
+ assertEquals(vA, cache[1].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[1].getRoot().getChild(B).get(k));
}
public void testInvalidations() throws Exception
@@ -93,27 +93,27 @@
nodeA.put(k, vA);
nodeB.put(k, vB);
- assertEquals(vA, cache[0].getChild(A).get(k));
- assertEquals(vB, cache[0].getChild(A).getChild(B).get(k));
+ assertEquals(vA, cache[0].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[0].getRoot().getChild(A).getChild(B).get(k));
- assertNull(cache[1].getChild(A));
- assertNull(cache[1].getChild(B));
+ assertNull(cache[1].getRoot().getChild(A));
+ assertNull(cache[1].getRoot().getChild(B));
// now move...
nodeB.move(rootNode);
- assertEquals(vA, cache[0].getChild(A).get(k));
- assertEquals(vB, cache[0].getChild(B).get(k));
+ assertEquals(vA, cache[0].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[0].getRoot().getChild(B).get(k));
- assertNull(cache[1].getChild(A));
- assertNull(cache[1].getChild(B));
+ assertNull(cache[1].getRoot().getChild(A));
+ assertNull(cache[1].getRoot().getChild(B));
// now make sure a node exists on cache 2
- cache[1].addChild(A);
+ cache[1].getRoot().addChild(A);
try
{
- cache[0].getChild(B).move(cache[0].getChild(A)); // should throw an NPE
+ cache[0].getRoot().getChild(B).move(cache[0].getRoot().getChild(A)); // should throw an NPE
fail("Expecting an exception");
}
catch (Exception e)
@@ -130,25 +130,25 @@
nodeA.put(k, vA);
nodeB.put(k, vB);
- assertEquals(vA, cache[0].getChild(A).get(k));
- assertEquals(vB, cache[0].getChild(A).getChild(B).get(k));
+ assertEquals(vA, cache[0].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[0].getRoot().getChild(A).getChild(B).get(k));
- assertEquals(vA, cache[1].getChild(A).get(k));
- assertEquals(vB, cache[1].getChild(A).getChild(B).get(k));
+ assertEquals(vA, cache[1].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[1].getRoot().getChild(A).getChild(B).get(k));
// now move...
tm.begin();
nodeB.move(rootNode);
- assertEquals(vA, cache[0].getChild(A).get(k));
- assertEquals(vB, cache[0].getChild(B).get(k));
+ assertEquals(vA, cache[0].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[0].getRoot().getChild(B).get(k));
tm.commit();
- assertEquals(vA, cache[0].getChild(A).get(k));
- assertEquals(vB, cache[0].getChild(B).get(k));
- assertEquals(vA, cache[1].getChild(A).get(k));
- assertEquals(vB, cache[1].getChild(B).get(k));
+ assertEquals(vA, cache[0].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[0].getRoot().getChild(B).get(k));
+ assertEquals(vA, cache[1].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[1].getRoot().getChild(B).get(k));
}
@@ -160,24 +160,24 @@
nodeA.put(k, vA);
nodeB.put(k, vB);
- assertEquals(vA, cache[0].getChild(A).get(k));
- assertEquals(vB, cache[0].getChild(A).getChild(B).get(k));
- assertEquals(vA, cache[1].getChild(A).get(k));
- assertEquals(vB, cache[1].getChild(A).getChild(B).get(k));
+ assertEquals(vA, cache[0].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[0].getRoot().getChild(A).getChild(B).get(k));
+ assertEquals(vA, cache[1].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[1].getRoot().getChild(A).getChild(B).get(k));
// now move...
tm.begin();
nodeB.move(rootNode);
- assertEquals(vA, cache[0].getChild(A).get(k));
- assertEquals(vB, cache[0].getChild(B).get(k));
+ assertEquals(vA, cache[0].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[0].getRoot().getChild(B).get(k));
tm.rollback();
- assertEquals(vA, cache[0].getChild(A).get(k));
- assertEquals(vB, cache[0].getChild(A).getChild(B).get(k));
- assertEquals(vA, cache[1].getChild(A).get(k));
- assertEquals(vB, cache[1].getChild(A).getChild(B).get(k));
+ assertEquals(vA, cache[0].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[0].getRoot().getChild(A).getChild(B).get(k));
+ assertEquals(vA, cache[1].getRoot().getChild(A).get(k));
+ assertEquals(vB, cache[1].getRoot().getChild(A).getChild(B).get(k));
}
public void testReplConcurrency()
1.7 +33 -30 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.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- CacheAPITest.java 20 Nov 2006 03:53:56 -0000 1.6
+++ CacheAPITest.java 30 Dec 2006 17:49:53 -0000 1.7
@@ -3,6 +3,7 @@
import junit.framework.TestCase;
import org.jboss.cache.AbstractCacheListener;
import org.jboss.cache.Cache;
+import org.jboss.cache.CacheImpl;
import org.jboss.cache.CacheListener;
import org.jboss.cache.DummyTransactionManagerLookup;
import org.jboss.cache.Fqn;
@@ -96,7 +97,7 @@
assertEquals(1, cache.getCacheListeners().size());
- cache.addChild(Fqn.fromString("/blah"));
+ cache.getRoot().addChild(Fqn.fromString("/blah"));
// test that the event was captured by the listener.
@@ -175,6 +176,8 @@
cache.put(fqn, data);
+ System.out.println(((CacheImpl) cache).printDetails());
+
assertEquals(value, cache.get(fqn, key));
}
@@ -186,11 +189,11 @@
{
// this fqn is relative, but since it is from the root it may as well be absolute
Fqn fqn = Fqn.fromString("/test/fqn");
- cache.addChild(fqn);
- assertTrue(cache.hasChild(fqn));
+ cache.getRoot().addChild(fqn);
+ assertTrue(cache.getRoot().hasChild(fqn));
cache.removeNode(fqn);
- assertFalse(cache.hasChild(fqn));
+ assertFalse(cache.getRoot().hasChild(fqn));
}
/**
@@ -202,34 +205,34 @@
Fqn two = Fqn.fromString("/one/two");
Object key = "key", value = "value";
- cache.addChild(one).put(key, value);
- cache.addChild(two).put(key, value);
+ cache.getRoot().addChild(one).put(key, value);
+ cache.getRoot().addChild(two).put(key, value);
- assertTrue(cache.hasChild(one));
- assertFalse(cache.getChild(one).getData().isEmpty());
- assertTrue(cache.hasChild(two));
- assertFalse(cache.getChild(two).getData().isEmpty());
+ assertTrue(cache.getRoot().hasChild(one));
+ assertFalse(cache.getRoot().getChild(one).getData().isEmpty());
+ assertTrue(cache.getRoot().hasChild(two));
+ assertFalse(cache.getRoot().getChild(two).getData().isEmpty());
// evict two
cache.evict(two, false);
- assertTrue(cache.hasChild(one));
- assertTrue(cache.getChild(one).getKeys().contains(key));
- assertFalse(cache.hasChild(two));
+ assertTrue(cache.getRoot().hasChild(one));
+ assertTrue(cache.getRoot().getChild(one).getKeys().contains(key));
+ assertFalse(cache.getRoot().hasChild(two));
// now add 2 again...
- cache.addChild(two).put(key, value);
+ cache.getRoot().addChild(two).put(key, value);
// now evict one, NOT recursive
cache.evict(one, false);
// one will NOT be removed, just emptied.
- assertTrue(cache.hasChild(one));
- assertFalse(cache.getChild(one).getKeys().contains(key));
+ assertTrue(cache.getRoot().hasChild(one));
+ assertFalse(cache.getRoot().getChild(one).getKeys().contains(key));
// two will be unaffected
- assertTrue(cache.hasChild(two));
- assertTrue(cache.getChild(two).getKeys().contains(key));
+ assertTrue(cache.getRoot().hasChild(two));
+ assertTrue(cache.getRoot().getChild(two).getKeys().contains(key));
}
@@ -242,29 +245,29 @@
Fqn two = Fqn.fromString("/one/two");
Object key = "key", value = "value";
- cache.addChild(one).put(key, value);
- cache.addChild(two).put(key, value);
+ cache.getRoot().addChild(one).put(key, value);
+ cache.getRoot().addChild(two).put(key, value);
- assertTrue(cache.hasChild(one));
- assertFalse(cache.getChild(one).getData().isEmpty());
- assertTrue(cache.hasChild(two));
- assertFalse(cache.getChild(two).getData().isEmpty());
+ assertTrue(cache.getRoot().hasChild(one));
+ assertFalse(cache.getRoot().getChild(one).getData().isEmpty());
+ assertTrue(cache.getRoot().hasChild(two));
+ assertFalse(cache.getRoot().getChild(two).getData().isEmpty());
// evict two
cache.evict(two, true);
- assertTrue(cache.hasChild(one));
- assertFalse(cache.getChild(one).getData().isEmpty());
- assertFalse(cache.hasChild(two));
+ assertTrue(cache.getRoot().hasChild(one));
+ assertFalse(cache.getRoot().getChild(one).getData().isEmpty());
+ assertFalse(cache.getRoot().hasChild(two));
// now add 2 again...
- cache.addChild(two).put(key, value);
+ cache.getRoot().addChild(two).put(key, value);
// now evict one, recursive
cache.evict(one, true);
- assertFalse(cache.hasChild(one));
- assertFalse(cache.hasChild(two));
+ assertFalse(cache.getRoot().hasChild(one));
+ assertFalse(cache.getRoot().hasChild(two));
}
1.15 +20 -24 JBossCache/tests/functional/org/jboss/cache/api/NodeMoveAPITest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: NodeMoveAPITest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/api/NodeMoveAPITest.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- NodeMoveAPITest.java 22 Dec 2006 03:53:30 -0000 1.14
+++ NodeMoveAPITest.java 30 Dec 2006 17:49:53 -0000 1.15
@@ -1,12 +1,10 @@
package org.jboss.cache.api;
import EDU.oswego.cs.dl.util.concurrent.Latch;
-import org.jboss.cache.CacheSPI;
+import org.jboss.cache.CacheImpl;
import org.jboss.cache.Fqn;
import org.jboss.cache.Node;
import org.jboss.cache.NodeNotExistsException;
-import org.jboss.cache.TreeCache;
-import org.jboss.cache.TreeCacheProxyImpl;
import org.jboss.cache.config.Configuration;
import org.jboss.cache.factories.DefaultCacheFactory;
import org.jboss.cache.loader.AbstractCacheLoaderTestBase;
@@ -26,11 +24,10 @@
{
protected Node rootNode, nodeA, nodeB, nodeC, nodeD, nodeE;
- protected CacheSPI cache;
+ protected CacheImpl cache;
protected TransactionManager tm;
protected static final Fqn A = Fqn.fromString("/a"), B = Fqn.fromString("/b"), C = Fqn.fromString("/c"), D = Fqn.fromString("/d"), E = Fqn.fromString("/e");
protected Object k = "key", vA = "valueA", vB = "valueB", vC = "valueC", vD = "valueD", vE = "valueE";
- protected TreeCache treeCache;
protected boolean optimistic = false;
@@ -38,12 +35,11 @@
protected void setUp() throws Exception
{
// start a single cache instance
- cache = (CacheSPI) DefaultCacheFactory.createCache("META-INF/local-tx-service.xml", false);
+ cache = (CacheImpl) DefaultCacheFactory.createCache("META-INF/local-tx-service.xml", false);
cache.getConfiguration().setNodeLockingScheme(optimistic ? Configuration.NodeLockingScheme.OPTIMISTIC : Configuration.NodeLockingScheme.PESSIMISTIC);
cache.start();
rootNode = cache.getRoot();
tm = cache.getTransactionManager();
- treeCache = ((TreeCacheProxyImpl) cache).treeCache;
}
protected void tearDown()
@@ -84,7 +80,7 @@
nodeC.move(nodeB);
log.info("POST MOVE " + cache);
log.info("HC " + nodeC + " " + System.identityHashCode(nodeC));
- Node x = cache.getChild(Fqn.fromString("b/c"));
+ Node x = cache.getRoot().getChild(Fqn.fromString("b/c"));
log.info("HC " + x + " " + System.identityHashCode(x));
/*
/a
@@ -151,7 +147,7 @@
nodeD = nodeC.getChild(D);
nodeE = nodeD.getChild(E);
- System.out.println("Tree " + treeCache.printLockInfo());
+ System.out.println("Tree " + cache.printLockInfo());
assertTrue(rootNode.hasChild(A));
assertTrue(rootNode.hasChild(B));
@@ -313,31 +309,31 @@
System.out.println("Loader" + loader);
- log.info("Current tree is " + treeCache.printLockInfo());
+ log.info("Current tree is " + cache.printLockInfo());
cache.evict(Fqn.ROOT, true);
- log.info("POST EVICT tree is " + treeCache.printLockInfo());
+ log.info("POST EVICT tree is " + cache.printLockInfo());
// move
if (useTx) tm.begin();
nodeC.move(nodeB);
if (useTx) tm.commit();
- log.info("Post commit tree is " + treeCache.printDetails());
+ log.info("Post commit tree is " + cache.printDetails());
// after eviction, the node objects we hold are probably stale.
nodeA = rootNode.getChild(A);
nodeB = rootNode.getChild(B);
nodeC = nodeB.getChild(C);
- log.info("Current tree is " + treeCache.printDetails());
+ log.info("Current tree is " + cache.printDetails());
log.info("nodeC get child B ");
nodeD = nodeC.getChild(D);
- log.info("Current tree is " + treeCache.printDetails());
+ log.info("Current tree is " + cache.printDetails());
log.info("nodeD get child E ");
nodeE = nodeD.getChild(E);
- log.info("Current tree is " + treeCache.printDetails());
+ log.info("Current tree is " + cache.printDetails());
Fqn old_C = new Fqn(C);
Fqn old_D = new Fqn(old_C, D);
@@ -387,20 +383,20 @@
nodeB = nodeA.addChild(B);
nodeD = nodeB.addChild(D);
nodeC = rootNode.addChild(C);
- assertEquals(0, treeCache.getNumberOfLocksHeld());
+ assertEquals(0, cache.getNumberOfLocksHeld());
tm.begin();
nodeB.move(nodeC);
// nodeC should have a RL, nodeA should have a RL, nodeB should have a WL, nodeD should have a WL
- System.out.println("LOCKS: " + treeCache.printLockInfo());
+ System.out.println("LOCKS: " + cache.printLockInfo());
- assertEquals("ROOT should have a RL, nodeC should have a RL, nodeA should have a RL, nodeB should have a WL, nodeD should have a WL", 5, treeCache.getNumberOfLocksHeld());
+ assertEquals("ROOT should have a RL, nodeC should have a RL, nodeA should have a RL, nodeB should have a WL, nodeD should have a WL", 5, cache.getNumberOfLocksHeld());
tm.commit();
- assertEquals(0, treeCache.getNumberOfLocksHeld());
+ assertEquals(0, cache.getNumberOfLocksHeld());
}
public void testLocks() throws Exception
@@ -408,20 +404,20 @@
nodeA = rootNode.addChild(A);
nodeB = nodeA.addChild(B);
nodeC = rootNode.addChild(C);
- assertEquals(0, treeCache.getNumberOfLocksHeld());
+ assertEquals(0, cache.getNumberOfLocksHeld());
tm.begin();
nodeB.move(nodeC);
// nodeC should have a RL, nodeA should have a RL, nodeB should have a WL
- System.out.println("LOCKS: " + treeCache.printLockInfo());
+ System.out.println("LOCKS: " + cache.printLockInfo());
- assertEquals("ROOT should have a RL, nodeC should have a RL, nodeA should have a RL, nodeB should have a WL", 4, treeCache.getNumberOfLocksHeld());
+ assertEquals("ROOT should have a RL, nodeC should have a RL, nodeA should have a RL, nodeB should have a WL", 4, cache.getNumberOfLocksHeld());
tm.commit();
- assertEquals(0, treeCache.getNumberOfLocksHeld());
+ assertEquals(0, cache.getNumberOfLocksHeld());
}
@@ -507,7 +503,7 @@
t.join();
}
- assertEquals(0, treeCache.getNumberOfLocksHeld());
+ assertEquals(0, cache.getNumberOfLocksHeld());
boolean found_x = false, found_x_again = false;
for (Node n : NODES)
{
1.6 +8 -9 JBossCache/tests/functional/org/jboss/cache/api/SyncReplTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SyncReplTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/api/SyncReplTest.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- SyncReplTest.java 31 Oct 2006 06:57:27 -0000 1.5
+++ SyncReplTest.java 30 Dec 2006 17:49:53 -0000 1.6
@@ -13,7 +13,6 @@
import org.jboss.cache.Fqn;
import org.jboss.cache.InvocationContext;
import org.jboss.cache.Node;
-import org.jboss.cache.TreeCacheProxyImpl;
import org.jboss.cache.config.Option;
import org.jboss.cache.factories.DefaultCacheFactory;
import org.jboss.cache.misc.TestingUtil;
@@ -62,10 +61,10 @@
Fqn f = Fqn.fromString("/test/data");
String k = "key", v = "value";
- assertNull("Should be null", caches[0].getChild(f));
- assertNull("Should be null", caches[1].getChild(f));
+ assertNull("Should be null", caches[0].getRoot().getChild(f));
+ assertNull("Should be null", caches[1].getRoot().getChild(f));
- Node node = caches[0].addChild(f);
+ Node node = caches[0].getRoot().addChild(f);
assertNotNull("Should not be null", node);
@@ -103,7 +102,7 @@
map.put("1", "1");
map.put("2", "2");
caches[0].getInvocationContext().getOptionOverrides().setSuppressLocking(true);
- caches[0].addChild(fqn).put(map);
+ caches[0].getRoot().addChild(fqn).put(map);
caches[0].getInvocationContext().getOptionOverrides().setSuppressLocking(true);
assertEquals("Value should be set", "1", caches[0].get(fqn, "1"));
@@ -111,7 +110,7 @@
map.put("3", "3");
map.put("4", "4");
caches[0].getInvocationContext().getOptionOverrides().setSuppressLocking(true);
- caches[0].addChild(fqn1).put(map);
+ caches[0].getRoot().addChild(fqn1).put(map);
caches[0].getInvocationContext().getOptionOverrides().setSuppressLocking(true);
assertEquals("Value should be set", "2", caches[0].get(fqn, "2"));
@@ -122,13 +121,13 @@
{
for (Cache c : caches)
{
- assertClusterSize(message, size, (TreeCacheProxyImpl) c);
+ assertClusterSize(message, size, c);
}
}
- private void assertClusterSize(String message, int size, TreeCacheProxyImpl tcpi)
+ private void assertClusterSize(String message, int size, Cache c)
{
- assertEquals(message, size, tcpi.treeCache.getMembers().size());
+ assertEquals(message, size, c.getMembers().size());
}
private void assertInvocationContextInitState()
More information about the jboss-cvs-commits
mailing list