diff options
author | Sirisha_Manchikanti <sirisha.manchikanti@est.tech> | 2021-09-06 09:15:07 +0100 |
---|---|---|
committer | Sirisha_Manchikanti <sirisha.manchikanti@est.tech> | 2021-09-07 17:47:12 +0100 |
commit | 1df4475d60d9c6d46087f8284dd2e0697d59c071 (patch) | |
tree | 00763b704dd8d4818a08223afef40728d8565909 /runtime-controlloop/src/test | |
parent | 29fc6f31180fbbc48d75a3bb1ac97d4b00883e5c (diff) |
Fix parsing of type heirarchy for nodetypes
Fixed an issue where a ControlLoopElement with type defined in
node-types is not parsed. This commit also includes changes to save
the state of a controlLoopElement coming from ControlLoopAck message
into runtime database.
Issue-ID: POLICY-3575
Signed-off-by: Sirisha_Manchikanti <sirisha.manchikanti@est.tech>
Change-Id: I1249cf2cabd4a499d80b401f94f7f42f08b350e3
Diffstat (limited to 'runtime-controlloop/src/test')
-rw-r--r-- | runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java | 20 |
1 files changed, 19 insertions, 1 deletions
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 260ccfb35..14de34d1c 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 @@ -193,7 +193,7 @@ class SupervisionMessagesTest extends CommonRestController { 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( @@ -216,6 +216,22 @@ class SupervisionMessagesTest extends CommonRestController { } } + 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 void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier clParticipantType, String entryKey, ToscaNodeTemplate entryValue, List<ParticipantDefinition> participantDefinitionUpdates) { @@ -259,6 +275,8 @@ class SupervisionMessagesTest extends CommonRestController { participantUpdateAckMsg.setMessage("ParticipantUpdateAck message"); participantUpdateAckMsg.setResponseTo(UUID.randomUUID()); participantUpdateAckMsg.setResult(true); + participantUpdateAckMsg.setParticipantId(getParticipantId()); + participantUpdateAckMsg.setParticipantType(getParticipantType()); synchronized (lockit) { ParticipantUpdateAckListener participantUpdateAckListener = |