From: Michael Mokry Date: Thu, 12 Apr 2018 14:45:06 +0000 (-0500) Subject: OOF Policy Config File Creation Issue X-Git-Tag: v1.2.0^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=policy%2Fengine.git;a=commitdiff_plain;h=882850a0f5a147c45749facf2e78bccafce1760d OOF Policy Config File Creation Issue Fixed the issue with creating the config file with the wrong file name so that the PDP can pick it up when pushing the policy and getCOnfig will return the Config retrieved rather than a CONFIG_NOT_FOUND 400 status. I found this issue in the new CSIT tests for HPA policies and this should also resolve the failed test in Integration as well. Change-Id: I617133a188f3ba915feafd79da4f3e9d0b0eb4a6 Issue-ID: POLICY-738 Signed-off-by: Michael Mokry --- diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicy.java index 2a03482d2..18d588c8f 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicy.java @@ -88,10 +88,12 @@ public class OptimizationConfigPolicy extends Policy { //save configuration of the policy based on the policyname private void saveConfigurations(String policyName, String jsonBody) { + + if(policyName.endsWith(".xml")){ + policyName = policyName.replace(".xml", ""); + } + try (PrintWriter out = new PrintWriter(CONFIG_HOME + File.separator + policyName +".json");){ - if(policyName.endsWith(".xml")){ - policyName = policyName.replace(".xml", ""); - } out.println(jsonBody); } catch (Exception e) { LOGGER.error("Exception Occured While writing Configuration data"+e);