Introduce top-level pom file.
[mdsal.git] / code-generator / binding-generator-impl / src / test / java / org / opendaylight / yangtools / 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.yangtools.sal.binding.generator.impl;
9
10 import static org.junit.Assert.assertFalse;
11 import static org.junit.Assert.assertNotNull;
12
13 import java.io.File;
14 import java.io.IOException;
15 import java.net.URISyntaxException;
16 import java.net.URL;
17 import java.util.ArrayList;
18 import java.util.List;
19
20 import org.junit.BeforeClass;
21 import org.junit.Test;
22 import org.opendaylight.yangtools.sal.binding.generator.api.BindingGenerator;
23 import org.opendaylight.yangtools.sal.binding.model.api.Type;
24 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
25 import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
26 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
27
28 public class BinaryTypeTest {
29     private final static List<File> yangModels = new ArrayList<>();
30     private final static URL yangModelsFolder = AugmentedTypeTest.class
31             .getResource("/binary-type-test-models");
32
33     @BeforeClass
34     public static void loadTestResources() throws URISyntaxException {
35         final File augFolder = new File(yangModelsFolder.toURI());
36         for (final File fileEntry : augFolder.listFiles()) {
37             if (fileEntry.isFile()) {
38                 yangModels.add(fileEntry);
39             }
40         }
41     }
42
43     @Test
44     public void binaryTypeTest() throws IOException {
45         final YangContextParser parser = new YangParserImpl();
46         final SchemaContext context = parser.parseFiles(yangModels);
47
48         assertNotNull("context is null", context);
49         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
50         final List<Type> genTypes = bindingGen.generateTypes(context);
51
52         assertNotNull("genTypes is null", genTypes);
53         assertFalse("genTypes is empty", genTypes.isEmpty());
54
55         //TODO: implement test
56     }
57 }