From d58c0ca04ae993702b2c399afd52b01e503ec0fe Mon Sep 17 00:00:00 2001 From: FrancescoFioraEst Date: Fri, 2 Jun 2023 12:36:45 +0100 Subject: Add Failure handling support in all ACM-participants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In any transition (like deploy, undeploy,  lock, unlock, update, delete) a participant should respond with the final state of transition, a status indicator (stateChaneResult) indicating if error has occurred and a message. Issue-ID: POLICY-4706 Change-Id: I424bc6d620f476392baee8904e21d3a6c7aa8d6b Signed-off-by: FrancescoFioraEst --- .../AutomationCompositionElementHandlerTest.java | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'participant/participant-impl/participant-impl-kubernetes/src/test') diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java index ee0039c3f..d9702abc5 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java @@ -32,6 +32,7 @@ import static org.mockito.Mockito.doThrow; import java.io.File; import java.io.IOException; import java.util.List; +import java.util.Map; import java.util.UUID; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; @@ -157,4 +158,41 @@ class AutomationCompositionElementHandlerTest { () -> automationCompositionElementHandler.checkPodStatus(automationCompositionId, element.getId(), chartInfo, 1, 1)); } + + @Test + void testUpdate() throws PfModelException { + var elementId1 = UUID.randomUUID(); + var element = new AcElementDeploy(); + element.setId(elementId1); + element.setDefinition(new ToscaConceptIdentifier(KEY_NAME, "1.0.1")); + element.setOrderedState(DeployOrder.DEPLOY); + var automationCompositionId = commonTestData.getAutomationCompositionId(); + assertDoesNotThrow( + () -> automationCompositionElementHandler.update(automationCompositionId, element, Map.of())); + } + + @Test + void testLock() throws PfModelException { + assertDoesNotThrow(() -> automationCompositionElementHandler.lock(UUID.randomUUID(), UUID.randomUUID())); + } + + @Test + void testUnlock() throws PfModelException { + assertDoesNotThrow(() -> automationCompositionElementHandler.unlock(UUID.randomUUID(), UUID.randomUUID())); + } + + @Test + void testDelete() throws PfModelException { + assertDoesNotThrow(() -> automationCompositionElementHandler.delete(UUID.randomUUID(), UUID.randomUUID())); + } + + @Test + void testPrime() throws PfModelException { + assertDoesNotThrow(() -> automationCompositionElementHandler.prime(UUID.randomUUID(), List.of())); + } + + @Test + void testDeprime() throws PfModelException { + assertDoesNotThrow(() -> automationCompositionElementHandler.deprime(UUID.randomUUID())); + } } -- cgit 1.2.3-korg