diff options
author | rameshiyer27 <ramesh.murugan.iyer@est.tech> | 2023-05-18 16:47:10 +0100 |
---|---|---|
committer | Liam Fallon <liam.fallon@est.tech> | 2023-05-23 15:25:03 +0000 |
commit | 461bbdb67733552e78037bd96ca7efdfd3015e25 (patch) | |
tree | efab4e35ea578f058879922588cd711d0e22d0ce /runtime-acm/src/test/java | |
parent | 4539ab951ef81839d38641fa09f2cbd490d71a63 (diff) |
Update AC Element properties on the DEPLOYED state
User can update the instance property values on DEPLOYED state.
The runtime sends PROPERTY_UPDATE event to the participants and the updated values are stored on the runtime database.
Participants can implement the update method to perform the required action.
Issue-ID: POLICY-4682
Signed-off-by: zrrmmua <ramesh.murugan.iyer@est.tech>
Change-Id: Ic35fba669b5ffcf2c75d6deaa8c309d58e4026f0
Diffstat (limited to 'runtime-acm/src/test/java')
2 files changed, 8 insertions, 21 deletions
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java index faf356c22..54a0c9613 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java @@ -313,22 +313,6 @@ class AutomationCompositionInstantiationProviderTest { } @Test - void testUpdateBadRequest() { - var automationComposition = InstantiationUtils - .getAutomationCompositionFromResource(AC_INSTANTIATION_AC_DEFINITION_NOT_FOUND_JSON, "AcNotFound"); - - var acProvider = mock(AutomationCompositionProvider.class); - automationComposition.setDeployState(DeployState.DEPLOYED); - when(acProvider.getAutomationComposition(automationComposition.getInstanceId())) - .thenReturn(automationComposition); - var provider = new AutomationCompositionInstantiationProvider(acProvider, - mock(AcDefinitionProvider.class), null, null); - - assertThatThrownBy(() -> provider.updateAutomationComposition(automationComposition.getCompositionId(), - automationComposition)).hasMessageMatching("Not allow to update for state in DEPLOYED"); - } - - @Test void testCompositionInstanceState() { var acDefinitionProvider = mock(AcDefinitionProvider.class); var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.COMMISSIONED); diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java index c61984b01..e763127cc 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java @@ -33,6 +33,7 @@ import java.util.Optional; import java.util.UUID; import org.junit.jupiter.api.Test; import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils; +import org.onap.policy.clamp.acm.runtime.supervision.comm.AcElementPropertiesPublisher; import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionDeployPublisher; import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher; import org.onap.policy.clamp.acm.runtime.util.CommonTestData; @@ -59,7 +60,8 @@ class SupervisionAcHandlerTest { var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AutomationCompositionDeployPublisher.class), - mock(AutomationCompositionStateChangePublisher.class)); + mock(AutomationCompositionStateChangePublisher.class), + mock(AcElementPropertiesPublisher.class)); var automationCompositionAckMessage = new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK); @@ -97,7 +99,8 @@ class SupervisionAcHandlerTest { var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AutomationCompositionDeployPublisher.class), - mock(AutomationCompositionStateChangePublisher.class)); + mock(AutomationCompositionStateChangePublisher.class), + mock(AcElementPropertiesPublisher.class)); handler.handleAutomationCompositionUpdateAckMessage(automationCompositionAckMessage); @@ -110,7 +113,7 @@ class SupervisionAcHandlerTest { var acStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class); var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AutomationCompositionDeployPublisher.class), - acStateChangePublisher); + acStateChangePublisher, mock(AcElementPropertiesPublisher.class)); var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML); var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED); var automationComposition = @@ -127,7 +130,7 @@ class SupervisionAcHandlerTest { var acStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class); var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AutomationCompositionDeployPublisher.class), - acStateChangePublisher); + acStateChangePublisher, mock(AcElementPropertiesPublisher.class)); var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML); var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED); var automationComposition = @@ -144,7 +147,7 @@ class SupervisionAcHandlerTest { var acStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class); var handler = new SupervisionAcHandler(automationCompositionProvider, mock(AutomationCompositionDeployPublisher.class), - acStateChangePublisher); + acStateChangePublisher, mock(AcElementPropertiesPublisher.class)); var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML); var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED); var automationComposition = |