assert cache1.get("key").equals("value1");
assert cache2.get("key") == null;
}
public void testReplaceWithOldVal() {
AdvancedCache cache1 = cache(0,"invalidation").getAdvancedCache();
AdvancedCache cache2 = cache(1,"invalidation").getAdvancedCache();
cache2.withFlags(CACHE_MODE_LOCAL).put("key", "value2");
assert cache1.get("key") == null;
assert cache2.get("key").equals("value2");
assert !cache1.replace("key", "valueOld", "value1"); // should do nothing since there is nothing to replace on cache1
assert cache1.get("key") == null;
assert cache2.get("key").equals("value2");
assert null == cache1.withFlags(CACHE_MODE_LOCAL).put("key", "valueN");
assert !cache1.replace("key", "valueOld", "value1"); // should do nothing since there is nothing to replace on cache1
assert cache1.get("key").equals("valueN");
assert cache2.get("key").equals("value2");
replListener(cache2).expect(InvalidateCommand.class);
assert cache1.replace("key", "valueN", "value1");
replListener(cache2).waitForRpc();
assert cache1.get("key").equals("value1");
assert cache2.get("key") == null;
}