From e0d7e568c86b612852372d566bddb97585ae5cad Mon Sep 17 00:00:00 2001 From: FrancescoFioraEst Date: Wed, 3 Jul 2024 16:30:10 +0100 Subject: Update policy-api status response check in ACM policy-participant Issue-ID:POLICY-5067 Change-Id: Ibd9416226619b32bae09008c92962b1b186cb0e9 Signed-off-by: FrancescoFioraEst --- .../policy/main/handler/AutomationCompositionElementHandler.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'participant/participant-impl/participant-impl-policy') diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java index 34c195501..5a3bc6328 100644 --- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java +++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java @@ -182,7 +182,7 @@ public class AutomationCompositionElementHandler extends AcElementListenerV2 { createPolicyResp = response.getStatus(); } } - if (createPolicyTypeResp == HttpStatus.SC_OK && createPolicyResp == HttpStatus.SC_OK) { + if (isSuccess(createPolicyTypeResp) && isSuccess(createPolicyResp)) { LOGGER.info( "PolicyTypes/Policies for the automation composition element : {} are created " + "successfully", instanceElement.elementId()); @@ -195,6 +195,10 @@ public class AutomationCompositionElementHandler extends AcElementListenerV2 { } } + private boolean isSuccess(int status) { + return status == HttpStatus.SC_OK || status == HttpStatus.SC_CREATED; + } + private List getPolicyTypeList(ToscaServiceTemplate serviceTemplate) { List policyTypeList = new ArrayList<>(); if (serviceTemplate.getPolicyTypes() != null) { -- cgit 1.2.3-korg