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>
* @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);
}
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.");
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.");