From ca2f61793ab1d971414c25c68f9007c7c9abfaac Mon Sep 17 00:00:00 2001 From: liamfallon Date: Mon, 4 Jan 2021 15:58:25 +0000 Subject: 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: I677cc1f8730001b300ab2041f2d57c2485cbc4ed Signed-off-by: liamfallon --- .../onap/policy/drools/domain/models/DomainPolicyTypesTest.java | 9 +++++---- .../drools/domain/models/operational/OperationalPolicyTest.java | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'policy-domains') diff --git a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java index f737766f..e9071a2b 100644 --- a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java +++ b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DomainPolicyTypesTest.java @@ -1,6 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 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. @@ -40,8 +41,8 @@ import org.onap.policy.drools.domain.models.artifact.NativeArtifactProperties; import org.onap.policy.drools.domain.models.artifact.NativeArtifactRulesArtifact; import org.onap.policy.drools.domain.models.controller.ControllerPolicy; import org.onap.policy.drools.policies.DomainMaker; +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.models.tosca.authorative.concepts.ToscaServiceTemplate; public class DomainPolicyTypesTest { @@ -75,8 +76,8 @@ public class DomainPolicyTypesTest { ToscaPolicy toscaPolicy = getExamplesPolicy(EXAMPLE_NATIVE_DROOLS_POLICY_JSON, EXAMPLE_NATIVE_DROOLS_POLICY_NAME); - ToscaPolicyTypeIdentifier policyTypeId = - new ToscaPolicyTypeIdentifier(NATIVE_DROOLS_POLICY_TYPE, "1.0.0"); + ToscaConceptIdentifier policyTypeId = + new ToscaConceptIdentifier(NATIVE_DROOLS_POLICY_TYPE, "1.0.0"); domainMaker.isConformant(policyTypeId, rawNativeDroolsPolicy); assertTrue(domainMaker.isConformant(toscaPolicy)); @@ -116,7 +117,7 @@ public class DomainPolicyTypesTest { assertTrue(domainMaker .isDomainConformant( - new ToscaPolicyTypeIdentifier(domainDroolsPolicy2.getType(), domainDroolsPolicy2.getTypeVersion()), + new ToscaConceptIdentifier(domainDroolsPolicy2.getType(), domainDroolsPolicy2.getTypeVersion()), domainDroolsPolicy2)); } diff --git a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/operational/OperationalPolicyTest.java b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/operational/OperationalPolicyTest.java index 8f37b47c..91e8acc1 100644 --- a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/operational/OperationalPolicyTest.java +++ b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/operational/OperationalPolicyTest.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 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. @@ -31,8 +32,8 @@ import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.drools.domain.models.Metadata; import org.onap.policy.drools.policies.DomainMaker; +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.models.tosca.authorative.concepts.ToscaServiceTemplate; public class OperationalPolicyTest { @@ -58,8 +59,8 @@ public class OperationalPolicyTest { String rawVcpeToscaPolicy = getExamplesPolicyString(VCPE_OPERATIONAL_DROOLS_POLICY_JSON, OP_POLICY_NAME_VCPE); // valid "known" policy type with implicit schema - ToscaPolicyTypeIdentifier operationalCompliantType = - new ToscaPolicyTypeIdentifier(OPERATIONAL_DROOLS_POLICY_TYPE, "1.0.0"); + ToscaConceptIdentifier operationalCompliantType = + new ToscaConceptIdentifier(OPERATIONAL_DROOLS_POLICY_TYPE, "1.0.0"); assertTrue(domainMaker.isConformant(operationalCompliantType, rawVcpeToscaPolicy)); assertNotNull(domainMaker.convertTo(operationalCompliantType, rawVcpeToscaPolicy, OperationalPolicy.class)); } @@ -112,4 +113,4 @@ public class OperationalPolicyTest { private String getExamplesPolicyString(String resourcePath, String policyName) throws CoderException { return nonValCoder.encode(getExamplesPolicy(resourcePath, policyName)); } -} \ No newline at end of file +} -- cgit 1.2.3-korg