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.io.InputStream;
14 import java.util.List;
17 import org.junit.Test;
18 import org.opendaylight.controller.config.yangjmxgenerator.ConfigConstants;
19 import org.opendaylight.controller.config.yangjmxgenerator.ServiceInterfaceEntryTest;
20 import org.opendaylight.controller.config.yangjmxgenerator.plugin.util.YangModelSearchUtils;
21 import org.opendaylight.yangtools.yang.model.api.Module;
22 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
24 import com.google.common.collect.Lists;
26 public class UnknownExtensionTest extends ServiceInterfaceEntryTest {
29 public void testStopOnUnknownLanguageExtension() throws Exception {
30 List<InputStream> yangISs = Lists.newArrayList(getClass()
31 .getResourceAsStream("test-ifcWithUnknownExtension.yang"));
32 yangISs.addAll(getConfigApiYangInputStreams());
34 YangParserImpl parser = new YangParserImpl();
35 Set<Module> modulesToBuild = parser
36 .parseYangModelsFromStreams(yangISs);
37 context = parser.resolveSchemaContext(modulesToBuild);
38 namesToModules = YangModelSearchUtils.mapModulesByNames(context
40 configModule = namesToModules.get(ConfigConstants.CONFIG_MODULE);
41 threadsModule = namesToModules
42 .get(ConfigConstants.CONFIG_THREADS_MODULE);
44 super.testCreateFromIdentities();
46 } catch (IllegalStateException e) {
49 e.getMessage().startsWith(
50 "Unexpected unknown schema node."));
53 for (InputStream is : yangISs) {