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%2FShardDataTreeSnapshotTest.java;fp=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2FShardDataTreeSnapshotTest.java;h=dc07265d7f88cb2a6baed79180aacbb9833b02b1;hb=085b076786d299c235ab5561c9fa678fd6b8d726;hp=0000000000000000000000000000000000000000;hpb=6da2893d4a3a939a1f5d4079f6ffe04a305754e6;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeSnapshotTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeSnapshotTest.java new file mode 100644 index 0000000000..dc07265d7f --- /dev/null +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeSnapshotTest.java @@ -0,0 +1,48 @@ +package org.opendaylight.controller.cluster.datastore; + +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.verify; +import java.net.URI; +import java.util.Set; +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.opendaylight.controller.cluster.datastore.utils.PruningDataTreeModification; +import org.opendaylight.controller.md.cluster.datastore.model.CarsModel; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification; +import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot; + +public class ShardDataTreeSnapshotTest { + + @Mock + DataTreeSnapshot dataTreeSnapshot; + + @Mock + Set validNamespaces; + + @Before + public void setUp(){ + MockitoAnnotations.initMocks(this); + } + + @Test + public void testNewModification(){ + ShardDataTreeSnapshot snapshot1 + = new ShardDataTreeSnapshot(dataTreeSnapshot, validNamespaces); + + DataTreeModification dataTreeModification1 = snapshot1.newModification(); + + assertTrue(dataTreeModification1 instanceof PruningDataTreeModification); + } + + @Test + public void testReadNode(){ + ShardDataTreeSnapshot snapshot + = new ShardDataTreeSnapshot(dataTreeSnapshot, validNamespaces); + + snapshot.readNode(CarsModel.BASE_PATH); + + verify(dataTreeSnapshot).readNode(CarsModel.BASE_PATH); + } +} \ No newline at end of file