use of org.opendaylight.netconf.sal.rest.impl.NormalizedNodeContext in project netconf by opendaylight.
the class TestJsonBodyReader method moduleSubContainerDataPutTest.
@Test
public void moduleSubContainerDataPutTest() throws Exception {
final DataSchemaNode dataSchemaNode = schemaContext.getDataChildByName(QName.create(INSTANCE_IDENTIFIER_MODULE_QNAME, "cont"));
final QName cont1QName = QName.create(dataSchemaNode.getQName(), "cont1");
final YangInstanceIdentifier dataII = YangInstanceIdentifier.of(dataSchemaNode.getQName()).node(cont1QName);
final DataSchemaNode dataSchemaNodeOnPath = ((DataNodeContainer) dataSchemaNode).getDataChildByName(cont1QName);
final String uri = "instance-identifier-module:cont/cont1";
mockBodyReader(uri, this.jsonBodyReader, false);
final InputStream inputStream = TestJsonBodyReader.class.getResourceAsStream("/instanceidentifier/json/json_sub_container.json");
final NormalizedNodeContext returnValue = this.jsonBodyReader.readFrom(null, null, null, this.mediaType, null, inputStream);
checkNormalizedNodeContext(returnValue);
checkExpectValueNormalizeNodeContext(dataSchemaNodeOnPath, returnValue, dataII);
}
use of org.opendaylight.netconf.sal.rest.impl.NormalizedNodeContext in project netconf by opendaylight.
the class TestJsonBodyReaderMountPoint method moduleSubContainerDataPostTest.
@Test
public void moduleSubContainerDataPostTest() throws Exception {
final DataSchemaNode dataSchemaNode = schemaContext.getDataChildByName(QName.create(INSTANCE_IDENTIFIER_MODULE_QNAME, "cont"));
final String uri = "instance-identifier-module:cont/yang-ext:mount/instance-identifier-module:cont";
mockBodyReader(uri, this.jsonBodyReader, true);
final InputStream inputStream = TestJsonBodyReaderMountPoint.class.getResourceAsStream("/instanceidentifier/json/json_sub_container.json");
final NormalizedNodeContext returnValue = this.jsonBodyReader.readFrom(null, null, null, this.mediaType, null, inputStream);
checkMountPointNormalizedNodeContext(returnValue);
checkExpectValueNormalizeNodeContext(dataSchemaNode, returnValue);
}
use of org.opendaylight.netconf.sal.rest.impl.NormalizedNodeContext in project netconf by opendaylight.
the class TestXmlBodyReader method moduleSubContainerDataPostTest.
@Test
public void moduleSubContainerDataPostTest() throws Exception {
final DataSchemaNode dataSchemaNode = schemaContext.getDataChildByName(QName.create(INSTANCE_IDENTIFIER_MODULE_QNAME, "cont"));
final QName cont1QName = QName.create(dataSchemaNode.getQName(), "cont1");
final YangInstanceIdentifier dataII = YangInstanceIdentifier.of(dataSchemaNode.getQName()).node(cont1QName);
final String uri = "instance-identifier-module:cont";
mockBodyReader(uri, this.xmlBodyReader, true);
final InputStream inputStream = TestXmlBodyReader.class.getResourceAsStream("/instanceidentifier/xml/xml_sub_container.xml");
final NormalizedNodeContext returnValue = this.xmlBodyReader.readFrom(null, null, null, this.mediaType, null, inputStream);
checkNormalizedNodeContext(returnValue);
checkExpectValueNormalizeNodeContext(dataSchemaNode, returnValue, dataII);
}
use of org.opendaylight.netconf.sal.rest.impl.NormalizedNodeContext in project netconf by opendaylight.
the class TestXmlBodyReaderMountPoint method findBarContainerUsingNamespaceTest.
/**
* Test when container with the same name is placed in two modules (foo-module and bar-module). Namespace must be
* used to distinguish between them to find correct one. Check if container was found not only according to its name
* but also by correct namespace used in payload.
*/
@Test
public void findBarContainerUsingNamespaceTest() throws Exception {
mockBodyReader("instance-identifier-module:cont/yang-ext:mount", this.xmlBodyReader, true);
final InputStream inputStream = TestXmlBodyReader.class.getResourceAsStream("/instanceidentifier/xml/xmlDataFindBarContainer.xml");
final NormalizedNodeContext returnValue = this.xmlBodyReader.readFrom(null, null, null, this.mediaType, null, inputStream);
// check return value
checkMountPointNormalizedNodeContext(returnValue);
// check if container was found both according to its name and namespace
assertEquals("Not correct container found, name was ignored", "foo-bar-container", returnValue.getData().getIdentifier().getNodeType().getLocalName());
assertEquals("Not correct container found, namespace was ignored", "bar:module", returnValue.getData().getIdentifier().getNodeType().getNamespace().toString());
}
use of org.opendaylight.netconf.sal.rest.impl.NormalizedNodeContext in project netconf by opendaylight.
the class TestXmlBodyReaderMountPoint method moduleSubContainerDataPutTest.
@Test
public void moduleSubContainerDataPutTest() throws Exception {
final DataSchemaNode dataSchemaNode = schemaContext.getDataChildByName(QName.create(INSTANCE_IDENTIFIER_MODULE_QNAME, "cont"));
final String uri = "instance-identifier-module:cont/yang-ext:mount/instance-identifier-module:cont/cont1";
mockBodyReader(uri, this.xmlBodyReader, false);
final InputStream inputStream = TestXmlBodyReaderMountPoint.class.getResourceAsStream("/instanceidentifier/xml/xml_sub_container.xml");
final NormalizedNodeContext returnValue = this.xmlBodyReader.readFrom(null, null, null, this.mediaType, null, inputStream);
checkMountPointNormalizedNodeContext(returnValue);
checkExpectValueNormalizeNodeContext(dataSchemaNode, returnValue, QName.create(dataSchemaNode.getQName(), "cont1"));
}
Aggregations