Fix participant not sending ack 13/142113/2
authordanielhanrahan <daniel.hanrahan@est.tech>
Wed, 24 Sep 2025 12:20:10 +0000 (13:20 +0100)
committerdanielhanrahan <daniel.hanrahan@est.tech>
Wed, 24 Sep 2025 12:52:38 +0000 (13:52 +0100)
After logging change, the code to send the ack was removed.
This fixes recent CSIT failures. Also add unit tests.

Issue-ID: POLICY-5452
Change-Id: I9ad595fca6082d9c34d0d63a109bfd7cdde99eb7
Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech>
participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java

index f520efc..523b114 100644 (file)
@@ -143,6 +143,7 @@ public class ParticipantMessagePublisher implements Publisher {
             description = "AUTOMATION_COMPOSITION_UPDATE_ACK/AUTOMATION_COMPOSITION_STATECHANGE_ACK messages published")
     public void sendAutomationCompositionAck(final AutomationCompositionDeployAck automationCompositionAck) {
         validate();
+        topicSinkClient.send(automationCompositionAck);
         NetLoggerUtil.log(NetLoggerUtil.EventType.OUT, topicSinkClient.getSink().getTopicCommInfrastructure(),
                 topicSinkClient.getTopic(), "Sent AutomationComposition Update/StateChange Ack to runtime - "
                         + automationCompositionAck.toString());
index 6b248fa..63baef2 100644 (file)
@@ -27,6 +27,7 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
 import static org.junit.jupiter.api.Assertions.assertThrows;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
 
 import java.util.Collections;
 import java.util.List;
@@ -48,6 +49,9 @@ import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantSt
 import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantStatusReq;
 import org.onap.policy.common.message.bus.event.Topic;
 import org.onap.policy.common.message.bus.event.TopicSink;
+import org.onap.policy.common.utils.coder.Coder;
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
 import org.onap.policy.common.utils.coder.StandardCoderObject;
 
 class ParticipantCommTest {
@@ -100,26 +104,35 @@ class ParticipantCommTest {
     }
 
     @Test
-    void participantMessagePublisherTest() {
+    void participantMessagePublisherTest() throws CoderException {
+        var coder = new StandardCoder();
+        var mockTopicSink = mock(TopicSink.class);
         var publisher = new ParticipantMessagePublisher();
-        publisher.active(Collections.singletonList(Mockito.mock(TopicSink.class)));
+        publisher.active(Collections.singletonList(mockTopicSink));
+
         var participantStatus = new ParticipantStatus();
         assertDoesNotThrow(() -> publisher.sendParticipantStatus(participantStatus));
+        verify(mockTopicSink).send(coder.encode(participantStatus));
 
         var participantRegister = new ParticipantRegister();
         assertDoesNotThrow(() -> publisher.sendParticipantRegister(participantRegister));
+        verify(mockTopicSink).send(coder.encode(participantRegister));
 
         var participantDeregister = new ParticipantDeregister();
         assertDoesNotThrow(() -> publisher.sendParticipantDeregister(participantDeregister));
+        verify(mockTopicSink).send(coder.encode(participantDeregister));
 
         var participantPrimeAck = new ParticipantPrimeAck();
         assertDoesNotThrow(() -> publisher.sendParticipantPrimeAck(participantPrimeAck));
+        verify(mockTopicSink).send(coder.encode(participantPrimeAck));
 
-        var automationCompositionAck = mock(AutomationCompositionDeployAck.class);
+        var automationCompositionAck = new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY);
         assertDoesNotThrow(() -> publisher.sendAutomationCompositionAck(automationCompositionAck));
+        verify(mockTopicSink).send(coder.encode(automationCompositionAck));
 
-        var participantReqSync = mock(ParticipantReqSync.class);
+        var participantReqSync = new ParticipantReqSync();
         assertDoesNotThrow(() -> publisher.sendParticipantReqSync(participantReqSync));
+        verify(mockTopicSink).send(coder.encode(participantReqSync));
     }
 
     @Test