summaryrefslogtreecommitdiffstats
path: root/applications
diff options
context:
space:
mode:
authorrameshiyer27 <ramesh.murugan.iyer@est.tech>2022-02-11 08:53:57 +0000
committerRamesh Murugan Iyer <ramesh.murugan.iyer@est.tech>2022-02-11 09:29:32 +0000
commitfca2e06f2a01c03ba0d12271defaec0b5ab13ba5 (patch)
tree6e5d98e874d17fe982e619077a3949c10321b683 /applications
parentd8ed7a991d54bd6e53a7c1fedee808ab78dfdf19 (diff)
Fix xacml pdp to accommodate Object values in policy metadata
Issue-ID: POLICY-3832 Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech> Change-Id: I276bf28d3fdaad6e1d7cde315cdb049343cbde3f
Diffstat (limited to 'applications')
-rw-r--r--applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslator.java4
-rw-r--r--applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java2
-rw-r--r--applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java2
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java2
-rw-r--r--applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java6
5 files changed, 8 insertions, 8 deletions
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslator.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslator.java
index 58bdafa2..d1c6d38c 100644
--- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslator.java
+++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslator.java
@@ -187,7 +187,7 @@ public abstract class StdBaseTranslator implements ToscaPolicyTranslator {
* @throws ToscaPolicyConversionException If there is something missing from the metadata
*/
protected PolicyType fillMetadataSection(PolicyType policy,
- Map<String, String> map) throws ToscaPolicyConversionException {
+ Map<String, Object> map) throws ToscaPolicyConversionException {
//
// Ensure the policy-id exists - we don't use it here. It
// is saved in the TOSCA Policy Name field.
@@ -205,7 +205,7 @@ public abstract class StdBaseTranslator implements ToscaPolicyTranslator {
//
// Add in the Policy Version
//
- policy.setVersion(map.get(POLICY_VERSION));
+ policy.setVersion(String.valueOf(map.get(POLICY_VERSION)));
return policy;
}
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java
index 2a4574eb..64a7db98 100644
--- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java
+++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java
@@ -69,7 +69,7 @@ public class StdCombinedPolicyResultsTranslator extends StdBaseTranslator {
//
// Get the policy Id
//
- String policyId = toscaPolicy.getMetadata().get(POLICY_ID);
+ String policyId = String.valueOf(toscaPolicy.getMetadata().get(POLICY_ID));
//
// Set it as the policy ID
//
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java
index e473de88..732542a2 100644
--- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java
+++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java
@@ -251,7 +251,7 @@ public class StdMatchableTranslator extends StdBaseTranslator implements Matcha
//
// Policy name should be at the root
//
- String policyName = toscaPolicy.getMetadata().get(POLICY_ID);
+ String policyName = String.valueOf(toscaPolicy.getMetadata().get(POLICY_ID));
//
// Set it as the policy ID
//
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java
index 6e60fe75..75af4482 100644
--- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java
+++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java
@@ -254,7 +254,7 @@ public class StdBaseTranslatorTest {
}
private class TestTranslator extends StdBaseTranslator {
- public Map<String, String> metadata = new HashMap<>();
+ public Map<String, Object> metadata = new HashMap<>();
@Override
protected void scanObligations(Collection<Obligation> obligations, DecisionResponse decisionResponse) {
diff --git a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java
index 3aae5fc4..45caf21c 100644
--- a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java
+++ b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslator.java
@@ -129,7 +129,7 @@ public class GuardTranslator implements ToscaPolicyTranslator {
//
// Policy name should be at the root
//
- String policyName = toscaPolicy.getMetadata().get("policy-id");
+ String policyName = String.valueOf(toscaPolicy.getMetadata().get("policy-id"));
//
// Set it as the policy ID
//
@@ -275,14 +275,14 @@ public class GuardTranslator implements ToscaPolicyTranslator {
* @param map The Metadata TOSCA Map
* @return Same Policy Object
*/
- protected PolicyType fillMetadataSection(PolicyType policy, Map<String, String> map) {
+ protected PolicyType fillMetadataSection(PolicyType policy, Map<String, Object> map) {
//
// NOTE: The models code ensures the metadata section ALWAYS exists
//
//
// Add in the Policy Version
//
- policy.setVersion(map.get("policy-version"));
+ policy.setVersion(String.valueOf(map.get("policy-version")));
return policy;
}