2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.mdsal.binding.generator.impl;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertNotNull;
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.generator.impl.BindingGeneratorImpl;
20 import org.opendaylight.mdsal.binding.model.api.Enumeration;
21 import org.opendaylight.mdsal.binding.model.api.GeneratedType;
22 import org.opendaylight.mdsal.binding.model.api.Type;
23 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
24 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
25 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
27 public class Bug6135Test {
31 public void bug6135Test() throws FileNotFoundException, ReactorException, URISyntaxException {
32 final SchemaContext context = YangParserTestUtils.parseYangSource("/bug-6135/foo.yang");
33 assertNotNull(context);
35 final List<Type> generateTypes = new BindingGeneratorImpl(false).generateTypes(context);
36 assertFalse(generateTypes.isEmpty());
38 GeneratedType genInterface = null;
39 for (final Type type : generateTypes) {
40 if (type.getName().equals("TestLeafrefData")) {
41 genInterface = (GeneratedType) type;
45 assertNotNull(genInterface);
46 final List<Enumeration> enums = genInterface.getEnumerations();
47 assertEquals(2, enums.size());