1d104f819ac0326b6785b8595599506a82fb14c5
[mdsal.git] / binding / mdsal-binding-generator-impl / src / test / java / org / opendaylight / mdsal / binding / generator / impl / Bug4145Test.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.io.IOException;
15 import java.net.URISyntaxException;
16 import java.util.List;
17 import org.junit.Test;
18 import org.opendaylight.mdsal.binding.generator.impl.BindingGeneratorImpl;
19 import org.opendaylight.mdsal.binding.model.api.Type;
20 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
21 import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
22 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
23 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
24
25 public class Bug4145Test {
26     @Test
27     public void bug4145Test() throws URISyntaxException, IOException, YangSyntaxErrorException, ReactorException {
28         File resourceFile = new File(getClass().getResource(
29                 "/bug-4145/foo.yang").toURI());
30
31         SchemaContext context = YangParserTestUtils.parseYangFiles(resourceFile);
32
33         List<Type> generateTypes = new BindingGeneratorImpl(false)
34                 .generateTypes(context);
35         assertNotNull(generateTypes);
36         assertTrue(generateTypes.size() > 0);
37     }
38 }