aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@est.tech>2019-05-07 13:13:12 +0000
committera.sreekumar <ajith.sreekumar@est.tech>2019-05-07 13:13:12 +0000
commit1f0eee7003f13f48c38145a34d3c8a78c5659912 (patch)
tree49316645a14517a54ed4ad46443338e0baf4a8c3
parent728f9132fa2c774ad5e6e5ec3c32dbd1bfd4bbfa (diff)
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 <ajith.sreekumar@est.tech>
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java4
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java2
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java4
3 files changed, 5 insertions, 5 deletions
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.");