Bump persisted PayloadVersion
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / cluster / datastore / entityownership / EntityOwnershipShardTest.java
index 9eb974170bebedc12e3e58fb47435ab30813b680..887336de3d859baa7d7a2f50b93a7fe3f4212875 100644 (file)
@@ -9,7 +9,7 @@ package org.opendaylight.controller.cluster.datastore.entityownership;
 
 import static org.junit.Assert.assertEquals;
 import static org.mockito.AdditionalMatchers.or;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.reset;
@@ -29,6 +29,7 @@ import akka.dispatch.Dispatchers;
 import akka.testkit.TestActorRef;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.util.concurrent.Uninterruptibles;
+import java.time.Duration;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -102,7 +103,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testOnRegisterCandidateLocal() throws Exception {
+    public void testOnRegisterCandidateLocal() {
         testLog.info("testOnRegisterCandidateLocal starting");
 
         ShardTestKit kit = new ShardTestKit(getSystem());
@@ -124,7 +125,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testOnRegisterCandidateLocalWithNoInitialLeader() throws Exception {
+    public void testOnRegisterCandidateLocalWithNoInitialLeader() {
         testLog.info("testOnRegisterCandidateLocalWithNoInitialLeader starting");
 
         final ShardTestKit kit = new ShardTestKit(getSystem());
@@ -159,7 +160,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testOnRegisterCandidateLocalWithNoInitialConsensus() throws Exception {
+    public void testOnRegisterCandidateLocalWithNoInitialConsensus() {
         testLog.info("testOnRegisterCandidateLocalWithNoInitialConsensus starting");
 
         final ShardTestKit kit = new ShardTestKit(getSystem());
@@ -244,7 +245,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testOnRegisterCandidateLocalWithRemoteLeader() throws Exception {
+    public void testOnRegisterCandidateLocalWithRemoteLeader() {
         testLog.info("testOnRegisterCandidateLocalWithRemoteLeader starting");
 
         ShardTestKit kit = new ShardTestKit(getSystem());
@@ -300,7 +301,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testOnUnregisterCandidateLocal() throws Exception {
+    public void testOnUnregisterCandidateLocal() {
         testLog.info("testOnUnregisterCandidateLocal starting");
 
         ShardTestKit kit = new ShardTestKit(getSystem());
@@ -336,7 +337,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testOwnershipChanges() throws Exception {
+    public void testOwnershipChanges() {
         testLog.info("testOwnershipChanges starting");
 
         final ShardTestKit kit = new ShardTestKit(getSystem());
@@ -523,7 +524,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
 
         kit.watch(peer2);
         peer2.tell(PoisonPill.getInstance(), ActorRef.noSender());
-        kit.expectMsgClass(kit.duration("5 seconds"), Terminated.class);
+        kit.expectMsgClass(Duration.ofSeconds(5), Terminated.class);
         kit.unwatch(peer2);
 
         leader.tell(new PeerDown(peerId2.getMemberName(), peerId2.toString()), ActorRef.noSender());
@@ -590,7 +591,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
 
         kit.watch(peer1);
         peer1.tell(PoisonPill.getInstance(), ActorRef.noSender());
-        kit.expectMsgClass(kit.duration("5 seconds"), Terminated.class);
+        kit.expectMsgClass(Duration.ofSeconds(5), Terminated.class);
         kit.unwatch(peer1);
         leader.tell(new PeerDown(peerId1.getMemberName(), peerId1.toString()), ActorRef.noSender());
 
@@ -636,9 +637,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
             leaderLastApplied.set(rs.getLastApplied());
         });
 
-        verifyRaftState(peer2, rs -> {
-            assertEquals("LastApplied", leaderLastApplied.get(), rs.getLastIndex());
-        });
+        verifyRaftState(peer2, rs -> assertEquals("LastApplied", leaderLastApplied.get(), rs.getLastIndex()));
 
         // Kill the local leader and elect peer2 the leader. This should cause a new owner to be selected for
         // the entities (1 and 3) previously owned by the local leader member.
@@ -649,7 +648,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
 
         kit.watch(leader);
         leader.tell(PoisonPill.getInstance(), ActorRef.noSender());
-        kit.expectMsgClass(kit.duration("5 seconds"), Terminated.class);
+        kit.expectMsgClass(Duration.ofSeconds(5), Terminated.class);
         kit.unwatch(leader);
         peer2.tell(new PeerDown(leaderId.getMemberName(), leaderId.toString()), ActorRef.noSender());
         peer2.tell(TimeoutNow.INSTANCE, peer2);
@@ -1044,7 +1043,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testListenerRegistration() throws Exception {
+    public void testListenerRegistration() {
         testLog.info("testListenerRegistration starting");
 
         ShardTestKit kit = new ShardTestKit(getSystem());
@@ -1137,7 +1136,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testDelayedEntityOwnerSelectionWhenMaxPeerRequestsReceived() throws Exception {
+    public void testDelayedEntityOwnerSelectionWhenMaxPeerRequestsReceived() {
         testLog.info("testDelayedEntityOwnerSelectionWhenMaxPeerRequestsReceived starting");
 
         ShardTestKit kit = new ShardTestKit(getSystem());
@@ -1179,7 +1178,7 @@ public class EntityOwnershipShardTest extends AbstractEntityOwnershipTest {
     }
 
     @Test
-    public void testDelayedEntityOwnerSelection() throws Exception {
+    public void testDelayedEntityOwnerSelection() {
         testLog.info("testDelayedEntityOwnerSelection starting");
 
         final ShardTestKit kit = new ShardTestKit(getSystem());