diff options
author | 2020-12-17 16:57:10 +0000 | |
---|---|---|
committer | 2020-12-21 16:30:57 +0000 | |
commit | 30ead499d80c3c6cf6433c6a1e9fb4693d109ab1 (patch) | |
tree | b0d48259a5ca139080be351ca64d69bc00b591c0 /applications/guard/src/test/java | |
parent | 0bd8066788769079f098f6f831919b2c639520a0 (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/guard/src/test/java')
-rw-r--r-- | applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslatorTest.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslatorTest.java b/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslatorTest.java index 7e5e3ed5..e4c958b9 100644 --- a/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslatorTest.java +++ b/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslatorTest.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. @@ -35,6 +36,7 @@ import com.att.research.xacml.std.StdStatusCode; import com.att.research.xacml.util.XACMLPolicyWriter; import java.io.ByteArrayOutputStream; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AllOfType; import oasis.names.tc.xacml._3_0.core.schema.wd_17.AnyOfType; @@ -204,6 +206,16 @@ public class GuardTranslatorTest { } } } + + ToscaPolicy testPol = completedJtst.getToscaTopologyTemplate().getPolicies().get(0).values().iterator().next(); + + testPol.setProperties(new LinkedHashMap<>()); + assertThatExceptionOfType(ToscaPolicyConversionException.class) + .isThrownBy(() -> translator.convertPolicy(testPol)); + + testPol.setProperties(null); + assertThatExceptionOfType(ToscaPolicyConversionException.class) + .isThrownBy(() -> translator.convertPolicy(testPol)); } private void validateCommon(ToscaPolicy policy, PolicyType xacmlPolicy) { |