Adjust test suite parser update to conform with API changes
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / Bug4231Test.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. 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.SchemaContext;
18 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
19 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
20 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
21
22 public class Bug4231Test {
23
24     @Test
25     public void test() throws Exception {
26         SchemaContext context = TestUtils.parseYangSources("/bugs/bug4231");
27
28         assertNotNull(context);
29
30         QNameModule foo = QNameModule.create(new URI("foo"), Revision.of("2015-09-02"));
31
32         SchemaPath targetPath = SchemaPath
33                 .create(true, QName.create(foo, "augment-target"))
34                 .createChild(QName.create(foo, "my-container-in-grouping"))
35                 .createChild(QName.create(foo, "l2"));
36
37         SchemaNode targetNode = SchemaContextUtil.findNodeInSchemaContext(
38                 context, targetPath.getPathFromRoot());
39         assertNotNull(targetNode);
40     }
41
42 }