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;
10 import static org.junit.Assert.*;
13 import java.util.ArrayList;
14 import java.util.List;
17 import org.junit.BeforeClass;
18 import org.junit.Test;
19 import org.opendaylight.controller.sal.binding.generator.api.BindingGenerator;
20 import org.opendaylight.controller.sal.binding.model.api.Type;
21 import org.opendaylight.yangtools.yang.model.api.Module;
22 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
23 import org.opendaylight.yangtools.yang.model.parser.api.YangModelParser;
24 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
26 public class UnionTypeDefTest {
27 private final static List<File> yangModels = new ArrayList<>();
28 private final static String yangModelsFolder = AugmentedTypeTest.class
29 .getResource("/union-test-models").getPath();
32 public static void loadTestResources() {
33 final File augFolder = new File(yangModelsFolder);
35 for (final File fileEntry : augFolder.listFiles()) {
36 if (fileEntry.isFile()) {
37 yangModels.add(fileEntry);
43 public void unionTypeResolvingTest() {
44 final YangModelParser parser = new YangParserImpl();
45 final Set<Module> modules = parser.parseYangModels(yangModels);
46 final SchemaContext context = parser.resolveSchemaContext(modules);
48 assertNotNull("context is null", context);
49 final BindingGenerator bindingGen = new BindingGeneratorImpl();
50 final List<Type> genTypes = bindingGen.generateTypes(context);
52 assertNotNull("genTypes is null", genTypes);
53 assertFalse("genTypes is empty", genTypes.isEmpty());
55 //TODO: implement test