From 9f1fdf9f419c1724a9cf75a20fdd24df191766bd Mon Sep 17 00:00:00 2001 From: FrancescoFioraEst Date: Wed, 5 Apr 2023 16:32:38 +0100 Subject: Add UseState and OperationalState support in ACM Issue-ID: POLICY-4639 Change-Id: Iac5249c054bf41d830463826a8f61f477c48235b Signed-off-by: FrancescoFioraEst --- .../handler/AutomationCompositionElementHandler.java | 12 ++++++++++++ .../AutomationCompositionElementHandlerTest.java | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+) (limited to 'participant/participant-impl/participant-impl-policy/src') 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 3e740192b..d40ac3276 100644 --- 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 @@ -201,4 +201,16 @@ public class AutomationCompositionElementHandler implements AutomationCompositio return policyList; } + + @Override + public String getUseState(UUID automationCompositionId, UUID automationCompositionElementId) + throws PfModelException { + return "IDLE"; + } + + @Override + public String getOperationalState(UUID automationCompositionId, UUID automationCompositionElementId) + throws PfModelException { + return "ENABLED"; + } } 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 47c279988..ecc0b88e7 100644 --- 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 @@ -21,6 +21,7 @@ package org.onap.policy.clamp.acm.participant.policy.main.handler; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; @@ -133,4 +134,22 @@ class AutomationCompositionElementHandlerTest { assertThatThrownBy(() -> handler.deploy(AC_ID, element, Map.of())) .hasMessageMatching("Deploy of Policy failed."); } + + @Test + void testGetOperationalState() throws PfModelException { + var api = mock(PolicyApiHttpClient.class); + var pap = mock(PolicyPapHttpClient.class); + var handler = new AutomationCompositionElementHandler(api, pap); + + assertEquals("ENABLED", handler.getOperationalState(UUID.randomUUID(), UUID.randomUUID())); + } + + @Test + void testGetUseState() throws PfModelException { + var api = mock(PolicyApiHttpClient.class); + var pap = mock(PolicyPapHttpClient.class); + var handler = new AutomationCompositionElementHandler(api, pap); + + assertEquals("IDLE", handler.getUseState(UUID.randomUUID(), UUID.randomUUID())); + } } -- cgit 1.2.3-korg