Refactored equals in AugmentationSchemaImpl. 84/384/3
authorMartin Vitez <mvitez@cisco.com>
Wed, 22 May 2013 08:14:47 +0000 (10:14 +0200)
committerMartin Vitez <mvitez@cisco.com>
Wed, 22 May 2013 08:42:44 +0000 (10:42 +0200)
Change-Id: Ib683418a3e2547845a71b721aea1090c2cf1ba40
Signed-off-by: Martin Vitez <mvitez@cisco.com>
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/main/java/org/opendaylight/controller/yang/parser/builder/impl/AugmentationSchemaBuilderImpl.java
opendaylight/sal/yang-prototype/code-generator/yang-model-parser-impl/src/test/java/org/opendaylight/controller/yang/parser/impl/YangParserTest.java

index 29c38df..605ca6d 100644 (file)
@@ -350,6 +350,8 @@ public class AugmentationSchemaBuilderImpl implements AugmentationSchemaBuilder
                     + ((targetPath == null) ? 0 : targetPath.hashCode());
             result = prime * result
                     + ((whenCondition == null) ? 0 : whenCondition.hashCode());
+            result = prime * result
+                    + ((childNodes == null) ? 0 : childNodes.hashCode());
             return result;
         }
 
@@ -379,6 +381,13 @@ public class AugmentationSchemaBuilderImpl implements AugmentationSchemaBuilder
             } else if (!whenCondition.equals(other.whenCondition)) {
                 return false;
             }
+            if (childNodes == null) {
+                if (other.childNodes != null) {
+                    return false;
+                }
+            } else if (!childNodes.equals(other.childNodes)) {
+                return false;
+            }
             return true;
         }
 
index f6240c9..9cbf5b9 100644 (file)
@@ -248,10 +248,7 @@ public class YangParserTest {
 
         // check
         assertEquals(augmentedContainer, augmentedContainerDefinition);
-        assertEquals(augmentedContainerAugments.iterator().next(), augment1);
-
         assertEquals(augmentedLeaf, augmentedLeafDefinition);
-        assertEquals(ifEntryAugments.iterator().next(), augment3);
     }
 
     @Test