Cleanup TestKit use
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / test / java / org / opendaylight / controller / remote / rpc / RpcListenerTest.java
index 680d55da9d11bb0d97ca51bb5bb6224098ee20d1..7ae8a0a57fdf9fc963522beb03d34a6ad482cd6a 100644 (file)
@@ -12,13 +12,12 @@ import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 import akka.testkit.javadsl.TestKit;
 import com.typesafe.config.ConfigFactory;
-import java.net.URISyntaxException;
 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;
@@ -30,47 +29,39 @@ public class RpcListenerTest {
     private static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier
             .create(new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME));
     private static final DOMRpcIdentifier RPC_ID = DOMRpcIdentifier.create(RPC_TYPE, TEST_PATH);
-    static ActorSystem system;
 
+    private static ActorSystem SYSTEM;
 
     @BeforeClass
-    public static void setup() throws InterruptedException {
-        system = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster-rpc"));
+    public static void setup() {
+        SYSTEM = ActorSystem.create("opendaylight-rpc", ConfigFactory.load().getConfig("odl-cluster-rpc"));
     }
 
     @AfterClass
     public static void teardown() {
-        TestKit.shutdownActorSystem(system);
-        system = null;
+        TestKit.shutdownActorSystem(SYSTEM);
+        SYSTEM = null;
     }
 
     @Test
-    public void testRouteAdd() throws URISyntaxException, InterruptedException {
-        new TestKit(system) {
-            {
-                // Test announcements
-                final TestKit probeReg = new TestKit(system);
-                final ActorRef rpcRegistry = probeReg.getRef();
+    public void testRouteAdd() {
+        // Test announcements
+        final TestKit probeReg = new TestKit(SYSTEM);
+        final ActorRef rpcRegistry = probeReg.getRef();
 
-                final RpcListener rpcListener = new RpcListener(rpcRegistry);
-                rpcListener.onRpcAvailable(Collections.singleton(RPC_ID));
-                probeReg.expectMsgClass(RpcRegistry.Messages.AddOrUpdateRoutes.class);
-            }
-        };
+        final RpcListener rpcListener = new RpcListener(rpcRegistry);
+        rpcListener.onRpcAvailable(Collections.singleton(RPC_ID));
+        probeReg.expectMsgClass(RpcRegistry.Messages.AddOrUpdateRoutes.class);
     }
 
     @Test
-    public void testRouteRemove() throws URISyntaxException, InterruptedException {
-        new TestKit(system) {
-            {
-                // Test announcements
-                final TestKit probeReg = new TestKit(system);
-                final ActorRef rpcRegistry = probeReg.getRef();
+    public void testRouteRemove() {
+        // Test announcements
+        final TestKit probeReg = new TestKit(SYSTEM);
+        final ActorRef rpcRegistry = probeReg.getRef();
 
-                final RpcListener rpcListener = new RpcListener(rpcRegistry);
-                rpcListener.onRpcUnavailable(Collections.singleton(RPC_ID));
-                probeReg.expectMsgClass(RpcRegistry.Messages.RemoveRoutes.class);
-            }
-        };
+        final RpcListener rpcListener = new RpcListener(rpcRegistry);
+        rpcListener.onRpcUnavailable(Collections.singleton(RPC_ID));
+        probeReg.expectMsgClass(RpcRegistry.Messages.RemoveRoutes.class);
     }
 }