Adjust to yangtools-2.0.0 changes
[mdsal.git] / binding / mdsal-binding-generator-impl / src / test / java / org / opendaylight / mdsal / binding / generator / impl / Bug6135Test.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.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertNotNull;
13
14 import java.io.FileNotFoundException;
15 import java.net.URISyntaxException;
16 import java.util.List;
17 import org.junit.Ignore;
18 import org.junit.Test;
19 import org.opendaylight.mdsal.binding.model.api.Enumeration;
20 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
21 import org.opendaylight.mdsal.binding.model.api.Type;
22 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
23 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
24 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
25
26 public class Bug6135Test {
27
28     @Ignore
29     @Test
30     public void bug6135Test() throws FileNotFoundException, ReactorException, URISyntaxException {
31         final SchemaContext context = YangParserTestUtils.parseYangResource("/bug-6135/foo.yang");
32         assertNotNull(context);
33
34         final List<Type> generateTypes = new BindingGeneratorImpl(false).generateTypes(context);
35         assertFalse(generateTypes.isEmpty());
36
37         GeneratedType genInterface = null;
38         for (final Type type : generateTypes) {
39             if (type.getName().equals("TestLeafrefData")) {
40                 genInterface = (GeneratedType) type;
41                 break;
42             }
43         }
44         assertNotNull(genInterface);
45         final List<Enumeration> enums = genInterface.getEnumerations();
46         assertEquals(2, enums.size());
47     }
48 }