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 java.util.ArrayList;
12 import java.util.List;
15 import org.junit.BeforeClass;
16 import org.junit.Test;
17 import org.opendaylight.controller.sal.binding.generator.api.BindingGenerator;
18 import org.opendaylight.controller.sal.binding.model.api.Type;
19 import org.opendaylight.controller.yang.model.api.Module;
20 import org.opendaylight.controller.yang.model.api.SchemaContext;
21 import org.opendaylight.controller.yang.model.parser.api.YangModelParser;
22 import org.opendaylight.controller.yang.parser.impl.YangParserImpl;
24 import static org.junit.Assert.assertFalse;
25 import static org.junit.Assert.assertNotNull;
27 public class ChoiceCaseGenTypesTest {
29 private final static List<File> yangModels = new ArrayList<>();
30 private final static String yangModelsFolder = AugmentedTypeTest.class.getResource("/choice-case-type-test-models")
34 public static void loadTestResources() {
35 final File augFolder = new File(yangModelsFolder);
36 for (final File fileEntry : augFolder.listFiles()) {
37 if (fileEntry.isFile()) {
38 yangModels.add(fileEntry);
44 public void choiceCaseResolvingTypeTest() {
45 final YangModelParser parser = new YangParserImpl();
46 final Set<Module> modules = parser.parseYangModels(yangModels);
47 final SchemaContext context = parser.resolveSchemaContext(modules);
49 assertNotNull("context is null", context);
50 final BindingGenerator bindingGen = new BindingGeneratorImpl();
51 final List<Type> genTypes = bindingGen.generateTypes(context);
53 assertNotNull("genTypes is null", genTypes);
54 assertFalse("genTypes is empty", genTypes.isEmpty());