X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShardCommitCoordinationTest.java;h=bd9c0a48ff3f1872d7ffea017796ac58c306eccf;hb=9905bf0575ff196a531eb114e89b1bdb7226bc6c;hp=5239ff785c3f07c8f983e56422f5a404fbc0e5b8;hpb=731e7284cf0895fdb1b89427f91762e80e67c2ff;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinationTest.java index 5239ff785c..bd9c0a48ff 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardCommitCoordinationTest.java @@ -27,8 +27,8 @@ import akka.dispatch.Dispatchers; import akka.testkit.TestActorRef; import akka.testkit.javadsl.TestKit; import com.google.common.collect.ImmutableSortedSet; +import java.time.Duration; import java.util.SortedSet; -import java.util.concurrent.TimeUnit; import org.junit.Test; import org.opendaylight.controller.cluster.access.concepts.MemberName; import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier; @@ -43,7 +43,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import scala.concurrent.duration.FiniteDuration; /** * Unit tests for various 3PC coordination scenarios. @@ -68,7 +67,7 @@ public class ShardCommitCoordinationTest extends AbstractShardTest { * even though it isn't at the head of the queues. */ @Test - public void testTwoTransactionsWithSameTwoParticipatingShards() throws Exception { + public void testTwoTransactionsWithSameTwoParticipatingShards() { final String testName = "testTwoTransactionsWithSameTwoParticipatingShards"; LOG.info("{} starting", testName); @@ -116,7 +115,7 @@ public class ShardCommitCoordinationTest extends AbstractShardTest { // in the participating shard list. shardA.tell(new CanCommitTransaction(txId2, CURRENT_VERSION).toSerializable(), kit2.getRef()); - kit2.expectNoMessage(FiniteDuration.create(100, TimeUnit.MILLISECONDS)); + kit2.expectNoMessage(Duration.ofMillis(100)); // Send tx1 CanCommit to A - it's at the head of the queue so should proceed. @@ -132,7 +131,7 @@ public class ShardCommitCoordinationTest extends AbstractShardTest { // Send tx2 CanCommit to B - tx1 should now be at the head of he queue. shardB.tell(new CanCommitTransaction(txId2, CURRENT_VERSION).toSerializable(), kit2.getRef()); - kit2.expectNoMessage(FiniteDuration.create(100, TimeUnit.MILLISECONDS)); + kit2.expectNoMessage(Duration.ofMillis(100)); // Finish commit of tx1. @@ -180,7 +179,7 @@ public class ShardCommitCoordinationTest extends AbstractShardTest { * CanCommit is requested. */ @Test - public void testMultipleTransactionsWithMixedParticipatingShards() throws Exception { + public void testMultipleTransactionsWithMixedParticipatingShards() { final String testName = "testMultipleTransactionsWithMixedParticipatingShards"; LOG.info("{} starting", testName); @@ -261,18 +260,18 @@ public class ShardCommitCoordinationTest extends AbstractShardTest { // shard list [A] matches that of tx5 so tx3 should be moved ahead of tx5 in the queue. shardB.tell(new CanCommitTransaction(txId3, CURRENT_VERSION).toSerializable(), kit3.getRef()); - kit3.expectNoMessage(FiniteDuration.create(100, TimeUnit.MILLISECONDS)); + kit3.expectNoMessage(Duration.ofMillis(100)); // Send tx4 CanCommit to B - tx4's participating shard list [A] matches that of tx3 and tx5 - so tx4 should // be moved ahead of tx5 in the queue but not tx3 since should be in the CAN_COMMIT_PENDING state. shardB.tell(new CanCommitTransaction(txId4, CURRENT_VERSION).toSerializable(), kit4.getRef()); - kit4.expectNoMessage(FiniteDuration.create(100, TimeUnit.MILLISECONDS)); + kit4.expectNoMessage(Duration.ofMillis(100)); // Send tx5 CanCommit to B - it's position in the queue should remain the same. shardB.tell(new CanCommitTransaction(txId5, CURRENT_VERSION).toSerializable(), kit5.getRef()); - kit5.expectNoMessage(FiniteDuration.create(100, TimeUnit.MILLISECONDS)); + kit5.expectNoMessage(Duration.ofMillis(100)); // Finish commit of tx1. @@ -345,7 +344,7 @@ public class ShardCommitCoordinationTest extends AbstractShardTest { * When the tx's re committed verify the ready order is preserved. */ @Test - public void testTwoTransactionsWithOneCommonParticipatingShard1() throws Exception { + public void testTwoTransactionsWithOneCommonParticipatingShard1() { final String testName = "testTwoTransactionsWithOneCommonParticipatingShard1"; LOG.info("{} starting", testName); @@ -412,7 +411,7 @@ public class ShardCommitCoordinationTest extends AbstractShardTest { // shard list [A] do not match that of tx2 [B] so tx1 should not be allowed to proceed. shardC.tell(new CanCommitTransaction(txId1, CURRENT_VERSION).toSerializable(), kit1.getRef()); - kit1.expectNoMessage(FiniteDuration.create(100, TimeUnit.MILLISECONDS)); + kit1.expectNoMessage(Duration.ofMillis(100)); // Send tx2 CanCommit to C - it's at the head of the queue so should proceed. @@ -458,7 +457,7 @@ public class ShardCommitCoordinationTest extends AbstractShardTest { * When the tx's re committed verify the ready order is preserved. */ @Test - public void testTwoTransactionsWithOneCommonParticipatingShard2() throws Exception { + public void testTwoTransactionsWithOneCommonParticipatingShard2() { final String testName = "testTwoTransactionsWithOneCommonParticipatingShard2"; LOG.info("{} starting", testName); @@ -520,7 +519,7 @@ public class ShardCommitCoordinationTest extends AbstractShardTest { // shard list [A] do not match that of tx2 [] so tx1 should not be allowed to proceed. shardB.tell(new CanCommitTransaction(txId1, CURRENT_VERSION).toSerializable(), kit1.getRef()); - kit1.expectNoMessage(FiniteDuration.create(100, TimeUnit.MILLISECONDS)); + kit1.expectNoMessage(Duration.ofMillis(100)); // Send tx2 CanCommit to B - it's at the head of the queue so should proceed. @@ -554,8 +553,7 @@ public class ShardCommitCoordinationTest extends AbstractShardTest { LOG.info("{} ending", testName); } - static void verifyInnerListEntry(TestActorRef shard, int outerID, String innerID) - throws Exception { + static void verifyInnerListEntry(TestActorRef shard, int outerID, String innerID) { final YangInstanceIdentifier path = innerEntryPath(outerID, innerID); final NormalizedNode innerListEntry = readStore(shard, path); assertNotNull(path + " not found", innerListEntry);