use of org.opendaylight.controller.remote.rpc.messages.ExecuteRpc in project controller by opendaylight.
the class RpcBrokerTest method testExecuteRpcFailureWithException.
@Test
public void testExecuteRpcFailureWithException() {
new TestKit(node1) {
{
when(domRpcService1.invokeRpc(eq(TEST_RPC_TYPE), Mockito.<NormalizedNode<?, ?>>any())).thenReturn(Futures.<DOMRpcResult, DOMRpcException>immediateFailedCheckedFuture(new DOMRpcImplementationNotAvailableException("NOT FOUND")));
final ExecuteRpc executeMsg = ExecuteRpc.from(TEST_RPC_ID, null);
rpcInvoker1.tell(executeMsg, getRef());
final Failure rpcResponse = expectMsgClass(duration("5 seconds"), akka.actor.Status.Failure.class);
Assert.assertTrue(rpcResponse.cause() instanceof DOMRpcException);
}
};
}
use of org.opendaylight.controller.remote.rpc.messages.ExecuteRpc in project controller by opendaylight.
the class RpcBrokerTest method testExecuteRpc.
@Test
public void testExecuteRpc() {
new TestKit(node1) {
{
final ContainerNode invokeRpcResult = makeRPCOutput("bar");
final DOMRpcResult rpcResult = new DefaultDOMRpcResult(invokeRpcResult);
when(domRpcService1.invokeRpc(eq(TEST_RPC_TYPE), Mockito.<NormalizedNode<?, ?>>any())).thenReturn(Futures.<DOMRpcResult, DOMRpcException>immediateCheckedFuture(rpcResult));
final ExecuteRpc executeMsg = ExecuteRpc.from(TEST_RPC_ID, null);
rpcInvoker1.tell(executeMsg, getRef());
final RpcResponse rpcResponse = expectMsgClass(duration("5 seconds"), RpcResponse.class);
assertEquals(rpcResult.getResult(), rpcResponse.getResultNormalizedNode());
}
};
}
Aggregations