aboutsummaryrefslogtreecommitdiffstats
path: root/runtime-acm/src/test/java
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/java
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/java')
-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
3 files changed, 13 insertions, 14 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");
}
}