Merge "Fix minor bug in FRM proactive flow code path"
[controller.git] / opendaylight / sal / yang-prototype / code-generator / binding-generator-impl / src / test / java / org / opendaylight / controller / sal / binding / generator / impl / BinaryTypeTest.java
1 /*
2 * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3 *
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
7 */
8 package org.opendaylight.controller.sal.binding.generator.impl;
9
10 import static org.junit.Assert.*;
11
12 import java.io.File;
13 import java.util.ArrayList;
14 import java.util.List;
15 import java.util.Set;
16
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;
25
26 public class BinaryTypeTest {
27     private final static List<File> yangModels = new ArrayList<>();
28     private final static String yangModelsFolder = AugmentedTypeTest.class
29             .getResource("/binary-type-test-models").getPath();
30
31     @BeforeClass
32     public static void loadTestResources() {
33         final File augFolder = new File(yangModelsFolder);
34         for (final File fileEntry : augFolder.listFiles()) {
35             if (fileEntry.isFile()) {
36                 yangModels.add(fileEntry);
37             }
38         }
39     }
40
41     @Test
42     public void binaryTypeTest() {
43         final YangModelParser parser = new YangParserImpl();
44         final Set<Module> modules = parser.parseYangModels(yangModels);
45         final SchemaContext context = parser.resolveSchemaContext(modules);
46
47         assertNotNull("context is null", context);
48         final BindingGenerator bindingGen = new BindingGeneratorImpl();
49         final List<Type> genTypes = bindingGen.generateTypes(context);
50
51         assertNotNull("genTypes is null", genTypes);
52         assertFalse("genTypes is empty", genTypes.isEmpty());
53
54         //TODO: implement test
55     }
56 }