Adjust for RPCService methods changing 05/89305/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 22 Apr 2020 23:29:18 +0000 (01:29 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 23 Apr 2020 07:00:31 +0000 (09:00 +0200)
ListenableFuture return from the API contract has changed slightly,
adjust for that. Also make sure we do not pass nulls to RPC
invocation.

JIRA: MDSAL-303
Change-Id: I62e6adc5d7226267c4c3c125ebb2fd43b3af1a5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 files changed:
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/AbstractRemoteImplementation.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/OpsInvoker.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcImplementation.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/AbstractExecute.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/AbstractResponse.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/ActionResponse.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/ExecuteAction.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/ExecuteRpc.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/messages/RpcResponse.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/OpsBrokerTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RemoteOpsImplementationTest.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/GetConstantService.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/RoutedGetConstantService.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/SingletonGetConstantService.java

index 6a8030f..9a5df49 100644 (file)
@@ -18,7 +18,7 @@ import scala.concurrent.Future;
 /**
  * An abstract base class for remote RPC/action implementations.
  */
-abstract class AbstractRemoteImplementation<T extends AbstractExecute<?>> {
+abstract class AbstractRemoteImplementation<T extends AbstractExecute> {
     // 0 for local, 1 for binding, 2 for remote
     static final long COST = 2;
 
index 2f1ac92..5ccea6a 100644 (file)
@@ -82,7 +82,7 @@ final class OpsInvoker extends AbstractUntypedActor {
         LOG.debug("Executing RPC {}", msg.getType());
         final ActorRef sender = getSender();
 
-        final ListenableFuture<DOMRpcResult> future;
+        final ListenableFuture<? extends DOMRpcResult> future;
         try {
             future = rpcService.invokeRpc(msg.getType(), msg.getInput());
         } catch (final RuntimeException e) {
index a737049..3046f7e 100644 (file)
@@ -13,7 +13,7 @@ import org.opendaylight.controller.remote.rpc.messages.ExecuteRpc;
 import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.mdsal.dom.api.DOMRpcImplementation;
 import org.opendaylight.mdsal.dom.api.DOMRpcResult;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
 /**
  * A {@link DOMRpcImplementation} which routes invocation requests to a remote invoker actor.
@@ -26,8 +26,7 @@ final class RemoteRpcImplementation extends AbstractRemoteImplementation<Execute
     }
 
     @Override
-    public ListenableFuture<DOMRpcResult> invokeRpc(final DOMRpcIdentifier rpc,
-            final NormalizedNode<?, ?> input) {
+    public ListenableFuture<DOMRpcResult> invokeRpc(final DOMRpcIdentifier rpc, final ContainerNode input) {
         return new RemoteDOMRpcFuture(rpc.getType(), ask(ExecuteRpc.from(rpc, input)));
     }
 
index a23bcb3..9e50d03 100644 (file)
@@ -13,28 +13,28 @@ import com.google.common.base.MoreObjects;
 import com.google.common.base.MoreObjects.ToStringHelper;
 import java.io.Serializable;
 import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 /**
  * An abstract base class for invocation requests. Specialized via {@link ExecuteAction} and {@link ExecuteRpc}.
  */
-public abstract class AbstractExecute<T extends NormalizedNode<?, ?>> implements Serializable {
+public abstract class AbstractExecute implements Serializable {
     private static final long serialVersionUID = 1L;
 
     private final transient @NonNull SchemaPath type;
-    private final transient T input;
+    private final transient @NonNull ContainerNode input;
 
-    AbstractExecute(final @NonNull SchemaPath type, final T input) {
+    AbstractExecute(final @NonNull SchemaPath type, final ContainerNode input) {
         this.type = requireNonNull(type);
-        this.input = input;
+        this.input = requireNonNull(input);
     }
 
     public final @NonNull SchemaPath getType() {
         return type;
     }
 
-    public final T getInput() {
+    public final @NonNull ContainerNode getInput() {
         return input;
     }
 
index 1789753..6651853 100644 (file)
@@ -9,21 +9,21 @@ package org.opendaylight.controller.remote.rpc.messages;
 
 import java.io.Serializable;
 import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
 /**
  * An abstract base class for invocation responses. Specialized via {@link ActionResponse} and {@link RpcResponse}.
  */
-public abstract class AbstractResponse<T extends NormalizedNode<?, ?>> implements Serializable {
+public abstract class AbstractResponse implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    private final transient @Nullable T output;
+    private final transient @Nullable ContainerNode output;
 
-    public AbstractResponse(final @Nullable T output) {
+    public AbstractResponse(final @Nullable ContainerNode output) {
         this.output = output;
     }
 
-    public final @Nullable T getOutput() {
+    public final @Nullable ContainerNode getOutput() {
         return output;
     }
 
index d6a2358..a1f2a7a 100644 (file)
@@ -24,7 +24,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
 @SuppressFBWarnings({"SE_TRANSIENT_FIELD_NOT_RESTORED", "DMI_NONSERIALIZABLE_OBJECT_WRITTEN"})
-public class ActionResponse extends AbstractResponse<ContainerNode> {
+public class ActionResponse extends AbstractResponse {
     private static final long serialVersionUID = 1L;
 
     private final transient @NonNull ImmutableList<@NonNull RpcError> errors;
index 4fb9c61..977734b 100644 (file)
@@ -18,14 +18,16 @@ import java.io.ObjectOutput;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier;
+import org.opendaylight.yangtools.yang.common.YangConstants;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.codec.binfmt.NormalizedNodeDataInput;
 import org.opendaylight.yangtools.yang.data.codec.binfmt.NormalizedNodeDataOutput;
 import org.opendaylight.yangtools.yang.data.codec.binfmt.NormalizedNodeStreamVersion;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
-public final class ExecuteAction extends AbstractExecute<@NonNull ContainerNode> {
+public final class ExecuteAction extends AbstractExecute {
     private static final long serialVersionUID = 1128904894827335676L;
 
     private final @NonNull DOMDataTreeIdentifier path;
@@ -87,7 +89,11 @@ public final class ExecuteAction extends AbstractExecute<@NonNull ContainerNode>
             final SchemaPath name = stream.readSchemaPath();
             final LogicalDatastoreType type = LogicalDatastoreType.readFrom(in);
             final YangInstanceIdentifier path = stream.readYangInstanceIdentifier();
-            final ContainerNode input = (ContainerNode) stream.readOptionalNormalizedNode().orElse(null);
+            ContainerNode input = (ContainerNode) stream.readOptionalNormalizedNode().orElse(null);
+            if (input == null) {
+                input = ImmutableNodes.containerNode(
+                    YangConstants.operationInputQName(name.getLastComponent().getModule()));
+            }
 
             executeAction = new ExecuteAction(name, new DOMDataTreeIdentifier(type, path), input);
         }
index 135111f..3f0cc35 100644 (file)
@@ -14,23 +14,23 @@ import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import org.eclipse.jdt.annotation.NonNull;
-import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.common.YangConstants;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.codec.binfmt.NormalizedNodeDataInput;
 import org.opendaylight.yangtools.yang.data.codec.binfmt.NormalizedNodeDataOutput;
 import org.opendaylight.yangtools.yang.data.codec.binfmt.NormalizedNodeStreamVersion;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
-public final class ExecuteRpc extends AbstractExecute<@Nullable NormalizedNode<?, ?>> {
+public final class ExecuteRpc extends AbstractExecute {
     private static final long serialVersionUID = 1128904894827335676L;
 
-    private ExecuteRpc(final @NonNull SchemaPath type, final @Nullable NormalizedNode<?, ?> input) {
+    private ExecuteRpc(final @NonNull SchemaPath type, final @NonNull ContainerNode input) {
         super(type, input);
     }
 
-    public static @NonNull ExecuteRpc from(final @NonNull DOMRpcIdentifier rpc,
-            final @Nullable NormalizedNode<?, ?> input) {
+    public static @NonNull ExecuteRpc from(final @NonNull DOMRpcIdentifier rpc, final @NonNull ContainerNode input) {
         return new ExecuteRpc(rpc.getType(), input);
     }
 
@@ -67,7 +67,11 @@ public final class ExecuteRpc extends AbstractExecute<@Nullable NormalizedNode<?
         public void readExternal(final ObjectInput in) throws IOException {
             final NormalizedNodeDataInput stream = NormalizedNodeDataInput.newDataInput(in);
             final SchemaPath type = SchemaPath.ROOT.createChild(stream.readQName());
-            final NormalizedNode<?, ?> input = stream.readOptionalNormalizedNode().orElse(null);
+            ContainerNode input = (ContainerNode) stream.readOptionalNormalizedNode().orElse(null);
+            if (input == null) {
+                input = ImmutableNodes.containerNode(
+                    YangConstants.operationInputQName(type.getLastComponent().getModule()));
+            }
             executeRpc = new ExecuteRpc(type, input);
         }
 
index f141f09..a2f4f1f 100644 (file)
@@ -13,12 +13,12 @@ import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.datastore.node.utils.stream.SerializationUtils;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
-public class RpcResponse extends AbstractResponse<NormalizedNode<?, ?>> {
+public class RpcResponse extends AbstractResponse {
     private static final long serialVersionUID = -4211279498688989245L;
 
-    public RpcResponse(final @Nullable NormalizedNode<?, ?> output) {
+    public RpcResponse(final @Nullable ContainerNode output) {
         super(output);
     }
 
@@ -49,7 +49,7 @@ public class RpcResponse extends AbstractResponse<NormalizedNode<?, ?>> {
 
         @Override
         public void readExternal(final ObjectInput in) throws IOException {
-            rpcResponse = new RpcResponse(SerializationUtils.readNormalizedNode(in).orElse(null));
+            rpcResponse = new RpcResponse((ContainerNode) SerializationUtils.readNormalizedNode(in).orElse(null));
         }
 
         private Object readResolve() {
index 793740c..b8b5b7c 100644 (file)
@@ -11,7 +11,8 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
 
 import akka.actor.Status.Failure;
 import java.time.Duration;
@@ -26,14 +27,12 @@ import org.opendaylight.yangtools.util.concurrent.FluentFutures;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 
 public class OpsBrokerTest extends AbstractOpsTest {
-
     @Test
     public void testExecuteRpc() {
-        final ContainerNode invokeRpcResult = makeRPCOutput("bar");
-        final DOMRpcResult rpcResult = new DefaultDOMRpcResult(invokeRpcResult);
-        when(domRpcService1.invokeRpc(eq(TEST_RPC_TYPE), any())).thenReturn(
-            FluentFutures.immediateFluentFuture(rpcResult));
-        final ExecuteRpc executeRpc = ExecuteRpc.from(TEST_RPC_ID, null);
+        final DOMRpcResult rpcResult = new DefaultDOMRpcResult(makeRPCOutput("bar"));
+        doReturn(FluentFutures.immediateFluentFuture(rpcResult)).when(domRpcService1)
+            .invokeRpc(eq(TEST_RPC_TYPE), any());
+        final ExecuteRpc executeRpc = ExecuteRpc.from(TEST_RPC_ID, mock(ContainerNode.class));
 
         rpcInvoker1.tell(executeRpc, rpcRegistry1Probe.getRef());
 
@@ -44,10 +43,10 @@ public class OpsBrokerTest extends AbstractOpsTest {
 
     @Test
     public void testExecuteRpcFailureWithException() {
-        when(domRpcService1.invokeRpc(eq(TEST_RPC_TYPE), any())).thenReturn(FluentFutures.immediateFailedFluentFuture(
-            new DOMRpcImplementationNotAvailableException("NOT FOUND")));
+        doReturn(FluentFutures.immediateFailedFluentFuture(new DOMRpcImplementationNotAvailableException("NOT FOUND")))
+            .when(domRpcService1).invokeRpc(eq(TEST_RPC_TYPE), any());
 
-        final ExecuteRpc executeMsg = ExecuteRpc.from(TEST_RPC_ID, null);
+        final ExecuteRpc executeMsg = ExecuteRpc.from(TEST_RPC_ID, mock(ContainerNode.class));
 
         rpcInvoker1.tell(executeMsg, rpcRegistry1Probe.getRef());
 
index 6a76812..f2aeb2b 100644 (file)
@@ -33,7 +33,6 @@ 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.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 /**
@@ -51,15 +50,11 @@ public class RemoteOpsImplementationTest extends AbstractOpsTest {
         final ContainerNode rpcOutput = makeRPCOutput("bar");
         final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);
 
-//        Answer<FluentFuture<DOMRpcResult>> answer = FluentFutures.immediateFluentFuture(rpcResult);
-
-        final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
-        @SuppressWarnings({"unchecked", "rawtypes"})
-        final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
-                ArgumentCaptor.forClass(NormalizedNode.class);
+        final ContainerNode invokeRpcInput = makeRPCInput("foo");
+        final ArgumentCaptor<ContainerNode> inputCaptor = ArgumentCaptor.forClass(ContainerNode.class);
 
-        when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
-                FluentFutures.immediateFluentFuture(rpcResult));
+        doReturn(FluentFutures.immediateFluentFuture(rpcResult)).when(domRpcService2)
+            .invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture());
 
         final ListenableFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
         assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
@@ -75,42 +70,18 @@ public class RemoteOpsImplementationTest extends AbstractOpsTest {
     public void testInvokeAction() throws Exception {
         final ContainerNode actionOutput = makeRPCOutput("bar");
         final DOMActionResult actionResult = new SimpleDOMActionResult(actionOutput, Collections.emptyList());
-        final NormalizedNode<?, ?> invokeActionInput = makeRPCInput("foo");
-        @SuppressWarnings({"unchecked", "rawtypes"})
-        final ArgumentCaptor<ContainerNode> inputCaptor =
-                ArgumentCaptor.forClass(ContainerNode.class);
+        final ContainerNode invokeActionInput = makeRPCInput("foo");
+        final ArgumentCaptor<ContainerNode> inputCaptor = ArgumentCaptor.forClass(ContainerNode.class);
         doReturn(FluentFutures.immediateFluentFuture(actionResult)).when(domActionService2).invokeAction(
                 eq(TEST_RPC_TYPE), eq(TEST_DATA_TREE_ID), inputCaptor.capture());
         final ListenableFuture<DOMActionResult> frontEndFuture = remoteActionImpl1.invokeAction(TEST_RPC_TYPE,
-                TEST_DATA_TREE_ID, (ContainerNode) invokeActionInput);
+                TEST_DATA_TREE_ID, invokeActionInput);
         assertTrue(frontEndFuture instanceof RemoteDOMActionFuture);
         final DOMActionResult result = frontEndFuture.get(5, TimeUnit.SECONDS);
         assertEquals(actionOutput, result.getOutput().get());
 
     }
 
-    /**
-     * This test method invokes and executes the remote rpc.
-     */
-    @Test
-    public void testInvokeRpcWithNullInput() throws Exception {
-        final ContainerNode rpcOutput = makeRPCOutput("bar");
-        final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);
-
-        @SuppressWarnings({"unchecked", "rawtypes"})
-        final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
-                (ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
-
-        when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
-                FluentFutures.immediateFluentFuture(rpcResult));
-
-        ListenableFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, null);
-        assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
-
-        final DOMRpcResult result = frontEndFuture.get(5, TimeUnit.SECONDS);
-        assertEquals(rpcOutput, result.getResult());
-    }
-
     /**
      * This test method invokes and executes the remote action.
      */
@@ -119,9 +90,7 @@ public class RemoteOpsImplementationTest extends AbstractOpsTest {
         final ContainerNode actionOutput = makeRPCOutput("bar");
         final DOMActionResult actionResult = new SimpleDOMActionResult(actionOutput);
 
-        @SuppressWarnings({"unchecked", "rawtypes"})
-            final ArgumentCaptor<ContainerNode> inputCaptor =
-                  ArgumentCaptor.forClass(ContainerNode.class);
+        final ArgumentCaptor<ContainerNode> inputCaptor = ArgumentCaptor.forClass(ContainerNode.class);
         doReturn(FluentFutures.immediateFluentFuture(actionResult)).when(domActionService2).invokeAction(
                 eq(TEST_RPC_TYPE), eq(TEST_DATA_TREE_ID), inputCaptor.capture());
 
@@ -141,13 +110,11 @@ public class RemoteOpsImplementationTest extends AbstractOpsTest {
         final ContainerNode rpcOutput = null;
         final DOMRpcResult rpcResult = new DefaultDOMRpcResult(rpcOutput);
 
-        final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
-        @SuppressWarnings({"unchecked", "rawtypes"})
-        final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
-                (ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
+        final ContainerNode invokeRpcInput = makeRPCInput("foo");
+        final ArgumentCaptor<ContainerNode> inputCaptor = ArgumentCaptor.forClass(ContainerNode.class);
 
-        when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
-                FluentFutures.immediateFluentFuture(rpcResult));
+        doReturn(FluentFutures.immediateFluentFuture(rpcResult)).when(domRpcService2)
+            .invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture());
 
         final ListenableFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
         assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
@@ -162,10 +129,8 @@ public class RemoteOpsImplementationTest extends AbstractOpsTest {
     @SuppressWarnings({"checkstyle:AvoidHidingCauseException", "checkstyle:IllegalThrows"})
     @Test(expected = DOMRpcException.class)
     public void testInvokeRpcWithRemoteFailedFuture() throws Throwable {
-        final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
-        @SuppressWarnings({"unchecked", "rawtypes"})
-        final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
-                (ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
+        final ContainerNode invokeRpcInput = makeRPCInput("foo");
+        final ArgumentCaptor<ContainerNode> inputCaptor = ArgumentCaptor.forClass(ContainerNode.class);
 
         when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
                 FluentFutures.immediateFailedFluentFuture(new RemoteDOMRpcException("Test Exception", null)));
@@ -187,9 +152,7 @@ public class RemoteOpsImplementationTest extends AbstractOpsTest {
     @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);
+        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(
@@ -213,7 +176,7 @@ public class RemoteOpsImplementationTest extends AbstractOpsTest {
     @Ignore
     @Test(expected = RemoteDOMRpcException.class)
     public void testInvokeRpcWithAkkaTimeoutException() throws Exception {
-        final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
+        final ContainerNode invokeRpcInput = makeRPCInput("foo");
         final ListenableFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
         assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
 
@@ -227,10 +190,10 @@ public class RemoteOpsImplementationTest extends AbstractOpsTest {
     @Test(expected = DOMRpcException.class)
     @SuppressWarnings({"checkstyle:AvoidHidingCauseException", "checkstyle:IllegalThrows"})
     public void testInvokeRpcWithLookupException() throws Throwable {
-        final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
+        final ContainerNode invokeRpcInput = makeRPCInput("foo");
 
         doThrow(new RuntimeException("test")).when(domRpcService2).invokeRpc(any(SchemaPath.class),
-            any(NormalizedNode.class));
+            any(ContainerNode.class));
 
         final ListenableFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
         assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
index a800dc9..94a685f 100644 (file)
@@ -21,7 +21,7 @@ import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.common.Revision;
 import org.opendaylight.yangtools.yang.common.YangConstants;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
@@ -52,7 +52,8 @@ public final class GetConstantService implements DOMRpcImplementation {
     }
 
     @Override
-    public ListenableFuture<DOMRpcResult> invokeRpc(final DOMRpcIdentifier rpc, final NormalizedNode<?, ?> input) {
+    public ListenableFuture<? extends DOMRpcResult> invokeRpc(final DOMRpcIdentifier rpc,
+            final ContainerNode input) {
         LOG.debug("get-constant invoked, current value: {}", constant);
 
         return Futures.immediateFuture(new DefaultDOMRpcResult(ImmutableContainerNodeBuilder.create()
index 64470b0..37d2972 100644 (file)
@@ -24,7 +24,7 @@ import org.opendaylight.yangtools.yang.common.Revision;
 import org.opendaylight.yangtools.yang.common.YangConstants;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
@@ -59,7 +59,7 @@ public final class RoutedGetConstantService implements DOMRpcImplementation {
     }
 
     @Override
-    public ListenableFuture<DOMRpcResult> invokeRpc(final DOMRpcIdentifier rpc, final NormalizedNode<?, ?> input) {
+    public ListenableFuture<? extends DOMRpcResult> invokeRpc(final DOMRpcIdentifier rpc, final ContainerNode input) {
         LOG.debug("get-contexted-constant invoked, current value: {}", constant);
 
         return Futures.immediateFuture(new DefaultDOMRpcResult(ImmutableContainerNodeBuilder.create()
index ffa3b80..d69403a 100644 (file)
@@ -25,7 +25,7 @@ import org.opendaylight.yangtools.yang.common.QNameModule;
 import org.opendaylight.yangtools.yang.common.Revision;
 import org.opendaylight.yangtools.yang.common.YangConstants;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
@@ -65,7 +65,7 @@ public final class SingletonGetConstantService implements DOMRpcImplementation,
     }
 
     @Override
-    public ListenableFuture<DOMRpcResult> invokeRpc(final DOMRpcIdentifier rpc, final NormalizedNode<?, ?> input) {
+    public ListenableFuture<? extends DOMRpcResult> invokeRpc(final DOMRpcIdentifier rpc, final ContainerNode input) {
         LOG.debug("get-singleton-constant invoked, current value: {}", constant);
 
         return Futures.immediateFuture(new DefaultDOMRpcResult(ImmutableContainerNodeBuilder.create()

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.