Migrate to UntypedAbstractActor
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / test / java / org / opendaylight / controller / remote / rpc / RemoteRpcProviderTest.java
index 76e63c4e1d3da01d8aa7ce7a864f360d6f6b4dfe..c84197cf6abb462f859750d9e6031ed38c51ae45 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ * Copyright (c) 2014, 2017 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
@@ -9,11 +9,10 @@
 package org.opendaylight.controller.remote.rpc;
 
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
 
 import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
-import akka.testkit.JavaTestKit;
+import akka.testkit.javadsl.TestKit;
 import com.typesafe.config.Config;
 import com.typesafe.config.ConfigFactory;
 import java.util.concurrent.TimeUnit;
@@ -21,9 +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.controller.sal.core.api.Broker;
+import org.opendaylight.mdsal.dom.api.DOMRpcProviderService;
+import org.opendaylight.mdsal.dom.api.DOMRpcService;
 import scala.concurrent.Await;
 import scala.concurrent.duration.Duration;
 
@@ -32,7 +30,7 @@ public class RemoteRpcProviderTest {
     static RemoteRpcProviderConfig moduleConfig;
 
     @BeforeClass
-    public static void setup() throws InterruptedException {
+    public static void setup() {
         moduleConfig = new RemoteRpcProviderConfig.Builder("odl-cluster-rpc")
                 .withConfigReader(ConfigFactory::load).build();
         final Config config = moduleConfig.get();
@@ -42,18 +40,16 @@ public class RemoteRpcProviderTest {
 
     @AfterClass
     public static void teardown() {
-        JavaTestKit.shutdownActorSystem(system);
+        TestKit.shutdownActorSystem(system);
         system = null;
     }
 
     @Test
     public void testRemoteRpcProvider() throws Exception {
-        try (final RemoteRpcProvider rpcProvider = new RemoteRpcProvider(system, mock(DOMRpcProviderService.class),
-                new RemoteRpcProviderConfig(system.settings().config()))) {
-            final Broker.ProviderSession session = mock(Broker.ProviderSession.class);
-            when(session.getService(DOMRpcService.class)).thenReturn(mock(DOMRpcService.class));
+        try (RemoteRpcProvider rpcProvider = new RemoteRpcProvider(system, mock(DOMRpcProviderService.class),
+            mock(DOMRpcService.class), new RemoteRpcProviderConfig(system.settings().config()))) {
 
-            rpcProvider.onSessionInitiated(session);
+            rpcProvider.start();
 
             final ActorRef actorRef = Await.result(
                     system.actorSelection(moduleConfig.getRpcManagerPath()).resolveOne(