Fix distribution to accommodate object values in policy metadata 93/127093/1
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>
Mon, 14 Feb 2022 10:08:16 +0000 (10:08 +0000)
committerrameshiyer27 <ramesh.murugan.iyer@est.tech>
Mon, 14 Feb 2022 10:08:16 +0000 (10:08 +0000)
Issue-ID: POLICY-3832
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: I1cb539156acee3a63c9ffa432ec2371941bf9acd

plugins/forwarding-plugins/src/main/java/org/onap/policy/distribution/forwarding/lifecycle/api/LifecycleApiPolicyForwarder.java

index 4d0a8f7..3a38084 100644 (file)
@@ -1,6 +1,6 @@
 /*-
  * ============LICENSE_START=======================================================
- *  Copyright (C) 2019 Nordix Foundation.
+ *  Copyright (C) 2019,2022 Nordix Foundation.
  *  Modifications Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved.
  *  Modifications Copyright (C) 2021 Bell Canada.
  * ================================================================================
@@ -129,9 +129,11 @@ public class LifecycleApiPolicyForwarder implements PolicyForwarder {
         final var pdpPolicies = new PdpDeployPolicies();
         final List<ToscaConceptIdentifierOptVersion> policyIdentifierList = new ArrayList<>();
         for (final Map<String, ToscaPolicy> policyMap : toscaServiceTemplate.getToscaTopologyTemplate().getPolicies()) {
-            final String policyId = policyMap.entrySet().iterator().next().getValue().getMetadata().get("policy-id");
+            final String policyId =
+                String.valueOf(policyMap.entrySet().iterator().next().getValue().getMetadata().get("policy-id"));
             final String policyVersion =
-                    policyMap.entrySet().iterator().next().getValue().getMetadata().get("policy-version");
+                    String.valueOf(policyMap.entrySet().iterator().next().getValue().getMetadata()
+                        .get("policy-version"));
             final var toscaPolicyIdentifier =
                     new ToscaConceptIdentifierOptVersion(policyId, policyVersion);
             policyIdentifierList.add(toscaPolicyIdentifier);