From 1f0eee7003f13f48c38145a34d3c8a78c5659912 Mon Sep 17 00:00:00 2001 From: "a.sreekumar" Date: Tue, 7 May 2019 13:13:12 +0000 Subject: Fix to accomodate recent changes in policy-models-tosca Recent change in JpaToscaPolicy require corresponding changes in PDP-A as the code was expecting a simple string earlier. This review contains the changes to fix this Change-Id: I3bbae264800b2c8bb8bdd61eae7b171028a85bc3 Issue-ID: POLICY-1739 Signed-off-by: a.sreekumar --- .../onap/policy/apex/services/onappf/handler/ApexEngineHandler.java | 4 ++-- .../apex/services/onappf/handler/PdpStateChangeMessageHandler.java | 2 +- .../policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'services/services-onappf/src/main/java') diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java index 85d666c2b..1c9413020 100644 --- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java +++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java @@ -53,11 +53,11 @@ public class ApexEngineHandler { * @throws ApexStarterException if the apex engine instantiation failed using the properties passed */ - public ApexEngineHandler(final String properties) throws ApexStarterException { + public ApexEngineHandler(final Object properties) throws ApexStarterException { final StandardCoder standardCoder = new StandardCoder(); JsonObject body; try { - body = standardCoder.decode(new StringReader(properties), JsonObject.class); + body = standardCoder.decode(new StringReader(properties.toString()), JsonObject.class); } catch (final CoderException e) { throw new ApexStarterException(e); } diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java index 9c53fb196..495bceccd 100644 --- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java +++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java @@ -97,7 +97,7 @@ public class PdpStateChangeMessageHandler { try { // assumed that the apex policies list contains only one entry. final ApexEngineHandler apexEngineHandler = - new ApexEngineHandler((String) policies.get(0).getProperties().get("content")); + new ApexEngineHandler(policies.get(0).getProperties().get("content")); Registry.registerOrReplace(ApexStarterConstants.REG_APEX_ENGINE_HANDLER, apexEngineHandler); pdpResponseDetails = pdpMessageHandler.createPdpResonseDetails(pdpStateChangeMsg.getRequestId(), PdpResponseStatus.SUCCESS, "Apex engine started. State changed to active."); diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java index 478d1c757..64d465784 100644 --- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java +++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java @@ -120,8 +120,8 @@ public class PdpUpdateMessageHandler { if (null != apexEngineHandler && apexEngineHandler.isApexEngineRunning()) { apexEngineHandler.shutdown(); } - apexEngineHandler = new ApexEngineHandler( - (String) pdpUpdateMsg.getPolicies().get(0).getProperties().get("content")); + apexEngineHandler = + new ApexEngineHandler(pdpUpdateMsg.getPolicies().get(0).getProperties().get("content")); Registry.registerOrReplace(ApexStarterConstants.REG_APEX_ENGINE_HANDLER, apexEngineHandler); pdpResponseDetails = pdpMessageHandler.createPdpResonseDetails(pdpUpdateMsg.getRequestId(), PdpResponseStatus.SUCCESS, "Apex engine started and policies are running."); -- cgit 1.2.3-korg