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.yangtools.sal.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.yangtools.sal.binding.model.api.Enumeration;
20 import org.opendaylight.yangtools.sal.binding.model.api.GeneratedType;
21 import org.opendaylight.yangtools.sal.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;
26 public class Bug6135Test {
30 public void bug6135Test() throws FileNotFoundException, ReactorException, URISyntaxException {
31 final SchemaContext context = YangParserTestUtils.parseYangSource("/bug-6135/foo.yang");
32 assertNotNull(context);
34 final List<Type> generateTypes = new BindingGeneratorImpl(false).generateTypes(context);
35 assertFalse(generateTypes.isEmpty());
37 GeneratedType genInterface = null;
38 for (final Type type : generateTypes) {
39 if (type.getName().equals("TestLeafrefData")) {
40 genInterface = (GeneratedType) type;
44 assertNotNull(genInterface);
45 final List<Enumeration> enums = genInterface.getEnumerations();
46 assertEquals(2, enums.size());