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 java.io.IOException;
14 import java.net.URISyntaxException;
15 import java.text.ParseException;
16 import org.junit.Test;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.common.QNameModule;
19 import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
20 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
21 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
22 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
23 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
24 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
26 public class Bug4231Test {
29 public void test() throws IOException, URISyntaxException, ParseException, ReactorException {
30 SchemaContext context = TestUtils.parseYangSources("/bugs/bug4231");
32 assertNotNull(context);
34 QNameModule foo = QNameModule.create(new URI("foo"),
35 SimpleDateFormatUtil.getRevisionFormat().parse("2015-09-02"));
37 SchemaPath targetPath = SchemaPath
38 .create(true, QName.create(foo, "augment-target"))
39 .createChild(QName.create(foo, "my-container-in-grouping"))
40 .createChild(QName.create(foo, "l2"));
42 SchemaNode targetNode = SchemaContextUtil.findNodeInSchemaContext(
43 context, targetPath.getPathFromRoot());
44 assertNotNull(targetNode);