public void testInvokeCommandCollection() throws Exception { ClusteredGetCommand command = TestingUtil.extractCommandsFactory(cache(0)).buildClusteredGetCommand("key", 0, 0L); RpcManager rpcManager0 = cache(0).getAdvancedCache().getRpcManager(); Exceptions.expectException(IllegalArgumentException.class, () -> rpcManager0.invokeCommand(Arrays.asList(address(0)), command, SingleResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions())); command.setTopologyId(rpcManager0.getTopologyId()); CompletionStage<Map<Address, Response>> stage1 = rpcManager0.invokeCommand(Arrays.asList(address(0)), command, MapResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions()); assertResponse(Collections.emptyMap(), stage1); CompletionStage<Map<Address, Response>> stage2 = rpcManager0.invokeCommand(Arrays.asList(address(1)), command, MapResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions()); assertResponse(Collections.singletonMap(address(1), SUCCESSFUL_EMPTY_RESPONSE), stage2); CompletionStage<Map<Address, Response>> stage3 = rpcManager0.invokeCommand(Arrays.asList(address(0), address(1)), command, MapResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions()); assertResponse(Collections.singletonMap(address(1), SUCCESSFUL_EMPTY_RESPONSE), stage3); }
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); }
public void testInvokeCommands() throws Exception { ClusteredGetCommand command = TestingUtil.extractCommandsFactory(cache(0)).buildClusteredGetCommand("key", 0, 0L); RpcManager rpcManager0 = cache(0).getAdvancedCache().getRpcManager(); Exceptions.expectException(IllegalArgumentException.class, () -> { rpcManager0.invokeCommands(Arrays.asList(address(1)), a -> command, MapResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions()); }); command.setTopologyId(rpcManager0.getTopologyId()); CompletionStage<Map<Address, Response>> stage1 = rpcManager0.invokeCommands(Arrays.asList(address(0)), a -> command, MapResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions()); assertResponse(Collections.emptyMap(), stage1); CompletionStage<Map<Address, Response>> stage2 = rpcManager0.invokeCommands(Arrays.asList(address(1)), a -> command, MapResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions()); assertResponse(Collections.singletonMap(address(1), SUCCESSFUL_EMPTY_RESPONSE), stage2); CompletionStage<Map<Address, Response>> stage3 = rpcManager0.invokeCommands(Arrays.asList(address(0), address(1)), a -> command, MapResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions()); assertResponse(Collections.singletonMap(address(1), SUCCESSFUL_EMPTY_RESPONSE), stage3); CompletionStage<Map<Address, Response>> stage4 = rpcManager0.invokeCommands(Arrays.asList(address(0), address(1), address(2)), a -> command, MapResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions()); assertResponse(makeMap(address(1), SUCCESSFUL_EMPTY_RESPONSE, address(2), SUCCESSFUL_EMPTY_RESPONSE), stage4); }
public void testInvokeCommand1() throws Exception { ClusteredGetCommand command = TestingUtil.extractCommandsFactory(cache(0)).buildClusteredGetCommand("key", 0, 0L); RpcManager rpcManager0 = cache(0).getAdvancedCache().getRpcManager(); Exceptions.expectException(IllegalArgumentException.class, () -> rpcManager0.invokeCommand(address(0), command, SingleResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions())); command.setTopologyId(rpcManager0.getTopologyId()); CompletionStage<ValidResponse> stage1 = rpcManager0.invokeCommand(address(0), command, SingleResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions()); assertResponse(null, stage1); CompletionStage<ValidResponse> stage2 = rpcManager0.invokeCommand(address(1), command, SingleResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions()); assertResponse(SUCCESSFUL_EMPTY_RESPONSE, stage2); CompletionStage<ValidResponse> stage3 = rpcManager0.invokeCommand(SUSPECT, command, SingleResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions()); Exceptions.expectExecutionException(SuspectException.class, stage3.toCompletableFuture()); }
public void testInvokeCommandOnAll() throws Exception { ClusteredGetCommand command = TestingUtil.extractCommandsFactory(cache(0)).buildClusteredGetCommand("key", 0, 0L); RpcManager rpcManager0 = cache(0).getAdvancedCache().getRpcManager(); Exceptions.expectException(IllegalArgumentException.class, () -> rpcManager0.invokeCommandOnAll(command, SingleResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions())); command.setTopologyId(rpcManager0.getTopologyId()); CompletionStage<Map<Address, Response>> stage1 = rpcManager0.invokeCommandOnAll(command, MapResponseCollector.validOnly(), rpcManager0.getSyncRpcOptions()); assertResponse(makeMap(address(1), SUCCESSFUL_EMPTY_RESPONSE, address(2), SUCCESSFUL_EMPTY_RESPONSE), stage1); }