From 882850a0f5a147c45749facf2e78bccafce1760d Mon Sep 17 00:00:00 2001 From: Michael Mokry Date: Thu, 12 Apr 2018 09:45:06 -0500 Subject: 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 --- .../pap/xacml/rest/components/OptimizationConfigPolicy.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ONAP-PAP-REST/src') 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); -- cgit 1.2.3-korg