summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2024-06-21 16:19:38 +0100
committerFrancesco Fiora <francesco.fiora@est.tech>2024-06-24 11:51:54 +0000
commit96b0e2bd8b3180396c3198ef0b0f9445dc1af727 (patch)
tree6e50f3c8c06c7306759c248faca0762a0da23b6a
parent98285f381934f8b419a2bb123ea4a084fdd7b540 (diff)
Fix registration flow
* set replicaId in RegisterAck message * ParticipantRegisterAckPublisher and ParticipantRegisterAckListener should be used with sync topic Issue-ID: POLICY-5060 Change-Id: I1292d636ea79055e902ec3d68108a28fbd80afdc Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantRegisterAckListener.java5
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java9
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java8
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java2
5 files changed, 20 insertions, 6 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantRegisterAckListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantRegisterAckListener.java
index 544e66fe4..8b8192e3a 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantRegisterAckListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantRegisterAckListener.java
@@ -45,4 +45,9 @@ public class ParticipantRegisterAckListener extends ParticipantAckListener<Parti
public String getType() {
return ParticipantMessageType.PARTICIPANT_REGISTER_ACK.name();
}
+
+ @Override
+ public boolean isDefaultTopic() {
+ return false;
+ }
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java
index 4c8c5815c..3c93a3571 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java
@@ -81,7 +81,7 @@ public class SupervisionParticipantHandler {
participantRegisterMsg.getParticipantSupportedElementType(), true);
participantRegisterAckPublisher.send(participantRegisterMsg.getMessageId(),
- participantRegisterMsg.getParticipantId());
+ participantRegisterMsg.getParticipantId(), participantRegisterMsg.getReplicaId());
}
/**
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
index d021c57a4..5e073080b 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
@@ -36,14 +36,21 @@ public class ParticipantRegisterAckPublisher extends AbstractParticipantAckPubli
*
* @param responseTo the original request id in the request.
* @param participantId the participant Id
+ * @param replicaId the participant replica Id
*/
@Timed(value = "publisher.participant_register_ack", description = "PARTICIPANT_REGISTER_ACK messages published")
- public void send(UUID responseTo, UUID participantId) {
+ public void send(UUID responseTo, UUID participantId, UUID replicaId) {
var message = new ParticipantRegisterAck();
message.setParticipantId(participantId);
+ message.setReplicaId(replicaId);
message.setResponseTo(responseTo);
message.setMessage("Participant Register Ack");
message.setResult(true);
super.send(message);
}
+
+ @Override
+ public boolean isDefaultTopic() {
+ return false;
+ }
}
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java
index bebaa3319..932529d79 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java
@@ -104,7 +104,7 @@ class SupervisionParticipantHandlerTest {
verify(participantProvider).saveParticipant(any());
verify(participantRegisterAckPublisher).send(participantRegisterMessage.getMessageId(),
- CommonTestData.getParticipantId());
+ CommonTestData.getParticipantId(), null);
}
@Test
@@ -158,7 +158,8 @@ class SupervisionParticipantHandlerTest {
CommonTestData.getTestParamaterGroup());
handler.handleParticipantMessage(participantRegisterMessage);
- verify(participantRegisterAckPublisher).send(participantRegisterMessage.getMessageId(), participantId);
+ verify(participantRegisterAckPublisher)
+ .send(participantRegisterMessage.getMessageId(), participantId, participantId);
verify(acDefinitionProvider).updateAcDefinition(any(AutomationCompositionDefinition.class),
eq(CommonTestData.TOSCA_COMP_NAME));
verify(participantRestartPublisher).send(any(), any(AutomationCompositionDefinition.class), any());
@@ -216,7 +217,8 @@ class SupervisionParticipantHandlerTest {
CommonTestData.getTestParamaterGroup());
handler.handleParticipantMessage(participantRegisterMessage);
- verify(participantRegisterAckPublisher).send(participantRegisterMessage.getMessageId(), participantId);
+ verify(participantRegisterAckPublisher)
+ .send(participantRegisterMessage.getMessageId(), participantId, replicaId);
verify(acDefinitionProvider, times(0)).updateAcDefinition(any(AutomationCompositionDefinition.class),
eq(CommonTestData.TOSCA_COMP_NAME));
verify(participantSyncPublisher)
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java
index cab5adf9c..7cf0bf84f 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java
@@ -200,7 +200,7 @@ class SupervisionMessagesTest {
var publisher = new ParticipantRegisterAckPublisher();
var topicSink = mock(TopicSink.class);
publisher.active(topicSink);
- publisher.send(UUID.randomUUID(), CommonTestData.getParticipantId());
+ publisher.send(UUID.randomUUID(), CommonTestData.getParticipantId(), CommonTestData.getReplicaId());
verify(topicSink).send(anyString());
}