use of org.apache.geode.internal.util.DelayedAction in project geode by apache.
the class Bug45934DUnitTest method testNormal.
@Test
public void testNormal() throws Exception {
int count = 1000;
Host host = Host.getHost(0);
final VM remote = host.getVM(1);
final String name = getName();
// 0. create the remote region, set error flag
createRemoteRegion(remote, name);
// 1. create the local cache
CacheFactory cf = new CacheFactory();
cf.set(MCAST_PORT, "45934");
cf.set(CONSERVE_SOCKETS, "false");
Cache cache = getCache(cf);
// 2. create normal region locally
RegionFactory<Integer, Integer> rf = cache.<Integer, Integer>createRegionFactory();
rf.setDataPolicy(DataPolicy.NORMAL);
rf.setScope(Scope.DISTRIBUTED_ACK);
Region<Integer, Integer> region = rf.create(name);
// 3. reset the error flag after initial failure
DistributedCacheOperation.test_InvalidVersionAction = new DelayedAction(new Runnable() {
@Override
public void run() {
unsetRemoteFlag(remote);
}
});
DistributedCacheOperation.test_InvalidVersionAction.allowToProceed();
// 3. put data
Map<Integer, Integer> values = new HashMap<Integer, Integer>();
for (int i = 0; i < count; i++) {
values.put(i, i);
}
region.putAll(values);
// 5. double check
verifyLocal(region, count);
verify(remote, name, count);
cache.close();
}
Aggregations