Adjust to yangtools-2.0.0 changes
[controller.git] / opendaylight / config / yang-jmx-generator / src / test / java / org / opendaylight / controller / config / yangjmxgenerator / unknownextension / UnknownExtensionTest.java
1 /*
2  * Copyright (c) 2013 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.controller.config.yangjmxgenerator.unknownextension;
9
10 import static org.junit.Assert.assertTrue;
11 import static org.junit.Assert.fail;
12
13 import java.util.ArrayList;
14 import java.util.List;
15 import org.junit.Test;
16 import org.opendaylight.controller.config.yangjmxgenerator.ConfigConstants;
17 import org.opendaylight.controller.config.yangjmxgenerator.ServiceInterfaceEntryTest;
18 import org.opendaylight.controller.config.yangjmxgenerator.plugin.util.YangModelSearchUtils;
19 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
20
21 public class UnknownExtensionTest extends ServiceInterfaceEntryTest {
22
23     @Test
24     public void testStopOnUnknownLanguageExtension() throws Exception {
25         List<String> yangs = new ArrayList<>();
26         yangs.addAll(getConfigApiYangs());
27         yangs.add("test-ifcWithUnknownExtension.yang");
28
29         context = YangParserTestUtils.parseYangResources(UnknownExtensionTest.class, yangs);
30         namesToModules = YangModelSearchUtils.mapModulesByNames(context.getModules());
31         configModule = namesToModules.get(ConfigConstants.CONFIG_MODULE);
32         threadsModule = namesToModules.get(ConfigConstants.CONFIG_THREADS_MODULE);
33         try {
34             super.testCreateFromIdentities();
35             fail();
36         } catch (IllegalStateException e) {
37             assertTrue(e.getMessage(),
38                 e.getMessage().startsWith("Unexpected unknown schema node."));
39         }
40     }
41
42 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.