import java.io.BufferedWriter
import java.io.File
import java.io.OutputStreamWriter
+import java.net.URI
import java.util.ArrayList
import java.util.HashSet
import java.util.List
if (schemaNode instanceof ListSchemaNode) {
val listKeys = (schemaNode as ListSchemaNode).keyDefinition
for (listKey : listKeys) {
- pathListParams.add((schemaNode as DataNodeContainer).getDataChildByName(listKey) as LeafSchemaNode)
- path.append(PATH_DELIMETER + "{" + listKey.localName + "}")
+ pathListParams.add((schemaNode as DataNodeContainer).getDataChildByName(listKey) as LeafSchemaNode)
+ path.append(PATH_DELIMETER)
+ path.append('{')
+ path.append(listKey.localName)
+ path.append('}')
}
}
return path.toString
private def resourceParams() '''
«FOR pathParam : pathListParams»
«IF pathParam != null»
- «val prefix = pathParam.type.QName.prefix»
- «val type = if (prefix.nullOrEmpty) pathParam.type.QName.localName else prefix + ":" + pathParam.type.QName.localName»
+ «val type = pathParam.type.QName.localName»
<param required="true" style="template" name="«pathParam.QName.localName»" type="«type»"/>
«ENDIF»
«ENDFOR»
private def methodGet(DataSchemaNode schemaNode) '''
<method name="GET">
<response>
- «representation(schemaNode.QName.prefix, schemaNode.QName.localName)»
+ «representation(schemaNode.QName.namespace, schemaNode.QName.localName)»
</response>
</method>
'''
private def mehodPut(DataSchemaNode schemaNode) '''
<method name="PUT">
<request>
- «representation(schemaNode.QName.prefix, schemaNode.QName.localName)»
+ «representation(schemaNode.QName.namespace, schemaNode.QName.localName)»
</request>
</method>
'''
private def mehodPost(DataSchemaNode schemaNode) '''
<method name="POST">
<request>
- «representation(schemaNode.QName.prefix, schemaNode.QName.localName)»
+ «representation(schemaNode.QName.namespace, schemaNode.QName.localName)»
</request>
</method>
'''
<method name="DELETE" />
'''
- private def representation(String prefix, String name) '''
- «val elementData = if (prefix.nullOrEmpty) name else prefix + ":" + name»
+ private def representation(URI prefix, String name) '''
+ «val elementData = name»
<representation mediaType="application/xml" element="«elementData»"/>
<representation mediaType="text/xml" element="«elementData»"/>
<representation mediaType="application/json" element="«elementData»"/>
/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.Fpre
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
package org.opendaylight.yangtools.yang.common;
import static org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil.getRevisionFormat;
-
import java.io.Serializable;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Objects;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-
import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.objcache.ObjectCache;
import org.opendaylight.yangtools.objcache.ObjectCacheFactory;
private final QNameModule module;
// Mandatory
private final String localName;
- // Nullable
- private final String prefix;
- private QName(final QNameModule module, final String prefix, final String localName) {
+ private QName(final QNameModule module, final String localName) {
this.localName = checkLocalName(localName);
- this.prefix = prefix;
this.module = module;
}
return CACHE.getReference(what);
}
- /**
- * QName Constructor.
- *
- * @param namespace
- * the namespace assigned to the YANG module
- * @param revision
- * the revision of the YANG module
- * @param prefix
- * locally defined prefix assigned to local name
- * @param localName
- * YANG schema identifier
- *
- * @deprecated Prefix storage in QNames is deprecated.
- */
- @Deprecated
- public QName(final URI namespace, final Date revision, final String prefix, final String localName) {
- this(QNameModule.create(namespace, revision), prefix, localName);
- }
-
/**
* QName Constructor.
*
* YANG schema identifier
*/
public QName(final URI namespace, final String localName) {
- this(namespace, null, "", localName);
+ this(QNameModule.create(namespace, null), localName);
}
private static String checkLocalName(final String localName) {
return module.getRevision();
}
- /**
- * Returns locally defined prefix assigned to local name
- *
- * @return locally defined prefix assigned to local name
- *
- * @deprecated Prefix storage in QNames is deprecated.
- */
- @Deprecated
- public String getPrefix() {
- return prefix;
- }
-
@Override
public int hashCode() {
final int prime = 31;
}
public static QName create(final QName base, final String localName) {
- return create(base.getModule(), base.getPrefix(), localName);
+ return create(base.getModule(), localName);
}
/**
*
* @param qnameModule
* Namespace and revision enclosed as a QNameModule
- * @param prefix
- * Namespace prefix
* @param localName
* Local name part of QName. MUST NOT BE null.
* @return Instance of QName
- *
- * @deprecated Prefix storage in QNames is deprecated.
*/
- @Deprecated
- public static QName create(final QNameModule module, final String prefix, final String localName) {
- if (module == null) {
+ public static QName create(final QNameModule qnameModule, final String localName) {
+ if (qnameModule == null) {
throw new NullPointerException("module may not be null");
}
- return new QName(module, prefix, localName);
- }
-
- /**
- * Creates new QName.
- *
- * @param qnameModule
- * Namespace and revision enclosed as a QNameModule
- * @param localName
- * Local name part of QName. MUST NOT BE null.
- * @return Instance of QName
- */
- public static QName create(final QNameModule qnameModule, final String localName) {
- return create(qnameModule, null, localName);
+ return new QName(qnameModule, localName);
}
/**
* @return Instance of QName
*/
public static QName create(final URI namespace, final Date revision, final String localName) {
- return create(QNameModule.create(namespace, revision), null, localName);
+ return create(QNameModule.create(namespace, revision), localName);
}
/**
*/
public void writeElement(final XMLStreamWriter writer, final @Nonnull Node<?> data, final SchemaNode schema) throws XMLStreamException {
final QName qname = data.getNodeType();
- final String pfx = qname.getPrefix() != null ? qname.getPrefix() : "";
final String ns = qname.getNamespace() != null ? qname.getNamespace().toString() : "";
+ final String pfx = "";
if (isEmptyElement(data)) {
if (hasAttributes(data)) {
private static void write(final @Nonnull XMLStreamWriter writer, final @Nonnull IdentityrefTypeDefinition type, final @Nonnull Object value) throws XMLStreamException {
if (value instanceof QName) {
final QName qname = (QName) value;
- final String prefix;
- if (qname.getPrefix() != null && !qname.getPrefix().isEmpty()) {
- prefix = qname.getPrefix();
- } else {
- prefix = "x";
- }
+ final String prefix = "x";
final String ns = qname.getNamespace().toString();
writer.writeNamespace(prefix, ns);
private static final Logger LOG = LoggerFactory.getLogger(MyNodeBuilder.class);
private URI qnNamespace;
- private final String qnPrefix;
private final Date qnRevision;
private CompositeNode rootNode;
*/
private MyNodeBuilder(final QName baseQName) {
qnNamespace = baseQName.getNamespace();
- qnPrefix = baseQName.getPrefix();
qnRevision = baseQName.getRevision();
}
public static MyNodeBuilder newInstance() {
QName qName = null;
try {
- qName = new QName(
+ qName = QName.create(
new URI("urn:opendaylight:controller:network"),
- new Date(42), "yang-data-impl-groovyTest_", "node");
+ new Date(42), "node");
} catch (URISyntaxException e) {
LOG.error(e.getMessage(), e);
}
private QName createQName(final Object localName) {
LOG.debug("qname for: "+localName);
- return new QName(qnNamespace, qnRevision, qnPrefix, (String) localName);
+ return QName.create(qnNamespace, qnRevision, (String) localName);
}
protected CompositeNode getCurrentNode() {
public CompositeNode getRootNode() {
return rootNode;
}
-}
\ No newline at end of file
+}
final RandomPrefix a = new RandomPrefix();
final URI uri = URI.create("localhost");
- final QName qName = QName.create(QNameModule.create(uri, new Date()), "p1", "local-name");
- final QName qName2 = QName.create(QNameModule.create(uri, new Date()), "p2", "local-name");
+ final QName qName = QName.create(QNameModule.create(uri, new Date()), "local-name");
+ final QName qName2 = QName.create(QNameModule.create(uri, new Date()), "local-name");
assertEquals(a.encodePrefix(qName.getNamespace()), a.encodePrefix(qName2.getNamespace()));
}
final URI uri = URI.create("localhost");
QName qName = QName.create(uri, new Date(), "local-name");
assertEquals("a", a.encodePrefix(qName.getNamespace()));
- qName = QName.create(QNameModule.create(uri, new Date()), "", "local-name");
+ qName = QName.create(QNameModule.create(uri, new Date()), "local-name");
assertEquals("a", a.encodePrefix(qName.getNamespace()));
- qName = QName.create(QNameModule.create(URI.create("second"), new Date()), "", "local-name");
+ qName = QName.create(QNameModule.create(URI.create("second"), new Date()), "local-name");
assertEquals("b", a.encodePrefix(qName.getNamespace()));
}
if(prefix.isPresent()) {
final QName moduleQName = QName.create(namespace, revision, "module");
final QNameModule module = QNameModule.create(moduleQName.getNamespace(), moduleQName.getRevision());
- return QName.create(module, prefix.get(), localName);
+ return QName.create(module, localName);
} else {
return QName.create(namespace, revision, localName);
}
}
return null;
}
-}
\ No newline at end of file
+}
* @return built-in base yang type QName.
*/
public static QName constructQName(final String typeName) {
- return QName.create(BASE_TYPES_MODULE, "", typeName);
+ return QName.create(BASE_TYPES_MODULE, typeName);
}
/**
if (newParent instanceof ModuleBuilder) {
ModuleBuilder parent = (ModuleBuilder) newParent;
if (identityrefTypeCheck) {
- newQName = QName.create(parent.getQNameModule(), parent.getPrefix(), old.getQName()
- .getLocalName());
+ newQName = QName.create(parent.getQNameModule(), old.getQName().getLocalName());
} else {
newQName = old.getQName();
}
AugmentationSchemaBuilder augment = (AugmentationSchemaBuilder) newParent;
ModuleBuilder parent = BuilderUtils.getParentModule(newParent);
if (identityrefTypeCheck) {
- newQName = QName.create(parent.getQNameModule(), parent.getPrefix(), old.getQName()
- .getLocalName());
+ newQName = QName.create(parent.getQNameModule(), old.getQName().getLocalName());
} else {
newQName = old.getQName();
}
}
public ModuleBuilder(final Module base) {
- super(base.getName(), 0, QName.create(base.getQNameModule(), base.getPrefix(), base.getName()),
+ super(base.getName(), 0, QName.create(base.getQNameModule(), base.getName()),
SCHEMA_PATH, base);
this.name = base.getName();
this.sourcePath = base.getModuleSourcePath();
private final SchemaPathStack stack = new SchemaPathStack();
private final Map<String, TreeMap<Date, URI>> namespaceContext;
private final String sourcePath;
- private QName moduleQName = new QName(null, new Date(0L), null, "dummy");
+ private QName moduleQName = QName.create(null, new Date(0L), "dummy");
private ModuleBuilder moduleBuilder;
private String moduleName;
private int augmentOrder;
setLog("namespace", namespaceStr);
} else if (treeNode instanceof Prefix_stmtContext) {
yangModelPrefix = stringFromNode(treeNode);
- this.moduleQName = QName.create(moduleQName.getModule(), yangModelPrefix, moduleQName.getLocalName());
+ this.moduleQName = QName.create(moduleQName.getModule(), moduleQName.getLocalName());
moduleBuilder.setPrefix(yangModelPrefix);
setLog("prefix", yangModelPrefix);
} else if (treeNode instanceof Yang_version_stmtContext) {
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-
import java.io.FileNotFoundException;
import java.net.URI;
import java.text.DateFormat;
import java.util.Date;
import java.util.List;
import java.util.Set;
-
import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.QName;
private static Date fooRev;
private static Date barRev;
private static Date bazRev;
- private static final String foo = "foo";
- private static final String bar = "bar";
- private static final String baz = "baz";
private static QName q0;
private static QName q1;
private static QName q2;
barRev = simpleDateFormat.parse("2013-10-14");
bazRev = simpleDateFormat.parse("2013-10-15");
- q0 = new QName(barNS, barRev, bar, "interfaces");
- q1 = new QName(barNS, barRev, bar, "ifEntry");
- q2 = new QName(bazNS, bazRev, baz, "augment-holder");
+ q0 = QName.create(barNS, barRev, "interfaces");
+ q1 = QName.create(barNS, barRev, "ifEntry");
+ q2 = QName.create(bazNS, bazRev, "augment-holder");
}
@Test
assertNotNull(odl);
// leaf ds0ChannelNumber
- QName qname = new QName(fooNS, fooRev, foo, "ds0ChannelNumber");
+ QName qname = QName.create(fooNS, fooRev, "ds0ChannelNumber");
qnames.add(qname);
assertEquals(qname, ds0ChannelNumber.getQName());
expectedSchemaPath = SchemaPath.create(qnames, true);
assertEquals(expectedSchemaPath, ds0ChannelNumber.getType().getPath());
// leaf interface-id
- qname = new QName(fooNS, fooRev, foo, "interface-id");
+ qname = QName.create(fooNS, fooRev, "interface-id");
assertEquals(qname, interfaceId.getQName());
qnames.set(3, qname);
expectedSchemaPath = SchemaPath.create(qnames, true);
assertFalse(interfaceId.isAugmenting());
// container schemas
- qname = new QName(fooNS, fooRev, foo, "schemas");
+ qname = QName.create(fooNS, fooRev, "schemas");
assertEquals(qname, schemas.getQName());
qnames.set(3, qname);
expectedSchemaPath = SchemaPath.create(qnames, true);
assertFalse(schemas.isAugmenting());
// choice odl
- qname = new QName(fooNS, fooRev, foo, "odl");
+ qname = QName.create(fooNS, fooRev, "odl");
assertEquals(qname, odl.getQName());
qnames.set(3, qname);
expectedSchemaPath = SchemaPath.create(qnames, true);
assertNotNull(odl);
// leaf ds0ChannelNumber
- QName qname = new QName(fooNS, fooRev, foo, "ds0ChannelNumber");
+ QName qname = QName.create(fooNS, fooRev, "ds0ChannelNumber");
assertEquals(qname, ds0ChannelNumber.getQName());
qnames.add(qname);
expectedPath = SchemaPath.create(qnames, true);
assertEquals(expectedPath, ds0ChannelNumber.getPath());
// leaf interface-id
- qname = new QName(fooNS, fooRev, foo, "interface-id");
+ qname = QName.create(fooNS, fooRev, "interface-id");
assertEquals(qname, interfaceId.getQName());
qnames.set(3, qname);
expectedPath = SchemaPath.create(qnames, true);
assertEquals(expectedPath, interfaceId.getPath());
// container schemas
- qname = new QName(fooNS, fooRev, foo, "schemas");
+ qname = QName.create(fooNS, fooRev, "schemas");
assertEquals(qname, schemas.getQName());
qnames.set(3, qname);
expectedPath = SchemaPath.create(qnames, true);
assertEquals(expectedPath, schemas.getPath());
// choice odl
- qname = new QName(fooNS, fooRev, foo, "odl");
+ qname = QName.create(fooNS, fooRev, "odl");
assertEquals(qname, odl.getQName());
qnames.set(3, qname);
expectedPath = SchemaPath.create(qnames, true);
qnames.add(q0);
qnames.add(q1);
qnames.add(q2);
- qnames.add(new QName(fooNS, fooRev, foo, "odl"));
+ qnames.add(QName.create(fooNS, fooRev, "odl"));
// case id
- QName qname = new QName(fooNS, fooRev, foo, "id");
+ QName qname = QName.create(fooNS, fooRev, "id");
assertEquals(qname, id.getQName());
qnames.add(qname);
expectedPath = SchemaPath.create(qnames, true);
assertEquals(1, idChildren.size());
// case node1
- qname = new QName(fooNS, fooRev, foo, "node1");
+ qname = QName.create(fooNS, fooRev, "node1");
assertEquals(qname, node1.getQName());
qnames.set(4, qname);
expectedPath = SchemaPath.create(qnames, true);
assertTrue(node1Children.isEmpty());
// case node2
- qname = new QName(fooNS, fooRev, foo, "node2");
+ qname = QName.create(fooNS, fooRev, "node2");
assertEquals(qname, node2.getQName());
qnames.set(4, qname);
expectedPath = SchemaPath.create(qnames, true);
assertTrue(node2Children.isEmpty());
// case node3
- qname = new QName(fooNS, fooRev, foo, "node3");
+ qname = QName.create(fooNS, fooRev, "node3");
assertEquals(qname, node3.getQName());
qnames.set(4, qname);
expectedPath = SchemaPath.create(qnames, true);
qnames.add(q0);
qnames.add(q1);
qnames.add(q2);
- qnames.add(new QName(fooNS, fooRev, foo, "odl"));
+ qnames.add(QName.create(fooNS, fooRev, "odl"));
// case id child
- qnames.add(new QName(fooNS, fooRev, foo, "id"));
- qnames.add(new QName(fooNS, fooRev, foo, "id"));
+ qnames.add(QName.create(fooNS, fooRev, "id"));
+ qnames.add(QName.create(fooNS, fooRev, "id"));
LeafSchemaNode caseIdChild = (LeafSchemaNode) idChildren.iterator().next();
assertNotNull(caseIdChild);
expectedPath = SchemaPath.create(qnames, true);
assertEquals(expectedPath, caseIdChild.getPath());
// case node3 child
- qnames.set(4, new QName(fooNS, fooRev, foo, "node3"));
- qnames.set(5, new QName(fooNS, fooRev, foo, "node3"));
+ qnames.set(4, QName.create(fooNS, fooRev, "node3"));
+ qnames.set(5, QName.create(fooNS, fooRev, "node3"));
ContainerSchemaNode caseNode3Child = (ContainerSchemaNode) node3Children.iterator().next();
assertNotNull(caseNode3Child);
expectedPath = SchemaPath.create(qnames, true);
}
assertNotNull(submit);
- QName submitQName = new QName(NS_BAR, revision, "b", "submit");
+ QName submitQName = QName.create(NS_BAR, revision, "submit");
assertEquals(submitQName, submit.getQName());
ContainerSchemaNode input = submit.getInput();
- QName inputQName = new QName(NS_BAR, revision, "b", "input");
+ QName inputQName = QName.create(NS_BAR, revision, "input");
assertEquals(inputQName, input.getQName());
ChoiceNode arguments = (ChoiceNode) input.getDataChildByName("arguments");
- QName argumentsQName = new QName(NS_BAR, revision, "b", "arguments");
+ QName argumentsQName = QName.create(NS_BAR, revision, "arguments");
assertEquals(argumentsQName, arguments.getQName());
assertFalse(arguments.isAugmenting());
Set<ChoiceCaseNode> cases = arguments.getCases();
qnames[2] = argumentsQName;
// case attach
- qnames[3] = new QName(NS_FOO, revision, "f", "attach");
+ qnames[3] = QName.create(NS_FOO, revision, "attach");
assertEquals(qnames[3], attach.getQName());
expectedPath = SchemaPath.create(Arrays.asList(qnames), true);
assertEquals(expectedPath, attach.getPath());
assertEquals(1, attachChildren.size());
// case create
- qnames[3] = new QName(NS_FOO, revision, "f", "create");
+ qnames[3] = QName.create(NS_FOO, revision, "create");
assertEquals(qnames[3], create.getQName());
expectedPath = SchemaPath.create(Arrays.asList(qnames), true);
assertEquals(expectedPath, create.getPath());
assertEquals(1, createChildren.size());
// case attach
- qnames[3] = new QName(NS_FOO, revision, "f", "destroy");
+ qnames[3] = QName.create(NS_FOO, revision, "destroy");
assertEquals(qnames[3], destroy.getQName());
expectedPath = SchemaPath.create(Arrays.asList(qnames), true);
assertEquals(expectedPath, destroy.getPath());
package org.opendaylight.yangtools.yang.parser.impl;
import static org.junit.Assert.assertEquals;
-
import com.google.common.io.ByteSource;
import com.google.common.io.ByteStreams;
import java.io.File;
public static SchemaPath createPath(final boolean absolute, final URI namespace, final Date revision, final String prefix, final String... names) {
List<QName> path = new ArrayList<>();
for (String name : names) {
- path.add(new QName(namespace, revision, prefix, name));
+ path.add(QName.create(namespace, revision, name));
}
return SchemaPath.create(path, absolute);
}
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-
import com.google.common.collect.Lists;
-
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URI;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
-
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.QName;
private static final URI GD_NS = URI.create("urn:opendaylight:params:xml:ns:yang:grouping-definitions");
private Date UG_REV;
private Date GD_REV;
- private static final String UG_PREF = "ug";
- private static final String GD_PREF = "gd";
private Set<Module> modules;
assertEquals(1, notifications.size());
NotificationDefinition pcreq = notifications.iterator().next();
assertNotNull(pcreq);
- QName expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "pcreq");
+ QName expectedQName = QName.create(UG_NS, UG_REV, "pcreq");
path.offer(expectedQName);
SchemaPath expectedPath = SchemaPath.create(path, true);
assertEquals(expectedPath, pcreq.getPath());
// * |-- leaf version
LeafSchemaNode version = (LeafSchemaNode) pcreq.getDataChildByName("version");
assertNotNull(version);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "version");
+ expectedQName = QName.create(UG_NS, UG_REV, "version");
path.offer(expectedQName);
expectedPath = SchemaPath.create(path, true);
assertEquals(expectedPath, version.getPath());
- expectedQName = new QName(GD_NS, GD_REV, GD_PREF, "protocol-version");
+ expectedQName = QName.create(GD_NS, GD_REV, "protocol-version");
path.offer(expectedQName);
expectedPath = SchemaPath.create(Lists.newArrayList(expectedQName), true);
assertEquals(expectedPath, version.getType().getPath());
// * |-- leaf type
LeafSchemaNode type = (LeafSchemaNode) pcreq.getDataChildByName("type");
assertNotNull(type);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "type");
+ expectedQName = QName.create(UG_NS, UG_REV, "type");
assertTrue(type.isAddedByUses());
path.pollLast();
path.pollLast();
path.offer(expectedQName);
expectedPath = SchemaPath.create(path, true);
assertEquals(expectedPath, type.getPath());
- expectedQName = new QName(GD_NS, GD_REV, GD_PREF, "int-ext");
+ expectedQName = QName.create(GD_NS, GD_REV, "int-ext");
path.offer(expectedQName);
expectedPath = SchemaPath.create(Lists.newArrayList(expectedQName), true);
assertEquals(expectedPath, type.getType().getPath());
// * |-- list requests
ListSchemaNode requests = (ListSchemaNode) pcreq.getDataChildByName("requests");
assertNotNull(requests);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "requests");
+ expectedQName = QName.create(UG_NS, UG_REV, "requests");
assertEquals(expectedQName, requests.getQName());
path.pollLast();
path.pollLast();
// * |-- |-- container rp
ContainerSchemaNode rp = (ContainerSchemaNode) requests.getDataChildByName("rp");
assertNotNull(rp);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "rp");
+ expectedQName = QName.create(UG_NS, UG_REV, "rp");
path.offer(expectedQName);
expectedPath = SchemaPath.create(path, true);
assertEquals(expectedPath, rp.getPath());
// * |-- |-- |-- leaf processing-rule
LeafSchemaNode processingRule = (LeafSchemaNode) rp.getDataChildByName("processing-rule");
assertNotNull(processingRule);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "processing-rule");
+ expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
assertEquals(expectedQName, processingRule.getQName());
path.offer(expectedQName);
expectedPath = SchemaPath.create(path, true);
// * |-- |-- |-- leaf ignore
LeafSchemaNode ignore = (LeafSchemaNode) rp.getDataChildByName("ignore");
assertNotNull(ignore);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "ignore");
+ expectedQName = QName.create(UG_NS, UG_REV, "ignore");
assertEquals(expectedQName, ignore.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- |-- leaf priority
LeafSchemaNode priority = (LeafSchemaNode) rp.getDataChildByName("priority");
assertNotNull(priority);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "priority");
+ expectedQName = QName.create(UG_NS, UG_REV, "priority");
assertEquals(expectedQName, priority.getQName());
path.pollLast();
path.offer(expectedQName);
expectedPath = SchemaPath.create(path, true);
assertEquals(expectedPath, priority.getPath());
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "uint8");
+ expectedQName = QName.create(UG_NS, UG_REV, "uint8");
path.offer(expectedQName);
expectedPath = SchemaPath.create(path, true);
// TODO
// * |-- |-- |-- container box
ContainerSchemaNode box = (ContainerSchemaNode) rp.getDataChildByName("box");
assertNotNull(box);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "box");
+ expectedQName = QName.create(UG_NS, UG_REV, "box");
assertEquals(expectedQName, box.getQName());
path.pollLast();
path.pollLast();
// * |-- |-- |-- |-- container order
ContainerSchemaNode order = (ContainerSchemaNode) box.getDataChildByName("order");
assertNotNull(order);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "order");
+ expectedQName = QName.create(UG_NS, UG_REV, "order");
assertEquals(expectedQName, order.getQName());
path.offer(expectedQName);
expectedPath = SchemaPath.create(path, true);
// * |-- |-- |-- |-- |-- leaf delete
LeafSchemaNode delete = (LeafSchemaNode) order.getDataChildByName("delete");
assertNotNull(delete);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "delete");
+ expectedQName = QName.create(UG_NS, UG_REV, "delete");
assertEquals(expectedQName, delete.getQName());
path.offer(expectedQName);
expectedPath = SchemaPath.create(path, true);
// * |-- |-- |-- |-- |-- leaf setup
LeafSchemaNode setup = (LeafSchemaNode) order.getDataChildByName("setup");
assertNotNull(setup);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "setup");
+ expectedQName = QName.create(UG_NS, UG_REV, "setup");
assertEquals(expectedQName, setup.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- path-key-expansion
ContainerSchemaNode pke = (ContainerSchemaNode) requests.getDataChildByName("path-key-expansion");
assertNotNull(pke);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "path-key-expansion");
+ expectedQName = QName.create(UG_NS, UG_REV, "path-key-expansion");
assertEquals(expectedQName, pke.getQName());
path.pollLast();
path.pollLast();
// * |-- |-- |-- path-key
ContainerSchemaNode pathKey = (ContainerSchemaNode) pke.getDataChildByName("path-key");
assertNotNull(pathKey);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "path-key");
+ expectedQName = QName.create(UG_NS, UG_REV, "path-key");
assertEquals(expectedQName, pathKey.getQName());
path.offer(expectedQName);
expectedPath= SchemaPath.create(path, true);
// * |-- |-- |-- |-- leaf processing-rule
processingRule = (LeafSchemaNode) pathKey.getDataChildByName("processing-rule");
assertNotNull(processingRule);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "processing-rule");
+ expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
assertEquals(expectedQName, processingRule.getQName());
path.offer(expectedQName);
expectedPath= SchemaPath.create(path, true);
// * |-- |-- |-- |-- leaf ignore
ignore = (LeafSchemaNode) pathKey.getDataChildByName("ignore");
assertNotNull(ignore);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "ignore");
+ expectedQName = QName.create(UG_NS, UG_REV, "ignore");
assertEquals(expectedQName, ignore.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- |-- |-- list path-keys
ListSchemaNode pathKeys = (ListSchemaNode) pathKey.getDataChildByName("path-keys");
assertNotNull(pathKeys);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "path-keys");
+ expectedQName = QName.create(UG_NS, UG_REV, "path-keys");
assertEquals(expectedQName, pathKeys.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- |-- |-- |-- leaf version
version = (LeafSchemaNode) pathKeys.getDataChildByName("version");
assertNotNull(version);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "version");
+ expectedQName = QName.create(UG_NS, UG_REV, "version");
assertEquals(expectedQName, version.getQName());
path.offer(expectedQName);
expectedPath= SchemaPath.create(path, true);
// * |-- |-- |-- |-- |-- leaf type
type = (LeafSchemaNode) pathKeys.getDataChildByName("type");
assertNotNull(type);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "type");
+ expectedQName = QName.create(UG_NS, UG_REV, "type");
assertEquals(expectedQName, type.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- container segment-computation
ContainerSchemaNode sc = (ContainerSchemaNode) requests.getDataChildByName("segment-computation");
assertNotNull(sc);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "segment-computation");
+ expectedQName = QName.create(UG_NS, UG_REV, "segment-computation");
assertEquals(expectedQName, sc.getQName());
path.pollLast();
path.pollLast();
// * |-- |-- |-- container p2p
ContainerSchemaNode p2p = (ContainerSchemaNode) sc.getDataChildByName("p2p");
assertNotNull(p2p);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "p2p");
+ expectedQName = QName.create(UG_NS, UG_REV, "p2p");
assertEquals(expectedQName, p2p.getQName());
path.offer(expectedQName);
expectedPath= SchemaPath.create(path, true);
// * |-- |-- |-- |-- container endpoints
ContainerSchemaNode endpoints = (ContainerSchemaNode) p2p.getDataChildByName("endpoints");
assertNotNull(endpoints);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "endpoints");
+ expectedQName = QName.create(UG_NS, UG_REV, "endpoints");
assertEquals(expectedQName, endpoints.getQName());
path.offer(expectedQName);
expectedPath= SchemaPath.create(path, true);
// * |-- |-- |-- |-- |-- leaf processing-rule
processingRule = (LeafSchemaNode) endpoints.getDataChildByName("processing-rule");
assertNotNull(processingRule);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "processing-rule");
+ expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
assertEquals(expectedQName, processingRule.getQName());
path.offer(expectedQName);
expectedPath= SchemaPath.create(path, true);
// * |-- |-- |-- |-- |-- leaf ignore
ignore = (LeafSchemaNode) endpoints.getDataChildByName("ignore");
assertNotNull(ignore);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "ignore");
+ expectedQName = QName.create(UG_NS, UG_REV, "ignore");
assertEquals(expectedQName, ignore.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- |-- |-- |-- container box
box = (ContainerSchemaNode) endpoints.getDataChildByName("box");
assertNotNull(box);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "box");
+ expectedQName = QName.create(UG_NS, UG_REV, "box");
assertEquals(expectedQName, box.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- |-- |-- |-- choice address-family
ChoiceNode af = (ChoiceNode) endpoints.getDataChildByName("address-family");
assertNotNull(af);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "address-family");
+ expectedQName = QName.create(UG_NS, UG_REV, "address-family");
assertEquals(expectedQName, af.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- |-- |-- container reported-route
ContainerSchemaNode reportedRoute = (ContainerSchemaNode) p2p.getDataChildByName("reported-route");
assertNotNull(reportedRoute);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "reported-route");
+ expectedQName = QName.create(UG_NS, UG_REV, "reported-route");
assertEquals(expectedQName, reportedRoute.getQName());
path.pollLast();
path.pollLast();
// * |-- |-- |-- |-- |-- leaf processing-rule
processingRule = (LeafSchemaNode) reportedRoute.getDataChildByName("processing-rule");
assertNotNull(processingRule);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "processing-rule");
+ expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
assertEquals(expectedQName, processingRule.getQName());
path.offer(expectedQName);
expectedPath= SchemaPath.create(path, true);
// * |-- |-- |-- |-- |-- leaf ignore
ignore = (LeafSchemaNode) reportedRoute.getDataChildByName("ignore");
assertNotNull(ignore);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "ignore");
+ expectedQName = QName.create(UG_NS, UG_REV, "ignore");
assertEquals(expectedQName, ignore.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- |-- |-- |-- list subobjects
ListSchemaNode subobjects = (ListSchemaNode) reportedRoute.getDataChildByName("subobjects");
assertNotNull(subobjects);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "subobjects");
+ expectedQName = QName.create(UG_NS, UG_REV, "subobjects");
assertEquals(expectedQName, subobjects.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- |-- |-- |-- container bandwidth
ContainerSchemaNode bandwidth = (ContainerSchemaNode) reportedRoute.getDataChildByName("bandwidth");
assertNotNull(bandwidth);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "bandwidth");
+ expectedQName = QName.create(UG_NS, UG_REV, "bandwidth");
assertEquals(expectedQName, bandwidth.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- |-- |-- container bandwidth
bandwidth = (ContainerSchemaNode) p2p.getDataChildByName("bandwidth");
assertNotNull(bandwidth);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "bandwidth");
+ expectedQName = QName.create(UG_NS, UG_REV, "bandwidth");
assertEquals(expectedQName, bandwidth.getQName());
path.pollLast();
path.pollLast();
// * |-- |-- |-- |-- |-- leaf processing-rule
processingRule = (LeafSchemaNode) bandwidth.getDataChildByName("processing-rule");
assertNotNull(processingRule);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "processing-rule");
+ expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
assertEquals(expectedQName, processingRule.getQName());
path.offer(expectedQName);
expectedPath= SchemaPath.create(path, true);
// * |-- |-- |-- |-- |-- leaf ignore
ignore = (LeafSchemaNode) bandwidth.getDataChildByName("ignore");
assertNotNull(ignore);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "ignore");
+ expectedQName = QName.create(UG_NS, UG_REV, "ignore");
assertEquals(expectedQName, ignore.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- |-- |-- |-- container bandwidth
ContainerSchemaNode bandwidthInner = (ContainerSchemaNode) bandwidth.getDataChildByName("bandwidth");
assertNotNull(bandwidthInner);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "bandwidth");
+ expectedQName = QName.create(UG_NS, UG_REV, "bandwidth");
assertEquals(expectedQName, bandwidth.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- list svec
ListSchemaNode svec = (ListSchemaNode) pcreq.getDataChildByName("svec");
assertNotNull(svec);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "svec");
+ expectedQName = QName.create(UG_NS, UG_REV, "svec");
assertEquals(expectedQName, svec.getQName());
path.pollLast();
path.pollLast();
// * |-- |-- leaf link-diverse
LeafSchemaNode linkDiverse = (LeafSchemaNode) svec.getDataChildByName("link-diverse");
assertNotNull(linkDiverse);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "link-diverse");
+ expectedQName = QName.create(UG_NS, UG_REV, "link-diverse");
assertEquals(expectedQName, linkDiverse.getQName());
path.offer(expectedQName);
expectedPath= SchemaPath.create(path, true);
// * |-- |-- leaf processing-rule
processingRule = (LeafSchemaNode) svec.getDataChildByName("processing-rule");
assertNotNull(processingRule);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "processing-rule");
+ expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
assertEquals(expectedQName, processingRule.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- leaf ignore
ignore = (LeafSchemaNode) svec.getDataChildByName("ignore");
assertNotNull(ignore);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "ignore");
+ expectedQName = QName.create(UG_NS, UG_REV, "ignore");
assertEquals(expectedQName, ignore.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- list metric
ListSchemaNode metric = (ListSchemaNode) svec.getDataChildByName("metric");
assertNotNull(metric);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "metric");
+ expectedQName = QName.create(UG_NS, UG_REV, "metric");
assertEquals(expectedQName, metric.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- |-- leaf metric-type
LeafSchemaNode metricType = (LeafSchemaNode) metric.getDataChildByName("metric-type");
assertNotNull(metricType);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "metric-type");
+ expectedQName = QName.create(UG_NS, UG_REV, "metric-type");
assertEquals(expectedQName, metricType.getQName());
path.offer(expectedQName);
expectedPath= SchemaPath.create(path, true);
// * |-- |-- |-- box
box = (ContainerSchemaNode) metric.getDataChildByName("box");
assertNotNull(box);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "box");
+ expectedQName = QName.create(UG_NS, UG_REV, "box");
assertEquals(expectedQName, box.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- |-- leaf processing-rule
processingRule = (LeafSchemaNode) metric.getDataChildByName("processing-rule");
assertNotNull(processingRule);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "processing-rule");
+ expectedQName = QName.create(UG_NS, UG_REV, "processing-rule");
assertEquals(expectedQName, processingRule.getQName());
path.pollLast();
path.offer(expectedQName);
// * |-- |-- |-- leaf ignore
ignore = (LeafSchemaNode) metric.getDataChildByName("ignore");
assertNotNull(ignore);
- expectedQName = new QName(UG_NS, UG_REV, UG_PREF, "ignore");
+ expectedQName = QName.create(UG_NS, UG_REV, "ignore");
assertEquals(expectedQName, ignore.getQName());
path.pollLast();
path.offer(expectedQName);
}
assertNotNull(intExt);
- List<QName> path = Lists.newArrayList(new QName(GD_NS, GD_REV, GD_PREF, "int-ext"));
+ List<QName> path = Lists.newArrayList(QName.create(GD_NS, GD_REV, "int-ext"));
SchemaPath expectedPath = SchemaPath.create(path, true);
assertEquals(expectedPath, intExt.getPath());
ContainerSchemaNode nodes = (ContainerSchemaNode) test.getDataChildByName("nodes");
// test SchemaNode args
- QName expectedQName = new QName(snNS, snRev, snPref, "nodes");
+ QName expectedQName = QName.create(snNS, snRev, "nodes");
assertEquals(expectedQName, nodes.getQName());
SchemaPath expectedPath = TestUtils.createPath(true, snNS, snRev, snPref, "nodes");
assertEquals(expectedPath, nodes.getPath());
Set<TypeDefinition<?>> typedefs = nodes.getTypeDefinitions();
assertEquals(1, typedefs.size());
TypeDefinition<?> nodesType = typedefs.iterator().next();
- QName typedefQName = new QName(snNS, snRev, snPref, "nodes-type");
+ QName typedefQName = QName.create(snNS, snRev, "nodes-type");
assertEquals(typedefQName, nodesType.getQName());
SchemaPath nodesTypePath = TestUtils.createPath(true, snNS, snRev, snPref, "nodes", "nodes-type");
assertEquals(nodesTypePath, nodesType.getPath());
Set<GroupingDefinition> groupings = nodes.getGroupings();
assertEquals(1, groupings.size());
GroupingDefinition nodeGroup = groupings.iterator().next();
- QName groupQName = new QName(snNS, snRev, snPref, "node-group");
+ QName groupQName = QName.create(snNS, snRev, "node-group");
assertEquals(groupQName, nodeGroup.getQName());
SchemaPath nodeGroupPath = TestUtils.createPath(true, snNS, snRev, snPref, "nodes", "node-group");
assertEquals(nodeGroupPath, nodeGroup.getPath());
List<QName> path = new ArrayList<>();
for (String name : names) {
- path.add(new QName(ns, rev, prefix, name));
+ path.add(QName.create(ns, rev, name));
}
return SchemaPath.create(path, true);
}
ListSchemaNode ifEntry = (ListSchemaNode) interfaces.getDataChildByName("ifEntry");
// test SchemaNode args
- QName expectedQName = new QName(expectedNamespace, barRev, expectedPrefix, "ifEntry");
+ QName expectedQName = QName.create(expectedNamespace, barRev, "ifEntry");
assertEquals(expectedQName, ifEntry.getQName());
SchemaPath expectedPath = TestUtils.createPath(true, expectedNamespace, barRev, expectedPrefix, "interfaces",
"ifEntry");
assertEquals(2, availableAugmentations.size());
// test ListSchemaNode args
List<QName> expectedKey = new ArrayList<>();
- expectedKey.add(new QName(expectedNamespace, barRev, expectedPrefix, "ifIndex"));
+ expectedKey.add(QName.create(expectedNamespace, barRev, "ifIndex"));
assertEquals(expectedKey, ifEntry.getKeyDefinition());
assertFalse(ifEntry.isUserOrdered());
// test DataNodeContainer args
assertEquals("system/user ref", dev.getReference());
List<QName> path = new ArrayList<>();
- path.add(new QName(barNS, barRev, "br", "interfaces"));
- path.add(new QName(barNS, barRev, "br", "ifEntry"));
+ path.add(QName.create(barNS, barRev, "interfaces"));
+ path.add(QName.create(barNS, barRev, "ifEntry"));
SchemaPath expectedPath = SchemaPath.create(path, true);
assertEquals(expectedPath, dev.getTargetPath());
NotificationDefinition notification = notifications.iterator().next();
// test SchemaNode args
- QName expectedQName = new QName(bazNS, bazRev, expectedPrefix, "event");
+ QName expectedQName = QName.create(bazNS, bazRev, "event");
assertEquals(expectedQName, notification.getQName());
SchemaPath expectedPath = TestUtils.createPath(true, bazNS, bazRev, expectedPrefix, "event");
assertEquals(expectedPath, notification.getPath());
// test grouping path
List<QName> path = new ArrayList<>();
- QName qname = new QName(URI.create("urn:opendaylight.baz"), simpleDateFormat.parse("2013-02-27"), "baz",
- "target");
+ QName qname = QName.create(URI.create("urn:opendaylight.baz"), simpleDateFormat.parse("2013-02-27"), "target");
path.add(qname);
SchemaPath expectedPath = SchemaPath.create(path, true);
assertEquals(expectedPath, usesNode.getGroupingPath());
DateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date expectedRev = simpleDateFormat.parse("2013-07-03");
List<QName> path = new ArrayList<>();
- path.add(new QName(expectedNS, expectedRev, "bar", "interfaces"));
- path.add(new QName(expectedNS, expectedRev, "bar", "ifEntry"));
+ path.add(QName.create(expectedNS, expectedRev, "interfaces"));
+ path.add(QName.create(expectedNS, expectedRev, "ifEntry"));
SchemaPath expectedPath = SchemaPath.create(path, true);
assertEquals(expectedPath, dev.getTargetPath());