diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2022-12-01 09:15:22 +0000 |
---|---|---|
committer | FrancescoFioraEst <francesco.fiora@est.tech> | 2022-12-01 10:55:04 +0000 |
commit | b5d62899bf9cfaef5c9dcc49023428bbb12bcc55 (patch) | |
tree | d7325a4df408b39bf7b30789724631efbc738c91 /runtime-acm/src/test | |
parent | 7af90cd8fdabdd1c3ae79d3551980016d6b24f7e (diff) |
Refactor POST and PUT Automation Composition
Refactor POST and PUT Automation Composition to handle
a single resource instead of a list.
Issue-ID: POLICY-4470
Change-Id: Ic7025e1eafdd197487bc5268993ec5e3e5520025
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm/src/test')
16 files changed, 667 insertions, 1296 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 cebabdb0f..864179844 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 @@ -36,10 +36,10 @@ import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler; import org.onap.policy.clamp.acm.runtime.util.CommonTestData; +import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException; import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException; import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState; -import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions; import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationCommand; import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider; import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider; @@ -53,35 +53,25 @@ import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate; * */ class AutomationCompositionInstantiationProviderTest { - private static final String AC_INSTANTIATION_CREATE_JSON = - "src/test/resources/rest/acm/AutomationCompositions.json"; + private static final String AC_INSTANTIATION_CREATE_JSON = "src/test/resources/rest/acm/AutomationComposition.json"; private static final String AC_INSTANTIATION_UPDATE_JSON = - "src/test/resources/rest/acm/AutomationCompositionsUpdate.json"; + "src/test/resources/rest/acm/AutomationCompositionUpdate.json"; private static final String AC_INSTANTIATION_CHANGE_STATE_JSON = "src/test/resources/rest/acm/PassiveCommand.json"; private static final String AC_INSTANTIATION_DEFINITION_NAME_NOT_FOUND_JSON = "src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json"; private static final String AC_INSTANTIATION_AC_DEFINITION_NOT_FOUND_JSON = - "src/test/resources/rest/acm/AutomationCompositionsNotFound.json"; + "src/test/resources/rest/acm/AutomationCompositionNotFound.json"; private static final String AUTOMATION_COMPOSITION_NOT_FOUND = "Automation composition not found"; private static final String DELETE_BAD_REQUEST = "Automation composition state is still %s"; private static final String ORDERED_STATE_INVALID = "ordered state invalid or not specified on command"; private static final String AC_ELEMENT_NAME_NOT_FOUND = - "\"AutomationCompositions\" INVALID, item has status INVALID\n" + "\"AutomationComposition\" INVALID, item has status INVALID\n" + " \"entry PMSHInstance0AcElementNotFound\" INVALID, item has status INVALID\n" + " \"entry org.onap.domain.pmsh.DCAEMicroservice\" INVALID, Not found\n" + " \"entry org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement\"" - + " INVALID, Not found\n" - + " \"entry org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement\" INVALID, Not found\n" - + " \"entry PMSHInstance1AcElementNotFound\" INVALID, item has status INVALID\n" - + " \"entry org.onap.domain.pmsh.DCAEMicroservice\" INVALID, Not found\n" - + " \"entry org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement\"" - + " INVALID, Not found\n" - + " \"entry org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement\" INVALID, Not found\n"; - + + " INVALID, Not found\n"; private static final String AC_DEFINITION_NOT_FOUND = - "\"AutomationCompositions\" INVALID, item has status INVALID\n" - + " item \"ServiceTemplate\" value \"\" INVALID," - + " Commissioned automation composition definition not found\n" + "\"AutomationComposition\" INVALID, item has status INVALID\n" + " item \"ServiceTemplate\" value \"\" INVALID," + " Commissioned automation composition definition not found\n"; @@ -96,7 +86,7 @@ class AutomationCompositionInstantiationProviderTest { } @Test - void testInstantiationCrud() throws Exception { + void testInstantiationCrud() throws AutomationCompositionException { var participantProvider = Mockito.mock(ParticipantProvider.class); var participants = CommonTestData.createParticipants(); when(participantProvider.getParticipants()).thenReturn(participants); @@ -108,77 +98,63 @@ class AutomationCompositionInstantiationProviderTest { var acProvider = mock(AutomationCompositionProvider.class); var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler, participantProvider, acDefinitionProvider); - var automationCompositionsCreate = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud"); - for (var automationComposition : automationCompositionsCreate.getAutomationCompositionList()) { - automationComposition.setCompositionId(compositionId); - } - var instantiationResponse = instantiationProvider.createAutomationCompositions(automationCompositionsCreate); - InstantiationUtils.assertInstantiationResponse(instantiationResponse, automationCompositionsCreate); + var automationCompositionCreate = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud"); + automationCompositionCreate.setCompositionId(compositionId); + when(acProvider.saveAutomationComposition(automationCompositionCreate)).thenReturn(automationCompositionCreate); - verify(acProvider).saveAutomationCompositions(automationCompositionsCreate.getAutomationCompositionList()); + var instantiationResponse = instantiationProvider.createAutomationComposition(automationCompositionCreate); + InstantiationUtils.assertInstantiationResponse(instantiationResponse, automationCompositionCreate); - for (var automationComposition : automationCompositionsCreate.getAutomationCompositionList()) { - when(acProvider.getAutomationCompositions(automationComposition.getName(), - automationComposition.getVersion())).thenReturn(List.of(automationComposition)); + verify(acProvider).saveAutomationComposition(automationCompositionCreate); - var automationCompositionsGet = instantiationProvider - .getAutomationCompositions(automationComposition.getName(), automationComposition.getVersion()); - assertThat(automationCompositionsGet.getAutomationCompositionList()).hasSize(1); - assertThat(automationComposition) - .isEqualTo(automationCompositionsGet.getAutomationCompositionList().get(0)); - } + when(acProvider.getAutomationCompositions(automationCompositionCreate.getName(), + automationCompositionCreate.getVersion())).thenReturn(List.of(automationCompositionCreate)); - var automationCompositionsUpdate = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_UPDATE_JSON, "Crud"); - for (var automationComposition : automationCompositionsUpdate.getAutomationCompositionList()) { - automationComposition.setCompositionId(compositionId); - } + var automationCompositionsGet = instantiationProvider.getAutomationCompositions( + automationCompositionCreate.getName(), automationCompositionCreate.getVersion()); + assertThat(automationCompositionCreate) + .isEqualTo(automationCompositionsGet.getAutomationCompositionList().get(0)); - instantiationResponse = instantiationProvider.updateAutomationCompositions(automationCompositionsUpdate); - InstantiationUtils.assertInstantiationResponse(instantiationResponse, automationCompositionsUpdate); + var automationCompositionUpdate = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_UPDATE_JSON, "Crud"); + automationCompositionUpdate.setCompositionId(compositionId); - verify(acProvider).saveAutomationCompositions(automationCompositionsUpdate.getAutomationCompositionList()); + instantiationResponse = instantiationProvider.updateAutomationComposition(automationCompositionUpdate); + InstantiationUtils.assertInstantiationResponse(instantiationResponse, automationCompositionUpdate); - for (var automationComposition : automationCompositionsUpdate.getAutomationCompositionList()) { - when(acProvider.findAutomationComposition(automationComposition.getKey().asIdentifier())) - .thenReturn(Optional.of(automationComposition)); - when(acProvider.findAutomationComposition(automationComposition.getName(), - automationComposition.getVersion())).thenReturn(Optional.of(automationComposition)); - when(acProvider.deleteAutomationComposition(automationComposition.getName(), - automationComposition.getVersion())).thenReturn(automationComposition); - } + verify(acProvider).saveAutomationComposition(automationCompositionUpdate); + + when(acProvider.findAutomationComposition(automationCompositionUpdate.getKey().asIdentifier())) + .thenReturn(Optional.of(automationCompositionUpdate)); + when(acProvider.findAutomationComposition(automationCompositionUpdate.getName(), + automationCompositionUpdate.getVersion())).thenReturn(Optional.of(automationCompositionUpdate)); + when(acProvider.deleteAutomationComposition(automationCompositionUpdate.getName(), + automationCompositionUpdate.getVersion())).thenReturn(automationCompositionUpdate); var instantiationCommand = InstantiationUtils.getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "Crud"); instantiationResponse = instantiationProvider.issueAutomationCompositionCommand(instantiationCommand); InstantiationUtils.assertInstantiationResponse(instantiationResponse, instantiationCommand); - verify(supervisionHandler) - .triggerAutomationCompositionSupervision(instantiationCommand.getAutomationCompositionIdentifierList()); + verify(supervisionHandler).triggerAutomationCompositionSupervision(automationCompositionUpdate); // in order to delete a automationComposition the state must be UNINITIALISED - automationCompositionsCreate.getAutomationCompositionList() - .forEach(ac -> ac.setState(AutomationCompositionState.UNINITIALISED)); - instantiationProvider.updateAutomationCompositions(automationCompositionsCreate); + automationCompositionCreate.setState(AutomationCompositionState.UNINITIALISED); + instantiationProvider.updateAutomationComposition(automationCompositionCreate); - for (AutomationComposition automationComposition : automationCompositionsCreate - .getAutomationCompositionList()) { - instantiationProvider.deleteAutomationComposition(automationComposition.getName(), - automationComposition.getVersion()); + instantiationProvider.deleteAutomationComposition(automationCompositionCreate.getName(), + automationCompositionCreate.getVersion()); - verify(acProvider).deleteAutomationComposition(automationComposition.getName(), - automationComposition.getVersion()); - } + verify(acProvider).deleteAutomationComposition(automationCompositionCreate.getName(), + automationCompositionCreate.getVersion()); } @Test - void testInstantiationDelete() throws Exception { - - AutomationCompositions automationCompositions = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Delete"); + void testInstantiationDelete() { + var automationComposition = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Delete"); - AutomationComposition automationComposition0 = automationCompositions.getAutomationCompositionList().get(0); var participantProvider = Mockito.mock(ParticipantProvider.class); var acProvider = mock(AutomationCompositionProvider.class); var supervisionHandler = mock(SupervisionHandler.class); @@ -187,30 +163,27 @@ class AutomationCompositionInstantiationProviderTest { var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler, participantProvider, acDefinitionProvider); - assertThatThrownBy(() -> instantiationProvider.deleteAutomationComposition(automationComposition0.getName(), - automationComposition0.getVersion())).hasMessageMatching(AUTOMATION_COMPOSITION_NOT_FOUND); + assertThatThrownBy(() -> instantiationProvider.deleteAutomationComposition(automationComposition.getName(), + automationComposition.getVersion())).hasMessageMatching(AUTOMATION_COMPOSITION_NOT_FOUND); - for (AutomationCompositionState state : AutomationCompositionState.values()) { + for (var state : AutomationCompositionState.values()) { if (!AutomationCompositionState.UNINITIALISED.equals(state)) { - assertThatDeleteThrownBy(automationCompositions, state); + assertThatDeleteThrownBy(automationComposition, state); } } - automationComposition0.setState(AutomationCompositionState.UNINITIALISED); + automationComposition.setState(AutomationCompositionState.UNINITIALISED); - for (AutomationComposition automationComposition : automationCompositions.getAutomationCompositionList()) { - when(acProvider.findAutomationComposition(automationComposition.getName(), - automationComposition.getVersion())).thenReturn(Optional.of(automationComposition)); - when(acProvider.deleteAutomationComposition(automationComposition.getName(), - automationComposition.getVersion())).thenReturn(automationComposition); + when(acProvider.findAutomationComposition(automationComposition.getName(), automationComposition.getVersion())) + .thenReturn(Optional.of(automationComposition)); + when(acProvider.deleteAutomationComposition(automationComposition.getName(), + automationComposition.getVersion())).thenReturn(automationComposition); - instantiationProvider.deleteAutomationComposition(automationComposition.getName(), - automationComposition.getVersion()); - } + instantiationProvider.deleteAutomationComposition(automationComposition.getName(), + automationComposition.getVersion()); } - private void assertThatDeleteThrownBy(AutomationCompositions automationCompositions, - AutomationCompositionState state) throws Exception { - AutomationComposition automationComposition = automationCompositions.getAutomationCompositionList().get(0); + private void assertThatDeleteThrownBy(AutomationComposition automationComposition, + AutomationCompositionState state) { automationComposition.setState(state); var participantProvider = Mockito.mock(ParticipantProvider.class); var acProvider = mock(AutomationCompositionProvider.class); @@ -228,48 +201,42 @@ class AutomationCompositionInstantiationProviderTest { } @Test - void testCreateAutomationCompositions_NoDuplicates() throws Exception { + void testCreateAutomationCompositions_NoDuplicates() { var acDefinitionProvider = mock(AcDefinitionProvider.class); var compositionId = UUID.randomUUID(); when(acDefinitionProvider.findAcDefinition(compositionId)).thenReturn(Optional.of(serviceTemplate)); - var automationCompositionsCreate = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "NoDuplicates"); - for (var automationComposition : automationCompositionsCreate.getAutomationCompositionList()) { - automationComposition.setCompositionId(compositionId); - } + var automationCompositionCreate = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "NoDuplicates"); + automationCompositionCreate.setCompositionId(compositionId); var acProvider = mock(AutomationCompositionProvider.class); + when(acProvider.saveAutomationComposition(automationCompositionCreate)).thenReturn(automationCompositionCreate); + var participantProvider = Mockito.mock(ParticipantProvider.class); var supervisionHandler = mock(SupervisionHandler.class); var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler, participantProvider, acDefinitionProvider); - var instantiationResponse = - instantiationProvider.createAutomationCompositions(automationCompositionsCreate); - InstantiationUtils.assertInstantiationResponse(instantiationResponse, automationCompositionsCreate); + var instantiationResponse = instantiationProvider.createAutomationComposition(automationCompositionCreate); + InstantiationUtils.assertInstantiationResponse(instantiationResponse, automationCompositionCreate); - when(acProvider.findAutomationComposition( - automationCompositionsCreate.getAutomationCompositionList().get(0).getKey().asIdentifier())) - .thenReturn(Optional.of(automationCompositionsCreate.getAutomationCompositionList().get(0))); + when(acProvider.findAutomationComposition(automationCompositionCreate.getKey().asIdentifier())) + .thenReturn(Optional.of(automationCompositionCreate)); - assertThatThrownBy(() -> instantiationProvider.createAutomationCompositions(automationCompositionsCreate)) - .hasMessageMatching( - automationCompositionsCreate.getAutomationCompositionList().get(0).getKey().asIdentifier() - + " already defined"); + assertThatThrownBy(() -> instantiationProvider.createAutomationComposition(automationCompositionCreate)) + .hasMessageMatching(automationCompositionCreate.getKey().asIdentifier() + " already defined"); } @Test - void testCreateAutomationCompositions_CommissionedAcElementNotFound() throws Exception { + void testCreateAutomationCompositions_CommissionedAcElementNotFound() { var acDefinitionProvider = mock(AcDefinitionProvider.class); var compositionId = UUID.randomUUID(); when(acDefinitionProvider.findAcDefinition(compositionId)).thenReturn(Optional.of(serviceTemplate)); - var automationCompositions = InstantiationUtils.getAutomationCompositionsFromResource( + var automationComposition = InstantiationUtils.getAutomationCompositionFromResource( AC_INSTANTIATION_DEFINITION_NAME_NOT_FOUND_JSON, "AcElementNotFound"); - for (var automationComposition : automationCompositions.getAutomationCompositionList()) { - automationComposition.setCompositionId(compositionId); - } + automationComposition.setCompositionId(compositionId); var acProvider = mock(AutomationCompositionProvider.class); var participantProvider = mock(ParticipantProvider.class); @@ -277,17 +244,17 @@ class AutomationCompositionInstantiationProviderTest { var provider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler, participantProvider, acDefinitionProvider); - assertThatThrownBy(() -> provider.createAutomationCompositions(automationCompositions)) + assertThatThrownBy(() -> provider.createAutomationComposition(automationComposition)) .hasMessageMatching(AC_ELEMENT_NAME_NOT_FOUND); - assertThatThrownBy(() -> provider.updateAutomationCompositions(automationCompositions)) + assertThatThrownBy(() -> provider.updateAutomationComposition(automationComposition)) .hasMessageMatching(AC_ELEMENT_NAME_NOT_FOUND); } @Test void testCreateAutomationCompositions_CommissionedAcNotFound() throws Exception { - AutomationCompositions automationCompositions = InstantiationUtils - .getAutomationCompositionsFromResource(AC_INSTANTIATION_AC_DEFINITION_NOT_FOUND_JSON, "AcNotFound"); + var automationComposition = InstantiationUtils + .getAutomationCompositionFromResource(AC_INSTANTIATION_AC_DEFINITION_NOT_FOUND_JSON, "AcNotFound"); var participantProvider = Mockito.mock(ParticipantProvider.class); var acProvider = mock(AutomationCompositionProvider.class); @@ -296,10 +263,10 @@ class AutomationCompositionInstantiationProviderTest { var provider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler, participantProvider, acDefinitionProvider); - assertThatThrownBy(() -> provider.createAutomationCompositions(automationCompositions)) + assertThatThrownBy(() -> provider.createAutomationComposition(automationComposition)) .hasMessageMatching(AC_DEFINITION_NOT_FOUND); - assertThatThrownBy(() -> provider.updateAutomationCompositions(automationCompositions)) + assertThatThrownBy(() -> provider.updateAutomationComposition(automationComposition)) .hasMessageMatching(AC_DEFINITION_NOT_FOUND); } diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/InstantiationUtils.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/InstantiationUtils.java index b0359113b..8b0ccd74e 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/InstantiationUtils.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/InstantiationUtils.java @@ -22,12 +22,10 @@ package org.onap.policy.clamp.acm.runtime.instantiation; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import java.io.File; import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; -import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions; import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationCommand; import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationResponse; import org.onap.policy.common.utils.coder.Coder; @@ -35,7 +33,6 @@ import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.coder.StandardYamlCoder; import org.onap.policy.common.utils.resources.ResourceUtils; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; /** @@ -47,21 +44,23 @@ public class InstantiationUtils { private static final StandardYamlCoder YAML_TRANSLATOR = new StandardYamlCoder(); /** - * Gets the AutomationCompositions from Resource. + * Gets the AutomationComposition from Resource. * * @param path path of the resource * @param suffix suffix to add to all names in AutomationCompositions - * @return the AutomationCompositions from Resource - * @throws CoderException if an error occurs + * @return the AutomationComposition from Resource */ - public static AutomationCompositions getAutomationCompositionsFromResource(final String path, final String suffix) - throws CoderException { - AutomationCompositions automationCompositions = CODER.decode(new File(path), AutomationCompositions.class); + public static AutomationComposition getAutomationCompositionFromResource(final String path, final String suffix) { + try { + var automationComposition = CODER.decode(new File(path), AutomationComposition.class); - // add suffix to all names - automationCompositions.getAutomationCompositionList() - .forEach(automationComposition -> automationComposition.setName(automationComposition.getName() + suffix)); - return automationCompositions; + // add suffix to name + automationComposition.setName(automationComposition.getName() + suffix); + return automationComposition; + } catch (CoderException e) { + fail("Cannot read or decode " + path); + return null; + } } /** @@ -70,32 +69,18 @@ public class InstantiationUtils { * @param path path of the resource * @param suffix suffix to add to all names in AutomationCompositions * @return the InstantiationCommand - * @throws CoderException if an error occurs */ - public static InstantiationCommand getInstantiationCommandFromResource(final String path, final String suffix) - throws CoderException { - InstantiationCommand instantiationCommand = CODER.decode(new File(path), InstantiationCommand.class); - - // add suffix to all names - instantiationCommand.getAutomationCompositionIdentifierList().forEach(ac -> ac.setName(ac.getName() + suffix)); - return instantiationCommand; - } + public static InstantiationCommand getInstantiationCommandFromResource(final String path, final String suffix) { + try { + var instantiationCommand = CODER.decode(new File(path), InstantiationCommand.class); - /** - * Assert that Instantiation Response contains proper AutomationCompositions. - * - * @param response InstantiationResponse - * @param automationCompositions AutomationCompositions - */ - public static void assertInstantiationResponse(InstantiationResponse response, - AutomationCompositions automationCompositions) { - assertThat(response).isNotNull(); - assertThat(response.getErrorDetails()).isNull(); - assertThat(response.getAffectedAutomationCompositions()) - .hasSameSizeAs(automationCompositions.getAutomationCompositionList()); - for (AutomationComposition automationComposition : automationCompositions.getAutomationCompositionList()) { - assertTrue(response.getAffectedAutomationCompositions().stream() - .anyMatch(ac -> ac.equals(automationComposition.getKey().asIdentifier()))); + // add suffix to the name + var id = instantiationCommand.getAutomationCompositionIdentifier(); + id.setName(id.getName() + suffix); + return instantiationCommand; + } catch (CoderException e) { + fail("Cannot read or decode " + path); + return null; } } @@ -107,12 +92,7 @@ public class InstantiationUtils { */ public static void assertInstantiationResponse(InstantiationResponse response, InstantiationCommand command) { assertThat(response).isNotNull(); - assertEquals(response.getAffectedAutomationCompositions().size(), - command.getAutomationCompositionIdentifierList().size()); - for (ToscaConceptIdentifier toscaConceptIdentifier : command.getAutomationCompositionIdentifierList()) { - assertTrue(response.getAffectedAutomationCompositions().stream() - .anyMatch(ac -> ac.compareTo(toscaConceptIdentifier) == 0)); - } + assertEquals(response.getAffectedAutomationComposition(), command.getAutomationCompositionIdentifier()); } /** @@ -122,12 +102,10 @@ public class InstantiationUtils { * @param automationComposition AutomationComposition */ public static void assertInstantiationResponse(InstantiationResponse response, - AutomationComposition automationComposition) { + AutomationComposition automationComposition) { assertThat(response).isNotNull(); assertThat(response.getErrorDetails()).isNull(); - assertEquals(1, response.getAffectedAutomationCompositions().size()); - assertEquals(0, response.getAffectedAutomationCompositions().get(0) - .compareTo(automationComposition.getKey().asIdentifier())); + assertEquals(response.getAffectedAutomationComposition(), automationComposition.getKey().asIdentifier()); } /** @@ -136,7 +114,6 @@ public class InstantiationUtils { * @param path path of the resource */ public static ToscaServiceTemplate getToscaServiceTemplate(String path) { - try { return YAML_TRANSLATOR.decode(ResourceUtils.getResourceAsStream(path), ToscaServiceTemplate.class); } catch (CoderException e) { diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java index 732b76a81..d3777620b 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java @@ -29,7 +29,6 @@ import static org.onap.policy.clamp.acm.runtime.util.CommonTestData.TOSCA_SERVIC import java.util.UUID; import javax.ws.rs.client.Entity; -import javax.ws.rs.client.Invocation; import javax.ws.rs.core.Response; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; @@ -47,6 +46,7 @@ import org.onap.policy.clamp.models.acm.messages.rest.instantiation.Instantiatio import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider; import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider; import org.onap.policy.clamp.models.acm.persistence.repository.AutomationCompositionRepository; +import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -65,10 +65,10 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; class InstantiationControllerTest extends CommonRestController { private static final String AC_INSTANTIATION_CREATE_JSON = - "src/test/resources/rest/acm/AutomationCompositions.json"; + "src/test/resources/rest/acm/AutomationComposition.json"; private static final String AC_INSTANTIATION_UPDATE_JSON = - "src/test/resources/rest/acm/AutomationCompositionsUpdate.json"; + "src/test/resources/rest/acm/AutomationCompositionUpdate.json"; private static final String AC_INSTANTIATION_CHANGE_STATE_JSON = "src/test/resources/rest/acm/PassiveCommand.json"; @@ -119,11 +119,11 @@ class InstantiationControllerTest extends CommonRestController { } @Test - void testCreate_Unauthorized() throws Exception { - AutomationCompositions automationCompositions = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Unauthorized"); + void testCreate_Unauthorized() { + var automationComposition = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Unauthorized"); - assertUnauthorizedPost(INSTANTIATION_ENDPOINT, Entity.json(automationCompositions)); + assertUnauthorizedPost(INSTANTIATION_ENDPOINT, Entity.json(automationComposition)); } @Test @@ -133,10 +133,10 @@ class InstantiationControllerTest extends CommonRestController { @Test void testUpdate_Unauthorized() throws Exception { - AutomationCompositions automationCompositions = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_UPDATE_JSON, "Unauthorized"); + var automationComposition = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_UPDATE_JSON, "Unauthorized"); - assertUnauthorizedPut(INSTANTIATION_ENDPOINT, Entity.json(automationCompositions)); + assertUnauthorizedPut(INSTANTIATION_ENDPOINT, Entity.json(automationComposition)); } @Test @@ -145,197 +145,164 @@ class InstantiationControllerTest extends CommonRestController { } @Test - void testCommand_Unauthorized() throws Exception { - InstantiationCommand instantiationCommand = InstantiationUtils + void testCommand_Unauthorized() { + var instantiationCommand = InstantiationUtils .getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "Unauthorized"); assertUnauthorizedPut(INSTANTIATION_COMMAND_ENDPOINT, Entity.json(instantiationCommand)); } @Test - void testCreate() throws Exception { - - var automationCompositionsFromRsc = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Create"); - for (var automationComposition : automationCompositionsFromRsc.getAutomationCompositionList()) { - automationComposition.setCompositionId(compositionId); - } + void testCreate() { + var automationCompositionFromRsc = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Create"); + automationCompositionFromRsc.setCompositionId(compositionId); var invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT); - var resp = invocationBuilder.post(Entity.json(automationCompositionsFromRsc)); + var resp = invocationBuilder.post(Entity.json(automationCompositionFromRsc)); assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus()); - InstantiationResponse instResponse = resp.readEntity(InstantiationResponse.class); - InstantiationUtils.assertInstantiationResponse(instResponse, automationCompositionsFromRsc); + var instResponse = resp.readEntity(InstantiationResponse.class); + InstantiationUtils.assertInstantiationResponse(instResponse, automationCompositionFromRsc); - for (var automationCompositionFromRsc : automationCompositionsFromRsc.getAutomationCompositionList()) { - var automationCompositionsFromDb = - instantiationProvider.getAutomationCompositions(automationCompositionFromRsc.getKey().getName(), - automationCompositionFromRsc.getKey().getVersion()); + var automationCompositionsFromDb = instantiationProvider.getAutomationCompositions( + automationCompositionFromRsc.getKey().getName(), automationCompositionFromRsc.getKey().getVersion()); + + assertNotNull(automationCompositionsFromDb); + assertThat(automationCompositionsFromDb.getAutomationCompositionList()).hasSize(1); + assertEquals(automationCompositionFromRsc, automationCompositionsFromDb.getAutomationCompositionList().get(0)); - assertNotNull(automationCompositionsFromDb); - assertThat(automationCompositionsFromDb.getAutomationCompositionList()).hasSize(1); - assertEquals(automationCompositionFromRsc, - automationCompositionsFromDb.getAutomationCompositionList().get(0)); - } } @Test - void testCreateBadRequest() throws Exception { - var automationCompositionsFromRsc = InstantiationUtils - .getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "CreateBadRequest"); - for (var automationComposition : automationCompositionsFromRsc.getAutomationCompositionList()) { - automationComposition.setCompositionId(compositionId); - } + void testCreateBadRequest() { + var automationCompositionFromRsc = InstantiationUtils + .getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "CreateBadRequest"); + automationCompositionFromRsc.setCompositionId(compositionId); var invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT); - var resp = invocationBuilder.post(Entity.json(automationCompositionsFromRsc)); + var resp = invocationBuilder.post(Entity.json(automationCompositionFromRsc)); assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus()); // testing Bad Request: AC already defined - resp = invocationBuilder.post(Entity.json(automationCompositionsFromRsc)); + resp = invocationBuilder.post(Entity.json(automationCompositionFromRsc)); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp.getStatus()); - InstantiationResponse instResponse = resp.readEntity(InstantiationResponse.class); + var instResponse = resp.readEntity(InstantiationResponse.class); assertNotNull(instResponse.getErrorDetails()); - assertNull(instResponse.getAffectedAutomationCompositions()); + assertNull(instResponse.getAffectedAutomationComposition()); } @Test void testQuery_NoResultWithThisName() { - Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT + "?name=noResultWithThisName"); - Response rawresp = invocationBuilder.buildGet().invoke(); + var invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT + "?name=noResultWithThisName"); + var rawresp = invocationBuilder.buildGet().invoke(); assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); - AutomationCompositions resp = rawresp.readEntity(AutomationCompositions.class); + var resp = rawresp.readEntity(AutomationCompositions.class); assertThat(resp.getAutomationCompositionList()).isEmpty(); } @Test - void testQuery() throws Exception { + void testQuery() { + var automationComposition = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Query"); + automationComposition.setCompositionId(compositionId); - var automationCompositions = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Query"); - for (var acFromRsc : automationCompositions.getAutomationCompositionList()) { - acFromRsc.setCompositionId(compositionId); - } - instantiationProvider.createAutomationCompositions(automationCompositions); - - for (var automationCompositionFromRsc : automationCompositions.getAutomationCompositionList()) { - var invocationBuilder = super.sendRequest( - INSTANTIATION_ENDPOINT + "?name=" + automationCompositionFromRsc.getKey().getName()); - Response rawresp = invocationBuilder.buildGet().invoke(); - assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); - AutomationCompositions automationCompositionsQuery = rawresp.readEntity(AutomationCompositions.class); - assertNotNull(automationCompositionsQuery); - assertThat(automationCompositionsQuery.getAutomationCompositionList()).hasSize(1); - assertEquals(automationCompositionFromRsc, - automationCompositionsQuery.getAutomationCompositionList().get(0)); - } + instantiationProvider.createAutomationComposition(automationComposition); + + var invocationBuilder = + super.sendRequest(INSTANTIATION_ENDPOINT + "?name=" + automationComposition.getKey().getName()); + var rawresp = invocationBuilder.buildGet().invoke(); + assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus()); + var automationCompositionsQuery = rawresp.readEntity(AutomationCompositions.class); + assertNotNull(automationCompositionsQuery); + assertThat(automationCompositionsQuery.getAutomationCompositionList()).hasSize(1); + assertEquals(automationComposition, automationCompositionsQuery.getAutomationCompositionList().get(0)); } @Test - void testUpdate() throws Exception { - - var automationCompositionsCreate = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Update"); - for (var automationComposition : automationCompositionsCreate.getAutomationCompositionList()) { - automationComposition.setCompositionId(compositionId); - } + void testUpdate() { + var automationCompositionCreate = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Update"); + automationCompositionCreate.setCompositionId(compositionId); - instantiationProvider.createAutomationCompositions(automationCompositionsCreate); + instantiationProvider.createAutomationComposition(automationCompositionCreate); var invocationBuilder = super.sendRequest(INSTANTIATION_ENDPOINT); - var automationCompositions = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_UPDATE_JSON, "Update"); - for (var automationComposition : automationCompositions.getAutomationCompositionList()) { - automationComposition.setCompositionId(compositionId); - } - var resp = invocationBuilder.put(Entity.json(automationCompositions)); + var automationComposition = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_UPDATE_JSON, "Update"); + automationComposition.setCompositionId(compositionId); + var resp = invocationBuilder.put(Entity.json(automationComposition)); assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus()); var instResponse = resp.readEntity(InstantiationResponse.class); - InstantiationUtils.assertInstantiationResponse(instResponse, automationCompositions); + InstantiationUtils.assertInstantiationResponse(instResponse, automationComposition); - for (var automationCompositionUpdate : automationCompositions.getAutomationCompositionList()) { - var automationCompositionsFromDb = instantiationProvider.getAutomationCompositions( - automationCompositionUpdate.getKey().getName(), automationCompositionUpdate.getKey().getVersion()); + var automationCompositionsFromDb = instantiationProvider.getAutomationCompositions( + automationComposition.getKey().getName(), automationComposition.getKey().getVersion()); - assertNotNull(automationCompositionsFromDb); - assertThat(automationCompositionsFromDb.getAutomationCompositionList()).hasSize(1); - assertEquals(automationCompositionUpdate, - automationCompositionsFromDb.getAutomationCompositionList().get(0)); - } + assertNotNull(automationCompositionsFromDb); + assertThat(automationCompositionsFromDb.getAutomationCompositionList()).hasSize(1); + assertEquals(automationComposition, automationCompositionsFromDb.getAutomationCompositionList().get(0)); } @Test - void testDelete() throws Exception { + void testDelete() { + var automationCompositionFromRsc = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Delete"); + automationCompositionFromRsc.setCompositionId(compositionId); - var automationCompositionsFromRsc = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Delete"); - for (var automationComposition : automationCompositionsFromRsc.getAutomationCompositionList()) { - automationComposition.setCompositionId(compositionId); - } + instantiationProvider.createAutomationComposition(automationCompositionFromRsc); - instantiationProvider.createAutomationCompositions(automationCompositionsFromRsc); - - for (var automationCompositionFromRsc : automationCompositionsFromRsc.getAutomationCompositionList()) { - var invocationBuilder = super.sendRequest( - INSTANTIATION_ENDPOINT + "?name=" + automationCompositionFromRsc.getKey().getName() + "&version=" - + automationCompositionFromRsc.getKey().getVersion()); - var resp = invocationBuilder.delete(); - assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus()); - var instResponse = resp.readEntity(InstantiationResponse.class); - InstantiationUtils.assertInstantiationResponse(instResponse, automationCompositionFromRsc); - - var automationCompositionsFromDb = - instantiationProvider.getAutomationCompositions(automationCompositionFromRsc.getKey().getName(), - automationCompositionFromRsc.getKey().getVersion()); - assertThat(automationCompositionsFromDb.getAutomationCompositionList()).isEmpty(); - } + var invocationBuilder = + super.sendRequest(INSTANTIATION_ENDPOINT + "?name=" + automationCompositionFromRsc.getKey().getName() + + "&version=" + automationCompositionFromRsc.getKey().getVersion()); + var resp = invocationBuilder.delete(); + assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus()); + var instResponse = resp.readEntity(InstantiationResponse.class); + InstantiationUtils.assertInstantiationResponse(instResponse, automationCompositionFromRsc); + + var automationCompositionsFromDb = instantiationProvider.getAutomationCompositions( + automationCompositionFromRsc.getKey().getName(), automationCompositionFromRsc.getKey().getVersion()); + assertThat(automationCompositionsFromDb.getAutomationCompositionList()).isEmpty(); } @Test - void testDeleteBadRequest() throws Exception { - var automationCompositionsFromRsc = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "DelBadRequest"); - for (var automationComposition : automationCompositionsFromRsc.getAutomationCompositionList()) { - automationComposition.setCompositionId(compositionId); - } + void testDeleteBadRequest() { + var automationCompositionFromRsc = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "DelBadRequest"); + automationCompositionFromRsc.setCompositionId(compositionId); - instantiationProvider.createAutomationCompositions(automationCompositionsFromRsc); + instantiationProvider.createAutomationComposition(automationCompositionFromRsc); - for (var automationCompositionFromRsc : automationCompositionsFromRsc.getAutomationCompositionList()) { - var invocationBuilder = super.sendRequest( - INSTANTIATION_ENDPOINT + "?name=" + automationCompositionFromRsc.getKey().getName()); - var resp = invocationBuilder.delete(); - assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp.getStatus()); - } + var invocationBuilder = + super.sendRequest(INSTANTIATION_ENDPOINT + "?name=" + automationCompositionFromRsc.getKey().getName()); + var resp = invocationBuilder.delete(); + assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp.getStatus()); } @Test void testCommand_NotFound1() { - Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_COMMAND_ENDPOINT); - Response resp = invocationBuilder.put(Entity.json(new InstantiationCommand())); + var invocationBuilder = super.sendRequest(INSTANTIATION_COMMAND_ENDPOINT); + var resp = invocationBuilder.put(Entity.json(new InstantiationCommand())); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp.getStatus()); } @Test - void testCommand_NotFound2() throws Exception { - InstantiationCommand command = + void testCommand_NotFound2() { + var command = InstantiationUtils.getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON, "Command"); command.setOrderedState(null); - Invocation.Builder invocationBuilder = super.sendRequest(INSTANTIATION_COMMAND_ENDPOINT); - Response resp = invocationBuilder.put(Entity.json(command)); + var invocationBuilder = super.sendRequest(INSTANTIATION_COMMAND_ENDPOINT); + var resp = invocationBuilder.put(Entity.json(command)); assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp.getStatus()); } @Test - void testCommand() throws Exception { - var automationCompositions = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Command"); - for (var automationComposition : automationCompositions.getAutomationCompositionList()) { - automationComposition.setCompositionId(compositionId); - } - instantiationProvider.createAutomationCompositions(automationCompositions); + void testCommand() throws PfModelException { + var automationComposition = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Command"); + automationComposition.setCompositionId(compositionId); + instantiationProvider.createAutomationComposition(automationComposition); var participants = CommonTestData.createParticipants(); for (var participant : participants) { @@ -352,13 +319,12 @@ class InstantiationControllerTest extends CommonRestController { InstantiationUtils.assertInstantiationResponse(instResponse, command); // check passive state on DB - for (var toscaConceptIdentifier : command.getAutomationCompositionIdentifierList()) { - var automationCompositionsGet = instantiationProvider - .getAutomationCompositions(toscaConceptIdentifier.getName(), toscaConceptIdentifier.getVersion()); - assertThat(automationCompositionsGet.getAutomationCompositionList()).hasSize(1); - assertEquals(command.getOrderedState(), - automationCompositionsGet.getAutomationCompositionList().get(0).getOrderedState()); - } + var toscaConceptIdentifier = command.getAutomationCompositionIdentifier(); + var automationCompositionsGet = instantiationProvider + .getAutomationCompositions(toscaConceptIdentifier.getName(), toscaConceptIdentifier.getVersion()); + assertThat(automationCompositionsGet.getAutomationCompositionList()).hasSize(1); + assertEquals(command.getOrderedState(), + automationCompositionsGet.getAutomationCompositionList().get(0).getOrderedState()); } private synchronized void deleteEntryInDB() throws Exception { diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java index 47e3d516c..e01f76bb8 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java @@ -57,123 +57,115 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUp import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider; import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider; import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider; -import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; class SupervisionHandlerTest { - private static final String AC_INSTANTIATION_CREATE_JSON = - "src/test/resources/rest/acm/AutomationCompositions.json"; + private static final String AC_INSTANTIATION_CREATE_JSON = "src/test/resources/rest/acm/AutomationComposition.json"; private static final ToscaConceptIdentifier identifier = new ToscaConceptIdentifier("PMSHInstance0Crud", "1.0.1"); private static final ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("ParticipantId", "1.0.0"); private static final ToscaConceptIdentifier participantType = - new ToscaConceptIdentifier("ParticipantType", "1.0.0"); + new ToscaConceptIdentifier("ParticipantType", "1.0.0"); @Test - void testTriggerAutomationCompositionSupervisionEmpty() throws PfModelException, CoderException { - var handler = createSupervisionHandler(AutomationCompositionOrderedState.PASSIVE, - AutomationCompositionState.UNINITIALISED); - - assertThatThrownBy(() -> handler.triggerAutomationCompositionSupervision(List.of())) - .hasMessageMatching("The list of automation compositions for supervision is empty"); - } - - @Test - void testTriggerAutomationCompositionSupervision() - throws AutomationCompositionException, PfModelException, CoderException { - var automationCompositionProvider = mock(AutomationCompositionProvider.class); + void testTriggerAutomationCompositionSupervision() throws AutomationCompositionException { var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class); - var handler = createSupervisionHandler(automationCompositionProvider, mock(ParticipantProvider.class), - mock(ParticipantRegisterAckPublisher.class), - mock(ParticipantDeregisterAckPublisher.class), automationCompositionUpdatePublisher, - mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE, - AutomationCompositionState.UNINITIALISED); + var handler = createSupervisionHandlerForTrigger(automationCompositionUpdatePublisher); - handler.triggerAutomationCompositionSupervision(List.of(identifier)); + var automationComposition = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud"); + automationComposition.setOrderedState(AutomationCompositionOrderedState.PASSIVE); + automationComposition.setState(AutomationCompositionState.UNINITIALISED); + handler.triggerAutomationCompositionSupervision(automationComposition); - verify(automationCompositionUpdatePublisher).send(any(AutomationComposition.class)); - verify(automationCompositionProvider).saveAutomationComposition(any(AutomationComposition.class)); + verify(automationCompositionUpdatePublisher).send(automationComposition); } @Test - void testAcUninitialisedToUninitialised() throws PfModelException, CoderException { - var handler = createSupervisionHandler(AutomationCompositionOrderedState.UNINITIALISED, - AutomationCompositionState.UNINITIALISED); + void testAcUninitialisedToUninitialised() { + var handler = createSupervisionHandlerForTrigger(); + var automationComposition = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud"); + automationComposition.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED); + automationComposition.setState(AutomationCompositionState.UNINITIALISED); - assertThatThrownBy(() -> handler.triggerAutomationCompositionSupervision(List.of(identifier))) - .hasMessageMatching("Automation composition is already in state UNINITIALISED"); + assertThatThrownBy(() -> handler.triggerAutomationCompositionSupervision(automationComposition)) + .hasMessageMatching("Automation composition is already in state UNINITIALISED"); } @Test - void testAcUninitialisedToPassive() throws PfModelException, CoderException, AutomationCompositionException { - - var automationCompositionsCreate = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud"); - - var automationComposition = automationCompositionsCreate.getAutomationCompositionList().get(0); + void testAcUninitialisedToPassive() throws AutomationCompositionException { + var automationComposition = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud"); automationComposition.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED); automationComposition.setState(AutomationCompositionState.PASSIVE); automationComposition.setCompositionId(UUID.randomUUID()); var automationCompositionProvider = mock(AutomationCompositionProvider.class); - when(automationCompositionProvider.findAutomationComposition(identifier)) - .thenReturn(Optional.of(automationComposition)); - when(automationCompositionProvider.getAutomationComposition(identifier)).thenReturn(automationComposition); - var acDefinitionProvider = Mockito.mock(AcDefinitionProvider.class); - when(acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId())) - .thenReturn(Objects.requireNonNull(InstantiationUtils.getToscaServiceTemplate( - TOSCA_SERVICE_TEMPLATE_YAML))); + when(acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId())).thenReturn( + Objects.requireNonNull(InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML))); var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class); var handler = new SupervisionHandler(automationCompositionProvider, mock(ParticipantProvider.class), - acDefinitionProvider, mock(AutomationCompositionUpdatePublisher.class), - automationCompositionStateChangePublisher, mock(ParticipantRegisterAckPublisher.class), - mock(ParticipantDeregisterAckPublisher.class), mock(ParticipantUpdatePublisher.class)); + acDefinitionProvider, mock(AutomationCompositionUpdatePublisher.class), + automationCompositionStateChangePublisher, mock(ParticipantRegisterAckPublisher.class), + mock(ParticipantDeregisterAckPublisher.class), mock(ParticipantUpdatePublisher.class)); - handler.triggerAutomationCompositionSupervision(List.of(identifier)); + handler.triggerAutomationCompositionSupervision(automationComposition); verify(automationCompositionStateChangePublisher).send(any(AutomationComposition.class), eq(1)); } @Test - void testAcPassiveToPassive() throws PfModelException, CoderException { - var handler = createSupervisionHandler(AutomationCompositionOrderedState.PASSIVE, - AutomationCompositionState.PASSIVE); + void testAcPassiveToPassive() { + var handler = createSupervisionHandlerForTrigger(); + var automationComposition = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud"); + automationComposition.setOrderedState(AutomationCompositionOrderedState.PASSIVE); + automationComposition.setState(AutomationCompositionState.PASSIVE); - assertThatThrownBy(() -> handler.triggerAutomationCompositionSupervision(List.of(identifier))) - .hasMessageMatching("Automation composition is already in state PASSIVE"); + assertThatThrownBy(() -> handler.triggerAutomationCompositionSupervision(automationComposition)) + .hasMessageMatching("Automation composition is already in state PASSIVE"); } @Test - void testAcRunningToRunning() throws PfModelException, CoderException { - var handler = createSupervisionHandler(AutomationCompositionOrderedState.RUNNING, - AutomationCompositionState.RUNNING); + void testAcRunningToRunning() { + var handler = createSupervisionHandlerForTrigger(); + + var automationComposition = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud"); + automationComposition.setOrderedState(AutomationCompositionOrderedState.RUNNING); + automationComposition.setState(AutomationCompositionState.RUNNING); - assertThatThrownBy(() -> handler.triggerAutomationCompositionSupervision(List.of(identifier))) - .hasMessageMatching("Automation composition is already in state RUNNING"); + assertThatThrownBy(() -> handler.triggerAutomationCompositionSupervision(automationComposition)) + .hasMessageMatching("Automation composition is already in state RUNNING"); } @Test - void testAcRunningToUninitialised() throws PfModelException, CoderException { - var handler = createSupervisionHandler(AutomationCompositionOrderedState.RUNNING, - AutomationCompositionState.UNINITIALISED); + void testAcRunningToUninitialised() { + var handler = createSupervisionHandlerForTrigger(); + + var automationComposition = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud"); + automationComposition.setOrderedState(AutomationCompositionOrderedState.RUNNING); + automationComposition.setState(AutomationCompositionState.UNINITIALISED); - assertThatThrownBy(() -> handler.triggerAutomationCompositionSupervision(List.of(identifier))) - .hasMessageMatching("Automation composition can't transition from state UNINITIALISED to state RUNNING"); + assertThatThrownBy(() -> handler.triggerAutomationCompositionSupervision(automationComposition)) + .hasMessageMatching( + "Automation composition can't transition from state UNINITIALISED to state RUNNING"); } @Test - void testHandleAutomationCompositionStateChangeAckMessage() throws PfModelException, CoderException { + void testHandleAutomationCompositionStateChangeAckMessage() { var automationCompositionProvider = mock(AutomationCompositionProvider.class); var handler = createSupervisionHandler(automationCompositionProvider, mock(ParticipantProvider.class), - mock(ParticipantRegisterAckPublisher.class), - mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class), - mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE, - AutomationCompositionState.UNINITIALISED); + mock(ParticipantRegisterAckPublisher.class), mock(ParticipantDeregisterAckPublisher.class), + mock(AutomationCompositionUpdatePublisher.class), mock(ParticipantUpdatePublisher.class), + AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED); var automationCompositionAckMessage = - new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK); + new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK); automationCompositionAckMessage.setAutomationCompositionResultMap(Map.of()); automationCompositionAckMessage.setAutomationCompositionId(identifier); @@ -183,19 +175,18 @@ class SupervisionHandlerTest { } @Test - void testHandleAutomationCompositionUpdateAckMessage() throws PfModelException, CoderException { + void testHandleAutomationCompositionUpdateAckMessage() { var automationCompositionAckMessage = - new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK); + new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK); automationCompositionAckMessage.setParticipantId(participantId); automationCompositionAckMessage.setParticipantType(participantType); automationCompositionAckMessage.setAutomationCompositionResultMap(Map.of()); automationCompositionAckMessage.setAutomationCompositionId(identifier); var automationCompositionProvider = mock(AutomationCompositionProvider.class); var handler = createSupervisionHandler(automationCompositionProvider, mock(ParticipantProvider.class), - mock(ParticipantRegisterAckPublisher.class), - mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class), - mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE, - AutomationCompositionState.UNINITIALISED); + mock(ParticipantRegisterAckPublisher.class), mock(ParticipantDeregisterAckPublisher.class), + mock(AutomationCompositionUpdatePublisher.class), mock(ParticipantUpdatePublisher.class), + AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED); handler.handleAutomationCompositionUpdateAckMessage(automationCompositionAckMessage); @@ -203,7 +194,7 @@ class SupervisionHandlerTest { } @Test - void testHandleParticipantDeregister() throws PfModelException, CoderException { + void testHandleParticipantDeregister() throws PfModelException { var participant = new Participant(); participant.setName(participantId.getName()); participant.setVersion(participantId.getVersion()); @@ -211,7 +202,7 @@ class SupervisionHandlerTest { var participantProvider = mock(ParticipantProvider.class); when(participantProvider.findParticipant(participantId.getName(), participantId.getVersion())) - .thenReturn(Optional.of(participant)); + .thenReturn(Optional.of(participant)); var participantDeregisterMessage = new ParticipantDeregister(); participantDeregisterMessage.setMessageId(UUID.randomUUID()); @@ -219,10 +210,9 @@ class SupervisionHandlerTest { participantDeregisterMessage.setParticipantType(participantType); var participantDeregisterAckPublisher = mock(ParticipantDeregisterAckPublisher.class); var handler = createSupervisionHandler(mock(AutomationCompositionProvider.class), participantProvider, - mock(ParticipantRegisterAckPublisher.class), - participantDeregisterAckPublisher, mock(AutomationCompositionUpdatePublisher.class), - mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE, - AutomationCompositionState.UNINITIALISED); + mock(ParticipantRegisterAckPublisher.class), participantDeregisterAckPublisher, + mock(AutomationCompositionUpdatePublisher.class), mock(ParticipantUpdatePublisher.class), + AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED); handler.handleParticipantMessage(participantDeregisterMessage); @@ -231,7 +221,7 @@ class SupervisionHandlerTest { } @Test - void testHandleParticipantRegister() throws PfModelException, CoderException { + void testHandleParticipantRegister() throws PfModelException { var participant = new Participant(); participant.setName(participantId.getName()); participant.setVersion(participantId.getVersion()); @@ -244,20 +234,19 @@ class SupervisionHandlerTest { var participantProvider = mock(ParticipantProvider.class); var participantRegisterAckPublisher = mock(ParticipantRegisterAckPublisher.class); var handler = createSupervisionHandler(mock(AutomationCompositionProvider.class), participantProvider, - participantRegisterAckPublisher, - mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class), - mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE, - AutomationCompositionState.UNINITIALISED); + participantRegisterAckPublisher, mock(ParticipantDeregisterAckPublisher.class), + mock(AutomationCompositionUpdatePublisher.class), mock(ParticipantUpdatePublisher.class), + AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED); handler.handleParticipantMessage(participantRegisterMessage); verify(participantProvider).saveParticipant(any()); verify(participantRegisterAckPublisher).send(participantRegisterMessage.getMessageId(), participantId, - participantType); + participantType); } @Test - void testParticipantUpdateAck() throws PfModelException, CoderException { + void testParticipantUpdateAck() throws PfModelException { var participant = new Participant(); participant.setName(participantId.getName()); participant.setVersion(participantId.getVersion()); @@ -265,17 +254,16 @@ class SupervisionHandlerTest { var participantProvider = mock(ParticipantProvider.class); when(participantProvider.findParticipant(participantId.getName(), participantId.getVersion())) - .thenReturn(Optional.of(participant)); + .thenReturn(Optional.of(participant)); var participantUpdateAckMessage = new ParticipantUpdateAck(); participantUpdateAckMessage.setParticipantId(participantId); participantUpdateAckMessage.setParticipantType(participantType); participantUpdateAckMessage.setState(ParticipantState.PASSIVE); var handler = createSupervisionHandler(mock(AutomationCompositionProvider.class), participantProvider, - mock(ParticipantRegisterAckPublisher.class), - mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class), - mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE, - AutomationCompositionState.UNINITIALISED); + mock(ParticipantRegisterAckPublisher.class), mock(ParticipantDeregisterAckPublisher.class), + mock(AutomationCompositionUpdatePublisher.class), mock(ParticipantUpdatePublisher.class), + AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED); handler.handleParticipantMessage(participantUpdateAckMessage); @@ -283,7 +271,7 @@ class SupervisionHandlerTest { } @Test - void testHandleParticipantStatus() throws PfModelException, CoderException { + void testHandleParticipantStatus() throws PfModelException { var participantStatusMessage = new ParticipantStatus(); participantStatusMessage.setParticipantId(participantId); participantStatusMessage.setParticipantType(participantType); @@ -292,80 +280,81 @@ class SupervisionHandlerTest { var participantProvider = mock(ParticipantProvider.class); var handler = createSupervisionHandler(mock(AutomationCompositionProvider.class), participantProvider, - mock(ParticipantRegisterAckPublisher.class), - mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class), - mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE, - AutomationCompositionState.UNINITIALISED); + mock(ParticipantRegisterAckPublisher.class), mock(ParticipantDeregisterAckPublisher.class), + mock(AutomationCompositionUpdatePublisher.class), mock(ParticipantUpdatePublisher.class), + AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED); handler.handleParticipantMessage(participantStatusMessage); verify(participantProvider).saveParticipant(any()); } @Test - void testHandleSendCommissionMessage() throws PfModelException, CoderException { + void testHandleSendCommissionMessage() throws PfModelException { var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class); var handler = - createSupervisionHandler(mock(AutomationCompositionProvider.class), mock(ParticipantProvider.class), - mock(ParticipantRegisterAckPublisher.class), - mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class), - participantUpdatePublisher, AutomationCompositionOrderedState.PASSIVE, - AutomationCompositionState.UNINITIALISED); + createSupervisionHandler(mock(AutomationCompositionProvider.class), mock(ParticipantProvider.class), + mock(ParticipantRegisterAckPublisher.class), mock(ParticipantDeregisterAckPublisher.class), + mock(AutomationCompositionUpdatePublisher.class), participantUpdatePublisher, + AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED); handler.handleSendCommissionMessage(participantId.getName(), participantId.getVersion()); verify(participantUpdatePublisher).sendComissioningBroadcast(participantId.getName(), - participantId.getVersion()); + participantId.getVersion()); } @Test - void testHandleSendDeCommissionMessage() throws PfModelException, CoderException { + void testHandleSendDeCommissionMessage() throws PfModelException { var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class); var handler = - createSupervisionHandler(mock(AutomationCompositionProvider.class), mock(ParticipantProvider.class), - mock(ParticipantRegisterAckPublisher.class), - mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class), - participantUpdatePublisher, AutomationCompositionOrderedState.PASSIVE, - AutomationCompositionState.UNINITIALISED); + createSupervisionHandler(mock(AutomationCompositionProvider.class), mock(ParticipantProvider.class), + mock(ParticipantRegisterAckPublisher.class), mock(ParticipantDeregisterAckPublisher.class), + mock(AutomationCompositionUpdatePublisher.class), participantUpdatePublisher, + AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED); handler.handleSendDeCommissionMessage(); verify(participantUpdatePublisher).sendDecomisioning(); } - private SupervisionHandler createSupervisionHandler(AutomationCompositionOrderedState orderedState, - AutomationCompositionState state) throws PfModelException, CoderException { - return createSupervisionHandler(mock(AutomationCompositionProvider.class), mock(ParticipantProvider.class), - mock(ParticipantRegisterAckPublisher.class), - mock(ParticipantDeregisterAckPublisher.class), mock(AutomationCompositionUpdatePublisher.class), - mock(ParticipantUpdatePublisher.class), orderedState, state); - } - private SupervisionHandler createSupervisionHandler(AutomationCompositionProvider automationCompositionProvider, - ParticipantProvider participantProvider, - ParticipantRegisterAckPublisher participantRegisterAckPublisher, + ParticipantProvider participantProvider, ParticipantRegisterAckPublisher participantRegisterAckPublisher, ParticipantDeregisterAckPublisher participantDeregisterAckPublisher, AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher, ParticipantUpdatePublisher participantUpdatePublisher, AutomationCompositionOrderedState orderedState, - AutomationCompositionState state) throws PfModelException, CoderException { - var automationCompositionsCreate = - InstantiationUtils.getAutomationCompositionsFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud"); + AutomationCompositionState state) { + var automationComposition = + InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud"); - var automationComposition = automationCompositionsCreate.getAutomationCompositionList().get(0); automationComposition.setOrderedState(orderedState); automationComposition.setState(state); - when(automationCompositionProvider.findAutomationComposition(identifier)) .thenReturn(Optional.of(automationComposition)); - when(automationCompositionProvider.getAutomationComposition(identifier)).thenReturn(automationComposition); var acDefinitionProvider = Mockito.mock(AcDefinitionProvider.class); - when(acDefinitionProvider.getServiceTemplateList(any(), any())) - .thenReturn(List.of(Objects.requireNonNull(InstantiationUtils.getToscaServiceTemplate( - TOSCA_SERVICE_TEMPLATE_YAML)))); + when(acDefinitionProvider.getServiceTemplateList(any(), any())).thenReturn(List + .of(Objects.requireNonNull(InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML)))); var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class); - return new SupervisionHandler(automationCompositionProvider, participantProvider, - acDefinitionProvider, automationCompositionUpdatePublisher, automationCompositionStateChangePublisher, - participantRegisterAckPublisher, participantDeregisterAckPublisher, participantUpdatePublisher); + return new SupervisionHandler(automationCompositionProvider, participantProvider, acDefinitionProvider, + automationCompositionUpdatePublisher, automationCompositionStateChangePublisher, + participantRegisterAckPublisher, participantDeregisterAckPublisher, participantUpdatePublisher); + + } + + private SupervisionHandler createSupervisionHandlerForTrigger() { + return new SupervisionHandler(mock(AutomationCompositionProvider.class), mock(ParticipantProvider.class), + mock(AcDefinitionProvider.class), mock(AutomationCompositionUpdatePublisher.class), + mock(AutomationCompositionStateChangePublisher.class), mock(ParticipantRegisterAckPublisher.class), + mock(ParticipantDeregisterAckPublisher.class), mock(ParticipantUpdatePublisher.class)); + + } + + private SupervisionHandler createSupervisionHandlerForTrigger( + AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher) { + return new SupervisionHandler(mock(AutomationCompositionProvider.class), mock(ParticipantProvider.class), + mock(AcDefinitionProvider.class), automationCompositionUpdatePublisher, + mock(AutomationCompositionStateChangePublisher.class), mock(ParticipantRegisterAckPublisher.class), + mock(ParticipantDeregisterAckPublisher.class), mock(ParticipantUpdatePublisher.class)); } } diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java index 6d3e5b5a0..03a0ec59e 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java @@ -50,13 +50,12 @@ import org.onap.policy.clamp.models.acm.concepts.ParticipantState; import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider; import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider; import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider; -import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; class SupervisionScannerTest { - private static final String AC_JSON = "src/test/resources/rest/acm/AutomationCompositionsSmoke.json"; + private static final String AC_JSON = "src/test/resources/rest/acm/AutomationCompositionSmoke.json"; private static final AcDefinitionProvider acDefinitionProvider = mock(AcDefinitionProvider.class); @@ -69,7 +68,7 @@ class SupervisionScannerTest { new ToscaConceptIdentifier("org.onap.policy.clamp.acm.PolicyParticipant", PARTICIPANT_VERSION); @BeforeAll - public static void setUpBeforeAll() throws Exception { + public static void setUpBeforeAll() { var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML); var acDefinition = new AutomationCompositionDefinition(); compositionId = UUID.randomUUID(); @@ -79,7 +78,7 @@ class SupervisionScannerTest { } @Test - void testScannerOrderedStateEqualsToState() throws PfModelException, CoderException { + void testScannerOrderedStateEqualsToState() { var automationCompositionProvider = mock(AutomationCompositionProvider.class); var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class); var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class); @@ -88,10 +87,9 @@ class SupervisionScannerTest { var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class); var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner"); - var automationCompositions = InstantiationUtils.getAutomationCompositionsFromResource(AC_JSON, "Crud") - .getAutomationCompositionList(); + var automationComposition = InstantiationUtils.getAutomationCompositionFromResource(AC_JSON, "Crud"); when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId)) - .thenReturn(automationCompositions); + .thenReturn(List.of(automationComposition)); var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider, automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider, @@ -102,14 +100,13 @@ class SupervisionScannerTest { } @Test - void testScannerOrderedStateDifferentToState() throws PfModelException, CoderException { - var automationCompositions = InstantiationUtils.getAutomationCompositionsFromResource(AC_JSON, "Crud") - .getAutomationCompositionList(); - automationCompositions.get(0).setState(AutomationCompositionState.UNINITIALISED2PASSIVE); - automationCompositions.get(0).setOrderedState(AutomationCompositionOrderedState.UNINITIALISED); + void testScannerOrderedStateDifferentToState() { + var automationComposition = InstantiationUtils.getAutomationCompositionFromResource(AC_JSON, "Crud"); + automationComposition.setState(AutomationCompositionState.UNINITIALISED2PASSIVE); + automationComposition.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED); var automationCompositionProvider = mock(AutomationCompositionProvider.class); when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId)) - .thenReturn(automationCompositions); + .thenReturn(List.of(automationComposition)); var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class); var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class); @@ -127,7 +124,7 @@ class SupervisionScannerTest { } @Test - void testScanner() throws PfModelException { + void testScanner() { var automationCompositionProvider = mock(AutomationCompositionProvider.class); var automationComposition = new AutomationComposition(); when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId)) @@ -156,12 +153,11 @@ class SupervisionScannerTest { } @Test - void testSendAutomationCompositionMsgUpdate() throws PfModelException, CoderException { - var automationCompositions = InstantiationUtils.getAutomationCompositionsFromResource(AC_JSON, "Crud") - .getAutomationCompositionList(); - automationCompositions.get(0).setState(AutomationCompositionState.UNINITIALISED2PASSIVE); - automationCompositions.get(0).setOrderedState(AutomationCompositionOrderedState.PASSIVE); - for (var element : automationCompositions.get(0).getElements().values()) { + void testSendAutomationCompositionMsgUpdate() { + var automationComposition = InstantiationUtils.getAutomationCompositionFromResource(AC_JSON, "Crud"); + automationComposition.setState(AutomationCompositionState.UNINITIALISED2PASSIVE); + automationComposition.setOrderedState(AutomationCompositionOrderedState.PASSIVE); + for (var element : automationComposition.getElements().values()) { if ("org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement" .equals(element.getDefinition().getName())) { element.setOrderedState(AutomationCompositionOrderedState.PASSIVE); @@ -174,7 +170,7 @@ class SupervisionScannerTest { var automationCompositionProvider = mock(AutomationCompositionProvider.class); when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId)) - .thenReturn(automationCompositions); + .thenReturn(List.of(automationComposition)); var participantProvider = mock(ParticipantProvider.class); var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class); diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json b/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json new file mode 100644 index 000000000..a754de9d3 --- /dev/null +++ b/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json @@ -0,0 +1,64 @@ +{ + "name": "PMSHInstance0", + "version": "1.0.1", + "compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40", + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "PMSH automation composition instance 0", + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c20": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", + "definition": { + "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement", + "version": "1.2.3" + }, + "participantId": { + "name": "K8sParticipant0", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.policy.clamp.acm.KubernetesParticipant", + "version": "2.3.4" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Automation composition element for the K8S microservice for PMSH" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c21": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", + "definition": { + "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement", + "version": "1.2.3" + }, + "participantId": { + "name": "HttpParticipant0", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.policy.clamp.acm.HttpParticipant", + "version": "2.3.4" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Automation composition element for the http requests of PMSH microservice" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c22": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", + "version": "1.2.3" + }, + "participantId": { + "name": "org.onap.PM_Policy", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.policy.clamp.acm.PolicyParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Automation composition element for the operational policy for Performance Management Subscription Handling" + } + } +} diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json index 7e1107c0a..ccfd587a4 100644 --- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json +++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json @@ -1,142 +1,70 @@ { - "automationCompositionList": [ - { - "name": "PMSHInstance0", - "version": "1.0.1", + "name": "PMSHInstance0", + "version": "1.0.1", + "compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40", + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "PMSH automation composition instance 0", + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c20": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", "definition": { - "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition", + "name": "org.onap.domain.pmsh.DCAEMicroservice", "version": "1.2.3" }, + "participantType": { + "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant", + "version": "2.3.4" + }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", - "description": "PMSH automation composition instance 0", - "elements": { - "709c62b3-8918-41b9-a747-d21eb79c6c20": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", - "definition": { - "name": "org.onap.domain.pmsh.DCAEMicroservice", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c21": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c22": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c23": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant", - "version": "2.2.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition" - } - } + "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition" }, - { - "name": "PMSHInstance1", - "version": "1.0.1", + "709c62b3-8918-41b9-a747-d21eb79c6c21": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", "definition": { - "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition", + "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement", "version": "1.2.3" }, + "participantType": { + "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c22": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", + "version": "1.2.3" + }, + "participantType": { + "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c23": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", + "version": "1.2.3" + }, + "participantId": { + "name": "org.onap.PM_Policy", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.policy.clamp.acm.PolicyParticipant", + "version": "2.3.1" + }, "state": "UNINITIALISED", "orderedState": "UNINITIALISED", - "description": "PMSH automation composition instance 1", - "elements": { - "709c62b3-8918-41b9-a747-d21eb79c6c24": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c24", - "definition": { - "name": "org.onap.domain.pmsh.DCAEMicroservice", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "DCAE Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c25": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c25", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Monitoring Policy Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c26": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c26", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c27": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c27", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant", - "version": "2.2.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "CDS Automation Composition Element for the PMSH instance 1 automation composition" - } - } + "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition" } - ] -} + } +}
\ No newline at end of file diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionNotFound.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionNotFound.json new file mode 100644 index 000000000..a17ba399a --- /dev/null +++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionNotFound.json @@ -0,0 +1,66 @@ +{ + "name": "PMSHInstance0", + "version": "1.0.1", + "compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40", + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "PMSH automation composition instance 0", + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c20": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", + "version": "1.2.3" + }, + "participantType": { + "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant", + "version": "2.3.4" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c21": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement", + "version": "1.2.3" + }, + "participantType": { + "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c22": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", + "version": "1.2.3" + }, + "participantType": { + "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c23": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement", + "version": "1.2.3" + }, + "participantType": { + "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant", + "version": "2.2.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition" + } + } +}
\ No newline at end of file diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json new file mode 100644 index 000000000..0fe9671e2 --- /dev/null +++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json @@ -0,0 +1,64 @@ +{ + "name": "PMSHInstance0", + "version": "1.0.1", + "compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40", + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "PMSH automation composition instance 0", + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c20": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", + "definition": { + "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement", + "version": "1.2.3" + }, + "participantId": { + "name": "HttpParticipant0", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.policy.clamp.acm.HttpParticipant", + "version": "2.3.4" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Http Automation Composition Element for the PMSH instance 0 automation composition" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c22": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", + "version": "1.2.3" + }, + "participantId": { + "name": "org.onap.PM_Policy", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.policy.clamp.acm.PolicyParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c23": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", + "definition": { + "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement", + "version": "1.2.3" + }, + "participantId": { + "name": "K8sParticipant0t", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.policy.clamp.acm.KubernetesParticipant", + "version": "2.3.4" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "K8s Automation Composition Element for the PMSH instance 0 automation composition" + } + } +} diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json new file mode 100644 index 000000000..75dbed72a --- /dev/null +++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json @@ -0,0 +1,64 @@ +{ + "name": "PMSHInstance0", + "version": "1.0.1", + "compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40", + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "PMSH automation composition instance 0", + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c21": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", + "definition": { + "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement", + "version": "1.2.3" + }, + "participantId": { + "name": "K8sParticipant0", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.policy.clamp.acm.KubernetesParticipant", + "version": "2.3.4" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Automation composition element for the K8S microservice for PMSH" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c22": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", + "definition": { + "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement", + "version": "1.2.3" + }, + "participantId": { + "name": "HttpParticipant0", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.policy.clamp.acm.HttpParticipant", + "version": "2.3.4" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Automation composition element for the operational policy for Performance Management Subscription Handling" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c23": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", + "version": "1.2.3" + }, + "participantId": { + "name": "org.onap.PM_Policy", + "version": "1.0.0" + }, + "participantType": { + "name": "org.onap.policy.clamp.acm.PolicyParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition" + } + } +} diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionVersionNotMatches.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionVersionNotMatches.json deleted file mode 100644 index d29444a09..000000000 --- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionVersionNotMatches.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "automationCompositionList": [ - { - "name": "PMSHInstance0", - "version": "1.0.1", - "definition": { - "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition", - "version": "1.2.3" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "PMSH automation composition instance 0", - "elements": { - "709c62b3-8918-41b9-a747-d21eb79c6c20": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c21": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c22": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c23": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant", - "version": "2.2.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition" - } - } - }, - { - "name": "PMSHInstance1", - "version": "1.0.1", - "definition": { - "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition", - "version": "1.2.3" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "PMSH automation composition instance 1", - "elements": { - "709c62b3-8918-41b9-a747-d21eb79c6c24": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c24", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "DCAE Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c25": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c25", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Monitoring Policy Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c26": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c26", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c27": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c27", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant", - "version": "2.2.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "CDS Automation Composition Element for the PMSH instance 1 automation composition" - } - } - } - ] -} diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositions.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositions.json deleted file mode 100644 index 33ebd1706..000000000 --- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositions.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "automationCompositionList": [ - { - "name": "PMSHInstance0", - "version": "1.0.1", - "compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40", - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "PMSH automation composition instance 0", - "elements": { - "709c62b3-8918-41b9-a747-d21eb79c6c20": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", - "definition": { - "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "K8sParticipant0", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.KubernetesParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Automation composition element for the K8S microservice for PMSH" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c21": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", - "definition": { - "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "HttpParticipant0", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.HttpParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Automation composition element for the http requests of PMSH microservice" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c22": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "org.onap.PM_Policy", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.PolicyParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Automation composition element for the operational policy for Performance Management Subscription Handling" - } - } - }, - { - "name": "PMSHInstance1", - "version": "1.0.1", - "compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40", - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "PMSH automation composition instance 1", - "elements": { - "709c62b3-8918-41b9-a747-d21eb79c6c24": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c24", - "definition": { - "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "K8sParticipant0", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.KubernetesParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "DCAE Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c25": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c25", - "definition": { - "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "HttpParticipant0", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.HttpParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Monitoring Policy Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c26": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c26", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "org.onap.PM_Policy", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.PolicyParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition" - } - } - } - ] -} diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsNotFound.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsNotFound.json deleted file mode 100644 index 5a859fbca..000000000 --- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsNotFound.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "automationCompositionList": [ - { - "name": "PMSHInstance0", - "version": "1.0.1", - "definition": { - "name": "org.onap.domain.PMSHAutomationCompositionDefinition", - "version": "1.2.3" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "PMSH automation composition instance 0", - "elements": { - "709c62b3-8918-41b9-a747-d21eb79c6c20": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c21": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c22": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c23": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant", - "version": "2.2.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "CDS Automation Composition Element for the PMSH instance 0 automation composition" - } - } - }, - { - "name": "PMSHInstance1", - "version": "1.0.1", - "definition": { - "name": "org.onap.domain.PMSHAutomationCompositionDefinition", - "version": "1.2.3" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "PMSH automation composition instance 1", - "elements": { - "709c62b3-8918-41b9-a747-d21eb79c6c24": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c24", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "DCAE Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c25": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c25", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Monitoring Policy Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c26": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c26", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c27": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c27", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement", - "version": "1.2.3" - }, - "participantType": { - "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant", - "version": "2.2.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "CDS Automation Composition Element for the PMSH instance 1 automation composition" - } - } - } - ] -} diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsSmoke.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsSmoke.json deleted file mode 100644 index 60ea7959c..000000000 --- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsSmoke.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "automationCompositionList": [ - { - "name": "PMSHInstance0", - "version": "1.0.1", - "definition": { - "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition", - "version": "1.2.3" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "PMSH automation composition instance 0", - "elements": { - "709c62b3-8918-41b9-a747-d21eb79c6c20": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", - "definition": { - "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "HttpParticipant0", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.HttpParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Http Automation Composition Element for the PMSH instance 0 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c22": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "org.onap.PM_Policy", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.PolicyParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c23": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", - "definition": { - "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "K8sParticipant0t", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.KubernetesParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "K8s Automation Composition Element for the PMSH instance 0 automation composition" - } - } - }, - { - "name": "PMSHInstance1", - "version": "1.0.1", - "definition": { - "name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition", - "version": "1.2.3" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "PMSH automation composition instance 1", - "elements": { - "709c62b3-8918-41b9-a747-d21eb79c6c24": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c24", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", - "version": "1.2.3" - }, - "participantId": { - "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant", - "version": "2.3.4" - }, - "participantType": { - "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "DCAE Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c25": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c25", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "participantType": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Monitoring Policy Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c26": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c26", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "participantType": { - "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c27": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c27", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant", - "version": "2.2.1" - }, - "participantType": { - "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant", - "version": "2.2.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "CDS Automation Composition Element for the PMSH instance 1 automation composition" - } - } - } - ] -} diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsUpdate.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsUpdate.json deleted file mode 100644 index dc1f7056b..000000000 --- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionsUpdate.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "automationCompositionList": [ - { - "name": "PMSHInstance0", - "version": "1.0.1", - "compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40", - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "PMSH automation composition instance 1", - "elements": { - "709c62b3-8918-41b9-a747-d21eb79c6c21": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", - "definition": { - "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "K8sParticipant0", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.KubernetesParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c22": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", - "definition": { - "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "HttpParticipant0", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.HttpParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c23": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "org.onap.PM_Policy", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.PolicyParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition" - } - } - }, - { - "name": "PMSHInstance1", - "version": "1.0.1", - "compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40", - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "PMSH automation composition instance 1", - "elements": { - "709c62b3-8918-41b9-a747-d21eb79c6c25": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c25", - "definition": { - "name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "K8sParticipant0", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.KubernetesParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "DCAE Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c26": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c26", - "definition": { - "name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "HttpParticipant0", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.HttpParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Monitoring Policy Automation Composition Element for the PMSH instance 1 automation composition" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c27": { - "id": "709c62b3-8918-41b9-a747-e21eb79c6c27", - "definition": { - "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "org.onap.PM_Policy", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.PolicyParticipant", - "version": "2.3.1" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Operational Policy Automation Composition Element for the PMSH instance 1 automation composition" - } - } - } - ] -} diff --git a/runtime-acm/src/test/resources/rest/acm/PassiveCommand.json b/runtime-acm/src/test/resources/rest/acm/PassiveCommand.json index 5bb9eb336..93f131cd8 100644 --- a/runtime-acm/src/test/resources/rest/acm/PassiveCommand.json +++ b/runtime-acm/src/test/resources/rest/acm/PassiveCommand.json @@ -1,13 +1,7 @@ { "orderedState": "PASSIVE", - "automationCompositionIdentifierList": [ - { - "name": "PMSHInstance0", - "version": "1.0.1" - }, - { - "name": "PMSHInstance1", - "version": "1.0.1" - } - ] -} + "automationCompositionIdentifier": { + "name": "PMSHInstance0", + "version": "1.0.1" + } +}
\ No newline at end of file |