summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models-pap/src/main/java/org/onap/policy/models/pap/concepts/PapPolicyIdentifier.java62
-rw-r--r--models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpDeployPolicies.java37
-rw-r--r--models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyStatus.java14
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/PapPolicyIdentifierTest.java78
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpDeployPoliciesTest.java90
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyStatusTest.java8
-rw-r--r--models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestModels.java23
-rw-r--r--models-pap/src/test/resources/json/PapPoliciesList.json16
-rw-r--r--models-pap/src/test/resources/json/PapPolicyIdentifier.json4
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java9
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java19
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java8
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java17
-rw-r--r--models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java13
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroupTest.java11
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupFilterTest.java91
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupTest.java8
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpGroupsTest.java5
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpStatusTest.java6
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/concepts/PdpSubGroupTest.java25
-rw-r--r--models-pdp/src/test/java/org/onap/policy/models/pdp/persistence/provider/PdpProviderTest.java13
-rw-r--r--models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java13
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java93
-rw-r--r--models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpMessageHandler.java10
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifier.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyIdentifier.java)17
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifierOptVersion.java (renamed from models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyIdentifierOptVersion.java)21
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java10
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeIdentifier.java92
-rw-r--r--models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java10
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifierOptVersionTest.java (renamed from models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyIdentifierOptVersionTest.java)29
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyConceptIdentifierTest.java (renamed from models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeIdentifierTest.java)25
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTest.java6
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeConceptIdentifierTest.java (renamed from models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyIdentifierTest.java)25
33 files changed, 543 insertions, 365 deletions
diff --git a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PapPolicyIdentifier.java b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PapPolicyIdentifier.java
new file mode 100644
index 000000000..7bd78a222
--- /dev/null
+++ b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PapPolicyIdentifier.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Models
+ * ================================================================================
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.models.pap.concepts;
+
+import com.google.gson.annotations.SerializedName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.NonNull;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion;
+
+/**
+ * Policy identifier with an optional version; only the "name" is required.
+ *
+ * <p>Note that there are deliberately no setters or getters on this class, it is use purely for GSON serialization and
+ * deserializaiton
+ */
+public class PapPolicyIdentifier {
+ @NonNull
+ @ApiModelProperty(name = "policy-id")
+ @SerializedName("policy-id")
+ private String name;
+
+ @ApiModelProperty(name = "policy-version")
+ @SerializedName("policy-version")
+ private String version;
+
+ public PapPolicyIdentifier(final String name, final String version) {
+ this.name = name;
+ this.version = version;
+ }
+
+ public PapPolicyIdentifier(@NonNull final ToscaConceptIdentifier identifier) {
+ this(identifier.getName(), identifier.getVersion());
+ }
+
+ public PapPolicyIdentifier(@NonNull final ToscaConceptIdentifierOptVersion identifier) {
+ this(identifier.getName(), identifier.getVersion());
+ }
+
+ public ToscaConceptIdentifierOptVersion getGenericIdentifier() {
+ return name == null ? new ToscaConceptIdentifierOptVersion()
+ : new ToscaConceptIdentifierOptVersion(name, version);
+ }
+}
diff --git a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpDeployPolicies.java b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpDeployPolicies.java
index 7bc8892f2..6ab41ddf8 100644
--- a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpDeployPolicies.java
+++ b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PdpDeployPolicies.java
@@ -1,8 +1,9 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* 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.
@@ -21,19 +22,35 @@
package org.onap.policy.models.pap.concepts;
import java.util.List;
-import lombok.Getter;
-import lombok.Setter;
+import java.util.stream.Collectors;
import lombok.ToString;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifierOptVersion;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion;
/**
- * Request deploy or update a set of policies using the <i>simple</i> PDP Group deployment
- * REST API. Only the "name" and "version" fields of a Policy are used, and only the
- * "name" field is actually required.
+ * Request deploy or update a set of policies using the <i>simple</i> PDP Group deployment REST API. Only the "name" and
+ * "version" fields of a Policy are used, and only the "name" field is actually required.
*/
-@Getter
-@Setter
@ToString
public class PdpDeployPolicies {
- private List<ToscaPolicyIdentifierOptVersion> policies;
+ private List<PapPolicyIdentifier> policies;
+
+ /**
+ * Get the identifiers of the policies on the list.
+ *
+ * @return The list of identifiers
+ */
+ public List<ToscaConceptIdentifierOptVersion> getPolicies() {
+ return policies == null ? null
+ : policies.stream().map(PapPolicyIdentifier::getGenericIdentifier).collect(Collectors.toList());
+ }
+
+ /**
+ * Set the identifiers of the policies on the list.
+ *
+ * @param policies The list of identifiers
+ */
+ public void setPolicies(final List<ToscaConceptIdentifierOptVersion> policies) {
+ this.policies =
+ policies == null ? null : policies.stream().map(PapPolicyIdentifier::new).collect(Collectors.toList());
+ }
}
diff --git a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyStatus.java b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyStatus.java
index 427f168ea..b05af9204 100644
--- a/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyStatus.java
+++ b/models-pap/src/main/java/org/onap/policy/models/pap/concepts/PolicyStatus.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* 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.
@@ -21,8 +22,7 @@ package org.onap.policy.models.pap.concepts;
import com.google.gson.annotations.SerializedName;
import lombok.Data;
import lombok.NoArgsConstructor;
-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;
@Data
@NoArgsConstructor
@@ -66,18 +66,18 @@ public class PolicyStatus {
* @param policy policy identifier, from which the name and version are to be
* extracted
*/
- public PolicyStatus(ToscaPolicyTypeIdentifier policyType, ToscaPolicyIdentifier policy) {
+ public PolicyStatus(ToscaConceptIdentifier policyType, ToscaConceptIdentifier policy) {
this.policyTypeId = policyType.getName();
this.policyTypeVersion = policyType.getVersion();
this.policyId = policy.getName();
this.policyVersion = policy.getVersion();
}
- public ToscaPolicyTypeIdentifier getPolicyType() {
- return new ToscaPolicyTypeIdentifier(policyTypeId, policyTypeVersion);
+ public ToscaConceptIdentifier getPolicyType() {
+ return new ToscaConceptIdentifier(policyTypeId, policyTypeVersion);
}
- public ToscaPolicyIdentifier getPolicy() {
- return new ToscaPolicyIdentifier(policyId, policyVersion);
+ public ToscaConceptIdentifier getPolicy() {
+ return new ToscaConceptIdentifier(policyId, policyVersion);
}
}
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PapPolicyIdentifierTest.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PapPolicyIdentifierTest.java
new file mode 100644
index 000000000..2ab315ddd
--- /dev/null
+++ b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PapPolicyIdentifierTest.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.models.pap.concepts;
+
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.io.IOException;
+import org.junit.Test;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.resources.TextFileUtils;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion;
+
+/**
+ * This only tests the methods that aren't already tested via TestModels.
+ */
+public class PapPolicyIdentifierTest {
+
+ @Test
+ public void testPapPolicyIdentifier() throws CoderException {
+ assertNotNull(new PapPolicyIdentifier("Name", "Version"));
+ assertNotNull(new PapPolicyIdentifier("Name", null));
+ assertNotNull(new PapPolicyIdentifier(null, null));
+
+ assertNotNull(new PapPolicyIdentifier(new ToscaConceptIdentifier("Name", "Version")));
+ assertNotNull(new PapPolicyIdentifier(new ToscaConceptIdentifierOptVersion("Name", "Version")));
+
+ assertThatThrownBy(() -> new PapPolicyIdentifier((ToscaConceptIdentifier) null))
+ .isInstanceOf(NullPointerException.class);
+
+ assertThatThrownBy(() -> new PapPolicyIdentifier((ToscaConceptIdentifierOptVersion) null))
+ .isInstanceOf(NullPointerException.class);
+
+ PapPolicyIdentifier ppi = new PapPolicyIdentifier("myname", "1.2.3");
+
+ assertEquals("myname", ppi.getGenericIdentifier().getName());
+ assertEquals("1.2.3", ppi.getGenericIdentifier().getVersion());
+
+ PapPolicyIdentifier ppi2 = new PapPolicyIdentifier(null, null);
+ assertNull(ppi2.getGenericIdentifier().getName());
+ assertNull(ppi2.getGenericIdentifier().getVersion());
+ }
+
+ @Test
+ public void testPapPolicyIdentifierSerialization() throws CoderException, IOException {
+ String idString = TextFileUtils.getTextFileAsString("src/test/resources/json/PapPolicyIdentifier.json");
+
+ StandardCoder coder = new StandardCoder();
+
+ PapPolicyIdentifier ppi = coder.decode(idString, PapPolicyIdentifier.class);
+
+ assertEquals("MyPolicy", ppi.getGenericIdentifier().getName());
+ assertEquals("1.2.6", ppi.getGenericIdentifier().getVersion());
+
+ String idStringBack = coder.encode(ppi);
+ assertEquals(idString.replaceAll("\\s+", ""), idStringBack.replaceAll("\\s+", ""));
+ }
+}
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpDeployPoliciesTest.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpDeployPoliciesTest.java
new file mode 100644
index 000000000..3664cc39c
--- /dev/null
+++ b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PdpDeployPoliciesTest.java
@@ -0,0 +1,90 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.models.pap.concepts;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.resources.TextFileUtils;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifierOptVersion;
+
+/**
+ * This only tests the methods that aren't already tested via TestModels.
+ */
+public class PdpDeployPoliciesTest {
+ @Test
+ public void testPapPolicyIdentifier() throws CoderException, IOException {
+ assertNotNull(new PdpDeployPolicies());
+
+ List<ToscaConceptIdentifierOptVersion> tciListIn = new ArrayList<>();
+
+ ToscaConceptIdentifierOptVersion tci0 = new ToscaConceptIdentifierOptVersion("MyPolicy0", "1.2.0");
+ tciListIn.add(tci0);
+ ToscaConceptIdentifierOptVersion tci1 = new ToscaConceptIdentifierOptVersion("MyPolicy1", "1.2.1");
+ tciListIn.add(tci1);
+ ToscaConceptIdentifierOptVersion tci2 = new ToscaConceptIdentifierOptVersion("MyPolicy2", "1.2.2");
+ tciListIn.add(tci2);
+
+ PdpDeployPolicies policies = new PdpDeployPolicies();
+ policies.setPolicies(null);
+ assertNull(policies.getPolicies());
+
+ policies.setPolicies(tciListIn);
+
+ assertEquals(3, policies.getPolicies().size());
+
+ assertEquals("MyPolicy0", policies.getPolicies().get(0).getName());
+ assertEquals("1.2.0", policies.getPolicies().get(0).getVersion());
+ assertEquals("MyPolicy1", policies.getPolicies().get(1).getName());
+ assertEquals("1.2.1", policies.getPolicies().get(1).getVersion());
+ assertEquals("MyPolicy2", policies.getPolicies().get(2).getName());
+ assertEquals("1.2.2", policies.getPolicies().get(2).getVersion());
+
+ List<ToscaConceptIdentifierOptVersion> tciListOut = policies.getPolicies();
+ assertEquals(tciListIn, tciListOut);
+ }
+
+ @Test
+ public void testPapPolicyIdentifierSerialization() throws CoderException, IOException {
+ String idListString = TextFileUtils.getTextFileAsString("src/test/resources/json/PapPoliciesList.json");
+
+ StandardCoder coder = new StandardCoder();
+
+ PdpDeployPolicies policies = coder.decode(idListString, PdpDeployPolicies.class);
+
+ assertEquals(3, policies.getPolicies().size());
+
+ assertEquals("MyPolicy0", policies.getPolicies().get(0).getName());
+ assertEquals("1.2.0", policies.getPolicies().get(0).getVersion());
+ assertEquals("MyPolicy1", policies.getPolicies().get(1).getName());
+ assertEquals("1.2.1", policies.getPolicies().get(1).getVersion());
+ assertEquals("MyPolicy2", policies.getPolicies().get(2).getName());
+ assertEquals("1.2.2", policies.getPolicies().get(2).getVersion());
+
+ String idListStringBack = coder.encode(policies);
+ assertEquals(idListString.replaceAll("\\s+", ""), idListStringBack.replaceAll("\\s+", ""));
+ }
+}
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyStatusTest.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyStatusTest.java
index 869bd1dbf..997c30414 100644
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyStatusTest.java
+++ b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/PolicyStatusTest.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* 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.
@@ -23,8 +24,7 @@ import static org.junit.Assert.assertEquals;
import org.junit.Test;
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;
/**
* This only tests the methods that aren't already tested via TestModels.
@@ -33,8 +33,8 @@ public class PolicyStatusTest {
@Test
public void test() throws CoderException {
- ToscaPolicyTypeIdentifier type = new ToscaPolicyTypeIdentifier("my-type", "3.2.1");
- ToscaPolicyIdentifier policy = new ToscaPolicyIdentifier("my-name", "1.2.3");
+ ToscaConceptIdentifier type = new ToscaConceptIdentifier("my-type", "3.2.1");
+ ToscaConceptIdentifier policy = new ToscaConceptIdentifier("my-name", "1.2.3");
// test constructor with arguments
PolicyStatus status = new PolicyStatus(type, policy);
diff --git a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestModels.java b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestModels.java
index ae41a5c4f..1658ccbd0 100644
--- a/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestModels.java
+++ b/models-pap/src/test/java/org/onap/policy/models/pap/concepts/TestModels.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * 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.
@@ -20,11 +20,13 @@
package org.onap.policy.models.pap.concepts;
-import com.openpojo.reflection.filters.FilterPackageInfo;
+import com.openpojo.reflection.PojoClass;
+import com.openpojo.reflection.impl.PojoClassFactory;
import com.openpojo.validation.Validator;
import com.openpojo.validation.ValidatorBuilder;
import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
+import java.util.List;
import org.junit.Test;
import org.onap.policy.common.utils.test.ToStringTester;
@@ -37,8 +39,19 @@ public class TestModels {
@Test
public void testPapModels() {
- final Validator validator = ValidatorBuilder.create().with(new ToStringTester()).with(new SetterTester())
- .with(new GetterTester()).build();
- validator.validate(TestModels.class.getPackage().getName(), new FilterPackageInfo());
+ List<PojoClass> pojoClasses = PojoClassFactory.getPojoClasses(TestModels.class.getPackage().getName());
+
+ // @formatter:off
+ final Validator validator =
+ ValidatorBuilder.create()
+ .with(new ToStringTester())
+ .with(new SetterTester())
+ .with(new GetterTester())
+ .build();
+ // @formatter:on
+
+ pojoClasses.remove(PojoClassFactory.getPojoClass(PdpDeployPolicies.class));
+
+ validator.validate(pojoClasses);
}
}
diff --git a/models-pap/src/test/resources/json/PapPoliciesList.json b/models-pap/src/test/resources/json/PapPoliciesList.json
new file mode 100644
index 000000000..39f387ced
--- /dev/null
+++ b/models-pap/src/test/resources/json/PapPoliciesList.json
@@ -0,0 +1,16 @@
+{
+ "policies": [
+ {
+ "policy-id" : "MyPolicy0",
+ "policy-version": "1.2.0"
+ },
+ {
+ "policy-id" : "MyPolicy1",
+ "policy-version": "1.2.1"
+ },
+ {
+ "policy-id" : "MyPolicy2",
+ "policy-version": "1.2.2"
+ }
+ ]
+}
diff --git a/models-pap/src/test/resources/json/PapPolicyIdentifier.json b/models-pap/src/test/resources/json/PapPolicyIdentifier.json
new file mode 100644
index 000000000..36fa259ba
--- /dev/null
+++ b/models-pap/src/test/resources/json/PapPolicyIdentifier.json
@@ -0,0 +1,4 @@
+{
+ "policy-id" : "MyPolicy",
+ "policy-version": "1.2.6"
+} \ No newline at end of file
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java
index 1a1fe228d..35443a291 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/DeploymentSubGroup.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* 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.
@@ -27,7 +28,7 @@ import lombok.NonNull;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* A deployment (i.e., set of policies) for all PDPs of the same pdp type running within a
@@ -44,7 +45,7 @@ public class DeploymentSubGroup {
private String pdpType;
private Action action;
- private List<ToscaPolicyIdentifier> policies;
+ private List<ToscaConceptIdentifier> policies;
/**
* Constructs the object.
@@ -61,7 +62,7 @@ public class DeploymentSubGroup {
public DeploymentSubGroup(@NonNull final DeploymentSubGroup source) {
this.pdpType = source.pdpType;
this.action = source.action;
- this.policies = PfUtils.mapList(source.policies, ToscaPolicyIdentifier::new, new ArrayList<>(0));
+ this.policies = PfUtils.mapList(source.policies, ToscaConceptIdentifier::new, new ArrayList<>(0));
}
/**
@@ -75,7 +76,7 @@ public class DeploymentSubGroup {
result.validateNotNull("pdpType", pdpType);
result.validateNotNull("action", action);
- result.validateNotNullList("policies", policies, ToscaPolicyIdentifier::validatePapRest);
+ result.validateNotNullList("policies", policies, ToscaConceptIdentifier::validatePapRest);
return result;
}
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java
index 313482d2e..a7ceaa9a5 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpGroupFilter.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");
@@ -29,8 +29,7 @@ import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
import org.onap.policy.models.base.PfObjectFilter;
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;
/**
* Filter class for searches for {@link PdpGroup} instances. If any fields are null, they are ignored.
@@ -50,14 +49,14 @@ public class PdpGroupFilter implements PfObjectFilter<PdpGroup> {
private String pdpType;
// Set regular expressions on fields to match policy type names and versions
- private List<ToscaPolicyTypeIdentifier> policyTypeList;
+ private List<ToscaConceptIdentifier> policyTypeList;
// If set, only PDP groups where policy types are matched exactly are returned
@Builder.Default
private boolean matchPolicyTypesExactly = false;
// Set regular expressions on fields to match policy names and versions
- private List<ToscaPolicyIdentifier> policyList;
+ private List<ToscaConceptIdentifier> policyList;
// If set, only PDP groups where policies are matched exactly are returned
@Builder.Default
@@ -110,7 +109,7 @@ public class PdpGroupFilter implements PfObjectFilter<PdpGroup> {
* @param matchPolicyTypesExactly if true, only PDP groups where policy types are matched exactly are returned
* @return true if the filter should let this PDP group through
*/
- private boolean filterOnPolicyTypeList(final PdpGroup pdpGroup, final List<ToscaPolicyTypeIdentifier> typeFilter,
+ private boolean filterOnPolicyTypeList(final PdpGroup pdpGroup, final List<ToscaConceptIdentifier> typeFilter,
final boolean matchPolicyTypesExactly) {
if (typeFilter == null) {
return true;
@@ -139,9 +138,9 @@ public class PdpGroupFilter implements PfObjectFilter<PdpGroup> {
* @return true if one element of the elements to find is supported by an element on
* the list we searched
*/
- private boolean findSupportedPolicyType(List<ToscaPolicyTypeIdentifier> supportedPolicyTypes,
- List<ToscaPolicyTypeIdentifier> typeFilter) {
- for (ToscaPolicyTypeIdentifier supportedPolicyType : supportedPolicyTypes) {
+ private boolean findSupportedPolicyType(List<ToscaConceptIdentifier> supportedPolicyTypes,
+ List<ToscaConceptIdentifier> typeFilter) {
+ for (ToscaConceptIdentifier supportedPolicyType : supportedPolicyTypes) {
String supName = supportedPolicyType.getName();
if (supName.endsWith(".*")) {
String substr = supName.substring(0, supName.length() - 1);
@@ -164,7 +163,7 @@ public class PdpGroupFilter implements PfObjectFilter<PdpGroup> {
* @param matchPoliciesExactly if true, only PDP groups where ps are matched exactly are returned
* @return true if the filter should let this PDP group through
*/
- private boolean filterOnPolicyList(final PdpGroup pdpGroup, final List<ToscaPolicyIdentifier> policyFilter,
+ private boolean filterOnPolicyList(final PdpGroup pdpGroup, final List<ToscaConceptIdentifier> policyFilter,
final boolean matchPoliciesExactly) {
if (policyFilter == null) {
return true;
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
index 6207bbe0c..e90a4d10e 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpStatus.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 Nordix Foundation.
+ * Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,7 +30,7 @@ import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
import org.onap.policy.models.pdp.enums.PdpMessageType;
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;
/**
* Class to represent the PDP_STATUS message that all the PDP's will send to PAP.
@@ -51,7 +51,7 @@ public class PdpStatus extends PdpMessage {
*/
private String description;
- private List<ToscaPolicyIdentifier> policies;
+ private List<ToscaConceptIdentifier> policies;
private String deploymentInstanceInfo;
private String properties;
private PdpStatistics statistics;
@@ -77,7 +77,7 @@ public class PdpStatus extends PdpMessage {
this.state = source.state;
this.healthy = source.healthy;
this.description = source.description;
- this.policies = PfUtils.mapList(source.policies, ToscaPolicyIdentifier::new, new ArrayList<>(0));
+ this.policies = PfUtils.mapList(source.policies, ToscaConceptIdentifier::new, new ArrayList<>(0));
this.deploymentInstanceInfo = source.deploymentInstanceInfo;
this.properties = source.properties;
this.statistics = (source.statistics == null ? null : new PdpStatistics(source.statistics));
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
index e3e33b454..bfd9dac95 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/concepts/PdpSubGroup.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 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");
@@ -32,8 +32,7 @@ import org.onap.policy.common.parameters.ObjectValidationResult;
import org.onap.policy.common.parameters.ValidationResult;
import org.onap.policy.common.parameters.ValidationStatus;
import org.onap.policy.models.base.PfUtils;
-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;
/**
* Class to represent a group of all PDP's of the same pdp type running for a particular
@@ -44,8 +43,8 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifi
@Data
public class PdpSubGroup {
private String pdpType;
- private List<ToscaPolicyTypeIdentifier> supportedPolicyTypes;
- private List<ToscaPolicyIdentifier> policies;
+ private List<ToscaConceptIdentifier> supportedPolicyTypes;
+ private List<ToscaConceptIdentifier> policies;
private int currentInstanceCount;
private int desiredInstanceCount;
private Map<String, String> properties;
@@ -65,9 +64,9 @@ public class PdpSubGroup {
*/
public PdpSubGroup(@NonNull final PdpSubGroup source) {
this.pdpType = source.pdpType;
- this.supportedPolicyTypes = PfUtils.mapList(source.supportedPolicyTypes, ToscaPolicyTypeIdentifier::new,
+ this.supportedPolicyTypes = PfUtils.mapList(source.supportedPolicyTypes, ToscaConceptIdentifier::new,
new ArrayList<>(0));
- this.policies = PfUtils.mapList(source.policies, ToscaPolicyIdentifier::new, new ArrayList<>(0));
+ this.policies = PfUtils.mapList(source.policies, ToscaConceptIdentifier::new, new ArrayList<>(0));
this.currentInstanceCount = source.currentInstanceCount;
this.desiredInstanceCount = source.desiredInstanceCount;
this.properties = (source.properties == null ? null : new LinkedHashMap<>(source.properties));
@@ -87,9 +86,9 @@ public class PdpSubGroup {
result.validateNotNull("pdpType", pdpType);
// When doing PdpGroup Update operation, supported policy types and policies doesn't have to be validated.
if (!updateGroupFlow) {
- result.validateNotNullList("policies", policies, ToscaPolicyIdentifier::validatePapRest);
+ result.validateNotNullList("policies", policies, ToscaConceptIdentifier::validatePapRest);
result.validateNotNullList("supportedPolicyTypes", supportedPolicyTypes,
- ToscaPolicyTypeIdentifier::validatePapRest);
+ ToscaConceptIdentifier::validatePapRest);
if (supportedPolicyTypes != null && supportedPolicyTypes.isEmpty()) {
result.addResult(new ObjectValidationResult("supportedPolicyTypes", supportedPolicyTypes,
diff --git a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
index 3474fccc1..27ad34e4a 100644
--- a/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
+++ b/models-pdp/src/main/java/org/onap/policy/models/pdp/persistence/concepts/JpaPdpSubGroup.java
@@ -3,7 +3,7 @@
* ONAP Policy Model
* ================================================================================
* Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019 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.
@@ -61,8 +61,7 @@ import org.onap.policy.models.base.PfUtils;
import org.onap.policy.models.base.validation.annotations.VerifyKey;
import org.onap.policy.models.pdp.concepts.Pdp;
import org.onap.policy.models.pdp.concepts.PdpSubGroup;
-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;
/**
* Class to represent a PDP subgroup in the database.
@@ -186,14 +185,14 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative<PdpSubGro
pdpSubgroup.setSupportedPolicyTypes(new ArrayList<>());
for (PfSearchableKey supportedPolicyTypeKey : supportedPolicyTypes) {
- ToscaPolicyTypeIdentifier supportedPolicyTypeIdent = new ToscaPolicyTypeIdentifier(
+ ToscaConceptIdentifier supportedPolicyTypeIdent = new ToscaConceptIdentifier(
supportedPolicyTypeKey.getName(), supportedPolicyTypeKey.getVersion());
pdpSubgroup.getSupportedPolicyTypes().add(supportedPolicyTypeIdent);
}
pdpSubgroup.setPolicies(new ArrayList<>());
for (PfConceptKey policyKey : policies) {
- ToscaPolicyIdentifier toscaPolicyIdentifier = new ToscaPolicyIdentifier();
+ ToscaConceptIdentifier toscaPolicyIdentifier = new ToscaConceptIdentifier();
toscaPolicyIdentifier.setName(policyKey.getName());
toscaPolicyIdentifier.setVersion(policyKey.getVersion());
pdpSubgroup.getPolicies().add(toscaPolicyIdentifier);
@@ -220,7 +219,7 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative<PdpSubGro
this.supportedPolicyTypes = new ArrayList<>();
if (pdpSubgroup.getSupportedPolicyTypes() != null) {
- for (ToscaPolicyTypeIdentifier supportedPolicyType : pdpSubgroup.getSupportedPolicyTypes()) {
+ for (ToscaConceptIdentifier supportedPolicyType : pdpSubgroup.getSupportedPolicyTypes()) {
this.supportedPolicyTypes
.add(new PfSearchableKey(supportedPolicyType.getName(), supportedPolicyType.getVersion()));
}
@@ -228,7 +227,7 @@ public class JpaPdpSubGroup extends PfConcept implements PfAuthorative<PdpSubGro
this.policies = new ArrayList<>();
if (pdpSubgroup.getPolicies() != null) {
- for (ToscaPolicyIdentifier toscaPolicyIdentifier : pdpSubgroup.getPolicies()) {
+ for (ToscaConceptIdentifier toscaPolicyIdentifier : pdpSubgroup.getPolicies()) {
this.policies
.add(new PfConceptKey(toscaPolicyIdentifier.getName(), toscaPolicyIdentifier.getVersion()));
}
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()
diff --git a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
index 29b2d70b0..c80ca3194 100644
--- a/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
+++ b/models-provider/src/main/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderImpl.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 Nordix Foundation.
+ * Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
@@ -43,12 +43,11 @@ import org.onap.policy.models.pdp.persistence.provider.PdpProvider;
import org.onap.policy.models.pdp.persistence.provider.PdpStatisticsProvider;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+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.ToscaPolicyFilter;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplateFilter;
import org.onap.policy.models.tosca.authorative.provider.AuthorativeToscaProvider;
@@ -212,7 +211,7 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
throws PfModelException {
assertInitialized();
- ToscaPolicyTypeIdentifier policyTypeIdentifier = new ToscaPolicyTypeIdentifier(name, version);
+ ToscaConceptIdentifier policyTypeIdentifier = new ToscaConceptIdentifier(name, version);
assertPolicyTypeNotSupportedInPdpGroup(policyTypeIdentifier);
return new AuthorativeToscaProvider().deletePolicyType(pfDao, name, version);
@@ -261,7 +260,7 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
throws PfModelException {
assertInitialized();
- ToscaPolicyIdentifier policyIdentifier = new ToscaPolicyIdentifier(name, version);
+ ToscaConceptIdentifier policyIdentifier = new ToscaConceptIdentifier(name, version);
assertPolicyNotDeployedInPdpGroup(policyIdentifier);
return new AuthorativeToscaProvider().deletePolicy(pfDao, name, version);
@@ -363,7 +362,7 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
* @param policyTypeIdentifier the policy type identifier
* @throws PfModelException if the policy type is supported in a PDP group
*/
- private void assertPolicyTypeNotSupportedInPdpGroup(ToscaPolicyTypeIdentifier policyTypeIdentifier)
+ private void assertPolicyTypeNotSupportedInPdpGroup(ToscaConceptIdentifier policyTypeIdentifier)
throws PfModelException {
for (PdpGroup pdpGroup : getPdpGroups(null)) {
for (PdpSubGroup pdpSubGroup : pdpGroup.getPdpSubgroups()) {
@@ -382,7 +381,7 @@ public class DatabasePolicyModelsProviderImpl implements PolicyModelsProvider {
* @param policyIdentifier the identifier of the policy
* @throws PfModelException thrown if the policy is deployed in a PDP group
*/
- private void assertPolicyNotDeployedInPdpGroup(final ToscaPolicyIdentifier policyIdentifier)
+ private void assertPolicyNotDeployedInPdpGroup(final ToscaConceptIdentifier policyIdentifier)
throws PfModelException {
for (PdpGroup pdpGroup : getPdpGroups(null)) {
for (PdpSubGroup pdpSubGroup : pdpGroup.getPdpSubgroups()) {
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
index d8b6a83e4..3e1767f8e 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/DatabasePolicyModelsProviderTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 Nordix Foundation.
+ * Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
@@ -43,10 +43,9 @@ import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.models.provider.PolicyModelsProvider;
import org.onap.policy.models.provider.PolicyModelsProviderFactory;
import org.onap.policy.models.provider.PolicyModelsProviderParameters;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
/**
@@ -97,7 +96,7 @@ public class DatabasePolicyModelsProviderTest {
}).hasMessageMatching("^parameters is marked .*on.*ull but is null$");
PolicyModelsProvider databaseProvider =
- new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
+ new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
parameters.setDatabaseUrl("jdbc://www.acmecorp.nonexist");
@@ -131,7 +130,7 @@ public class DatabasePolicyModelsProviderTest {
public void testProviderMethodsNull() throws Exception {
PolicyModelsProvider databaseProvider =
- new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
+ new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
assertThatThrownBy(() -> {
databaseProvider.getFilteredPolicyTypes(null);
@@ -275,7 +274,7 @@ public class DatabasePolicyModelsProviderTest {
@Test
public void testProviderMethodsNotInit() throws Exception {
PolicyModelsProvider databaseProvider =
- new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
+ new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
databaseProvider.close();
@@ -287,15 +286,15 @@ public class DatabasePolicyModelsProviderTest {
@Test
public void testProviderMethods() throws PfModelException {
PolicyModelsProvider databaseProvider =
- new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
+ new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
assertThatThrownBy(() -> databaseProvider.getPolicyTypes(NAME, VERSION_100))
- .hasMessage("service template not found in database");
+ .hasMessage("service template not found in database");
assertTrue(databaseProvider.getPolicyTypeList(NAME, VERSION_100).isEmpty());
assertThatThrownBy(() -> databaseProvider.getFilteredPolicyTypes(ToscaPolicyTypeFilter.builder().build()))
- .hasMessage("service template not found in database");
+ .hasMessage("service template not found in database");
assertTrue(databaseProvider.getFilteredPolicyTypeList(ToscaPolicyTypeFilter.builder().build()).isEmpty());
@@ -308,15 +307,15 @@ public class DatabasePolicyModelsProviderTest {
}).hasMessage("no policy types specified on service template");
assertThatThrownBy(() -> databaseProvider.deletePolicyType(NAME, VERSION_100))
- .hasMessage("service template not found in database");
+ .hasMessage("service template not found in database");
assertThatThrownBy(() -> databaseProvider.getPolicies(NAME, VERSION_100))
- .hasMessage("service template not found in database");
+ .hasMessage("service template not found in database");
assertTrue(databaseProvider.getPolicyList(NAME, VERSION_100).isEmpty());
assertThatThrownBy(() -> databaseProvider.getFilteredPolicies(ToscaPolicyFilter.builder().build()))
- .hasMessage("service template not found in database");
+ .hasMessage("service template not found in database");
assertTrue(databaseProvider.getFilteredPolicyList(ToscaPolicyFilter.builder().build()).isEmpty());
@@ -329,7 +328,7 @@ public class DatabasePolicyModelsProviderTest {
}).hasMessage("topology template not specified on service template");
assertThatThrownBy(() -> databaseProvider.deletePolicy("Policy", "0.0.0").getToscaTopologyTemplate())
- .hasMessage("service template not found in database");
+ .hasMessage("service template not found in database");
assertEquals(0, databaseProvider.getPdpGroups(NAME).size());
assertEquals(0, databaseProvider.getFilteredPdpGroups(PdpGroupFilter.builder().build()).size());
@@ -349,7 +348,7 @@ public class DatabasePolicyModelsProviderTest {
pdpSubGroup.setPdpType("type");
pdpSubGroup.setDesiredInstanceCount(123);
pdpSubGroup.setSupportedPolicyTypes(new ArrayList<>());
- pdpSubGroup.getSupportedPolicyTypes().add(new ToscaPolicyTypeIdentifier("type", "7.8.9"));
+ pdpSubGroup.getSupportedPolicyTypes().add(new ToscaConceptIdentifier("type", "7.8.9"));
pdpGroup.getPdpSubgroups().add(pdpSubGroup);
Pdp pdp = new Pdp();
@@ -369,20 +368,20 @@ public class DatabasePolicyModelsProviderTest {
statisticsArrayList.add(pdpStatistics);
assertEquals(123,
- databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0).getDesiredInstanceCount());
+ databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0).getDesiredInstanceCount());
assertEquals(1, databaseProvider.getPdpGroups(GROUP).size());
pdpSubGroup.setDesiredInstanceCount(234);
databaseProvider.updatePdpSubGroup(GROUP, pdpSubGroup);
assertEquals(234,
- databaseProvider.getPdpGroups(GROUP).get(0).getPdpSubgroups().get(0).getDesiredInstanceCount());
+ databaseProvider.getPdpGroups(GROUP).get(0).getPdpSubgroups().get(0).getDesiredInstanceCount());
- assertEquals("Hello",
- databaseProvider.getPdpGroups(GROUP).get(0).getPdpSubgroups().get(0).getPdpInstances().get(0).getMessage());
+ assertEquals("Hello", databaseProvider.getPdpGroups(GROUP).get(0).getPdpSubgroups().get(0).getPdpInstances()
+ .get(0).getMessage());
pdp.setMessage("Howdy");
databaseProvider.updatePdp(GROUP, "type", pdp);
- assertEquals("Howdy",
- databaseProvider.getPdpGroups(GROUP).get(0).getPdpSubgroups().get(0).getPdpInstances().get(0).getMessage());
+ assertEquals("Howdy", databaseProvider.getPdpGroups(GROUP).get(0).getPdpSubgroups().get(0).getPdpInstances()
+ .get(0).getMessage());
assertThatThrownBy(() -> {
databaseProvider.deletePdpGroup(NAME);
@@ -396,30 +395,30 @@ public class DatabasePolicyModelsProviderTest {
assertEquals(NAME, databaseProvider.getPdpStatistics(null, null).get(0).getPdpInstanceId());
assertEquals(NAME, databaseProvider.getFilteredPdpStatistics(null, GROUP, null, null, null, ORDER, 0).get(0)
- .getPdpInstanceId());
+ .getPdpInstanceId());
assertEquals(0,
- databaseProvider.getFilteredPdpStatistics(null, GROUP, null, new Date(), null, ORDER, 0).size());
+ databaseProvider.getFilteredPdpStatistics(null, GROUP, null, new Date(), null, ORDER, 0).size());
assertEquals(NAME, databaseProvider.getFilteredPdpStatistics(null, GROUP, null, null, new Date(), ORDER, 0)
- .get(0).getPdpInstanceId());
+ .get(0).getPdpInstanceId());
assertEquals(0,
- databaseProvider.getFilteredPdpStatistics(null, GROUP, null, new Date(), new Date(), ORDER, 0).size());
+ databaseProvider.getFilteredPdpStatistics(null, GROUP, null, new Date(), new Date(), ORDER, 0).size());
assertEquals(NAME, databaseProvider.getFilteredPdpStatistics(NAME, GROUP, null, null, null, ORDER, 0).get(0)
- .getPdpInstanceId());
+ .getPdpInstanceId());
assertEquals(0,
- databaseProvider.getFilteredPdpStatistics(NAME, GROUP, null, new Date(), new Date(), ORDER, 0).size());
+ databaseProvider.getFilteredPdpStatistics(NAME, GROUP, null, new Date(), new Date(), ORDER, 0).size());
assertEquals(NAME, databaseProvider.getFilteredPdpStatistics(NAME, GROUP, "type", null, null, ORDER, 0).get(0)
- .getPdpInstanceId());
- assertEquals(0,
- databaseProvider.getFilteredPdpStatistics(NAME, GROUP, "type", new Date(), new Date(), ORDER, 0).size());
+ .getPdpInstanceId());
+ assertEquals(0, databaseProvider.getFilteredPdpStatistics(NAME, GROUP, "type", new Date(), new Date(), ORDER, 0)
+ .size());
assertEquals(NAME, databaseProvider.getFilteredPdpStatistics(NAME, GROUP, "type", null, null, ORDER, 1).get(0)
- .getPdpInstanceId());
+ .getPdpInstanceId());
assertEquals(NAME, databaseProvider.getFilteredPdpStatistics(NAME, GROUP, "type", null, null, ORDER, 5).get(0)
- .getPdpInstanceId());
- assertEquals(0,
- databaseProvider.getFilteredPdpStatistics(NAME, GROUP, "type", new Date(), new Date(), ORDER, 5).size());
+ .getPdpInstanceId());
+ assertEquals(0, databaseProvider.getFilteredPdpStatistics(NAME, GROUP, "type", new Date(), new Date(), ORDER, 5)
+ .size());
assertEquals(NAME, databaseProvider.deletePdpStatistics(NAME, null).get(0).getPdpInstanceId());
assertEquals(0, databaseProvider.getPdpStatistics(null, null).size());
@@ -429,13 +428,13 @@ public class DatabasePolicyModelsProviderTest {
@Test
public void testDeletePolicyDeployedInSubgroup() throws PfModelException {
- List<ToscaPolicyIdentifier> policies = new ArrayList<>();
+ List<ToscaConceptIdentifier> policies = new ArrayList<>();
- policies.add(new ToscaPolicyIdentifier("p0", "0.0.1"));
- policies.add(new ToscaPolicyIdentifier("p1", "0.0.1"));
+ policies.add(new ToscaConceptIdentifier("p0", "0.0.1"));
+ policies.add(new ToscaConceptIdentifier("p1", "0.0.1"));
- List<ToscaPolicyTypeIdentifier> supportedPolicyTypes = new ArrayList<>();
- supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier("pt2", "0.0.1"));
+ List<ToscaConceptIdentifier> supportedPolicyTypes = new ArrayList<>();
+ supportedPolicyTypes.add(new ToscaConceptIdentifier("pt2", "0.0.1"));
PdpSubGroup subGroup = new PdpSubGroup();
subGroup.setPdpType("pdpType");
@@ -454,24 +453,24 @@ public class DatabasePolicyModelsProviderTest {
pdpGroups.add(pdpGroup);
PolicyModelsProvider databaseProvider =
- new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
+ new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
databaseProvider.createPdpGroups(pdpGroups);
assertThatThrownBy(() -> databaseProvider.deletePolicy("p0", "0.0.1"))
- .hasMessageContaining("policy is in use, it is deployed in PDP group pdpGroup subgroup pdpType");
+ .hasMessageContaining("policy is in use, it is deployed in PDP group pdpGroup subgroup pdpType");
assertThatThrownBy(() -> databaseProvider.deletePolicy("p3", "0.0.1"))
- .hasMessageContaining("service template not found in database");
+ .hasMessageContaining("service template not found in database");
databaseProvider.close();
}
@Test
public void testDeletePolicyTypeSupportedInSubgroup() throws PfModelException {
- List<ToscaPolicyTypeIdentifier> supportedPolicyTypes = new ArrayList<>();
- supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier("pt1", "0.0.1"));
- supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier("pt2", "0.0.1"));
+ List<ToscaConceptIdentifier> supportedPolicyTypes = new ArrayList<>();
+ supportedPolicyTypes.add(new ToscaConceptIdentifier("pt1", "0.0.1"));
+ supportedPolicyTypes.add(new ToscaConceptIdentifier("pt2", "0.0.1"));
PdpSubGroup subGroup = new PdpSubGroup();
subGroup.setPdpType("pdpType");
@@ -489,15 +488,15 @@ public class DatabasePolicyModelsProviderTest {
pdpGroups.add(pdpGroup);
PolicyModelsProvider databaseProvider =
- new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
+ new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
databaseProvider.createPdpGroups(pdpGroups);
assertThatThrownBy(() -> databaseProvider.deletePolicyType("pt2", "0.0.1"))
- .hasMessageContaining("policy type is in use, it is referenced in PDP group pdpGroup subgroup pdpType");
+ .hasMessageContaining("policy type is in use, it is referenced in PDP group pdpGroup subgroup pdpType");
assertThatThrownBy(() -> databaseProvider.deletePolicyType("pt0", "0.0.1"))
- .hasMessageContaining("service template not found in database");
+ .hasMessageContaining("service template not found in database");
databaseProvider.close();
}
diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpMessageHandler.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpMessageHandler.java
index d77ece054..6e628cc62 100644
--- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpMessageHandler.java
+++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpMessageHandler.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 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");
@@ -31,8 +31,8 @@ import org.onap.policy.models.pdp.enums.PdpResponseStatus;
import org.onap.policy.models.pdp.enums.PdpState;
import org.onap.policy.models.sim.pdp.PdpSimulatorConstants;
import org.onap.policy.models.sim.pdp.parameters.PdpStatusParameters;
+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.ToscaPolicyIdentifier;
/**
* This class supports the handling of pdp messages.
@@ -117,11 +117,11 @@ public class PdpMessageHandler {
*
* @return policyTypeIdentifiers
*/
- public List<ToscaPolicyIdentifier> getToscaPolicyIdentifiers(final List<ToscaPolicy> policies) {
- final List<ToscaPolicyIdentifier> policyIdentifiers = new ArrayList<>(policies.size());
+ public List<ToscaConceptIdentifier> getToscaPolicyIdentifiers(final List<ToscaPolicy> policies) {
+ final List<ToscaConceptIdentifier> policyIdentifiers = new ArrayList<>(policies.size());
for (final ToscaPolicy policy : policies) {
if (null != policy.getName() && null != policy.getVersion()) {
- policyIdentifiers.add(new ToscaPolicyIdentifier(policy.getName(), policy.getVersion()));
+ policyIdentifiers.add(new ToscaConceptIdentifier(policy.getName(), policy.getVersion()));
}
}
return policyIdentifiers;
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyIdentifier.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifier.java
index ba1042851..36e460e83 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyIdentifier.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifier.java
@@ -1,9 +1,9 @@
-/*
+/*-
* ============LICENSE_START=======================================================
* 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.
@@ -29,11 +29,11 @@ import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.ValidationResult;
/**
- * Identifies a policy. Both the name and version must be non-null.
+ * Identifies a concept. Both the name and version must be non-null.
*/
@Data
@NoArgsConstructor
-public class ToscaPolicyIdentifier implements Comparable<ToscaPolicyIdentifier> {
+public class ToscaConceptIdentifier implements Comparable<ToscaConceptIdentifier> {
@NonNull
private String name;
@@ -42,19 +42,18 @@ public class ToscaPolicyIdentifier implements Comparable<ToscaPolicyIdentifier>
private String version;
- public ToscaPolicyIdentifier(@NonNull String name, @NonNull String version) {
+ public ToscaConceptIdentifier(@NonNull String name, @NonNull String version) {
this.name = name;
this.version = version;
}
- public ToscaPolicyIdentifier(ToscaPolicyIdentifier source) {
+ public ToscaConceptIdentifier(ToscaConceptIdentifier source) {
this.name = source.name;
this.version = source.version;
}
/**
- * Validates that appropriate fields are populated for an incoming call to the PAP
- * REST API.
+ * Validates that appropriate fields are populated for an incoming call to the PAP REST API.
*
* @return the validation result
*/
@@ -68,7 +67,7 @@ public class ToscaPolicyIdentifier implements Comparable<ToscaPolicyIdentifier>
}
@Override
- public int compareTo(ToscaPolicyIdentifier other) {
+ public int compareTo(ToscaConceptIdentifier other) {
if (this == other) {
return 0;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyIdentifierOptVersion.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifierOptVersion.java
index 29bff911f..c23c04fe8 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyIdentifierOptVersion.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifierOptVersion.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.
@@ -21,47 +21,40 @@
package org.onap.policy.models.tosca.authorative.concepts;
-import com.google.gson.annotations.SerializedName;
-import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import org.apache.commons.lang3.ObjectUtils;
/**
- * Policy identifier with an optional version; only the "name" is required.
+ * Concept identifier with an optional version; only the "name" is required.
*/
@Data
@NoArgsConstructor
-public class ToscaPolicyIdentifierOptVersion implements Comparable<ToscaPolicyIdentifierOptVersion> {
+public class ToscaConceptIdentifierOptVersion implements Comparable<ToscaConceptIdentifierOptVersion> {
@NonNull
- @ApiModelProperty(name = "policy-id")
- @SerializedName("policy-id")
private String name;
- @ApiModelProperty(name = "policy-version")
- @SerializedName("policy-version")
private String version;
-
- public ToscaPolicyIdentifierOptVersion(@NonNull String name, String version) {
+ public ToscaConceptIdentifierOptVersion(@NonNull String name, String version) {
this.name = name;
this.version = version;
}
- public ToscaPolicyIdentifierOptVersion(ToscaPolicyIdentifierOptVersion source) {
+ public ToscaConceptIdentifierOptVersion(ToscaConceptIdentifierOptVersion source) {
this.name = source.name;
this.version = source.version;
}
- public ToscaPolicyIdentifierOptVersion(ToscaPolicyIdentifier source) {
+ public ToscaConceptIdentifierOptVersion(ToscaConceptIdentifier source) {
this.name = source.getName();
this.version = source.getVersion();
}
@Override
- public int compareTo(ToscaPolicyIdentifierOptVersion other) {
+ public int compareTo(ToscaConceptIdentifierOptVersion other) {
if (this == other) {
return 0;
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java
index c98a844e5..491b478a4 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicy.java
@@ -3,7 +3,7 @@
* ONAP Policy Model
* ================================================================================
* 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.
@@ -76,8 +76,8 @@ public class ToscaPolicy extends ToscaEntity {
*
* @return this policy's identifier
*/
- public ToscaPolicyIdentifier getIdentifier() {
- return new ToscaPolicyIdentifier(getName(), getVersion());
+ public ToscaConceptIdentifier getIdentifier() {
+ return new ToscaConceptIdentifier(getName(), getVersion());
}
/**
@@ -85,7 +85,7 @@ public class ToscaPolicy extends ToscaEntity {
*
* @return this policy's type identifier
*/
- public ToscaPolicyTypeIdentifier getTypeIdentifier() {
- return new ToscaPolicyTypeIdentifier(getType(), getTypeVersion());
+ public ToscaConceptIdentifier getTypeIdentifier() {
+ return new ToscaConceptIdentifier(getType(), getTypeVersion());
}
}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeIdentifier.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeIdentifier.java
deleted file mode 100644
index 32dd7cbd7..000000000
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeIdentifier.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * ONAP Policy Models
- * ================================================================================
- * Copyright (C) 2019 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.policy.models.tosca.authorative.concepts;
-
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.NonNull;
-import org.apache.commons.lang3.ObjectUtils;
-import org.onap.policy.common.parameters.BeanValidationResult;
-import org.onap.policy.common.parameters.ValidationResult;
-
-/**
- * Identifies a policy type. Both the name and version must be non-null.
- */
-@Data
-@NoArgsConstructor
-public class ToscaPolicyTypeIdentifier implements Comparable<ToscaPolicyTypeIdentifier> {
-
- @NonNull
- private String name;
-
- @NonNull
- private String version;
-
-
- public ToscaPolicyTypeIdentifier(@NonNull String name, @NonNull String version) {
- this.name = name;
- this.version = version;
- }
-
- public ToscaPolicyTypeIdentifier(ToscaPolicyTypeIdentifier source) {
- this.name = source.name;
- this.version = source.version;
- }
-
- /**
- * Validates that appropriate fields are populated for an incoming call to the PAP
- * REST API.
- *
- * @return the validation result
- */
- public ValidationResult validatePapRest() {
- BeanValidationResult result = new BeanValidationResult("group", this);
-
- result.validateNotNull("name", name);
- result.validateNotNull("version", version);
-
- return result;
- }
-
- @Override
- public int compareTo(ToscaPolicyTypeIdentifier other) {
- if (this == other) {
- return 0;
- }
-
- if (other == null) {
- return 1;
- }
-
- int result = ObjectUtils.compare(getName(), other.getName());
- if (result != 0) {
- return result;
- }
-
- return ObjectUtils.compare(getVersion(), other.getVersion());
- }
-
- @Override
- public String toString() {
- return this.name + " " + this.version;
- }
-}
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
index c0a5cdf75..594a5c348 100644
--- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
+++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaServiceTemplate.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 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");
@@ -269,11 +269,11 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType<ToscaServiceTemp
public void fromAuthorative(ToscaServiceTemplate toscaServiceTemplate) {
super.fromAuthorative(toscaServiceTemplate);
- if (PfKey.NULL_KEY_NAME.equals(getKey().getName())) {
+ if (toscaServiceTemplate.getDefinedName() == null) {
getKey().setName(DEFAULT_NAME);
}
- if (PfKey.NULL_KEY_VERSION.equals(getKey().getVersion())) {
+ if (toscaServiceTemplate.getDefinedVersion() == null) {
getKey().setVersion(DEFAULT_VERSION);
}
@@ -476,8 +476,8 @@ public class JpaToscaServiceTemplate extends JpaToscaEntityType<ToscaServiceTemp
* @param dataTypeKeyCollection the data type key collection
* @param result where the results are added
*/
- private void validateReferencedDataTypesExists(
- final Collection<PfConceptKey> dataTypeKeyCollection, final BeanValidationResult result) {
+ private void validateReferencedDataTypesExists(final Collection<PfConceptKey> dataTypeKeyCollection,
+ final BeanValidationResult result) {
for (PfConceptKey dataTypeKey : dataTypeKeyCollection) {
if (dataTypes == null || dataTypes.get(dataTypeKey) == null) {
addResult(result, "data type", dataTypeKey.getId(), NOT_FOUND);
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyIdentifierOptVersionTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifierOptVersionTest.java
index 0b43173ad..aedf5cb15 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyIdentifierOptVersionTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaConceptIdentifierOptVersionTest.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.
@@ -28,58 +29,58 @@ import org.junit.Test;
/**
* Test the other constructors, as {@link PojosTest} tests the other methods.
*/
-public class ToscaPolicyIdentifierOptVersionTest extends ToscaIdentifierTestBase<ToscaPolicyIdentifierOptVersion> {
+public class ToscaConceptIdentifierOptVersionTest extends ToscaIdentifierTestBase<ToscaConceptIdentifierOptVersion> {
- public ToscaPolicyIdentifierOptVersionTest() {
- super(ToscaPolicyIdentifierOptVersion.class, "policy-id", "policy-version");
+ public ToscaConceptIdentifierOptVersionTest() {
+ super(ToscaConceptIdentifierOptVersion.class, "name", "version");
}
@Test
public void testAllArgsConstructor_testIsNullVersion() {
- assertThatThrownBy(() -> new ToscaPolicyIdentifierOptVersion(null, VERSION))
+ assertThatThrownBy(() -> new ToscaConceptIdentifierOptVersion(null, VERSION))
.isInstanceOf(NullPointerException.class);
// with null version
- ToscaPolicyIdentifierOptVersion orig = new ToscaPolicyIdentifierOptVersion(NAME, null);
+ ToscaConceptIdentifierOptVersion orig = new ToscaConceptIdentifierOptVersion(NAME, null);
assertEquals(NAME, orig.getName());
assertEquals(null, orig.getVersion());
- orig = new ToscaPolicyIdentifierOptVersion(NAME, VERSION);
+ orig = new ToscaConceptIdentifierOptVersion(NAME, VERSION);
assertEquals(NAME, orig.getName());
assertEquals(VERSION, orig.getVersion());
}
@Test
public void testCopyConstructor() throws Exception {
- assertThatThrownBy(() -> new ToscaPolicyIdentifierOptVersion((ToscaPolicyIdentifierOptVersion) null))
+ assertThatThrownBy(() -> new ToscaConceptIdentifierOptVersion((ToscaConceptIdentifierOptVersion) null))
.isInstanceOf(NullPointerException.class);
- ToscaPolicyIdentifierOptVersion orig = new ToscaPolicyIdentifierOptVersion();
+ ToscaConceptIdentifierOptVersion orig = new ToscaConceptIdentifierOptVersion();
// verify with null values
- assertEquals(orig.toString(), new ToscaPolicyIdentifierOptVersion(orig).toString());
+ assertEquals(orig.toString(), new ToscaConceptIdentifierOptVersion(orig).toString());
// verify with all values
orig = makeIdent(NAME, VERSION);
- assertEquals(orig.toString(), new ToscaPolicyIdentifierOptVersion(orig).toString());
+ assertEquals(orig.toString(), new ToscaConceptIdentifierOptVersion(orig).toString());
}
@Test
public void testCopyToscaPolicyIdentifierConstructor() {
- assertThatThrownBy(() -> new ToscaPolicyIdentifierOptVersion((ToscaPolicyIdentifier) null))
+ assertThatThrownBy(() -> new ToscaConceptIdentifierOptVersion((ToscaConceptIdentifier) null))
.isInstanceOf(NullPointerException.class);
- ToscaPolicyIdentifier orig = new ToscaPolicyIdentifier();
+ ToscaConceptIdentifier orig = new ToscaConceptIdentifier();
// verify with null values
- ToscaPolicyIdentifierOptVersion newIdent = new ToscaPolicyIdentifierOptVersion(orig);
+ ToscaConceptIdentifierOptVersion newIdent = new ToscaConceptIdentifierOptVersion(orig);
assertEquals(null, newIdent.getName());
assertEquals(null, newIdent.getVersion());
// verify with all values
orig.setName(NAME);
orig.setVersion(VERSION);
- newIdent = new ToscaPolicyIdentifierOptVersion(orig);
+ newIdent = new ToscaConceptIdentifierOptVersion(orig);
assertEquals(NAME, newIdent.getName());
assertEquals(VERSION, newIdent.getVersion());
}
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeIdentifierTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyConceptIdentifierTest.java
index a5e0431b2..6f49fd433 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeIdentifierTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyConceptIdentifierTest.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.
@@ -33,39 +34,39 @@ import org.onap.policy.common.parameters.ValidationResult;
/**
* Test methods not tested by {@link PojosTest}.
*/
-public class ToscaPolicyTypeIdentifierTest extends ToscaIdentifierTestBase<ToscaPolicyTypeIdentifier> {
+public class ToscaPolicyConceptIdentifierTest extends ToscaIdentifierTestBase<ToscaConceptIdentifier> {
- public ToscaPolicyTypeIdentifierTest() {
- super(ToscaPolicyTypeIdentifier.class, "name", "version");
+ public ToscaPolicyConceptIdentifierTest() {
+ super(ToscaConceptIdentifier.class, "name", "version");
}
@Test
public void testAllArgsConstructor() {
- assertThatThrownBy(() -> new ToscaPolicyTypeIdentifier(null, VERSION)).isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> new ToscaPolicyTypeIdentifier(NAME, null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new ToscaConceptIdentifier(null, VERSION)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new ToscaConceptIdentifier(NAME, null)).isInstanceOf(NullPointerException.class);
- ToscaPolicyTypeIdentifier orig = new ToscaPolicyTypeIdentifier(NAME, VERSION);
+ ToscaConceptIdentifier orig = new ToscaConceptIdentifier(NAME, VERSION);
assertEquals(NAME, orig.getName());
assertEquals(VERSION, orig.getVersion());
}
@Test
public void testCopyConstructor() {
- assertThatThrownBy(() -> new ToscaPolicyTypeIdentifier(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new ToscaConceptIdentifier(null)).isInstanceOf(NullPointerException.class);
- ToscaPolicyTypeIdentifier orig = new ToscaPolicyTypeIdentifier();
+ ToscaConceptIdentifier orig = new ToscaConceptIdentifier();
// verify with null values
- assertEquals(orig.toString(), new ToscaPolicyTypeIdentifier(orig).toString());
+ assertEquals(orig.toString(), new ToscaConceptIdentifier(orig).toString());
// verify with all values
- orig = new ToscaPolicyTypeIdentifier(NAME, VERSION);
- assertEquals(orig.toString(), new ToscaPolicyTypeIdentifier(orig).toString());
+ orig = new ToscaConceptIdentifier(NAME, VERSION);
+ assertEquals(orig.toString(), new ToscaConceptIdentifier(orig).toString());
}
@Test
public void testValidatePapRest() throws Exception {
- ToscaPolicyTypeIdentifier ident = new ToscaPolicyTypeIdentifier(NAME, VERSION);
+ ToscaConceptIdentifier ident = new ToscaConceptIdentifier(NAME, VERSION);
ValidationResult result = ident.validatePapRest();
assertNotNull(result);
assertTrue(result.isValid());
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTest.java
index 9fd559392..59f471ae8 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTest.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.
@@ -47,11 +47,11 @@ public class ToscaPolicyTest {
assertEquals("ToscaEntityKey(name=my_name, version=1.2.3)", policy.getKey().toString());
- ToscaPolicyIdentifier ident = policy.getIdentifier();
+ ToscaConceptIdentifier ident = policy.getIdentifier();
assertEquals("my_name", ident.getName());
assertEquals("1.2.3", ident.getVersion());
- ToscaPolicyTypeIdentifier type = policy.getTypeIdentifier();
+ ToscaConceptIdentifier type = policy.getTypeIdentifier();
assertEquals("my_type", type.getName());
assertEquals("3.2.1", type.getVersion());
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyIdentifierTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeConceptIdentifierTest.java
index cc40e2410..7845a1f32 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyIdentifierTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeConceptIdentifierTest.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.
@@ -33,39 +34,39 @@ import org.onap.policy.common.parameters.ValidationResult;
/**
* Test methods not tested by {@link PojosTest}.
*/
-public class ToscaPolicyIdentifierTest extends ToscaIdentifierTestBase<ToscaPolicyIdentifier> {
+public class ToscaPolicyTypeConceptIdentifierTest extends ToscaIdentifierTestBase<ToscaConceptIdentifier> {
- public ToscaPolicyIdentifierTest() {
- super(ToscaPolicyIdentifier.class, "name", "version");
+ public ToscaPolicyTypeConceptIdentifierTest() {
+ super(ToscaConceptIdentifier.class, "name", "version");
}
@Test
public void testAllArgsConstructor() {
- assertThatThrownBy(() -> new ToscaPolicyIdentifier(null, VERSION)).isInstanceOf(NullPointerException.class);
- assertThatThrownBy(() -> new ToscaPolicyIdentifier(NAME, null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new ToscaConceptIdentifier(null, VERSION)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new ToscaConceptIdentifier(NAME, null)).isInstanceOf(NullPointerException.class);
- ToscaPolicyIdentifier orig = new ToscaPolicyIdentifier(NAME, VERSION);
+ ToscaConceptIdentifier orig = new ToscaConceptIdentifier(NAME, VERSION);
assertEquals(NAME, orig.getName());
assertEquals(VERSION, orig.getVersion());
}
@Test
public void testCopyConstructor() {
- assertThatThrownBy(() -> new ToscaPolicyIdentifier(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new ToscaConceptIdentifier(null)).isInstanceOf(NullPointerException.class);
- ToscaPolicyIdentifier orig = new ToscaPolicyIdentifier();
+ ToscaConceptIdentifier orig = new ToscaConceptIdentifier();
// verify with null values
- assertEquals(orig.toString(), new ToscaPolicyIdentifier(orig).toString());
+ assertEquals(orig.toString(), new ToscaConceptIdentifier(orig).toString());
// verify with all values
- orig = new ToscaPolicyIdentifier(NAME, VERSION);
- assertEquals(orig.toString(), new ToscaPolicyIdentifier(orig).toString());
+ orig = new ToscaConceptIdentifier(NAME, VERSION);
+ assertEquals(orig.toString(), new ToscaConceptIdentifier(orig).toString());
}
@Test
public void testValidatePapRest() throws Exception {
- ToscaPolicyIdentifier ident = new ToscaPolicyIdentifier(NAME, VERSION);
+ ToscaConceptIdentifier ident = new ToscaConceptIdentifier(NAME, VERSION);
ValidationResult result = ident.validatePapRest();
assertNotNull(result);
assertTrue(result.isValid());