From 9659c99c9c8b4b7ce33d7f48e61df44a03090186 Mon Sep 17 00:00:00 2001 From: "saul.gill" Date: Thu, 2 Feb 2023 11:40:29 +0000 Subject: Refactor ParticipantUpdate to ParticipantPrime Refactored ParticipantUpdateAck to ParticipantPrimeAck Refactored ParticipantUpdate to ParticipantPrime Refactored all associated tests and code Issue-ID: POLICY-4548 Change-Id: I2265777add4e088173ec465603e26143e3f40070 Signed-off-by: saul.gill --- .../policy/endtoend/ParticipantMessagesTest.java | 24 +++++++++++----------- .../policy/main/utils/TestListenerUtils.java | 20 +++++++++--------- 2 files changed, 22 insertions(+), 22 deletions(-) (limited to 'participant/participant-impl/participant-impl-policy') diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java index 555183227..5ba598cc8 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java @@ -32,18 +32,18 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantDeregisterAckListener; import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher; +import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantPrimeListener; import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantRegisterAckListener; -import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantUpdateListener; import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler; import org.onap.policy.clamp.acm.participant.policy.main.parameters.CommonTestData; import org.onap.policy.clamp.acm.participant.policy.main.utils.TestListenerUtils; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrime; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrimeAck; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.springframework.beans.factory.annotation.Autowired; @@ -126,11 +126,11 @@ class ParticipantMessagesTest { @Test void testReceiveParticipantUpdateMessage() { - ParticipantUpdate participantUpdateMsg = TestListenerUtils.createParticipantUpdateMsg(); + ParticipantPrime participantPrimeMsg = TestListenerUtils.createParticipantPrimeMsg(); synchronized (lockit) { - ParticipantUpdateListener participantUpdateListener = new ParticipantUpdateListener(participantHandler); - participantUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantUpdateMsg); + ParticipantPrimeListener participantPrimeListener = new ParticipantPrimeListener(participantHandler); + participantPrimeListener.onTopicEvent(INFRA, TOPIC, null, participantPrimeMsg); } // Verify the result of GET participants with what is stored @@ -138,16 +138,16 @@ class ParticipantMessagesTest { } @Test - void testSendParticipantUpdateAckMessage() { - final ParticipantUpdateAck participantUpdateAckMsg = new ParticipantUpdateAck(); - participantUpdateAckMsg.setMessage("ParticipantUpdateAck message"); - participantUpdateAckMsg.setResponseTo(UUID.randomUUID()); - participantUpdateAckMsg.setResult(true); + void testSendParticipantPrimeAckMessage() { + final ParticipantPrimeAck participantPrimeAckMsg = new ParticipantPrimeAck(); + participantPrimeAckMsg.setMessage("ParticipantPrimeAck message"); + participantPrimeAckMsg.setResponseTo(UUID.randomUUID()); + participantPrimeAckMsg.setResult(true); synchronized (lockit) { ParticipantMessagePublisher participantMessagePublisher = new ParticipantMessagePublisher(); participantMessagePublisher.active(Collections.singletonList(Mockito.mock(TopicSink.class))); - assertThatCode(() -> participantMessagePublisher.sendParticipantUpdateAck(participantUpdateAckMsg)) + assertThatCode(() -> participantMessagePublisher.sendParticipantPrimeAck(participantPrimeAckMsg)) .doesNotThrowAnyException(); } } diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java index b7058a84f..17d961880 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java @@ -29,7 +29,7 @@ import java.util.UUID; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.onap.policy.clamp.acm.participant.policy.main.parameters.CommonTestData; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate; +import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrime; import org.onap.policy.common.utils.coder.YamlJsonTranslator; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; @@ -45,23 +45,23 @@ public final class TestListenerUtils { /** * Method to create participantUpdateMsg. * - * @return ParticipantUpdate message + * @return ParticipantPrime message */ - public static ParticipantUpdate createParticipantUpdateMsg() { - final var participantUpdateMsg = new ParticipantUpdate(); + public static ParticipantPrime createParticipantPrimeMsg() { + final var participantPrimeMsg = new ParticipantPrime(); var participantId = CommonTestData.getParticipantId(); - participantUpdateMsg.setParticipantId(participantId); - participantUpdateMsg.setTimestamp(Instant.now()); - participantUpdateMsg.setTimestamp(Instant.ofEpochMilli(3000)); - participantUpdateMsg.setMessageId(UUID.randomUUID()); + participantPrimeMsg.setParticipantId(participantId); + participantPrimeMsg.setTimestamp(Instant.now()); + participantPrimeMsg.setTimestamp(Instant.ofEpochMilli(3000)); + participantPrimeMsg.setMessageId(UUID.randomUUID()); var toscaServiceTemplate = testAutomationCompositionRead(); // Add policies to the toscaServiceTemplate TestListenerUtils.addPoliciesToToscaServiceTemplate(toscaServiceTemplate); - participantUpdateMsg.setParticipantDefinitionUpdates(new ArrayList<>()); - return participantUpdateMsg; + participantPrimeMsg.setParticipantDefinitionUpdates(new ArrayList<>()); + return participantPrimeMsg; } private static ToscaServiceTemplate testAutomationCompositionRead() { -- cgit 1.2.3-korg