summaryrefslogtreecommitdiffstats
path: root/participant/participant-intermediary/src
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-01-26 17:31:46 +0000
committerLiam Fallon <liam.fallon@est.tech>2023-01-30 16:39:27 +0000
commit934f7bd443225a6945b0542fa5cb7c043deac426 (patch)
tree55d490b816af0a50f521ee777f82757f28f9a16e /participant/participant-intermediary/src
parenta178851e9f2e148c17d81c29a9310644e0330b9a (diff)
Refactor Prime and Deprime messages in ACM
Issue-ID: POLICY-4502 Change-Id: Ib0ecc513285bf971a0c25cec528dcdeec5ad63a2 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-intermediary/src')
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java5
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java16
2 files changed, 17 insertions, 4 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
index f324cea0c..75f2d81ab 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
@@ -209,15 +209,16 @@ public class ParticipantHandler {
// This message is to decommission the automation composition
acElementDefsMap.get(participantUpdateMsg.getCompositionId()).clear();
}
- sendParticipantUpdateAck(participantUpdateMsg.getMessageId());
+ sendParticipantUpdateAck(participantUpdateMsg.getMessageId(), participantUpdateMsg.getCompositionId());
}
/**
* Method to send ParticipantUpdateAck message to automation composition runtime.
*/
- public void sendParticipantUpdateAck(UUID messageId) {
+ public void sendParticipantUpdateAck(UUID messageId, UUID compositionId) {
var participantUpdateAck = new ParticipantUpdateAck();
participantUpdateAck.setResponseTo(messageId);
+ participantUpdateAck.setCompositionId(compositionId);
participantUpdateAck.setMessage("Participant Update Ack message");
participantUpdateAck.setResult(true);
participantUpdateAck.setParticipantId(participantId);
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
index c538a0248..dc04440ca 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
@@ -25,6 +25,9 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
import java.time.Instant;
import java.util.List;
@@ -36,14 +39,13 @@ import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAckMessage;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
import org.onap.policy.common.utils.coder.CoderException;
class ParticipantHandlerTest {
private final CommonTestData commonTestData = new CommonTestData();
- private static final String ID_NAME = "org.onap.PM_CDS_Blueprint";
- private static final String ID_VERSION = "1.0.1";
@Test
void handleUpdateTest() {
@@ -119,4 +121,14 @@ class ParticipantHandlerTest {
}
+ @Test
+ void testHandleParticipantRegisterAck() {
+ var parameters = CommonTestData.getParticipantParameters();
+ var automationCompositionHandler = commonTestData.getMockAutomationCompositionHandler();
+ var publisher = mock(ParticipantMessagePublisher.class);
+ var participantHandler = new ParticipantHandler(parameters, publisher, automationCompositionHandler);
+
+ participantHandler.handleParticipantRegisterAck(new ParticipantRegisterAck());
+ verify(publisher).sendParticipantStatus(any());
+ }
}