[jboss-cvs] JBossCache/tests/functional/org/jboss/cache/interceptors ...

Manik Surtani manik at jboss.org
Wed May 23 11:22:05 EDT 2007


  User: msurtani
  Date: 07/05/23 11:22:05

  Modified:    tests/functional/org/jboss/cache/interceptors 
                        EvictionInterceptorTest.java
  Log:
  Performance enhancements, including a new invoke() signature for Interceptor
  
  Revision  Changes    Path
  1.22      +34 -33    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.21
  retrieving revision 1.22
  diff -u -b -r1.21 -r1.22
  --- EvictionInterceptorTest.java	7 Feb 2007 22:06:56 -0000	1.21
  +++ EvictionInterceptorTest.java	23 May 2007 15:22:05 -0000	1.22
  @@ -10,6 +10,7 @@
   import org.jboss.cache.CacheImpl;
   import org.jboss.cache.DefaultCacheFactory;
   import org.jboss.cache.Fqn;
  +import org.jboss.cache.InvocationContext;
   import org.jboss.cache.Node;
   import org.jboss.cache.Region;
   import org.jboss.cache.RegionManager;
  @@ -106,7 +107,7 @@
   
         MethodCall mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
                 Fqn.fromString(fqn1));
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         Region regionABC = regionManager.getRegion(fqn1, false);
         assertNull(regionABC.takeLastEventNode());
   
  @@ -125,7 +126,7 @@
   
         mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
                 Fqn.fromString(fqn1));
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
   
         regionABC = regionManager.getRegion(fqn1, false);
         EvictedEventNode event = regionABC.takeLastEventNode();
  @@ -135,7 +136,7 @@
   
         mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
                 Fqn.fromString(fqn2));
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
   
         Region regionAB = regionManager.getRegion(fqn2, false);
         event = regionAB.takeLastEventNode();
  @@ -144,7 +145,7 @@
         assertNull(regionAB.takeLastEventNode());
   
         mc = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal, Fqn.fromString(fqn3));
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         Region regionABD = regionManager.getRegion(fqn3, false);
         event = regionABD.takeLastEventNode();
         assertEquals(NodeEventType.VISIT_NODE_EVENT, event.getEventType());
  @@ -155,7 +156,7 @@
         {
            Fqn fqn = Fqn.fromString(fqn3);
            mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal, fqn);
  -         interceptor.invoke(mc);
  +         interceptor.invoke(InvocationContext.fromMethodCall(mc));
         }
   
         for (int i = 0; i < 10; i++)
  @@ -170,7 +171,7 @@
   
         // check null handling.
         mc = MethodCallFactory.create(MethodDeclarations.getDataMapMethodLocal, new Object[]{null});
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
   
      }
   
  @@ -181,20 +182,20 @@
         Fqn fqn = Fqn.fromString(fqn4);
         Object key = "key";
         MethodCall mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         Region region = regionManager.getRegion(fqn.toString(), false);
         assertNull(region.takeLastEventNode());
   
         // add the node but try to get on a null element should result in no cache events being added to MarshRegion.
         cache.put(fqn, "wrongkey", "");
         mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(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 MarshRegion.
         mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, "wrongkey", false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         EvictedEventNode event = region.takeLastEventNode();
         assertEquals(fqn, event.getFqn());
         assertEquals(NodeEventType.VISIT_NODE_EVENT, event.getEventType());
  @@ -205,7 +206,7 @@
         // test on element granularity configured node.
         fqn = Fqn.fromString(fqn4);
         mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
   
         region = regionManager.getRegion(fqn.toString(), false);
         event = region.takeLastEventNode();
  @@ -223,7 +224,7 @@
            cache.put("/d/e/g", key, "");
   
            mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, true);
  -         interceptor.invoke(mc);
  +         interceptor.invoke(InvocationContext.fromMethodCall(mc));
         }
   
         region = regionManager.getRegion(fqn.toString(), false);
  @@ -237,7 +238,7 @@
         cache.put("/a/b/c", key, "");
         fqn = Fqn.fromString("/a/b/c");
         mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
   
         region = regionManager.getRegion(fqn.toString(), false);
         event = region.takeLastEventNode();
  @@ -253,7 +254,7 @@
            cache.put(fqn.toString(), key, "");
   
            mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, true);
  -         interceptor.invoke(mc);
  +         interceptor.invoke(InvocationContext.fromMethodCall(mc));
         }
   
         for (int i = 0; i < 1000; i++)
  @@ -267,15 +268,15 @@
   
         // check null handling
         mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, null, key, true);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         assertNull(region.takeLastEventNode());
   
         mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, null, null, true);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         assertNull(region.takeLastEventNode());
   
         mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, null, true);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         assertNull(region.takeLastEventNode());
      }
   
  @@ -291,7 +292,7 @@
         Fqn fqn = Fqn.fromString("/a/b/c");
   
         MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, null, fqn, data, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
   
         Region region = regionManager.getRegion(fqn.toString(), false);
         EvictedEventNode event = region.takeLastEventNode();
  @@ -313,7 +314,7 @@
         {
            mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, null, fqn, i,
                    "value", false);
  -         interceptor.invoke(mc);
  +         interceptor.invoke(InvocationContext.fromMethodCall(mc));
   
            assertEquals("value", cache.get(fqn.toString(), i));
         }
  @@ -330,7 +331,7 @@
   
         fqn = Fqn.fromString("/a/b");
         mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, null, fqn, data, false, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         event = regionManager.getRegion(fqn.toString(), false).takeLastEventNode();
         assertFalse(event.isResetElementCount());
         assertEquals(NodeEventType.ADD_NODE_EVENT, event.getEventType());
  @@ -349,7 +350,7 @@
         }
   
         mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, null, fqn, data, false, true);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         event = regionManager.getRegion(fqn.toString(), false).takeLastEventNode();
         assertEquals(NodeEventType.ADD_NODE_EVENT, event.getEventType());
         assertEquals(fqn, event.getFqn());
  @@ -379,7 +380,7 @@
   
         MethodCall mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
                 null, fqn, key, value, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         assertEquals("value", cache.get(fqn, key));
         EvictedEventNode event = region.takeLastEventNode();
         assertEquals(NodeEventType.ADD_ELEMENT_EVENT, event.getEventType());
  @@ -390,7 +391,7 @@
   
         mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
                 null, fqn, key, value, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         assertEquals("value", cache.get(fqn, key));
         event = region.takeLastEventNode();
         assertEquals(NodeEventType.ADD_ELEMENT_EVENT, event.getEventType());
  @@ -408,7 +409,7 @@
         cache.put(fqn, "b", "c");
   
         MethodCall mc = MethodCallFactory.create(MethodDeclarations.removeDataMethodLocal, null, fqn, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
   
         assertEquals(0, cache.get(fqn).getData().size());
         Region region = regionManager.getRegion(fqn.toString(), false);
  @@ -418,7 +419,7 @@
         assertNull(region.takeLastEventNode());
   
         mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, null, fqn, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
   
         assertNull(cache.get(fqn));
         event = region.takeLastEventNode();
  @@ -435,7 +436,7 @@
   
         MethodCall mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
                 null, fqn, "a", false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
   
         assertNull(cache.get(fqn, "a"));
         Region region = regionManager.getRegion(fqn.toString(), false);
  @@ -447,7 +448,7 @@
   
         mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
                 null, fqn, "b", false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
   
         assertNull(cache.get(fqn, "b"));
         event = region.takeLastEventNode();
  @@ -458,7 +459,7 @@
   
         mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
                 null, fqn, "b", false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
   
         event = region.takeLastEventNode();
         assertNull(event);
  @@ -476,7 +477,7 @@
         Fqn fqn = Fqn.fromString("/a/b/c");
   
         MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, null, fqn, data, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
   
         Region region = regionManager.getRegion(fqn.toString(), false);
         EvictedEventNode event = region.takeLastEventNode();
  @@ -488,14 +489,14 @@
   
         mc = MethodCallFactory.create(MethodDeclarations.getNodeMethodLocal,
                 fqn);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         event = region.takeLastEventNode();
         assertEquals(NodeEventType.VISIT_NODE_EVENT, event.getEventType());
         assertEquals(fqn, event.getFqn());
         assertNull(region.takeLastEventNode());
   
         mc = MethodCallFactory.create(MethodDeclarations.removeNodeMethodLocal, null, fqn, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         assertNull(cache.get(fqn));
         event = region.takeLastEventNode();
         assertEquals(NodeEventType.REMOVE_NODE_EVENT, event.getEventType());
  @@ -506,7 +507,7 @@
         Object value = "value";
         mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal,
                 null, fqn, key, value, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         assertEquals("value", cache.get(fqn, key));
         event = region.takeLastEventNode();
         assertEquals(NodeEventType.ADD_ELEMENT_EVENT, event.getEventType());
  @@ -516,7 +517,7 @@
         assertNull(region.takeLastEventNode());
   
         mc = MethodCallFactory.create(MethodDeclarations.getKeyValueMethodLocal, fqn, key, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
         region = regionManager.getRegion(fqn.toString(), false);
         event = region.takeLastEventNode();
         assertEquals(NodeEventType.VISIT_NODE_EVENT, event.getEventType());
  @@ -525,7 +526,7 @@
   
         mc = MethodCallFactory.create(MethodDeclarations.removeKeyMethodLocal,
                 null, fqn, key, false);
  -      interceptor.invoke(mc);
  +      interceptor.invoke(InvocationContext.fromMethodCall(mc));
   
         assertNull(cache.get(fqn, key));
         event = region.takeLastEventNode();
  
  
  



More information about the jboss-cvs-commits mailing list