private void doTest(boolean initialized) throws Exception {
final Object key = new MagicKey("key", cache(0));
final Cache<Object, Object> cache = cache(1);
final TransactionManager tm = tm(1);
final CountingRpcManager rpcManager = replaceRpcManager(cache);
if (initialized) {
cache(0).put(key, "v1");
}
tm.begin();
rpcManager.resetStats();
AssertJUnit.assertEquals("Wrong value read.", initialized ? "v1" : null, cache.get(key));
AssertJUnit.assertEquals("Wrong number of gets after read.", 1, rpcManager.clusterGet);
AssertJUnit.assertEquals("Wrong put return value.", initialized ? "v1" : null, cache.put(key, "v2"));
AssertJUnit.assertEquals("Wrong number of gets after put.", 1, rpcManager.clusterGet);