aboutsummaryrefslogtreecommitdiffstats
path: root/participant/participant-intermediary
diff options
context:
space:
mode:
authorRamesh Murugan Iyer <ramesh.murugan.iyer@est.tech>2023-02-03 09:01:30 +0000
committerGerrit Code Review <gerrit@onap.org>2023-02-03 09:01:30 +0000
commit26814a2d839be880fa56c658f0d88940d957e872 (patch)
tree7835255e47bf1e76648889c1427a5b9604f90e5b /participant/participant-intermediary
parentb77b1160c9391f7b0cf1a16ce7e203a45203fb6a (diff)
parent9659c99c9c8b4b7ce33d7f48e61df44a03090186 (diff)
Merge "Refactor ParticipantUpdate to ParticipantPrime"
Diffstat (limited to 'participant/participant-intermediary')
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java14
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantPrimeListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantUpdateListener.java)14
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java48
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java6
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java28
5 files changed, 55 insertions, 55 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
index b18875813..4c885fa26 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
@@ -28,9 +28,9 @@ import org.onap.policy.clamp.acm.participant.intermediary.handler.Publisher;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrimeAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient;
import org.slf4j.Logger;
@@ -100,15 +100,15 @@ public class ParticipantMessagePublisher implements Publisher {
}
/**
- * Method to send Participant Update Ack message to runtime.
+ * Method to send Participant Prime Ack message to runtime.
*
- * @param participantUpdateAck the Participant Update Ack
+ * @param participantPrimeAck the Participant Prime Ack
*/
- @Timed(value = "publisher.participant_update_ack", description = "PARTICIPANT_UPDATE_ACK messages published")
- public void sendParticipantUpdateAck(final ParticipantUpdateAck participantUpdateAck) {
+ @Timed(value = "publisher.participant_prime_ack", description = "PARTICIPANT_PRIME_ACK messages published")
+ public void sendParticipantPrimeAck(final ParticipantPrimeAck participantPrimeAck) {
validate();
- topicSinkClient.send(participantUpdateAck);
- LOGGER.debug("Sent Participant Update Ack message to CLAMP - {}", participantUpdateAck);
+ topicSinkClient.send(participantPrimeAck);
+ LOGGER.debug("Sent Participant Prime Ack message to CLAMP - {}", participantPrimeAck);
}
/**
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantUpdateListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantPrimeListener.java
index 19eb5fb30..e114c74f9 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantUpdateListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantPrimeListener.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,26 +22,26 @@ package org.onap.policy.clamp.acm.participant.intermediary.comm;
import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrime;
import org.springframework.stereotype.Component;
/**
- * Listener for Participant Update messages sent by runtime.
+ * Listener for Participant Prime messages sent by runtime.
*/
@Component
-public class ParticipantUpdateListener extends ParticipantListener<ParticipantUpdate> {
+public class ParticipantPrimeListener extends ParticipantListener<ParticipantPrime> {
/**
* Constructs the object.
*
* @param participantHandler the handler for managing the state of the participant
*/
- public ParticipantUpdateListener(final ParticipantHandler participantHandler) {
- super(ParticipantUpdate.class, participantHandler, participantHandler::handleParticipantUpdate);
+ public ParticipantPrimeListener(final ParticipantHandler participantHandler) {
+ super(ParticipantPrime.class, participantHandler, participantHandler::handleParticipantPrime);
}
@Override
public String getType() {
- return ParticipantMessageType.PARTICIPANT_UPDATE.name();
+ return ParticipantMessageType.PARTICIPANT_PRIME.name();
}
}
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 050d66d0b..3aae2c41a 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
@@ -42,12 +42,12 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAc
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrime;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrimeAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -186,44 +186,44 @@ public class ParticipantHandler {
}
/**
- * Handle a ParticipantUpdate message.
+ * Handle a ParticipantPrime message.
*
- * @param participantUpdateMsg the ParticipantUpdate message
+ * @param participantPrimeMsg the ParticipantPrime message
*/
- @Timed(value = "listener.participant_update", description = "PARTICIPANT_UPDATE messages received")
- public void handleParticipantUpdate(ParticipantUpdate participantUpdateMsg) {
- LOGGER.debug("ParticipantUpdate message received for participantId {}",
- participantUpdateMsg.getParticipantId());
+ @Timed(value = "listener.participant_prime", description = "PARTICIPANT_PRIME messages received")
+ public void handleParticipantPrime(ParticipantPrime participantPrimeMsg) {
+ LOGGER.debug("ParticipantPrime message received for participantId {}",
+ participantPrimeMsg.getParticipantId());
- acElementDefsMap.putIfAbsent(participantUpdateMsg.getCompositionId(), new ArrayList<>());
- if (!participantUpdateMsg.getParticipantDefinitionUpdates().isEmpty()) {
+ acElementDefsMap.putIfAbsent(participantPrimeMsg.getCompositionId(), new ArrayList<>());
+ if (!participantPrimeMsg.getParticipantDefinitionUpdates().isEmpty()) {
// This message is to commission the automation composition
- for (var participantDefinition : participantUpdateMsg.getParticipantDefinitionUpdates()) {
+ for (var participantDefinition : participantPrimeMsg.getParticipantDefinitionUpdates()) {
if (participantDefinition.getParticipantId().equals(participantId)) {
- acElementDefsMap.get(participantUpdateMsg.getCompositionId())
+ acElementDefsMap.get(participantPrimeMsg.getCompositionId())
.addAll(participantDefinition.getAutomationCompositionElementDefinitionList());
break;
}
}
} else {
// This message is to decommission the automation composition
- acElementDefsMap.get(participantUpdateMsg.getCompositionId()).clear();
+ acElementDefsMap.get(participantPrimeMsg.getCompositionId()).clear();
}
- sendParticipantUpdateAck(participantUpdateMsg.getMessageId(), participantUpdateMsg.getCompositionId());
+ sendParticipantPrimeAck(participantPrimeMsg.getMessageId(), participantPrimeMsg.getCompositionId());
}
/**
- * Method to send ParticipantUpdateAck message to automation composition runtime.
+ * Method to send ParticipantPrimeAck message to automation composition runtime.
*/
- 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);
- participantUpdateAck.setState(ParticipantState.ON_LINE);
- publisher.sendParticipantUpdateAck(participantUpdateAck);
+ public void sendParticipantPrimeAck(UUID messageId, UUID compositionId) {
+ var participantPrimeAck = new ParticipantPrimeAck();
+ participantPrimeAck.setResponseTo(messageId);
+ participantPrimeAck.setCompositionId(compositionId);
+ participantPrimeAck.setMessage("Participant Prime Ack message");
+ participantPrimeAck.setResult(true);
+ participantPrimeAck.setParticipantId(participantId);
+ participantPrimeAck.setState(ParticipantState.ON_LINE);
+ publisher.sendParticipantPrimeAck(participantPrimeAck);
}
/**
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java
index d9d99da4e..1540d6e4c 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,8 +56,8 @@ class ParticipantCommTest {
assertEquals(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK.name(),
participantDeregisterAckListener.getType());
- var participantUpdateListener = new ParticipantUpdateListener(participantHandler);
- assertEquals(ParticipantMessageType.PARTICIPANT_UPDATE.name(), participantUpdateListener.getType());
+ var participantPrimeListener = new ParticipantPrimeListener(participantHandler);
+ assertEquals(ParticipantMessageType.PARTICIPANT_PRIME.name(), participantPrimeListener.getType());
var automationCompositionUpdateListener = new AutomationCompositionDeployListener(participantHandler);
assertEquals(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY.name(),
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 9f1bf29be..7349ab9c0 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
@@ -39,8 +39,8 @@ 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.ParticipantPrime;
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 {
@@ -54,43 +54,43 @@ class ParticipantHandlerTest {
var publisher = new ParticipantMessagePublisher();
var emptyParticipantHandler =
new ParticipantHandler(parameters, publisher, automationCompositionHander);
- var participantUpdateMsg = new ParticipantUpdate();
+ var participantPrimeMsg = new ParticipantPrime();
assertThatThrownBy(() ->
- emptyParticipantHandler.handleParticipantUpdate(participantUpdateMsg))
+ emptyParticipantHandler.handleParticipantPrime(participantPrimeMsg))
.isInstanceOf(RuntimeException.class);
var participantHandler = commonTestData.getMockParticipantHandler();
var participantId = CommonTestData.getParticipantId();
- participantUpdateMsg.setAutomationCompositionId(CommonTestData.AC_ID_1);
- participantUpdateMsg.setCompositionId(CommonTestData.AC_ID_1);
- participantUpdateMsg.setParticipantId(participantId);
- participantUpdateMsg.setMessageId(UUID.randomUUID());
- participantUpdateMsg.setTimestamp(Instant.ofEpochMilli(3000));
+ participantPrimeMsg.setAutomationCompositionId(CommonTestData.AC_ID_1);
+ participantPrimeMsg.setCompositionId(CommonTestData.AC_ID_1);
+ participantPrimeMsg.setParticipantId(participantId);
+ participantPrimeMsg.setMessageId(UUID.randomUUID());
+ participantPrimeMsg.setTimestamp(Instant.ofEpochMilli(3000));
var heartbeatF = participantHandler.makeHeartbeat(false);
assertEquals(participantId, heartbeatF.getParticipantId());
assertThat(heartbeatF.getAutomationCompositionInfoList()).isEmpty();
- participantHandler.handleParticipantUpdate(participantUpdateMsg);
+ participantHandler.handleParticipantPrime(participantPrimeMsg);
var heartbeatT = participantHandler.makeHeartbeat(true);
assertEquals(participantId, heartbeatT.getParticipantId());
assertThat(heartbeatT.getParticipantDefinitionUpdates()).isNotEmpty();
assertEquals(participantId, heartbeatT.getParticipantDefinitionUpdates().get(0).getParticipantId());
- var pum = setListParticipantDefinition(participantUpdateMsg);
- participantHandler.handleParticipantUpdate(pum);
+ var pum = setListParticipantDefinition(participantPrimeMsg);
+ participantHandler.handleParticipantPrime(pum);
var heartbeatTAfterUpdate = participantHandler.makeHeartbeat(true);
assertEquals(participantId, heartbeatTAfterUpdate.getParticipantId());
}
- private ParticipantUpdate setListParticipantDefinition(ParticipantUpdate participantUpdateMsg) {
+ private ParticipantPrime setListParticipantDefinition(ParticipantPrime participantPrimeMsg) {
var def = new ParticipantDefinition();
def.setParticipantId(CommonTestData.getParticipantId());
- participantUpdateMsg.setParticipantDefinitionUpdates(List.of(def));
- return participantUpdateMsg;
+ participantPrimeMsg.setParticipantDefinitionUpdates(List.of(def));
+ return participantPrimeMsg;
}
@Test