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;
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.SimpleDateFormatUtil;
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(new URI("foo"),
31 SimpleDateFormatUtil.getRevisionFormat().parse("2015-09-02"));
33 SchemaPath targetPath = SchemaPath
34 .create(true, QName.create(foo, "augment-target"))
35 .createChild(QName.create(foo, "my-container-in-grouping"))
36 .createChild(QName.create(foo, "l2"));
38 SchemaNode targetNode = SchemaContextUtil.findNodeInSchemaContext(
39 context, targetPath.getPathFromRoot());
40 assertNotNull(targetNode);