build.clustering().stateTransfer().timeout(10000);
createClusteredCaches(2, "replication", build);
}
public void put() {
AdvancedCache cache1 = cache(0,"replication").getAdvancedCache();
AdvancedCache cache2 = cache(1,"replication").getAdvancedCache();
// test a simple put!
assert cache1.get("key") == null;
assert cache2.get("key") == null;
expectRpc(cache2, PutKeyValueCommand.class);
cache1.put("key", "value");
waitForRpc(cache2);
assert cache1.get("key").equals("value");
assert cache2.get("key").equals("value");
Map map = new HashMap();
map.put("key2", "value2");
map.put("key3", "value3");
expectRpc(cache2, PutMapCommand.class);
cache1.putAll(map);
waitForRpc(cache2);
assert cache1.get("key").equals("value");
assert cache2.get("key").equals("value");
assert cache1.get("key2").equals("value2");
assert cache2.get("key2").equals("value2");
assert cache1.get("key3").equals("value3");
assert cache2.get("key3").equals("value3");
}