ef2a0fe50d0c3e60591d0ff1a569f36825a28f4d
[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 import java.io.File;
14 import java.util.List;
15 import org.junit.Ignore;
16 import org.junit.Test;
17 import org.opendaylight.mdsal.binding.model.api.Enumeration;
18 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
19 import org.opendaylight.mdsal.binding.model.api.Type;
20 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
21 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
22
23 public class Bug6135Test {
24
25     @Ignore
26     @Test
27     public void bug6135Test() throws Exception {
28         final SchemaContext context = YangParserTestUtils
29                 .parseYangFiles(new File(Bug6135Test.class.getResource("/bug-6135/foo.yang").toURI()));
30         assertNotNull(context);
31
32         final List<Type> generateTypes = new BindingGeneratorImpl(false).generateTypes(context);
33         assertFalse(generateTypes.isEmpty());
34
35         GeneratedType genInterface = null;
36         for (final Type type : generateTypes) {
37             if (type.getName().equals("TestLeafrefData")) {
38                 genInterface = (GeneratedType) type;
39                 break;
40             }
41         }
42         assertNotNull(genInterface);
43         final List<Enumeration> enums = genInterface.getEnumerations();
44         assertEquals(2, enums.size());
45     }
46 }