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.yangtools.sal.binding.generator.impl;
10 import static org.junit.Assert.assertFalse;
11 import static org.junit.Assert.assertNotNull;
13 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
14 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
17 import java.io.IOException;
18 import java.net.URISyntaxException;
20 import java.util.ArrayList;
21 import java.util.List;
22 import org.junit.BeforeClass;
23 import org.junit.Test;
24 import org.opendaylight.yangtools.sal.binding.generator.api.BindingGenerator;
25 import org.opendaylight.yangtools.sal.binding.model.api.Type;
26 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
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");
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);
44 public void binaryTypeTest() throws IOException, SourceException, ReactorException {
45 final SchemaContext context = RetestUtils.parseYangSources(yangModels);
47 assertNotNull("context is null", context);
48 final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
49 final List<Type> genTypes = bindingGen.generateTypes(context);
51 assertNotNull("genTypes is null", genTypes);
52 assertFalse("genTypes is empty", genTypes.isEmpty());
54 //TODO: implement test