@Test public void invokeRpcTest() throws Exception { final Method methodWithoutInput = TestRpcService.class.getDeclaredMethod("methodWithoutInput", RpcService.class); final Method methodWithInput = TestRpcService.class.getDeclaredMethod("methodWithInput", RpcService.class, DataObject.class); methodWithInput.setAccessible(true); methodWithoutInput.setAccessible(true); final RpcService rpcService = new TestRpcService(); final TestRpcInvokerImpl testRpcInvoker = new TestRpcInvokerImpl(ImmutableMap.of( "(test)tstWithoutInput", methodWithoutInput, "(test)tstWithInput", methodWithInput)); assertTrue(testRpcInvoker.map.get("(test)tstWithInput") instanceof RpcMethodInvokerWithInput); assertTrue(testRpcInvoker.map.get("(test)tstWithoutInput") instanceof RpcMethodInvokerWithoutInput); final Crate crateWithoutInput = (Crate) testRpcInvoker.invokeRpc(rpcService, QName.create("test", "tstWithoutInput"), null).get(); assertEquals(TestRpcService.methodWithoutInput(rpcService).get().getRpcService(), crateWithoutInput.getRpcService()); assertFalse(crateWithoutInput.getDataObject().isPresent()); final DataObject dataObject = mock(DataObject.class); final Crate crateWithInput = (Crate) testRpcInvoker.invokeRpc(rpcService, QName.create("test", "tstWithInput"), dataObject).get(); assertEquals(TestRpcService.methodWithInput(rpcService, dataObject).get().getRpcService(), crateWithInput.getRpcService()); assertTrue(crateWithInput.getDataObject().isPresent()); assertEquals(dataObject, crateWithInput.getDataObject().get()); }
@Override public final ListenableFuture<RpcResult<?>> invokeRpc(final RpcService impl, final QName rpcName, final DataObject input) { requireNonNull(impl, "Implementation must be supplied"); RpcMethodInvoker invoker = map.get(qnameToKey(rpcName)); checkArgument(invoker != null, "Supplied RPC is not valid for implementation %s", impl); return invoker.invokeOn(impl, input); }
AbstractMappedRpcInvoker extends RpcServiceInvoker { @Override public final ListenableFuture<RpcResult<?>> invokeRpc(final RpcService impl, final QName rpcName, final DataObject input) { requireNonNull(impl, "Implementation must be supplied"); RpcMethodInvoker invoker = map.get(qnameToKey(rpcName)); checkArgument(invoker != null, "Supplied RPC is not valid for implementation %s", impl); return invoker.invokeOn(impl, input); } }
AbstractMappedRpcInvoker extends RpcServiceInvoker { @Override public final ListenableFuture<RpcResult<?>> invokeRpc(final RpcService impl, final QName rpcName, final DataObject input) { requireNonNull(impl, "Implementation must be supplied"); RpcMethodInvoker invoker = map.get(qnameToKey(rpcName)); checkArgument(invoker != null, "Supplied RPC is not valid for implementation %s", impl); return invoker.invokeOn(impl, input); } protected  AbstractMappedRpcInvoker(final Map<T, Method> map); }
AbstractMappedRpcInvoker extends RpcServiceInvoker { @Override public final ListenableFuture<RpcResult<?>> invokeRpc(final RpcService impl, final QName rpcName, final DataObject input) { requireNonNull(impl, "Implementation must be supplied"); RpcMethodInvoker invoker = map.get(qnameToKey(rpcName)); checkArgument(invoker != null, "Supplied RPC is not valid for implementation %s", impl); return invoker.invokeOn(impl, input); } protected  AbstractMappedRpcInvoker(final Map<T, Method> map); @Override final ListenableFuture<RpcResult<?>> invokeRpc(final RpcService impl, final QName rpcName,
            final DataObject input); }
AbstractMappedRpcInvoker extends RpcServiceInvoker { @Override public final ListenableFuture<RpcResult<?>> invokeRpc(final RpcService impl, final QName rpcName, final DataObject input) { requireNonNull(impl, "Implementation must be supplied"); RpcMethodInvoker invoker = map.get(qnameToKey(rpcName)); checkArgument(invoker != null, "Supplied RPC is not valid for implementation %s", impl); return invoker.invokeOn(impl, input); } protected  AbstractMappedRpcInvoker(final Map<T, Method> map); @Override final ListenableFuture<RpcResult<?>> invokeRpc(final RpcService impl, final QName rpcName,
            final DataObject input);  }