use of org.apache.geode.cache.execute.FunctionInvocationTargetException in project geode by apache.
the class OnGroupsFunctionExecutionDUnitTest method testP2PIgnoreMemberFailure.
@Test
public void testP2PIgnoreMemberFailure() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
final String regionName = getName();
initVM(vm0, "g0,mg", regionName, false);
initVM(vm1, "g1", regionName, false);
initVM(vm2, "g0,g1,g2", regionName, false);
vm0.invoke(new SerializableCallable() {
@Override
public Object call() throws Exception {
DistributedSystem ds = getSystem();
Execution e1 = FunctionService.onMembers("g1");
ArrayList<String> args = new ArrayList<String>();
args.add("shutdown");
args.add("g2");
e1 = e1.setArguments(args);
((AbstractExecution) e1).setIgnoreDepartedMembers(true);
ArrayList l = (ArrayList) e1.execute(new OnGroupsExceptionFunction()).getResult();
assertEquals(2, l.size());
if (l.get(0) instanceof FunctionInvocationTargetException) {
assertTrue((Boolean) l.get(1));
} else if (l.get(0) instanceof Boolean) {
assertTrue(l.get(1) instanceof FunctionInvocationTargetException);
} else {
fail("expected to find a Boolean or throwable at index 0");
}
return null;
}
});
}
Aggregations