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