diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2021-06-21 16:45:27 +0100 |
---|---|---|
committer | FrancescoFioraEst <francesco.fiora@est.tech> | 2021-06-28 10:36:54 +0100 |
commit | 7f7f0c5790dc63e43a59c53154e796239ab34cbb (patch) | |
tree | 39a8682b04502e99bc8575ec636613de193ade03 /participant/participant-impl/participant-impl-dcae/src/test/java | |
parent | 077406d881b8b03456f76d246a4db44d13780999 (diff) |
Convert Intermediary Participant to Spring and refactor Participants
Issue-ID: POLICY-3370
Change-Id: I1541fc47b35c91f9ec86ab768bc3cec2cd78647c
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-impl/participant-impl-dcae/src/test/java')
-rw-r--r-- | participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/PartecipantDcaeTest.java | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/PartecipantDcaeTest.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/PartecipantDcaeTest.java index 46317729a..a96581e6c 100644 --- a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/PartecipantDcaeTest.java +++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/PartecipantDcaeTest.java @@ -35,9 +35,9 @@ import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.Parti import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate; import org.onap.policy.clamp.controlloop.participant.dcae.main.parameters.CommonTestData; import org.onap.policy.clamp.controlloop.participant.dcae.main.rest.TestListenerUtils; -import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi; import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopStateChangeListener; import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopUpdateListener; +import org.onap.policy.clamp.controlloop.participant.intermediary.handler.ParticipantHandler; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.utils.coder.CoderException; import org.springframework.beans.factory.annotation.Autowired; @@ -61,7 +61,7 @@ class PartecipantDcaeTest { private static ClientAndServer mockConsulServer; @Autowired - private ParticipantIntermediaryApi participantIntermediaryApi; + private ParticipantHandler participantHandler; /** * start Servers. @@ -107,8 +107,7 @@ class PartecipantDcaeTest { TestListenerUtils.createControlLoopStateChangeMsg(ControlLoopOrderedState.UNINITIALISED); participantControlLoopStateChangeMsg.setOrderedState(ControlLoopOrderedState.PASSIVE); - ControlLoopStateChangeListener clStateChangeListener = - new ControlLoopStateChangeListener(participantIntermediaryApi.getParticipantHandler()); + ControlLoopStateChangeListener clStateChangeListener = new ControlLoopStateChangeListener(participantHandler); clStateChangeListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopStateChangeMsg); assertEquals(ControlLoopOrderedState.PASSIVE, participantControlLoopStateChangeMsg.getOrderedState()); @@ -128,13 +127,12 @@ class PartecipantDcaeTest { participantControlLoopUpdateMsg.getParticipantId().setName("DummyName"); participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.PASSIVE); - ControlLoopUpdateListener clUpdateListener = - new ControlLoopUpdateListener(participantIntermediaryApi.getParticipantHandler()); + ControlLoopUpdateListener clUpdateListener = new ControlLoopUpdateListener(participantHandler); clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); // Verify the content in participantHandler assertNotEquals(participantControlLoopUpdateMsg.getParticipantId().getName(), - participantIntermediaryApi.getParticipantHandler().getParticipantId().getName()); + participantHandler.getParticipantId().getName()); } @Test @@ -142,15 +140,12 @@ class PartecipantDcaeTest { ParticipantControlLoopUpdate participantControlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg(); participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.PASSIVE); - ControlLoopUpdateListener clUpdateListener = - new ControlLoopUpdateListener(participantIntermediaryApi.getParticipantHandler()); + ControlLoopUpdateListener clUpdateListener = new ControlLoopUpdateListener(participantHandler); clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); // Verify the content in participantHandler - assertEquals(participantIntermediaryApi.getParticipantHandler().getParticipantId(), - participantControlLoopUpdateMsg.getParticipantId()); - assertEquals(1, participantIntermediaryApi.getParticipantHandler().getControlLoopHandler().getControlLoops() - .getControlLoopList().size()); + assertEquals(participantHandler.getParticipantId(), participantControlLoopUpdateMsg.getParticipantId()); + assertEquals(1, participantHandler.getControlLoopHandler().getControlLoops().getControlLoopList().size()); } @Test @@ -158,14 +153,11 @@ class PartecipantDcaeTest { ParticipantControlLoopUpdate participantControlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg(); participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.UNINITIALISED); - ControlLoopUpdateListener clUpdateListener = - new ControlLoopUpdateListener(participantIntermediaryApi.getParticipantHandler()); + ControlLoopUpdateListener clUpdateListener = new ControlLoopUpdateListener(participantHandler); clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); // Verify the content in participantHandler - assertEquals(participantIntermediaryApi.getParticipantHandler().getParticipantId(), - participantControlLoopUpdateMsg.getParticipantId()); - assertEquals(1, participantIntermediaryApi.getParticipantHandler().getControlLoopHandler().getControlLoops() - .getControlLoopList().size()); + assertEquals(participantHandler.getParticipantId(), participantControlLoopUpdateMsg.getParticipantId()); + assertEquals(1, participantHandler.getControlLoopHandler().getControlLoops().getControlLoopList().size()); } } |