diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2023-01-30 13:43:10 +0000 |
---|---|---|
committer | FrancescoFioraEst <francesco.fiora@est.tech> | 2023-01-31 10:20:02 +0000 |
commit | 7f762dfa19f673241f8ea1b2ff3d56d2d58bdcdb (patch) | |
tree | 591b04b568efed20c76f7d67973163d075d27162 /runtime-acm | |
parent | 934f7bd443225a6945b0542fa5cb7c043deac426 (diff) |
Refactor ACM Update message to ACM Deploy message in ACM
Refactor ACM Update message to ACM Deploy message in ACM
and add AcElementDeploy in Deploy message.
AutomationCompositionElement will be removed from the message
after POLICY-4506 and POLICY-4507.
Issue-ID: POLICY-4543
Change-Id: I8444e15b3b4cb1209ffd083fb965e0707fbd9625
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm')
8 files changed, 88 insertions, 87 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java index 2542bdb15..374df0135 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java @@ -27,15 +27,15 @@ import java.util.Set; import java.util.UUID; import javax.ws.rs.core.Response; import lombok.AllArgsConstructor; +import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionDeployPublisher; import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher; -import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher; import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException; +import org.onap.policy.clamp.models.acm.concepts.AcElementDeployAck; import org.onap.policy.clamp.models.acm.concepts.AcTypeState; import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; -import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState; import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck; import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider; import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider; @@ -66,7 +66,7 @@ public class SupervisionHandler { private final AcDefinitionProvider acDefinitionProvider; // Publishers for participant communication - private final AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher; + private final AutomationCompositionDeployPublisher automationCompositionDeployPublisher; private final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher; /** @@ -76,9 +76,10 @@ public class SupervisionHandler { */ @MessageIntercept @Timed( - value = "listener.automation_composition_update_ack", - description = "AUTOMATION_COMPOSITION_UPDATE_ACK messages received") - public void handleAutomationCompositionUpdateAckMessage(AutomationCompositionAck automationCompositionAckMessage) { + value = "listener.automation_composition_deploy_ack", + description = "AUTOMATION_COMPOSITION_DEPLOY_ACK messages received") + public void handleAutomationCompositionUpdateAckMessage( + AutomationCompositionDeployAck automationCompositionAckMessage) { LOGGER.debug("AutomationComposition Update Ack message received {}", automationCompositionAckMessage); setAcElementStateInDb(automationCompositionAckMessage); } @@ -128,12 +129,12 @@ public class SupervisionHandler { value = "listener.automation_composition_statechange_ack", description = "AUTOMATION_COMPOSITION_STATECHANGE_ACK messages received") public void handleAutomationCompositionStateChangeAckMessage( - AutomationCompositionAck automationCompositionAckMessage) { + AutomationCompositionDeployAck automationCompositionAckMessage) { LOGGER.debug("AutomationComposition StateChange Ack message received {}", automationCompositionAckMessage); setAcElementStateInDb(automationCompositionAckMessage); } - private void setAcElementStateInDb(AutomationCompositionAck automationCompositionAckMessage) { + private void setAcElementStateInDb(AutomationCompositionDeployAck automationCompositionAckMessage) { if (automationCompositionAckMessage.getAutomationCompositionResultMap() != null) { var automationComposition = automationCompositionProvider .findAutomationComposition(automationCompositionAckMessage.getAutomationCompositionId()); @@ -152,7 +153,7 @@ public class SupervisionHandler { } private boolean updateState(AutomationComposition automationComposition, - Set<Map.Entry<UUID, AutomationCompositionElementAck>> automationCompositionResultSet) { + Set<Map.Entry<UUID, AcElementDeployAck>> automationCompositionResultSet) { var updated = false; for (var acElementAck : automationCompositionResultSet) { var element = automationComposition.getElements().get(acElementAck.getKey()); @@ -256,7 +257,7 @@ public class SupervisionHandler { break; case UNINITIALISED: automationComposition.setState(AutomationCompositionState.UNINITIALISED2PASSIVE); - automationCompositionUpdatePublisher.send(automationComposition); + automationCompositionDeployPublisher.send(automationComposition); break; case UNINITIALISED2PASSIVE: diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java index 0e5aab5e3..68ec44dc0 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java @@ -26,8 +26,8 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; import org.onap.policy.clamp.acm.runtime.main.parameters.AcRuntimeParameterGroup; +import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionDeployPublisher; import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher; -import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher; import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState; import org.onap.policy.clamp.models.acm.concepts.Participant; @@ -56,7 +56,7 @@ public class SupervisionScanner { private final AutomationCompositionProvider automationCompositionProvider; private final AcDefinitionProvider acDefinitionProvider; private final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher; - private final AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher; + private final AutomationCompositionDeployPublisher automationCompositionDeployPublisher; private final ParticipantProvider participantProvider; /** @@ -65,20 +65,20 @@ public class SupervisionScanner { * @param automationCompositionProvider the provider to use to read automation compositions from the database * @param acDefinitionProvider the Policy Models Provider * @param automationCompositionStateChangePublisher the AutomationComposition StateChange Publisher - * @param automationCompositionUpdatePublisher the AutomationCompositionUpdate Publisher + * @param automationCompositionDeployPublisher the AutomationCompositionUpdate Publisher * @param participantProvider the Participant Provider * @param acRuntimeParameterGroup the parameters for the automation composition runtime */ public SupervisionScanner(final AutomationCompositionProvider automationCompositionProvider, AcDefinitionProvider acDefinitionProvider, final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher, - AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher, + AutomationCompositionDeployPublisher automationCompositionDeployPublisher, ParticipantProvider participantProvider, final AcRuntimeParameterGroup acRuntimeParameterGroup) { this.automationCompositionProvider = automationCompositionProvider; this.acDefinitionProvider = acDefinitionProvider; this.automationCompositionStateChangePublisher = automationCompositionStateChangePublisher; - this.automationCompositionUpdatePublisher = automationCompositionUpdatePublisher; + this.automationCompositionDeployPublisher = automationCompositionDeployPublisher; this.participantProvider = participantProvider; automationCompositionCounter.setMaxRetryCount( @@ -229,7 +229,7 @@ public class SupervisionScanner { private void sendAutomationCompositionMsg(AutomationComposition automationComposition, int startPhase) { if (AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())) { LOGGER.debug("retry message AutomationCompositionUpdate"); - automationCompositionUpdatePublisher.send(automationComposition, startPhase); + automationCompositionDeployPublisher.send(automationComposition, startPhase); } else { LOGGER.debug("retry message AutomationCompositionStateChange"); automationCompositionStateChangePublisher.send(automationComposition, startPhase); diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java index 57556e088..4a0abc180 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java @@ -29,8 +29,8 @@ import java.util.List; import java.util.UUID; import lombok.AllArgsConstructor; import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; -import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate; +import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeploy; import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider; import org.onap.policy.clamp.models.acm.utils.AcmUtils; import org.slf4j.Logger; @@ -38,52 +38,52 @@ import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; /** - * This class is used to send AutomationCompositionUpdate messages to participants on DMaaP. + * This class is used to send AutomationCompositionDeploy messages to participants on DMaaP. */ @Component @AllArgsConstructor -public class AutomationCompositionUpdatePublisher extends AbstractParticipantPublisher<AutomationCompositionUpdate> { +public class AutomationCompositionDeployPublisher extends AbstractParticipantPublisher<AutomationCompositionDeploy> { - private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionUpdatePublisher.class); + private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionDeployPublisher.class); private final AcDefinitionProvider acDefinitionProvider; /** - * Send AutomationCompositionUpdate to Participant. + * Send AutomationCompositionDeploy to Participant. * * @param automationComposition the AutomationComposition */ - @Timed(value = "publisher.automation_composition_update", - description = "AUTOMATION_COMPOSITION_UPDATE messages published") + @Timed(value = "publisher.automation_composition_deploy", + description = "AUTOMATION_COMPOSITION_DEPLOY messages published") public void send(AutomationComposition automationComposition) { send(automationComposition, 0); } /** - * Send AutomationCompositionUpdate to Participant. + * Send AutomationCompositionDeploy to Participant. * * @param automationComposition the AutomationComposition * @param startPhase the Start Phase */ - @Timed(value = "publisher.automation_composition_update", - description = "AUTOMATION_COMPOSITION_UPDATE messages published") + @Timed(value = "publisher.automation_composition_deploy", + description = "AUTOMATION_COMPOSITION_DEPLOY messages published") public void send(AutomationComposition automationComposition, int startPhase) { - var automationCompositionUpdateMsg = new AutomationCompositionUpdate(); - automationCompositionUpdateMsg.setCompositionId(automationComposition.getCompositionId()); - automationCompositionUpdateMsg.setStartPhase(startPhase); - automationCompositionUpdateMsg.setAutomationCompositionId(automationComposition.getInstanceId()); - automationCompositionUpdateMsg.setMessageId(UUID.randomUUID()); - automationCompositionUpdateMsg.setTimestamp(Instant.now()); + var acDeployMsg = new AutomationCompositionDeploy(); + acDeployMsg.setCompositionId(automationComposition.getCompositionId()); + acDeployMsg.setStartPhase(startPhase); + acDeployMsg.setAutomationCompositionId(automationComposition.getInstanceId()); + acDeployMsg.setMessageId(UUID.randomUUID()); + acDeployMsg.setTimestamp(Instant.now()); var toscaServiceTemplate = acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId()).getServiceTemplate(); - List<ParticipantUpdates> participantUpdates = new ArrayList<>(); + List<ParticipantDeploy> participantDeploys = new ArrayList<>(); for (var element : automationComposition.getElements().values()) { AcmUtils.setAcPolicyInfo(element, toscaServiceTemplate); - AcmUtils.prepareParticipantUpdate(element, participantUpdates); + AcmUtils.prepareParticipantUpdate(element, participantDeploys); } - automationCompositionUpdateMsg.setParticipantUpdatesList(participantUpdates); + acDeployMsg.setParticipantUpdatesList(participantDeploys); - LOGGER.debug("AutomationCompositionUpdate message sent {}", automationCompositionUpdateMsg); - super.send(automationCompositionUpdateMsg); + LOGGER.debug("AutomationCompositionDeploy message sent {}", acDeployMsg); + super.send(acDeployMsg); } } diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java index dd07be680..ed1662a95 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java @@ -23,7 +23,7 @@ package org.onap.policy.clamp.acm.runtime.supervision.comm; import org.onap.policy.clamp.acm.runtime.config.messaging.Listener; import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.listeners.ScoListener; @@ -36,8 +36,8 @@ import org.springframework.stereotype.Component; * Listener for AutomationCompositionStateChangeAck messages sent by participants. */ @Component -public class AutomationCompositionStateChangeAckListener extends ScoListener<AutomationCompositionAck> - implements Listener<AutomationCompositionAck> { +public class AutomationCompositionStateChangeAckListener extends ScoListener<AutomationCompositionDeployAck> + implements Listener<AutomationCompositionDeployAck> { private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionStateChangeAckListener.class); private final SupervisionHandler supervisionHandler; @@ -46,20 +46,20 @@ public class AutomationCompositionStateChangeAckListener extends ScoListener<Aut * Constructs the object. */ public AutomationCompositionStateChangeAckListener(SupervisionHandler supervisionHandler) { - super(AutomationCompositionAck.class); + super(AutomationCompositionDeployAck.class); this.supervisionHandler = supervisionHandler; } @Override public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco, - final AutomationCompositionAck automationCompositionStateChangeAckMessage) { + final AutomationCompositionDeployAck automationCompositionStateChangeAckMessage) { LOGGER.debug("AutomationCompositionStateChangeAck received from participant - {}", automationCompositionStateChangeAckMessage); supervisionHandler.handleAutomationCompositionStateChangeAckMessage(automationCompositionStateChangeAckMessage); } @Override - public ScoListener<AutomationCompositionAck> getScoListener() { + public ScoListener<AutomationCompositionDeployAck> getScoListener() { return this; } diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java index 7a1d5294c..64d1fbef1 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java @@ -23,7 +23,7 @@ package org.onap.policy.clamp.acm.runtime.supervision.comm; import org.onap.policy.clamp.acm.runtime.config.messaging.Listener; import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.listeners.ScoListener; @@ -36,8 +36,8 @@ import org.springframework.stereotype.Component; * Listener for AutomationCompositionUpdateAck messages sent by participants. */ @Component -public class AutomationCompositionUpdateAckListener extends ScoListener<AutomationCompositionAck> - implements Listener<AutomationCompositionAck> { +public class AutomationCompositionUpdateAckListener extends ScoListener<AutomationCompositionDeployAck> + implements Listener<AutomationCompositionDeployAck> { private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionUpdateAckListener.class); private final SupervisionHandler supervisionHandler; @@ -46,25 +46,25 @@ public class AutomationCompositionUpdateAckListener extends ScoListener<Automati * Constructs the object. */ public AutomationCompositionUpdateAckListener(SupervisionHandler supervisionHandler) { - super(AutomationCompositionAck.class); + super(AutomationCompositionDeployAck.class); this.supervisionHandler = supervisionHandler; } @Override public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco, - final AutomationCompositionAck automationCompositionUpdateAckMessage) { + final AutomationCompositionDeployAck automationCompositionUpdateAckMessage) { LOGGER.debug("AutomationCompositionUpdateAck message received from participant - {}", automationCompositionUpdateAckMessage); supervisionHandler.handleAutomationCompositionUpdateAckMessage(automationCompositionUpdateAckMessage); } @Override - public ScoListener<AutomationCompositionAck> getScoListener() { + public ScoListener<AutomationCompositionDeployAck> getScoListener() { return this; } @Override public String getType() { - return ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK.name(); + return ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY_ACK.name(); } } 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 c6535702b..8ae21ca75 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 @@ -36,8 +36,8 @@ import java.util.UUID; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils; +import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionDeployPublisher; import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher; -import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher; import org.onap.policy.clamp.acm.runtime.util.CommonTestData; import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException; import org.onap.policy.clamp.models.acm.concepts.AcTypeState; @@ -46,7 +46,7 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState; import org.onap.policy.clamp.models.acm.concepts.ParticipantState; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck; import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider; @@ -59,8 +59,8 @@ class SupervisionHandlerTest { @Test void testTriggerAutomationCompositionSupervision() throws AutomationCompositionException { - var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class); - var handler = createSupervisionHandlerForTrigger(automationCompositionUpdatePublisher); + var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class); + var handler = createSupervisionHandlerForTrigger(automationCompositionDeployPublisher); var automationComposition = InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud"); @@ -68,7 +68,7 @@ class SupervisionHandlerTest { automationComposition.setState(AutomationCompositionState.UNINITIALISED); handler.triggerAutomationCompositionSupervision(automationComposition); - verify(automationCompositionUpdatePublisher).send(automationComposition); + verify(automationCompositionDeployPublisher).send(automationComposition); } @Test @@ -101,7 +101,7 @@ class SupervisionHandlerTest { var automationCompositionProvider = mock(AutomationCompositionProvider.class); var handler = new SupervisionHandler(automationCompositionProvider, acDefinitionProvider, - mock(AutomationCompositionUpdatePublisher.class), automationCompositionStateChangePublisher); + mock(AutomationCompositionDeployPublisher.class), automationCompositionStateChangePublisher); handler.triggerAutomationCompositionSupervision(automationComposition); @@ -149,7 +149,7 @@ class SupervisionHandlerTest { void testAcRunningToPassive() throws AutomationCompositionException { var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class); var handler = createSupervisionHandler(mock(AutomationCompositionProvider.class), - mock(AutomationCompositionUpdatePublisher.class), automationCompositionStateChangePublisher, + mock(AutomationCompositionDeployPublisher.class), automationCompositionStateChangePublisher, AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED); var automationComposition = @@ -193,7 +193,7 @@ class SupervisionHandlerTest { void testAcPassiveToRunning() throws AutomationCompositionException { var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class); var handler = createSupervisionHandler(mock(AutomationCompositionProvider.class), - mock(AutomationCompositionUpdatePublisher.class), automationCompositionStateChangePublisher, + mock(AutomationCompositionDeployPublisher.class), automationCompositionStateChangePublisher, AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED); var automationComposition = @@ -210,10 +210,10 @@ class SupervisionHandlerTest { void testHandleAutomationCompositionStateChangeAckMessage() { var automationCompositionProvider = mock(AutomationCompositionProvider.class); var handler = createSupervisionHandler(automationCompositionProvider, - mock(AutomationCompositionUpdatePublisher.class), mock(AutomationCompositionStateChangePublisher.class), + mock(AutomationCompositionDeployPublisher.class), mock(AutomationCompositionStateChangePublisher.class), AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED); var automationCompositionAckMessage = - new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK); + new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK); automationCompositionAckMessage.setAutomationCompositionResultMap(Map.of()); automationCompositionAckMessage.setAutomationCompositionId(IDENTIFIER); @@ -225,13 +225,13 @@ class SupervisionHandlerTest { @Test void testHandleAutomationCompositionUpdateAckMessage() { var automationCompositionAckMessage = - new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK); + new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY_ACK); automationCompositionAckMessage.setParticipantId(CommonTestData.getParticipantId()); automationCompositionAckMessage.setAutomationCompositionResultMap(Map.of()); automationCompositionAckMessage.setAutomationCompositionId(IDENTIFIER); var automationCompositionProvider = mock(AutomationCompositionProvider.class); var handler = createSupervisionHandler(automationCompositionProvider, - mock(AutomationCompositionUpdatePublisher.class), mock(AutomationCompositionStateChangePublisher.class), + mock(AutomationCompositionDeployPublisher.class), mock(AutomationCompositionStateChangePublisher.class), AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED); handler.handleAutomationCompositionUpdateAckMessage(automationCompositionAckMessage); @@ -246,7 +246,7 @@ class SupervisionHandlerTest { participantUpdateAckMessage.setState(ParticipantState.ON_LINE); var acDefinitionProvider = mock(AcDefinitionProvider.class); var handler = new SupervisionHandler(mock(AutomationCompositionProvider.class), acDefinitionProvider, - mock(AutomationCompositionUpdatePublisher.class), + mock(AutomationCompositionDeployPublisher.class), mock(AutomationCompositionStateChangePublisher.class)); handler.handleParticipantMessage(participantUpdateAckMessage); @@ -268,7 +268,7 @@ class SupervisionHandlerTest { .thenReturn(Optional.of(acDefinition)); var handler = new SupervisionHandler(mock(AutomationCompositionProvider.class), acDefinitionProvider, - mock(AutomationCompositionUpdatePublisher.class), + mock(AutomationCompositionDeployPublisher.class), mock(AutomationCompositionStateChangePublisher.class)); handler.handleParticipantMessage(participantUpdateAckMessage); @@ -290,7 +290,7 @@ class SupervisionHandlerTest { .thenReturn(Optional.of(acDefinition)); var handler = new SupervisionHandler(mock(AutomationCompositionProvider.class), acDefinitionProvider, - mock(AutomationCompositionUpdatePublisher.class), + mock(AutomationCompositionDeployPublisher.class), mock(AutomationCompositionStateChangePublisher.class)); handler.handleParticipantMessage(participantUpdateAckMessage); @@ -299,7 +299,7 @@ class SupervisionHandlerTest { } private SupervisionHandler createSupervisionHandler(AutomationCompositionProvider automationCompositionProvider, - AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher, + AutomationCompositionDeployPublisher automationCompositionDeployPublisher, AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher, AutomationCompositionOrderedState orderedState, AutomationCompositionState state) { var automationComposition = @@ -320,19 +320,19 @@ class SupervisionHandlerTest { when(acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId())).thenReturn(acDefinition); return new SupervisionHandler(automationCompositionProvider, acDefinitionProvider, - automationCompositionUpdatePublisher, automationCompositionStateChangePublisher); + automationCompositionDeployPublisher, automationCompositionStateChangePublisher); } private SupervisionHandler createSupervisionHandlerForTrigger() { return new SupervisionHandler(mock(AutomationCompositionProvider.class), mock(AcDefinitionProvider.class), - mock(AutomationCompositionUpdatePublisher.class), + mock(AutomationCompositionDeployPublisher.class), mock(AutomationCompositionStateChangePublisher.class)); } private SupervisionHandler createSupervisionHandlerForTrigger( - AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher) { + AutomationCompositionDeployPublisher automationCompositionDeployPublisher) { return new SupervisionHandler(mock(AutomationCompositionProvider.class), mock(AcDefinitionProvider.class), - automationCompositionUpdatePublisher, mock(AutomationCompositionStateChangePublisher.class)); + automationCompositionDeployPublisher, mock(AutomationCompositionStateChangePublisher.class)); } } 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 936555aa3..5917a435c 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 @@ -34,8 +34,8 @@ import java.util.UUID; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils; +import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionDeployPublisher; import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher; -import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher; import org.onap.policy.clamp.acm.runtime.util.CommonTestData; import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition; @@ -73,7 +73,7 @@ class SupervisionScannerTest { void testScannerOrderedStateEqualsToState() { var automationCompositionProvider = mock(AutomationCompositionProvider.class); var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class); - var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class); + var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class); var participantProvider = mock(ParticipantProvider.class); var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner"); @@ -82,7 +82,7 @@ class SupervisionScannerTest { .thenReturn(List.of(automationComposition)); var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider, - automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider, + automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider, acRuntimeParameterGroup); supervisionScanner.run(false); @@ -98,13 +98,13 @@ class SupervisionScannerTest { when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId)) .thenReturn(List.of(automationComposition)); - var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class); + var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class); var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class); var participantProvider = mock(ParticipantProvider.class); var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner"); var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider, - automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider, + automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider, acRuntimeParameterGroup); supervisionScanner.run(false); @@ -122,12 +122,12 @@ class SupervisionScannerTest { var participant = CommonTestData.createParticipant(CommonTestData.getParticipantId()); when(participantProvider.getParticipants()).thenReturn(List.of(participant)); - var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class); + var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class); var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class); var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner"); var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider, - automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider, + automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider, acRuntimeParameterGroup); supervisionScanner.handleParticipantStatus(participant.getParticipantId()); @@ -156,17 +156,17 @@ class SupervisionScannerTest { .thenReturn(List.of(automationComposition)); var participantProvider = mock(ParticipantProvider.class); - var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class); + var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class); var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class); var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner"); var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider, - automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider, + automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider, acRuntimeParameterGroup); supervisionScanner.run(false); - verify(automationCompositionUpdatePublisher).send(any(AutomationComposition.class), anyInt()); + verify(automationCompositionDeployPublisher).send(any(AutomationComposition.class), anyInt()); } @Test @@ -185,11 +185,11 @@ class SupervisionScannerTest { var participantProvider = mock(ParticipantProvider.class); when(participantProvider.getParticipants()).thenReturn(List.of(participant)); - var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class); + var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class); var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class); var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider, - automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider, + automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider, acRuntimeParameterGroup); supervisionScanner.handleParticipantStatus(participant.getParticipantId()); 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 d558deae3..010e8ba38 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 @@ -42,7 +42,7 @@ import org.onap.policy.clamp.models.acm.concepts.AcTypeState; import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck; +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.ParticipantDeregisterAck; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType; @@ -224,7 +224,7 @@ class SupervisionMessagesTest { @Test void testAutomationCompositionUpdateAckListener() { final var automationCompositionAck = - new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE); + new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY); var supervisionHandler = mock(SupervisionHandler.class); var acUpdateAckListener = new AutomationCompositionUpdateAckListener(supervisionHandler); acUpdateAckListener.onTopicEvent(INFRA, TOPIC, null, automationCompositionAck); @@ -234,7 +234,7 @@ class SupervisionMessagesTest { @Test void testAutomationCompositionStateChangeAckListener() { final var automationCompositionAck = - new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE); + new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE); var supervisionHandler = mock(SupervisionHandler.class); var acStateChangeAckListener = new AutomationCompositionStateChangeAckListener(supervisionHandler); acStateChangeAckListener.onTopicEvent(INFRA, TOPIC, null, automationCompositionAck); |