Java Code Examples for org.opendaylight.yangtools.yang.common.QNameModule#create()

The following examples show how to use org.opendaylight.yangtools.yang.common.QNameModule#create() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MoreRevisionsTest.java    From yangtools with Eclipse Public License 1.0 6 votes vote down vote up
private static void checkNetconfMonitoringModuleSimpleTest(final SchemaContext context,
        final Revision rev20130715, final QName dateTimeTypeDef20130715) {
    URI monitoringNS = URI.create("urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring");
    final QNameModule monitoring19700101 = QNameModule.create(monitoringNS);
    QName lockedTime = QName.create(monitoring19700101, "locked-time");

    Module monitoringModule19700101 = context.findModule("ietf-netconf-monitoring").get();
    DataSchemaNode leafLockedTime = monitoringModule19700101.getDataChildByName(lockedTime);
    assertNotNull(leafLockedTime);

    assertTrue(leafLockedTime instanceof LeafSchemaNode);
    QName lockedTimeTypeQName = ((LeafSchemaNode) leafLockedTime).getType().getQName();
    assertEquals(dateTimeTypeDef20130715, lockedTimeTypeQName);

    Collection<? extends ModuleImport> imports = monitoringModule19700101.getImports();
    assertEquals(1, imports.size());
    ModuleImport monitoringImport = imports.iterator().next();
    assertEquals("ietf-yang-types", monitoringImport.getModuleName());
    assertEquals(Optional.of(rev20130715), monitoringImport.getRevision());
}
 
Example 2
Source File: MoreRevisionsTest.java    From yangtools with Eclipse Public License 1.0 6 votes vote down vote up
private static void checkContentSimpleTest(final SchemaContext context) {
    URI yangTypesNS = URI.create("urn:ietf:params:xml:ns:yang:ietf-yang-types");

    final Revision rev20100924 = Revision.of("2010-09-24");
    final Revision rev20130516 = Revision.of("2013-05-16");
    final Revision rev20130715 = Revision.of("2013-07-15");

    final QNameModule yangTypes20100924 = QNameModule.create(yangTypesNS, rev20100924);
    final QNameModule yangTypes20130516 = QNameModule.create(yangTypesNS, rev20130516);
    final QNameModule yangTypes20130715 = QNameModule.create(yangTypesNS, rev20130715);

    final QName dateTimeTypeDef20100924 = QName.create(yangTypes20100924, "date-and-time");
    final QName dateTimeTypeDef20130516 = QName.create(yangTypes20130516, "date-and-time");
    final QName dateTimeTypeDef20130715 = QName.create(yangTypes20130715, "date-and-time");

    Module yangTypesModule20100924 = context.findModule("ietf-yang-types", rev20100924).get();
    Module yangTypesModule20130516 = context.findModule("ietf-yang-types", rev20130516).get();
    Module yangTypesModule20130715 = context.findModule("ietf-yang-types", rev20130715).get();
    assertTrue(findTypeDef(yangTypesModule20100924, dateTimeTypeDef20100924));
    assertTrue(findTypeDef(yangTypesModule20130516, dateTimeTypeDef20130516));
    assertTrue(findTypeDef(yangTypesModule20130715, dateTimeTypeDef20130715));

    checkNetconfMonitoringModuleSimpleTest(context, rev20130715, dateTimeTypeDef20130715);
    checkInterfacesModuleSimpleTest(context, rev20100924, dateTimeTypeDef20100924);
}
 
Example 3
Source File: Bug4231Test.java    From yangtools with Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void test() throws Exception {
    SchemaContext context = TestUtils.parseYangSources("/bugs/bug4231");

    assertNotNull(context);

    QNameModule foo = QNameModule.create(new URI("foo"), Revision.of("2015-09-02"));

    SchemaPath targetPath = SchemaPath
            .create(true, QName.create(foo, "augment-target"))
            .createChild(QName.create(foo, "my-container-in-grouping"))
            .createChild(QName.create(foo, "l2"));

    SchemaNode targetNode = SchemaContextUtil.findNodeInSchemaContext(
            context, targetPath.getPathFromRoot());
    assertNotNull(targetNode);
}
 
Example 4
Source File: MoreRevisionsTest.java    From yangtools with Eclipse Public License 1.0 6 votes vote down vote up
private static void checkContentFullTest(final SchemaContext context) {
    URI yangTypesNS = URI.create("urn:ietf:params:xml:ns:yang:ietf-yang-types");

    final Revision rev20100924 = Revision.of("2010-09-24");
    final Revision rev20130516 = Revision.of("2013-05-16");
    final Revision rev20130715 = Revision.of("2013-07-15");

    final QNameModule yangTypes20100924 = QNameModule.create(yangTypesNS, rev20100924);
    final QNameModule yangTypes20130516 = QNameModule.create(yangTypesNS, rev20130516);
    final QNameModule yangTypes20130715 = QNameModule.create(yangTypesNS, rev20130715);

    final QName dateTimeTypeDef20100924 = QName.create(yangTypes20100924, "date-and-time");
    final QName dateTimeTypeDef20130516 = QName.create(yangTypes20130516, "date-and-time");
    final QName dateTimeTypeDef20130715 = QName.create(yangTypes20130715, "date-and-time");

    Module yangTypesModule20100924 = context.findModule("ietf-yang-types", rev20100924).get();
    Module yangTypesModule20130516 = context.findModule("ietf-yang-types", rev20130516).get();
    Module yangTypesModule20130715 = context.findModule("ietf-yang-types", rev20130715).get();
    assertTrue(findTypeDef(yangTypesModule20100924, dateTimeTypeDef20100924));
    assertTrue(findTypeDef(yangTypesModule20130516, dateTimeTypeDef20130516));
    assertTrue(findTypeDef(yangTypesModule20130715, dateTimeTypeDef20130715));

    checkNetconfMonitoringModuleFullTest(context, rev20130715, dateTimeTypeDef20130715);
    checkInterfacesModuleFullTest(context, rev20100924, dateTimeTypeDef20100924);
}
 
Example 5
Source File: Bug2872Test.java    From yangtools with Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void test() throws Exception {
    final SchemaContext schema = StmtTestUtils.parseYangSources("/bugs/bug2872");
    assertNotNull(schema);

    final QNameModule bug2872module = QNameModule.create(URI.create("bug2872"), Revision.of("2016-06-08"));
    final QName foo = QName.create(bug2872module, "bar");

    final DataSchemaNode dataSchemaNode = schema.getDataChildByName(foo);
    assertTrue(dataSchemaNode instanceof LeafSchemaNode);
    final LeafSchemaNode myLeaf = (LeafSchemaNode) dataSchemaNode;

    final TypeDefinition<?> type = myLeaf.getType();
    assertTrue(type instanceof EnumTypeDefinition);
    final EnumTypeDefinition myEnum = (EnumTypeDefinition) type;

    final List<EnumTypeDefinition.EnumPair> values = myEnum.getValues();
    assertEquals(2, values.size());

    final List<String> valueNames = new ArrayList<>();
    for (EnumTypeDefinition.EnumPair pair : values) {
        valueNames.add(pair.getName());
    }
    assertTrue(valueNames.contains("value-one"));
    assertTrue(valueNames.contains("value-two"));
}
 
Example 6
Source File: YangModeledAnyXMLDeserializationTest.java    From yangtools with Eclipse Public License 1.0 6 votes vote down vote up
@Before
public void setUp() {
    barModuleQName = QNameModule.create(URI.create("bar"));
    myContainer1 = QName.create(barModuleQName, "my-container-1");
    myLeaf1 = QName.create(barModuleQName, "my-leaf-1");
    myAnyXMLDataBar = QName.create(barModuleQName, "my-anyxml-data");

    fooModuleQName = QNameModule.create(URI.create("foo"));
    myContainer2 = QName.create(fooModuleQName, "my-container-2");
    innerContainer = QName.create(fooModuleQName, "inner-container");
    myLeaf3 = QName.create(fooModuleQName, "my-leaf-3");
    myLeaf2 = QName.create(fooModuleQName, "my-leaf-2");
    myAnyXMLDataFoo = QName.create(fooModuleQName, "my-anyxml-data");

    schemaContext = YangParserTestUtils.parseYangResourceDirectory("/anyxml-support/yang");
}
 
Example 7
Source File: JaxenTest.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
private void initQNames() {
    this.moduleQName = QNameModule.create(URI.create("urn:opendaylight.test2"), Revision.of("2015-08-08"));
    this.rootQName = QName.create(moduleQName, "root");
    this.listAQName = QName.create(moduleQName, "list-a");
    this.listBQName = QName.create(moduleQName, "list-b");
    this.leafAQName = QName.create(moduleQName, "leaf-a");
    this.leafBQName = QName.create(moduleQName, "leaf-b");
    this.leafDQName = QName.create(moduleQName, "leaf-d");
    this.containerAQName = QName.create(moduleQName, "container-a");
    this.containerBQName = QName.create(moduleQName, "container-b");
}
 
Example 8
Source File: Bug4610Test.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void test() throws Exception {
    SchemaContext context = StmtTestUtils.parseYangSources("/bugs/bug4610");

    Revision revision = Revision.of("2015-12-12");
    QNameModule foo = QNameModule.create(URI.create("foo"), revision);
    QNameModule bar = QNameModule.create(URI.create("bar"), revision);

    QName g1 = QName.create(bar, "g1");
    QName g2 = QName.create(bar, "g2");
    QName c1Bar = QName.create(bar, "c1");

    QName c1Foo = QName.create(foo, "c1");
    QName g3 = QName.create(foo, "g3");
    QName root = QName.create(foo, "root");

    ContainerEffectiveStatement effectiveContainerStatementG1 = findContainer(context, g1, c1Bar);
    ContainerEffectiveStatement effectiveContainerStatementG2 = findContainer(context, g2, c1Bar);
    ContainerEffectiveStatement effectiveContainerStatementG3 = findContainer(context, g3, c1Foo);
    ContainerEffectiveStatement effectiveContainerStatementRoot = findContainer(context, root, c1Foo);

    // check arguments
    QName originalStatementArgument = effectiveContainerStatementG1.argument();
    assertTrue(originalStatementArgument.equals(effectiveContainerStatementG2.argument()));
    assertFalse(originalStatementArgument.equals(effectiveContainerStatementG3.argument()));
    assertFalse(originalStatementArgument.equals(effectiveContainerStatementRoot.argument()));

    ContainerStatement originalContainerStatement = effectiveContainerStatementG1.getDeclared();
    ContainerStatement inGrouping2ContainerStatement = effectiveContainerStatementG2.getDeclared();
    ContainerStatement inGrouping3ContainerStatement = effectiveContainerStatementG3.getDeclared();
    ContainerStatement inRootContainerStatement = effectiveContainerStatementRoot.getDeclared();

    // check declared instances
    assertTrue(originalContainerStatement == inGrouping2ContainerStatement);
    assertTrue(originalContainerStatement == inGrouping3ContainerStatement);
    assertTrue(originalContainerStatement == inRootContainerStatement);

}
 
Example 9
Source File: XmlStreamUtilsTest.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
private static QName getAttrQName(final String namespace, final String revision, final String localName,
        final Optional<String> prefix) {
    if (prefix.isPresent()) {
        final QName moduleQName = QName.create(namespace, revision, "module");
        final QNameModule module = QNameModule.create(moduleQName.getNamespace(), moduleQName.getRevision());
        return QName.create(module, localName);
    }
    return QName.create(namespace, revision, localName);
}
 
Example 10
Source File: YT1108Test.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void setup() {
    fooModule = QNameModule.create(URI.create("foo-namespace"));
    fooLeafContainer = QName.create(fooModule, "leaf-container");

    fooIdentity = QName.create(fooModule, "ident-one");
    fooUnionIdentityRefLeaf = QName.create(fooModule, "union-identityref-leaf");
    fooIdentityRefLeaf = QName.create(fooModule, "identityref-leaf");
}
 
Example 11
Source File: SchemalessXMLStreamNormalizedNodeStreamWriterTest.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void setup() {
    foobarModule = QNameModule.create(URI.create("foobar-namespace"), Revision.of("2016-09-19"));

    outerContainer = QName.create(foobarModule, "outer-container");

    myContainer1 = QName.create(foobarModule, "my-container-1");
    myKeyedList = QName.create(foobarModule, "my-keyed-list");
    myKeyLeaf = QName.create(foobarModule, "my-key-leaf");
    myLeafInList1 = QName.create(foobarModule, "my-leaf-in-list-1");
    myLeafInList2 = QName.create(foobarModule, "my-leaf-in-list-2");
    myOrderedList = QName.create(foobarModule, "my-ordered-list");
    myKeyLeafInOrderedList = QName.create(foobarModule, "my-key-leaf-in-ordered-list");
    myLeafInOrderedList1 = QName.create(foobarModule, "my-leaf-in-ordered-list-1");
    myLeafInOrderedList2 = QName.create(foobarModule, "my-leaf-in-ordered-list-2");
    myUnkeyedList = QName.create(foobarModule, "my-unkeyed-list");
    myLeafInUnkeyedList = QName.create(foobarModule, "my-leaf-in-unkeyed-list");
    myLeaf1 = QName.create(foobarModule, "my-leaf-1");
    myLeafList = QName.create(foobarModule, "my-leaf-list");
    myOrderedLeafList = QName.create(foobarModule, "my-ordered-leaf-list");

    myContainer2 = QName.create(foobarModule, "my-container-2");
    innerContainer = QName.create(foobarModule, "inner-container");
    myLeaf2 = QName.create(foobarModule, "my-leaf-2");
    myLeaf3 = QName.create(foobarModule, "my-leaf-3");
    myChoice = QName.create(foobarModule, "my-choice");
    myLeafInCase2 = QName.create(foobarModule, "my-leaf-in-case-2");
    myAnyxml = QName.create(foobarModule, "my-anyxml");

    myContainer3 = QName.create(foobarModule, "my-container-3");
    myDoublyKeyedList = QName.create(foobarModule, "my-doubly-keyed-list");
    myFirstKeyLeaf = QName.create(foobarModule, "my-first-key-leaf");
    mySecondKeyLeaf = QName.create(foobarModule, "my-second-key-leaf");
    myLeafInList3 = QName.create(foobarModule, "my-leaf-in-list-3");

    anyxmlDomSource = new DOMSource();
}
 
Example 12
Source File: CaseStmtTest.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void setup() throws Exception {
    schema = StmtTestUtils.parseYangSources("/case-test");
    Revision rev = Revision.of("2015-09-09");
    rootFoo = schema.findModule("foo", rev).get();
    rootBar = schema.findModule("bar", rev).get();
    assertNotNull(rootFoo);
    assertNotNull(rootBar);
    qnameFoo = QNameModule.create(URI.create("foo"), rev);
    qnameBar = QNameModule.create(URI.create("bar"), rev);
    assertNotNull(qnameFoo);
    assertNotNull(qnameBar);
}
 
Example 13
Source File: NormalizedNodesToXmlTest.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void setup() {
    bazModule = QNameModule.create(URI.create("baz-namespace"));

    outerContainer = QName.create(bazModule, "outer-container");

    myContainer1 = QName.create(bazModule, "my-container-1");
    myKeyedList = QName.create(bazModule, "my-keyed-list");
    myKeyLeaf = QName.create(bazModule, "my-key-leaf");
    myLeafInList1 = QName.create(bazModule, "my-leaf-in-list-1");
    myLeafInList2 = QName.create(bazModule, "my-leaf-in-list-2");
    myLeaf1 = QName.create(bazModule, "my-leaf-1");
    myLeafList = QName.create(bazModule, "my-leaf-list");

    myContainer2 = QName.create(bazModule, "my-container-2");
    innerContainer = QName.create(bazModule, "inner-container");
    myLeaf2 = QName.create(bazModule, "my-leaf-2");
    myLeaf3 = QName.create(bazModule, "my-leaf-3");
    myChoice = QName.create(bazModule, "my-choice");
    myLeafInCase2 = QName.create(bazModule, "my-leaf-in-case-2");

    myContainer3 = QName.create(bazModule, "my-container-3");
    myDoublyKeyedList = QName.create(bazModule, "my-doubly-keyed-list");
    myFirstKeyLeaf = QName.create(bazModule, "my-first-key-leaf");
    mySecondKeyLeaf = QName.create(bazModule, "my-second-key-leaf");
    myLeafInList3 = QName.create(bazModule, "my-leaf-in-list-3");
}
 
Example 14
Source File: OrderedListTest.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void setup() {
    testModule = QNameModule.create(URI.create("ordered-list-modification-test"));
    parentContainer = QName.create(testModule, "parent-container");
    childContainer = QName.create(testModule, "child-container");
    parentOrderedList = QName.create(testModule, "parent-ordered-list");
    childOrderedList = QName.create(testModule, "child-ordered-list");
    parentKeyLeaf = QName.create(testModule, "parent-key-leaf");
    childKeyLeaf = QName.create(testModule, "child-key-leaf");
    parentOrdinaryLeaf = QName.create(testModule, "parent-ordinary-leaf");
    childOrdinaryLeaf = QName.create(testModule, "child-ordinary-leaf");
    inMemoryDataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_OPERATIONAL,
        YangParserTestUtils.parseYangResource("/ordered-list-modification-test.yang"));
}
 
Example 15
Source File: Bug4295Test.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void init() {
    foo = QNameModule.create(URI.create("foo"));
    root = QName.create(foo, "root");
    subRoot = QName.create(foo, "sub-root");
    outerList = QName.create(foo, "outer-list");
    innerList = QName.create(foo, "inner-list");
    oid = QName.create(foo, "o-id");
    iid = QName.create(foo, "i-id");
    oleaf = QName.create(foo, "o");
    ileaf = QName.create(foo, "i");
    inMemoryDataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_OPERATIONAL,
        YangParserTestUtils.parseYangResource("/bug-4295/foo.yang"));
}
 
Example 16
Source File: StringPatternCheckingCodecTest.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void testStringPatternCheckingCodec() {
    final SchemaContext schemaContext = YangParserTestUtils.parseYangResource(
        "/string-pattern-checking-codec-test.yang");
    assertNotNull(schemaContext);

    final QNameModule testModuleQName = QNameModule.create(URI.create("string-pattern-checking-codec-test"));

    final Module testModule = schemaContext.findModules("string-pattern-checking-codec-test").iterator().next();
    final ContainerSchemaNode testContainer = (ContainerSchemaNode) testModule.findDataChildByName(
            QName.create(testModuleQName, "test-container")).get();

    final LeafSchemaNode testLeaf = (LeafSchemaNode) testContainer.findDataChildByName(
            QName.create(testModuleQName, "string-leaf-with-valid-pattern")).get();

    final StringCodec<String> codec = getCodec(testLeaf.getType(), StringCodec.class);
    assertNotNull(codec);
    assertEquals("ABCD", codec.serialize("ABCD"));
    assertEquals("ABCD", codec.deserialize("ABCD"));

    try {
        codec.deserialize("abcd");
        fail("Exception should have been thrown.");
    } catch (final IllegalArgumentException ex) {
        LOG.debug("IllegalArgumentException was thrown as expected", ex);
        assertEquals("Value 'abcd' does not match regular expression '[A-Z]+'", ex.getMessage());
    }
}
 
Example 17
Source File: NormalizedNodeWriterTest.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void setUp() {
    bazModule = QNameModule.create(URI.create("baz-namespace"), Revision.of("1970-01-01"));
    myKeyedList = QName.create(bazModule, "my-keyed-list");
    myKeyLeaf = QName.create(bazModule, "my-key-leaf");
    myLeafList = QName.create(bazModule, "my-leaf-list");
}
 
Example 18
Source File: Bug3874ExtensionTest.java    From yangtools with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void test() throws Exception {
    SchemaContext context = reactor.newBuild()
            .addSource(YangStatementStreamSource.create(YangTextSchemaSource.forResource("/bugs/bug3874/foo.yang")))
            .addSource(YangStatementStreamSource.create(
                YangTextSchemaSource.forResource("/bugs/bug3874/yang-ext.yang")))
            .buildEffective();

    QNameModule foo = QNameModule.create(URI.create("foo"));
    QName myContainer2QName = QName.create(foo, "my-container-2");
    QName myAnyXmlDataQName = QName.create(foo, "my-anyxml-data");

    DataSchemaNode dataChildByName = context.findDataChildByName(myAnyXmlDataQName).get();
    assertTrue(dataChildByName instanceof YangModeledAnyxmlSchemaNode);
    YangModeledAnyxmlSchemaNode yangModeledAnyXml = (YangModeledAnyxmlSchemaNode) dataChildByName;

    SchemaNode myContainer2 = SchemaContextUtil.findDataSchemaNode(context,
        SchemaPath.create(true, myContainer2QName));
    assertTrue(myContainer2 instanceof ContainerSchemaNode);
    assertEquals(myContainer2, yangModeledAnyXml.getSchemaOfAnyXmlData());

    Collection<? extends UnknownSchemaNode> unknownSchemaNodes = yangModeledAnyXml.getUnknownSchemaNodes();
    assertEquals(1, unknownSchemaNodes.size());

    UnknownSchemaNode next = unknownSchemaNodes.iterator().next();
    assertTrue(next instanceof AnyxmlSchemaLocationEffectiveStatementImpl);
    AnyxmlSchemaLocationEffectiveStatementImpl anyxmlSchemaLocationUnknownNode =
            (AnyxmlSchemaLocationEffectiveStatementImpl) next;
    assertEquals(OpenDaylightExtensionsStatements.ANYXML_SCHEMA_LOCATION.getStatementName(),
        anyxmlSchemaLocationUnknownNode.getNodeType());
    assertEquals(OpenDaylightExtensionsStatements.ANYXML_SCHEMA_LOCATION.getStatementName(),
        anyxmlSchemaLocationUnknownNode.getQName());
}
 
Example 19
Source File: QNameFactory.java    From yangtools with Eclipse Public License 1.0 4 votes vote down vote up
QNameModule toQNameModule() {
    return QNameModule.create(URI.create(namespace), Revision.ofNullable(revision));
}
 
Example 20
Source File: EffectiveModuleTest.java    From yangtools with Eclipse Public License 1.0 4 votes vote down vote up
@Test
public void effectiveBuildTest() throws SourceException, ReactorException {
    SchemaContext result = RFC7950Reactors.defaultReactor().newBuild()
            .addSources(ROOT_MODULE, IMPORTED_MODULE, SUBMODULE)
            .buildEffective();

    assertNotNull(result);

    Module rootModule = result.findModules("root").iterator().next();
    assertNotNull(rootModule);

    assertEquals("root-pref", rootModule.getPrefix());
    assertEquals(YangVersion.VERSION_1, rootModule.getYangVersion());
    assertEquals(Optional.of("cisco"), rootModule.getOrganization());
    assertEquals(Optional.of("cisco email"), rootModule.getContact());

    final ContainerSchemaNode contSchemaNode = (ContainerSchemaNode) rootModule.getDataChildByName(CONT);
    assertNotNull(contSchemaNode);

    final Collection<? extends AugmentationSchemaNode> augmentations = rootModule.getAugmentations();
    assertEquals(1, augmentations.size());
    assertEquals(Absolute.of(CONT), augmentations.iterator().next().getTargetPath());

    final Collection<? extends ModuleImport> imports = rootModule.getImports();
    assertEquals(1, imports.size());
    final ModuleImport importStmt = imports.iterator().next();
    assertNotNull(importStmt);
    assertEquals("imported", importStmt.getModuleName());
    assertEquals(Optional.of(REVISION), importStmt.getRevision());
    assertEquals("imp-pref", importStmt.getPrefix());

    final Collection<? extends Module> submodules = rootModule.getSubmodules();
    assertEquals(1, submodules.size());
    assertEquals("submod", submodules.iterator().next().getName());

    final Collection<? extends NotificationDefinition> notifications = rootModule.getNotifications();
    assertEquals(1, notifications.size());
    assertEquals("notif1", notifications.iterator().next().getQName().getLocalName());

    final Collection<? extends RpcDefinition> rpcs = rootModule.getRpcs();
    assertEquals(1, rpcs.size());
    assertEquals("rpc1", rpcs.iterator().next().getQName().getLocalName());

    final Collection<? extends Deviation> deviations = rootModule.getDeviations();
    assertEquals(1, deviations.size());
    final Deviation deviationStmt = deviations.iterator().next();
    assertNotNull(deviationStmt);
    final QNameModule importedModuleQName = QNameModule.create(URI.create("imported"), REVISION);
    final QName importedContQName = QName.create(importedModuleQName, "cont");
    assertEquals(Absolute.of(importedContQName), deviationStmt.getTargetPath());
    assertEquals(DeviateKind.ADD, deviationStmt.getDeviates().iterator().next().getDeviateType());
    assertEquals(Optional.of("deviate reference"), deviationStmt.getReference());

    final Collection<? extends IdentitySchemaNode> identities = rootModule.getIdentities();
    assertEquals(1, identities.size());
    assertEquals("identity1", identities.iterator().next().getQName().getLocalName());

    final Collection<? extends FeatureDefinition> features = rootModule.getFeatures();
    assertEquals(1, features.size());
    final FeatureDefinition featureStmt = features.iterator().next();
    assertNotNull(featureStmt);
    assertEquals(FEATURE1, featureStmt.getQName());
    assertEquals(FEATURE1_SCHEMA_PATH, featureStmt.getPath());
    assertEquals(Optional.of("feature1 description"), featureStmt.getDescription());
    assertEquals(Optional.of("feature1 reference"), featureStmt.getReference());
    assertEquals(Status.CURRENT, featureStmt.getStatus());

    final Collection<? extends ExtensionDefinition> extensionSchemaNodes = rootModule.getExtensionSchemaNodes();
    assertEquals(1, extensionSchemaNodes.size());
    assertEquals("ext1", extensionSchemaNodes.iterator().next().getQName().getLocalName());
}