Migrate from YangInstanceIdentifier.EMPTY
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / databroker / actors / dds / AbstractClientHistoryTest.java
index bd170ee34fbe31b4dabd75a54214d9ab7c096c78..48ac3484f7c622030ab66514d74e815f7039a295 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.controller.cluster.databroker.actors.dds;
 
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
@@ -29,7 +29,7 @@ import org.opendaylight.controller.cluster.access.client.ClientActorContext;
 import org.opendaylight.controller.cluster.access.client.ConnectedClientConnection;
 import org.opendaylight.controller.cluster.access.concepts.LocalHistoryIdentifier;
 import org.opendaylight.controller.cluster.datastore.messages.PrimaryShardInfo;
-import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
+import org.opendaylight.controller.cluster.datastore.utils.ActorUtils;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
 import scala.concurrent.Promise;
@@ -48,82 +48,82 @@ public abstract class AbstractClientHistoryTest<T extends AbstractClientHistory>
     protected abstract ClientActorContext clientActorContext();
 
     @Test
-    public abstract void testDoCreateSnapshot() throws Exception;
+    public abstract void testDoCreateSnapshot();
 
     @Test
-    public abstract void testDoCreateTransaction() throws Exception;
+    public abstract void testDoCreateTransaction();
 
     @Test
-    public abstract void testCreateHistoryProxy() throws Exception;
+    public abstract void testCreateHistoryProxy();
 
     @Test
-    public abstract void testOnTransactionComplete() throws Exception;
+    public abstract void testOnTransactionComplete();
 
     @Test
-    public abstract void testOnTransactionAbort() throws Exception;
+    public abstract void testOnTransactionAbort();
 
     @Test
-    public abstract void testOnTransactionReady() throws Exception;
+    public abstract void testOnTransactionReady();
 
     @Test
-    public abstract void testOnTransactionReadyDuplicate() throws Exception;
+    public abstract void testOnTransactionReadyDuplicate();
 
     @Test
-    public void testCreateSnapshotProxy() throws Exception {
+    public void testCreateSnapshotProxy() {
         final AbstractProxyTransaction snapshotProxy = object().createSnapshotProxy(TRANSACTION_ID, 0L);
         Assert.assertNotNull(snapshotProxy);
         Assert.assertNotEquals(TRANSACTION_ID, snapshotProxy.getIdentifier());
     }
 
     @Test
-    public void testCreateTransactionProxy() throws Exception {
+    public void testCreateTransactionProxy() {
         AbstractProxyTransaction transactionProxy = object().createTransactionProxy(TRANSACTION_ID, 0L);
         Assert.assertNotNull(transactionProxy);
         Assert.assertNotEquals(TRANSACTION_ID, transactionProxy.getIdentifier());
     }
 
     @Test
-    public void testState() throws Exception {
+    public void testState() {
         Assert.assertEquals(AbstractClientHistory.State.IDLE, object().state());
     }
 
     @Test
-    public void testUpdateState() throws Exception {
+    public void testUpdateState() {
         object().updateState(AbstractClientHistory.State.IDLE, AbstractClientHistory.State.CLOSED);
         Assert.assertEquals(AbstractClientHistory.State.CLOSED, object().state());
     }
 
     @Test
-    public void testDoClose() throws Exception {
+    public void testDoClose() {
         object().createTransactionProxy(TRANSACTION_ID, 0L);
         object().doClose();
         Assert.assertEquals(AbstractClientHistory.State.CLOSED, object().state());
     }
 
     @Test
-    public void testGetIdentifier() throws Exception {
+    public void testGetIdentifier() {
         Assert.assertEquals(HISTORY_ID, object().getIdentifier());
     }
 
     @Test
-    public void testNextTx() throws Exception {
+    public void testNextTx() {
         Assert.assertTrue(object().nextTx() + 1 == object().nextTx());
     }
 
     @Test
-    public void testResolveShardForPath() throws Exception {
-        final Long shardForPath = object().resolveShardForPath(YangInstanceIdentifier.EMPTY);
+    public void testResolveShardForPath() {
+        final Long shardForPath = object().resolveShardForPath(YangInstanceIdentifier.empty());
         Assert.assertEquals(0L, shardForPath.longValue());
     }
 
     @Test
-    public void testLocalAbort() throws Exception {
+    public void testLocalAbort() {
         object().localAbort(new Throwable());
         Assert.assertEquals(AbstractClientHistory.State.CLOSED, object().state());
     }
 
     @Test
-    public void testOnProxyDestroyed() throws Exception {
+    public void testOnProxyDestroyed() {
         final ProxyHistory proxyHistory = Mockito.mock(ProxyHistory.class);
         when(proxyHistory.getIdentifier()).thenReturn(HISTORY_ID);
 
@@ -132,27 +132,26 @@ public abstract class AbstractClientHistoryTest<T extends AbstractClientHistory>
     }
 
     @Test
-    public void testCreateTransaction() throws Exception {
+    public void testCreateTransaction() {
         final ClientTransaction transaction = object().createTransaction();
         Assert.assertNotNull(transaction);
     }
 
     @Test
-    public void testTakeSnapshot() throws Exception {
+    public void testTakeSnapshot() {
         final ClientSnapshot clientSnapshot = object().takeSnapshot();
         Assert.assertEquals(object().getIdentifier(), clientSnapshot.getIdentifier().getHistoryId());
     }
 
     @Test
-    @SuppressWarnings("unchecked")
-    public void testStartReconnect() throws Exception {
+    public void testStartReconnect() {
         // cookie and shard are the same
         final Long cookie = 0L;
         final Long shard = cookie;
 
         final ShardBackendInfo info = new ShardBackendInfo(clientActorContext().self(), 0L, ABIVersion.current(),
                 SHARD_NAME, UnsignedLong.ZERO, Optional.of(tree), 10);
-        final ConnectedClientConnection newConn = AccessClientUtil.createConnectedConnection(
+        final ConnectedClientConnection<ShardBackendInfo> newConn = AccessClientUtil.createConnectedConnection(
                 clientActorContext(), cookie, info);
         object().createSnapshotProxy(TRANSACTION_ID, shard);
 
@@ -161,15 +160,14 @@ public abstract class AbstractClientHistoryTest<T extends AbstractClientHistory>
     }
 
     @Test
-    @SuppressWarnings("unchecked")
-    public void testStartReconnectMissingOldProxy() throws Exception {
+    public void testStartReconnectMissingOldProxy() {
         // cookie and shard are different
         final Long cookie = 1L;
         final Long shard = 0L;
 
         final ShardBackendInfo info = new ShardBackendInfo(clientActorContext().self(), 0L, ABIVersion.current(),
                 SHARD_NAME, UnsignedLong.ZERO, Optional.of(tree), 10);
-        final ConnectedClientConnection newConn = AccessClientUtil.createConnectedConnection(
+        final ConnectedClientConnection<ShardBackendInfo> newConn = AccessClientUtil.createConnectedConnection(
                 clientActorContext(), cookie, info);
         object().createSnapshotProxy(TRANSACTION_ID, shard);
 
@@ -177,8 +175,8 @@ public abstract class AbstractClientHistoryTest<T extends AbstractClientHistory>
         Assert.assertNull(reconnectCohort);
     }
 
-    protected static ActorContext createActorContextMock(final ActorSystem system, final ActorRef actor) {
-        final ActorContext mock = mock(ActorContext.class);
+    protected static ActorUtils createActorUtilsMock(final ActorSystem system, final ActorRef actor) {
+        final ActorUtils mock = mock(ActorUtils.class);
         final Promise<PrimaryShardInfo> promise = new DefaultPromise<>();
         final ActorSelection selection = system.actorSelection(actor.path());
         final PrimaryShardInfo shardInfo = new PrimaryShardInfo(selection, (short) 0);