X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Ftest%2FRestGetOperationTest.java;h=539248a147cd4eea16dca9f4725cf26e9b185496;hb=c74d5c2399e500fe3e690edc8cee497b1cb6f867;hp=d4f69090819c152895eeb53b71bbfc9107fda511;hpb=bdcd6c4baea3357499a1fcdff459259b56373baa;p=controller.git diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java index d4f6909081..539248a147 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java @@ -61,17 +61,14 @@ import org.opendaylight.controller.sal.restconf.impl.RestconfImpl; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.CompositeNode; 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.PathArgument; import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; -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.ImmutableCompositeNode; import org.opendaylight.yangtools.yang.data.impl.schema.Builders; -import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder; import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableLeafNodeBuilder; import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapEntryNodeBuilder; -import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder; import org.opendaylight.yangtools.yang.data.impl.util.CompositeNodeBuilder; import org.opendaylight.yangtools.yang.model.api.DataNodeContainer; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; @@ -674,9 +671,7 @@ public class RestGetOperationTest extends JerseyTest { } private NormalizedNode prepareCnDataForSlashesBehindMountPointTest() throws ParseException { - CollectionNodeBuilder lst1 = ImmutableMapNodeBuilder.create(); - lst1.withNodeIdentifier(TestUtils.getNodeIdentifier("lst1", "test:module", "2014-01-09")); - lst1.withChild(ImmutableMapEntryNodeBuilder + return ImmutableMapEntryNodeBuilder .create() .withNodeIdentifier( TestUtils.getNodeIdentifierPredicate("lst1", "test:module", "2014-01-09", "lf11", @@ -684,9 +679,8 @@ public class RestGetOperationTest extends JerseyTest { .withChild( ImmutableLeafNodeBuilder.create() .withNodeIdentifier(TestUtils.getNodeIdentifier("lf11", "test:module", "2014-01-09")) - .withValue("GigabitEthernet0/0/0/0").build()).build()); + .withValue("GigabitEthernet0/0/0/0").build()).build(); - return lst1.build(); } /** @@ -905,6 +899,9 @@ public class RestGetOperationTest extends JerseyTest { expectLeaf("depth3-leaf1", "depth3-leaf1-value"))); } + /** + * Tests behavior when invalid value of depth URI parameter + */ @Test public void getDataWithInvalidDepthParameterTest() { @@ -931,6 +928,10 @@ public class RestGetOperationTest extends JerseyTest { private void getDataWithInvalidDepthParameterTest(final UriInfo uriInfo) { try { + QName qNameDepth1Cont = QName.create("urn:nested:module", "2014-06-3", "depth1-cont"); + YangInstanceIdentifier ii = YangInstanceIdentifier.builder().node(qNameDepth1Cont).build(); + NormalizedNode value = (NormalizedNode)(Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(qNameDepth1Cont)).build()); + when(brokerFacade.readConfigurationData(eq(ii))).thenReturn(value); restconfImpl.readConfigurationData("nested-module:depth1-cont", uriInfo); fail("Expected RestconfDocumentedException"); } catch (RestconfDocumentedException e) {