use of org.opendaylight.controller.md.sal.dom.api.DOMRpcException in project controller by opendaylight.
the class RemoteRpcImplementationTest method testInvokeRpc.
/**
* This test method invokes and executes the remote rpc.
*/
@Test
public void testInvokeRpc() throws Exception {
final ContainerNode rpcOutput = makeRPCOutput("bar");
final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);
final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
@SuppressWarnings({ "unchecked", "rawtypes" }) final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor = (ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(Futures.<DOMRpcResult, DOMRpcException>immediateCheckedFuture(rpcResult));
final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
final DOMRpcResult result = frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
assertEquals(rpcOutput, result.getResult());
}
Aggregations