diff options
Diffstat (limited to 'participant/participant-impl/participant-impl-simulator/src')
2 files changed, 20 insertions, 4 deletions
diff --git a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java index a7d21164f..688f7df6b 100644 --- a/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java +++ b/participant/participant-impl/participant-impl-simulator/src/main/java/org/onap/policy/clamp/controlloop/participant/simulator/simulation/SimulationProvider.java @@ -79,8 +79,8 @@ public class SimulationProvider { */ public TypedSimpleResponse<ControlLoopElement> updateControlLoopElement(ControlLoopElement element) { TypedSimpleResponse<ControlLoopElement> response = new TypedSimpleResponse<>(); - response.setResponse(intermediaryApi.updateControlLoopElementState(element.getId(), element.getOrderedState(), - element.getState(), ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE)); + response.setResponse(intermediaryApi.updateControlLoopElementState(null, element.getId(), + element.getOrderedState(), element.getState(), ParticipantMessageType.CONTROL_LOOP_STATE_CHANGE)); return response; } diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java index 56be0817f..7439ccd5b 100644 --- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java +++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/controlloop/participant/simulator/main/rest/TestListenerUtils.java @@ -146,7 +146,7 @@ public class TestListenerUtils { Map<String, ToscaNodeTemplate> nodeTemplatesMap = toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates(); for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : nodeTemplatesMap.entrySet()) { - if (toscaInputEntry.getValue().getType().contains(CONTROL_LOOP_ELEMENT)) { + if (checkIfNodeTemplateIsControlLoopElement(toscaInputEntry.getValue(), toscaServiceTemplate)) { ControlLoopElement clElement = new ControlLoopElement(); clElement.setId(UUID.randomUUID()); ToscaConceptIdentifier clParticipantType; @@ -178,6 +178,22 @@ public class TestListenerUtils { return clUpdateMsg; } + private static boolean checkIfNodeTemplateIsControlLoopElement(ToscaNodeTemplate nodeTemplate, + ToscaServiceTemplate toscaServiceTemplate) { + if (nodeTemplate.getType().contains(CONTROL_LOOP_ELEMENT)) { + return true; + } else { + var nodeType = toscaServiceTemplate.getNodeTypes().get(nodeTemplate.getType()); + if (nodeType != null) { + var derivedFrom = nodeType.getDerivedFrom(); + if (derivedFrom != null) { + return derivedFrom.contains(CONTROL_LOOP_ELEMENT) ? true : false; + } + } + } + return false; + } + private static void prepareParticipantUpdateForControlLoop(ControlLoopElement clElement, List<ParticipantUpdates> participantUpdates) { if (participantUpdates.isEmpty()) { @@ -228,7 +244,7 @@ public class TestListenerUtils { List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>(); for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates().entrySet()) { - if (toscaInputEntry.getValue().getType().contains(CONTROL_LOOP_ELEMENT)) { + if (checkIfNodeTemplateIsControlLoopElement(toscaInputEntry.getValue(), toscaServiceTemplate)) { ToscaConceptIdentifier clParticipantType; try { clParticipantType = CODER.decode( |