diff options
author | Jim Hahn <jrh3@att.com> | 2021-09-02 14:28:06 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-09-02 14:28:06 +0000 |
commit | adb8255b9706e09127d77bc072bef4e8b3a27cf1 (patch) | |
tree | 418b8507a1a30baa3b8167b4a0a2ca1d90df2683 /participant/participant-impl/participant-impl-policy/src/test/java | |
parent | 83b5318e545fbc72e3612c4300c4d738b0b577de (diff) | |
parent | 466783f7638c9173f08a63d51af2c799c0a63598 (diff) |
Merge "Verify alignment with Definition of TOSCA Control Loop Types"
Diffstat (limited to 'participant/participant-impl/participant-impl-policy/src/test/java')
-rw-r--r-- | participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java | 34 |
1 files changed, 17 insertions, 17 deletions
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 52ec98ea2..a33fa0a58 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 @@ -157,17 +157,17 @@ public class TestListenerUtils { if (toscaInputEntry.getValue().getType().contains(CONTROL_LOOP_ELEMENT)) { ControlLoopElement clElement = new ControlLoopElement(); clElement.setId(UUID.randomUUID()); - ToscaConceptIdentifier clParticipantId; + ToscaConceptIdentifier clParticipantType; try { - clParticipantId = CODER.decode( - toscaInputEntry.getValue().getProperties().get("participant_id").toString(), + 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); } - clElement.setParticipantId(clParticipantId); - clElement.setParticipantType(clParticipantId); + clElement.setParticipantId(clParticipantType); + clElement.setParticipantType(clParticipantType); clElement.setDefinition(new ToscaConceptIdentifier(toscaInputEntry.getKey(), toscaInputEntry.getValue().getVersion())); @@ -264,15 +264,15 @@ public class TestListenerUtils { 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(), + 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(), + prepareParticipantDefinitionUpdate(clParticipantType, toscaInputEntry.getKey(), toscaInputEntry.getValue(), participantDefinitionUpdates); } } @@ -281,7 +281,7 @@ public class TestListenerUtils { return participantUpdateMsg; } - private static void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantId, String entryKey, + private static void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantType, String entryKey, ToscaNodeTemplate entryValue, List<ParticipantDefinition> participantDefinitionUpdates) { var clDefinition = new ControlLoopElementDefinition(); @@ -291,28 +291,28 @@ public class TestListenerUtils { List<ControlLoopElementDefinition> controlLoopElementDefinitionList = new ArrayList<>(); if (participantDefinitionUpdates.isEmpty()) { - participantDefinitionUpdates.add(getParticipantDefinition(clDefinition, clParticipantId, + participantDefinitionUpdates.add(getParticipantDefinition(clDefinition, clParticipantType, controlLoopElementDefinitionList)); } else { boolean 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, + participantDefinitionUpdates.add(getParticipantDefinition(clDefinition, clParticipantType, controlLoopElementDefinitionList)); } } } private static ParticipantDefinition getParticipantDefinition(ControlLoopElementDefinition clDefinition, - ToscaConceptIdentifier clParticipantId, + ToscaConceptIdentifier clParticipantType, List<ControlLoopElementDefinition> controlLoopElementDefinitionList) { ParticipantDefinition participantDefinition = new ParticipantDefinition(); - participantDefinition.setParticipantId(clParticipantId); + participantDefinition.setParticipantType(clParticipantType); controlLoopElementDefinitionList.add(clDefinition); participantDefinition.setControlLoopElementDefinitionList(controlLoopElementDefinitionList); return participantDefinition; |