APEX-PDP incorrectly reports successful policy deployment to PAP 96/120296/1
authora.sreekumar <ajith.sreekumar@bell.ca>
Thu, 8 Apr 2021 10:06:14 +0000 (11:06 +0100)
committerAjith Sreekumar <ajith.sreekumar@bell.ca>
Mon, 12 Apr 2021 10:06:42 +0000 (10:06 +0000)
Change-Id: I2fbf0303805b4c5feead522ad78fd4ef518659af
Issue-ID: POLICY-3173
Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
(cherry picked from commit ae01c8d07c3b62dd9b06958a62702816e2f7bfc1)

services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java
services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java

index 9fe3c94..65c4b03 100644 (file)
@@ -160,9 +160,10 @@ public class ApexEngineHandler {
             policyMapToRetain.putAll(policyModel.getPolicies().getPolicyMap());
         });
         for (ApexMain main : undeployedPoliciesMainMap.values()) {
-            handleParametersRemoval(inputParamKeysToRetain, outputParamKeysToRetain, taskParametersToRetain,
-                executorParamKeysToRetain, schemaParamKeysToRetain, main);
-
+            if (null != main.getApexParameters()) {
+                handleParametersRemoval(inputParamKeysToRetain, outputParamKeysToRetain, taskParametersToRetain,
+                    executorParamKeysToRetain, schemaParamKeysToRetain, main);
+            }
             if (null != main.getActivator() && null != main.getActivator().getPolicyModel()) {
                 handleAxConceptsRemoval(keyInfoMapToRetain, schemaMapToRetain, eventMapToRetain, albumMapToRetain,
                     taskMapToRetain, policyMapToRetain, main);
index bf72b09..8dc49ee 100644 (file)
@@ -1,6 +1,7 @@
 /*-
  * ============LICENSE_START=======================================================
  *  Copyright (C) 2019-2021 Nordix Foundation.
+ *  Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -97,7 +98,8 @@ public class PdpUpdateMessageHandler {
         if (pdpStatusContext.getState().equals(PdpState.ACTIVE)) {
             pdpResponseDetails = startOrStopApexEngineBasedOnPolicies(pdpUpdateMsg, pdpMessageHandler);
 
-            ApexEngineHandler apexEngineHandler = Registry.get(ApexStarterConstants.REG_APEX_ENGINE_HANDLER);
+            ApexEngineHandler apexEngineHandler =
+                Registry.getOrDefault(ApexStarterConstants.REG_APEX_ENGINE_HANDLER, ApexEngineHandler.class, null);
             // in hearbeat while in active state, only the policies which are running should be there.
             // if some policy fails, that shouldn't go in the heartbeat.
             // If no policies are running, then the policy list in the heartbeat can be empty