use of org.opendaylight.yangtools.yang.model.api.Module in project controller by opendaylight.
the class ModuleMXBeanEntryNameConflictTest method testNameConflicts.
@Ignore
@Test
public void testNameConflicts() {
for (final String moduleName : testedModules) {
final Module testedModule = loadYangs(moduleName, moduleName);
try {
LOG.debug("Testing {}", moduleName);
ModuleMXBeanEntry.create(testedModule, new HashMap<>(), this.context, new TypeProviderWrapper(new TypeProviderImpl(this.context)), PACKAGE_NAME);
fail(moduleName + " did not cause a name conflict and should");
} catch (final NameConflictException e) {
assertEquals(this.testedYangModulesToExpectedConflictingName.get(moduleName), e.getConflictingName());
}
}
}
use of org.opendaylight.yangtools.yang.model.api.Module in project controller by opendaylight.
the class RuntimeBeanEntry method findQNameFromGrouping.
/**
* Find "proper" qname of unknown node in case it comes from a grouping
*/
private static QName findQNameFromGrouping(final DataNodeContainer subtree, final SchemaContext ctx, final UnknownSchemaNode unknownSchemaNode, final String localIdentityName) {
QName identityQName = null;
for (UsesNode usesNode : subtree.getUses()) {
SchemaNode dataChildByName = SchemaContextUtil.findDataSchemaNode(ctx, usesNode.getGroupingPath());
Module m = SchemaContextUtil.findParentModule(ctx, dataChildByName);
List<UnknownSchemaNode> unknownSchemaNodes = dataChildByName.getUnknownSchemaNodes();
if (Collections2.transform(unknownSchemaNodes, UNKNOWN_NODE_TO_STRING).contains(UNKNOWN_NODE_TO_STRING.apply(unknownSchemaNode))) {
identityQName = QName.create(dataChildByName.getQName(), localIdentityName);
}
}
return identityQName;
}
use of org.opendaylight.yangtools.yang.model.api.Module in project controller by opendaylight.
the class DOMRpcRoutingTable method findRpcDefinition.
private static RpcDefinition findRpcDefinition(final SchemaContext context, final SchemaPath schemaPath) {
if (context != null) {
final QName qname = schemaPath.getPathFromRoot().iterator().next();
final Module module = context.findModule(qname.getModule()).orElse(null);
if (module != null && module.getRpcs() != null) {
for (RpcDefinition rpc : module.getRpcs()) {
if (qname.equals(rpc.getQName())) {
return rpc;
}
}
}
}
return null;
}
Aggregations