diff options
author | saul.gill <saul.gill@est.tech> | 2023-01-23 17:44:13 +0000 |
---|---|---|
committer | saul.gill <saul.gill@est.tech> | 2023-01-26 09:27:28 +0000 |
commit | 73d0c089fe3e3019e8caa54a60a4c76de5edd72a (patch) | |
tree | 3197ed2af3da4a57abf8226c1cf21e6500a42444 /runtime-acm/src/test/java/org | |
parent | db615d9fed370c7896a638704d00807c19b6f5d3 (diff) |
Remove participantType and references
Issue-ID: POLICY-4538
Change-Id: Idf3f0308254a318b3e72aa8a234fd7c78f6ffd82
Signed-off-by: saul.gill <saul.gill@est.tech>
Diffstat (limited to 'runtime-acm/src/test/java/org')
5 files changed, 12 insertions, 36 deletions
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 10332117c..aa8905917 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 @@ -53,13 +53,10 @@ 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.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/AutomationComposition.json"; private static final UUID IDENTIFIER = UUID.randomUUID(); - private static final ToscaConceptIdentifier PARTICIPANT_TYPE = - new ToscaConceptIdentifier("ParticipantType", "1.0.0"); @Test void testTriggerAutomationCompositionSupervision() throws AutomationCompositionException { @@ -235,7 +232,6 @@ class SupervisionHandlerTest { var automationCompositionAckMessage = new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK); automationCompositionAckMessage.setParticipantId(CommonTestData.getParticipantId()); - automationCompositionAckMessage.setParticipantType(PARTICIPANT_TYPE); automationCompositionAckMessage.setAutomationCompositionResultMap(Map.of()); automationCompositionAckMessage.setAutomationCompositionId(IDENTIFIER); var automationCompositionProvider = mock(AutomationCompositionProvider.class); @@ -253,7 +249,6 @@ class SupervisionHandlerTest { void testParticipantUpdateAck() { var participantUpdateAckMessage = new ParticipantUpdateAck(); participantUpdateAckMessage.setParticipantId(CommonTestData.getParticipantId()); - participantUpdateAckMessage.setParticipantType(PARTICIPANT_TYPE); participantUpdateAckMessage.setState(ParticipantState.ON_LINE); var handler = createSupervisionHandler(mock(AutomationCompositionProvider.class), mock(AutomationCompositionUpdatePublisher.class), mock(AutomationCompositionStateChangePublisher.class), diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java index 9463d7977..b53a17ece 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java @@ -40,12 +40,11 @@ import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; class SupervisionParticipantHandlerTest { - private static final ToscaConceptIdentifier PARTICIPANT_TYPE = - new ToscaConceptIdentifier("ParticipantType", "1.0.0"); + private static final ToscaConceptIdentifier PARTICIPANT_ID = new ToscaConceptIdentifier("ParticipantId", "1.0.0"); @Test void testHandleParticipantDeregister() { - var participant = CommonTestData.createParticipant(PARTICIPANT_TYPE, CommonTestData.getParticipantId()); + var participant = CommonTestData.createParticipant(CommonTestData.getParticipantId()); var participantProvider = mock(ParticipantProvider.class); when(participantProvider.findParticipant(CommonTestData.getParticipantId())) @@ -54,7 +53,6 @@ class SupervisionParticipantHandlerTest { var participantDeregisterMessage = new ParticipantDeregister(); participantDeregisterMessage.setMessageId(UUID.randomUUID()); participantDeregisterMessage.setParticipantId(CommonTestData.getParticipantId()); - participantDeregisterMessage.setParticipantType(PARTICIPANT_TYPE); var participantDeregisterAckPublisher = mock(ParticipantDeregisterAckPublisher.class); var handler = new SupervisionParticipantHandler(participantProvider, mock(ParticipantRegisterAckPublisher.class), participantDeregisterAckPublisher); @@ -70,7 +68,6 @@ class SupervisionParticipantHandlerTest { var participantRegisterMessage = new ParticipantRegister(); participantRegisterMessage.setMessageId(UUID.randomUUID()); participantRegisterMessage.setParticipantId(CommonTestData.getParticipantId()); - participantRegisterMessage.setParticipantType(PARTICIPANT_TYPE); var participantProvider = mock(ParticipantProvider.class); var participantRegisterAckPublisher = mock(ParticipantRegisterAckPublisher.class); var handler = new SupervisionParticipantHandler(participantProvider, participantRegisterAckPublisher, @@ -81,21 +78,20 @@ class SupervisionParticipantHandlerTest { verify(participantProvider).saveParticipant(any()); verify(participantRegisterAckPublisher).send(participantRegisterMessage.getMessageId(), - CommonTestData.getParticipantId(), PARTICIPANT_TYPE); + CommonTestData.getParticipantId()); } @Test void testHandleParticipantStatus() { var participantStatusMessage = new ParticipantStatus(); participantStatusMessage.setParticipantId(CommonTestData.getParticipantId()); - participantStatusMessage.setParticipantType(PARTICIPANT_TYPE); participantStatusMessage.setState(ParticipantState.ON_LINE); participantStatusMessage.setParticipantSupportedElementType(new ArrayList<>()); var participantProvider = mock(ParticipantProvider.class); var handler = new SupervisionParticipantHandler(participantProvider, mock(ParticipantRegisterAckPublisher.class), mock(ParticipantDeregisterAckPublisher.class)); - var participant = CommonTestData.createParticipant(PARTICIPANT_TYPE, CommonTestData.getParticipantId()); + var participant = CommonTestData.createParticipant(CommonTestData.getParticipantId()); when(participantProvider.findParticipant(CommonTestData.getParticipantId())) .thenReturn(Optional.of(participant)); handler.handleParticipantMessage(participantStatusMessage); 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 683dd539a..936555aa3 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 @@ -119,7 +119,7 @@ class SupervisionScannerTest { .thenReturn(List.of(automationComposition)); var participantProvider = mock(ParticipantProvider.class); - var participant = CommonTestData.createParticipant(PARTICIPANT_TYPE, CommonTestData.getParticipantId()); + var participant = CommonTestData.createParticipant(CommonTestData.getParticipantId()); when(participantProvider.getParticipants()).thenReturn(List.of(participant)); var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class); @@ -180,7 +180,7 @@ class SupervisionScannerTest { acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().setMaxWaitMs(-1); acRuntimeParameterGroup.getParticipantParameters().setMaxStatusWaitMs(-1); - var participant = CommonTestData.createParticipant(PARTICIPANT_TYPE, CommonTestData.getParticipantId()); + var participant = CommonTestData.createParticipant(CommonTestData.getParticipantId()); participant.setParticipantState(ParticipantState.OFF_LINE); var participantProvider = mock(ParticipantProvider.class); when(participantProvider.getParticipants()).thenReturn(List.of(participant)); diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java index d9c4ed67f..5ea3bea2c 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java @@ -49,7 +49,6 @@ 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.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; class SupervisionMessagesTest { @@ -170,14 +169,10 @@ class SupervisionMessagesTest { var publisher = new ParticipantRegisterAckPublisher(); var topicSink = mock(TopicSink.class); publisher.active(List.of(topicSink)); - publisher.send(UUID.randomUUID(), CommonTestData.getParticipantId(), getParticipantType()); + publisher.send(UUID.randomUUID(), CommonTestData.getParticipantId()); verify(topicSink).send(anyString()); } - private ToscaConceptIdentifier getParticipantType() { - return new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "2.3.1"); - } - @Test void testParticipantDeregisterAckPublisher() { var publisher = new ParticipantDeregisterAckPublisher(); diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java index 7d80228db..b99140914 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation. + * Copyright (C) 2021-2023 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,6 @@ import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.ResourceUtils; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Class to hold/create all parameters for test cases. @@ -75,30 +74,21 @@ public class CommonTestData { * @return a List of Participants */ public static List<Participant> createParticipants() { - var participant1 = createParticipant( - new ToscaConceptIdentifier("org.onap.policy.clamp.acm.KubernetesParticipant", "2.3.4"), - UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c02")); - var participant2 = createParticipant( - new ToscaConceptIdentifier("org.onap.policy.clamp.acm.HttpParticipant", "2.3.4"), - UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c01")); - var participant3 = createParticipant( - new ToscaConceptIdentifier("org.onap.policy.clamp.acm.PolicyParticipant", "2.3.1"), - UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c03")); + var participant1 = createParticipant(UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c02")); + var participant2 = createParticipant(UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c01")); + var participant3 = createParticipant(UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c03")); return List.of(participant1, participant2, participant3); } /** * Create a new Participant. * - * @param participantType the participant Type * @param participantId the participant id * @return a new Participant */ - public static Participant createParticipant(ToscaConceptIdentifier participantType, - UUID participantId) { + public static Participant createParticipant(UUID participantId) { var participant = new Participant(); participant.setParticipantId(participantId); - participant.setParticipantType(participantType); return participant; } |