+ @Test
+ public void testRpcForMountpoint() throws Exception {
+ final UriInfo uriInfo = mock(UriInfo.class);
+ doReturn(new MultivaluedHashMap<>()).when(uriInfo).getQueryParameters(anyBoolean());
+
+ final NormalizedNodeContext ctx = mock(NormalizedNodeContext.class);
+ final InstanceIdentifierContext iiCtx = mock(InstanceIdentifierContext.class);
+ doReturn(iiCtx).when(ctx).getInstanceIdentifierContext();
+ final SchemaNode schemaNode = mock(SchemaNode.class);
+ doReturn(schemaNode).when(iiCtx).getSchemaNode();
+ doReturn(mock(SchemaPath.class)).when(schemaNode).getPath();
+ doReturn(QName.create("namespace", "2010-10-10", "localname")).when(schemaNode).getQName();
+
+ final DOMMountPoint mount = mock(DOMMountPoint.class);
+ doReturn(mount).when(iiCtx).getMountPoint();
+ final DOMRpcService rpcService = mock(DOMRpcService.class);
+ doReturn(Optional.of(rpcService)).when(mount).getService(DOMRpcService.class);
+ doReturn(Futures.immediateCheckedFuture(mock(DOMRpcResult.class))).when(rpcService).invokeRpc(any(SchemaPath.class), any(NormalizedNode.class));
+ restconfImpl.invokeRpc("randomId", ctx, uriInfo);
+ restconfImpl.invokeRpc("ietf-netconf", ctx, uriInfo);
+ verify(rpcService, times(2)).invokeRpc(any(SchemaPath.class), any(NormalizedNode.class));
+ }