Added model generation from ietf-topology models
[yangtools.git] / code-generator / binding-generator-impl / src / test / java / org / opendaylight / yangtools / sal / binding / generator / impl / GeneratedTypesTest.java
index df24a06da56bc6e9523dbf5b1a7689cb8d4ab3ee..e82b24ba40d66687cc9b88d58ae30ec4fb40dde9 100644 (file)
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. 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.yangtools.sal.binding.generator.impl;
-
-import static org.junit.Assert.*;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.junit.Test;
-import org.opendaylight.yangtools.sal.binding.generator.api.BindingGenerator;
-import org.opendaylight.yangtools.sal.binding.model.api.GeneratedProperty;
-import org.opendaylight.yangtools.sal.binding.model.api.GeneratedTransferObject;
-import org.opendaylight.yangtools.sal.binding.model.api.GeneratedType;
-import org.opendaylight.yangtools.sal.binding.model.api.MethodSignature;
-import org.opendaylight.yangtools.sal.binding.model.api.Type;
-import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.parser.api.YangModelParser;
-import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
-
-public class GeneratedTypesTest {
-
-    private SchemaContext resolveSchemaContextFromFiles(final String... yangFiles) {
-        final YangModelParser parser = new YangParserImpl();
-
-        final List<File> inputFiles = new ArrayList<File>();
-        for (int i = 0; i < yangFiles.length; ++i) {
-            inputFiles.add(new File(yangFiles[i]));
-        }
-
-        final Set<Module> modules = parser.parseYangModels(inputFiles);
-        return parser.resolveSchemaContext(modules);
-    }
-
-    @Test
-    public void testMultipleModulesResolving() {
-        final String topologyPath = getClass().getResource("/abstract-topology.yang").getPath();
-        final String typesPath = getClass().getResource("/ietf-inet-types@2010-09-24.yang").getPath();
-        final SchemaContext context = resolveSchemaContextFromFiles(topologyPath, typesPath);
-        assertNotNull(context);
-
-        final BindingGenerator bindingGen = new BindingGeneratorImpl();
-        final List<Type> genTypes = bindingGen.generateTypes(context);
-
-        assertNotNull(genTypes);
-        assertEquals(29, genTypes.size());
-    }
-
-    @Test
-    public void testLeafrefResolving() {
-        final String topologyPath = getClass().getResource("/leafref-test-models/abstract-topology@2013-02-08.yang")
-                .getPath();
-        final String interfacesPath = getClass().getResource("/leafref-test-models/ietf-interfaces@2012-11-15.yang")
-                .getPath();
-        // final String ifTypePath = getClass().getResource(
-        // "/leafref-test-models/iana-if-type@2012-06-05.yang").getPath();
-        final String inetTypesPath = getClass().getResource("/leafref-test-models/ietf-inet-types@2010-09-24.yang")
-                .getPath();
-        final String yangTypesPath = getClass().getResource("/leafref-test-models/ietf-yang-types@2010-09-24.yang")
-                .getPath();
-
-        assertNotNull(topologyPath);
-        assertNotNull(interfacesPath);
-        // assertTrue(ifTypePath != null);
-        assertNotNull(inetTypesPath);
-        assertNotNull(yangTypesPath);
-
-        // final SchemaContext context = resolveSchemaContextFromFiles(topologyPath, interfacesPath, ifTypePath,
-        // inetTypesPath, yangTypesPath);
-        final SchemaContext context = resolveSchemaContextFromFiles(topologyPath, interfacesPath, inetTypesPath,
-                yangTypesPath);
-        assertNotNull(context);
-        assertEquals(4, context.getModules().size());
-
-        final BindingGenerator bindingGen = new BindingGeneratorImpl();
-        final List<Type> genTypes = bindingGen.generateTypes(context);
-
-        assertEquals(57, genTypes.size());
-        assertNotNull(genTypes);
-
-        GeneratedTransferObject gtIfcKey = null;
-        GeneratedType gtIfc = null;
-        GeneratedType gtNetworkLink = null;
-        GeneratedType gtSource = null;
-        GeneratedType gtDest = null;
-        GeneratedType gtTunnel = null;
-        GeneratedTransferObject gtTunnelKey = null;
-        GeneratedType gtTopology = null;
-        for (final Type type : genTypes) {
-            String name = type.getName();
-            if ("InterfaceKey".equals(name)) {
-                gtIfcKey = (GeneratedTransferObject) type;
-            } else if ("Interface".equals(name)) {
-                gtIfc = (GeneratedType) type;
-            } else if ("NetworkLink".equals(name)) {
-                gtNetworkLink = (GeneratedType) type;
-            } else if ("SourceNode".equals(name)) {
-                gtSource = (GeneratedType) type;
-            } else if ("DestinationNode".equals(name)) {
-                gtDest = (GeneratedType) type;
-            } else if ("Tunnel".equals(name)) {
-                gtTunnel = (GeneratedType) type;
-            } else if ("TunnelKey".equals(name)) {
-                gtTunnelKey = (GeneratedTransferObject) type;
-            } else if ("Topology".equals(name)) {
-                gtTopology = (GeneratedType) type;
-            }
-        }
-
-        assertNotNull(gtIfcKey);
-        assertNotNull(gtIfc);
-        assertNotNull(gtNetworkLink);
-        assertNotNull(gtSource);
-        assertNotNull(gtDest);
-        assertNotNull(gtTunnel);
-        assertNotNull(gtTunnelKey);
-        assertNotNull(gtTopology);
-
-        // Topology
-        final List<MethodSignature> gtTopoMethods = gtTopology.getMethodDefinitions();
-        assertNotNull(gtTopoMethods);
-        MethodSignature condLeafref = null;
-        for (final MethodSignature method : gtTopoMethods) {
-            if (method.getName().equals("getCondLeafref")) {
-                condLeafref = method;
-            }
-        }
-        assertNotNull(condLeafref);
-        Type condLeafRT = condLeafref.getReturnType();
-        assertNotNull(condLeafRT);
-        assertEquals("java.lang.Object", condLeafRT.getFullyQualifiedName());
-
-        // InterfaceId
-        final List<GeneratedProperty> gtIfcKeyProps = gtIfcKey.getProperties();
-        assertNotNull(gtIfcKeyProps);
-        GeneratedProperty ifcIdProp = null;
-        for (final GeneratedProperty property : gtIfcKeyProps) {
-            if (property.getName().equals("InterfaceId")) {
-                ifcIdProp = property;
-            }
-        }
-        assertNotNull(ifcIdProp);
-        Type ifcIdPropType = ifcIdProp.getReturnType();
-        assertNotNull(ifcIdPropType);
-        assertEquals("java.lang.String", ifcIdPropType.getFullyQualifiedName());
-
-        // Interface
-        final List<MethodSignature> gtIfcMethods = gtIfc.getMethodDefinitions();
-        assertNotNull(gtIfcMethods);
-        MethodSignature getIfcKey = null;
-        MethodSignature getHigherLayerIf = null;
-        for (final MethodSignature method : gtIfcMethods) {
-            if (method.getName().equals("getInterfaceKey")) {
-                getIfcKey = method;
-            } else if (method.getName().equals("getHigherLayerIf")) {
-                getHigherLayerIf = method;
-            }
-        }
-        assertNotNull(getIfcKey);
-        Type getIfcKeyType = getIfcKey.getReturnType();
-        assertNotNull(getIfcKeyType);
-        assertNotSame("java.lang.Void", getIfcKeyType);
-        assertEquals("InterfaceKey", getIfcKeyType.getName());
-
-        assertNotNull(getHigherLayerIf);
-        Type getHigherLayerIfType = getHigherLayerIf.getReturnType();
-        assertNotNull(getHigherLayerIfType);
-        assertNotSame("java.lang.Void", getHigherLayerIfType);
-        assertEquals("List", getHigherLayerIfType.getName());
-
-        // NetworkLink
-        final List<MethodSignature> gtNetworkLinkMethods = gtNetworkLink.getMethodDefinitions();
-        assertNotNull(gtNetworkLinkMethods);
-        MethodSignature getIfc = null;
-        for (MethodSignature method : gtNetworkLinkMethods) {
-            if (method.getName().equals("getInterface")) {
-                getIfc = method;
-            }
-        }
-        assertNotNull(getIfc);
-        Type getIfcType = getIfc.getReturnType();
-        assertNotNull(getIfcType);
-        assertNotSame("java.lang.Void", getIfcType);
-        assertEquals("String", getIfcType.getName());
-
-        // SourceNode
-        final List<MethodSignature> gtSourceMethods = gtSource.getMethodDefinitions();
-        assertNotNull(gtSourceMethods);
-        MethodSignature getIdSource = null;
-        for (MethodSignature method : gtSourceMethods) {
-            if (method.getName().equals("getId")) {
-                getIdSource = method;
-            }
-        }
-        assertNotNull(getIdSource);
-        Type getIdType = getIdSource.getReturnType();
-        assertNotNull(getIdType);
-        assertNotSame("java.lang.Void", getIdType);
-        assertEquals("Uri", getIdType.getName());
-
-        // DestinationNode
-        final List<MethodSignature> gtDestMethods = gtDest.getMethodDefinitions();
-        assertNotNull(gtDestMethods);
-        MethodSignature getIdDest = null;
-        for (MethodSignature method : gtDestMethods) {
-            if (method.getName().equals("getId")) {
-                getIdDest = method;
-            }
-        }
-        assertNotNull(getIdDest);
-        Type getIdDestType = getIdDest.getReturnType();
-        assertNotNull(getIdDestType);
-        assertNotSame("java.lang.Void", getIdDestType);
-        assertEquals("Uri", getIdDestType.getName());
-
-        // Tunnel
-        final List<MethodSignature> gtTunnelMethods = gtTunnel.getMethodDefinitions();
-        assertNotNull(gtTunnelMethods);
-        MethodSignature getTunnelKey = null;
-        for (MethodSignature method : gtTunnelMethods) {
-            if (method.getName().equals("getTunnelKey")) {
-                getTunnelKey = method;
-            }
-        }
-        assertNotNull(getTunnelKey);
-        Type getTunnelKeyType = getTunnelKey.getReturnType();
-        assertNotNull(getTunnelKeyType);
-        assertNotSame("java.lang.Void", getTunnelKeyType);
-        assertEquals("TunnelKey", getTunnelKeyType.getName());
-
-        // TunnelKey
-        final List<GeneratedProperty> gtTunnelKeyProps = gtTunnelKey.getProperties();
-        assertNotNull(gtTunnelKeyProps);
-        GeneratedProperty tunnelId = null;
-        for (final GeneratedProperty property : gtTunnelKeyProps) {
-            if (property.getName().equals("TunnelId")) {
-                tunnelId = property;
-            }
-        }
-        assertNotNull(tunnelId);
-        Type tunnelIdType = tunnelId.getReturnType();
-        assertNotNull(tunnelIdType);
-        assertNotSame("java.lang.Void", tunnelIdType);
-        assertEquals("Uri", tunnelIdType.getName());
-    }
-
-    @Test
-    public void testContainerResolving() {
-        final String filePath = getClass().getResource("/simple-container-demo.yang").getPath();
-        final SchemaContext context = resolveSchemaContextFromFiles(filePath);
-        assert (context != null);
-
-        final BindingGenerator bindingGen = new BindingGeneratorImpl();
-        final List<Type> genTypes = bindingGen.generateTypes(context);
-
-        assertNotNull(genTypes);
-        assertEquals(4, genTypes.size());
-
-        final GeneratedType simpleContainer = (GeneratedType) genTypes.get(1);
-        final GeneratedType nestedContainer = (GeneratedType) genTypes.get(2);
-
-        assertEquals("SimpleContainer", simpleContainer.getName());
-        assertEquals("NestedContainer", nestedContainer.getName());
-        assertEquals(3, simpleContainer.getMethodDefinitions().size());
-        assertEquals(2, nestedContainer.getMethodDefinitions().size());
-
-        int getFooMethodCounter = 0;
-        int getBarMethodCounter = 0;
-        int getNestedContainerCounter = 0;
-
-        String getFooMethodReturnTypeName = "";
-        String getBarMethodReturnTypeName = "";
-        String getNestedContainerReturnTypeName = "";
-        for (final MethodSignature method : simpleContainer.getMethodDefinitions()) {
-            if (method.getName().equals("getFoo")) {
-                getFooMethodCounter++;
-                getFooMethodReturnTypeName = method.getReturnType().getName();
-            }
-
-            if (method.getName().equals("getBar")) {
-                getBarMethodCounter++;
-                getBarMethodReturnTypeName = method.getReturnType().getName();
-            }
-
-            if (method.getName().equals("getNestedContainer")) {
-                getNestedContainerCounter++;
-                getNestedContainerReturnTypeName = method.getReturnType().getName();
-            }
-        }
-
-        assertEquals(1, getFooMethodCounter);
-        assertEquals("Integer", getFooMethodReturnTypeName);
-
-        assertEquals(1, getBarMethodCounter);
-        assertEquals("String", getBarMethodReturnTypeName);
-
-        assertEquals(1, getNestedContainerCounter);
-        assertEquals("NestedContainer", getNestedContainerReturnTypeName);
-
-        getFooMethodCounter = 0;
-        getBarMethodCounter = 0;
-
-        getFooMethodReturnTypeName = "";
-        getBarMethodReturnTypeName = "";
-
-        for (final MethodSignature method : nestedContainer.getMethodDefinitions()) {
-
-            if (method.getName().equals("getFoo")) {
-                getFooMethodCounter++;
-                getFooMethodReturnTypeName = method.getReturnType().getName();
-            }
-
-            if (method.getName().equals("getBar")) {
-                getBarMethodCounter++;
-                getBarMethodReturnTypeName = method.getReturnType().getName();
-            }
-        }
-
-        assertEquals(1, getFooMethodCounter);
-        assertEquals("Short", getFooMethodReturnTypeName);
-
-        assertEquals(1, getBarMethodCounter);
-        assertEquals("String", getBarMethodReturnTypeName);
-    }
-
-    @Test
-    public void testLeafListResolving() {
-        final String filePath = getClass().getResource("/simple-leaf-list-demo.yang").getPath();
-        final SchemaContext context = resolveSchemaContextFromFiles(filePath);
-        assertNotNull(context);
-
-        final BindingGenerator bindingGen = new BindingGeneratorImpl();
-        final List<Type> genTypes = bindingGen.generateTypes(context);
-
-        assertNotNull(genTypes);
-        assertEquals(4, genTypes.size());
-
-        final GeneratedType simpleContainer = (GeneratedType) genTypes.get(1);
-        final GeneratedType nestedContainer = (GeneratedType) genTypes.get(2);
-
-        assertEquals("SimpleContainer", simpleContainer.getName());
-        assertEquals("NestedContainer", nestedContainer.getName());
-        assertEquals(3, simpleContainer.getMethodDefinitions().size());
-        assertEquals(2, nestedContainer.getMethodDefinitions().size());
-
-        int getFooMethodCounter = 0;
-        int getBarMethodCounter = 0;
-        int getNestedContainerCounter = 0;
-
-        String getFooMethodReturnTypeName = "";
-        String getBarMethodReturnTypeName = "";
-        String getNestedContainerReturnTypeName = "";
-        for (final MethodSignature method : simpleContainer.getMethodDefinitions()) {
-            if (method.getName().equals("getFoo")) {
-                getFooMethodCounter++;
-                getFooMethodReturnTypeName = method.getReturnType().getName();
-            }
-
-            if (method.getName().equals("getBar")) {
-                getBarMethodCounter++;
-                getBarMethodReturnTypeName = method.getReturnType().getName();
-            }
-
-            if (method.getName().equals("getNestedContainer")) {
-                getNestedContainerCounter++;
-                getNestedContainerReturnTypeName = method.getReturnType().getName();
-            }
-        }
-
-        assertEquals(1, getFooMethodCounter);
-        assertEquals("List", getFooMethodReturnTypeName);
-
-        assertEquals(1, getBarMethodCounter);
-        assertEquals("String", getBarMethodReturnTypeName);
-
-        assertEquals(1, getNestedContainerCounter);
-        assertEquals("NestedContainer", getNestedContainerReturnTypeName);
-
-        getFooMethodCounter = 0;
-        getBarMethodCounter = 0;
-
-        getFooMethodReturnTypeName = "";
-        getBarMethodReturnTypeName = "";
-
-        for (final MethodSignature method : nestedContainer.getMethodDefinitions()) {
-            if (method.getName().equals("getFoo")) {
-                getFooMethodCounter++;
-                getFooMethodReturnTypeName = method.getReturnType().getName();
-            }
-
-            if (method.getName().equals("getBar")) {
-                getBarMethodCounter++;
-                getBarMethodReturnTypeName = method.getReturnType().getName();
-            }
-        }
-
-        assertEquals(1, getFooMethodCounter);
-        assertEquals("Short", getFooMethodReturnTypeName);
-
-        assertEquals(1, getBarMethodCounter);
-        assertEquals("List", getBarMethodReturnTypeName);
-    }
-
-    @Test
-    public void testListResolving() {
-        final String filePath = getClass().getResource("/simple-list-demo.yang").getPath();
-        final SchemaContext context = resolveSchemaContextFromFiles(filePath);
-        assertNotNull(context);
-
-        final BindingGenerator bindingGen = new BindingGeneratorImpl();
-        final List<Type> genTypes = bindingGen.generateTypes(context);
-
-        assertNotNull(genTypes);
-        assertEquals(6, genTypes.size());
-
-        int listParentContainerMethodsCount = 0;
-        int simpleListMethodsCount = 0;
-        int listChildContainerMethodsCount = 0;
-        int listKeyClassCount = 0;
-
-        int getSimpleListKeyMethodCount = 0;
-        int getListChildContainerMethodCount = 0;
-        int getFooMethodCount = 0;
-        int setFooMethodCount = 0;
-        int getSimpleLeafListMethodCount = 0;
-        int setSimpleLeafListMethodCount = 0;
-        int getBarMethodCount = 0;
-
-        String getSimpleListKeyMethodReturnTypeName = "";
-        String getListChildContainerMethodReturnTypeName = "";
-
-        int listKeyClassPropertyCount = 0;
-        String listKeyClassPropertyName = "";
-        String listKeyClassPropertyTypeName = "";
-        boolean listKeyClassPropertyReadOnly = false;
-
-        int hashMethodParameterCount = 0;
-        String hashMethodParameterName = "";
-        String hashMethodParameterReturnTypeName = "";
-
-        int equalMethodParameterCount = 0;
-        String equalMethodParameterName = "";
-        String equalMethodParameterReturnTypeName = "";
-
-        for (final Type type : genTypes) {
-            if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
-                final GeneratedType genType = (GeneratedType) type;
-                if (genType.getName().equals("ListParentContainer")) {
-                    listParentContainerMethodsCount = genType.getMethodDefinitions().size();
-                } else if (genType.getName().equals("SimpleList")) {
-                    simpleListMethodsCount = genType.getMethodDefinitions().size();
-                    final List<MethodSignature> methods = genType.getMethodDefinitions();
-                    for (final MethodSignature method : methods) {
-                        if (method.getName().equals("getSimpleListKey")) {
-                            getSimpleListKeyMethodCount++;
-                            getSimpleListKeyMethodReturnTypeName = method.getReturnType().getName();
-                        } else if (method.getName().equals("getListChildContainer")) {
-                            getListChildContainerMethodCount++;
-                            getListChildContainerMethodReturnTypeName = method.getReturnType().getName();
-                        } else if (method.getName().equals("getFoo")) {
-                            getFooMethodCount++;
-                        } else if (method.getName().equals("setFoo")) {
-                            setFooMethodCount++;
-                        } else if (method.getName().equals("getSimpleLeafList")) {
-                            getSimpleLeafListMethodCount++;
-                        } else if (method.getName().equals("setSimpleLeafList")) {
-                            setSimpleLeafListMethodCount++;
-                        } else if (method.getName().equals("getBar")) {
-                            getBarMethodCount++;
-                        }
-                    }
-                } else if (genType.getName().equals("ListChildContainer")) {
-                    listChildContainerMethodsCount = genType.getMethodDefinitions().size();
-                }
-            } else if (type instanceof GeneratedTransferObject) {
-                final GeneratedTransferObject genTO = (GeneratedTransferObject) type;
-                final List<GeneratedProperty> properties = genTO.getProperties();
-                final List<GeneratedProperty> hashProps = genTO.getHashCodeIdentifiers();
-                final List<GeneratedProperty> equalProps = genTO.getEqualsIdentifiers();
-
-                listKeyClassCount++;
-                listKeyClassPropertyCount = properties.size();
-                listKeyClassPropertyName = properties.get(0).getName();
-                listKeyClassPropertyTypeName = properties.get(0).getReturnType().getName();
-                listKeyClassPropertyReadOnly = properties.get(0).isReadOnly();
-
-                hashMethodParameterCount = hashProps.size();
-                hashMethodParameterName = hashProps.get(0).getName();
-                hashMethodParameterReturnTypeName = hashProps.get(0).getReturnType().getName();
-
-                equalMethodParameterCount = equalProps.size();
-                equalMethodParameterName = equalProps.get(0).getName();
-                equalMethodParameterReturnTypeName = equalProps.get(0).getReturnType().getName();
-
-            }
-        }
-
-        assertEquals(1, listParentContainerMethodsCount);
-        assertEquals(1, listChildContainerMethodsCount);
-        assertEquals(1, getSimpleListKeyMethodCount);
-        assertEquals(1, listKeyClassCount);
-
-        assertEquals(1, listKeyClassPropertyCount);
-        assertEquals("ListKey", listKeyClassPropertyName);
-        assertEquals("Byte", listKeyClassPropertyTypeName);
-        assertEquals(true, listKeyClassPropertyReadOnly);
-        assertEquals(1, hashMethodParameterCount);
-        assertEquals("ListKey", hashMethodParameterName);
-        assertEquals("Byte", hashMethodParameterReturnTypeName);
-        assertEquals(1, equalMethodParameterCount);
-        assertEquals("ListKey", equalMethodParameterName);
-        assertEquals("Byte", equalMethodParameterReturnTypeName);
-
-        assertEquals("SimpleListKey", getSimpleListKeyMethodReturnTypeName);
-
-        assertEquals(1, getListChildContainerMethodCount);
-        assertEquals("ListChildContainer", getListChildContainerMethodReturnTypeName);
-        assertEquals(1, getFooMethodCount);
-        assertEquals(0, setFooMethodCount);
-        assertEquals(1, getSimpleLeafListMethodCount);
-        assertEquals(0, setSimpleLeafListMethodCount);
-        assertEquals(1, getBarMethodCount);
-
-        assertEquals(5, simpleListMethodsCount);
-    }
-
-    @Test
-    public void testListCompositeKeyResolving() {
-        final String filePath = getClass().getResource("/list-composite-key.yang").getPath();
-        final SchemaContext context = resolveSchemaContextFromFiles(filePath);
-
-        assertNotNull(context);
-
-        final BindingGenerator bindingGen = new BindingGeneratorImpl();
-        final List<Type> genTypes = bindingGen.generateTypes(context);
-
-        assertNotNull(genTypes);
-        assertEquals(8, genTypes.size());
-
-        int genTypesCount = 0;
-        int genTOsCount = 0;
-
-        int compositeKeyListKeyPropertyCount = 0;
-        int compositeKeyListKeyCount = 0;
-        int innerListKeyPropertyCount = 0;
-
-        for (final Type type : genTypes) {
-            if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
-                genTypesCount++;
-            } else if (type instanceof GeneratedTransferObject) {
-                final GeneratedTransferObject genTO = (GeneratedTransferObject) type;
-
-                if (genTO.getName().equals("CompositeKeyListKey")) {
-                    compositeKeyListKeyCount++;
-                    final List<GeneratedProperty> properties = genTO.getProperties();
-                    for (final GeneratedProperty prop : properties) {
-                        if (prop.getName().equals("Key1")) {
-                            compositeKeyListKeyPropertyCount++;
-                        } else if (prop.getName().equals("Key2")) {
-                            compositeKeyListKeyPropertyCount++;
-                        }
-                    }
-                    genTOsCount++;
-                } else if (genTO.getName().equals("InnerListKey")) {
-                    final List<GeneratedProperty> properties = genTO.getProperties();
-                    innerListKeyPropertyCount = properties.size();
-                    genTOsCount++;
-                }
-            }
-        }
-        assertEquals(1, compositeKeyListKeyCount);
-        assertEquals(2, compositeKeyListKeyPropertyCount);
-
-        assertEquals(1, innerListKeyPropertyCount);
-
-        assertEquals(6, genTypesCount);
-        assertEquals(2, genTOsCount);
-    }
-
-    @Test
-    public void testGeneratedTypes() {
-        final String filePath = getClass().getResource("/demo-topology.yang").getPath();
-        final SchemaContext context = resolveSchemaContextFromFiles(filePath);
-        assertNotNull(context);
-
-        final BindingGenerator bindingGen = new BindingGeneratorImpl();
-        final List<Type> genTypes = bindingGen.generateTypes(context);
-
-        assertNotNull(genTypes);
-        assertEquals(15, genTypes.size());
-
-        int genTypesCount = 0;
-        int genTOsCount = 0;
-        for (final Type type : genTypes) {
-            if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {
-                genTypesCount++;
-            } else if (type instanceof GeneratedTransferObject) {
-                genTOsCount++;
-            }
-        }
-
-        assertEquals(12, genTypesCount);
-        assertEquals(3, genTOsCount);
-    }
-}
+/*\r
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+package org.opendaylight.yangtools.sal.binding.generator.impl;\r
+\r
+import static org.junit.Assert.*;\r
+\r
+import java.io.File;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+import java.util.Set;\r
+\r
+import org.junit.Test;\r
+import org.opendaylight.yangtools.sal.binding.generator.api.BindingGenerator;\r
+import org.opendaylight.yangtools.sal.binding.model.api.GeneratedProperty;\r
+import org.opendaylight.yangtools.sal.binding.model.api.GeneratedTransferObject;\r
+import org.opendaylight.yangtools.sal.binding.model.api.GeneratedType;\r
+import org.opendaylight.yangtools.sal.binding.model.api.MethodSignature;\r
+import org.opendaylight.yangtools.sal.binding.model.api.Type;\r
+import org.opendaylight.yangtools.yang.model.api.Module;\r
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;\r
+import org.opendaylight.yangtools.yang.model.parser.api.YangModelParser;\r
+import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;\r
+\r
+public class GeneratedTypesTest {\r
+\r
+    private SchemaContext resolveSchemaContextFromFiles(final String... yangFiles) {\r
+        final YangModelParser parser = new YangParserImpl();\r
+\r
+        final List<File> inputFiles = new ArrayList<File>();\r
+        for (int i = 0; i < yangFiles.length; ++i) {\r
+            inputFiles.add(new File(yangFiles[i]));\r
+        }\r
+\r
+        final Set<Module> modules = parser.parseYangModels(inputFiles);\r
+        return parser.resolveSchemaContext(modules);\r
+    }\r
+\r
+    @Test\r
+    public void testMultipleModulesResolving() {\r
+        final String topologyPath = getClass().getResource("/abstract-topology.yang").getPath();\r
+        final String typesPath = getClass().getResource("/ietf-inet-types@2010-09-24.yang").getPath();\r
+        final SchemaContext context = resolveSchemaContextFromFiles(topologyPath, typesPath);\r
+        assertNotNull(context);\r
+\r
+        final BindingGenerator bindingGen = new BindingGeneratorImpl();\r
+        final List<Type> genTypes = bindingGen.generateTypes(context);\r
+\r
+        assertNotNull(genTypes);\r
+        assertEquals(26, genTypes.size());\r
+    }\r
+\r
+    @Test\r
+    public void testLeafrefResolving() {\r
+        final String topologyPath = getClass().getResource("/leafref-test-models/abstract-topology@2013-02-08.yang")\r
+                .getPath();\r
+        final String interfacesPath = getClass().getResource("/leafref-test-models/ietf-interfaces@2012-11-15.yang")\r
+                .getPath();\r
+        // final String ifTypePath = getClass().getResource(\r
+        // "/leafref-test-models/iana-if-type@2012-06-05.yang").getPath();\r
+        final String inetTypesPath = getClass().getResource("/leafref-test-models/ietf-inet-types@2010-09-24.yang")\r
+                .getPath();\r
+        final String yangTypesPath = getClass().getResource("/leafref-test-models/ietf-yang-types@2010-09-24.yang")\r
+                .getPath();\r
+\r
+        assertNotNull(topologyPath);\r
+        assertNotNull(interfacesPath);\r
+        // assertTrue(ifTypePath != null);\r
+        assertNotNull(inetTypesPath);\r
+        assertNotNull(yangTypesPath);\r
+\r
+        // final SchemaContext context = resolveSchemaContextFromFiles(topologyPath, interfacesPath, ifTypePath,\r
+        // inetTypesPath, yangTypesPath);\r
+        final SchemaContext context = resolveSchemaContextFromFiles(topologyPath, interfacesPath, inetTypesPath,\r
+                yangTypesPath);\r
+        assertNotNull(context);\r
+        assertEquals(4, context.getModules().size());\r
+\r
+        final BindingGenerator bindingGen = new BindingGeneratorImpl();\r
+        final List<Type> genTypes = bindingGen.generateTypes(context);\r
+\r
+        assertEquals(51, genTypes.size());\r
+        assertNotNull(genTypes);\r
+\r
+        GeneratedTransferObject gtIfcKey = null;\r
+        GeneratedType gtIfc = null;\r
+        GeneratedType gtNetworkLink = null;\r
+        GeneratedType gtSource = null;\r
+        GeneratedType gtDest = null;\r
+        GeneratedType gtTunnel = null;\r
+        GeneratedTransferObject gtTunnelKey = null;\r
+        GeneratedType gtTopology = null;\r
+        for (final Type type : genTypes) {\r
+            String name = type.getName();\r
+            if ("InterfaceKey".equals(name)) {\r
+                gtIfcKey = (GeneratedTransferObject) type;\r
+            } else if ("Interface".equals(name)) {\r
+                gtIfc = (GeneratedType) type;\r
+            } else if ("NetworkLink".equals(name)) {\r
+                gtNetworkLink = (GeneratedType) type;\r
+            } else if ("SourceNode".equals(name)) {\r
+                gtSource = (GeneratedType) type;\r
+            } else if ("DestinationNode".equals(name)) {\r
+                gtDest = (GeneratedType) type;\r
+            } else if ("Tunnel".equals(name)) {\r
+                gtTunnel = (GeneratedType) type;\r
+            } else if ("TunnelKey".equals(name)) {\r
+                gtTunnelKey = (GeneratedTransferObject) type;\r
+            } else if ("Topology".equals(name)) {\r
+                gtTopology = (GeneratedType) type;\r
+            }\r
+        }\r
+\r
+        assertNotNull(gtIfcKey);\r
+        assertNotNull(gtIfc);\r
+        assertNotNull(gtNetworkLink);\r
+        assertNotNull(gtSource);\r
+        assertNotNull(gtDest);\r
+        assertNotNull(gtTunnel);\r
+        assertNotNull(gtTunnelKey);\r
+        assertNotNull(gtTopology);\r
+\r
+        // Topology\r
+        final List<MethodSignature> gtTopoMethods = gtTopology.getMethodDefinitions();\r
+        assertNotNull(gtTopoMethods);\r
+        MethodSignature condLeafref = null;\r
+        for (final MethodSignature method : gtTopoMethods) {\r
+            if (method.getName().equals("getCondLeafref")) {\r
+                condLeafref = method;\r
+            }\r
+        }\r
+        assertNotNull(condLeafref);\r
+        Type condLeafRT = condLeafref.getReturnType();\r
+        assertNotNull(condLeafRT);\r
+        assertEquals("java.lang.Object", condLeafRT.getFullyQualifiedName());\r
+\r
+        // InterfaceId\r
+        final List<GeneratedProperty> gtIfcKeyProps = gtIfcKey.getProperties();\r
+        assertNotNull(gtIfcKeyProps);\r
+        GeneratedProperty ifcIdProp = null;\r
+        for (final GeneratedProperty property : gtIfcKeyProps) {\r
+            if (property.getName().equals("InterfaceId")) {\r
+                ifcIdProp = property;\r
+            }\r
+        }\r
+        assertNotNull(ifcIdProp);\r
+        Type ifcIdPropType = ifcIdProp.getReturnType();\r
+        assertNotNull(ifcIdPropType);\r
+        assertEquals("java.lang.String", ifcIdPropType.getFullyQualifiedName());\r
+\r
+        // Interface\r
+        final List<MethodSignature> gtIfcMethods = gtIfc.getMethodDefinitions();\r
+        assertNotNull(gtIfcMethods);\r
+        MethodSignature getIfcKey = null;\r
+        MethodSignature getHigherLayerIf = null;\r
+        for (final MethodSignature method : gtIfcMethods) {\r
+            if (method.getName().equals("getInterfaceKey")) {\r
+                getIfcKey = method;\r
+            } else if (method.getName().equals("getHigherLayerIf")) {\r
+                getHigherLayerIf = method;\r
+            }\r
+        }\r
+        assertNotNull(getIfcKey);\r
+        Type getIfcKeyType = getIfcKey.getReturnType();\r
+        assertNotNull(getIfcKeyType);\r
+        assertNotSame("java.lang.Void", getIfcKeyType);\r
+        assertEquals("InterfaceKey", getIfcKeyType.getName());\r
+\r
+        assertNotNull(getHigherLayerIf);\r
+        Type getHigherLayerIfType = getHigherLayerIf.getReturnType();\r
+        assertNotNull(getHigherLayerIfType);\r
+        assertNotSame("java.lang.Void", getHigherLayerIfType);\r
+        assertEquals("List", getHigherLayerIfType.getName());\r
+\r
+        // NetworkLink\r
+        final List<MethodSignature> gtNetworkLinkMethods = gtNetworkLink.getMethodDefinitions();\r
+        assertNotNull(gtNetworkLinkMethods);\r
+        MethodSignature getIfc = null;\r
+        for (MethodSignature method : gtNetworkLinkMethods) {\r
+            if (method.getName().equals("getInterface")) {\r
+                getIfc = method;\r
+            }\r
+        }\r
+        assertNotNull(getIfc);\r
+        Type getIfcType = getIfc.getReturnType();\r
+        assertNotNull(getIfcType);\r
+        assertNotSame("java.lang.Void", getIfcType);\r
+        assertEquals("String", getIfcType.getName());\r
+\r
+        // SourceNode\r
+        final List<MethodSignature> gtSourceMethods = gtSource.getMethodDefinitions();\r
+        assertNotNull(gtSourceMethods);\r
+        MethodSignature getIdSource = null;\r
+        for (MethodSignature method : gtSourceMethods) {\r
+            if (method.getName().equals("getId")) {\r
+                getIdSource = method;\r
+            }\r
+        }\r
+        assertNotNull(getIdSource);\r
+        Type getIdType = getIdSource.getReturnType();\r
+        assertNotNull(getIdType);\r
+        assertNotSame("java.lang.Void", getIdType);\r
+        assertEquals("Uri", getIdType.getName());\r
+\r
+        // DestinationNode\r
+        final List<MethodSignature> gtDestMethods = gtDest.getMethodDefinitions();\r
+        assertNotNull(gtDestMethods);\r
+        MethodSignature getIdDest = null;\r
+        for (MethodSignature method : gtDestMethods) {\r
+            if (method.getName().equals("getId")) {\r
+                getIdDest = method;\r
+            }\r
+        }\r
+        assertNotNull(getIdDest);\r
+        Type getIdDestType = getIdDest.getReturnType();\r
+        assertNotNull(getIdDestType);\r
+        assertNotSame("java.lang.Void", getIdDestType);\r
+        assertEquals("Uri", getIdDestType.getName());\r
+\r
+        // Tunnel\r
+        final List<MethodSignature> gtTunnelMethods = gtTunnel.getMethodDefinitions();\r
+        assertNotNull(gtTunnelMethods);\r
+        MethodSignature getTunnelKey = null;\r
+        for (MethodSignature method : gtTunnelMethods) {\r
+            if (method.getName().equals("getTunnelKey")) {\r
+                getTunnelKey = method;\r
+            }\r
+        }\r
+        assertNotNull(getTunnelKey);\r
+        Type getTunnelKeyType = getTunnelKey.getReturnType();\r
+        assertNotNull(getTunnelKeyType);\r
+        assertNotSame("java.lang.Void", getTunnelKeyType);\r
+        assertEquals("TunnelKey", getTunnelKeyType.getName());\r
+\r
+        // TunnelKey\r
+        final List<GeneratedProperty> gtTunnelKeyProps = gtTunnelKey.getProperties();\r
+        assertNotNull(gtTunnelKeyProps);\r
+        GeneratedProperty tunnelId = null;\r
+        for (final GeneratedProperty property : gtTunnelKeyProps) {\r
+            if (property.getName().equals("TunnelId")) {\r
+                tunnelId = property;\r
+            }\r
+        }\r
+        assertNotNull(tunnelId);\r
+        Type tunnelIdType = tunnelId.getReturnType();\r
+        assertNotNull(tunnelIdType);\r
+        assertNotSame("java.lang.Void", tunnelIdType);\r
+        assertEquals("Uri", tunnelIdType.getName());\r
+    }\r
+\r
+    @Test\r
+    public void testContainerResolving() {\r
+        final String filePath = getClass().getResource("/simple-container-demo.yang").getPath();\r
+        final SchemaContext context = resolveSchemaContextFromFiles(filePath);\r
+        assert (context != null);\r
+\r
+        final BindingGenerator bindingGen = new BindingGeneratorImpl();\r
+        final List<Type> genTypes = bindingGen.generateTypes(context);\r
+\r
+        assertNotNull(genTypes);\r
+        assertEquals(3, genTypes.size());\r
+\r
+        final GeneratedType simpleContainer = (GeneratedType) genTypes.get(1);\r
+        final GeneratedType nestedContainer = (GeneratedType) genTypes.get(2);\r
+\r
+        assertEquals("SimpleContainer", simpleContainer.getName());\r
+        assertEquals("NestedContainer", nestedContainer.getName());\r
+        assertEquals(3, simpleContainer.getMethodDefinitions().size());\r
+        assertEquals(2, nestedContainer.getMethodDefinitions().size());\r
+\r
+        int getFooMethodCounter = 0;\r
+        int getBarMethodCounter = 0;\r
+        int getNestedContainerCounter = 0;\r
+\r
+        String getFooMethodReturnTypeName = "";\r
+        String getBarMethodReturnTypeName = "";\r
+        String getNestedContainerReturnTypeName = "";\r
+        for (final MethodSignature method : simpleContainer.getMethodDefinitions()) {\r
+            if (method.getName().equals("getFoo")) {\r
+                getFooMethodCounter++;\r
+                getFooMethodReturnTypeName = method.getReturnType().getName();\r
+            }\r
+\r
+            if (method.getName().equals("getBar")) {\r
+                getBarMethodCounter++;\r
+                getBarMethodReturnTypeName = method.getReturnType().getName();\r
+            }\r
+\r
+            if (method.getName().equals("getNestedContainer")) {\r
+                getNestedContainerCounter++;\r
+                getNestedContainerReturnTypeName = method.getReturnType().getName();\r
+            }\r
+        }\r
+\r
+        assertEquals(1, getFooMethodCounter);\r
+        assertEquals("Integer", getFooMethodReturnTypeName);\r
+\r
+        assertEquals(1, getBarMethodCounter);\r
+        assertEquals("String", getBarMethodReturnTypeName);\r
+\r
+        assertEquals(1, getNestedContainerCounter);\r
+        assertEquals("NestedContainer", getNestedContainerReturnTypeName);\r
+\r
+        getFooMethodCounter = 0;\r
+        getBarMethodCounter = 0;\r
+\r
+        getFooMethodReturnTypeName = "";\r
+        getBarMethodReturnTypeName = "";\r
+\r
+        for (final MethodSignature method : nestedContainer.getMethodDefinitions()) {\r
+\r
+            if (method.getName().equals("getFoo")) {\r
+                getFooMethodCounter++;\r
+                getFooMethodReturnTypeName = method.getReturnType().getName();\r
+            }\r
+\r
+            if (method.getName().equals("getBar")) {\r
+                getBarMethodCounter++;\r
+                getBarMethodReturnTypeName = method.getReturnType().getName();\r
+            }\r
+        }\r
+\r
+        assertEquals(1, getFooMethodCounter);\r
+        assertEquals("Short", getFooMethodReturnTypeName);\r
+\r
+        assertEquals(1, getBarMethodCounter);\r
+        assertEquals("String", getBarMethodReturnTypeName);\r
+    }\r
+\r
+    @Test\r
+    public void testLeafListResolving() {\r
+        final String filePath = getClass().getResource("/simple-leaf-list-demo.yang").getPath();\r
+        final SchemaContext context = resolveSchemaContextFromFiles(filePath);\r
+        assertNotNull(context);\r
+\r
+        final BindingGenerator bindingGen = new BindingGeneratorImpl();\r
+        final List<Type> genTypes = bindingGen.generateTypes(context);\r
+\r
+        assertNotNull(genTypes);\r
+        assertEquals(3, genTypes.size());\r
+\r
+        final GeneratedType simpleContainer = (GeneratedType) genTypes.get(1);\r
+        final GeneratedType nestedContainer = (GeneratedType) genTypes.get(2);\r
+\r
+        assertEquals("SimpleContainer", simpleContainer.getName());\r
+        assertEquals("NestedContainer", nestedContainer.getName());\r
+        assertEquals(3, simpleContainer.getMethodDefinitions().size());\r
+        assertEquals(2, nestedContainer.getMethodDefinitions().size());\r
+\r
+        int getFooMethodCounter = 0;\r
+        int getBarMethodCounter = 0;\r
+        int getNestedContainerCounter = 0;\r
+\r
+        String getFooMethodReturnTypeName = "";\r
+        String getBarMethodReturnTypeName = "";\r
+        String getNestedContainerReturnTypeName = "";\r
+        for (final MethodSignature method : simpleContainer.getMethodDefinitions()) {\r
+            if (method.getName().equals("getFoo")) {\r
+                getFooMethodCounter++;\r
+                getFooMethodReturnTypeName = method.getReturnType().getName();\r
+            }\r
+\r
+            if (method.getName().equals("getBar")) {\r
+                getBarMethodCounter++;\r
+                getBarMethodReturnTypeName = method.getReturnType().getName();\r
+            }\r
+\r
+            if (method.getName().equals("getNestedContainer")) {\r
+                getNestedContainerCounter++;\r
+                getNestedContainerReturnTypeName = method.getReturnType().getName();\r
+            }\r
+        }\r
+\r
+        assertEquals(1, getFooMethodCounter);\r
+        assertEquals("List", getFooMethodReturnTypeName);\r
+\r
+        assertEquals(1, getBarMethodCounter);\r
+        assertEquals("String", getBarMethodReturnTypeName);\r
+\r
+        assertEquals(1, getNestedContainerCounter);\r
+        assertEquals("NestedContainer", getNestedContainerReturnTypeName);\r
+\r
+        getFooMethodCounter = 0;\r
+        getBarMethodCounter = 0;\r
+\r
+        getFooMethodReturnTypeName = "";\r
+        getBarMethodReturnTypeName = "";\r
+\r
+        for (final MethodSignature method : nestedContainer.getMethodDefinitions()) {\r
+            if (method.getName().equals("getFoo")) {\r
+                getFooMethodCounter++;\r
+                getFooMethodReturnTypeName = method.getReturnType().getName();\r
+            }\r
+\r
+            if (method.getName().equals("getBar")) {\r
+                getBarMethodCounter++;\r
+                getBarMethodReturnTypeName = method.getReturnType().getName();\r
+            }\r
+        }\r
+\r
+        assertEquals(1, getFooMethodCounter);\r
+        assertEquals("Short", getFooMethodReturnTypeName);\r
+\r
+        assertEquals(1, getBarMethodCounter);\r
+        assertEquals("List", getBarMethodReturnTypeName);\r
+    }\r
+\r
+    @Test\r
+    public void testListResolving() {\r
+        final String filePath = getClass().getResource("/simple-list-demo.yang").getPath();\r
+        final SchemaContext context = resolveSchemaContextFromFiles(filePath);\r
+        assertNotNull(context);\r
+\r
+        final BindingGenerator bindingGen = new BindingGeneratorImpl();\r
+        final List<Type> genTypes = bindingGen.generateTypes(context);\r
+\r
+        assertNotNull(genTypes);\r
+        assertEquals(5, genTypes.size());\r
+\r
+        int listParentContainerMethodsCount = 0;\r
+        int simpleListMethodsCount = 0;\r
+        int listChildContainerMethodsCount = 0;\r
+        int listKeyClassCount = 0;\r
+\r
+        int getSimpleListKeyMethodCount = 0;\r
+        int getListChildContainerMethodCount = 0;\r
+        int getFooMethodCount = 0;\r
+        int setFooMethodCount = 0;\r
+        int getSimpleLeafListMethodCount = 0;\r
+        int setSimpleLeafListMethodCount = 0;\r
+        int getBarMethodCount = 0;\r
+\r
+        String getSimpleListKeyMethodReturnTypeName = "";\r
+        String getListChildContainerMethodReturnTypeName = "";\r
+\r
+        int listKeyClassPropertyCount = 0;\r
+        String listKeyClassPropertyName = "";\r
+        String listKeyClassPropertyTypeName = "";\r
+        boolean listKeyClassPropertyReadOnly = false;\r
+\r
+        int hashMethodParameterCount = 0;\r
+        String hashMethodParameterName = "";\r
+        String hashMethodParameterReturnTypeName = "";\r
+\r
+        int equalMethodParameterCount = 0;\r
+        String equalMethodParameterName = "";\r
+        String equalMethodParameterReturnTypeName = "";\r
+\r
+        for (final Type type : genTypes) {\r
+            if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {\r
+                final GeneratedType genType = (GeneratedType) type;\r
+                if (genType.getName().equals("ListParentContainer")) {\r
+                    listParentContainerMethodsCount = genType.getMethodDefinitions().size();\r
+                } else if (genType.getName().equals("SimpleList")) {\r
+                    simpleListMethodsCount = genType.getMethodDefinitions().size();\r
+                    final List<MethodSignature> methods = genType.getMethodDefinitions();\r
+                    for (final MethodSignature method : methods) {\r
+                        if (method.getName().equals("getSimpleListKey")) {\r
+                            getSimpleListKeyMethodCount++;\r
+                            getSimpleListKeyMethodReturnTypeName = method.getReturnType().getName();\r
+                        } else if (method.getName().equals("getListChildContainer")) {\r
+                            getListChildContainerMethodCount++;\r
+                            getListChildContainerMethodReturnTypeName = method.getReturnType().getName();\r
+                        } else if (method.getName().equals("getFoo")) {\r
+                            getFooMethodCount++;\r
+                        } else if (method.getName().equals("setFoo")) {\r
+                            setFooMethodCount++;\r
+                        } else if (method.getName().equals("getSimpleLeafList")) {\r
+                            getSimpleLeafListMethodCount++;\r
+                        } else if (method.getName().equals("setSimpleLeafList")) {\r
+                            setSimpleLeafListMethodCount++;\r
+                        } else if (method.getName().equals("getBar")) {\r
+                            getBarMethodCount++;\r
+                        }\r
+                    }\r
+                } else if (genType.getName().equals("ListChildContainer")) {\r
+                    listChildContainerMethodsCount = genType.getMethodDefinitions().size();\r
+                }\r
+            } else if (type instanceof GeneratedTransferObject) {\r
+                final GeneratedTransferObject genTO = (GeneratedTransferObject) type;\r
+                final List<GeneratedProperty> properties = genTO.getProperties();\r
+                final List<GeneratedProperty> hashProps = genTO.getHashCodeIdentifiers();\r
+                final List<GeneratedProperty> equalProps = genTO.getEqualsIdentifiers();\r
+\r
+                listKeyClassCount++;\r
+                listKeyClassPropertyCount = properties.size();\r
+                listKeyClassPropertyName = properties.get(0).getName();\r
+                listKeyClassPropertyTypeName = properties.get(0).getReturnType().getName();\r
+                listKeyClassPropertyReadOnly = properties.get(0).isReadOnly();\r
+\r
+                hashMethodParameterCount = hashProps.size();\r
+                hashMethodParameterName = hashProps.get(0).getName();\r
+                hashMethodParameterReturnTypeName = hashProps.get(0).getReturnType().getName();\r
+\r
+                equalMethodParameterCount = equalProps.size();\r
+                equalMethodParameterName = equalProps.get(0).getName();\r
+                equalMethodParameterReturnTypeName = equalProps.get(0).getReturnType().getName();\r
+\r
+            }\r
+        }\r
+\r
+        assertEquals(1, listParentContainerMethodsCount);\r
+        assertEquals(1, listChildContainerMethodsCount);\r
+        assertEquals(1, getSimpleListKeyMethodCount);\r
+        assertEquals(1, listKeyClassCount);\r
+\r
+        assertEquals(1, listKeyClassPropertyCount);\r
+        assertEquals("ListKey", listKeyClassPropertyName);\r
+        assertEquals("Byte", listKeyClassPropertyTypeName);\r
+        assertEquals(true, listKeyClassPropertyReadOnly);\r
+        assertEquals(1, hashMethodParameterCount);\r
+        assertEquals("ListKey", hashMethodParameterName);\r
+        assertEquals("Byte", hashMethodParameterReturnTypeName);\r
+        assertEquals(1, equalMethodParameterCount);\r
+        assertEquals("ListKey", equalMethodParameterName);\r
+        assertEquals("Byte", equalMethodParameterReturnTypeName);\r
+\r
+        assertEquals("SimpleListKey", getSimpleListKeyMethodReturnTypeName);\r
+\r
+        assertEquals(1, getListChildContainerMethodCount);\r
+        assertEquals("ListChildContainer", getListChildContainerMethodReturnTypeName);\r
+        assertEquals(1, getFooMethodCount);\r
+        assertEquals(0, setFooMethodCount);\r
+        assertEquals(1, getSimpleLeafListMethodCount);\r
+        assertEquals(0, setSimpleLeafListMethodCount);\r
+        assertEquals(1, getBarMethodCount);\r
+\r
+        assertEquals(5, simpleListMethodsCount);\r
+    }\r
+\r
+    @Test\r
+    public void testListCompositeKeyResolving() {\r
+        final String filePath = getClass().getResource("/list-composite-key.yang").getPath();\r
+        final SchemaContext context = resolveSchemaContextFromFiles(filePath);\r
+\r
+        assertNotNull(context);\r
+\r
+        final BindingGenerator bindingGen = new BindingGeneratorImpl();\r
+        final List<Type> genTypes = bindingGen.generateTypes(context);\r
+\r
+        assertNotNull(genTypes);\r
+        assertEquals(7, genTypes.size());\r
+\r
+        int genTypesCount = 0;\r
+        int genTOsCount = 0;\r
+\r
+        int compositeKeyListKeyPropertyCount = 0;\r
+        int compositeKeyListKeyCount = 0;\r
+        int innerListKeyPropertyCount = 0;\r
+\r
+        for (final Type type : genTypes) {\r
+            if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {\r
+                genTypesCount++;\r
+            } else if (type instanceof GeneratedTransferObject) {\r
+                final GeneratedTransferObject genTO = (GeneratedTransferObject) type;\r
+\r
+                if (genTO.getName().equals("CompositeKeyListKey")) {\r
+                    compositeKeyListKeyCount++;\r
+                    final List<GeneratedProperty> properties = genTO.getProperties();\r
+                    for (final GeneratedProperty prop : properties) {\r
+                        if (prop.getName().equals("Key1")) {\r
+                            compositeKeyListKeyPropertyCount++;\r
+                        } else if (prop.getName().equals("Key2")) {\r
+                            compositeKeyListKeyPropertyCount++;\r
+                        }\r
+                    }\r
+                    genTOsCount++;\r
+                } else if (genTO.getName().equals("InnerListKey")) {\r
+                    final List<GeneratedProperty> properties = genTO.getProperties();\r
+                    innerListKeyPropertyCount = properties.size();\r
+                    genTOsCount++;\r
+                }\r
+            }\r
+        }\r
+        assertEquals(1, compositeKeyListKeyCount);\r
+        assertEquals(2, compositeKeyListKeyPropertyCount);\r
+\r
+        assertEquals(1, innerListKeyPropertyCount);\r
+\r
+        assertEquals(5, genTypesCount);\r
+        assertEquals(2, genTOsCount);\r
+    }\r
+\r
+    @Test\r
+    public void testGeneratedTypes() {\r
+        final String filePath = getClass().getResource("/demo-topology.yang").getPath();\r
+        final SchemaContext context = resolveSchemaContextFromFiles(filePath);\r
+        assertNotNull(context);\r
+\r
+        final BindingGenerator bindingGen = new BindingGeneratorImpl();\r
+        final List<Type> genTypes = bindingGen.generateTypes(context);\r
+\r
+        assertNotNull(genTypes);\r
+        assertEquals(14, genTypes.size());\r
+\r
+        int genTypesCount = 0;\r
+        int genTOsCount = 0;\r
+        for (final Type type : genTypes) {\r
+            if (type instanceof GeneratedType && !(type instanceof GeneratedTransferObject)) {\r
+                genTypesCount++;\r
+            } else if (type instanceof GeneratedTransferObject) {\r
+                genTOsCount++;\r
+            }\r
+        }\r
+\r
+        assertEquals(11, genTypesCount);\r
+        assertEquals(3, genTOsCount);\r
+    }\r
+}\r