From 1df4475d60d9c6d46087f8284dd2e0697d59c071 Mon Sep 17 00:00:00 2001 From: Sirisha_Manchikanti Date: Mon, 6 Sep 2021 09:15:07 +0100 Subject: 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 Change-Id: I1249cf2cabd4a499d80b401f94f7f42f08b350e3 --- .../participant/http/main/handler/ControlLoopElementHandler.java | 7 ++++--- .../src/test/java/handler/ClElementHandlerTest.java | 3 ++- .../participant-impl-http/src/test/java/utils/CommonTestData.java | 8 ++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'participant/participant-impl/participant-impl-http/src') diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java index f18885f0f..cfe786865 100644 --- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java +++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/controlloop/participant/http/main/handler/ControlLoopElementHandler.java @@ -88,8 +88,8 @@ public class ControlLoopElementHandler implements ControlLoopElementListener, Cl * @throws PfModelException in case of a model exception */ @Override - public void controlLoopElementStateChange(UUID controlLoopElementId, ControlLoopState currentState, - ControlLoopOrderedState newState) throws PfModelException { + public void controlLoopElementStateChange(ToscaConceptIdentifier controlLoopId, UUID controlLoopElementId, + ControlLoopState currentState, ControlLoopOrderedState newState) throws PfModelException { // Implementation not needed for http participant } @@ -100,7 +100,8 @@ public class ControlLoopElementHandler implements ControlLoopElementListener, Cl * @param nodeTemplate toscaNodeTemplate */ @Override - public void controlLoopElementUpdate(ControlLoopElement element, ToscaNodeTemplate nodeTemplate) { + public void controlLoopElementUpdate(ToscaConceptIdentifier controlLoopId, ControlLoopElement element, + ToscaNodeTemplate nodeTemplate) { try { var configRequest = CODER.convert(nodeTemplate.getProperties(), ConfigRequest.class); Set> violations = Validation.buildDefaultValidatorFactory() diff --git a/participant/participant-impl/participant-impl-http/src/test/java/handler/ClElementHandlerTest.java b/participant/participant-impl/participant-impl-http/src/test/java/handler/ClElementHandlerTest.java index 46ed355de..0de25072d 100644 --- a/participant/participant-impl/participant-impl-http/src/test/java/handler/ClElementHandlerTest.java +++ b/participant/participant-impl/participant-impl-http/src/test/java/handler/ClElementHandlerTest.java @@ -66,6 +66,7 @@ class ClElementHandlerTest { serviceTemplate.getToscaTopologyTemplate().getNodeTemplates(); assertDoesNotThrow(() -> controlLoopElementHandler - .controlLoopElementUpdate(element, nodeTemplatesMap.get(HTTP_CONTROL_LOOP_ELEMENT))); + .controlLoopElementUpdate(commonTestData.getControlLoopId(), element, + nodeTemplatesMap.get(HTTP_CONTROL_LOOP_ELEMENT))); } } diff --git a/participant/participant-impl/participant-impl-http/src/test/java/utils/CommonTestData.java b/participant/participant-impl/participant-impl-http/src/test/java/utils/CommonTestData.java index 84957edfa..aa4f56225 100644 --- a/participant/participant-impl/participant-impl-http/src/test/java/utils/CommonTestData.java +++ b/participant/participant-impl/participant-impl-http/src/test/java/utils/CommonTestData.java @@ -135,6 +135,14 @@ public class CommonTestData { ); } + /** + * Get controlloop id. + * @return ToscaConceptIdentifier controlLoopId + */ + public ToscaConceptIdentifier getControlLoopId() { + return new ToscaConceptIdentifier("PMSHInstance0", "1.0.0"); + } + /** * Get headers for config request. * @return Map of headers -- cgit 1.2.3-korg