fdb0467cb73d74f1905b6d1ff8802ffbb8bc6ddd
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / yin / YinFileMetaStmtsTest.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.yin;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertNotNull;
12
13 import java.io.IOException;
14 import java.net.URISyntaxException;
15 import java.util.Optional;
16 import org.junit.Before;
17 import org.junit.Test;
18 import org.opendaylight.yangtools.yang.model.api.Module;
19 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
20 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
21 import org.opendaylight.yangtools.yang.stmt.TestUtils;
22 import org.xml.sax.SAXException;
23
24 public class YinFileMetaStmtsTest {
25
26     private SchemaContext context;
27
28     @Before
29     public void init() throws URISyntaxException, ReactorException, SAXException, IOException {
30         context = TestUtils.loadYinModules(getClass().getResource("/semantic-statement-parser/yin/modules").toURI());
31         assertEquals(9, context.getModules().size());
32     }
33
34     @Test
35     public void testMetaStatements() throws URISyntaxException {
36         Module testModule = TestUtils.findModule(context, "ietf-netconf-monitoring").get();
37         assertNotNull(testModule);
38
39         assertEquals(Optional.of("IETF NETCONF (Network Configuration) Working Group"), testModule.getOrganization());
40         assertEquals(Optional.of("WG Web:   <http://tools.ietf.org/wg/netconf/>\n"
41                 + "WG List:  <mailto:netconf@ietf.org>\n"
42                 + "\n"
43                 + "WG Chair: Mehmet Ersue\n"
44                 + "        <mailto:mehmet.ersue@nsn.com>\n"
45                 + "\n"
46                 + "WG Chair: Bert Wijnen\n"
47                 + "        <mailto:bertietf@bwijnen.net>\n"
48                 + "\n"
49                 + "Editor:   Mark Scott\n"
50                 + "        <mailto:mark.scott@ericsson.com>\n"
51                 + "\n"
52                 + "Editor:   Martin Bjorklund\n"
53                 + "        <mailto:mbj@tail-f.com>"), testModule.getContact());
54         assertEquals(Optional.of("NETCONF Monitoring Module.\n" + "All elements in this module are read-only.\n" + "\n"
55                 + "Copyright (c) 2010 IETF Trust and the persons identified as\n" + "authors of the code. All rights "
56                 + "reserved.\n" + "\n" + "Redistribution and use in source and binary forms, with or\n" +  "without "
57                 + "modification, is permitted pursuant to, and subject\n" + "to the license terms contained in, the "
58                 + "Simplified BSD\n" + "License set forth in Section 4.c of the IETF Trust's\n" + "Legal Provisions "
59                 + "Relating to IETF Documents\n" + "(http://trustee.ietf.org/license-info).\n" + "\n" + "This version "
60                 + "of this YANG module is part of RFC 6022; see\n" + "the RFC itself for full legal notices."),
61                 testModule.getDescription());
62     }
63 }