MethodCall mc = MethodCallFactory.create(MethodDeclarations.putDataMethodLocal, new Object[]{null, fqn, data, Boolean.FALSE});
interceptor.invoke(mc);
Region region = regionManager.getRegion(fqn.toString());
EvictedEventNode event = region.takeLastEventNode();
assertEquals(EvictedEventNode.ADD_NODE_EVENT, event.getEvent());
assertEquals(fqn, event.getFqn());
assertEquals(100, event.getElementDifference());
Node node = cache.get(fqn.toString());
assertNotNull(node);
for (int i = 0; i < 100; i++)
{
Integer in = new Integer(i);
assertTrue(node.containsKey(in));
assertEquals(in, node.get(in));
}
for (int i = 0; i < 100; i++)
{
mc = MethodCallFactory.create(MethodDeclarations.putKeyValMethodLocal, new Object[]{null, fqn, new Integer(i),
"value", Boolean.FALSE});
interceptor.invoke(mc);
assertEquals("value", cache.get(fqn.toString(), new Integer(i)));
}
for (int i = 0; i < 100; i++)
{
event = region.takeLastEventNode();
assertNotNull(event);
assertEquals(fqn, event.getFqn());
assertEquals(EvictedEventNode.ADD_ELEMENT_EVENT, event.getEvent());
}
assertNull(region.takeLastEventNode());
fqn = Fqn.fromString("/a/b");
mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, new Object[]{null, fqn, data, Boolean.FALSE, Boolean.FALSE});
interceptor.invoke(mc);
event = regionManager.getRegion(fqn.toString()).takeLastEventNode();
assertFalse(event.isResetElementCount());
assertEquals(EvictedEventNode.ADD_NODE_EVENT, event.getEvent());
assertEquals(fqn, event.getFqn());
assertEquals(100, event.getElementDifference());
assertNull(regionManager.getRegion(fqn.toString()).takeLastEventNode());
node = cache.get(fqn.toString());
assertEquals(100, node.numAttributes());
assertNotNull(node);
for (int i = 0; i < 100; i++)
{
Integer in = new Integer(i);
assertTrue(node.containsKey(in));
assertEquals(in, node.get(in));
}
mc = MethodCallFactory.create(MethodDeclarations.putDataEraseMethodLocal, new Object[]{null, fqn, data, Boolean.FALSE, Boolean.TRUE});
interceptor.invoke(mc);
event = regionManager.getRegion(fqn.toString()).takeLastEventNode();
assertEquals(EvictedEventNode.ADD_NODE_EVENT, event.getEvent());
assertEquals(fqn, event.getFqn());
assertEquals(100, event.getElementDifference());
assertTrue(event.isResetElementCount());
assertNull(regionManager.getRegion(fqn.toString()).takeLastEventNode());
node = cache.get(fqn.toString());
assertEquals(100, node.numAttributes());