diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2022-12-13 13:57:47 +0000 |
---|---|---|
committer | Francesco Fiora <francesco.fiora@est.tech> | 2022-12-13 16:45:51 +0000 |
commit | a01c89adfa3a6fe0918d77282759295a7f0514e5 (patch) | |
tree | f5885152f94b408e3b3634ab600471e035d72da0 /participant/participant-impl/participant-impl-kubernetes/src/test/java | |
parent | 04ffb73ae3fcd3c666030d5c867febd88ef6537c (diff) |
Replace ToscaConceptIdentifier with UUID in Participant Messages ACM
Replace in all messages the reference to Automation Composition
ToscaConceptIdentifier(name, version) with instanceId(UUID).
Issue-ID: POLICY-4479
Change-Id: I7bc9a7494103b9c1752a1e2c6f6d5a527196913d
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-kubernetes/src/test/java')
2 files changed, 15 insertions, 16 deletions
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java index fbd18ef67..f1357e435 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java @@ -32,7 +32,6 @@ import static org.mockito.Mockito.doThrow; import java.io.File; import java.io.IOException; import java.util.List; -import java.util.Map; import java.util.UUID; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; @@ -59,7 +58,6 @@ import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.models.base.PfModelException; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.springframework.test.context.junit.jupiter.SpringExtension; @@ -100,8 +98,8 @@ class AutomationCompositionElementHandlerTest { @Test void test_AutomationCompositionElementStateChange() throws ServiceException { - UUID automationCompositionElementId1 = UUID.randomUUID(); - UUID automationCompositionElementId2 = UUID.randomUUID(); + var automationCompositionElementId1 = UUID.randomUUID(); + var automationCompositionElementId2 = UUID.randomUUID(); automationCompositionElementHandler.getChartMap().put(automationCompositionElementId1, charts.get(0)); automationCompositionElementHandler.getChartMap().put(automationCompositionElementId2, charts.get(1)); @@ -133,27 +131,27 @@ class AutomationCompositionElementHandlerTest { ExecutionException, InterruptedException { doReturn(true).when(chartService).installChart(any()); doNothing().when(automationCompositionElementHandler).checkPodStatus(any(), any(), any(), anyInt(), anyInt()); - UUID elementId1 = UUID.randomUUID(); - AutomationCompositionElement element = new AutomationCompositionElement(); + var elementId1 = UUID.randomUUID(); + var element = new AutomationCompositionElement(); element.setId(elementId1); element.setDefinition(new ToscaConceptIdentifier(KEY_NAME, "1.0.1")); element.setOrderedState(AutomationCompositionOrderedState.PASSIVE); - Map<String, ToscaNodeTemplate> nodeTemplatesMap = + var nodeTemplatesMap = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates(); automationCompositionElementHandler.automationCompositionElementUpdate( commonTestData.getAutomationCompositionId(), element, - nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT)); + nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT).getProperties()); assertThat(automationCompositionElementHandler.getChartMap()).hasSize(1).containsKey(elementId1); doThrow(new ServiceException("Error installing the chart")).when(chartService).installChart(Mockito.any()); - UUID elementId2 = UUID.randomUUID(); + var elementId2 = UUID.randomUUID(); element.setId(elementId2); automationCompositionElementHandler.automationCompositionElementUpdate( commonTestData.getAutomationCompositionId(), element, - nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT)); + nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT).getProperties()); assertThat(automationCompositionElementHandler.getChartMap().containsKey(elementId2)).isFalse(); } @@ -164,8 +162,8 @@ class AutomationCompositionElementHandlerTest { doReturn("Done").when(result).get(); doReturn(true).when(result).isDone(); var chartInfo = charts.get(0); - ToscaConceptIdentifier automationCompositionId = new ToscaConceptIdentifier(); - AutomationCompositionElement element = new AutomationCompositionElement(); + var automationCompositionId = UUID.randomUUID(); + var element = new AutomationCompositionElement(); assertDoesNotThrow( () -> automationCompositionElementHandler.checkPodStatus(automationCompositionId, element.getId(), chartInfo, 1, 1)); diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java index 7ffd68812..97d2fbbd2 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java @@ -24,6 +24,7 @@ package org.onap.policy.clamp.acm.participant.kubernetes.parameters; import java.util.List; import java.util.Map; import java.util.TreeMap; +import java.util.UUID; import org.onap.policy.common.endpoints.parameters.TopicParameters; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; @@ -37,7 +38,7 @@ public class CommonTestData { public static final long TIME_INTERVAL = 2000; public static final List<TopicParameters> TOPIC_PARAMS = List.of(getTopicParams()); public static final Coder CODER = new StandardCoder(); - + private static final UUID AC_ID = UUID.randomUUID(); /** * Get ParticipantK8sParameters. @@ -152,9 +153,9 @@ public class CommonTestData { /** * Get automation composition id. - * @return ToscaConceptIdentifier automationCompositionId + * @return UUID automationCompositionId */ - public ToscaConceptIdentifier getAutomationCompositionId() { - return new ToscaConceptIdentifier("PMSHInstance0", "1.0.0"); + public UUID getAutomationCompositionId() { + return AC_ID; } } |