diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2023-09-27 10:37:28 +0100 |
---|---|---|
committer | Francesco Fiora <francesco.fiora@est.tech> | 2023-09-27 09:39:04 +0000 |
commit | c85228f5b4071f0aee7412ba67a0cfa3031a2e90 (patch) | |
tree | 3327f5fb116c2e806b70954d876aa85a3cac6586 /participant/participant-impl/participant-impl-policy | |
parent | f80c317803bccbb12dac2d490520bf409b0d5e3a (diff) |
Add migration support in ACM participants
Issue-ID: POLICY-4825
Change-Id: Iebdd0b8c4890e9c022f68396f11f7ba8c80bef00
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-policy')
2 files changed, 20 insertions, 0 deletions
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java index 58ceffd10..7fd8e0dec 100755 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java @@ -276,4 +276,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<String, Object> properties) throws PfModelException { + intermediaryApi.updateAutomationCompositionElementState(automationCompositionId, element.getId(), + DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated"); + } } diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java index d211ab0d7..af6a401f2 100755 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java @@ -267,4 +267,17 @@ class AutomationCompositionElementHandlerTest { verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId, DeployState.DEPLOYED, LockState.LOCKED, StateChangeResult.NO_ERROR, "Restarted"); } + + @Test + void testMigrate() throws Exception { + var intermediaryApi = mock(ParticipantIntermediaryApi.class); + var handler = new AutomationCompositionElementHandler(mock(PolicyApiHttpClient.class), + mock(PolicyPapHttpClient.class), intermediaryApi); + + var acElement = getTestingAcElement(); + acElement.getToscaServiceTemplateFragment().setToscaTopologyTemplate(null); + handler.migrate(AC_ID, acElement, UUID.randomUUID(), Map.of()); + verify(intermediaryApi).updateAutomationCompositionElementState(AC_ID, automationCompositionElementId, + DeployState.DEPLOYED, null, StateChangeResult.NO_ERROR, "Migrated"); + } } |