Convert sal-remoterpc to mdsal APIs 97/74597/1
authorTom Pantelis <tompantelis@gmail.com>
Fri, 27 Jul 2018 21:12:04 +0000 (17:12 -0400)
committerTom Pantelis <tompantelis@gmail.com>
Fri, 27 Jul 2018 21:12:04 +0000 (17:12 -0400)
Change-Id: I161be27bce6f5f453e7324a737c4057493d80fa2
Signed-off-by: Tom Pantelis <tompantelis@gmail.com>
25 files changed:
opendaylight/md-sal/sal-remoterpc-connector/pom.xml
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteDOMRpcException.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteDOMRpcFuture.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/RemoteRpcProvider.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteRpcProviderFactory.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcErrorsException.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcInvoker.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcListener.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcManager.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RpcRegistrar.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/registry/RoutingTable.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistry.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteRpcRegistryMXBeanImpl.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/resources/org/opendaylight/blueprint/remote-rpc.xml
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/AbstractRpcTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RemoteRpcImplementationTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RemoteRpcProviderFactoryTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RemoteRpcProviderTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcBrokerTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcListenerTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/RpcRegistrarTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/RpcRegistryTest.java
opendaylight/md-sal/sal-remoterpc-connector/src/test/java/org/opendaylight/controller/remote/rpc/registry/mbeans/RemoteRpcRegistryMXBeanImplTest.java

index 56e1d73..df8d8d1 100644 (file)
             <artifactId>sal-common-util</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.opendaylight.controller</groupId>
-            <artifactId>sal-core-api</artifactId>
+            <groupId>org.opendaylight.mdsal</groupId>
+           <artifactId>mdsal-dom-api</artifactId>
         </dependency>
         <dependency>
-            <groupId>org.opendaylight.controller</groupId>
-            <artifactId>sal-core-spi</artifactId>
+            <groupId>org.opendaylight.mdsal</groupId>
+           <artifactId>mdsal-dom-spi</artifactId>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
index 046b204..eb9486d 100644 (file)
@@ -10,14 +10,14 @@ package org.opendaylight.controller.remote.rpc;
 import akka.dispatch.OnComplete;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.AbstractFuture;
-import com.google.common.util.concurrent.CheckedFuture;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
-import org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult;
+import javax.annotation.Nonnull;
 import org.opendaylight.controller.remote.rpc.messages.RpcResponse;
+import org.opendaylight.mdsal.dom.api.DOMRpcException;
+import org.opendaylight.mdsal.dom.api.DOMRpcResult;
+import org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
@@ -25,8 +25,7 @@ import org.slf4j.LoggerFactory;
 import scala.concurrent.ExecutionContext;
 import scala.concurrent.Future;
 
-final class RemoteDOMRpcFuture extends AbstractFuture<DOMRpcResult>
-        implements CheckedFuture<DOMRpcResult, DOMRpcException> {
+final class RemoteDOMRpcFuture extends AbstractFuture<DOMRpcResult> {
 
     private static final Logger LOG = LoggerFactory.getLogger(RemoteDOMRpcFuture.class);
 
@@ -50,33 +49,31 @@ final class RemoteDOMRpcFuture extends AbstractFuture<DOMRpcResult>
     }
 
     @Override
-    public DOMRpcResult checkedGet() throws DOMRpcException {
+    public DOMRpcResult get() throws InterruptedException, ExecutionException {
         try {
-            return get();
-        } catch (final ExecutionException e) {
+            return super.get();
+        } catch (ExecutionException e) {
             throw mapException(e);
-        } catch (final InterruptedException e) {
-            throw new RemoteDOMRpcException("Interruped while invoking RPC", e);
         }
     }
 
     @Override
-    public DOMRpcResult checkedGet(final long timeout, final TimeUnit unit) throws TimeoutException, DOMRpcException {
+    public DOMRpcResult get(final long timeout, @Nonnull final TimeUnit unit)
+            throws InterruptedException, ExecutionException, TimeoutException {
         try {
-            return get(timeout, unit);
+            return super.get(timeout, unit);
         } catch (final ExecutionException e) {
             throw mapException(e);
-        } catch (final InterruptedException e) {
-            throw new RemoteDOMRpcException("Interruped while invoking RPC", e);
         }
     }
 
-    private static DOMRpcException mapException(final ExecutionException ex) {
+    private static ExecutionException mapException(final ExecutionException ex) {
         final Throwable cause = ex.getCause();
         if (cause instanceof DOMRpcException) {
-            return (DOMRpcException) cause;
+            return ex;
         }
-        return new RemoteDOMRpcException("Exception during invoking RPC", ex);
+        return new ExecutionException(ex.getMessage(),
+                new RemoteDOMRpcException("Exception during invoking RPC", ex.getCause()));
     }
 
     private final class FutureUpdater extends OnComplete<Object> {
@@ -100,5 +97,4 @@ final class RemoteDOMRpcFuture extends AbstractFuture<DOMRpcResult>
             }
         }
     }
-
 }
index 067386e..45a847f 100644 (file)
@@ -12,12 +12,11 @@ import akka.actor.ActorRef;
 import akka.pattern.Patterns;
 import akka.util.Timeout;
 import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
+import com.google.common.util.concurrent.FluentFuture;
 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;
 
 /**
@@ -38,7 +37,7 @@ final class RemoteRpcImplementation implements DOMRpcImplementation {
     }
 
     @Override
-    public CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final DOMRpcIdentifier rpc,
+    public FluentFuture<DOMRpcResult> invokeRpc(final DOMRpcIdentifier rpc,
             final NormalizedNode<?, ?> input) {
         final RemoteDOMRpcFuture ret = RemoteDOMRpcFuture.create(rpc.getType().getLastComponent());
         ret.completeWith(Patterns.ask(remoteInvoker, ExecuteRpc.from(rpc, input), askDuration));
index 51e56d0..6bf84a9 100644 (file)
@@ -12,8 +12,8 @@ import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 import akka.actor.PoisonPill;
 import com.google.common.base.Preconditions;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
+import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
+import org.opendaylight.mdsal.dom.api.DOMRpcService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index cc77e4c..58a7001 100644 (file)
@@ -9,8 +9,8 @@
 package org.opendaylight.controller.remote.rpc;
 
 import akka.actor.ActorSystem;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
+import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
+import org.opendaylight.mdsal.dom.api.DOMRpcService;
 
 public final class RemoteRpcProviderFactory {
     private RemoteRpcProviderFactory() {
index 7f2e0b1..c8fbe7c 100644 (file)
@@ -12,7 +12,7 @@ import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
+import org.opendaylight.mdsal.dom.api.DOMRpcException;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
 import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
index 4c3ad7e..23b73f2 100644 (file)
@@ -17,10 +17,10 @@ import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
 import org.opendaylight.controller.remote.rpc.messages.ExecuteRpc;
 import org.opendaylight.controller.remote.rpc.messages.RpcResponse;
+import org.opendaylight.mdsal.dom.api.DOMRpcResult;
+import org.opendaylight.mdsal.dom.api.DOMRpcService;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
index bd0ee02..434f480 100644 (file)
@@ -11,12 +11,12 @@ import akka.actor.ActorRef;
 import com.google.common.base.Preconditions;
 import java.util.Collection;
 import javax.annotation.Nonnull;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcAvailabilityListener;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementation;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.AddOrUpdateRoutes;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.RemoveRoutes;
+import org.opendaylight.mdsal.dom.api.DOMRpcAvailabilityListener;
+import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
+import org.opendaylight.mdsal.dom.api.DOMRpcImplementation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
index a863166..e289d7d 100644 (file)
@@ -14,9 +14,9 @@ import akka.actor.Props;
 import akka.actor.SupervisorStrategy;
 import com.google.common.base.Preconditions;
 import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry;
+import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
+import org.opendaylight.mdsal.dom.api.DOMRpcService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import scala.concurrent.duration.Duration;
 
index 957b95d..5fc088d 100644 (file)
@@ -17,10 +17,10 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Optional;
 import org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationRegistration;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.UpdateRemoteEndpoints;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.RemoteRpcEndpoint;
+import org.opendaylight.mdsal.dom.api.DOMRpcImplementationRegistration;
+import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
 
 /**
  * Actor handling registration of RPCs available on remote nodes with the local {@link DOMRpcProviderService}.
index be76674..ec17297 100644 (file)
@@ -18,7 +18,7 @@ import java.io.Serializable;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import org.opendaylight.controller.cluster.datastore.node.utils.stream.SerializationUtils;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
+import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
index 2f95131..5159b96 100644 (file)
@@ -27,8 +27,8 @@ import java.util.Set;
 import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeDataInput;
 import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeDataOutput;
 import org.opendaylight.controller.cluster.datastore.node.utils.stream.NormalizedNodeInputOutput;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.controller.remote.rpc.registry.gossip.BucketData;
+import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
 
 public final class RoutingTable implements BucketData<RoutingTable>, Serializable {
     private static final class Proxy implements Externalizable {
index cefe752..5ba97a3 100644 (file)
@@ -22,7 +22,6 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Optional;
 import java.util.Set;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.controller.remote.rpc.RemoteRpcProviderConfig;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.AddOrUpdateRoutes;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.RemoveRoutes;
@@ -31,6 +30,7 @@ import org.opendaylight.controller.remote.rpc.registry.gossip.Bucket;
 import org.opendaylight.controller.remote.rpc.registry.gossip.BucketStoreAccess;
 import org.opendaylight.controller.remote.rpc.registry.gossip.BucketStoreActor;
 import org.opendaylight.controller.remote.rpc.registry.mbeans.RemoteRpcRegistryMXBeanImpl;
+import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
 
 /**
  * Registry to look up cluster nodes that have registered for a given RPC.
index 94a8d4a..22c18f0 100644 (file)
@@ -16,10 +16,10 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 import org.opendaylight.controller.md.sal.common.util.jmx.AbstractMXBean;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.controller.remote.rpc.registry.RoutingTable;
 import org.opendaylight.controller.remote.rpc.registry.gossip.Bucket;
 import org.opendaylight.controller.remote.rpc.registry.gossip.BucketStoreAccess;
+import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import scala.concurrent.Await;
index be8f94b..e6d19a1 100644 (file)
@@ -12,8 +12,8 @@
   </cm:property-placeholder>
 
   <reference id="actorSystemProvider" interface="org.opendaylight.controller.cluster.ActorSystemProvider" />
-  <reference id="domRpcService" interface="org.opendaylight.controller.md.sal.dom.api.DOMRpcService"/>
-  <reference id="domRpcRegistry" interface="org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService"/>
+  <reference id="domRpcService" interface="org.opendaylight.mdsal.dom.api.DOMRpcService"/>
+  <reference id="domRpcRegistry" interface="org.opendaylight.mdsal.dom.api.DOMRpcProviderService"/>
 
   <bean id="actorSystem" factory-ref="actorSystemProvider" factory-method="getActorSystem"/>
 
index 034205b..e512938 100644 (file)
@@ -23,9 +23,9 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
+import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
+import org.opendaylight.mdsal.dom.api.DOMRpcResult;
+import org.opendaylight.mdsal.dom.api.DOMRpcService;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.RpcError;
 import org.opendaylight.yangtools.yang.common.RpcError.ErrorSeverity;
index 0fe9dfe..6e755f1 100644 (file)
@@ -16,15 +16,16 @@ import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.when;
 
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.FluentFuture;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeUnit;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
-import org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult;
+import org.opendaylight.mdsal.dom.api.DOMRpcException;
+import org.opendaylight.mdsal.dom.api.DOMRpcResult;
+import org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult;
+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;
@@ -50,13 +51,12 @@ public class RemoteRpcImplementationTest extends AbstractRpcTest {
                 (ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
 
         when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
-                Futures.<DOMRpcResult, DOMRpcException>immediateCheckedFuture(rpcResult));
+                FluentFutures.immediateFluentFuture(rpcResult));
 
-        final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
-                remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
+        final FluentFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
         assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
 
-        final DOMRpcResult result = frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
+        final DOMRpcResult result = frontEndFuture.get(5, TimeUnit.SECONDS);
         assertEquals(rpcOutput, result.getResult());
     }
 
@@ -73,13 +73,12 @@ public class RemoteRpcImplementationTest extends AbstractRpcTest {
                 (ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
 
         when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
-                Futures.<DOMRpcResult, DOMRpcException>immediateCheckedFuture(rpcResult));
+                FluentFutures.immediateFluentFuture(rpcResult));
 
-        final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
-                remoteRpcImpl1.invokeRpc(TEST_RPC_ID, null);
+        FluentFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, null);
         assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
 
-        final DOMRpcResult result = frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
+        final DOMRpcResult result = frontEndFuture.get(5, TimeUnit.SECONDS);
         assertEquals(rpcOutput, result.getResult());
     }
 
@@ -97,34 +96,37 @@ public class RemoteRpcImplementationTest extends AbstractRpcTest {
                 (ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
 
         when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
-                Futures.<DOMRpcResult, DOMRpcException>immediateCheckedFuture(rpcResult));
+                FluentFutures.immediateFluentFuture(rpcResult));
 
-        final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
-                remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
+        final FluentFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
         assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
 
-        final DOMRpcResult result = frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
+        final DOMRpcResult result = frontEndFuture.get(5, TimeUnit.SECONDS);
         assertNull(result.getResult());
     }
 
     /**
      * This test method invokes and executes the remote rpc.
      */
+    @SuppressWarnings({"checkstyle:AvoidHidingCauseException", "checkstyle:IllegalThrows"})
     @Test(expected = DOMRpcException.class)
-    public void testInvokeRpcWithRemoteFailedFuture() throws Exception {
+    public void testInvokeRpcWithRemoteFailedFuture() throws Throwable {
         final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
         @SuppressWarnings({"unchecked", "rawtypes"})
         final ArgumentCaptor<NormalizedNode<?, ?>> inputCaptor =
                 (ArgumentCaptor) ArgumentCaptor.forClass(NormalizedNode.class);
 
         when(domRpcService2.invokeRpc(eq(TEST_RPC_TYPE), inputCaptor.capture())).thenReturn(
-                Futures.<DOMRpcResult, DOMRpcException>immediateFailedCheckedFuture(new RemoteDOMRpcException(
-                        "Test Exception", null)));
+                FluentFutures.immediateFailedFluentFuture(new RemoteDOMRpcException("Test Exception", null)));
 
-        final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
-                remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
+        final FluentFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
         assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
-        frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
+
+        try {
+            frontEndFuture.get(5, TimeUnit.SECONDS);
+        } catch (ExecutionException e) {
+            throw e.getCause();
+        }
     }
 
     /**
@@ -135,11 +137,10 @@ public class RemoteRpcImplementationTest extends AbstractRpcTest {
     @Test(expected = RemoteDOMRpcException.class)
     public void testInvokeRpcWithAkkaTimeoutException() throws Exception {
         final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
-        final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
-                remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
+        final FluentFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
         assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
 
-        frontEndFuture.checkedGet(20, TimeUnit.SECONDS);
+        frontEndFuture.get(20, TimeUnit.SECONDS);
     }
 
     /**
@@ -147,16 +148,20 @@ public class RemoteRpcImplementationTest extends AbstractRpcTest {
      * with runtime exception.
      */
     @Test(expected = DOMRpcException.class)
-    public void testInvokeRpcWithLookupException() throws Exception {
+    @SuppressWarnings({"checkstyle:AvoidHidingCauseException", "checkstyle:IllegalThrows"})
+    public void testInvokeRpcWithLookupException() throws Throwable {
         final NormalizedNode<?, ?> invokeRpcInput = makeRPCInput("foo");
 
         doThrow(new RuntimeException("test")).when(domRpcService2).invokeRpc(any(SchemaPath.class),
             any(NormalizedNode.class));
 
-        final CheckedFuture<DOMRpcResult, DOMRpcException> frontEndFuture =
-                remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
+        final FluentFuture<DOMRpcResult> frontEndFuture = remoteRpcImpl1.invokeRpc(TEST_RPC_ID, invokeRpcInput);
         assertTrue(frontEndFuture instanceof RemoteDOMRpcFuture);
 
-        frontEndFuture.checkedGet(5, TimeUnit.SECONDS);
+        try {
+            frontEndFuture.get(5, TimeUnit.SECONDS);
+        } catch (ExecutionException e) {
+            throw e.getCause();
+        }
     }
 }
index 31e1032..3481d5b 100644 (file)
@@ -14,8 +14,8 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
+import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
+import org.opendaylight.mdsal.dom.api.DOMRpcService;
 
 public class RemoteRpcProviderFactoryTest {
 
@@ -58,4 +58,4 @@ public class RemoteRpcProviderFactoryTest {
     public void testCreateInstanceMissingProviderConfig() {
         RemoteRpcProviderFactory.createInstance(providerService, rpcService, actorSystem, null);
     }
-}
\ No newline at end of file
+}
index e61856a..c84197c 100644 (file)
@@ -20,8 +20,8 @@ import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
+import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
+import org.opendaylight.mdsal.dom.api.DOMRpcService;
 import scala.concurrent.Await;
 import scala.concurrent.duration.Duration;
 
index d588736..18e4348 100644 (file)
@@ -14,16 +14,16 @@ import static org.mockito.Mockito.when;
 
 import akka.actor.Status.Failure;
 import akka.testkit.javadsl.TestKit;
-import com.google.common.util.concurrent.Futures;
 import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.Mockito;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationNotAvailableException;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
-import org.opendaylight.controller.md.sal.dom.spi.DefaultDOMRpcResult;
 import org.opendaylight.controller.remote.rpc.messages.ExecuteRpc;
 import org.opendaylight.controller.remote.rpc.messages.RpcResponse;
+import org.opendaylight.mdsal.dom.api.DOMRpcException;
+import org.opendaylight.mdsal.dom.api.DOMRpcImplementationNotAvailableException;
+import org.opendaylight.mdsal.dom.api.DOMRpcResult;
+import org.opendaylight.mdsal.dom.spi.DefaultDOMRpcResult;
+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;
 
@@ -37,7 +37,7 @@ public class RpcBrokerTest extends AbstractRpcTest {
                 final ContainerNode invokeRpcResult = makeRPCOutput("bar");
                 final DOMRpcResult rpcResult = new DefaultDOMRpcResult(invokeRpcResult);
                 when(domRpcService1.invokeRpc(eq(TEST_RPC_TYPE), Mockito.<NormalizedNode<?, ?>>any())).thenReturn(
-                        Futures.<DOMRpcResult, DOMRpcException>immediateCheckedFuture(rpcResult));
+                        FluentFutures.immediateFluentFuture(rpcResult));
 
                 final ExecuteRpc executeMsg = ExecuteRpc.from(TEST_RPC_ID, null);
 
@@ -55,7 +55,7 @@ public class RpcBrokerTest extends AbstractRpcTest {
         new TestKit(node1) {
             {
                 when(domRpcService1.invokeRpc(eq(TEST_RPC_TYPE), Mockito.<NormalizedNode<?, ?>>any()))
-                        .thenReturn(Futures.<DOMRpcResult, DOMRpcException>immediateFailedCheckedFuture(
+                        .thenReturn(FluentFutures.immediateFailedFluentFuture(
                                 new DOMRpcImplementationNotAvailableException("NOT FOUND")));
 
                 final ExecuteRpc executeMsg = ExecuteRpc.from(TEST_RPC_ID, null);
index ba6fc26..8b1892e 100644 (file)
@@ -16,8 +16,8 @@ import java.util.Collections;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry;
+import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
index 83f7e15..48b825a 100644 (file)
@@ -24,11 +24,11 @@ import org.mockito.InOrder;
 import org.mockito.Mock;
 import org.mockito.Mockito;
 import org.mockito.MockitoAnnotations;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcImplementationRegistration;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcProviderService;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.UpdateRemoteEndpoints;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.RemoteRpcEndpoint;
+import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
+import org.opendaylight.mdsal.dom.api.DOMRpcImplementationRegistration;
+import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
index 7c34f26..0d3b368 100644 (file)
@@ -42,13 +42,13 @@ import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.common.actor.AkkaConfigurationReader;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.controller.remote.rpc.RemoteRpcProviderConfig;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.AddOrUpdateRoutes;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.RemoveRoutes;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.Messages.UpdateRemoteEndpoints;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry.RemoteRpcEndpoint;
 import org.opendaylight.controller.remote.rpc.registry.gossip.Bucket;
+import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.slf4j.Logger;
index 4210437..d445ae1 100644 (file)
@@ -24,10 +24,10 @@ import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.controller.md.sal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.controller.remote.rpc.RemoteRpcProviderConfig;
 import org.opendaylight.controller.remote.rpc.registry.RpcRegistry;
 import org.opendaylight.controller.remote.rpc.registry.gossip.BucketStoreAccess;
+import org.opendaylight.mdsal.dom.api.DOMRpcIdentifier;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;

©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.