Test for YANG choices added 89/789/1
authorJozef Gloncak <jgloncak@cisco.com>
Mon, 5 Aug 2013 11:02:08 +0000 (13:02 +0200)
committerJozef Gloncak <jgloncak@cisco.com>
Mon, 5 Aug 2013 11:15:43 +0000 (13:15 +0200)
Test for YANG choices was programmed.

Fixed bug:
- in BindingGeneratorImpl was in method addInterfaceDefinition changed
  type of object which contains information about implemented interfaces
  from ReferencedType to GeneratedType

Change-Id: Ie580f74aeebfa53c77e01995ff0f361fb1ec6224
Signed-off-by: Jozef Gloncak <jgloncak@cisco.com>
opendaylight/sal/yang-prototype/code-generator/binding-generator-impl/src/main/java/org/opendaylight/controller/sal/binding/generator/impl/BindingGeneratorImpl.java
opendaylight/sal/yang-prototype/code-generator/binding-generator-impl/src/test/java/org/opendaylight/controller/sal/binding/generator/impl/ChoiceCaseGenTypesTest.java
opendaylight/sal/yang-prototype/code-generator/binding-generator-impl/src/test/java/org/opendaylight/controller/sal/binding/generator/impl/MethodSignaturePattern.java [new file with mode: 0644]
opendaylight/sal/yang-prototype/code-generator/binding-generator-impl/src/test/java/org/opendaylight/controller/sal/binding/generator/impl/SupportTestUtil.java [new file with mode: 0644]
opendaylight/sal/yang-prototype/code-generator/binding-generator-impl/src/test/java/org/opendaylight/controller/sal/binding/generator/impl/UsesTest.java

index 0f59f1aaa3ca9f9402c8c336988cc09e6e177422..3b5272d3f09ef87fa0944cdec4c1f743d30e67cb 100644 (file)
@@ -805,7 +805,7 @@ public final class BindingGeneratorImpl implements BindingGenerator {
 
         final List<GeneratedType> generatedTypes = new ArrayList<>();
         for (final ChoiceCaseNode caseNode : caseNodes) {
 
         final List<GeneratedType> generatedTypes = new ArrayList<>();
         for (final ChoiceCaseNode caseNode : caseNodes) {
-            if (caseNode != null && !caseNode.isAddedByUses()) {
+            if (caseNode != null && !caseNode.isAddedByUses() && !caseNode.isAugmenting()) {
                 final String packageName = packageNameForGeneratedType(basePackageName, caseNode.getPath());
                 final GeneratedTypeBuilder caseTypeBuilder = addDefaultInterfaceDefinition(packageName, caseNode);
                 caseTypeBuilder.addImplementsType(refChoiceType);
                 final String packageName = packageNameForGeneratedType(basePackageName, caseNode.getPath());
                 final GeneratedTypeBuilder caseTypeBuilder = addDefaultInterfaceDefinition(packageName, caseNode);
                 caseTypeBuilder.addImplementsType(refChoiceType);
@@ -1249,7 +1249,7 @@ public final class BindingGeneratorImpl implements BindingGenerator {
         for (UsesNode usesNode : dataNodeContainer.getUses()) {
             if (usesNode.getGroupingPath() != null) {
                 GeneratedType genType = allGroupings.get(usesNode.getGroupingPath());
         for (UsesNode usesNode : dataNodeContainer.getUses()) {
             if (usesNode.getGroupingPath() != null) {
                 GeneratedType genType = allGroupings.get(usesNode.getGroupingPath());
-                builder.addImplementsType(new ReferencedTypeImpl(genType.getPackageName(), genType.getName()));
+                builder.addImplementsType(genType);
             }
         }
         return builder;
             }
         }
         return builder;
index ba51672c596f2668badf2a512c42d4836f6b06e0..e283c65a8aebcc36831049116f19b1541d6b237d 100644 (file)
@@ -7,7 +7,11 @@
  */
 package org.opendaylight.controller.sal.binding.generator.impl;
 
  */
 package org.opendaylight.controller.sal.binding.generator.impl;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.opendaylight.controller.sal.binding.generator.impl.SupportTestUtil.containsInterface;
+import static org.opendaylight.controller.sal.binding.generator.impl.SupportTestUtil.containsSignatures;
 
 import java.io.File;
 import java.util.ArrayList;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -17,6 +21,8 @@ import java.util.Set;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.controller.sal.binding.generator.api.BindingGenerator;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.opendaylight.controller.sal.binding.generator.api.BindingGenerator;
+import org.opendaylight.controller.sal.binding.model.api.GeneratedTransferObject;
+import org.opendaylight.controller.sal.binding.model.api.GeneratedType;
 import org.opendaylight.controller.sal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.controller.sal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -39,6 +45,30 @@ public class ChoiceCaseGenTypesTest {
         }
     }
 
         }
     }
 
+    private static GeneratedType checkGeneratedType(List<Type> genTypes, String genTypeName, String packageName,
+            int occurences) {
+        GeneratedType searchedGenType = null;
+        int searchedGenTypeCounter = 0;
+        for (Type type : genTypes) {
+            if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
+                GeneratedType genType = (GeneratedType) type;
+                if (genType.getName().equals(genTypeName) && genType.getPackageName().equals(packageName)) {
+                    searchedGenType = genType;
+                    searchedGenTypeCounter++;
+                }
+            }
+        }
+        assertNotNull("Generated type " + genTypeName + " wasn't found", searchedGenType);
+        assertEquals(genTypeName + " generated type has incorrect number of occurences.", occurences,
+                searchedGenTypeCounter);
+        return searchedGenType;
+
+    }
+
+    private static GeneratedType checkGeneratedType(List<Type> genTypes, String genTypeName, String packageName) {
+        return checkGeneratedType(genTypes, genTypeName, packageName, 1);
+    }
+
     @Test
     public void choiceCaseResolvingTypeTest() {
         final YangModelParser parser = new YangParserImpl();
     @Test
     public void choiceCaseResolvingTypeTest() {
         final YangModelParser parser = new YangParserImpl();
@@ -51,5 +81,111 @@ public class ChoiceCaseGenTypesTest {
 
         assertNotNull("genTypes is null", genTypes);
         assertFalse("genTypes is empty", genTypes.isEmpty());
 
         assertNotNull("genTypes is null", genTypes);
         assertFalse("genTypes is empty", genTypes.isEmpty());
+
+        // test for file choice-monitoring
+        String pcgPref = "org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.choice.monitoring.rev201371.netconf.state.datastores.datastore.locks";
+        GeneratedType genType = null;
+
+        checkGeneratedType(genTypes, "LockType", pcgPref); // choice
+
+        genType = checkGeneratedType(genTypes, "GlobalLock", pcgPref + ".lock.type"); // case
+        containsSignatures(genType, new MethodSignaturePattern("getGlobalLock", "GlobalLock"));
+        containsInterface("LockType", genType);
+
+        genType = checkGeneratedType(genTypes, "PartialLock", pcgPref + ".lock.type"); // case
+        containsSignatures(genType, new MethodSignaturePattern("getPartialLock", "List<PartialLock>"));
+        containsInterface("LockType", genType);
+
+        genType = checkGeneratedType(genTypes, "Fingerprint", pcgPref + ".lock.type"); // case
+        containsSignatures(genType, new MethodSignaturePattern("getAlgorithmAndHash", "AlgorithmAndHash"));
+        containsInterface("LockType", genType);
+
+        genType = checkGeneratedType(genTypes, "AlgorithmAndHash", pcgPref + ".lock.type.fingerprint"); // choice
+
+        genType = checkGeneratedType(genTypes, "Md5", pcgPref + ".lock.type.fingerprint.algorithm.and.hash"); // case
+        containsSignatures(genType, new MethodSignaturePattern("getMd5", "TlsFingerprintType"));
+        containsInterface("AlgorithmAndHash", genType);
+
+        genType = checkGeneratedType(genTypes, "Sha1", pcgPref + ".lock.type.fingerprint.algorithm.and.hash"); // case
+        containsSignatures(genType, new MethodSignaturePattern("getSha1", "TlsFingerprintType"));
+        containsInterface("AlgorithmAndHash", genType);
+
+        genType = checkGeneratedType(genTypes, "Sha224", pcgPref + ".lock.type.fingerprint.algorithm.and.hash"); // case
+        containsSignatures(genType, new MethodSignaturePattern("getSha224", "TlsFingerprintType"));
+        containsInterface("AlgorithmAndHash", genType);
+
+        genType = checkGeneratedType(genTypes, "Sha256", pcgPref + ".lock.type.fingerprint.algorithm.and.hash"); // case
+        containsSignatures(genType, new MethodSignaturePattern("getSha256", "TlsFingerprintType"));
+        containsInterface("AlgorithmAndHash", genType);
+
+        genType = checkGeneratedType(genTypes, "Sha384", pcgPref + ".lock.type.fingerprint.algorithm.and.hash"); // case
+        containsSignatures(genType, new MethodSignaturePattern("getSha384", "TlsFingerprintType"));
+        containsInterface("AlgorithmAndHash", genType);
+
+        genType = checkGeneratedType(genTypes, "Sha512", pcgPref + ".lock.type.fingerprint.algorithm.and.hash"); // case
+        containsSignatures(genType, new MethodSignaturePattern("getSha512", "TlsFingerprintType"));
+        containsInterface("AlgorithmAndHash", genType);
+
+        // test for file augment-monitoring
+        // augment
+        // "/nm:netconf-state/nm:datastores/nm:datastore/nm:locks/nm:lock-type"
+        pcgPref = "org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.augment.monitoring.rev201371";
+        genType = null;
+
+        genType = checkGeneratedType(genTypes, "AutonomousLock", pcgPref
+                + ".netconf.state.datastores.datastore.locks.lock.type"); // choice
+        containsSignatures(genType, new MethodSignaturePattern("getAutonomousDef", "AutonomousDef"));
+        containsInterface("LockType", genType);
+
+        genType = checkGeneratedType(genTypes, "AnonymousLock", pcgPref
+                + ".netconf.state.datastores.datastore.locks.lock.type"); // choice
+        containsSignatures(genType, new MethodSignaturePattern("getLockTime", "Long"));
+        containsInterface("LockType", genType);
+
+        genType = checkGeneratedType(genTypes, "LeafAugCase", pcgPref
+                + ".netconf.state.datastores.datastore.locks.lock.type"); // choice
+        containsSignatures(genType, new MethodSignaturePattern("getLeafAugCase", "String"));
+        containsInterface("LockType", genType);
+
+        // augment
+        // "/nm:netconf-state/nm:datastores/nm:datastore/nm:locks/nm:lock-type/nm:partial-lock"
+        // {
+        genType = checkGeneratedType(genTypes, "PartialLock1", pcgPref); // case
+        containsSignatures(genType, new MethodSignaturePattern("getAugCaseByChoice", "AugCaseByChoice"));
+        containsInterface("Augmentation<PartialLock>", genType);
+
+        genType = checkGeneratedType(genTypes, "AugCaseByChoice", pcgPref
+                + ".netconf.state.datastores.datastore.locks.lock.type.partial.lock"); // choice
+
+        genType = checkGeneratedType(genTypes, "Foo", pcgPref
+                + ".netconf.state.datastores.datastore.locks.lock.type.partial.lock.aug._case.by.choice"); // case
+        containsSignatures(genType, new MethodSignaturePattern("getFoo", "String"));
+        containsInterface("AugCaseByChoice", genType);
+
+        genType = checkGeneratedType(genTypes, "Bar", pcgPref
+                + ".netconf.state.datastores.datastore.locks.lock.type.partial.lock.aug._case.by.choice"); // case
+        containsSignatures(genType, new MethodSignaturePattern("getBar", "Boolean"));
+        containsInterface("AugCaseByChoice", genType);
+
+        // augment "/nm:netconf-state/nm:datastores/nm:datastore" {
+        genType = checkGeneratedType(genTypes, "Datastore1", pcgPref);
+        containsSignatures(genType, new MethodSignaturePattern("getStorageFormat", "StorageFormat"));
+        containsInterface("Augmentation<Datastore>", genType);
+
+        genType = checkGeneratedType(genTypes, "StorageFormat", pcgPref + ".netconf.state.datastores.datastore"); // choice
+
+        genType = checkGeneratedType(genTypes, "UnknownFiles", pcgPref
+                + ".netconf.state.datastores.datastore.storage.format"); // case
+        containsSignatures(genType, new MethodSignaturePattern("getFiles", "List<Files>"));
+        containsInterface("StorageFormat", genType);
+
+        genType = checkGeneratedType(genTypes, "Xml", pcgPref + ".netconf.state.datastores.datastore.storage.format"); // case
+        containsSignatures(genType, new MethodSignaturePattern("getXmlDef", "XmlDef"));
+        containsInterface("StorageFormat", genType);
+
+        genType = checkGeneratedType(genTypes, "Yang", pcgPref + ".netconf.state.datastores.datastore.storage.format"); // case
+        containsSignatures(genType, new MethodSignaturePattern("getYangFileName", "String"));
+        containsInterface("StorageFormat", genType);
+
     }
 }
     }
 }
diff --git a/opendaylight/sal/yang-prototype/code-generator/binding-generator-impl/src/test/java/org/opendaylight/controller/sal/binding/generator/impl/MethodSignaturePattern.java b/opendaylight/sal/yang-prototype/code-generator/binding-generator-impl/src/test/java/org/opendaylight/controller/sal/binding/generator/impl/MethodSignaturePattern.java
new file mode 100644 (file)
index 0000000..6e4d03a
--- /dev/null
@@ -0,0 +1,19 @@
+package org.opendaylight.controller.sal.binding.generator.impl;
+
+public class MethodSignaturePattern {
+    final String name;
+    final String type;
+
+    public MethodSignaturePattern(String methodName, String methodType) {
+        this.name = methodName;
+        this.type = methodType;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public String getType() {
+        return this.type;
+    }
+}
\ No newline at end of file
diff --git a/opendaylight/sal/yang-prototype/code-generator/binding-generator-impl/src/test/java/org/opendaylight/controller/sal/binding/generator/impl/SupportTestUtil.java b/opendaylight/sal/yang-prototype/code-generator/binding-generator-impl/src/test/java/org/opendaylight/controller/sal/binding/generator/impl/SupportTestUtil.java
new file mode 100644 (file)
index 0000000..101abdb
--- /dev/null
@@ -0,0 +1,81 @@
+package org.opendaylight.controller.sal.binding.generator.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.opendaylight.controller.sal.binding.model.api.GeneratedType;
+import org.opendaylight.controller.sal.binding.model.api.MethodSignature;
+import org.opendaylight.controller.sal.binding.model.api.ParameterizedType;
+import org.opendaylight.controller.sal.binding.model.api.Type;
+
+public class SupportTestUtil {
+
+    public static void containsSignatures(final GeneratedType genType,
+            final MethodSignaturePattern... searchedSignsWhat) {
+        final List<MethodSignature> searchedSignsIn = genType.getMethodDefinitions();
+        containsSignatures(searchedSignsIn, searchedSignsWhat);
+    }
+
+    public static void containsSignatures(final List<MethodSignature> searchedSignsIn,
+            final MethodSignaturePattern... searchedSignsWhat) {
+        if (searchedSignsIn == null) {
+            throw new IllegalArgumentException("List of method signatures in which should be searched can't be null");
+        }
+        if (searchedSignsWhat == null) {
+            throw new IllegalArgumentException("Array of method signatures which should be searched can't be null");
+        }
+
+        for (MethodSignaturePattern searchedSignWhat : searchedSignsWhat) {
+            boolean nameMatchFound = false;
+            String typeNameFound = "";
+            for (MethodSignature searchedSignIn : searchedSignsIn) {
+                if (searchedSignWhat.getName().equals(searchedSignIn.getName())) {
+                    nameMatchFound = true;
+                    typeNameFound = resolveFullNameOfReturnType(searchedSignIn.getReturnType());
+                    if (searchedSignWhat.getType().equals(typeNameFound)) {
+                        break;
+                    }
+                }
+            }
+            assertTrue("Method " + searchedSignWhat.getName() + " wasn't found.", nameMatchFound);
+            assertEquals("Return type in method " + searchedSignWhat.getName() + " doesn't match expected type ",
+                    searchedSignWhat.getType(), typeNameFound);
+
+        }
+    }
+
+    public static String resolveFullNameOfReturnType(final Type type) {
+        final StringBuilder nameBuilder = new StringBuilder();
+        if (type instanceof ParameterizedType) {
+            nameBuilder.append(type.getName() + "<");
+            ParameterizedType parametrizedTypes = (ParameterizedType) type;
+            for (Type parametrizedType : parametrizedTypes.getActualTypeArguments()) {
+                nameBuilder.append(parametrizedType.getName() + ",");
+            }
+            if (nameBuilder.charAt(nameBuilder.length() - 1) == ',') {
+                nameBuilder.deleteCharAt(nameBuilder.length() - 1);
+            }
+            nameBuilder.append(">");
+        } else {
+            nameBuilder.append(type.getName());
+        }
+        return nameBuilder.toString();
+    }
+
+    public static void containsInterface(String interfaceNameSearched, GeneratedType genType) {
+        List<Type> caseCImplements = genType.getImplements();
+        boolean interfaceFound = false;
+        for (Type caseCImplement : caseCImplements) {
+            String interfaceName = resolveFullNameOfReturnType(caseCImplement);
+            if (interfaceName.equals(interfaceNameSearched)) {
+                interfaceFound = true;
+                break;
+            }
+        }
+        assertTrue("Generated type " + genType.getName() + " doesn't implement inrerface " + interfaceNameSearched,
+                interfaceFound);
+    }
+
+}
index d885e571ccb02c9a9676d613e914e7cc148992df..532d786aeef175877db92ab7dbe42b0ae5d70f45 100644 (file)
@@ -7,7 +7,11 @@
  */
 package org.opendaylight.controller.sal.binding.generator.impl;
 
  */
 package org.opendaylight.controller.sal.binding.generator.impl;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.opendaylight.controller.sal.binding.generator.impl.SupportTestUtil.containsInterface;
+import static org.opendaylight.controller.sal.binding.generator.impl.SupportTestUtil.containsSignatures;
 
 import java.io.File;
 import java.util.ArrayList;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -18,8 +22,6 @@ import org.junit.Test;
 import org.opendaylight.controller.sal.binding.generator.api.BindingGenerator;
 import org.opendaylight.controller.sal.binding.model.api.GeneratedTransferObject;
 import org.opendaylight.controller.sal.binding.model.api.GeneratedType;
 import org.opendaylight.controller.sal.binding.generator.api.BindingGenerator;
 import org.opendaylight.controller.sal.binding.model.api.GeneratedTransferObject;
 import org.opendaylight.controller.sal.binding.model.api.GeneratedType;
-import org.opendaylight.controller.sal.binding.model.api.MethodSignature;
-import org.opendaylight.controller.sal.binding.model.api.ParameterizedType;
 import org.opendaylight.controller.sal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.controller.sal.binding.model.api.Type;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
@@ -28,80 +30,6 @@ import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
 
 public class UsesTest {
 
 
 public class UsesTest {
 
-    private class MethodSignaturePattern {
-        final String name;
-        final String type;
-
-        public MethodSignaturePattern(String methodName, String methodType) {
-            this.name = methodName;
-            this.type = methodType;
-        }
-
-        public String getName() {
-            return this.name;
-        }
-
-        public String getType() {
-            return this.type;
-        }
-    }
-
-    private static void containsSignatures(final List<MethodSignature> searchedSignsIn,
-            final MethodSignaturePattern... searchedSignsWhat) {
-        if (searchedSignsIn == null) {
-            throw new IllegalArgumentException("List of method signatures in which should be searched can't be null");
-        }
-        if (searchedSignsWhat == null) {
-            throw new IllegalArgumentException("Array of method signatures which should be searched can't be null");
-        }
-
-        for (MethodSignaturePattern searchedSignWhat : searchedSignsWhat) {
-            boolean nameMatchFound = false;
-            String typeNameFound = "";
-            for (MethodSignature searchedSignIn : searchedSignsIn) {
-                if (searchedSignWhat.getName().equals(searchedSignIn.getName())) {
-                    nameMatchFound = true;
-                    typeNameFound = resolveFullNameOfReturnType(searchedSignIn);
-                    if (searchedSignWhat.getType().equals(typeNameFound)) {
-                        break;
-                    }
-                }
-            }
-            assertTrue("Method " + searchedSignWhat.getName() + " wasn't found.", nameMatchFound);
-            assertEquals("Return type in method " + searchedSignWhat.getName() + " doesn't match expected type ",
-                    searchedSignWhat.getType(), typeNameFound);
-
-        }
-    }
-
-    private static String resolveFullNameOfReturnType(final MethodSignature methodSignature) {
-        final StringBuilder nameBuilder = new StringBuilder();
-        if (methodSignature.getReturnType() instanceof ParameterizedType) {
-            nameBuilder.append(methodSignature.getReturnType().getName() + "<");
-            ParameterizedType parametrizedTypes = (ParameterizedType) methodSignature.getReturnType();
-            for (Type parametrizedType : parametrizedTypes.getActualTypeArguments()) {
-                nameBuilder.append(parametrizedType.getName() + ",");
-            }
-            if (nameBuilder.charAt(nameBuilder.length() - 1) == ',') {
-                nameBuilder.deleteCharAt(nameBuilder.length() - 1);
-            }
-            nameBuilder.append(">");
-        } else {
-            nameBuilder.append(methodSignature.getReturnType().getName());
-        }
-        return nameBuilder.toString();
-    }
-
-    private static boolean containsInterface(String interfaceName, GeneratedType genType) {
-        List<Type> caseCImplements = genType.getImplements();
-        for (Type caseCImplement : caseCImplements) {
-            if (caseCImplement.getName().equals(interfaceName)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
     private static List<File> loadTestResources(String testFile) {
         final List<File> testModels = new ArrayList<File>();
         final File listModelFile = new File(UsesTest.class.getResource(testFile).getPath());
     private static List<File> loadTestResources(String testFile) {
         final List<File> testModels = new ArrayList<File>();
         final File listModelFile = new File(UsesTest.class.getResource(testFile).getPath());
@@ -158,11 +86,11 @@ public class UsesTest {
         assertEquals("GroupingX is in wrong package.",
                 "org.opendaylight.yang.gen.v1.urn.grouping.dependencies.rev2013718", groupingX.getPackageName());
 
         assertEquals("GroupingX is in wrong package.",
                 "org.opendaylight.yang.gen.v1.urn.grouping.dependencies.rev2013718", groupingX.getPackageName());
 
-        assertTrue("GroupingV doesn't extend GroupingU.", containsInterface("GroupingV", groupingU));
-        assertTrue("GroupingX doesn't extend GroupingU.", containsInterface("GroupingX", groupingU));
-        assertTrue("GroupingZ doesn't extend GroupingV.", containsInterface("GroupingZ", groupingV));
-        assertTrue("GroupingZZ doesn't extend GroupingV.", containsInterface("GroupingZZ", groupingV));
-        assertTrue("GroupingY doesn't extend GroupingX.", containsInterface("GroupingY", groupingX));
+        containsInterface("GroupingV", groupingU);
+        containsInterface("GroupingX", groupingU);
+        containsInterface("GroupingZ", groupingV);
+        containsInterface("GroupingZZ", groupingV);
+        containsInterface("GroupingY", groupingX);
     }
 
     @Test
     }
 
     @Test
@@ -205,7 +133,7 @@ public class UsesTest {
         assertEquals("GroupingCaseTest is in wrong package.",
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses._case.rev2013718", groupingCaseTest.getPackageName());
 
         assertEquals("GroupingCaseTest is in wrong package.",
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses._case.rev2013718", groupingCaseTest.getPackageName());
 
-        assertTrue("Case C doesn't extend GroupingCaseTest.", containsInterface("GroupingCaseTest", caseC));
+        containsInterface("GroupingCaseTest", caseC);
         assertTrue("Case C shouldn't contain any method.", caseC.getMethodDefinitions().isEmpty());
 
         assertEquals("Number of method in GroupingCaseTest is incorrect", 1, groupingCaseTest.getMethodDefinitions()
         assertTrue("Case C shouldn't contain any method.", caseC.getMethodDefinitions().isEmpty());
 
         assertEquals("Number of method in GroupingCaseTest is incorrect", 1, groupingCaseTest.getMethodDefinitions()
@@ -255,8 +183,7 @@ public class UsesTest {
         assertEquals("ContainerTest isn't in correct package",
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.container.rev2013718", containerTest.getPackageName());
 
         assertEquals("ContainerTest isn't in correct package",
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.container.rev2013718", containerTest.getPackageName());
 
-        assertTrue("ContainerTest doesn't extend GroupingContainerTest.",
-                containsInterface("GroupingContainerTest", containerTest));
+        containsInterface("GroupingContainerTest", containerTest);
 
         assertEquals("Number of method in GroupingContainerTestis incorrect", 2, groupingContainerTest
                 .getMethodDefinitions().size());
 
         assertEquals("Number of method in GroupingContainerTestis incorrect", 2, groupingContainerTest
                 .getMethodDefinitions().size());
@@ -310,8 +237,7 @@ public class UsesTest {
         assertEquals("GroupingTest isn't in correct package",
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.grouping.rev2013718", groupingTest.getPackageName());
 
         assertEquals("GroupingTest isn't in correct package",
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.grouping.rev2013718", groupingTest.getPackageName());
 
-        assertTrue("GroupingTest doesn't extend GroupingGroupingTest.",
-                containsInterface("GroupingGroupingTest", groupingTest));
+        containsInterface("GroupingGroupingTest", groupingTest);
 
         assertEquals("Number of method in GroupingGroupingTest is incorrect", 1, groupingGroupingTest
                 .getMethodDefinitions().size());
 
         assertEquals("Number of method in GroupingGroupingTest is incorrect", 1, groupingGroupingTest
                 .getMethodDefinitions().size());
@@ -386,7 +312,7 @@ public class UsesTest {
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.list.rev2013718.grouping.list.test",
                 listGroupingListTest.getPackageName());
 
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.list.rev2013718.grouping.list.test",
                 listGroupingListTest.getPackageName());
 
-        assertTrue("ListTest doesn't extend GroupingGroupingTest.", containsInterface("GroupingListTest", listTest));
+        containsInterface("GroupingListTest", listTest);
 
         assertEquals("Number of method in GroupingListTest is incorrect", 4, groupingListTest.getMethodDefinitions()
                 .size());
 
         assertEquals("Number of method in GroupingListTest is incorrect", 4, groupingListTest.getMethodDefinitions()
                 .size());
@@ -448,8 +374,7 @@ public class UsesTest {
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.modul.rev2013718",
                 groupingUsesModulData.getPackageName());
 
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.modul.rev2013718",
                 groupingUsesModulData.getPackageName());
 
-        assertTrue("GroupingUsesModulData doesn't extend GroupingModulTest.",
-                containsInterface("GroupingModulTest", groupingUsesModulData));
+        containsInterface("GroupingModulTest", groupingUsesModulData);
 
         assertEquals("Number of method in GroupingUsesModulData is incorrect", 0, groupingUsesModulData
                 .getMethodDefinitions().size());
 
         assertEquals("Number of method in GroupingUsesModulData is incorrect", 0, groupingUsesModulData
                 .getMethodDefinitions().size());
@@ -533,10 +458,8 @@ public class UsesTest {
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.rpc.rev2013718.grouping.rpc.input.test",
                 containerGroupingRpcInputTest.getPackageName());
 
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.rpc.rev2013718.grouping.rpc.input.test",
                 containerGroupingRpcInputTest.getPackageName());
 
-        assertTrue("RpcTestInput doesn't extend GroupingRpcInputTest.",
-                containsInterface("GroupingRpcInputTest", rpcTestInput));
-        assertTrue("RpcTestOutput doesn't extend GroupingRpcOutputTest.",
-                containsInterface("GroupingRpcOutputTest", rpcTestOutput));
+        containsInterface("GroupingRpcInputTest", rpcTestInput);
+        containsInterface("GroupingRpcOutputTest", rpcTestOutput);
 
         assertEquals("Number of method in RpcTestInput is incorrect", 0, rpcTestInput.getMethodDefinitions().size());
         assertEquals("Number of method in RpcTestOutput is incorrect", 0, rpcTestOutput.getMethodDefinitions().size());
 
         assertEquals("Number of method in RpcTestInput is incorrect", 0, rpcTestInput.getMethodDefinitions().size());
         assertEquals("Number of method in RpcTestOutput is incorrect", 0, rpcTestOutput.getMethodDefinitions().size());
@@ -596,8 +519,7 @@ public class UsesTest {
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.augment.rev2013718",
                 groupingAugmentTest.getPackageName());
 
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.augment.rev2013718",
                 groupingAugmentTest.getPackageName());
 
-        assertTrue("ContainerAugment1 doesn't extend GroupingAugmentTest.",
-                containsInterface("GroupingAugmentTest", containerAugment1));
+        containsInterface("GroupingAugmentTest", containerAugment1);
 
         assertEquals("Number of method in GroupingCaseTest is incorrect", 0, containerAugment1.getMethodDefinitions()
                 .size());
 
         assertEquals("Number of method in GroupingCaseTest is incorrect", 0, containerAugment1.getMethodDefinitions()
                 .size());
@@ -666,8 +588,7 @@ public class UsesTest {
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.notification.rev2013718.grouping.notification.test",
                 containerGroupingNotificationTest.getPackageName());
 
                 "org.opendaylight.yang.gen.v1.urn.grouping.uses.notification.rev2013718.grouping.notification.test",
                 containerGroupingNotificationTest.getPackageName());
 
-        assertTrue("NotificationTest doesn't extend GroupingNotificationTest.",
-                containsInterface("GroupingNotificationTest", notificationTest));
+        containsInterface("GroupingNotificationTest", notificationTest);
 
         assertEquals("Number of method in NotificationTest is incorrect", 1, notificationTest.getMethodDefinitions()
                 .size());
 
         assertEquals("Number of method in NotificationTest is incorrect", 1, notificationTest.getMethodDefinitions()
                 .size());