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%2Fsharding%2FDistributedShardedDOMDataTreeTest.java;h=9a855a9a883aabc1ceb8fe858e76d7566d77e1f1;hb=refs%2Fchanges%2F76%2F78876%2F2;hp=7545cd5edcee9abbb4eef066641cad137a65da26;hpb=f41c5e6e6f6e10b36b1e4b1992877e38e718c8fb;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeTest.java index 7545cd5edc..9a855a9a88 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardedDOMDataTreeTest.java @@ -11,8 +11,8 @@ package org.opendaylight.controller.cluster.sharding; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.anyCollection; -import static org.mockito.Matchers.anyMap; +import static org.mockito.ArgumentMatchers.anyCollection; +import static org.mockito.ArgumentMatchers.anyMap; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -29,15 +29,16 @@ import akka.actor.AddressFromURIString; import akka.actor.Props; import akka.cluster.Cluster; import akka.testkit.javadsl.TestKit; -import com.google.common.base.Optional; import com.google.common.collect.Lists; -import com.google.common.util.concurrent.CheckedFuture; +import com.google.common.util.concurrent.FluentFuture; +import com.google.common.util.concurrent.ListenableFuture; import com.typesafe.config.ConfigFactory; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.concurrent.CompletionStage; import java.util.concurrent.TimeUnit; @@ -71,7 +72,6 @@ import org.opendaylight.controller.cluster.sharding.DistributedShardFactory.Dist import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper; import org.opendaylight.controller.md.cluster.datastore.model.TestModel; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; -import org.opendaylight.mdsal.common.api.TransactionCommitFailedException; import org.opendaylight.mdsal.dom.api.DOMDataTreeCursorAwareTransaction; import org.opendaylight.mdsal.dom.api.DOMDataTreeIdentifier; import org.opendaylight.mdsal.dom.api.DOMDataTreeListener; @@ -148,7 +148,7 @@ public class DistributedShardedDOMDataTreeTest extends AbstractTest { } @After - public void tearDown() throws Exception { + public void tearDown() { if (leaderDistributedDataStore != null) { leaderDistributedDataStore.close(); } @@ -204,7 +204,7 @@ public class DistributedShardedDOMDataTreeTest extends AbstractTest { cursor.write(test.getIdentifier(), test); cursor.close(); - tx.submit().checkedGet(); + tx.commit().get(); } @Test @@ -234,7 +234,7 @@ public class DistributedShardedDOMDataTreeTest extends AbstractTest { cursor.close(); LOG.debug("Got to pre submit"); - tx.submit().checkedGet(); + tx.commit().get(); final DOMDataTreeListener mockedDataTreeListener = mock(DOMDataTreeListener.class); doNothing().when(mockedDataTreeListener).onDataTreeChanged(anyCollection(), anyMap()); @@ -269,11 +269,9 @@ public class DistributedShardedDOMDataTreeTest extends AbstractTest { final ClientLocalHistory localHistory = distributedDataStoreClient.createLocalHistory(); final ClientTransaction tx2 = localHistory.createTransaction(); - final CheckedFuture>, - org.opendaylight.mdsal.common.api.ReadFailedException> read = - tx2.read(YangInstanceIdentifier.EMPTY); + final FluentFuture>> read = tx2.read(YangInstanceIdentifier.EMPTY); - final Optional> optional = read.checkedGet(); + final Optional> optional = read.get(); tx2.abort(); localHistory.close(); @@ -323,9 +321,9 @@ public class DistributedShardedDOMDataTreeTest extends AbstractTest { cursor.write(new NodeIdentifier(TestModel.INNER_LIST_QNAME), innerList); cursor.close(); - tx.submit().checkedGet(); + tx.commit().get(); - final ArrayList> futures = new ArrayList<>(); + final ArrayList> futures = new ArrayList<>(); for (int i = 0; i < 1000; i++) { final Collection innerListMapEntries = createInnerListMapEntries(1000, "run-" + i); for (final MapEntryNode innerListMapEntry : innerListMapEntries) { @@ -335,11 +333,11 @@ public class DistributedShardedDOMDataTreeTest extends AbstractTest { oid1.node(new NodeIdentifier(TestModel.INNER_LIST_QNAME)))); cursor1.write(innerListMapEntry.getIdentifier(), innerListMapEntry); cursor1.close(); - futures.add(tx1.submit()); + futures.add(tx1.commit()); } } - futures.get(futures.size() - 1).checkedGet(); + futures.get(futures.size() - 1).get(); final DOMDataTreeListener mockedDataTreeListener = mock(DOMDataTreeListener.class); doNothing().when(mockedDataTreeListener).onDataTreeChanged(anyCollection(), anyMap()); @@ -408,7 +406,7 @@ public class DistributedShardedDOMDataTreeTest extends AbstractTest { cursor.write(testNode.getIdentifier(), testNode); cursor.close(); - transaction.submit().checkedGet(); + transaction.commit().get(); final DOMDataTreeListener mockedDataTreeListener = mock(DOMDataTreeListener.class); doNothing().when(mockedDataTreeListener).onDataTreeChanged(anyCollection(), anyMap()); @@ -423,7 +421,7 @@ public class DistributedShardedDOMDataTreeTest extends AbstractTest { cursor.write(wholeList.getIdentifier(), wholeList); cursor.close(); - transaction.submit().checkedGet(); + transaction.commit().get(); leaderShardFactory.registerListener(mockedDataTreeListener, Collections.singletonList(TEST_ID), true, Collections.emptyList());