985934633aea12a34f01f14778719628e1ac3b6e
[mdsal.git] / binding / mdsal-binding-generator-impl / src / test / java / org / opendaylight / mdsal / binding / generator / impl / ControllerTest.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.assertNotNull;
11 import static org.junit.Assert.assertTrue;
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 ControllerTest {
23
24     @Test
25     public void controllerAugmentationTest() throws Exception {
26         File cn = new File(getClass().getResource("/controller-models/controller-network.yang").toURI());
27         File co = new File(getClass().getResource("/controller-models/controller-openflow.yang").toURI());
28         File ietfInetTypes = new File(getClass().getResource("/ietf/ietf-inet-types.yang").toURI());
29
30         final SchemaContext context = YangParserTestUtils.parseYangFiles(cn, co, ietfInetTypes);
31         assertNotNull("Schema Context is null", context);
32
33         final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
34         final List<Type> genTypes = bindingGen.generateTypes(context);
35
36         assertNotNull(genTypes);
37         assertTrue(!genTypes.isEmpty());
38     }
39 }