aboutsummaryrefslogtreecommitdiffstats
path: root/runtime-acm/src/test/java/org/onap
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2024-07-23 10:22:27 +0100
committerFrancesco Fiora <francesco.fiora@est.tech>2024-07-23 09:27:30 +0000
commit1c144c87fbe077eb471650064c64888c4501f581 (patch)
treed4fcc2018f0cf78e6495fd1f020edd324bd0480e /runtime-acm/src/test/java/org/onap
parentaf4d49da0f35da5d1086f0181b594dcc772e383d (diff)
Add support for Prepare, Review and Migrate pre-check in ACM runtime
Issue-ID: POLICY-5079 Change-Id: I6e54d2bce31f906efcc4d5bf3b930d34e7913fd2 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm/src/test/java/org/onap')
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java121
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java68
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java24
3 files changed, 186 insertions, 27 deletions
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
index 2ee6a152e..0591ab02c 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
@@ -48,6 +48,7 @@ import org.onap.policy.clamp.models.acm.concepts.StateChangeResult;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.AcInstanceStateUpdate;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.LockOrder;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.SubOrder;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
import org.onap.policy.clamp.models.acm.persistence.provider.AcInstanceStateResolver;
import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
@@ -169,7 +170,7 @@ class AutomationCompositionInstantiationProviderTest {
var supervisionAcHandler = mock(SupervisionAcHandler.class);
var participantProvider = mock(ParticipantProvider.class);
var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, acDefinitionProvider,
- null, supervisionAcHandler, participantProvider,
+ new AcInstanceStateResolver(), supervisionAcHandler, participantProvider,
CommonTestData.getTestParamaterGroup());
var instantiationResponse = instantiationProvider.updateAutomationComposition(
automationCompositionUpdate.getCompositionId(), automationCompositionUpdate);
@@ -200,15 +201,15 @@ class AutomationCompositionInstantiationProviderTest {
.thenReturn(automationCompositionUpdate);
var instantiationProvider =
- new AutomationCompositionInstantiationProvider(acProvider, mock(AcDefinitionProvider.class), null,
- mock(SupervisionAcHandler.class), mock(ParticipantProvider.class),
- mock(AcRuntimeParameterGroup.class));
+ new AutomationCompositionInstantiationProvider(acProvider, mock(AcDefinitionProvider.class),
+ new AcInstanceStateResolver(), mock(SupervisionAcHandler.class), mock(ParticipantProvider.class),
+ mock(AcRuntimeParameterGroup.class));
var compositionId = automationCompositionUpdate.getCompositionId();
assertThatThrownBy(
() -> instantiationProvider.updateAutomationComposition(compositionId, automationCompositionUpdate))
.hasMessageMatching(
- "Not allowed to update in the state " + automationCompositionUpdate.getDeployState());
+ "Not allowed to UPDATE in the state " + automationCompositionUpdate.getDeployState());
automationCompositionUpdate.setDeployState(DeployState.UPDATING);
automationCompositionUpdate.setLockState(LockState.LOCKED);
@@ -216,7 +217,7 @@ class AutomationCompositionInstantiationProviderTest {
assertThatThrownBy(
() -> instantiationProvider.updateAutomationComposition(compositionId, automationCompositionUpdate))
.hasMessageMatching(
- "Not allowed to migrate in the state " + automationCompositionUpdate.getDeployState());
+ "Not allowed to MIGRATE in the state " + automationCompositionUpdate.getDeployState());
}
@Test
@@ -243,7 +244,7 @@ class AutomationCompositionInstantiationProviderTest {
automationCompositionUpdate.setCompositionTargetId(UUID.randomUUID());
assertThatThrownBy(
() -> instantiationProvider.updateAutomationComposition(compositionId, automationCompositionUpdate))
- .hasMessageMatching("There is a restarting process, Migrate not allowed");
+ .hasMessageMatching("There is a restarting process, Update not allowed");
automationCompositionUpdate.setDeployState(DeployState.UNDEPLOYED);
automationCompositionUpdate.setLockState(LockState.NONE);
@@ -275,7 +276,7 @@ class AutomationCompositionInstantiationProviderTest {
var supervisionAcHandler = mock(SupervisionAcHandler.class);
var participantProvider = mock(ParticipantProvider.class);
var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, acDefinitionProvider,
- null, supervisionAcHandler, participantProvider,
+ new AcInstanceStateResolver(), supervisionAcHandler, participantProvider,
mock(AcRuntimeParameterGroup.class));
assertThatThrownBy(
() -> instantiationProvider.updateAutomationComposition(compositionId, automationCompositionUpdate))
@@ -305,7 +306,7 @@ class AutomationCompositionInstantiationProviderTest {
var supervisionAcHandler = mock(SupervisionAcHandler.class);
var participantProvider = mock(ParticipantProvider.class);
var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, acDefinitionProvider,
- null, supervisionAcHandler, participantProvider, new AcRuntimeParameterGroup());
+ new AcInstanceStateResolver(), supervisionAcHandler, participantProvider, new AcRuntimeParameterGroup());
assertThatThrownBy(() -> instantiationProvider
.updateAutomationComposition(automationComposition.getCompositionId(), automationComposition))
@@ -321,7 +322,51 @@ class AutomationCompositionInstantiationProviderTest {
var instantiationResponse = instantiationProvider
.updateAutomationComposition(automationComposition.getCompositionId(), automationComposition);
- verify(supervisionAcHandler).migrate(any(), any());
+ verify(supervisionAcHandler).migrate(any());
+ verify(acProvider).updateAutomationComposition(automationComposition);
+ InstantiationUtils.assertInstantiationResponse(instantiationResponse, automationComposition);
+ }
+
+
+ @Test
+ void testInstantiationMigrationPrecheck() {
+ var acDefinitionProvider = mock(AcDefinitionProvider.class);
+ var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
+ var compositionId = acDefinition.getCompositionId();
+ when(acDefinitionProvider.findAcDefinition(compositionId)).thenReturn(Optional.of(acDefinition));
+
+ var automationComposition =
+ InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_UPDATE_JSON, "Crud");
+ automationComposition.setCompositionId(compositionId);
+ automationComposition.setDeployState(DeployState.DEPLOYED);
+ automationComposition.setLockState(LockState.LOCKED);
+ automationComposition.setCompositionTargetId(UUID.randomUUID());
+ automationComposition.setPrecheck(true);
+ var acProvider = mock(AutomationCompositionProvider.class);
+ when(acProvider.getAutomationComposition(automationComposition.getInstanceId()))
+ .thenReturn(automationComposition);
+ when(acProvider.updateAutomationComposition(automationComposition)).thenReturn(automationComposition);
+
+ var supervisionAcHandler = mock(SupervisionAcHandler.class);
+ var acmParticipantProvider = mock(ParticipantProvider.class);
+ var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, acDefinitionProvider,
+ new AcInstanceStateResolver(), supervisionAcHandler, acmParticipantProvider, new AcRuntimeParameterGroup());
+
+ assertThatThrownBy(() -> instantiationProvider
+ .updateAutomationComposition(automationComposition.getCompositionId(), automationComposition))
+ .hasMessageMatching(
+ String.format(AC_DEFINITION_NOT_FOUND, automationComposition.getCompositionTargetId()));
+
+ var acDefinitionTarget = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
+ var compositionTargetId = acDefinitionTarget.getCompositionId();
+ when(acDefinitionProvider.findAcDefinition(compositionTargetId)).thenReturn(Optional.of(acDefinitionTarget));
+
+ automationComposition.setCompositionTargetId(compositionTargetId);
+
+ var instantiationResponse = instantiationProvider
+ .updateAutomationComposition(automationComposition.getCompositionId(), automationComposition);
+
+ verify(supervisionAcHandler).migratePrecheck(any());
verify(acProvider).updateAutomationComposition(automationComposition);
InstantiationUtils.assertInstantiationResponse(instantiationResponse, automationComposition);
}
@@ -354,7 +399,45 @@ class AutomationCompositionInstantiationProviderTest {
var supervisionAcHandler = mock(SupervisionAcHandler.class);
var participantProvider = mock(ParticipantProvider.class);
var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, acDefinitionProvider,
- null, supervisionAcHandler, participantProvider, new AcRuntimeParameterGroup());
+ new AcInstanceStateResolver(), supervisionAcHandler, participantProvider,
+ new AcRuntimeParameterGroup());
+
+ assertThatThrownBy(() -> instantiationProvider
+ .updateAutomationComposition(automationComposition.getCompositionId(), acMigrate))
+ .hasMessageStartingWith("Element id not present");
+ }
+
+ @Test
+ void testMigratePrecheckBadRequest() {
+ var acDefinitionProvider = mock(AcDefinitionProvider.class);
+ var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
+ var compositionId = acDefinition.getCompositionId();
+ when(acDefinitionProvider.findAcDefinition(compositionId)).thenReturn(Optional.of(acDefinition));
+
+ var automationComposition =
+ InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_UPDATE_JSON, "Crud");
+ automationComposition.setCompositionId(compositionId);
+ automationComposition.setDeployState(DeployState.DEPLOYED);
+ automationComposition.setLockState(LockState.LOCKED);
+ automationComposition.setPrecheck(true);
+ var acProvider = mock(AutomationCompositionProvider.class);
+ when(acProvider.getAutomationComposition(automationComposition.getInstanceId()))
+ .thenReturn(automationComposition);
+ when(acProvider.updateAutomationComposition(automationComposition)).thenReturn(automationComposition);
+
+ var acDefinitionTarget = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
+ var compositionTargetId = acDefinitionTarget.getCompositionId();
+ when(acDefinitionProvider.findAcDefinition(compositionTargetId)).thenReturn(Optional.of(acDefinitionTarget));
+
+ var acMigrate = new AutomationComposition(automationComposition);
+ acMigrate.setCompositionTargetId(compositionTargetId);
+ automationComposition.getElements().clear();
+
+ var supervisionAcHandler = mock(SupervisionAcHandler.class);
+ var participantProvider = mock(ParticipantProvider.class);
+ var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, acDefinitionProvider,
+ new AcInstanceStateResolver(), supervisionAcHandler, participantProvider,
+ new AcRuntimeParameterGroup());
assertThatThrownBy(() -> instantiationProvider
.updateAutomationComposition(automationComposition.getCompositionId(), acMigrate))
@@ -605,5 +688,21 @@ class AutomationCompositionInstantiationProviderTest {
acInstanceStateUpdate.setLockOrder(LockOrder.LOCK);
provider.compositionInstanceState(compositionId, instanceId, acInstanceStateUpdate);
verify(supervisionAcHandler).lock(any(AutomationComposition.class), any(AutomationCompositionDefinition.class));
+
+ automationComposition.setDeployState(DeployState.UNDEPLOYED);
+ automationComposition.setLockState(LockState.NONE);
+ acInstanceStateUpdate.setDeployOrder(DeployOrder.NONE);
+ acInstanceStateUpdate.setLockOrder(LockOrder.NONE);
+ acInstanceStateUpdate.setSubOrder(SubOrder.PREPARE);
+ provider.compositionInstanceState(compositionId, instanceId, acInstanceStateUpdate);
+ verify(supervisionAcHandler).prepare(any(AutomationComposition.class));
+
+ automationComposition.setDeployState(DeployState.DEPLOYED);
+ automationComposition.setLockState(LockState.LOCKED);
+ acInstanceStateUpdate.setDeployOrder(DeployOrder.NONE);
+ acInstanceStateUpdate.setLockOrder(LockOrder.NONE);
+ acInstanceStateUpdate.setSubOrder(SubOrder.REVIEW);
+ provider.compositionInstanceState(compositionId, instanceId, acInstanceStateUpdate);
+ verify(supervisionAcHandler).review(any(AutomationComposition.class));
}
}
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java
index e895401a4..2d9c1280b 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java
@@ -36,6 +36,7 @@ import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils;
import org.onap.policy.clamp.acm.runtime.supervision.comm.AcElementPropertiesPublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AcPreparePublisher;
import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionDeployPublisher;
import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionMigrationPublisher;
import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
@@ -76,7 +77,7 @@ class SupervisionAcHandlerTest {
var handler = new SupervisionAcHandler(automationCompositionProvider, acDefinitionProvider,
mock(AutomationCompositionDeployPublisher.class), mock(AutomationCompositionStateChangePublisher.class),
mock(AcElementPropertiesPublisher.class), null,
- mock(ParticipantSyncPublisher.class));
+ mock(ParticipantSyncPublisher.class), null);
var automationCompositionAckMessage =
getAutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK,
@@ -124,7 +125,7 @@ class SupervisionAcHandlerTest {
var handler = new SupervisionAcHandler(automationCompositionProvider, acDefinitionProvider,
mock(AutomationCompositionDeployPublisher.class), mock(AutomationCompositionStateChangePublisher.class),
mock(AcElementPropertiesPublisher.class), null,
- mock(ParticipantSyncPublisher.class));
+ mock(ParticipantSyncPublisher.class), null);
handler.handleAutomationCompositionUpdateAckMessage(automationCompositionAckMessage);
@@ -161,7 +162,7 @@ class SupervisionAcHandlerTest {
var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AcDefinitionProvider.class),
mock(AutomationCompositionDeployPublisher.class), automationCompositionStateChangePublisher, null,
- null, mock(ParticipantSyncPublisher.class));
+ null, mock(ParticipantSyncPublisher.class), null);
handler.handleAutomationCompositionUpdateAckMessage(automationCompositionAckMessage);
@@ -175,7 +176,8 @@ class SupervisionAcHandlerTest {
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AcDefinitionProvider.class),
automationCompositionDeployPublisher, mock(AutomationCompositionStateChangePublisher.class),
- mock(AcElementPropertiesPublisher.class), null, mock(ParticipantSyncPublisher.class));
+ mock(AcElementPropertiesPublisher.class), null,
+ mock(ParticipantSyncPublisher.class), null);
var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
@@ -195,7 +197,7 @@ class SupervisionAcHandlerTest {
var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AcDefinitionProvider.class),
mock(AutomationCompositionDeployPublisher.class), acStateChangePublisher,
mock(AcElementPropertiesPublisher.class), null,
- mock(ParticipantSyncPublisher.class));
+ mock(ParticipantSyncPublisher.class), null);
var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
var automationComposition =
@@ -213,7 +215,7 @@ class SupervisionAcHandlerTest {
var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AcDefinitionProvider.class),
mock(AutomationCompositionDeployPublisher.class), acStateChangePublisher,
mock(AcElementPropertiesPublisher.class), null,
- mock(ParticipantSyncPublisher.class));
+ mock(ParticipantSyncPublisher.class), null);
var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
@@ -234,7 +236,7 @@ class SupervisionAcHandlerTest {
var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AcDefinitionProvider.class),
mock(AutomationCompositionDeployPublisher.class), acStateChangePublisher,
mock(AcElementPropertiesPublisher.class), null,
- mock(ParticipantSyncPublisher.class));
+ mock(ParticipantSyncPublisher.class), null);
var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
var automationComposition =
@@ -252,7 +254,7 @@ class SupervisionAcHandlerTest {
var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AcDefinitionProvider.class),
mock(AutomationCompositionDeployPublisher.class), acStateChangePublisher,
mock(AcElementPropertiesPublisher.class), null,
- mock(ParticipantSyncPublisher.class));
+ mock(ParticipantSyncPublisher.class), null);
var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
var automationComposition =
@@ -272,7 +274,7 @@ class SupervisionAcHandlerTest {
var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AcDefinitionProvider.class),
mock(AutomationCompositionDeployPublisher.class), acStateChangePublisher,
mock(AcElementPropertiesPublisher.class), null,
- mock(ParticipantSyncPublisher.class));
+ mock(ParticipantSyncPublisher.class), null);
var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
var automationComposition =
@@ -290,7 +292,7 @@ class SupervisionAcHandlerTest {
var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AcDefinitionProvider.class),
mock(AutomationCompositionDeployPublisher.class), acStateChangePublisher,
mock(AcElementPropertiesPublisher.class), null,
- mock(ParticipantSyncPublisher.class));
+ mock(ParticipantSyncPublisher.class), null);
var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
var automationComposition =
@@ -321,7 +323,7 @@ class SupervisionAcHandlerTest {
var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AcDefinitionProvider.class),
mock(AutomationCompositionDeployPublisher.class), mock(AutomationCompositionStateChangePublisher.class),
mock(AcElementPropertiesPublisher.class), null,
- mock(ParticipantSyncPublisher.class));
+ mock(ParticipantSyncPublisher.class), null);
handler.handleAutomationCompositionUpdateAckMessage(automationCompositionAckMessage);
@@ -335,7 +337,7 @@ class SupervisionAcHandlerTest {
var handler = new SupervisionAcHandler(mock(AutomationCompositionProvider.class),
mock(AcDefinitionProvider.class), mock(AutomationCompositionDeployPublisher.class),
mock(AutomationCompositionStateChangePublisher.class), acElementPropertiesPublisher, null,
- mock(ParticipantSyncPublisher.class));
+ mock(ParticipantSyncPublisher.class), null);
var automationComposition =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Lock");
handler.update(automationComposition);
@@ -348,10 +350,46 @@ class SupervisionAcHandlerTest {
var acCompositionMigrationPublisher = mock(AutomationCompositionMigrationPublisher.class);
var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AcDefinitionProvider.class),
null, null, null,
- acCompositionMigrationPublisher, mock(ParticipantSyncPublisher.class));
+ acCompositionMigrationPublisher, mock(ParticipantSyncPublisher.class), null);
+ var automationComposition =
+ InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Migrate");
+ handler.migrate(automationComposition);
+ verify(acCompositionMigrationPublisher, timeout(1000)).send(any(AutomationComposition.class));
+ }
+
+ @Test
+ void testMigratePrecheck() {
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ var acCompositionMigrationPublisher = mock(AutomationCompositionMigrationPublisher.class);
+ var handler = new SupervisionAcHandler(automationCompositionProvider, null, null, null,
+ null, acCompositionMigrationPublisher, null, null);
+ var automationComposition =
+ InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Migrate");
+ handler.migratePrecheck(automationComposition);
+ verify(acCompositionMigrationPublisher, timeout(1000)).send(any(AutomationComposition.class));
+ }
+
+ @Test
+ void testPrepare() {
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ var acPreparePublisher = mock(AcPreparePublisher.class);
+ var handler = new SupervisionAcHandler(automationCompositionProvider, null, null, null,
+ null, null, null, acPreparePublisher);
+ var automationComposition =
+ InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Migrate");
+ handler.prepare(automationComposition);
+ verify(acPreparePublisher, timeout(1000)).sendPrepare(any(AutomationComposition.class));
+ }
+
+ @Test
+ void testReview() {
+ var automationCompositionProvider = mock(AutomationCompositionProvider.class);
+ var acPreparePublisher = mock(AcPreparePublisher.class);
+ var handler = new SupervisionAcHandler(automationCompositionProvider, null, null, null,
+ null, null, null, acPreparePublisher);
var automationComposition =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Migrate");
- handler.migrate(automationComposition, UUID.randomUUID());
- verify(acCompositionMigrationPublisher, timeout(1000)).send(any(AutomationComposition.class), any());
+ handler.review(automationComposition);
+ verify(acPreparePublisher, timeout(1000)).sendRevew(any(AutomationComposition.class));
}
}
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 7cf0bf84f..77b47f4e3 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
@@ -231,7 +231,29 @@ class SupervisionMessagesTest {
publisher.active(topicSink);
var automationComposition =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_UPDATE_JSON, "Crud");
- publisher.send(automationComposition, UUID.randomUUID());
+ publisher.send(automationComposition);
+ verify(topicSink).send(anyString());
+ }
+
+ @Test
+ void testAcPreparePublisher() {
+ var publisher = new AcPreparePublisher();
+ var topicSink = mock(TopicSink.class);
+ publisher.active(topicSink);
+ var automationComposition =
+ InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_UPDATE_JSON, "Crud");
+ publisher.sendPrepare(automationComposition);
+ verify(topicSink).send(anyString());
+ }
+
+ @Test
+ void testAcReviewPublisher() {
+ var publisher = new AcPreparePublisher();
+ var topicSink = mock(TopicSink.class);
+ publisher.active(topicSink);
+ var automationComposition =
+ InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_UPDATE_JSON, "Crud");
+ publisher.sendRevew(automationComposition);
verify(topicSink).send(anyString());
}