diff options
Diffstat (limited to 'applications/guard/src/test')
-rw-r--r-- | applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardTranslatorTest.java | 12 | ||||
-rw-r--r-- | applications/guard/src/test/resources/test-bad-policies.yaml | 11 |
2 files changed, 20 insertions, 3 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) { diff --git a/applications/guard/src/test/resources/test-bad-policies.yaml b/applications/guard/src/test/resources/test-bad-policies.yaml index 07040c54..eb39aded 100644 --- a/applications/guard/src/test/resources/test-bad-policies.yaml +++ b/applications/guard/src/test/resources/test-bad-policies.yaml @@ -5,6 +5,8 @@ topology_template: type: onap.policies.controlloop.guard.common.FrequencyLimiter type_version: 1.0.0 version: 1.0.0 + properties: + badProperty: badValue - frequency-timewindow: type: onap.policies.controlloop.guard.common.FrequencyLimiter type_version: 1.0.0 @@ -16,7 +18,8 @@ topology_template: type: onap.policies.controlloop.guard.common.MinMax type_version: 1.0.0 version: 1.0.0 - properties: null + properties: + badProperty: badValue - minmax-nominmax: type: onap.policies.controlloop.guard.common.MinMax type_version: 1.0.0 @@ -27,12 +30,14 @@ topology_template: type: onap.policies.controlloop.guard.common.Blacklist type_version: 1.0.0 version: 1.0.0 - properties: null + properties: + badProperty: badValue - filter-noalgorithm: type: onap.policies.controlloop.guard.common.Filter type_version: 1.0.0 version: 1.0.0 - properties: null + properties: + badProperty: badValue - filter-badalgorithm: type: onap.policies.controlloop.guard.common.Filter type_version: 1.0.0 |