Adjust test suite parser update to conform with API changes
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / Bug5550Test.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 import static org.junit.Assert.assertTrue;
12
13 import org.junit.Test;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
16 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
17 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
19 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
20
21 public class Bug5550Test {
22     private static final String NS = "foo";
23     private static final String REV = "2016-03-18";
24
25     @Test
26     public void test() throws Exception {
27         SchemaContext context = StmtTestUtils.parseYangSources("/bugs/bug5550");
28         assertNotNull(context);
29
30         QName root = QName.create(NS, REV, "root");
31         QName containerInGrouping = QName.create(NS, REV, "container-in-grouping");
32         QName leaf1 = QName.create(NS, REV, "leaf-1");
33
34         SchemaNode findDataSchemaNode = SchemaContextUtil.findDataSchemaNode(context,
35                 SchemaPath.create(true, root, containerInGrouping, leaf1));
36         assertTrue(findDataSchemaNode instanceof LeafSchemaNode);
37     }
38 }