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