summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2019-04-20 16:06:07 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-20 16:06:07 +0000
commitd49ebeef426ca3c0b34297e0eb77dbab5d019c7d (patch)
tree9c32f62d1e5e30af428b14db1e31b8a493bf4423
parentf42123cde45da90cddaddff5df731e977c0c8447 (diff)
parentb6df9c2cdfacb20b0a7307b8d58567da06d703cc (diff)
Merge "Fix a bug in adding one-digit policy-version in metadata"
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java6
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java6
2 files changed, 6 insertions, 6 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
index 7655eb96a..e21979be3 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicy.java
@@ -191,12 +191,12 @@ public class JpaToscaPolicy extends JpaToscaEntityType<ToscaPolicy> implements P
// Add the property metadata if it doesn't exist already
if (toscaPolicy.getMetadata() == null) {
- toscaPolicy.setMetadata(new LinkedHashMap<>());
+ setMetadata(new LinkedHashMap<>());
}
// Add the policy name and version fields to the metadata
- toscaPolicy.getMetadata().put(METADATA_POLICY_ID_TAG, getKey().getName());
- toscaPolicy.getMetadata().put(METADATA_POLICY_VERSION_TAG, Integer.toString(getKey().getMajorVersion()));
+ getMetadata().put(METADATA_POLICY_ID_TAG, getKey().getName());
+ getMetadata().put(METADATA_POLICY_VERSION_TAG, Integer.toString(getKey().getMajorVersion()));
}
@Override
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java
index 5f0cbb355..9d9ee608d 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java
@@ -171,7 +171,7 @@ public class MonitoringPolicySerializationTest {
JpaToscaPolicy policyVal = policiesConceptMap.values().iterator().next();
// Check metadata
- assertTrue(policyVal.getMetadata().size() == 1);
+ assertTrue(policyVal.getMetadata().size() == 2);
assertEquals("policy-id", policyVal.getMetadata().entrySet().iterator().next().getKey());
assertEquals("onap.restart.tca", policyVal.getMetadata().entrySet().iterator().next().getValue());
@@ -204,7 +204,7 @@ public class MonitoringPolicySerializationTest {
JpaToscaPolicy policyVal = policiesConceptMap.values().iterator().next();
// Check metadata
- assertTrue(policyVal.getMetadata().size() == 1);
+ assertTrue(policyVal.getMetadata().size() == 2);
assertEquals("policy-id", policyVal.getMetadata().entrySet().iterator().next().getKey());
assertEquals("onap.scaleout.tca", policyVal.getMetadata().entrySet().iterator().next().getValue());
@@ -237,7 +237,7 @@ public class MonitoringPolicySerializationTest {
JpaToscaPolicy policyVal = policiesConceptMap.values().iterator().next();
// Check metadata
- assertTrue(policyVal.getMetadata().size() == 1);
+ assertTrue(policyVal.getMetadata().size() == 2);
assertEquals("policy-id", policyVal.getMetadata().entrySet().iterator().next().getKey());
assertEquals("onap.vfirewall.tca", policyVal.getMetadata().entrySet().iterator().next().getValue());