Merge "Bug 1418 - onDataChange notification is not returning any data to the getCrea...
authorTony Tkacik <ttkacik@cisco.com>
Wed, 6 Aug 2014 09:25:10 +0000 (09:25 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 6 Aug 2014 09:25:10 +0000 (09:25 +0000)
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestGetOperationTest.java

index d4f69090819c152895eeb53b71bbfc9107fda511..e9d94b118412f2c0acbb967d82035a215e01a111 100644 (file)
@@ -61,6 +61,7 @@ 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;
@@ -905,6 +906,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 +935,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) {