2 * Copyright (c) 2015 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.parser.impl;
10 import static org.junit.Assert.*;
12 import java.text.ParseException;
15 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
16 import org.opendaylight.yangtools.yang.common.SimpleDateFormatUtil;
17 import org.opendaylight.yangtools.yang.common.QNameModule;
18 import org.opendaylight.yangtools.yang.common.QName;
19 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
20 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
21 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
22 import java.io.IOException;
23 import java.net.URISyntaxException;
24 import org.junit.Test;
26 public class Bug4231Test {
29 public void test() throws IOException, URISyntaxException, ParseException {
30 SchemaContext context = TestUtils.loadSchemaContext(getClass()
31 .getResource("/bugs/bug4231").toURI());
33 assertNotNull(context);
35 QNameModule foo = QNameModule.create(new URI("foo"),
36 SimpleDateFormatUtil.getRevisionFormat().parse("2015-09-02"));
38 SchemaPath targetPath = SchemaPath
39 .create(true, QName.create(foo, "augment-target"))
40 .createChild(QName.create(foo, "my-container-in-grouping"))
41 .createChild(QName.create(foo, "l2"));
43 SchemaNode targetNode = SchemaContextUtil.findNodeInSchemaContext(
44 context, targetPath.getPathFromRoot());
45 assertNotNull(targetNode);