use of org.opendaylight.mdsal.dom.api.DOMRpcImplementationNotAvailableException in project netconf by opendaylight.
the class JSONRestconfServiceImplTest method testInvokeRpcFailure.
@Test(expected = OperationFailedException.class)
public void testInvokeRpcFailure() throws Exception {
final DOMRpcException exception = new DOMRpcImplementationNotAvailableException("testExeption");
doReturn(immediateFailedFluentFuture(exception)).when(brokerFacade).invokeRpc(any(QName.class), any(NormalizedNode.class));
final String uriPath = "toaster:cancel-toast";
this.service.invokeRpc(uriPath, Optional.empty());
}
use of org.opendaylight.mdsal.dom.api.DOMRpcImplementationNotAvailableException in project netconf by opendaylight.
the class RestconfInvokeOperationsServiceImplTest method invokeRpcErrorsAndCheckTestTest.
@Test
public void invokeRpcErrorsAndCheckTestTest() throws InterruptedException, ExecutionException {
final QName errorRpc = QName.create(RPC, "error-rpc");
final DOMRpcException exception = new DOMRpcImplementationNotAvailableException("No implementation of RPC " + errorRpc + " available.");
doReturn(immediateFailedFluentFuture(exception)).when(rpcService).invokeRpc(errorRpc, INPUT);
final DOMRpcResult rpcResult = RestconfInvokeOperationsServiceImpl.invokeRpc(INPUT, errorRpc, rpcService).get();
assertNull(rpcResult.getResult());
final Collection<? extends RpcError> errorList = rpcResult.getErrors();
assertEquals(1, errorList.size());
final RpcError actual = errorList.iterator().next();
assertEquals("No implementation of RPC " + errorRpc + " available.", actual.getMessage());
assertEquals("operation-failed", actual.getTag());
assertEquals(RpcError.ErrorType.RPC, actual.getErrorType());
}
use of org.opendaylight.mdsal.dom.api.DOMRpcImplementationNotAvailableException in project netconf by opendaylight.
the class InvokeRpcMethodTest method testInvokeRpcWithNoPayloadRpc_FailNoErrors.
@Test
public void testInvokeRpcWithNoPayloadRpc_FailNoErrors() {
final QName qname = QName.create("(http://netconfcentral.org/ns/toaster?revision=2009-11-20)cancel-toast");
doReturn(immediateFailedFluentFuture(new DOMRpcImplementationNotAvailableException("testExeption"))).when(brokerFacade).invokeRpc(eq(qname), any());
final RestconfDocumentedException ex = assertThrows(RestconfDocumentedException.class, () -> this.restconfImpl.invokeRpc("toaster:cancel-toast", null, uriInfo));
verifyRestconfDocumentedException(ex, 0, ErrorType.APPLICATION, ErrorTag.OPERATION_NOT_SUPPORTED, Optional.empty(), Optional.empty());
}
Aggregations