OOF Policy Config File Creation Issue 27/42527/1
authorMichael Mokry <mm117s@att.com>
Thu, 12 Apr 2018 14:45:06 +0000 (09:45 -0500)
committerMichael Mokry <mm117s@att.com>
Thu, 12 Apr 2018 14:49:46 +0000 (09:49 -0500)
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 <mm117s@att.com>
ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/OptimizationConfigPolicy.java

index 2a03482..18d588c 100644 (file)
@@ -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);