import org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult;
import org.opendaylight.mdsal.dom.spi.SimpleDOMActionResult;
import org.opendaylight.yangtools.util.concurrent.FluentFutures;
+import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.stmt.SchemaNodeIdentifier.Absolute;
/**
* Unit tests for RemoteRpcImplementation.
final ContainerNode rpcOutput = makeRPCOutput("bar");
final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);
- final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
+ final NormalizedNode invokeRpcInput = makeRPCInput("foo");
@SuppressWarnings({"unchecked", "rawtypes"})
- final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
+ final ArgumentCaptor<NormalizedNode> inputCaptor =
ArgumentCaptor.forClass(NormalizedNode.class);
doReturn(FluentFutures.immediateFluentFuture(rpcResult)).when(domRpcService2)
- .invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture());
+ .invokeRpc(eq(TEST_RPC), inputCaptor.capture());
final ListenableFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
public void testInvokeAction() throws Exception {
final ContainerNode actionOutput = makeRPCOutput("bar");
final DOMActionResult actionResult = new SimpleDOMActionResult(actionOutput, Collections.emptyList());
- final NormalizedNode<?, ?> invokeActionInput = makeRPCInput("foo");
+ final NormalizedNode invokeActionInput = makeRPCInput("foo");
@SuppressWarnings({"unchecked", "rawtypes"})
final ArgumentCaptor<ContainerNode> inputCaptor =
ArgumentCaptor.forClass(ContainerNode.class);
final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);
@SuppressWarnings({"unchecked", "rawtypes"})
- final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
+ final ArgumentCaptor<NormalizedNode> inputCaptor =
(ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
doReturn(FluentFutures.immediateFluentFuture(rpcResult)).when(domRpcService2)
- .invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture());
+ .invokeRpc(eq(TEST_RPC), inputCaptor.capture());
ListenableFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, null);
assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
final ContainerNode rpcOutput = null;
final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);
- final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
+ final NormalizedNode invokeRpcInput = makeRPCInput("foo");
@SuppressWarnings({"unchecked", "rawtypes"})
- final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
+ final ArgumentCaptor<NormalizedNode> inputCaptor =
(ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
doReturn(FluentFutures.immediateFluentFuture(rpcResult)).when(domRpcService2)
- .invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture());
+ .invokeRpc(eq(TEST_RPC), inputCaptor.capture());
final ListenableFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
@SuppressWarnings({"checkstyle:AvoidHidingCauseException", "checkstyle:IllegalThrows"})
@Test(expected = DOMRpcException.class)
public void testInvokeRpcWithRemoteFailedFuture() throws Throwable {
- final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
+ final NormalizedNode invokeRpcInput = makeRPCInput("foo");
@SuppressWarnings({"unchecked", "rawtypes"})
- final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
+ final ArgumentCaptor<NormalizedNode> inputCaptor =
(ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
- when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
+ when(domRpcService2.invokeRpc(eq(TEST_RPC), inputCaptor.capture())).thenReturn(
FluentFutures.immediateFailedFluentFuture(new RemoteDOMRpcException("Test Exception", null)));
final ListenableFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
@Ignore
@Test(expected = RemoteDOMRpcException.class)
public void testInvokeRpcWithAkkaTimeoutException() throws Exception {
- final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
+ final NormalizedNode invokeRpcInput = makeRPCInput("foo");
final ListenableFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
@Test(expected = DOMRpcException.class)
@SuppressWarnings({"checkstyle:AvoidHidingCauseException", "checkstyle:IllegalThrows"})
public void testInvokeRpcWithLookupException() throws Throwable {
- final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
+ final NormalizedNode invokeRpcInput = makeRPCInput("foo");
- doThrow(new RuntimeException("test")).when(domRpcService2).invokeRpc(any(SchemaPath.class),
+ doThrow(new RuntimeException("test")).when(domRpcService2).invokeRpc(any(QName.class),
any(NormalizedNode.class));
final ListenableFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
public void testInvokeActionWithLookupException() throws Throwable {
final ContainerNode invokeRpcInput = makeRPCInput("foo");
- doThrow(new RuntimeException("test")).when(domActionService2).invokeAction(any(SchemaPath.class),
+ doThrow(new RuntimeException("test")).when(domActionService2).invokeAction(any(Absolute.class),
any(DOMDataTreeIdentifier.class), any(ContainerNode.class));
final ListenableFuture<DOMActionResult> frontEndFuture = remoteActionImpl1.invokeAction(TEST_RPC_TYPE,