X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FDataTreeCohortActorTest.java;h=5db3f39b6efe40ae3255a2542472aaecb883bc8b;hp=83bf284d7cbfe4b9e6eabc1b5c0cc0bebfe6669e;hb=HEAD;hpb=5fa5244653ee7ad3042324fb1f21fad69581b3d2 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActorTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActorTest.java index 83bf284d7c..7a3e268392 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActorTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataTreeCohortActorTest.java @@ -9,7 +9,8 @@ package org.opendaylight.controller.cluster.datastore; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyCollection; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.reset; @@ -45,8 +46,8 @@ import org.opendaylight.mdsal.dom.api.DOMDataTreeCandidate; import org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohort; import org.opendaylight.yangtools.util.concurrent.FluentFutures; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; -import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException; -import org.opendaylight.yangtools.yang.model.api.SchemaContext; +import org.opendaylight.yangtools.yang.data.tree.api.DataValidationFailedException; +import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; import scala.concurrent.Await; /** @@ -56,7 +57,7 @@ import scala.concurrent.Await; */ public class DataTreeCohortActorTest extends AbstractActorTest { private static final Collection CANDIDATES = new ArrayList<>(); - private static final SchemaContext MOCK_SCHEMA = mock(SchemaContext.class); + private static final EffectiveModelContext MOCK_SCHEMA = mock(EffectiveModelContext.class); private final TestActorFactory actorFactory = new TestActorFactory(getSystem()); private final DOMDataTreeCommitCohort mockCohort = mock(DOMDataTreeCommitCohort.class); private final PostCanCommitStep mockPostCanCommit = mock(PostCanCommitStep.class); @@ -108,13 +109,12 @@ public class DataTreeCohortActorTest extends AbstractActorTest { askAndAwait(cohortActor, new Commit(txId2)); } - @SuppressWarnings("unchecked") @Test public void testAsyncCohort() throws Exception { ListeningExecutorService executor = MoreExecutors.listeningDecorator(Executors.newSingleThreadExecutor()); doReturn(executeWithDelay(executor, mockPostCanCommit)) - .when(mockCohort).canCommit(any(Object.class), any(SchemaContext.class), any(Collection.class)); + .when(mockCohort).canCommit(any(Object.class), any(EffectiveModelContext.class), anyCollection()); doReturn(executor.submit(() -> mockPostPreCommit)).when(mockPostCanCommit).preCommit(); @@ -135,12 +135,12 @@ public class DataTreeCohortActorTest extends AbstractActorTest { executor.shutdownNow(); } - @SuppressWarnings("unchecked") @Test public void testFailureOnCanCommit() throws Exception { - DataValidationFailedException failure = new DataValidationFailedException(YangInstanceIdentifier.EMPTY, "mock"); + DataValidationFailedException failure = new DataValidationFailedException(YangInstanceIdentifier.of(), + "mock"); doReturn(FluentFutures.immediateFailedFluentFuture(failure)).when(mockCohort).canCommit(any(Object.class), - any(SchemaContext.class), any(Collection.class)); + any(EffectiveModelContext.class), anyCollection()); ActorRef cohortActor = newCohortActor("testFailureOnCanCommit"); @@ -195,16 +195,15 @@ public class DataTreeCohortActorTest extends AbstractActorTest { } private ActorRef newCohortActor(final String name) { - return actorFactory.createActor(DataTreeCohortActor.props(mockCohort, YangInstanceIdentifier.EMPTY), name); + return actorFactory.createActor(DataTreeCohortActor.props(mockCohort, YangInstanceIdentifier.of()), name); } - @SuppressWarnings("unchecked") private void resetMockCohort() { reset(mockCohort); doReturn(ThreePhaseCommitStep.NOOP_ABORT_FUTURE).when(mockPostCanCommit).abort(); doReturn(Futures.immediateFuture(mockPostPreCommit)).when(mockPostCanCommit).preCommit(); doReturn(FluentFutures.immediateFluentFuture(mockPostCanCommit)).when(mockCohort).canCommit(any(Object.class), - any(SchemaContext.class), any(Collection.class)); + any(EffectiveModelContext.class), anyCollection()); doReturn(ThreePhaseCommitStep.NOOP_ABORT_FUTURE).when(mockPostPreCommit).abort(); doReturn(Futures.immediateFuture(null)).when(mockPostPreCommit).commit();