diff options
author | Liam Fallon <liam.fallon@est.tech> | 2021-08-26 08:21:49 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-08-26 08:21:49 +0000 |
commit | 281a36c50d68f29e0e47dfec10ee8be38f5e5761 (patch) | |
tree | 1ad3f98fd4c9a74b601577e463210e73eaa4f4f2 /participant/participant-impl/participant-impl-policy/src | |
parent | db82b84e140e78e5f4145ed6d73fe089134dd173 (diff) | |
parent | 3971c419e094cb149c3e01781343d6265af64db6 (diff) |
Merge "Updated handling of ack messages"
Diffstat (limited to 'participant/participant-impl/participant-impl-policy/src')
3 files changed, 10 insertions, 20 deletions
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java index 0e19ea33e..b17ae4311 100644 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/controlloop/participant/policy/main/handler/ControlLoopElementHandler.java @@ -32,6 +32,7 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ClElementSt import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElement; 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.messages.dmaap.participant.ParticipantMessageType; import org.onap.policy.clamp.controlloop.participant.intermediary.api.ControlLoopElementListener; import org.onap.policy.clamp.controlloop.participant.intermediary.api.ParticipantIntermediaryApi; import org.onap.policy.clamp.controlloop.participant.policy.client.PolicyApiHttpClient; @@ -89,10 +90,12 @@ public class ControlLoopElementHandler implements ControlLoopElementListener { } break; case PASSIVE: - intermediaryApi.updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.PASSIVE); + intermediaryApi.updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.PASSIVE, + ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE); break; case RUNNING: - intermediaryApi.updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.RUNNING); + intermediaryApi.updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.RUNNING, + ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE); break; default: LOGGER.debug("Unknown orderedstate {}", newState); @@ -111,7 +114,8 @@ public class ControlLoopElementHandler implements ControlLoopElementListener { apiHttpClient.deletePolicyType(policyType.getKey(), policyType.getValue()); } policyTypeMap.clear(); - intermediaryApi.updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.UNINITIALISED); + intermediaryApi.updateControlLoopElementState(controlLoopElementId, newState, ControlLoopState.UNINITIALISED, + ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE); } /** @@ -125,7 +129,7 @@ public class ControlLoopElementHandler implements ControlLoopElementListener { public void controlLoopElementUpdate(ControlLoopElement element, ToscaNodeTemplate clElementDefinition) throws PfModelException { intermediaryApi.updateControlLoopElementState(element.getId(), element.getOrderedState(), - ControlLoopState.PASSIVE); + ControlLoopState.PASSIVE, ParticipantMessageType.CONTROL_LOOP_UPDATE); ToscaServiceTemplate controlLoopDefinition = intermediaryApi.getToscaServiceTemplate(); if (controlLoopDefinition.getToscaTopologyTemplate() != null) { if (controlLoopDefinition.getPolicyTypes() != null) { diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java index df9a4b259..699df25e8 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java @@ -161,21 +161,7 @@ class ParticipantMessagesTest { @Test void testParticipantStatusHeartbeat() throws Exception { - final ParticipantStatus heartbeat = new ParticipantStatus(); - heartbeat.setParticipantId(getParticipantId()); - ControlLoopInfo clInfo = getControlLoopInfo(getControlLoopId()); - clInfo.setControlLoopId(getControlLoopId()); - heartbeat.setControlLoopInfoList(List.of(clInfo)); - - ControlLoopElementDefinition clDefinition = getClElementDefinition(); - List<ControlLoopElementDefinition> controlLoopElementDefinitionList = - List.of(clDefinition); - ParticipantDefinition participantDefinition = new ParticipantDefinition(); - participantDefinition.setParticipantId(getParticipantId()); - participantDefinition.setControlLoopElementDefinitionList(controlLoopElementDefinitionList); - List<ParticipantDefinition> participantDefinitionUpdates = List.of(participantDefinition); - heartbeat.setParticipantDefinitionUpdates(participantDefinitionUpdates); - + final ParticipantStatus heartbeat = participantHandler.makeHeartbeat(true); synchronized (lockit) { ParticipantMessagePublisher publisher = new ParticipantMessagePublisher(Collections.singletonList(Mockito.mock(TopicSink.class))); diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java index 5984cf149..4c87e0875 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java @@ -59,7 +59,7 @@ public class TestListenerUtils { private static final Coder CODER = new StandardCoder(); static CommonTestData commonTestData = new CommonTestData(); private static final Logger LOGGER = LoggerFactory.getLogger(TestListenerUtils.class); - private static final String CONTROL_LOOP_ELEMENT = "ControlLoopElement"; + private static final String CONTROL_LOOP_ELEMENT = "org.onap.policy.clamp.controlloop.ControlLoopElement"; private TestListenerUtils() {} |