Original change of adding single digit policy-version in tosca policy
metadata does not take effect actually. It is added into metadata of
authorative tosca policy but not jpa tosca policy. Identify the issue
at the last minute and fix it.
Issue-ID: POLICY-1442
Change-Id: I8aefa546f757f7841554e3caf00ccc476d23ebf5
Signed-off-by: Chenfei Gao <cgao@research.att.com>
// Add the property metadata if it doesn't exist already
if (toscaPolicy.getMetadata() == null) {
// 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
}
// 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()));
JpaToscaPolicy policyVal = policiesConceptMap.values().iterator().next();
// Check metadata
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());
assertEquals("policy-id", policyVal.getMetadata().entrySet().iterator().next().getKey());
assertEquals("onap.restart.tca", policyVal.getMetadata().entrySet().iterator().next().getValue());
JpaToscaPolicy policyVal = policiesConceptMap.values().iterator().next();
// Check metadata
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());
assertEquals("policy-id", policyVal.getMetadata().entrySet().iterator().next().getKey());
assertEquals("onap.scaleout.tca", policyVal.getMetadata().entrySet().iterator().next().getValue());
JpaToscaPolicy policyVal = policiesConceptMap.values().iterator().next();
// Check metadata
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());
assertEquals("policy-id", policyVal.getMetadata().entrySet().iterator().next().getKey());
assertEquals("onap.vfirewall.tca", policyVal.getMetadata().entrySet().iterator().next().getValue());