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-policy/src/test | |
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-policy/src/test')
-rw-r--r-- | participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantPolicyTest.java | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantPolicyTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantPolicyTest.java index d34a38103..6b8323971 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantPolicyTest.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantPolicyTest.java @@ -28,9 +28,9 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate; -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.clamp.controlloop.participant.policy.main.utils.TestListenerUtils; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.springframework.beans.factory.annotation.Autowired; @@ -49,7 +49,7 @@ class ParticipantPolicyTest { private static final String TOPIC = "my-topic"; @Autowired - private ParticipantIntermediaryApi participantIntermediaryApi; + private ParticipantHandler participantHandler; @Test void testUpdatePolicyTypes() { @@ -60,14 +60,12 @@ class ParticipantPolicyTest { assertNotNull(participantControlLoopUpdateMsg.getControlLoopDefinition().getPolicyTypes()); synchronized (lockit) { - ControlLoopUpdateListener clUpdateListener = - new ControlLoopUpdateListener(participantIntermediaryApi.getParticipantHandler()); + ControlLoopUpdateListener clUpdateListener = new ControlLoopUpdateListener(participantHandler); clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); } // Verify the result of GET participants with what is stored - assertEquals("org.onap.PM_Policy", - participantIntermediaryApi.getParticipantHandler().getParticipantId().getName()); + assertEquals("org.onap.PM_Policy", participantHandler.getParticipantId().getName()); } @Test @@ -83,14 +81,12 @@ class ParticipantPolicyTest { participantControlLoopUpdateMsg.getControlLoopDefinition().getToscaTopologyTemplate().getPolicies()); synchronized (lockit) { - ControlLoopUpdateListener clUpdateListener = - new ControlLoopUpdateListener(participantIntermediaryApi.getParticipantHandler()); + ControlLoopUpdateListener clUpdateListener = new ControlLoopUpdateListener(participantHandler); clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); } // Verify the result of GET participants with what is stored - assertEquals("org.onap.PM_Policy", - participantIntermediaryApi.getParticipantHandler().getParticipantId().getName()); + assertEquals("org.onap.PM_Policy", participantHandler.getParticipantId().getName()); } @Test @@ -106,24 +102,20 @@ class ParticipantPolicyTest { participantControlLoopUpdateMsg.getControlLoopDefinition().getToscaTopologyTemplate().getPolicies()); synchronized (lockit) { - ControlLoopUpdateListener clUpdateListener = - new ControlLoopUpdateListener(participantIntermediaryApi.getParticipantHandler()); + ControlLoopUpdateListener clUpdateListener = new ControlLoopUpdateListener(participantHandler); clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); } // Verify the result of GET participants with what is stored - assertEquals("org.onap.PM_Policy", - participantIntermediaryApi.getParticipantHandler().getParticipantId().getName()); + assertEquals("org.onap.PM_Policy", participantHandler.getParticipantId().getName()); - ControlLoopStateChangeListener clStateChangeListener = - new ControlLoopStateChangeListener(participantIntermediaryApi.getParticipantHandler()); + ControlLoopStateChangeListener clStateChangeListener = new ControlLoopStateChangeListener(participantHandler); ParticipantControlLoopStateChange participantControlLoopStateChangeMsg = TestListenerUtils.createControlLoopStateChangeMsg(ControlLoopOrderedState.UNINITIALISED); participantControlLoopStateChangeMsg.setOrderedState(ControlLoopOrderedState.UNINITIALISED); clStateChangeListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopStateChangeMsg); // Verify the result of GET participants with what is stored - assertEquals("org.onap.PM_Policy", - participantIntermediaryApi.getParticipantHandler().getParticipantId().getName()); + assertEquals("org.onap.PM_Policy", participantHandler.getParticipantId().getName()); } } |