for(int i = 0; i < 4; i++){
cache.put(cacheManagers.get(0).getAddress().toString()+"-"+i, "42");
}
// lets check if all elements arrived
CacheStore cs1 = cache.getAdvancedCache().getComponentRegistry().getComponent(CacheLoaderManager.class).getCacheStore();
Set<Object> keys = cs1.loadAllKeys(null);
Assert.assertEquals(keys.size(), 4);
// now start 2nd node
addClusterEnabledCacheManager(getCB());
waitForClusterToForm("P006");
cache = cacheManagers.get(1).getCache("P006");
// add next 4 elements
for(int i = 0; i < 4; i++){
cache.put(cacheManagers.get(1).getAddress().toString()+"-"+i, "42");
}
Set mergedKeys = new HashSet();
// add keys from all cache stores
CacheStore cs2 = cache.getAdvancedCache().getComponentRegistry().getComponent(CacheLoaderManager.class).getCacheStore();
log.debugf("Load from cache store via cache 1");
mergedKeys.addAll(cs1.loadAllKeys(null));
log.debugf("Load from cache store via cache 2");
mergedKeys.addAll(cs2.loadAllKeys(null));
Assert.assertEquals(mergedKeys.size(), 8);
}