[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/interceptors ...
Manik Surtani
msurtani at belmont.prod.atl2.jboss.com
Wed Aug 30 13:08:19 EDT 2006
User: msurtani
Date: 06/08/30 13:08:19
Modified: tests/functional/org/jboss/cache/interceptors
EvictionInterceptorTest.java
Log:
Java5 optimisations
Revision Changes Path
1.8 +44 -54 JBossCache/tests/functional/org/jboss/cache/interceptors/EvictionInterceptorTest.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: EvictionInterceptorTest.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/tests/functional/org/jboss/cache/interceptors/EvictionInterceptorTest.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- EvictionInterceptorTest.java 25 Aug 2006 14:10:10 -0000 1.7
+++ EvictionInterceptorTest.java 30 Aug 2006 17:08:19 -0000 1.8
@@ -16,9 +16,9 @@
import org.jboss.cache.eviction.Region;
import org.jboss.cache.eviction.RegionManager;
import org.jboss.cache.lock.IsolationLevel;
+import org.jboss.cache.marshall.MethodCall;
import org.jboss.cache.marshall.MethodCallFactory;
import org.jboss.cache.marshall.MethodDeclarations;
-import org.jboss.cache.marshall.MethodCall;
import java.util.HashMap;
import java.util.Map;
@@ -108,7 +108,7 @@
// make sure node that doesn't exist does not result in a node visit event.
MethodCall mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
- new Object[]{Fqn.fromString(fqn1)});
+ Fqn.fromString(fqn1));
interceptor.invoke(mc);
Region regionABC = regionManager.getRegion(fqn1);
assertNull(regionABC.takeLastEventNode());
@@ -127,7 +127,7 @@
mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
- new Object[]{Fqn.fromString(fqn1)});
+ Fqn.fromString(fqn1));
interceptor.invoke(mc);
regionABC = regionManager.getRegion(fqn1);
@@ -137,7 +137,7 @@
assertNull(regionABC.takeLastEventNode());
mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
- new Object[]{Fqn.fromString(fqn2)});
+ Fqn.fromString(fqn2));
interceptor.invoke(mc);
Region regionAB = regionManager.getRegion(fqn2);
@@ -146,7 +146,7 @@
assertEquals(fqn2, event.getFqn().toString());
assertNull(regionAB.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal, new Object[]{Fqn.fromString(fqn3)});
+ mc = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal, Fqn.fromString(fqn3));
interceptor.invoke(mc);
Region regionABD = regionManager.getRegion(fqn3);
event = regionABD.takeLastEventNode();
@@ -157,7 +157,7 @@
for (int i = 0; i < 10; i++)
{
Fqn fqn = Fqn.fromString(fqn3);
- mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal, new Object[]{fqn});
+ mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal, fqn);
interceptor.invoke(mc);
}
@@ -172,7 +172,7 @@
assertNull(regionManager.getRegion(fqn3).takeLastEventNode());
// check null handling.
- mc = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal, new Object[]{null});
+ mc = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal, null);
interceptor.invoke(mc);
}
@@ -183,20 +183,20 @@
// aka Region.
Fqn fqn = Fqn.fromString(fqn4);
Object key = "key";
- MethodCall mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, new Object[]{fqn, key, Boolean.FALSE});
+ MethodCall mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
interceptor.invoke(mc);
Region region = regionManager.getRegion(fqn.toString());
assertNull(region.takeLastEventNode());
// add the node but try to get on a null element should result in no cache events being added to Region.
cache.put(fqn, "wrongkey", "");
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, new Object[]{fqn, key, Boolean.FALSE});
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
interceptor.invoke(mc);
assertNull(region.takeLastEventNode());
// now make sure if we try to get on the node/key we just created in cache, that this DOES add a EvictedEventNode to
// the Region.
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, new Object[]{fqn, "wrongkey", Boolean.FALSE});
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, "wrongkey", false);
interceptor.invoke(mc);
EvictedEventNode event = region.takeLastEventNode();
assertEquals(fqn, event.getFqn());
@@ -207,7 +207,7 @@
cache.put(fqn4, key, "value");
// test on element granularity configured node.
fqn = Fqn.fromString(fqn4);
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, new Object[]{fqn, key, Boolean.FALSE});
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
interceptor.invoke(mc);
region = regionManager.getRegion(fqn.toString());
@@ -225,7 +225,7 @@
cache.put("/d/e/g", key, "");
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, new Object[]{fqn, key, Boolean.TRUE});
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, true);
interceptor.invoke(mc);
}
@@ -239,7 +239,7 @@
cache.put("/a/b/c", key, "");
fqn = Fqn.fromString("/a/b/c");
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, new Object[]{fqn, key, Boolean.FALSE});
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
interceptor.invoke(mc);
region = regionManager.getRegion(fqn.toString());
@@ -255,7 +255,7 @@
cache.put(fqn.toString(), key, "");
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, new Object[]{fqn, key, Boolean.TRUE});
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, true);
interceptor.invoke(mc);
}
@@ -269,15 +269,15 @@
assertNull(region.takeLastEventNode());
// check null handling
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, new Object[]{null, key, Boolean.TRUE});
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, null, key, true);
interceptor.invoke(mc);
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, new Object[]{null, null, Boolean.TRUE});
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, null, null, true);
interceptor.invoke(mc);
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, new Object[]{fqn, null, Boolean.TRUE});
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, null, true);
interceptor.invoke(mc);
assertNull(region.takeLastEventNode());
}
@@ -287,14 +287,13 @@
Map data = new HashMap();
for (int i = 0; i < 100; i++)
{
- Integer in = new Integer(i);
- data.put(in, in);
+ data.put(i, i);
}
// this region is node granularity
Fqn fqn = Fqn.fromString("/a/b/c");
- MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, new Object[]{null, fqn, data, Boolean.FALSE});
+ MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, null, fqn, data, false);
interceptor.invoke(mc);
Region region = regionManager.getRegion(fqn.toString());
@@ -309,18 +308,17 @@
for (int i = 0; i < 100; i++)
{
- Integer in = new Integer(i);
- assertTrue(node.containsKey(in));
- assertEquals(in, node.get(in));
+ assertTrue(node.containsKey(i));
+ assertEquals(i, node.get(i));
}
for (int i = 0; i < 100; i++)
{
- mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, new Object[]{null, fqn, new Integer(i),
- "value", Boolean.FALSE});
+ mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, null, fqn, i,
+ "value", false);
interceptor.invoke(mc);
- assertEquals("value", cache.get(fqn.toString(), new Integer(i)));
+ assertEquals("value", cache.get(fqn.toString(), i));
}
for (int i = 0; i < 100; i++)
@@ -334,7 +332,7 @@
assertNull(region.takeLastEventNode());
fqn = Fqn.fromString("/a/b");
- mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, new Object[]{null, fqn, data, Boolean.FALSE, Boolean.FALSE});
+ mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, null, fqn, data, false, false);
interceptor.invoke(mc);
event = regionManager.getRegion(fqn.toString()).takeLastEventNode();
assertFalse(event.isResetElementCount());
@@ -349,12 +347,11 @@
for (int i = 0; i < 100; i++)
{
- Integer in = new Integer(i);
- assertTrue(node.containsKey(in));
- assertEquals(in, node.get(in));
+ assertTrue(node.containsKey(i));
+ assertEquals(i, node.get(i));
}
- mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, new Object[]{null, fqn, data, Boolean.FALSE, Boolean.TRUE});
+ mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, null, fqn, data, false, true);
interceptor.invoke(mc);
event = regionManager.getRegion(fqn.toString()).takeLastEventNode();
assertEquals(EvictedEventNode.ADD_NODE_EVENT, event.getEvent());
@@ -370,9 +367,8 @@
for (int i = 0; i < 100; i++)
{
- Integer in = new Integer(i);
- assertTrue(node.containsKey(in));
- assertEquals(in, node.get(in));
+ assertTrue(node.containsKey(i));
+ assertEquals(i, node.get(i));
}
}
@@ -385,7 +381,7 @@
Object value = "value";
MethodCall mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
- new Object[]{null, fqn, key, value, Boolean.FALSE});
+ null, fqn, key, value, false);
interceptor.invoke(mc);
assertEquals("value", cache.get(fqn, key));
EvictedEventNode event = region.takeLastEventNode();
@@ -396,7 +392,7 @@
assertNull(region.takeLastEventNode());
mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
- new Object[]{null, fqn, key, value, Boolean.FALSE});
+ null, fqn, key, value, false);
interceptor.invoke(mc);
assertEquals("value", cache.get(fqn, key));
event = region.takeLastEventNode();
@@ -414,8 +410,7 @@
cache.put(fqn, "a", "b");
cache.put(fqn, "b", "c");
- MethodCall mc = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal, new Object[]{
- null, fqn, Boolean.FALSE});
+ MethodCall mc = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal, null, fqn, false);
interceptor.invoke(mc);
assertEquals(0, cache.get(fqn).numAttributes());
@@ -425,9 +420,7 @@
assertEquals(fqn, event.getFqn());
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, new Object[]{
- null, fqn, Boolean.FALSE
- });
+ mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, null, fqn, false);
interceptor.invoke(mc);
assertNull(cache.get(fqn));
@@ -444,7 +437,7 @@
cache.put(fqn, "b", "c");
MethodCall mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
- new Object[]{null, fqn, "a", Boolean.FALSE});
+ null, fqn, "a", false);
interceptor.invoke(mc);
assertNull(cache.get(fqn, "a"));
@@ -456,7 +449,7 @@
assertNull(region.takeLastEventNode());
mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
- new Object[]{null, fqn, "b", Boolean.FALSE});
+ null, fqn, "b", false);
interceptor.invoke(mc);
assertNull(cache.get(fqn, "b"));
@@ -467,7 +460,7 @@
assertNull(region.takeLastEventNode());
mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
- new Object[]{null, fqn, "b", Boolean.FALSE});
+ null, fqn, "b", false);
interceptor.invoke(mc);
event = region.takeLastEventNode();
@@ -479,14 +472,13 @@
Map data = new HashMap();
for (int i = 0; i < 100; i++)
{
- Integer in = new Integer(i);
- data.put(in, in);
+ data.put(i, i);
}
// this region is node granularity
Fqn fqn = Fqn.fromString("/a/b/c");
- MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, new Object[]{null, fqn, data, Boolean.FALSE});
+ MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, null, fqn, data, false);
interceptor.invoke(mc);
Region region = regionManager.getRegion(fqn.toString());
@@ -498,16 +490,14 @@
assertNull(region.takeLastEventNode());
mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
- new Object[]{fqn});
+ fqn);
interceptor.invoke(mc);
event = region.takeLastEventNode();
assertEquals(EvictedEventNode.VISIT_NODE_EVENT, event.getEvent());
assertEquals(fqn, event.getFqn());
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, new Object[]{
- null, fqn, Boolean.FALSE
- });
+ mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, null, fqn, false);
interceptor.invoke(mc);
assertNull(cache.get(fqn));
event = region.takeLastEventNode();
@@ -518,7 +508,7 @@
Object key = "key";
Object value = "value";
mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
- new Object[]{null, fqn, key, value, Boolean.FALSE});
+ null, fqn, key, value, false);
interceptor.invoke(mc);
assertEquals("value", cache.get(fqn, key));
event = region.takeLastEventNode();
@@ -528,7 +518,7 @@
assertEquals("value", cache.get(fqn, key));
assertNull(region.takeLastEventNode());
- mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, new Object[]{fqn, key, Boolean.FALSE});
+ mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
interceptor.invoke(mc);
region = regionManager.getRegion(fqn.toString());
event = region.takeLastEventNode();
@@ -537,7 +527,7 @@
assertNull(region.takeLastEventNode());
mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
- new Object[]{null, fqn, key, Boolean.FALSE});
+ null, fqn, key, false);
interceptor.invoke(mc);
assertNull(cache.get(fqn, key));
More information about the jboss-cvs-commits
mailing list