//populate the near cache
for (int i = 0; i < count; i++) {
map.get(i);
}
final NearCache nearCache = getNearCache(mapName, instances[0]);
assertTrue(nearCache.size() > (count / n - count * 0.1)); //more-or-less (count / no_of_nodes) should be in the near cache now
Map<Object, Object> invalidationMap = new HashMap<Object, Object>(count);
for (int i = 0; i < count; i++) {
invalidationMap.put(i, i);
}
map.putAll(invalidationMap); //this should invalidate the near cache
assertTrueEventually(
new AssertTask() {
@Override
public void run() {
assertEquals("Invalidation is not working on putAll()", 0, nearCache.size());
}
}
);
}