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%2FShardTransactionTest.java;h=d1f47852c621303d556de3e50a8d133a97470da1;hb=a6af137c30470b86d4bc624d4c48cb686495a182;hp=0d65faa0600246761e25f12f5a9db6e5ec6be75e;hpb=b5cb353e3553a39f576c284119af75ffa5ea66a9;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java index 0d65faa060..d1f47852c6 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java @@ -19,8 +19,8 @@ import akka.actor.Props; import akka.actor.Status.Failure; import akka.actor.Terminated; import akka.dispatch.Dispatchers; -import akka.testkit.JavaTestKit; import akka.testkit.TestActorRef; +import akka.testkit.javadsl.TestKit; import com.google.common.base.Throwables; import java.util.concurrent.TimeUnit; import org.junit.Before; @@ -94,8 +94,8 @@ public class ShardTransactionTest extends AbstractActorTest { } @Test - public void testOnReceiveReadData() throws Exception { - new JavaTestKit(getSystem()) { + public void testOnReceiveReadData() { + new TestKit(getSystem()) { { testOnReceiveReadData(newTransactionActor(RO, readOnlyTransaction(), "testReadDataRO")); @@ -114,8 +114,8 @@ public class ShardTransactionTest extends AbstractActorTest { } @Test - public void testOnReceiveReadDataWhenDataNotFound() throws Exception { - new JavaTestKit(getSystem()) { + public void testOnReceiveReadDataWhenDataNotFound() { + new TestKit(getSystem()) { { testOnReceiveReadDataWhenDataNotFound( newTransactionActor(RO, readOnlyTransaction(), "testReadDataWhenDataNotFoundRO")); @@ -135,8 +135,8 @@ public class ShardTransactionTest extends AbstractActorTest { } @Test - public void testOnReceiveDataExistsPositive() throws Exception { - new JavaTestKit(getSystem()) { + public void testOnReceiveDataExistsPositive() { + new TestKit(getSystem()) { { testOnReceiveDataExistsPositive( newTransactionActor(RO, readOnlyTransaction(), "testDataExistsPositiveRO")); @@ -157,8 +157,8 @@ public class ShardTransactionTest extends AbstractActorTest { } @Test - public void testOnReceiveDataExistsNegative() throws Exception { - new JavaTestKit(getSystem()) { + public void testOnReceiveDataExistsNegative() { + new TestKit(getSystem()) { { testOnReceiveDataExistsNegative( newTransactionActor(RO, readOnlyTransaction(), "testDataExistsNegativeRO")); @@ -178,8 +178,8 @@ public class ShardTransactionTest extends AbstractActorTest { } @Test - public void testOnReceiveBatchedModifications() throws Exception { - new JavaTestKit(getSystem()) { + public void testOnReceiveBatchedModifications() { + new TestKit(getSystem()) { { ShardDataTreeTransactionParent parent = Mockito.mock(ShardDataTreeTransactionParent.class); DataTreeModification mockModification = Mockito.mock(DataTreeModification.class); @@ -220,13 +220,13 @@ public class ShardTransactionTest extends AbstractActorTest { } @Test - public void testOnReceiveBatchedModificationsReadyWithoutImmediateCommit() throws Exception { - new JavaTestKit(getSystem()) { + public void testOnReceiveBatchedModificationsReadyWithoutImmediateCommit() { + new TestKit(getSystem()) { { final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(), "testOnReceiveBatchedModificationsReadyWithoutImmediateCommit"); - JavaTestKit watcher = new JavaTestKit(getSystem()); + TestKit watcher = new TestKit(getSystem()); watcher.watch(transaction); YangInstanceIdentifier writePath = TestModel.TEST_PATH; @@ -244,7 +244,7 @@ public class ShardTransactionTest extends AbstractActorTest { assertEquals("getNumBatched", 1, reply.getNumBatched()); batched = new BatchedModifications(tx1, DataStoreVersions.CURRENT_VERSION); - batched.setReady(true); + batched.setReady(); batched.setTotalMessagesSent(2); transaction.tell(batched, getRef()); @@ -255,13 +255,13 @@ public class ShardTransactionTest extends AbstractActorTest { } @Test - public void testOnReceiveBatchedModificationsReadyWithImmediateCommit() throws Exception { - new JavaTestKit(getSystem()) { + public void testOnReceiveBatchedModificationsReadyWithImmediateCommit() { + new TestKit(getSystem()) { { final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(), "testOnReceiveBatchedModificationsReadyWithImmediateCommit"); - JavaTestKit watcher = new JavaTestKit(getSystem()); + TestKit watcher = new TestKit(getSystem()); watcher.watch(transaction); YangInstanceIdentifier writePath = TestModel.TEST_PATH; @@ -272,7 +272,7 @@ public class ShardTransactionTest extends AbstractActorTest { BatchedModifications batched = new BatchedModifications(nextTransactionId(), DataStoreVersions.CURRENT_VERSION); batched.addModification(new WriteModification(writePath, writeData)); - batched.setReady(true); + batched.setReady(); batched.setDoCommitOnReady(true); batched.setTotalMessagesSent(1); @@ -285,7 +285,7 @@ public class ShardTransactionTest extends AbstractActorTest { @Test(expected = TestException.class) public void testOnReceiveBatchedModificationsFailure() throws Exception { - new JavaTestKit(getSystem()) { + new TestKit(getSystem()) { { ShardDataTreeTransactionParent parent = Mockito.mock(ShardDataTreeTransactionParent.class); @@ -295,7 +295,7 @@ public class ShardTransactionTest extends AbstractActorTest { final ActorRef transaction = newTransactionActor(RW, mockWriteTx, "testOnReceiveBatchedModificationsFailure"); - JavaTestKit watcher = new JavaTestKit(getSystem()); + TestKit watcher = new TestKit(getSystem()); watcher.watch(transaction); YangInstanceIdentifier path = TestModel.TEST_PATH; @@ -311,7 +311,7 @@ public class ShardTransactionTest extends AbstractActorTest { expectMsgClass(duration("5 seconds"), akka.actor.Status.Failure.class); batched = new BatchedModifications(tx1, DataStoreVersions.CURRENT_VERSION); - batched.setReady(true); + batched.setReady(); batched.setTotalMessagesSent(2); transaction.tell(batched, getRef()); @@ -328,18 +328,18 @@ public class ShardTransactionTest extends AbstractActorTest { @Test(expected = IllegalStateException.class) public void testOnReceiveBatchedModificationsReadyWithIncorrectTotalMessageCount() throws Exception { - new JavaTestKit(getSystem()) { + new TestKit(getSystem()) { { final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(), "testOnReceiveBatchedModificationsReadyWithIncorrectTotalMessageCount"); - JavaTestKit watcher = new JavaTestKit(getSystem()); + TestKit watcher = new TestKit(getSystem()); watcher.watch(transaction); BatchedModifications batched = new BatchedModifications(nextTransactionId(), DataStoreVersions.CURRENT_VERSION); - batched.setReady(true); + batched.setReady(); batched.setTotalMessagesSent(2); transaction.tell(batched, getRef()); @@ -357,8 +357,8 @@ public class ShardTransactionTest extends AbstractActorTest { } @Test - public void testReadWriteTxOnReceiveCloseTransaction() throws Exception { - new JavaTestKit(getSystem()) { + public void testReadWriteTxOnReceiveCloseTransaction() { + new TestKit(getSystem()) { { final ActorRef transaction = newTransactionActor(RW, readWriteTransaction(), "testReadWriteTxOnReceiveCloseTransaction"); @@ -374,8 +374,8 @@ public class ShardTransactionTest extends AbstractActorTest { } @Test - public void testWriteOnlyTxOnReceiveCloseTransaction() throws Exception { - new JavaTestKit(getSystem()) { + public void testWriteOnlyTxOnReceiveCloseTransaction() { + new TestKit(getSystem()) { { final ActorRef transaction = newTransactionActor(WO, readWriteTransaction(), "testWriteTxOnReceiveCloseTransaction"); @@ -391,8 +391,8 @@ public class ShardTransactionTest extends AbstractActorTest { } @Test - public void testReadOnlyTxOnReceiveCloseTransaction() throws Exception { - new JavaTestKit(getSystem()) { + public void testReadOnlyTxOnReceiveCloseTransaction() { + new TestKit(getSystem()) { { final ActorRef transaction = newTransactionActor(TransactionType.READ_ONLY, readOnlyTransaction(), "testReadOnlyTxOnReceiveCloseTransaction"); @@ -411,7 +411,7 @@ public class ShardTransactionTest extends AbstractActorTest { datastoreContext = DatastoreContext.newBuilder().shardTransactionIdleTimeout( 500, TimeUnit.MILLISECONDS).build(); - new JavaTestKit(getSystem()) { + new TestKit(getSystem()) { { final ActorRef transaction = newTransactionActor(RW, readWriteTransaction(), "testShardTransactionInactivity");