diff options
author | liamfallon <liam.fallon@est.tech> | 2021-01-04 13:47:42 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2021-01-04 16:19:42 +0000 |
commit | f4a86b5bc37350c15c62544cea5e22ce7b6f931b (patch) | |
tree | e3ee53a4459a7d690918613399565951014ed71f /applications/guard | |
parent | e15fe6da7b38df5e6003006acc8f166653685d85 (diff) |
Changed identifiers to concept identifiers
The policy models tosca classes ToscaPolicyIdentifier and
ToscaPolicyIdentifierOptVersion can be used to identify any TOSCA
concept, not just TOSCA policies so they are renamed to
ToscaConceptIdentifier and ToscaCinceptIdentifierOptVersion
respectively.
The class ToscaPolicyTypeIdentifier is redundant and is replaced by
ToscaConceptIdentifier.
Issue-ID: POLICY-2900
Change-Id: Id614bbed34ed8897e7e882b70147b98ffe90bf57
Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'applications/guard')
2 files changed, 21 insertions, 19 deletions
diff --git a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplication.java b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplication.java index bb1b7588..1832945c 100644 --- a/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplication.java +++ b/applications/guard/src/main/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplication.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +24,7 @@ package org.onap.policy.xacml.pdp.application.guard; import java.util.Arrays; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.pdp.xacml.application.common.ToscaPolicyTranslator; import org.onap.policy.pdp.xacml.application.common.std.StdXacmlApplicationServiceProvider; import org.slf4j.Logger; @@ -52,30 +53,30 @@ public class GuardPdpApplication extends StdXacmlApplicationServiceProvider { applicationName = "guard"; actions = Arrays.asList("guard"); - this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier( + this.supportedPolicyTypes.add(new ToscaConceptIdentifier( GuardTranslator.POLICYTYPE_FREQUENCY, STRING_VERSION100)); - this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier( + this.supportedPolicyTypes.add(new ToscaConceptIdentifier( GuardTranslator.POLICYTYPE_MINMAX, STRING_VERSION100)); - this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier( + this.supportedPolicyTypes.add(new ToscaConceptIdentifier( GuardTranslator.POLICYTYPE_BLACKLIST, STRING_VERSION100)); - this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier( + this.supportedPolicyTypes.add(new ToscaConceptIdentifier( GuardTranslator.POLICYTYPE_FILTER, STRING_VERSION100)); - this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier( + this.supportedPolicyTypes.add(new ToscaConceptIdentifier( "onap.policies.controlloop.guard.coordination.FirstBlocksSecond", STRING_VERSION100)); } @Override - public boolean canSupportPolicyType(ToscaPolicyTypeIdentifier policyTypeId) { + public boolean canSupportPolicyType(ToscaConceptIdentifier policyTypeId) { // // For the time being, restrict this if the version isn't known. // Could be too difficult to support changing of versions dynamically. // - for (ToscaPolicyTypeIdentifier supported : this.supportedPolicyTypes) { + for (ToscaConceptIdentifier supported : this.supportedPolicyTypes) { if (policyTypeId.equals(supported)) { return true; } diff --git a/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplicationTest.java b/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplicationTest.java index 08495a7e..3b1b1c60 100644 --- a/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplicationTest.java +++ b/applications/guard/src/test/java/org/onap/policy/xacml/pdp/application/guard/GuardPdpApplicationTest.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,8 +56,8 @@ import org.onap.policy.common.utils.resources.TextFileUtils; import org.onap.policy.guard.OperationsHistory; import org.onap.policy.models.decisions.concepts.DecisionRequest; import org.onap.policy.models.decisions.concepts.DecisionResponse; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; import org.onap.policy.pdp.xacml.application.common.XacmlApplicationException; import org.onap.policy.pdp.xacml.application.common.XacmlApplicationServiceProvider; import org.onap.policy.pdp.xacml.application.common.XacmlPolicyUtils; @@ -219,26 +220,26 @@ public class GuardPdpApplicationTest { assertThat(service.supportedPolicyTypes()).isNotEmpty(); assertThat(service.supportedPolicyTypes().size()).isEqualTo(5); assertThat(service.canSupportPolicyType( - new ToscaPolicyTypeIdentifier("onap.policies.controlloop.guard.common.FrequencyLimiter", "1.0.0"))) + new ToscaConceptIdentifier("onap.policies.controlloop.guard.common.FrequencyLimiter", "1.0.0"))) .isTrue(); assertThat(service.canSupportPolicyType( - new ToscaPolicyTypeIdentifier("onap.policies.controlloop.guard.common.FrequencyLimiter", "1.0.1"))) + new ToscaConceptIdentifier("onap.policies.controlloop.guard.common.FrequencyLimiter", "1.0.1"))) .isFalse(); assertThat(service.canSupportPolicyType( - new ToscaPolicyTypeIdentifier("onap.policies.controlloop.guard.common.MinMax", "1.0.0"))).isTrue(); + new ToscaConceptIdentifier("onap.policies.controlloop.guard.common.MinMax", "1.0.0"))).isTrue(); assertThat(service.canSupportPolicyType( - new ToscaPolicyTypeIdentifier("onap.policies.controlloop.guard.common.MinMax", "1.0.1"))).isFalse(); + new ToscaConceptIdentifier("onap.policies.controlloop.guard.common.MinMax", "1.0.1"))).isFalse(); assertThat(service.canSupportPolicyType( - new ToscaPolicyTypeIdentifier("onap.policies.controlloop.guard.common.Blacklist", "1.0.0"))).isTrue(); + new ToscaConceptIdentifier("onap.policies.controlloop.guard.common.Blacklist", "1.0.0"))).isTrue(); assertThat(service.canSupportPolicyType( - new ToscaPolicyTypeIdentifier("onap.policies.controlloop.guard.common.Blacklist", "1.0.1"))).isFalse(); - assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier( + new ToscaConceptIdentifier("onap.policies.controlloop.guard.common.Blacklist", "1.0.1"))).isFalse(); + assertThat(service.canSupportPolicyType(new ToscaConceptIdentifier( "onap.policies.controlloop.guard.coordination.FirstBlocksSecond", "1.0.0"))).isTrue(); - assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier( + assertThat(service.canSupportPolicyType(new ToscaConceptIdentifier( "onap.policies.controlloop.guard.coordination.FirstBlocksSecond", "1.0.1"))).isFalse(); - assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier("onap.foo", "1.0.1"))).isFalse(); + assertThat(service.canSupportPolicyType(new ToscaConceptIdentifier("onap.foo", "1.0.1"))).isFalse(); assertThat(service.canSupportPolicyType( - new ToscaPolicyTypeIdentifier("onap.policies.controlloop.guard.common.Filter", "1.0.0"))).isTrue(); + new ToscaConceptIdentifier("onap.policies.controlloop.guard.common.Filter", "1.0.0"))).isTrue(); } @Test |