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/src/test | |
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/src/test')
3 files changed, 35 insertions, 35 deletions
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); |