X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=binding%2Fmdsal-binding-generator-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fbinding%2Fgenerator%2Fimpl%2FMdsal182Test.java;fp=binding%2Fmdsal-binding-generator-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fmdsal%2Fbinding%2Fgenerator%2Fimpl%2FMdsal182Test.java;h=bf297c27e0571135331573bb3c04cc39c6a5233f;hb=241855474b6476d66a82634fac9a8676bbc3ebee;hp=0000000000000000000000000000000000000000;hpb=6f5eaaf58218bb1eede197100a9b1c723fad330d;p=mdsal.git diff --git a/binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/Mdsal182Test.java b/binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/Mdsal182Test.java new file mode 100644 index 0000000000..bf297c27e0 --- /dev/null +++ b/binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/Mdsal182Test.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.mdsal.binding.generator.impl; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.Collection; +import org.junit.Test; +import org.opendaylight.mdsal.binding.model.api.Type; +import org.opendaylight.yangtools.yang.model.api.SchemaContext; +import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils; + +/** + * Test leafref resolution when the leaf is from a grouping. + */ +public class Mdsal182Test { + + @Test + public void testOneUpLeafref() { + final SchemaContext context = YangParserTestUtils.parseYangResource("/mdsal-182/good-leafref.yang"); + final Collection types = new BindingGeneratorImpl().generateTypes(context); + assertEquals(6, types.size()); + } + + @Test + public void testTwoUpLeafref() { + final SchemaContext context = YangParserTestUtils.parseYangResource("/mdsal-182/grouping-leafref.yang"); + final Collection types = new BindingGeneratorImpl().generateTypes(context); + assertNotNull(types); + assertEquals(4, types.size()); + } +}