Few fixes
- Add missing @Test annotation
- Fix type mismatch
Change-Id: If3d2da7011580d7ee625de776d8bd018c991d6eb
diff --git a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
index 2640a8b..03d7099 100644
--- a/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
+++ b/compiler/base/datamodel/src/main/java/org/onosproject/yang/compiler/datamodel/utils/DataModelUtils.java
@@ -936,6 +936,7 @@
case UNION:
return ((YangUnion) dataType.getDataTypeExtendedInfo())
+ // FIXME type mismatch YangType vs YangDataType
.getTypeList().contains(EMPTY);
default:
return dataType.getDataType().equals(EMPTY);
@@ -1381,7 +1382,7 @@
holder.addUniqueLeaf(leaf);
}
List<YangLeaf> leaves = holder.getUniqueLeaves();
- Map<YangLeaf, Integer> map = new HashMap<YangLeaf, Integer>();
+ Map<YangLeaf, Integer> map = new HashMap<>();
for (YangLeaf lf : leaves) {
if (map.containsKey(lf)) {
throw new DataModelException(E_UNIQUE);
diff --git a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java
index ba3e947..a8b9bac 100644
--- a/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java
+++ b/compiler/base/translator/src/main/java/org/onosproject/yang/compiler/translator/tojava/utils/MethodsGenerator.java
@@ -870,6 +870,7 @@
StringBuilder builder = new StringBuilder(getOverRideString());
builder.append(methodSignature(HASH_CODE_STRING, EMPTY_STRING, PUBLIC,
null, INT, null, CLASS_TYPE));
+ // FIXME this can end up generating Objects.hash against arrays
line = getReturnString(OBJECT_STRING + SUFFIX_S + PERIOD + HASH +
OPEN_PARENTHESIS, EIGHT_SPACE_INDENTATION);
builder.append(line);
diff --git a/model/src/test/java/org/onosproject/yang/model/ResourceIdTest.java b/model/src/test/java/org/onosproject/yang/model/ResourceIdTest.java
index fd203aa..4fdc600 100644
--- a/model/src/test/java/org/onosproject/yang/model/ResourceIdTest.java
+++ b/model/src/test/java/org/onosproject/yang/model/ResourceIdTest.java
@@ -56,6 +56,7 @@
.testEquals();
}
+ @Test
public void appendNodeKeys() throws CloneNotSupportedException {
ResourceId devices = ResourceId.builder()
.append(ridA.nodeKeys().subList(1, 2))
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java
index 3d6f507..db27c30 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultYangModelRegistry.java
@@ -151,7 +151,7 @@
updateRegClassStore(param);
modelIdStore.put(id, model);
} else if ((info != null) && (!registerClassStore
- .containsKey(info.getModuleClass()))) {
+ .containsValue(info.getModuleClass()))) {
updateRegClassStore(param);
} else {
throw new IllegalArgumentException(E_MEXIST);