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.sal.binding.generator.impl;
11 import static org.junit.Assert.*;
14 import java.util.ArrayList;
15 import java.util.List;
18 import org.junit.BeforeClass;
19 import org.junit.Test;
20 import org.opendaylight.controller.sal.binding.generator.api.BindingGenerator;
21 import org.opendaylight.controller.sal.binding.model.api.Type;
22 import org.opendaylight.yangtools.yang.model.api.Module;
23 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
24 import org.opendaylight.yangtools.yang.model.parser.api.YangModelParser;
25 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
27 public class ControllerTest {
29 private final static List<File> controllerModels = new ArrayList<>();
30 private final static String controllerModelsFolderPath = ControllerTest.class
31 .getResource("/controller-models").getPath();
34 public static void loadTestResources() {
35 final File ctrlFolder = new File(controllerModelsFolderPath);
37 for (final File fileEntry : ctrlFolder.listFiles()) {
38 if (fileEntry.isFile()) {
39 controllerModels.add(fileEntry);
45 public void controllerAugmentationTest() {
46 final YangModelParser parser = new YangParserImpl();
47 final Set<Module> modules = parser.parseYangModels(controllerModels);
48 final SchemaContext context = parser.resolveSchemaContext(modules);
50 assertNotNull(context);
51 final BindingGenerator bindingGen = new BindingGeneratorImpl();
52 final List<Type> genTypes = bindingGen.generateTypes(context);
54 assertNotNull(genTypes);
55 assertTrue(!genTypes.isEmpty());