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;
11 import static org.junit.Assert.assertTrue;
13 import java.io.FileNotFoundException;
14 import java.net.URISyntaxException;
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.common.QName;
17 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
19 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
20 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
21 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
22 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
23 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
25 public class Bug5550 {
26 private static final String NS = "foo";
27 private static final String REV = "2016-03-18";
30 public void test() throws SourceException, FileNotFoundException, ReactorException, URISyntaxException {
31 SchemaContext context = StmtTestUtils.parseYangSources("/bugs/bug5550");
32 assertNotNull(context);
34 QName root = QName.create(NS, REV, "root");
35 QName containerInGrouping = QName.create(NS, REV, "container-in-grouping");
36 QName leaf1 = QName.create(NS, REV, "leaf-1");
38 SchemaNode findDataSchemaNode = SchemaContextUtil.findDataSchemaNode(context,
39 SchemaPath.create(true, root, containerInGrouping, leaf1));
40 assertTrue(findDataSchemaNode instanceof LeafSchemaNode);