Bug 6859 #3 Binding generator v1 refactoring
[mdsal.git] / binding / mdsal-binding-generator-impl / src / test / java / org / opendaylight / mdsal / binding / generator / impl / UnionTypeDefTest.java
1 /*
2  * Copyright (c) 2016 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.mdsal.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.util.List;
15 import org.junit.Test;
16 import org.opendaylight.mdsal.binding.generator.api.BindingGenerator;
17 import org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl;
18 import org.opendaylight.mdsal.binding.model.api.Type;
19 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
20 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
21
22 public class UnionTypeDefTest {
23
24     @Test
25     public void unionTypeResolvingTest() throws Exception {
26         File abstractTopology = new File(getClass().getResource("/union-test-models/abstract-topology.yang").toURI());
27         File ietfInetTypes = new File(getClass().getResource("/ietf/ietf-inet-types.yang").toURI());
28         final SchemaContext context = YangParserTestUtils.parseYangSources(abstractTopology, ietfInetTypes);
29
30         assertNotNull("context is null", context);
31         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
32         final List<Type> genTypes = bindingGen.generateTypes(context);
33
34         assertNotNull("genTypes is null", genTypes);
35         assertFalse("genTypes is empty", genTypes.isEmpty());
36
37         // TODO: implement test
38     }
39 }