[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/optimistic ...
Manik Surtani
msurtani at jboss.com
Thu Jan 4 00:35:38 EST 2007
User: msurtani
Date: 07/01/04 00:35:38
Modified: tests/functional/org/jboss/cache/optimistic
AsyncFullStackInterceptorTest.java
FullStackInterceptorTest.java
OpLockingInterceptorTest.java
OptimisticReplicationInterceptorTest.java
Log:
Major changes around nodes, and the way they interact with the interceptor stack.
Also removed redundant methods in NodeSPI and removed the need for casting to NodeSPI in most cases.
Revision Changes Path
1.8 +22 -23 JBossCache/tests/functional/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AsyncFullStackInterceptorTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/optimistic/AsyncFullStackInterceptorTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- AsyncFullStackInterceptorTest.java 30 Dec 2006 17:49:52 -0000 1.7
+++ AsyncFullStackInterceptorTest.java 4 Jan 2007 05:35:38 -0000 1.8
@@ -5,6 +5,7 @@
import org.jboss.cache.CacheImpl;
import org.jboss.cache.Fqn;
import org.jboss.cache.GlobalTransaction;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.OptimisticTransactionEntry;
import org.jboss.cache.TransactionTable;
import org.jboss.cache.config.Configuration;
@@ -101,12 +102,11 @@
assertTrue(cache.exists(Fqn.fromString("/one/two")));
assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache.get(Fqn.fromString("/")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one/two"))
- .getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
@@ -169,11 +169,11 @@
assertTrue(cache.exists(Fqn.fromString("/one/two")));
assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache.get(Fqn.fromString("/")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one/two")).getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
assertEquals(pojo2, cache.get(Fqn.fromString("/one/two"), "key1"));
@@ -212,11 +212,11 @@
assertTrue(cache.exists(Fqn.fromString("/one/two")));
assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache.get(Fqn.fromString("/")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one/two")).getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
@@ -233,9 +233,9 @@
assertTrue(cache2.exists(Fqn.fromString("/one/two")));
assertNotNull(cache2.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache2.get(Fqn.fromString("/")).getNodeSPI().getLock().isLocked());
- assertEquals(false, cache2.get(Fqn.fromString("/one")).getNodeSPI().getLock().isLocked());
- assertEquals(false, cache2.get(Fqn.fromString("/one/two")).getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache2.get(Fqn.fromString("/"))).getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache2.get(Fqn.fromString("/one"))).getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache2.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache2.get(Fqn.fromString("/one")).getChild("two"));
assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
@@ -274,12 +274,11 @@
assertTrue(cache.exists(Fqn.fromString("/one/two")));
assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache.get(Fqn.fromString("/")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one/two"))
- .getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
@@ -296,9 +295,9 @@
assertTrue(cache2.exists(Fqn.fromString("/one/two")));
assertNotNull(cache2.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache2.get(Fqn.fromString("/")).getNodeSPI().getLock().isLocked());
- assertEquals(false, cache2.get(Fqn.fromString("/one")).getNodeSPI().getLock().isLocked());
- assertEquals(false, cache2.get(Fqn.fromString("/one/two")).getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache2.get(Fqn.fromString("/"))).getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache2.get(Fqn.fromString("/one"))).getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache2.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache2.get(Fqn.fromString("/one")).getChild("two"));
assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
@@ -386,9 +385,9 @@
assertTrue(cache.exists(Fqn.fromString("/one/two")));
assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache.get(Fqn.fromString("/")).getNodeSPI().getLock().isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one")).getNodeSPI().getLock().isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one/two")).getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/"))).getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one"))).getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
assertEquals(pojo2, cache.get(Fqn.fromString("/one/two"), "key1"));
1.21 +32 -35 JBossCache/tests/functional/org/jboss/cache/optimistic/FullStackInterceptorTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: FullStackInterceptorTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/optimistic/FullStackInterceptorTest.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- FullStackInterceptorTest.java 30 Dec 2006 17:49:52 -0000 1.20
+++ FullStackInterceptorTest.java 4 Jan 2007 05:35:38 -0000 1.21
@@ -6,6 +6,7 @@
import org.jboss.cache.CacheImpl;
import org.jboss.cache.Fqn;
import org.jboss.cache.GlobalTransaction;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.OptimisticTransactionEntry;
import org.jboss.cache.TransactionTable;
import org.jboss.cache.config.Configuration;
@@ -88,12 +89,11 @@
assertTrue(cache.exists(Fqn.fromString("/one/two")));
assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache.get(Fqn.fromString("/")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one/two"))
- .getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
@@ -133,12 +133,11 @@
assertTrue(cache.exists(Fqn.fromString("/one/two")));
assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache.get(Fqn.fromString("/")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one/two"))
- .getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
destroyCache(cache);
@@ -213,12 +212,11 @@
assertTrue(cache.exists(Fqn.fromString("/one/two")));
assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache.get(Fqn.fromString("/")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one/two"))
- .getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
@@ -281,11 +279,11 @@
assertTrue(cache.exists(Fqn.fromString("/one/two")));
assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache.get(Fqn.fromString("/")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one/two")).getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
assertEquals(pojo2, cache.get(Fqn.fromString("/one/two"), "key1"));
@@ -324,11 +322,11 @@
assertTrue(cache.exists(Fqn.fromString("/one/two")));
assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache.get(Fqn.fromString("/")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one/two")).getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
@@ -342,9 +340,9 @@
assertTrue(cache2.exists(Fqn.fromString("/one/two")));
assertNotNull(cache2.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache2.get(Fqn.fromString("/")).getNodeSPI().getLock().isLocked());
- assertEquals(false, cache2.get(Fqn.fromString("/one")).getNodeSPI().getLock().isLocked());
- assertEquals(false, cache2.get(Fqn.fromString("/one/two")).getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache2.get(Fqn.fromString("/"))).getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache2.get(Fqn.fromString("/one"))).getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache2.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache2.get(Fqn.fromString("/one")).getChild("two"));
assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
@@ -383,12 +381,11 @@
assertTrue(cache.exists(Fqn.fromString("/one/two")));
assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache.get(Fqn.fromString("/")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one")).getNodeSPI().getLock()
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one"))).getLock()
.isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one/two"))
- .getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
assertNotNull(cache.get(Fqn.fromString("/one/two"), "key1"));
@@ -402,9 +399,9 @@
assertTrue(cache2.exists(Fqn.fromString("/one/two")));
assertNotNull(cache2.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache2.get(Fqn.fromString("/")).getNodeSPI().getLock().isLocked());
- assertEquals(false, cache2.get(Fqn.fromString("/one")).getNodeSPI().getLock().isLocked());
- assertEquals(false, cache2.get(Fqn.fromString("/one/two")).getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache2.get(Fqn.fromString("/"))).getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache2.get(Fqn.fromString("/one"))).getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache2.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache2.get(Fqn.fromString("/one")).getChild("two"));
assertNotNull(cache2.get(Fqn.fromString("/one/two"), "key1"));
@@ -486,9 +483,9 @@
assertTrue(cache.exists(Fqn.fromString("/one/two")));
assertNotNull(cache.get(Fqn.fromString("/")).getChild("one"));
- assertEquals(false, cache.get(Fqn.fromString("/")).getNodeSPI().getLock().isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one")).getNodeSPI().getLock().isLocked());
- assertEquals(false, cache.get(Fqn.fromString("/one/two")).getNodeSPI().getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/"))).getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one"))).getLock().isLocked());
+ assertEquals(false, ((NodeSPI) cache.get(Fqn.fromString("/one/two"))).getLock().isLocked());
assertNotNull(cache.get(Fqn.fromString("/one")).getChild("two"));
assertEquals(pojo2, cache.get(Fqn.fromString("/one/two"), "key1"));
@@ -613,7 +610,7 @@
// First TX
mgr.begin();
Transaction tx = mgr.getTransaction();
- cache.put("/one/two", "key2", "val2"); // version for this is 1
+ cache.put("/one/two", "key2", "val2");// version for this is 1
// start another
mgr.suspend();
@@ -621,7 +618,7 @@
// Second TX
mgr.begin();
cache.put("/one/two", "key3", "val3");
- mgr.commit(); // now version is 2, attrs are key1 and key3
+ mgr.commit();// now version is 2, attrs are key1 and key3
// assert we can see this outside the existing tx
keys = cache.getKeys("/one/two");
@@ -633,7 +630,7 @@
// assert we can't see the change from tx2 as we already touched the node
keys = cache.getKeys("/one/two");
System.out.println("keys after TX #2 resumed (in private workspace of TX #2): " + keys);
- assertEquals(2, keys.size()); // we will see key1 and key2, but *not* key3
+ assertEquals(2, keys.size());// we will see key1 and key2, but *not* key3
// this will fail as our workspace has version 1, whereas cache has 2; TX will be rolled back
try
@@ -649,7 +646,7 @@
keys = cache.getKeys("/one/two");
System.out.println("keys after TX #2 was rolled back: " + keys);
- assertEquals(2, keys.size()); // key1 and key2
+ assertEquals(2, keys.size());// key1 and key2
destroyCache(cache);
}
1.18 +8 -8 JBossCache/tests/functional/org/jboss/cache/optimistic/OpLockingInterceptorTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OpLockingInterceptorTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/optimistic/OpLockingInterceptorTest.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- OpLockingInterceptorTest.java 30 Dec 2006 17:49:52 -0000 1.17
+++ OpLockingInterceptorTest.java 4 Jan 2007 05:35:38 -0000 1.18
@@ -9,7 +9,7 @@
import org.jboss.cache.CacheImpl;
import org.jboss.cache.Fqn;
import org.jboss.cache.GlobalTransaction;
-import org.jboss.cache.Node;
+import org.jboss.cache.NodeSPI;
import org.jboss.cache.OptimisticTransactionEntry;
import org.jboss.cache.TransactionTable;
import org.jboss.cache.interceptors.Interceptor;
@@ -64,7 +64,7 @@
cache.setInterceptorChain(lockingInterceptor);
-// first set up a node with a pojo
+ // first set up a node with a pojo
DummyTransactionManager mgr = DummyTransactionManager.getInstance();
mgr.begin();
Transaction tx = mgr.getTransaction();
@@ -155,7 +155,7 @@
cache.setInterceptorChain(lockingInterceptor);
-// first set up a node with a pojo
+ // first set up a node with a pojo
DummyTransactionManager mgr = DummyTransactionManager.getInstance();
mgr.begin();
Transaction tx = mgr.getTransaction();
@@ -241,8 +241,8 @@
int i = 0;
for (Iterator it = workspace.getNodes().values().iterator(); it.hasNext();)
{
- Node node = ((WorkspaceNode) it.next()).getNode();
- assertEquals(node.getNodeSPI().getLock(), entry.getLocks().get(i));
+ NodeSPI node = ((WorkspaceNode) it.next()).getNode();
+ assertEquals(node.getLock(), entry.getLocks().get(i));
i++;
}
assertEquals(MethodDeclarations.commitMethod, dummy.getCalled());
@@ -272,7 +272,7 @@
cache.setInterceptorChain(lockingInterceptor);
-// first set up a node with a pojo
+ // first set up a node with a pojo
DummyTransactionManager mgr = DummyTransactionManager.getInstance();
mgr.begin();
Transaction tx = mgr.getTransaction();
@@ -357,8 +357,8 @@
int i = 0;
for (Iterator it = workspace.getNodes().values().iterator(); it.hasNext();)
{
- Node node = ((WorkspaceNode) it.next()).getNode();
- assertEquals(node.getNodeSPI().getLock(), entry.getLocks().get(i));
+ NodeSPI node = ((WorkspaceNode) it.next()).getNode();
+ assertEquals(node.getLock(), entry.getLocks().get(i));
i++;
}
assertEquals(MethodDeclarations.rollbackMethod, dummy.getCalled());
1.20 +1 -1 JBossCache/tests/functional/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: OptimisticReplicationInterceptorTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/optimistic/OptimisticReplicationInterceptorTest.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- OptimisticReplicationInterceptorTest.java 30 Dec 2006 17:49:52 -0000 1.19
+++ OptimisticReplicationInterceptorTest.java 4 Jan 2007 05:35:38 -0000 1.20
@@ -362,7 +362,7 @@
remoteGtx.setAddress(new TestAddress());
//hack the method call to make it have the remote gtx
- MethodCall meth = (MethodCall) entry.getModifications().get(0);
+ MethodCall meth = entry.getModifications().get(0);
meth.getArgs()[0] = remoteGtx;
More information about the jboss-cvs-commits
mailing list