diff options
author | Jorge Hernandez <jorge.hernandez-herrero@att.com> | 2021-08-12 15:33:10 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-08-12 15:33:10 +0000 |
commit | a37bd982693785af5fc791df0baaa49dda039846 (patch) | |
tree | 3f230384fdce5ee3148b20bd8e794832a78d9073 /runtime-controlloop/src/main/java | |
parent | 9796dd1e99aea6768a8ed9bf11557db0c2a9c210 (diff) | |
parent | 20e2a1787c703a7957728e0c9a190a556b0ae536 (diff) |
Merge "Fix serialization of messages in Control Loop and Participants"
Diffstat (limited to 'runtime-controlloop/src/main/java')
2 files changed, 15 insertions, 13 deletions
diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java index 476407f66..9180cedb3 100644 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java +++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java @@ -311,17 +311,20 @@ public class SupervisionHandler { private void superviseControlLoops(ParticipantStatus participantStatusMessage) throws PfModelException, ControlLoopException { - for (Map.Entry<ToscaConceptIdentifier, ControlLoopInfo> clEntry : - participantStatusMessage.getControlLoopInfoMap().entrySet()) { - var dbControlLoop = controlLoopProvider.getControlLoop(new ToscaConceptIdentifier( - clEntry.getKey().getName(), clEntry.getKey().getVersion())); - if (dbControlLoop == null) { - exceptionOccured(Response.Status.NOT_FOUND, - "PARTICIPANT_STATUS control loop not found in database: " + clEntry.getKey()); + if (participantStatusMessage.getControlLoopInfoMap() != null) { + for (Map.Entry<String, ControlLoopInfo> clEntry : participantStatusMessage.getControlLoopInfoMap() + .entrySet()) { + String[] key = clEntry.getKey().split(" "); + var dbControlLoop = controlLoopProvider.getControlLoop( + new ToscaConceptIdentifier(key[0], key[1])); + if (dbControlLoop == null) { + exceptionOccured(Response.Status.NOT_FOUND, + "PARTICIPANT_STATUS control loop not found in database: " + clEntry.getKey()); + } + dbControlLoop.setState(clEntry.getValue().getState()); + monitoringProvider.createClElementStatistics(clEntry.getValue().getControlLoopStatistics() + .getClElementStatisticsList().getClElementStatistics()); } - dbControlLoop.setState(clEntry.getValue().getState()); - monitoringProvider.createClElementStatistics(clEntry.getValue() - .getControlLoopStatistics().getClElementStatisticsList().getClElementStatistics()); } } diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java index 88cf90d02..cfc0e3932 100644 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java +++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java @@ -71,9 +71,8 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par Map<UUID, ControlLoopElementDefinition> controlLoopElementDefinitionMap = new LinkedHashMap<>(); controlLoopElementDefinitionMap.put(UUID.randomUUID(), clDefinition); - Map<ToscaConceptIdentifier, Map<UUID, ControlLoopElementDefinition>> participantDefinitionUpdateMap = - new LinkedHashMap<>(); - participantDefinitionUpdateMap.put(participantId, controlLoopElementDefinitionMap); + Map<String, Map<UUID, ControlLoopElementDefinition>> participantDefinitionUpdateMap = new LinkedHashMap<>(); + participantDefinitionUpdateMap.put(participantId.toString(), controlLoopElementDefinitionMap); message.setParticipantDefinitionUpdateMap(participantDefinitionUpdateMap); LOGGER.debug("Participant Update sent {}", message); |