Merge branch 'master' of ../controller
[yangtools.git] / yang / yang-parser-rfc7950 / src / test / java / org / opendaylight / yangtools / yang / stmt / YT841Test.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.stmt;
9
10 import static org.junit.Assert.assertNotNull;
11
12 import java.net.URI;
13 import org.junit.Test;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.common.QNameModule;
16 import org.opendaylight.yangtools.yang.common.Revision;
17 import org.opendaylight.yangtools.yang.model.api.Module;
18 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
19 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
20 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
21 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
22
23 public class YT841Test {
24     private static final QNameModule FOO = QNameModule.create(URI.create("foo"), Revision.of("2018-01-02"));
25
26     @Test
27     public void testFindDataSchemaNode() throws Exception {
28         final SchemaContext context = StmtTestUtils.parseYangSources("/bugs/YT841/");
29         final Module foo = context.findModule(FOO).get();
30
31         final SchemaNode target = SchemaContextUtil.findDataSchemaNode(context, SchemaPath.create(true,
32             QName.create(FOO, "foo"),
33             QName.create(FOO, "foo"),
34             QName.create(FOO, "foo"),
35             QName.create(FOO, "input")));
36         assertNotNull(target);
37
38     }
39 }