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 com.google.common.collect.Lists;
14 import java.io.InputStream;
15 import java.util.List;
16 import org.junit.Test;
17 import org.opendaylight.controller.config.yangjmxgenerator.ConfigConstants;
18 import org.opendaylight.controller.config.yangjmxgenerator.ServiceInterfaceEntryTest;
19 import org.opendaylight.controller.config.yangjmxgenerator.plugin.util.YangModelSearchUtils;
20 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
22 public class UnknownExtensionTest extends ServiceInterfaceEntryTest {
25 public void testStopOnUnknownLanguageExtension() throws Exception {
26 List<InputStream> yangISs = Lists.newArrayList(getClass()
27 .getResourceAsStream("test-ifcWithUnknownExtension.yang"));
28 yangISs.addAll(getConfigApiYangInputStreams());
30 context = YangParserTestUtils.parseYangStreams(yangISs);
31 namesToModules = YangModelSearchUtils.mapModulesByNames(context.getModules());
32 configModule = namesToModules.get(ConfigConstants.CONFIG_MODULE);
33 threadsModule = namesToModules.get(ConfigConstants.CONFIG_THREADS_MODULE);
35 super.testCreateFromIdentities();
37 } catch (IllegalStateException e) {
38 assertTrue(e.getMessage(),
39 e.getMessage().startsWith("Unexpected unknown schema node."));
42 for (InputStream is : yangISs) {