2 * Copyright (c) 2016 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.stmt;
10 import static org.junit.Assert.assertNotNull;
12 import org.junit.Test;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.common.QNameModule;
15 import org.opendaylight.yangtools.yang.common.Revision;
16 import org.opendaylight.yangtools.yang.common.XMLNamespace;
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;
22 public class Bug4231Test {
25 public void test() throws Exception {
26 SchemaContext context = TestUtils.parseYangSources("/bugs/bug4231");
28 assertNotNull(context);
30 QNameModule foo = QNameModule.create(XMLNamespace.of("foo"), Revision.of("2015-09-02"));
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"));
37 SchemaNode targetNode = SchemaContextUtil.findNodeInSchemaContext(
38 context, targetPath.getPathFromRoot());
39 assertNotNull(targetNode);