2 * Copyright (c) 2013 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.controller.config.yangjmxgenerator.unknownextension;
10 import static org.junit.Assert.assertTrue;
11 import static org.junit.Assert.fail;
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;
21 public class UnknownExtensionTest extends ServiceInterfaceEntryTest {
24 public void testStopOnUnknownLanguageExtension() throws Exception {
25 List<String> yangs = new ArrayList<>();
26 yangs.addAll(getConfigApiYangs());
27 yangs.add("test-ifcWithUnknownExtension.yang");
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);
34 super.testCreateFromIdentities();
36 } catch (IllegalStateException e) {
37 assertTrue(e.getMessage(),
38 e.getMessage().startsWith("Unexpected unknown schema node."));