import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.AnyXmlSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceNode;
-import org.opendaylight.yangtools.yang.model.api.ConstraintDefinition;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.GroupingDefinition;
-import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.MustDefinition;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.UsesNode;
+import org.opendaylight.yangtools.yang.model.api.*;
public class YangParserSimpleTest {
private final URI snNS = URI.create("urn:opendaylight:simple-nodes");
// child nodes
// total size = 8: defined 6, inserted by uses 2
assertEquals(8, nodes.getChildNodes().size());
- AnyXmlSchemaNode text = (AnyXmlSchemaNode)nodes.getDataChildByName("text");
- assertNotNull(text);
- ChoiceNode level = (ChoiceNode)nodes.getDataChildByName("level");
- assertNotNull(level);
- ContainerSchemaNode node = (ContainerSchemaNode)nodes.getDataChildByName("node");
- assertNotNull(node);
- LeafSchemaNode nodesId = (LeafSchemaNode)nodes.getDataChildByName("nodes-id");
- assertNotNull(nodesId);
LeafListSchemaNode added = (LeafListSchemaNode)nodes.getDataChildByName("added");
- assertNotNull(added);
assertEquals(createPath("nodes", "added"), added.getPath());
- assertEquals(createPath("nodes", "added", "mytype"), added.getType().getPath());
+ assertEquals(createPath("mytype"), added.getType().getPath());
ListSchemaNode links = (ListSchemaNode) nodes.getDataChildByName("links");
- assertNotNull(links);
assertFalse(links.isUserOrdered());
- LeafSchemaNode source = (LeafSchemaNode)nodes.getDataChildByName("source");
- assertNotNull(source);
- LeafSchemaNode target = (LeafSchemaNode)nodes.getDataChildByName("target");
- assertNotNull(target);
Set<GroupingDefinition> groupings = nodes.getGroupings();
assertEquals(1, groupings.size());
private SchemaPath createPath(String... names) {
try {
- rev = TestUtils.simpleDateFormat.parse("2013-07-30");
+ rev = new SimpleDateFormat("yyyy-MM-dd").parse("2013-07-30");
} catch (ParseException e) {
e.printStackTrace();
}