From 466783f7638c9173f08a63d51af2c799c0a63598 Mon Sep 17 00:00:00 2001 From: FrancescoFioraEst Date: Tue, 31 Aug 2021 15:55:59 +0100 Subject: Verify alignment with Definition of TOSCA Control Loop Types Issue-ID: POLICY-3612 Change-Id: I818f80cdc1db98752a7791ef4aba7377add66516 Signed-off-by: FrancescoFioraEst --- .../supervision/comm/SupervisionMessagesTest.java | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'runtime-controlloop/src/test/java') diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java index f1a272835..4cfcf1508 100644 --- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java +++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java @@ -192,15 +192,15 @@ class SupervisionMessagesTest extends CommonRestController { for (Map.Entry 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); } } @@ -215,7 +215,7 @@ class SupervisionMessagesTest extends CommonRestController { } } - private void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantId, String entryKey, + private void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantType, String entryKey, ToscaNodeTemplate entryValue, List participantDefinitionUpdates) { var clDefinition = new ControlLoopElementDefinition(); @@ -225,28 +225,28 @@ class SupervisionMessagesTest extends CommonRestController { List 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 ParticipantDefinition getParticipantDefinition(ControlLoopElementDefinition clDefinition, - ToscaConceptIdentifier clParticipantId, + ToscaConceptIdentifier clParticipantType, List controlLoopElementDefinitionList) { ParticipantDefinition participantDefinition = new ParticipantDefinition(); - participantDefinition.setParticipantId(clParticipantId); + participantDefinition.setParticipantType(clParticipantType); controlLoopElementDefinitionList.add(clDefinition); participantDefinition.setControlLoopElementDefinitionList(controlLoopElementDefinitionList); return participantDefinition; -- cgit 1.2.3-korg