diff options
author | liamfallon <liam.fallon@est.tech> | 2021-01-04 12:15:18 +0000 |
---|---|---|
committer | liamfallon <liam.fallon@est.tech> | 2021-01-06 14:20:06 +0000 |
commit | f2b0318f53abf9f2345a5cdca74f3dd635aa9b60 (patch) | |
tree | 0a5d64add719e43596f95b9415db04257c037988 /models-tosca/src/test/java | |
parent | 8ad3f95cdcec48b8315a5febfd4ec07bae7aabba (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/src/test/java')
-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/ToscaPolicyIdentifierTest.java) | 25 | ||||
-rw-r--r-- | models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTest.java | 6 | ||||
-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/ToscaPolicyTypeIdentifierTest.java) | 25 |
4 files changed, 44 insertions, 41 deletions
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/ToscaPolicyIdentifierTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyConceptIdentifierTest.java index cc40e2410..6f49fd433 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/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 ToscaPolicyIdentifierTest extends ToscaIdentifierTestBase<ToscaPolicyIdentifier> { +public class ToscaPolicyConceptIdentifierTest extends ToscaIdentifierTestBase<ToscaConceptIdentifier> { - public ToscaPolicyIdentifierTest() { - super(ToscaPolicyIdentifier.class, "name", "version"); + public ToscaPolicyConceptIdentifierTest() { + 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()); 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/ToscaPolicyTypeIdentifierTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeConceptIdentifierTest.java index a5e0431b2..7845a1f32 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/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 ToscaPolicyTypeIdentifierTest extends ToscaIdentifierTestBase<ToscaPolicyTypeIdentifier> { +public class ToscaPolicyTypeConceptIdentifierTest extends ToscaIdentifierTestBase<ToscaConceptIdentifier> { - public ToscaPolicyTypeIdentifierTest() { - super(ToscaPolicyTypeIdentifier.class, "name", "version"); + public ToscaPolicyTypeConceptIdentifierTest() { + 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()); |