public void testInvokeCommandStaggered() throws Exception {
ClusteredGetCommand command =
TestingUtil.extractCommandsFactory(cache(0)).buildClusteredGetCommand("key", 0, 0L);
RpcManager rpcManager0 = cache(0).getAdvancedCache().getRpcManager();
Exceptions.expectException(IllegalArgumentException.class, () ->
rpcManager0.invokeCommandStaggered(Arrays.asList(address(0)), command, SingleResponseCollector.validOnly(),
rpcManager0.getSyncRpcOptions()));
command.setTopologyId(rpcManager0.getTopologyId());
CompletionStage<ValidResponse> stage1 =
rpcManager0.invokeCommandStaggered(Arrays.asList(address(0)), command, SingleResponseCollector.validOnly(),
rpcManager0.getSyncRpcOptions());
assertResponse(null, stage1);
CompletionStage<ValidResponse> stage2 =
rpcManager0.invokeCommandStaggered(Arrays.asList(address(1)), command, SingleResponseCollector.validOnly(),
rpcManager0.getSyncRpcOptions());
assertResponse(SUCCESSFUL_EMPTY_RESPONSE, stage2);
CompletionStage<ValidResponse> stage3 =
rpcManager0.invokeCommandStaggered(Arrays.asList(address(0), address(1)), command,
SingleResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions());
assertResponse(SUCCESSFUL_EMPTY_RESPONSE, stage3);
CompletionStage<ValidResponse> stage4 =
rpcManager0.invokeCommandStaggered(Arrays.asList(address(0), address(1), address(2)), command,
SingleResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions());
assertResponse(SUCCESSFUL_EMPTY_RESPONSE, stage4);
}