aboutsummaryrefslogtreecommitdiffstats
path: root/applications/native/src
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-12-17 16:57:10 +0000
committerliamfallon <liam.fallon@est.tech>2020-12-21 16:30:57 +0000
commit30ead499d80c3c6cf6433c6a1e9fb4693d109ab1 (patch)
treeb0d48259a5ca139080be351ca64d69bc00b591c0 /applications/native/src
parent0bd8066788769079f098f6f831919b2c639520a0 (diff)
XACML to accept properties as null
xacml-pdp expects the property map to exist in all policies, even if it is sometimes empty. Now, the propperty map can be null. The code is updated to cope with a null property map. Issue-ID: POLICY-2900 Change-Id: Ie31a2770aff1435a1d1064512d0c2fa2088d3183 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'applications/native/src')
-rw-r--r--applications/native/src/main/java/org/onap/policy/xacml/pdp/application/native/NativePdpApplication.java (renamed from applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplication.java)0
-rw-r--r--applications/native/src/main/java/org/onap/policy/xacml/pdp/application/native/NativePdpApplicationTranslator.java (renamed from applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTranslator.java)6
-rw-r--r--applications/native/src/test/java/org/onap/policy/xacml/pdp/application/native/NativePdpApplicationTest.java (renamed from applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java)0
3 files changed, 4 insertions, 2 deletions
diff --git a/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplication.java b/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/native/NativePdpApplication.java
index f8248f1c..f8248f1c 100644
--- a/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplication.java
+++ b/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/native/NativePdpApplication.java
diff --git a/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTranslator.java b/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/native/NativePdpApplicationTranslator.java
index 5ce25fac..34ef1462 100644
--- a/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTranslator.java
+++ b/applications/native/src/main/java/org/onap/policy/xacml/pdp/application/native/NativePdpApplicationTranslator.java
@@ -3,6 +3,7 @@
* ONAP
* ================================================================================
* Copyright (C) 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,6 +31,7 @@ import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
import java.util.Map;
+import org.apache.commons.collections4.MapUtils;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
@@ -86,7 +88,7 @@ public class NativePdpApplicationTranslator implements ToscaPolicyTranslator {
private String getNativeXacmlPolicy(ToscaPolicy toscaPolicy) throws ToscaPolicyConversionException {
Map<String, Object> propertyMap = toscaPolicy.getProperties();
- if (propertyMap.isEmpty() || !propertyMap.containsKey(POLICY)) {
+ if (MapUtils.isEmpty(propertyMap) || !propertyMap.containsKey(POLICY)) {
throw new ToscaPolicyConversionException("no xacml native policy found in the tosca policy");
}
@@ -107,4 +109,4 @@ public class NativePdpApplicationTranslator implements ToscaPolicyTranslator {
//
return null;
}
-} \ No newline at end of file
+}
diff --git a/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java b/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/native/NativePdpApplicationTest.java
index f434e80f..f434e80f 100644
--- a/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/nativ/NativePdpApplicationTest.java
+++ b/applications/native/src/test/java/org/onap/policy/xacml/pdp/application/native/NativePdpApplicationTest.java