use of org.opendaylight.mdsal.dom.api.DOMActionResult in project mdsal by opendaylight.
the class DOMRpcRouterTest method assertAvailable.
private static void assertAvailable(final DOMActionService actionService, final YangInstanceIdentifier path) {
final DOMActionResult result;
try {
result = Futures.getDone(invokeBaz(actionService, path));
} catch (ExecutionException e) {
throw new AssertionError("Unexpected invocation failure", e);
}
assertEquals(List.of(), result.getErrors());
}
use of org.opendaylight.mdsal.dom.api.DOMActionResult in project netconf by opendaylight.
the class NetconfMessageTransformerTest method toActionEmptyBodyWithoutOutputDefinedResultTest.
@Test
public void toActionEmptyBodyWithoutOutputDefinedResultTest() throws Exception {
NetconfMessage message = new NetconfMessage(XmlUtil.readXmlToDocument("<rpc-reply message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" + "<ok/>" + "</rpc-reply>"));
DOMActionResult actionResult = actionNetconfMessageTransformer.toActionResult(CHECK_WITHOUT_OUTPUT_INTERFACE_PATH, message);
assertNotNull(actionResult);
assertTrue(actionResult.getOutput().isEmpty());
}
use of org.opendaylight.mdsal.dom.api.DOMActionResult in project controller by opendaylight.
the class RemoteOpsImplementationTest method testInvokeActionWithRemoteFailedFuture.
/**
* This test method invokes and executes the remote rpc.
*/
@SuppressWarnings({ "checkstyle:AvoidHidingCauseException", "checkstyle:IllegalThrows" })
@Test(expected = DOMActionException.class)
public void testInvokeActionWithRemoteFailedFuture() throws Throwable {
final ContainerNode invokeActionInput = makeRPCInput("foo");
@SuppressWarnings({ "unchecked", "rawtypes" }) final ArgumentCaptor<ContainerNode> inputCaptor = ArgumentCaptor.forClass(ContainerNode.class);
when(domActionService2.invokeAction(eq(TEST_RPC_TYPE), eq(TEST_DATA_TREE_ID), inputCaptor.capture())).thenReturn(FluentFutures.immediateFailedFluentFuture(new RemoteDOMRpcException("Test Exception", null)));
final ListenableFuture<DOMActionResult> frontEndFuture = remoteActionImpl1.invokeAction(TEST_RPC_TYPE, TEST_DATA_TREE_ID, invokeActionInput);
assertTrue(frontEndFuture instanceof RemoteDOMActionFuture);
try {
frontEndFuture.get(5, TimeUnit.SECONDS);
} catch (ExecutionException e) {
throw e.getCause();
}
}
use of org.opendaylight.mdsal.dom.api.DOMActionResult in project netconf by opendaylight.
the class NetconfMessageTransformerTest method toActionResultTest.
@Test
public void toActionResultTest() throws Exception {
NetconfMessage message = new NetconfMessage(XmlUtil.readXmlToDocument("<rpc-reply message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" + "<reset-finished-at xmlns=\"urn:example:server-farm\">" + "now" + "</reset-finished-at>" + "</rpc-reply>"));
DOMActionResult actionResult = actionNetconfMessageTransformer.toActionResult(RESET_SERVER_PATH, message);
assertNotNull(actionResult);
ContainerNode containerNode = actionResult.getOutput().get();
assertNotNull(containerNode);
assertEquals("now", containerNode.body().iterator().next().body());
}
use of org.opendaylight.mdsal.dom.api.DOMActionResult in project netconf by opendaylight.
the class NetconfMessageTransformerTest method toActionEmptyBodyWithOutputDefinedResultTest.
@Test
public void toActionEmptyBodyWithOutputDefinedResultTest() throws Exception {
NetconfMessage message = new NetconfMessage(XmlUtil.readXmlToDocument("<rpc-reply message-id=\"101\" xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">" + "<ok/>" + "</rpc-reply>"));
DOMActionResult actionResult = actionNetconfMessageTransformer.toActionResult(CHECK_WITH_OUTPUT_INTERFACE_PATH, message);
assertNotNull(actionResult);
assertTrue(actionResult.getOutput().isEmpty());
}
Aggregations