diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2019-07-03 14:29:37 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2019-07-03 14:38:18 -0400 |
commit | dc6afa16a2b9fbd19373a1e2ca5859df2782dcb6 (patch) | |
tree | c5dd6428ad3abdeb6f4135d096ee5ba1e1adedee /applications/common/src/main/java | |
parent | 369435c42225f030a729b23ce0a9f01d288deed3 (diff) |
Fix xacml decision policy-type
Wrong attribute id was being used. Added info logging statement
to assist in debugging. Added JUnit to support this.
Issue-ID: POLICY-1843
Change-Id: I11d83574f91751804a45281d2e0c9cd3150e30eb
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'applications/common/src/main/java')
2 files changed, 6 insertions, 5 deletions
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyRequest.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyRequest.java index 3038b651..1acf741a 100644 --- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyRequest.java +++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyRequest.java @@ -26,7 +26,6 @@ import com.att.research.xacml.std.annotations.XACMLAction; import com.att.research.xacml.std.annotations.XACMLRequest; import com.att.research.xacml.std.annotations.XACMLResource; import com.att.research.xacml.std.annotations.XACMLSubject; - import java.util.ArrayList; import java.util.Collection; import java.util.Map; @@ -59,6 +58,9 @@ public class StdCombinedPolicyRequest { @XACMLResource(includeInResults = true) private Collection<String> resource = new ArrayList<>(); + @XACMLResource(attributeId = "urn:org:onap:policy-type", includeInResults = true) + private Collection<String> resourcePolicyType = new ArrayList<>(); + public StdCombinedPolicyRequest() { super(); } @@ -102,7 +104,7 @@ public class StdCombinedPolicyRequest { if (entrySet.getValue() instanceof Collection) { addPolicyTypes(request, (Collection) entrySet.getValue()); } else if (entrySet.getValue() instanceof String) { - request.resource.add(entrySet.getValue().toString()); + request.resourcePolicyType.add(entrySet.getValue().toString()); } } } @@ -118,7 +120,7 @@ public class StdCombinedPolicyRequest { private static StdCombinedPolicyRequest addPolicyTypes(StdCombinedPolicyRequest request, Collection<Object> types) { for (Object type : types) { - request.resource.add(type.toString()); + request.resourcePolicyType.add(type.toString()); } return request; } 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 2d7386d9..bd10fb2e 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 @@ -32,7 +32,6 @@ import com.att.research.xacml.api.Result; import com.att.research.xacml.api.XACML3; import com.att.research.xacml.std.annotations.RequestParser; import com.google.gson.Gson; - import java.util.Collection; import java.util.HashMap; import java.util.Map; @@ -143,7 +142,7 @@ public class StdCombinedPolicyResultsTranslator implements ToscaPolicyTranslator @Override public DecisionResponse convertResponse(Response xacmlResponse) { - LOGGER.debug("Converting Response {}", xacmlResponse); + LOGGER.info("Converting Response {}", xacmlResponse); DecisionResponse decisionResponse = new DecisionResponse(); // // Setup policies |