summaryrefslogtreecommitdiffstats
path: root/runtime-controlloop/src/main
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2021-09-02 14:28:06 +0000
committerGerrit Code Review <gerrit@onap.org>2021-09-02 14:28:06 +0000
commitadb8255b9706e09127d77bc072bef4e8b3a27cf1 (patch)
tree418b8507a1a30baa3b8167b4a0a2ca1d90df2683 /runtime-controlloop/src/main
parent83b5318e545fbc72e3612c4300c4d738b0b577de (diff)
parent466783f7638c9173f08a63d51af2c799c0a63598 (diff)
Merge "Verify alignment with Definition of TOSCA Control Loop Types"
Diffstat (limited to 'runtime-controlloop/src/main')
-rw-r--r--runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantUpdatePublisher.java41
1 files changed, 20 insertions, 21 deletions
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 113823648..c820bf3f1 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
@@ -76,19 +76,19 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
}
List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
- for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry :
- toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates().entrySet()) {
+ for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : toscaServiceTemplate.getToscaTopologyTemplate()
+ .getNodeTemplates().entrySet()) {
if (toscaInputEntry.getValue().getType().contains(CONTROL_LOOP_ELEMENT)) {
- ToscaConceptIdentifier clParticipantId;
+ ToscaConceptIdentifier clParticipantType;
try {
- clParticipantId = CODER.decode(
- toscaInputEntry.getValue().getProperties().get("participant_id").toString(),
- ToscaConceptIdentifier.class);
+ clParticipantType =
+ CODER.decode(toscaInputEntry.getValue().getProperties().get("participantType").toString(),
+ ToscaConceptIdentifier.class);
} catch (CoderException e) {
- throw new RuntimeException("cannot get ParticipantId from toscaNodeTemplate", e);
+ throw new RuntimeException("cannot get ParticipantType from toscaNodeTemplate", e);
}
- prepareParticipantDefinitionUpdate(clParticipantId, toscaInputEntry.getKey(),
- toscaInputEntry.getValue(), participantDefinitionUpdates);
+ prepareParticipantDefinitionUpdate(clParticipantType, toscaInputEntry.getKey(),
+ toscaInputEntry.getValue(), participantDefinitionUpdates);
}
}
@@ -103,38 +103,37 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
super.send(message);
}
- private void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantId, String entryKey,
- ToscaNodeTemplate entryValue, List<ParticipantDefinition> participantDefinitionUpdates) {
+ private void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantType, String entryKey,
+ ToscaNodeTemplate entryValue, List<ParticipantDefinition> participantDefinitionUpdates) {
var clDefinition = new ControlLoopElementDefinition();
- clDefinition.setClElementDefinitionId(new ToscaConceptIdentifier(
- entryKey, entryValue.getVersion()));
+ clDefinition.setClElementDefinitionId(new ToscaConceptIdentifier(entryKey, entryValue.getVersion()));
clDefinition.setControlLoopElementToscaNodeTemplate(entryValue);
List<ControlLoopElementDefinition> controlLoopElementDefinitionList = new ArrayList<>();
if (participantDefinitionUpdates.isEmpty()) {
- participantDefinitionUpdates.add(getParticipantDefinition(clDefinition, clParticipantId,
- controlLoopElementDefinitionList));
+ participantDefinitionUpdates
+ .add(getParticipantDefinition(clDefinition, clParticipantType, controlLoopElementDefinitionList));
} else {
var participantExists = false;
for (ParticipantDefinition participantDefinitionUpdate : participantDefinitionUpdates) {
- if (participantDefinitionUpdate.getParticipantId().equals(clParticipantId)) {
+ if (participantDefinitionUpdate.getParticipantType().equals(clParticipantType)) {
participantDefinitionUpdate.getControlLoopElementDefinitionList().add(clDefinition);
participantExists = true;
}
}
if (!participantExists) {
- participantDefinitionUpdates.add(getParticipantDefinition(clDefinition, clParticipantId,
- controlLoopElementDefinitionList));
+ participantDefinitionUpdates.add(
+ getParticipantDefinition(clDefinition, clParticipantType, controlLoopElementDefinitionList));
}
}
}
private ParticipantDefinition getParticipantDefinition(ControlLoopElementDefinition clDefinition,
- ToscaConceptIdentifier clParticipantId,
- List<ControlLoopElementDefinition> controlLoopElementDefinitionList) {
+ ToscaConceptIdentifier clParticipantType,
+ List<ControlLoopElementDefinition> controlLoopElementDefinitionList) {
var participantDefinition = new ParticipantDefinition();
- participantDefinition.setParticipantId(clParticipantId);
+ participantDefinition.setParticipantType(clParticipantType);
controlLoopElementDefinitionList.add(clDefinition);
participantDefinition.setControlLoopElementDefinitionList(controlLoopElementDefinitionList);
return participantDefinition;