aboutsummaryrefslogtreecommitdiffstats
path: root/models-tosca
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2021-01-04 12:15:18 +0000
committerliamfallon <liam.fallon@est.tech>2021-01-06 14:20:06 +0000
commitf2b0318f53abf9f2345a5cdca74f3dd635aa9b60 (patch)
tree0a5d64add719e43596f95b9415db04257c037988 /models-tosca
parent8ad3f95cdcec48b8315a5febfd4ec07bae7aabba (diff)
Changed identifiers to concept identifiers
The policy models tosca classes ToscaPolicyIdentifier and ToscaPolicyIdentifierOptVersion can be used to identify any TOSCA concept, not just TOSCA policies so they are renamed to ToscaConceptIdentifier and ToscaCinceptIdentifierOptVersion respectively. The class ToscaPolicyTypeIdentifier is redundant and is replaced by ToscaConceptIdentifier. Issue-ID: POLICY-2900 Change-Id: Id0a37c42ea4e74f07b47e1694c4f8291c35879c9 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'models-tosca')
-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
9 files changed, 69 insertions, 166 deletions
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());