From c85228f5b4071f0aee7412ba67a0cfa3031a2e90 Mon Sep 17 00:00:00 2001 From: FrancescoFioraEst Date: Wed, 27 Sep 2023 10:37:28 +0100 Subject: Add migration support in ACM participants Issue-ID: POLICY-4825 Change-Id: Iebdd0b8c4890e9c022f68396f11f7ba8c80bef00 Signed-off-by: FrancescoFioraEst --- .../main/handler/AutomationCompositionElementHandler.java | 7 +++++++ .../participant/http/handler/AcElementHandlerTest.java | 15 +++++++++++++++ 2 files changed, 22 insertions(+) mode change 100644 => 100755 participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java (limited to 'participant/participant-impl/participant-impl-http') diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java index b1412fe19..883b8a17b 100755 --- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java +++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java @@ -178,4 +178,11 @@ public class AutomationCompositionElementHandler implements AutomationCompositio intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(), deployState, lockState, StateChangeResult.NO_ERROR, "Restarted"); } + + @Override + public void migrate(UUID automationCompositionId, AcElementDeploy element, UUID compositionTargetId, + Map properties) throws PfModelException { + intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(), + DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated"); + } } diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java old mode 100644 new mode 100755 index de0d21e6d..634e78880 --- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java +++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java @@ -240,4 +240,19 @@ class AcElementHandlerTest { verify(participantIntermediaryApi).updateAutomationCompositionElementState(instanceId, element.getId(), DeployState.DEPLOYED, LockState.LOCKED, StateChangeResult.NO_ERROR, "Restarted"); } + + @Test + void testMigrate() throws PfModelException { + var instanceId = commonTestData.getAutomationCompositionId(); + var element = commonTestData.getAutomationCompositionElement(); + var acElementId = element.getId(); + var participantIntermediaryApi = mock(ParticipantIntermediaryApi.class); + + var automationCompositionElementHandler = + new AutomationCompositionElementHandler(participantIntermediaryApi, mock(AcHttpClient.class)); + + automationCompositionElementHandler.migrate(instanceId, element, UUID.randomUUID(), Map.of()); + verify(participantIntermediaryApi).updateAutomationCompositionElementState(instanceId, acElementId, + DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated"); + } } -- cgit 1.2.3-korg