2 * Copyright (c) 2016 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.mdsal.binding.generator.impl;
10 import static org.junit.Assert.assertFalse;
11 import static org.junit.Assert.assertNotNull;
14 import java.io.IOException;
15 import java.net.URISyntaxException;
17 import java.util.ArrayList;
18 import java.util.List;
19 import org.junit.BeforeClass;
20 import org.junit.Test;
21 import org.opendaylight.mdsal.binding.generator.api.BindingGenerator;
22 import org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl;
23 import org.opendaylight.mdsal.binding.model.api.Type;
24 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
25 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
26 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
27 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
29 public class BinaryTypeTest {
30 private final static List<File> yangModels = new ArrayList<>();
31 private final static URL yangModelsFolder = AugmentedTypeTest.class
32 .getResource("/binary-type-test-models");
35 public static void loadTestResources() throws URISyntaxException {
36 final File augFolder = new File(yangModelsFolder.toURI());
37 for (final File fileEntry : augFolder.listFiles()) {
38 if (fileEntry.isFile()) {
39 yangModels.add(fileEntry);
45 public void binaryTypeTest() throws IOException, SourceException, ReactorException {
46 final SchemaContext context = YangParserTestUtils.parseYangSources(yangModels);
48 assertNotNull("context is null", context);
49 final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
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