2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.odlext.parser;
10 import static org.junit.jupiter.api.Assertions.assertTrue;
12 import org.junit.jupiter.api.Test;
13 import org.opendaylight.yangtools.odlext.model.api.MountEffectiveStatement;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.common.QNameModule;
16 import org.opendaylight.yangtools.yang.common.XMLNamespace;
17 import org.opendaylight.yangtools.yang.model.spi.source.YangTextSource;
18 import org.opendaylight.yangtools.yang.parser.api.YangParserConfiguration;
19 import org.opendaylight.yangtools.yang.parser.rfc7950.reactor.RFC7950Reactors;
20 import org.opendaylight.yangtools.yang.parser.rfc7950.repo.YangStatementStreamSource;
21 import org.opendaylight.yangtools.yang.parser.spi.meta.ModelProcessingPhase;
24 private static final QNameModule FOO = QNameModule.create(XMLNamespace.of("foo"));
27 void test() throws Exception {
28 final var reactor = RFC7950Reactors.vanillaReactorBuilder()
29 .addStatementSupport(ModelProcessingPhase.FULL_DECLARATION,
30 new MountStatementSupport(YangParserConfiguration.DEFAULT))
32 final var foo = reactor.newBuild()
33 .addSource(YangStatementStreamSource.create(YangTextSource.forResource(MountTest.class, "/yang-ext.yang")))
34 .addSource(YangStatementStreamSource.create(YangTextSource.forResource(MountTest.class, "/mount.yang")))
36 .getModuleStatements()
39 assertTrue(foo.findDataTreeNode(QName.create(FOO, "foo")).orElseThrow()
40 .findFirstEffectiveSubstatement(MountEffectiveStatement.class)
43 assertTrue(foo.findDataTreeNode(QName.create(FOO, "bar")).orElseThrow()
44 .findFirstEffectiveSubstatement(MountEffectiveStatement.class)