public void testReplaceFromNonOwner() throws Exception {
String key = "k1", value = "value", value2 = "v2";
initAndTest();
for (Cache<Object, String> c : caches) {
CacheStore store = TestingUtil.extractComponent(c, CacheLoaderManager.class).getCacheStore();
if (isOwner(c, key)) {
assertIsInContainerImmortal(c, key);
assert store.load(key).getValue().equals(value);
} else {
assert !store.containsKey(key);
}
}
Object retval = getFirstNonOwner(key).replace(key, value2);
if (testRetVals) assert value.equals(retval);
for (Cache<Object, String> c : caches) {
CacheStore store = TestingUtil.extractComponent(c, CacheLoaderManager.class).getCacheStore();
if (isOwner(c, key)) {
assertIsInContainerImmortal(c, key);
assert c.get(key).equals(value2);
assert store.load(key).getValue().equals(value2);
} else {
assert !store.containsKey(key);
}
}
}