diff options
Diffstat (limited to 'models-pdp/src/test')
7 files changed, 79 insertions, 80 deletions
diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroupTest.java index 511d88f27..744c2e892 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroupTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroupTest.java @@ -3,6 +3,7 @@ * ONAP Policy Models * ================================================================================ * Copyright (C) 2019 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. @@ -34,7 +35,7 @@ import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.models.pdp.concepts.DeploymentSubGroup.Action; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Test methods not tested by {@link ModelsTest}. @@ -56,10 +57,10 @@ public class DeploymentSubGroupTest { orig.setPdpType("my-type"); orig.setAction(Action.POST); - final ToscaPolicyIdentifier pol1 = new ToscaPolicyIdentifier(); + final ToscaConceptIdentifier pol1 = new ToscaConceptIdentifier(); pol1.setName("policy-A"); pol1.setVersion("1.0.0"); - final ToscaPolicyIdentifier pol2 = new ToscaPolicyIdentifier(); + final ToscaConceptIdentifier pol2 = new ToscaConceptIdentifier(); pol2.setName("policy-B"); pol1.setVersion("2.0.0"); orig.setPolicies(Arrays.asList(pol1, pol2)); @@ -73,7 +74,7 @@ public class DeploymentSubGroupTest { subgrp.setPdpType("pdp-type"); subgrp.setAction(Action.PATCH); - subgrp.setPolicies(Arrays.asList(makeIdent("policy-X", "4.0.0", ToscaPolicyIdentifier.class))); + subgrp.setPolicies(Arrays.asList(makeIdent("policy-X", "4.0.0", ToscaConceptIdentifier.class))); // valid ValidationResult result = subgrp.validatePapRest(); @@ -103,7 +104,7 @@ public class DeploymentSubGroupTest { // invalid policy item sub2 = new DeploymentSubGroup(subgrp); - sub2.getPolicies().set(0, makeIdent(null, VERSION_300, ToscaPolicyIdentifier.class)); + sub2.getPolicies().set(0, makeIdent(null, VERSION_300, ToscaConceptIdentifier.class)); assertInvalid(sub2); } diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java index 6a0ae6b4e..89a1333ef 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2021 Nordix Foundation. * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -34,8 +34,7 @@ import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.models.pdp.enums.PdpState; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Test of the {@link PdpGroupFilter} class. @@ -174,9 +173,9 @@ public class PdpGroupFilterTest { @Test public void testFilterPolicyType() { - List<ToscaPolicyTypeIdentifier> identifierList = new ArrayList<>(); + List<ToscaConceptIdentifier> identifierList = new ArrayList<>(); - identifierList.add(new ToscaPolicyTypeIdentifier(NON_EXISTANT, VERSION1)); + identifierList.add(new ToscaConceptIdentifier(NON_EXISTANT, VERSION1)); PdpGroupFilter filter = PdpGroupFilter.builder().policyTypeList(identifierList).build(); List<PdpGroup> filteredList = filter.filter(pdpGroupList); @@ -184,7 +183,7 @@ public class PdpGroupFilterTest { identifierList.clear(); // don't match wild cards - identifierList.add(new ToscaPolicyTypeIdentifier(NON_EXISTANT, VERSION1)); + identifierList.add(new ToscaConceptIdentifier(NON_EXISTANT, VERSION1)); filter = PdpGroupFilter.builder().policyTypeList(identifierList).build(); final List<PdpGroup> wildCards = pdpGroupList.stream().map(this::makeWildCardPolicyTypes).collect(Collectors.toList()); @@ -193,42 +192,42 @@ public class PdpGroupFilterTest { identifierList.clear(); // match wild cards - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE0, VERSION1)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE0, VERSION1)); filter = PdpGroupFilter.builder().policyTypeList(identifierList).build(); filteredList = filter.filter(wildCards); assertEquals(4, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE0, VERSION1)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE0, VERSION1)); filter = PdpGroupFilter.builder().policyTypeList(identifierList).build(); filteredList = filter.filter(pdpGroupList); assertEquals(4, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE1, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE1, VERSION4)); filter = PdpGroupFilter.builder().policyTypeList(identifierList).build(); filteredList = filter.filter(pdpGroupList); assertEquals(4, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE2, VERSION7)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE2, VERSION7)); filter = PdpGroupFilter.builder().policyTypeList(identifierList).build(); filteredList = filter.filter(pdpGroupList); assertEquals(2, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE3, VERSION0)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE3, VERSION0)); filter = PdpGroupFilter.builder().policyTypeList(identifierList).build(); filteredList = filter.filter(pdpGroupList); assertEquals(2, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyTypeIdentifier(NON_EXISTANT, VERSION1)); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE0, VERSION9)); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE0, VERSION1)); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE1, VERSION4)); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE2, VERSION7)); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE3, VERSION0)); + identifierList.add(new ToscaConceptIdentifier(NON_EXISTANT, VERSION1)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE0, VERSION9)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE0, VERSION1)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE1, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE2, VERSION7)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE3, VERSION0)); filter = PdpGroupFilter.builder().policyTypeList(identifierList).build(); filteredList = filter.filter(pdpGroupList); assertEquals(5, filteredList.size()); @@ -238,30 +237,30 @@ public class PdpGroupFilterTest { assertEquals(0, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE0, VERSION1)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE0, VERSION1)); filter = PdpGroupFilter.builder().policyTypeList(identifierList).matchPolicyTypesExactly(true).build(); filteredList = filter.filter(pdpGroupList); assertEquals(2, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE0, VERSION1)); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE1, VERSION4)); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE2, VERSION7)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE0, VERSION1)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE1, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE2, VERSION7)); filter = PdpGroupFilter.builder().policyTypeList(identifierList).matchPolicyTypesExactly(true).build(); filteredList = filter.filter(pdpGroupList); assertEquals(1, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE0, VERSION1)); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE1, VERSION4)); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE3, VERSION0)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE0, VERSION1)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE1, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE3, VERSION0)); filter = PdpGroupFilter.builder().policyTypeList(identifierList).matchPolicyTypesExactly(true).build(); filteredList = filter.filter(pdpGroupList); assertEquals(1, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE1, VERSION4)); - identifierList.add(new ToscaPolicyTypeIdentifier(POLICY_TYPE3, VERSION0)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE1, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY_TYPE3, VERSION0)); filter = PdpGroupFilter.builder().policyTypeList(identifierList).matchPolicyTypesExactly(true).build(); filteredList = filter.filter(pdpGroupList); assertEquals(1, filteredList.size()); @@ -278,7 +277,7 @@ public class PdpGroupFilterTest { PdpGroup newGroup = new PdpGroup(group); for (PdpSubGroup subgroup : newGroup.getPdpSubgroups()) { - for (ToscaPolicyTypeIdentifier subType : subgroup.getSupportedPolicyTypes()) { + for (ToscaConceptIdentifier subType : subgroup.getSupportedPolicyTypes()) { if (POLICY_TYPE0.equals(subType.getName())) { subType.setName("policy.type.*"); } @@ -290,51 +289,51 @@ public class PdpGroupFilterTest { @Test public void testFilterPolicy() { - List<ToscaPolicyIdentifier> identifierList = new ArrayList<>(); + List<ToscaConceptIdentifier> identifierList = new ArrayList<>(); - identifierList.add(new ToscaPolicyIdentifier(NON_EXISTANT, VERSION1)); + identifierList.add(new ToscaConceptIdentifier(NON_EXISTANT, VERSION1)); PdpGroupFilter filter = PdpGroupFilter.builder().policyList(identifierList).build(); List<PdpGroup> filteredList = filter.filter(pdpGroupList); assertEquals(0, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyIdentifier(POLICY0, VERSION9)); + identifierList.add(new ToscaConceptIdentifier(POLICY0, VERSION9)); filter = PdpGroupFilter.builder().policyList(identifierList).build(); filteredList = filter.filter(pdpGroupList); assertEquals(0, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyIdentifier(POLICY0, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY0, VERSION4)); filter = PdpGroupFilter.builder().policyList(identifierList).build(); filteredList = filter.filter(pdpGroupList); assertEquals(4, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyIdentifier(POLICY1, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY1, VERSION4)); filter = PdpGroupFilter.builder().policyList(identifierList).build(); filteredList = filter.filter(pdpGroupList); assertEquals(1, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyIdentifier(POLICY2, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY2, VERSION4)); filter = PdpGroupFilter.builder().policyList(identifierList).build(); filteredList = filter.filter(pdpGroupList); assertEquals(2, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyIdentifier(POLICY3, VERSION1)); + identifierList.add(new ToscaConceptIdentifier(POLICY3, VERSION1)); filter = PdpGroupFilter.builder().policyList(identifierList).build(); filteredList = filter.filter(pdpGroupList); assertEquals(1, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyIdentifier(NON_EXISTANT, VERSION1)); - identifierList.add(new ToscaPolicyIdentifier(POLICY0, VERSION9)); - identifierList.add(new ToscaPolicyIdentifier(POLICY0, VERSION4)); - identifierList.add(new ToscaPolicyIdentifier(POLICY1, VERSION4)); - identifierList.add(new ToscaPolicyIdentifier(POLICY2, VERSION4)); - identifierList.add(new ToscaPolicyIdentifier(POLICY3, VERSION1)); + identifierList.add(new ToscaConceptIdentifier(NON_EXISTANT, VERSION1)); + identifierList.add(new ToscaConceptIdentifier(POLICY0, VERSION9)); + identifierList.add(new ToscaConceptIdentifier(POLICY0, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY1, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY2, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY3, VERSION1)); filter = PdpGroupFilter.builder().policyList(identifierList).build(); filteredList = filter.filter(pdpGroupList); assertEquals(5, filteredList.size()); @@ -344,27 +343,27 @@ public class PdpGroupFilterTest { assertEquals(0, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyIdentifier(POLICY0, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY0, VERSION4)); filter = PdpGroupFilter.builder().policyList(identifierList).matchPoliciesExactly(true).build(); filteredList = filter.filter(pdpGroupList); assertEquals(3, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyIdentifier(POLICY0, VERSION4)); - identifierList.add(new ToscaPolicyIdentifier(POLICY1, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY0, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY1, VERSION4)); filter = PdpGroupFilter.builder().policyList(identifierList).matchPoliciesExactly(true).build(); filteredList = filter.filter(pdpGroupList); assertEquals(1, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyIdentifier(POLICY2, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY2, VERSION4)); filter = PdpGroupFilter.builder().policyList(identifierList).matchPoliciesExactly(true).build(); filteredList = filter.filter(pdpGroupList); assertEquals(1, filteredList.size()); identifierList.clear(); - identifierList.add(new ToscaPolicyIdentifier(POLICY2, VERSION4)); - identifierList.add(new ToscaPolicyIdentifier(POLICY3, VERSION1)); + identifierList.add(new ToscaConceptIdentifier(POLICY2, VERSION4)); + identifierList.add(new ToscaConceptIdentifier(POLICY3, VERSION1)); filter = PdpGroupFilter.builder().policyList(identifierList).matchPoliciesExactly(true).build(); filteredList = filter.filter(pdpGroupList); assertEquals(1, filteredList.size()); diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java index 0ede98064..ae88f50f9 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java @@ -3,7 +3,7 @@ * ONAP Policy Models * ================================================================================ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2019-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. @@ -38,7 +38,7 @@ import java.util.TreeMap; import org.junit.Test; import org.onap.policy.common.parameters.ValidationResult; import org.onap.policy.models.pdp.enums.PdpState; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Test methods not tested by {@link ModelsTest}. @@ -129,7 +129,7 @@ public class PdpGroupTest { PdpSubGroup subgroup1 = new PdpSubGroup(); subgroup1.setDesiredInstanceCount(1); subgroup1.setPdpType(PDP_TYPE1); - subgroup1.setSupportedPolicyTypes(Arrays.asList(new ToscaPolicyTypeIdentifier("a-type-name", "3.2.1"))); + subgroup1.setSupportedPolicyTypes(Arrays.asList(new ToscaConceptIdentifier("a-type-name", "3.2.1"))); subgroup1.setPolicies(Collections.emptyList()); group.setPdpSubgroups(Arrays.asList(subgroup1)); @@ -165,7 +165,7 @@ public class PdpGroupTest { PdpSubGroup subgroup1 = new PdpSubGroup(); subgroup1.setDesiredInstanceCount(1); subgroup1.setPdpType(PDP_TYPE1); - subgroup1.setSupportedPolicyTypes(Arrays.asList(new ToscaPolicyTypeIdentifier("a-type-name", "3.2.1"))); + subgroup1.setSupportedPolicyTypes(Arrays.asList(new ToscaConceptIdentifier("a-type-name", "3.2.1"))); subgroup1.setPolicies(Collections.emptyList()); PdpSubGroup subgroup2 = new PdpSubGroup(subgroup1); diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java index bd98f18c3..5cf7c1340 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java @@ -3,6 +3,7 @@ * ONAP Policy Models * ================================================================================ * Copyright (C) 2019 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. @@ -34,7 +35,7 @@ import java.util.List; import java.util.Map; import org.junit.Test; import org.onap.policy.common.parameters.ValidationResult; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; public class PdpGroupsTest { @@ -46,7 +47,7 @@ public class PdpGroupsTest { PdpSubGroup subgrp = new PdpSubGroup(); subgrp.setDesiredInstanceCount(1); subgrp.setPdpType("pdp-type"); - subgrp.setSupportedPolicyTypes(Arrays.asList(new ToscaPolicyTypeIdentifier("policy-type", "9.8.7"))); + subgrp.setSupportedPolicyTypes(Arrays.asList(new ToscaConceptIdentifier("policy-type", "9.8.7"))); subgrp.setPolicies(Collections.emptyList()); group1.setPdpSubgroups(Arrays.asList(subgrp)); diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatusTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatusTest.java index 79f15b980..90b8d43c7 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatusTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatusTest.java @@ -3,7 +3,7 @@ * ONAP Policy Models * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-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. @@ -30,7 +30,7 @@ import java.util.Collections; import org.junit.Test; import org.onap.policy.models.pdp.enums.PdpHealthStatus; import org.onap.policy.models.pdp.enums.PdpState; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; public class PdpStatusTest { @@ -52,7 +52,7 @@ public class PdpStatusTest { orig.setPdpGroup("my-group"); orig.setPdpSubgroup("my-subgroup"); orig.setPdpType("my-type"); - orig.setPolicies(Arrays.asList(new ToscaPolicyIdentifier("policy-A", "1.0.0"))); + orig.setPolicies(Arrays.asList(new ToscaConceptIdentifier("policy-A", "1.0.0"))); orig.setProperties("my-properties"); final PdpResponseDetails resp = new PdpResponseDetails(); diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java index ba55426c7..7d3d4ab92 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java @@ -3,7 +3,7 @@ * ONAP Policy Models * ================================================================================ * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019-2020 Nordix Foundation. + * Modifications Copyright (C) 2019-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. @@ -37,8 +37,7 @@ import org.onap.policy.common.parameters.ValidationResult; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Test methods not tested by {@link ModelsTest}. @@ -70,10 +69,10 @@ public class PdpSubGroupTest { orig.setPdpType("my-type"); - final ToscaPolicyIdentifier pol1 = new ToscaPolicyIdentifier(); + final ToscaConceptIdentifier pol1 = new ToscaConceptIdentifier(); pol1.setName("policy-A"); pol1.setVersion("1.0.0"); - final ToscaPolicyIdentifier pol2 = new ToscaPolicyIdentifier(); + final ToscaConceptIdentifier pol2 = new ToscaConceptIdentifier(); pol2.setName("policy-B"); pol1.setVersion("2.0.0"); orig.setPolicies(Arrays.asList(pol1, pol2)); @@ -83,8 +82,8 @@ public class PdpSubGroupTest { props.put("key-B", "value-B"); orig.setProperties(props); - final ToscaPolicyTypeIdentifier supp1 = new ToscaPolicyTypeIdentifier("supp-A", "1.2"); - final ToscaPolicyTypeIdentifier supp2 = new ToscaPolicyTypeIdentifier("supp-B", "3.4"); + final ToscaConceptIdentifier supp1 = new ToscaConceptIdentifier("supp-A", "1.2"); + final ToscaConceptIdentifier supp2 = new ToscaConceptIdentifier("supp-B", "3.4"); orig.setSupportedPolicyTypes(Arrays.asList(supp1, supp2)); assertEquals(orig.toString(), new PdpSubGroup(orig).toString()); @@ -97,8 +96,8 @@ public class PdpSubGroupTest { subgrp.setDesiredInstanceCount(1); subgrp.setPdpType("pdp-type"); subgrp.setSupportedPolicyTypes( - Arrays.asList(makeIdent("type-X", VERSION_300, ToscaPolicyTypeIdentifier.class))); - subgrp.setPolicies(Arrays.asList(makeIdent("policy-X", "4.0.0", ToscaPolicyIdentifier.class))); + Arrays.asList(makeIdent("type-X", VERSION_300, ToscaConceptIdentifier.class))); + subgrp.setPolicies(Arrays.asList(makeIdent("policy-X", "4.0.0", ToscaConceptIdentifier.class))); ValidationResult result = subgrp.validatePapRest(false); assertNotNull(result); @@ -130,8 +129,8 @@ public class PdpSubGroupTest { subgrp.setDesiredInstanceCount(1); subgrp.setPdpType("pdp-type"); subgrp.setSupportedPolicyTypes( - Arrays.asList(makeIdent("type-X", VERSION_300, ToscaPolicyTypeIdentifier.class))); - subgrp.setPolicies(Arrays.asList(makeIdent("policy-X", "4.0.0", ToscaPolicyIdentifier.class))); + Arrays.asList(makeIdent("type-X", VERSION_300, ToscaConceptIdentifier.class))); + subgrp.setPolicies(Arrays.asList(makeIdent("policy-X", "4.0.0", ToscaConceptIdentifier.class))); // valid ValidationResult result = subgrp.validatePapRest(false); @@ -171,7 +170,7 @@ public class PdpSubGroupTest { // invalid policy type item sub2 = new PdpSubGroup(subgrp); - sub2.getSupportedPolicyTypes().set(0, makeIdent(null, VERSION_300, ToscaPolicyTypeIdentifier.class)); + sub2.getSupportedPolicyTypes().set(0, makeIdent(null, VERSION_300, ToscaConceptIdentifier.class)); assertInvalid(sub2); // null policies @@ -186,7 +185,7 @@ public class PdpSubGroupTest { // invalid policy item sub2 = new PdpSubGroup(subgrp); - sub2.getPolicies().set(0, makeIdent(null, VERSION_300, ToscaPolicyIdentifier.class)); + sub2.getPolicies().set(0, makeIdent(null, VERSION_300, ToscaConceptIdentifier.class)); assertInvalid(sub2); } diff --git a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java index cad1357b9..d57204adf 100644 --- a/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java +++ b/models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019-2021 Nordix Foundation. * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -49,8 +49,7 @@ import org.onap.policy.models.pdp.concepts.PdpStatistics; import org.onap.policy.models.pdp.concepts.PdpSubGroup; import org.onap.policy.models.pdp.enums.PdpHealthStatus; import org.onap.policy.models.pdp.enums.PdpState; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.simple.provider.SimpleToscaProvider; /** @@ -153,11 +152,11 @@ public class PdpProviderTest { assertEquals(5, new PdpProvider().createPdpGroups(pfDao, pdpGroups0.getGroups()).size()); - List<ToscaPolicyTypeIdentifier> policyTypeList = new ArrayList<>(); - policyTypeList.add(new ToscaPolicyTypeIdentifier("policy.type.0", "1.2.3")); + List<ToscaConceptIdentifier> policyTypeList = new ArrayList<>(); + policyTypeList.add(new ToscaConceptIdentifier("policy.type.0", "1.2.3")); - List<ToscaPolicyIdentifier> policyList = new ArrayList<>(); - policyList.add(new ToscaPolicyIdentifier("Policy0", "4.5.6")); + List<ToscaConceptIdentifier> policyList = new ArrayList<>(); + policyList.add(new ToscaConceptIdentifier("Policy0", "4.5.6")); // @formatter:off final PdpGroupFilter filter = PdpGroupFilter.builder() |