final List<Element> elements = Collections.singletonList(doc.getDocumentElement());
final SchemaNode schemaNodeContext = pathContext.getSchemaNode();
DataSchemaNode schemaNode;
+ boolean isRpc = false;
if (schemaNodeContext instanceof RpcDefinition) {
schemaNode = ((RpcDefinition) schemaNodeContext).getInput();
+ isRpc = true;
} else if (schemaNodeContext instanceof DataSchemaNode) {
schemaNode = (DataSchemaNode) schemaNodeContext;
} else {
final DomToNormalizedNodeParserFactory parserFactory =
DomToNormalizedNodeParserFactory.getInstance(XmlUtils.DEFAULT_XML_CODEC_PROVIDER, pathContext.getSchemaContext());
- if (isPost()) {
+ if (isPost() && !isRpc) {
final Deque<Object> foundSchemaNodes = findPathToSchemaNodeByName(schemaNode, docRootElm);
if (foundSchemaNodes.isEmpty()) {
throw new IllegalStateException(String.format("Child \"%s\" was not found in parent schema node \"%s\"",
docRootElm, schemaNode.getQName()));
}
while (!foundSchemaNodes.isEmpty()) {
- final Object child = foundSchemaNodes.pop();
+ final Object child = foundSchemaNodes.pop();
if (child instanceof AugmentationSchema) {
final AugmentationSchema augmentSchemaNode = (AugmentationSchema) child;
iiToDataList.add(SchemaUtils.getNodeIdentifierForAugmentation(augmentSchemaNode));
.readFrom(null, null, null, mediaType, null, inputStream);
checkNormalizedNodeContext(returnValue);
final ContainerNode contNode = (ContainerNode) returnValue.getData();
- final YangInstanceIdentifier yangleaf = YangInstanceIdentifier.of(QName.create(contNode.getNodeType(), "lf"));
- final Optional<DataContainerChild<? extends PathArgument, ?>> leafDataNode = contNode.getChild(yangleaf.getLastPathArgument());
+ final YangInstanceIdentifier yangCont = YangInstanceIdentifier.of(QName.create(contNode.getNodeType(), "cont"));
+ final Optional<DataContainerChild<? extends PathArgument, ?>> contDataNodePotential = contNode.getChild(yangCont
+ .getLastPathArgument());
+ assertTrue(contDataNodePotential.isPresent());
+ final ContainerNode contDataNode = (ContainerNode) contDataNodePotential.get();
+ final YangInstanceIdentifier yangLeaf = YangInstanceIdentifier.of(QName.create(contDataNode.getNodeType(), "lf"));
+ final Optional<DataContainerChild<? extends PathArgument, ?>> leafDataNode = contDataNode.getChild(yangLeaf
+ .getLastPathArgument());
assertTrue(leafDataNode.isPresent());
assertTrue("lf-test".equalsIgnoreCase(leafDataNode.get().getValue().toString()));
}
null, null, mediaType, null, inputStream);
checkNormalizedNodeContext(returnValue);
final ContainerNode contNode = (ContainerNode) returnValue.getData();
- final YangInstanceIdentifier yangleaf = YangInstanceIdentifier.of(QName
- .create(contNode.getNodeType(), "lf"));
- final Optional<DataContainerChild<? extends PathArgument, ?>> leafDataNode = contNode
- .getChild(yangleaf.getLastPathArgument());
+ final YangInstanceIdentifier yangCont = YangInstanceIdentifier.of(QName.create(contNode.getNodeType(), "cont"));
+ final Optional<DataContainerChild<? extends PathArgument, ?>> contDataNodePotential = contNode.getChild(yangCont
+ .getLastPathArgument());
+ assertTrue(contDataNodePotential.isPresent());
+ final ContainerNode contDataNode = (ContainerNode) contDataNodePotential.get();
+ final YangInstanceIdentifier yangLeaf = YangInstanceIdentifier.of(QName.create(contDataNode.getNodeType(), "lf"));
+ final Optional<DataContainerChild<? extends PathArgument, ?>> leafDataNode = contDataNode.getChild(yangLeaf
+ .getLastPathArgument());
assertTrue(leafDataNode.isPresent());
- assertTrue("lf-test".equalsIgnoreCase(leafDataNode.get().getValue()
- .toString()));
+ assertTrue("lf-test".equalsIgnoreCase(leafDataNode.get().getValue().toString()));
}
private void checkExpectValueNormalizeNodeContext(
-<cont xmlns="invoke:rpc:module">
- <lf>lf-test</lf>
-</cont>
\ No newline at end of file
+<input xmlns="invoke:rpc:module">
+ <cont>
+ <lf>lf-test</lf>
+ </cont>
+</input>
\ No newline at end of file