Use QName.parseRevision() instead of SimpleDateFormatUtil
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / Bug4231Test.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.yangtools.yang.stmt;
9
10 import static org.junit.Assert.assertNotNull;
11
12 import java.net.URI;
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.model.api.SchemaContext;
17 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
18 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
19 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
20
21 public class Bug4231Test {
22
23     @Test
24     public void test() throws Exception {
25         SchemaContext context = TestUtils.parseYangSources("/bugs/bug4231");
26
27         assertNotNull(context);
28
29         QNameModule foo = QNameModule.create(new URI("foo"), QName.parseRevision("2015-09-02"));
30
31         SchemaPath targetPath = SchemaPath
32                 .create(true, QName.create(foo, "augment-target"))
33                 .createChild(QName.create(foo, "my-container-in-grouping"))
34                 .createChild(QName.create(foo, "l2"));
35
36         SchemaNode targetNode = SchemaContextUtil.findNodeInSchemaContext(
37                 context, targetPath.getPathFromRoot());
38         assertNotNull(targetNode);
39     }
40
41 }