2 * Copyright (c) 2017 Cisco Systems, Inc. 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.yang.parser.stmt.rfc7950;
10 import static org.hamcrest.CoreMatchers.instanceOf;
11 import static org.hamcrest.MatcherAssert.assertThat;
13 import org.junit.Test;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
17 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
18 import org.opendaylight.yangtools.yang.stmt.StmtTestUtils;
20 public class Bug6884Test {
22 public void testYang11() throws Exception {
23 final EffectiveModelContext schemaContext = StmtTestUtils.parseYangSources("/rfc7950/bug6884/yang1-1");
24 final DataSchemaNode node = schemaContext.findDataTreeChild(foo("sub-root"), foo("sub-foo-2-con")).orElse(null);
25 assertThat(node, instanceOf(ContainerSchemaNode.class));
29 public void testCircularIncludesYang10() throws Exception {
30 final EffectiveModelContext schemaContext =
31 StmtTestUtils.parseYangSources("/rfc7950/bug6884/circular-includes");
32 DataSchemaNode node = schemaContext.findDataTreeChild(foo("sub-root"), foo("sub-foo-2-con")).orElse(null);
33 assertThat(node, instanceOf(ContainerSchemaNode.class));
35 node = schemaContext.findDataTreeChild(foo("sub-root-2"), foo("sub-foo-con")).orElse(null);
36 assertThat(node, instanceOf(ContainerSchemaNode.class));
39 private static QName foo(final String localName) {
40 return QName.create("foo", localName);