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.yin;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertNotNull;
14 import java.net.URISyntaxException;
16 import org.junit.Before;
17 import org.junit.Test;
18 import org.opendaylight.yangtools.yang.common.QName;
19 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
20 import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
21 import org.opendaylight.yangtools.yang.model.api.Module;
22 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
23 import org.opendaylight.yangtools.yang.stmt.TestUtils;
25 public class YinFileLeafListStmtTest {
27 private Set<Module> modules;
30 public void init() throws URISyntaxException, ReactorException {
31 modules = TestUtils.loadYinModules(getClass().getResource("/semantic-statement-parser/yin/modules").toURI());
32 assertEquals(9, modules.size());
36 public void testLeafList() {
37 final Module testModule = TestUtils.findModule(modules, "ietf-netconf-monitoring");
38 assertNotNull(testModule);
40 ContainerSchemaNode container = (ContainerSchemaNode) testModule.getDataChildByName(QName.create(
41 testModule.getQNameModule(), "netconf-state"));
42 assertNotNull(container);
44 container = (ContainerSchemaNode) container.getDataChildByName(QName.create(testModule.getQNameModule(),
46 assertNotNull(container);
48 final LeafListSchemaNode leafList = (LeafListSchemaNode) container.getDataChildByName(QName.create(
49 testModule.getQNameModule(), "capability"));
50 assertNotNull(leafList);
51 assertEquals("uri", leafList.getType().getQName().getLocalName());
52 assertEquals("List of NETCONF capabilities supported by the server.", leafList.getDescription());
53 assertFalse(leafList.isUserOrdered());