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%2Fsharding%2FDistributedShardFrontendTest.java;h=aba233fe6f074ea6613f90b30433a8607e9b9e73;hp=231b174ad6af8fd9be0583b067ab18a4e5693a06;hb=a35607c5040d0fd561529fde3032c9f49393deeb;hpb=66e553f2098ea61426c4a441be57395673535c2f diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardFrontendTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardFrontendTest.java index 231b174ad6..aba233fe6f 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardFrontendTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/sharding/DistributedShardFrontendTest.java @@ -5,9 +5,10 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.cluster.sharding; +import static org.hamcrest.CoreMatchers.hasItems; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.mockito.ArgumentMatchers.any; @@ -20,6 +21,7 @@ import static org.mockito.Mockito.verify; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import java.util.Collections; +import java.util.List; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -42,14 +44,15 @@ import org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates; +import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument; import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; -import org.opendaylight.yangtools.yang.data.api.schema.LeafNode; import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode; import org.opendaylight.yangtools.yang.data.api.schema.MapNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder; +@Deprecated(forRemoval = true) public class DistributedShardFrontendTest { private static final DOMDataTreeIdentifier ROOT = @@ -69,7 +72,7 @@ public class DistributedShardFrontendTest { new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, OUTER_LIST_YID); @Captor - private ArgumentCaptor pathArgumentCaptor; + private ArgumentCaptor pathArgumentCaptor; @Captor private ArgumentCaptor> nodeCaptor; @@ -108,7 +111,6 @@ public class DistributedShardFrontendTest { @Test public void testClientTransaction() throws Exception { - final DistributedDataStore distributedDataStore = mock(DistributedDataStore.class); final ActorUtils context = mock(ActorUtils.class); doReturn(context).when(distributedDataStore).getActorUtils(); @@ -157,19 +159,15 @@ public class DistributedShardFrontendTest { //check the lower shard got the correct modification verify(outerListCursor, times(2)).write(pathArgumentCaptor.capture(), nodeCaptor.capture()); - final YangInstanceIdentifier.PathArgument expectedYid = new NodeIdentifier(TestModel.ID_QNAME); - final YangInstanceIdentifier.PathArgument actualIdYid = pathArgumentCaptor.getAllValues().get(0); - assertEquals(expectedYid, actualIdYid); - - final YangInstanceIdentifier.PathArgument expectedInnerYid = new NodeIdentifier(TestModel.INNER_LIST_QNAME); - final YangInstanceIdentifier.PathArgument actualInnerListYid = pathArgumentCaptor.getAllValues().get(1); - assertEquals(expectedInnerYid, actualInnerListYid); - - final LeafNode actualIdNode = (LeafNode) nodeCaptor.getAllValues().get(0); - assertEquals(ImmutableNodes.leafNode(TestModel.ID_QNAME, 1), actualIdNode); + final List capturedArgs = pathArgumentCaptor.getAllValues(); + assertEquals(2, capturedArgs.size()); + assertThat(capturedArgs, + hasItems(new NodeIdentifier(TestModel.ID_QNAME), new NodeIdentifier(TestModel.INNER_LIST_QNAME))); - final MapNode actualInnerListNode = (MapNode) nodeCaptor.getAllValues().get(1); - assertEquals(createInnerMapNode(1), actualInnerListNode); + final List> capturedValues = nodeCaptor.getAllValues(); + assertEquals(2, capturedValues.size()); + assertThat(capturedValues, + hasItems(ImmutableNodes.leafNode(TestModel.ID_QNAME, 1), createInnerMapNode(1))); txCursor.close(); tx.commit().get();