diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2023-04-05 16:32:38 +0100 |
---|---|---|
committer | FrancescoFioraEst <francesco.fiora@est.tech> | 2023-04-11 10:06:21 +0100 |
commit | 9f1fdf9f419c1724a9cf75a20fdd24df191766bd (patch) | |
tree | 16db3d01d45ae45a4fc776d9d23596ec2c6bcc58 /participant/participant-impl/participant-impl-policy/src | |
parent | 2ca7552978f5389ef5ed2e5d4be3cb43e446f7c6 (diff) |
Add UseState and OperationalState support in ACM
Issue-ID: POLICY-4639
Change-Id: Iac5249c054bf41d830463826a8f61f477c48235b
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-policy/src')
2 files changed, 31 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 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())); + } } |