aboutsummaryrefslogtreecommitdiffstats
path: root/runtime-acm/src/test
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-01-17 09:56:52 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2023-01-23 15:22:35 +0000
commitc5e57c1b1cd0e778ebf47edd20fd9a340471ab72 (patch)
treef567d2bc52cf070bcccb83bad0f4ab5f70d2415f /runtime-acm/src/test
parenta263a250f7185fd9ddc4b600d96452fdbf21fffb (diff)
Refactor participantId as UUID
As part of endpoint refactoring, refactor participantId as UUID in ACM. Issue-ID: POLICY-4521 Change-Id: I8ac652d9b2fadf9ce3220febb9c2c3ac0d3786cc Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm/src/test')
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java3
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java7
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java17
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationComposition.json15
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json5
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json15
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json15
7 files changed, 23 insertions, 54 deletions
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
index 4516ccd97..1db95e4b5 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.clamp.acm.runtime.supervision;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
@@ -257,7 +258,7 @@ class SupervisionHandlerTest {
mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE,
AutomationCompositionState.UNINITIALISED);
- handler.handleParticipantMessage(participantUpdateAckMessage);
+ assertThatCode(() -> handler.handleParticipantMessage(participantUpdateAckMessage)).doesNotThrowAnyException();
}
@Test
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
index 93f15f64d..683dd539a 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
@@ -130,7 +130,7 @@ class SupervisionScannerTest {
automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
acRuntimeParameterGroup);
- supervisionScanner.handleParticipantStatus(participant.getKey().asIdentifier());
+ supervisionScanner.handleParticipantStatus(participant.getParticipantId());
supervisionScanner.run(true);
verify(automationCompositionProvider, times(0)).updateAutomationComposition(any(AutomationComposition.class));
}
@@ -182,7 +182,6 @@ class SupervisionScannerTest {
var participant = CommonTestData.createParticipant(PARTICIPANT_TYPE, CommonTestData.getParticipantId());
participant.setParticipantState(ParticipantState.OFF_LINE);
- participant.setDefinition(new ToscaConceptIdentifier("unknown", "0.0.0"));
var participantProvider = mock(ParticipantProvider.class);
when(participantProvider.getParticipants()).thenReturn(List.of(participant));
@@ -193,9 +192,9 @@ class SupervisionScannerTest {
automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
acRuntimeParameterGroup);
- supervisionScanner.handleParticipantStatus(participant.getKey().asIdentifier());
+ supervisionScanner.handleParticipantStatus(participant.getParticipantId());
supervisionScanner.run(true);
- verify(participantProvider, times(0)).updateParticipant(any());
+ verify(participantProvider, times(0)).saveParticipant(any());
supervisionScanner.run(true);
verify(participantProvider, times(1)).updateParticipant(any());
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java
index 195afdc5d..7d80228db 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java
@@ -21,6 +21,7 @@
package org.onap.policy.clamp.acm.runtime.util;
import java.util.List;
+import java.util.UUID;
import javax.ws.rs.core.Response.Status;
import org.onap.policy.clamp.acm.runtime.main.parameters.AcRuntimeParameterGroup;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
@@ -76,13 +77,13 @@ public class CommonTestData {
public static List<Participant> createParticipants() {
var participant1 = createParticipant(
new ToscaConceptIdentifier("org.onap.policy.clamp.acm.KubernetesParticipant", "2.3.4"),
- new ToscaConceptIdentifier("K8sParticipant0", "1.0.0"));
+ UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c02"));
var participant2 = createParticipant(
new ToscaConceptIdentifier("org.onap.policy.clamp.acm.HttpParticipant", "2.3.4"),
- new ToscaConceptIdentifier("HttpParticipant0", "1.0.0"));
+ UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c01"));
var participant3 = createParticipant(
new ToscaConceptIdentifier("org.onap.policy.clamp.acm.PolicyParticipant", "2.3.1"),
- new ToscaConceptIdentifier("org.onap.PM_Policy", "1.0.0"));
+ UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c03"));
return List.of(participant1, participant2, participant3);
}
@@ -94,16 +95,14 @@ public class CommonTestData {
* @return a new Participant
*/
public static Participant createParticipant(ToscaConceptIdentifier participantType,
- ToscaConceptIdentifier participantId) {
+ UUID participantId) {
var participant = new Participant();
- participant.setDefinition(participantId);
+ participant.setParticipantId(participantId);
participant.setParticipantType(participantType);
- participant.setName(participantId.getName());
- participant.setVersion(participantId.getVersion());
return participant;
}
- public static ToscaConceptIdentifier getParticipantId() {
- return new ToscaConceptIdentifier("org.onap.PM_Policy", "1.0.0");
+ public static UUID getParticipantId() {
+ return UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c03");
}
}
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json b/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json
index a754de9d3..77078e6eb 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json
@@ -12,10 +12,7 @@
"name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "K8sParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c02",
"participantType": {
"name": "org.onap.policy.clamp.acm.KubernetesParticipant",
"version": "2.3.4"
@@ -30,10 +27,7 @@
"name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "HttpParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
"participantType": {
"name": "org.onap.policy.clamp.acm.HttpParticipant",
"version": "2.3.4"
@@ -48,10 +42,7 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "org.onap.PM_Policy",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
"participantType": {
"name": "org.onap.policy.clamp.acm.PolicyParticipant",
"version": "2.3.1"
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json
index ccfd587a4..80facb29c 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json
@@ -54,10 +54,7 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "org.onap.PM_Policy",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
"participantType": {
"name": "org.onap.policy.clamp.acm.PolicyParticipant",
"version": "2.3.1"
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json
index 0fe9671e2..e66f3f68d 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json
@@ -12,10 +12,7 @@
"name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "HttpParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
"participantType": {
"name": "org.onap.policy.clamp.acm.HttpParticipant",
"version": "2.3.4"
@@ -30,10 +27,7 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "org.onap.PM_Policy",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
"participantType": {
"name": "org.onap.policy.clamp.acm.PolicyParticipant",
"version": "2.3.1"
@@ -48,10 +42,7 @@
"name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "K8sParticipant0t",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c02",
"participantType": {
"name": "org.onap.policy.clamp.acm.KubernetesParticipant",
"version": "2.3.4"
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json
index 75dbed72a..d0372a342 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json
@@ -12,10 +12,7 @@
"name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "K8sParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c02",
"participantType": {
"name": "org.onap.policy.clamp.acm.KubernetesParticipant",
"version": "2.3.4"
@@ -30,10 +27,7 @@
"name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "HttpParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
"participantType": {
"name": "org.onap.policy.clamp.acm.HttpParticipant",
"version": "2.3.4"
@@ -48,10 +42,7 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "org.onap.PM_Policy",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
"participantType": {
"name": "org.onap.policy.clamp.acm.PolicyParticipant",
"version": "2.3.1"