diff options
Diffstat (limited to 'participant/participant-impl/participant-impl-dcae/src')
-rw-r--r-- | participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/ParticipantDcaeTest.java (renamed from participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/endtoend/PartecipantDcaeTest.java) | 46 | ||||
-rw-r--r-- | participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java | 26 |
2 files changed, 36 insertions, 36 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/ParticipantDcaeTest.java index 3f5e42542..603d81860 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/ParticipantDcaeTest.java @@ -32,8 +32,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockserver.integration.ClientAndServer; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate; 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.dcae.main.parameters.CommonTestData; import org.onap.policy.clamp.controlloop.participant.dcae.main.rest.TestListenerUtils; import org.onap.policy.clamp.controlloop.participant.intermediary.comm.ControlLoopStateChangeListener; @@ -50,7 +50,7 @@ import org.springframework.test.context.junit.jupiter.SpringExtension; @ExtendWith(SpringExtension.class) @SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT) @TestPropertySource(locations = {"classpath:application_test.properties"}) -class PartecipantDcaeTest { +class ParticipantDcaeTest { private static final CommInfrastructure INFRA = CommInfrastructure.NOOP; private static final String TOPIC = "my-topic"; @@ -124,53 +124,53 @@ class PartecipantDcaeTest { @Test void testControlLoopUpdateListener_ParticipantIdNoMatch() throws CoderException { - ParticipantControlLoopUpdate participantControlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg(); - participantControlLoopUpdateMsg.getParticipantId().setName("DummyName"); - participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.PASSIVE); + ControlLoopUpdate controlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg(); + controlLoopUpdateMsg.getParticipantId().setName("DummyName"); + controlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.PASSIVE); ControlLoopUpdateListener clUpdateListener = new ControlLoopUpdateListener(participantHandler); - clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); + clUpdateListener.onTopicEvent(INFRA, TOPIC, null, controlLoopUpdateMsg); // Verify the content in participantHandler - assertNotEquals(participantControlLoopUpdateMsg.getParticipantId().getName(), + assertNotEquals(controlLoopUpdateMsg.getParticipantId().getName(), participantHandler.getParticipantId().getName()); } @Test void testControlLoopUpdateListenerPassive() throws CoderException { - ParticipantControlLoopUpdate participantControlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg(); - participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.PASSIVE); + ControlLoopUpdate controlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg(); + controlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.PASSIVE); ControlLoopUpdateListener clUpdateListener = new ControlLoopUpdateListener(participantHandler); - clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); + clUpdateListener.onTopicEvent(INFRA, TOPIC, null, controlLoopUpdateMsg); // Verify the content in participantHandler - assertEquals(participantHandler.getParticipantId(), participantControlLoopUpdateMsg.getParticipantId()); + assertEquals(participantHandler.getParticipantId(), controlLoopUpdateMsg.getParticipantId()); assertEquals(1, participantHandler.getControlLoopHandler().getControlLoops().getControlLoopList().size()); } @Test void testControlLoopUpdateListenerUninitialised() throws CoderException { - ParticipantControlLoopUpdate participantControlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg(); - participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.UNINITIALISED); + ControlLoopUpdate controlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg(); + controlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.UNINITIALISED); ControlLoopUpdateListener clUpdateListener = new ControlLoopUpdateListener(participantHandler); - clUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantControlLoopUpdateMsg); + clUpdateListener.onTopicEvent(INFRA, TOPIC, null, controlLoopUpdateMsg); // Verify the content in participantHandler - assertEquals(participantHandler.getParticipantId(), participantControlLoopUpdateMsg.getParticipantId()); + assertEquals(participantHandler.getParticipantId(), controlLoopUpdateMsg.getParticipantId()); assertEquals(1, participantHandler.getControlLoopHandler().getControlLoops().getControlLoopList().size()); } @Test void testControlLoopUpdateListenerString() throws CoderException { - ParticipantControlLoopUpdate participantControlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg(); - participantControlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.UNINITIALISED); - - assertThat(participantControlLoopUpdateMsg.toString()).contains("state=UNINITIALISED"); - ParticipantControlLoopUpdate copyParticipantControlLoopUpdateMsg = - TestListenerUtils.createCopyControlLoopUpdateMsg(participantControlLoopUpdateMsg); - assertThat(copyParticipantControlLoopUpdateMsg.toString()).contains("state=UNINITIALISED"); - assertNotEquals(participantControlLoopUpdateMsg, copyParticipantControlLoopUpdateMsg); + ControlLoopUpdate controlLoopUpdateMsg = TestListenerUtils.createControlLoopUpdateMsg(); + controlLoopUpdateMsg.getControlLoop().setOrderedState(ControlLoopOrderedState.UNINITIALISED); + + assertThat(controlLoopUpdateMsg.toString()).contains("state=UNINITIALISED"); + ControlLoopUpdate copyControlLoopUpdateMsg = + TestListenerUtils.createCopyControlLoopUpdateMsg(controlLoopUpdateMsg); + assertThat(copyControlLoopUpdateMsg.toString()).contains("state=UNINITIALISED"); + assertNotEquals(controlLoopUpdateMsg, copyControlLoopUpdateMsg); } } diff --git a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java index 4579b52bf..7f8eb0937 100644 --- a/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java +++ b/participant/participant-impl/participant-impl-dcae/src/test/java/org/onap/policy/clamp/controlloop/participant/dcae/main/rest/TestListenerUtils.java @@ -30,8 +30,8 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState; import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate; 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.models.messages.dmaap.participant.ParticipantHealthCheck; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantStateChange; import org.onap.policy.common.utils.coder.Coder; @@ -137,10 +137,10 @@ public class TestListenerUtils { /** * Method to create ControlLoopUpdateMsg. * - * @return ParticipantControlLoopUpdate message + * @return ControlLoopUpdate message */ - public static ParticipantControlLoopUpdate createControlLoopUpdateMsg() { - final ParticipantControlLoopUpdate clUpdateMsg = new ParticipantControlLoopUpdate(); + public static ControlLoopUpdate createControlLoopUpdateMsg() { + final ControlLoopUpdate clUpdateMsg = new ControlLoopUpdate(); ToscaConceptIdentifier controlLoopId = new ToscaConceptIdentifier(); controlLoopId.setName("PMSHInstance0"); controlLoopId.setVersion("1.0.0"); @@ -185,10 +185,10 @@ public class TestListenerUtils { /** * Method to create a deep copy of ControlLoopUpdateMsg. * - * @return ParticipantControlLoopUpdate message + * @return ControlLoopUpdate message */ - public static ParticipantControlLoopUpdate createCopyControlLoopUpdateMsg(ParticipantControlLoopUpdate cpy) { - return new ParticipantControlLoopUpdate(cpy); + public static ControlLoopUpdate createCopyControlLoopUpdateMsg(ControlLoopUpdate cpy) { + return new ControlLoopUpdate(cpy); } /** @@ -215,18 +215,18 @@ public class TestListenerUtils { } /** - * Method to create ParticipantControlLoopUpdate using the arguments passed. + * Method to create ControlLoopUpdate using the arguments passed. * * @param jsonFilePath the path of the controlloop content * - * @return ParticipantControlLoopUpdate message + * @return ControlLoopUpdate message * @throws CoderException exception while reading the file to object */ - public static ParticipantControlLoopUpdate createParticipantClUpdateMsgFromJson(String jsonFilePath) + public static ControlLoopUpdate createParticipantClUpdateMsgFromJson(String jsonFilePath) throws CoderException { - ParticipantControlLoopUpdate participantControlLoopUpdateMsg = - CODER.decode(new File(jsonFilePath), ParticipantControlLoopUpdate.class); - return participantControlLoopUpdateMsg; + ControlLoopUpdate controlLoopUpdateMsg = + CODER.decode(new File(jsonFilePath), ControlLoopUpdate.class); + return controlLoopUpdateMsg; } private static ToscaServiceTemplate testControlLoopRead() { |