SchemaNode schema = null;
final QName qname = name.getNodeType();
if (parent instanceof DataNodeContainer) {
- schema = ((DataNodeContainer)parent).getDataChildByName(qname);
+ schema = ((DataNodeContainer)parent).dataChildByName(qname);
if (schema == null) {
if (parent instanceof GroupingDefinition) {
schema = (GroupingDefinition) parent;
DataNodeContainer currenDataNodeContainer = module;
while (nodePathIterator.hasNext()) {
final QName qname = nodePathIterator.next();
- final DataSchemaNode child = currenDataNodeContainer.getDataChildByName(qname);
+ final DataSchemaNode child = currenDataNodeContainer.dataChildByName(qname);
if (child instanceof DataNodeContainer) {
if (!(child instanceof CaseSchemaNode)) {
final Iterator<PathArgument> it = id.getPathArguments().iterator();
if (it.hasNext()) {
topLevelElement = it.next();
- final DataSchemaNode dataChildByName = ctx.getDataChildByName(topLevelElement.getNodeType());
+ final DataSchemaNode dataChildByName = ctx.dataChildByName(topLevelElement.getNodeType());
checkNotNull(dataChildByName,
"Cannot find %s node in schema context. Instance identifier has to start from root", topLevelElement);
instanceIdToNodes = InstanceIdToNodes.fromSchemaAndQNameChecked(ctx, topLevelElement.getNodeType());
@Override
public SchemaOrderedNormalizedNodeWriter write(final NormalizedNode node) throws IOException {
if (Objects.equals(root, schemaContext)) {
- currentSchemaNode = schemaContext.getDataChildByName(node.getNodeType());
+ currentSchemaNode = schemaContext.dataChildByName(node.getNodeType());
} else {
currentSchemaNode = root;
}
*/
public static @Nullable SchemaNode findDataChildSchemaByQName(final SchemaNode node, final QName qname) {
if (node instanceof DataNodeContainer) {
- SchemaNode child = ((DataNodeContainer) node).getDataChildByName(qname);
+ SchemaNode child = ((DataNodeContainer) node).dataChildByName(qname);
if (child == null && node instanceof SchemaContext) {
child = tryFind(((SchemaContext) node).getOperations(), qname).orElse(null);
}
final DataSchemaNode child) {
if (parent instanceof AugmentationTarget && !(parent instanceof ChoiceSchemaNode)) {
for (AugmentationSchemaNode augmentation : ((AugmentationTarget) parent).getAvailableAugmentations()) {
- DataSchemaNode childInAugmentation = augmentation.getDataChildByName(child.getQName());
+ DataSchemaNode childInAugmentation = augmentation.dataChildByName(child.getQName());
if (childInAugmentation != null) {
return augmentation;
}
}
static DataSchemaNode findChildSchemaNode(final DataNodeContainer parent, final QName child) {
- final DataSchemaNode potential = parent.getDataChildByName(child);
+ final DataSchemaNode potential = parent.dataChildByName(child);
return potential == null ? findChoice(Iterables.filter(parent.getChildNodes(), ChoiceSchemaNode.class), child)
: potential;
}
@Test
public void findNodeInSchemaContextTest2() {
SchemaNode testNode = ((ContainerSchemaNode) myModule.getDataChildByName(QName.create(
- myModule.getQNameModule(), "my-container"))).getDataChildByName(QName.create(myModule.getQNameModule(),
+ myModule.getQNameModule(), "my-container"))).dataChildByName(QName.create(myModule.getQNameModule(),
"my-leaf-not-in-container"));
+ assertNull(testNode);
SchemaPath path = SchemaPath.create(true, QName.create(myModule.getQNameModule(), "my-container"),
QName.create(myModule.getQNameModule(), "my-leaf-not-in-container"));
SchemaNode foundNode = SchemaContextUtil.findNodeInSchemaContext(context, path.getPathFromRoot());
-
- assertNull(testNode);
assertNull(foundNode);
final RpcDefinition rpc = getRpcByName(myModule, "my-rpc");
- testNode = rpc.getInput().getDataChildByName(QName.create(myModule.getQNameModule(), "no-input-leaf"));
+ testNode = rpc.getInput().dataChildByName(QName.create(myModule.getQNameModule(), "no-input-leaf"));
+ assertNull(testNode);
path = SchemaPath.create(true, QName.create(myModule.getQNameModule(), "my-rpc"),
QName.create(myModule.getQNameModule(), "input"),
QName.create(myModule.getQNameModule(), "no-input-leaf"));
foundNode = SchemaContextUtil.findNodeInSchemaContext(context, path.getPathFromRoot());
-
- assertNull(testNode);
assertNull(foundNode);
final NotificationDefinition notification = myModule.getNotifications().iterator().next();
- testNode = notification.getDataChildByName(QName.create(myModule.getQNameModule(), "no-notification-leaf"));
+ testNode = notification.dataChildByName(QName.create(myModule.getQNameModule(), "no-notification-leaf"));
+ assertNull(testNode);
path = SchemaPath.create(true, QName.create(myModule.getQNameModule(), "my-notification"),
QName.create(myModule.getQNameModule(), "no-notification-leaf"));
foundNode = SchemaContextUtil.findNodeInSchemaContext(context, path.getPathFromRoot());
-
- assertNull(testNode);
assertNull(foundNode);
final GroupingDefinition grouping = getGroupingByName(myModule, "my-grouping");
testNode = ((ContainerSchemaNode) grouping.getDataChildByName(QName.create(myModule.getQNameModule(),
- "my-container-in-grouping"))).getDataChildByName(QName.create(myModule.getQNameModule(),
+ "my-container-in-grouping"))).dataChildByName(QName.create(myModule.getQNameModule(),
"no-leaf-in-grouping"));
+ assertNull(testNode);
path = SchemaPath.create(true, QName.create(myModule.getQNameModule(), "my-grouping"),
QName.create(myModule.getQNameModule(), "my-container-in-grouping"),
QName.create(myModule.getQNameModule(), "no-leaf-in-grouping"));
foundNode = SchemaContextUtil.findNodeInSchemaContext(context, path.getPathFromRoot());
-
- assertNull(testNode);
assertNull(foundNode);
testNode = ((ChoiceSchemaNode) myModule
.getDataChildByName(QName.create(myModule.getQNameModule(), "my-choice")))
.findCaseNodes("one").iterator().next()
- .getDataChildByName(QName.create(myModule.getQNameModule(), "no-choice-leaf"));
+ .dataChildByName(QName.create(myModule.getQNameModule(), "no-choice-leaf"));
+ assertNull(testNode);
path = SchemaPath.create(true, QName.create(myModule.getQNameModule(), "my-choice"),
QName.create(myModule.getQNameModule(), "one"),
QName.create(myModule.getQNameModule(), "no-choice-leaf"));
foundNode = SchemaContextUtil.findNodeInSchemaContext(context, path.getPathFromRoot());
-
- assertNull(testNode);
assertNull(foundNode);
ListSchemaNode listNode = (ListSchemaNode) ((ContainerSchemaNode) myModule.getDataChildByName(QName.create(
myModule.getQNameModule(), "my-container"))).getDataChildByName(QName.create(myModule.getQNameModule(),
"my-list"));
- testNode = listNode.getDataChildByName(QName.create(myModule.getQNameModule(), "no-leaf-in-list"));
+ testNode = listNode.dataChildByName(QName.create(myModule.getQNameModule(), "no-leaf-in-list"));
+ assertNull(testNode);
path = SchemaPath.create(true, QName.create(myModule.getQNameModule(), "my-container"),
QName.create(myModule.getQNameModule(), "my-list"),
QName.create(myModule.getQNameModule(), "no-leaf-in-list"));
foundNode = SchemaContextUtil.findNodeInSchemaContext(context, path.getPathFromRoot());
-
- assertNull(testNode);
assertNull(foundNode);
listNode = (ListSchemaNode) ((ContainerSchemaNode) myModule.getDataChildByName(QName.create(
myModule.getQNameModule(), "my-container"))).getDataChildByName(QName.create(myModule.getQNameModule(),
"my-list"));
- testNode = listNode.getDataChildByName(QName.create(myModule.getQNameModule(), "no-leaf-list-in-list"));
+ testNode = listNode.dataChildByName(QName.create(myModule.getQNameModule(), "no-leaf-list-in-list"));
+ assertNull(testNode);
path = SchemaPath.create(true, QName.create(myModule.getQNameModule(), "my-container"),
QName.create(myModule.getQNameModule(), "my-list"),
QName.create(myModule.getQNameModule(), "no-leaf-list-in-list"));
foundNode = SchemaContextUtil.findNodeInSchemaContext(context, path.getPathFromRoot());
-
- assertNull(testNode);
assertNull(foundNode);
-
}
@Test
SchemaNode foundNode = null;
final Iterable<QName> nextPath = nextLevel(path);
- foundNode = module.getDataChildByName(current);
+ foundNode = module.dataChildByName(current);
if (foundNode != null && nextPath.iterator().hasNext()) {
foundNode = findNodeIn(foundNode, nextPath);
}
if (parent instanceof DataNodeContainer) {
final DataNodeContainer parentDataNodeContainer = (DataNodeContainer) parent;
- foundNode = parentDataNodeContainer.getDataChildByName(current);
+ foundNode = parentDataNodeContainer.dataChildByName(current);
if (foundNode != null && nextPath.iterator().hasNext()) {
foundNode = findNodeIn(foundNode, nextPath);
}
if (foundNode == null) {
// fallback that tries to map into one of the child cases
for (final CaseSchemaNode caseNode : ((ChoiceSchemaNode) parent).getCases()) {
- final DataSchemaNode maybeChild = caseNode.getDataChildByName(current);
+ final DataSchemaNode maybeChild = caseNode.dataChildByName(current);
if (maybeChild != null) {
foundNode = findNodeIn(maybeChild, nextPath);
break;
return QName.create(module.getQNameModule(), prefixedName.next());
}
- return QName.create(parentModule.getNamespace(), parentModule.getRevision(), prefixedPathPart);
+ return QName.create(parentModule.getQNameModule(), prefixedPathPart);
}
/**
doReturn("test").when(mockModule).getName();
doReturn("test").when(mockModule).getPrefix();
- doReturn(NAMESPACE).when(mockModule).getNamespace();
doReturn(QNameModule.create(NAMESPACE)).when(mockModule).getQNameModule();
- doReturn(Optional.empty()).when(mockModule).getRevision();
}
@Test
QName.create(module.getQNameModule(), "test-leaf-a"));
assertNotNull(testLeafA);
- final ContainerSchemaNode testContainerB = (ContainerSchemaNode) module.getDataChildByName(
+ final ContainerSchemaNode testContainerB = (ContainerSchemaNode) module.dataChildByName(
QName.create(module.getQNameModule(), "test-container-b"));
assertNull(testContainerB);
boolean checked = false;
for (final AugmentationSchemaNode augmentationSchema : module.getAugmentations()) {
- final DataSchemaNode dataNode = augmentationSchema
- .getDataChildByName(QName.create(module.getQNameModule(), "dom-broker-impl"));
+ final DataSchemaNode dataNode = augmentationSchema.dataChildByName(
+ QName.create(module.getQNameModule(), "dom-broker-impl"));
if (dataNode instanceof CaseSchemaNode) {
final CaseSchemaNode caseNode = (CaseSchemaNode) dataNode;
- final DataSchemaNode dataNode2 = caseNode
- .getDataChildByName(QName.create(module.getQNameModule(), "async-data-broker"));
+ final DataSchemaNode dataNode2 = caseNode.dataChildByName(
+ QName.create(module.getQNameModule(), "async-data-broker"));
if (dataNode2 instanceof ContainerSchemaNode) {
final ContainerSchemaNode containerNode = (ContainerSchemaNode) dataNode2;
final DataSchemaNode leaf = containerNode
assertEquals(1, myContA.getChildNodes().size());
assertNotNull(myContA.getDataChildByName(QName.create(importedModule.getQNameModule(), "my-leaf-a3")));
- final ContainerSchemaNode myContB = (ContainerSchemaNode) importedModule.getDataChildByName(
+ final ContainerSchemaNode myContB = (ContainerSchemaNode) importedModule.dataChildByName(
QName.create(importedModule.getQNameModule(), "my-cont-b"));
assertNull(myContB);
final Collection<? extends UnknownSchemaNode> unknownSchemaNodes = schemaContext.getUnknownSchemaNodes();
assertEquals(3, unknownSchemaNodes.size());
- assertNull(schemaContext.getDataChildByName(QName.create("foo-namespace", "2016-09-21", "foo-cont")));
+ assertNull(schemaContext.dataChildByName(QName.create("foo-namespace", "2016-09-21", "foo-cont")));
assertFalse(schemaContext.findModule("foo", Revision.of("2016-08-21")).isPresent());
assertFalse(schemaContext.findModule(URI.create("foo-namespace"), Revision.of("2016-08-21")).isPresent());
final Module testModule = schemaContext.findModule("foo").get();
assertEquals(9, testModule.getChildNodes().size());
- final ContainerSchemaNode testContainerA = (ContainerSchemaNode) testModule.getDataChildByName(
+ final ContainerSchemaNode testContainerA = (ContainerSchemaNode) testModule.dataChildByName(
QName.create(testModule.getQNameModule(), "test-container-a"));
assertNull(testContainerA);
QName.create(testModule.getQNameModule(), "test-leaf-c"));
assertNotNull(testLeafC);
- final ContainerSchemaNode testContainerD = (ContainerSchemaNode) testModule.getDataChildByName(
+ final ContainerSchemaNode testContainerD = (ContainerSchemaNode) testModule.dataChildByName(
QName.create(testModule.getQNameModule(), "test-container-d"));
assertNull(testContainerD);
final ContainerSchemaNode testSubContainerE = (ContainerSchemaNode) testContainerE.getDataChildByName(
QName.create(testModule.getQNameModule(), "test-subcontainer-e"));
assertNotNull(testSubContainerE);
- final LeafSchemaNode testLeafE = (LeafSchemaNode) testSubContainerE.getDataChildByName(
+ final LeafSchemaNode testLeafE = (LeafSchemaNode) testSubContainerE.dataChildByName(
QName.create(testModule.getQNameModule(), "test-leaf-e"));
assertNull(testLeafE);
final ContainerSchemaNode testContainerF = (ContainerSchemaNode) testModule.getDataChildByName(
QName.create(testModule.getQNameModule(), "test-container-f"));
assertNotNull(testContainerF);
- final ContainerSchemaNode testSubContainerF = (ContainerSchemaNode) testContainerF.getDataChildByName(
+ final ContainerSchemaNode testSubContainerF = (ContainerSchemaNode) testContainerF.dataChildByName(
QName.create(testModule.getQNameModule(), "test-subcontainer-f"));
assertNull(testSubContainerF);
final LeafSchemaNode testLeafG = (LeafSchemaNode) testContainerG.getDataChildByName(
QName.create(testModule.getQNameModule(), "test-leaf-g"));
assertNotNull(testLeafG);
- final LeafSchemaNode augmentingTestLeafG = (LeafSchemaNode) testContainerG.getDataChildByName(
+ final LeafSchemaNode augmentingTestLeafG = (LeafSchemaNode) testContainerG.dataChildByName(
QName.create(testModule.getQNameModule(), "augmenting-test-leaf-g"));
assertNull(augmentingTestLeafG);
final AnyxmlSchemaNode augmentingTestAnyxmlG = (AnyxmlSchemaNode) testContainerG.getDataChildByName(
ContainerSchemaNode testGroupingSubContainer = (ContainerSchemaNode) testContainerI.getDataChildByName(
QName.create(testModule.getQNameModule(), "test-grouping-subcontainer"));
assertNotNull(testGroupingSubContainer);
- final LeafSchemaNode testGroupingLeaf = (LeafSchemaNode) testGroupingSubContainer.getDataChildByName(
+ final LeafSchemaNode testGroupingLeaf = (LeafSchemaNode) testGroupingSubContainer.dataChildByName(
QName.create(testModule.getQNameModule(), "test-grouping-leaf"));
assertNull(testGroupingLeaf);
final LeafSchemaNode augmentingTestGroupingLeaf = (LeafSchemaNode) testGroupingSubContainer.getDataChildByName(
QName.create(testModule.getQNameModule(), "augmenting-test-grouping-leaf"));
assertNotNull(augmentingTestGroupingLeaf);
- final LeafSchemaNode augmentingTestGroupingLeaf2 = (LeafSchemaNode) testGroupingSubContainer.getDataChildByName(
+ final LeafSchemaNode augmentingTestGroupingLeaf2 = (LeafSchemaNode) testGroupingSubContainer.dataChildByName(
QName.create(testModule.getQNameModule(), "augmenting-test-grouping-leaf-2"));
assertNull(augmentingTestGroupingLeaf2);
}
final ContainerSchemaNode testSubContainerE = (ContainerSchemaNode) testContainerE.getDataChildByName(
QName.create(testModule.getQNameModule(), "test-subcontainer-e"));
assertNotNull(testSubContainerE);
- final LeafSchemaNode testLeafE = (LeafSchemaNode) testSubContainerE.getDataChildByName(
+ final LeafSchemaNode testLeafE = (LeafSchemaNode) testSubContainerE.dataChildByName(
QName.create(testModule.getQNameModule(), "test-leaf-e"));
assertNull(testLeafE);
final ContainerSchemaNode testContainerF = (ContainerSchemaNode) testModule.getDataChildByName(
QName.create(testModule.getQNameModule(), "test-container-f"));
assertNotNull(testContainerF);
- final ContainerSchemaNode testSubContainerF = (ContainerSchemaNode) testContainerF.getDataChildByName(
+ final ContainerSchemaNode testSubContainerF = (ContainerSchemaNode) testContainerF.dataChildByName(
QName.create(testModule.getQNameModule(), "test-subcontainer-f"));
assertNull(testSubContainerF);
final LeafSchemaNode testLeafG = (LeafSchemaNode) testContainerG.getDataChildByName(
QName.create(testModule.getQNameModule(), "test-leaf-g"));
assertNotNull(testLeafG);
- final LeafSchemaNode augmentingTestLeafG = (LeafSchemaNode) testContainerG.getDataChildByName(
+ final LeafSchemaNode augmentingTestLeafG = (LeafSchemaNode) testContainerG.dataChildByName(
QName.create(testModule.getQNameModule(), "augmenting-test-leaf-g"));
assertNull(augmentingTestLeafG);
final AnyxmlSchemaNode augmentingTestAnyxmlG = (AnyxmlSchemaNode) testContainerG.getDataChildByName(
ContainerSchemaNode testGroupingSubContainer = (ContainerSchemaNode) testContainerI.getDataChildByName(
QName.create(testModule.getQNameModule(), "test-grouping-subcontainer"));
assertNotNull(testGroupingSubContainer);
- LeafSchemaNode testGroupingLeaf = (LeafSchemaNode) testGroupingSubContainer.getDataChildByName(
+ LeafSchemaNode testGroupingLeaf = (LeafSchemaNode) testGroupingSubContainer.dataChildByName(
QName.create(testModule.getQNameModule(), "test-grouping-leaf"));
assertNull(testGroupingLeaf);
QName.create(testModule.getQNameModule(), "test-grouping-subcontainer"));
assertNotNull(testGroupingSubContainer);
assertEquals(1, testGroupingSubContainer.getAvailableAugmentations().size());
- final LeafSchemaNode augmentingTestGroupingLeaf = (LeafSchemaNode) testGroupingSubContainer.getDataChildByName(
+ final LeafSchemaNode augmentingTestGroupingLeaf = (LeafSchemaNode) testGroupingSubContainer.dataChildByName(
QName.create(testModule.getQNameModule(), "augmenting-test-grouping-leaf"));
assertNull(augmentingTestGroupingLeaf);
- final LeafSchemaNode augmentingTestGroupingLeaf2 = (LeafSchemaNode) testGroupingSubContainer.getDataChildByName(
+ final LeafSchemaNode augmentingTestGroupingLeaf2 = (LeafSchemaNode) testGroupingSubContainer.dataChildByName(
QName.create(testModule.getQNameModule(), "augmenting-test-grouping-leaf-2"));
assertNull(augmentingTestGroupingLeaf2);
- testGroupingLeaf = (LeafSchemaNode) testGroupingSubContainer.getDataChildByName(
+ testGroupingLeaf = (LeafSchemaNode) testGroupingSubContainer.dataChildByName(
QName.create(testModule.getQNameModule(), "test-grouping-leaf"));
assertNull(testGroupingLeaf);
}