diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/ActionPolicyClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/ActionPolicyClient.java
index 94c6043..a3c29fb 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/ActionPolicyClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/ActionPolicyClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,78 +34,84 @@
 import org.onap.policy.api.PolicyParameters;
 
 public class ActionPolicyClient {
-	static Boolean isEdit = true;
-	public static void main(String[] args) {
-		try {
-	        PolicyEngine policyEngine = new PolicyEngine("config.properties");
-	        PolicyParameters policyParameters = new PolicyParameters();
-	        // Set Policy Type
-	        policyParameters.setPolicyClass(PolicyClass.Action); //required
-	        policyParameters.setPolicyName("MikeAPItesting.testActionAPI5"); //required
-	        policyParameters.setPolicyDescription("This is a sample Action policy update example with no Action Body");  //optional
-	        //policyParameters.setPolicyScope("MikeAPItesting"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI
-	        
-	        //Set the Component Attributes... These are Optional
-	        Map<String, String> configAttributes = new HashMap<>(); 
-	        configAttributes.put("Template", "UpdateTemplate");
-	        configAttributes.put("controller", "default"); 
-	        configAttributes.put("SamPoll", "30");
-	        configAttributes.put("value", "abcd"); 
-	        
-	        Map<AttributeType, Map<String,String>> attributes = new HashMap<>();
-	        attributes.put(AttributeType.MATCHING, configAttributes);
-	        policyParameters.setAttributes(attributes);
+    static Boolean isEdit = true;
 
-	        
-			List<String> dynamicRuleAlgorithmLabels = new LinkedList<>();
-			List<String> dynamicRuleAlgorithmFunctions = new LinkedList<>();
-			List<String> dynamicRuleAlgorithmField1 = new LinkedList<>();
-			List<String> dynamicRuleAlgorithmField2 = new LinkedList<>();
-			
-			//Example of a complex Rule algorithm
-			/* label 	field1     	function				field2
-			 * *****************************************************
-			 * A1   	cobal   	integer-equal   			90
-			 * A2   	cap     	string-contains     		ca
-			 * A3		cobal		integer-equal				90	
-			 * A4		A2			and							A3
-			 * A5		Config		integer-greater-than		45
-			 * A6		A4	`		or							A5
-			 * A7		A1			and							A6
-			 */
-			dynamicRuleAlgorithmLabels = Arrays.asList("A1","A2","A3","A4","A5","A6","A7");
-			dynamicRuleAlgorithmField1 = Arrays.asList("cobal","cap","cobal","A2","Config","A4","A1");
-			dynamicRuleAlgorithmFunctions = Arrays.asList("integer-equal","string-contains","integer-equal","and","integer-greater-than","or","and");
-			dynamicRuleAlgorithmField2 = Arrays.asList("90","ca","90","A3","45","A5","A6");
-			        
-			policyParameters.setDynamicRuleAlgorithmLabels(dynamicRuleAlgorithmLabels);
-			policyParameters.setDynamicRuleAlgorithmField1(dynamicRuleAlgorithmField1);
-			policyParameters.setDynamicRuleAlgorithmFunctions(dynamicRuleAlgorithmFunctions);
-			policyParameters.setDynamicRuleAlgorithmField2(dynamicRuleAlgorithmField2);
-			
-	        policyParameters.setActionPerformer("PEP");
-	        policyParameters.setActionAttribute("mikeTest2");
-	        policyParameters.setRequestID(UUID.randomUUID());
-	        
-	        // API method to create Policy or update policy
-	        PolicyChangeResponse response = null;
-	        if (!isEdit) {
-	            response = policyEngine.createPolicy(policyParameters);
-	        } else {
-	        	response = policyEngine.updatePolicy(policyParameters);
-	        }
-	        
-	        if(response.getResponseCode()==200){
-	            System.out.println(response.getResponseMessage());
-	            System.out.println("Policy Created Successfully!");
-	        }else{
-	            System.out.println("Error! " + response.getResponseMessage());
-	        }
-		} catch (Exception e) {
-			System.err.println(e.getMessage() + e);
-		}
-	}
-	
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
+        try {
+            PolicyEngine policyEngine = new PolicyEngine("config.properties");
+            PolicyParameters policyParameters = new PolicyParameters();
+            // Set Policy Type
+            policyParameters.setPolicyClass(PolicyClass.Action); // required
+            policyParameters.setPolicyName("MikeAPItesting.testActionAPI5"); // required
+            policyParameters.setPolicyDescription(
+                    "This is a sample Action policy update example with no Action Body"); // optional
+            // saved... this displays a a subscope on the GUI
+
+            // Set the Component Attributes... These are Optional
+            Map<String, String> configAttributes = new HashMap<>();
+            configAttributes.put("Template", "UpdateTemplate");
+            configAttributes.put("controller", "default");
+            configAttributes.put("SamPoll", "30");
+            configAttributes.put("value", "abcd");
+
+            Map<AttributeType, Map<String, String>> attributes = new HashMap<>();
+            attributes.put(AttributeType.MATCHING, configAttributes);
+            policyParameters.setAttributes(attributes);
+
+            List<String> dynamicRuleAlgorithmLabels = new LinkedList<>();
+            List<String> dynamicRuleAlgorithmFunctions = new LinkedList<>();
+            List<String> dynamicRuleAlgorithmField1 = new LinkedList<>();
+
+            // Example of a complex Rule algorithm
+            /*
+             * label field1 function field2
+             * *****************************************************
+             * A1 cobal integer-equal 90
+             * A2 cap string-contains ca
+             * A3 cobal integer-equal 90
+             * A4 A2 and A3
+             * A5 Config integer-greater-than 45
+             * A6 A4 ` or A5
+             * A7 A1 and A6
+             */
+            dynamicRuleAlgorithmLabels = Arrays.asList("A1", "A2", "A3", "A4", "A5", "A6", "A7");
+            dynamicRuleAlgorithmField1 = Arrays.asList("cobal", "cap", "cobal", "A2", "Config", "A4", "A1");
+            dynamicRuleAlgorithmFunctions = Arrays.asList("integer-equal", "string-contains", "integer-equal", "and",
+                    "integer-greater-than", "or", "and");
+            List<String> dynamicRuleAlgorithmField2 = new LinkedList<>();
+            dynamicRuleAlgorithmField2 = Arrays.asList("90", "ca", "90", "A3", "45", "A5", "A6");
+
+            policyParameters.setDynamicRuleAlgorithmLabels(dynamicRuleAlgorithmLabels);
+            policyParameters.setDynamicRuleAlgorithmField1(dynamicRuleAlgorithmField1);
+            policyParameters.setDynamicRuleAlgorithmFunctions(dynamicRuleAlgorithmFunctions);
+            policyParameters.setDynamicRuleAlgorithmField2(dynamicRuleAlgorithmField2);
+
+            policyParameters.setActionPerformer("PEP");
+            policyParameters.setActionAttribute("mikeTest2");
+            policyParameters.setRequestID(UUID.randomUUID());
+
+            // API method to create Policy or update policy
+            PolicyChangeResponse response = null;
+            if (!isEdit) {
+                response = policyEngine.createPolicy(policyParameters);
+            } else {
+                response = policyEngine.updatePolicy(policyParameters);
+            }
+
+            if (response.getResponseCode() == 200) {
+                System.out.println(response.getResponseMessage());
+                System.out.println("Policy Created Successfully!");
+            } else {
+                System.out.println("Error! " + response.getResponseMessage());
+            }
+        } catch (Exception e) {
+            System.err.println(e.getMessage() + e);
+        }
+    }
+
 }
-
-
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/BrmsParamPolicyClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/BrmsParamPolicyClient.java
index 33ceedf..60022d5 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/BrmsParamPolicyClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/BrmsParamPolicyClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,65 +32,68 @@
 import org.onap.policy.api.PolicyEngine;
 import org.onap.policy.api.PolicyParameters;
 
-
 public class BrmsParamPolicyClient {
-	
-	public static void main(String[] args) {
-		try {
 
-            PolicyEngine policyEngine = new PolicyEngine("config.properties");
+    /**
+     * main.
+     *
+     * @param args String[] of arguments
+     */
+    public static void main(String[] args) {
+        try {
 
             PolicyParameters policyParameters = new PolicyParameters();
 
-            // Set Policy Type(Mandatory) 
+            // Set Policy Type(Mandatory)
             policyParameters.setPolicyConfigType(PolicyConfigType.BRMS_PARAM);
-            
-            // Set Policy Name(Mandatory) 
+
+            // Set Policy Name(Mandatory)
             policyParameters.setPolicyName("Lakshman.testParamPolicyThree");
-            
+
             // Set Safe Policy value for Risk Type
-			SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
-			Date date = dateformat3.parse("15/10/2016");
-			policyParameters.setTtlDate(date);
-			// Set Safe Policy value for Guard
-			policyParameters.setGuard(true);
-			// Set Safe Policy value for Risk Level
-			policyParameters.setRiskLevel("5");
-			// Set Safe Policy value for Risk Type
-			policyParameters.setRiskType("PROD");
-            
+            SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
+            Date date = dateformat3.parse("15/10/2016");
+            policyParameters.setTtlDate(date);
+            // Set Safe Policy value for Guard
+            policyParameters.setGuard(true);
+            // Set Safe Policy value for Risk Level
+            policyParameters.setRiskLevel("5");
+            // Set Safe Policy value for Risk Type
+            policyParameters.setRiskType("PROD");
+
             // Set description of the policy(Optional)
             policyParameters.setPolicyDescription("This is a sample BRMS Param policy creation example");
-            
-            // Set BRMS Param Template Attributes(Mandatory) 
+
+            // Set BRMS Param Template Attributes(Mandatory)
             Map<String, String> ruleAttributes = new HashMap<>();
-            ruleAttributes.put("templateName", "Sample"); // This sampleTemplate is the Template name from dictionary. 
-            ruleAttributes.put("controller", "default"); // Set Rule to a PDP Controller, default is the controller name.
-            ruleAttributes.put("SamPoll", "300"); // Template specific key and value set by us. 
-            ruleAttributes.put("value", "abcd"); // Template specific key and value set by us. 
+            ruleAttributes.put("templateName", "Sample"); // This sampleTemplate is the Template name from dictionary.
+            // Set Rule to a PDP Controller, default is the controller
+            // name.
+            ruleAttributes.put("controller", "default");
+            ruleAttributes.put("SamPoll", "300"); // Template specific key and value set by us.
+            ruleAttributes.put("value", "abcd"); // Template specific key and value set by us.
             Map<AttributeType, Map<String, String>> attributes = new HashMap<>();
             attributes.put(AttributeType.RULE, ruleAttributes);
             policyParameters.setAttributes(attributes);
-            
-            //Set a random UUID(Mandatory)
+
+            // Set a random UUID(Mandatory)
             policyParameters.setRequestID(UUID.randomUUID());
 
-            // CreatePolicy method to create Policy. 
+            // CreatePolicy method to create Policy.
 
+            PolicyEngine policyEngine = new PolicyEngine("config.properties");
             PolicyChangeResponse response = policyEngine.updatePolicy(policyParameters);
 
-            if(response.getResponseCode()==200){
+            if (response.getResponseCode() == 200) {
                 System.out.println(response.getResponseMessage());
                 System.out.println("Policy Created Successfully!");
-            }else{
+            } else {
                 System.out.println("Error! " + response.getResponseMessage());
             }
         } catch (Exception e) {
             System.err.println(e.getMessage() + e);
         }
-		
-	}
-	
+
+    }
+
 }
-
-
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/BrmsRawPolicyClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/BrmsRawPolicyClient.java
index 60e2c5d..41bb6c5 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/BrmsRawPolicyClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/BrmsRawPolicyClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -42,39 +42,44 @@
 public class BrmsRawPolicyClient {
     static Boolean isEdit = true;
 
-    //Reads a File and converts into a String.
-    private static String readFile( String file ) throws IOException {
+    // Reads a File and converts into a String.
+    private static String readFile(String file) throws IOException {
 
-        String         line = null;
-        StringBuilder  stringBuilder = new StringBuilder();
-        String         ls = System.getProperty("line.separator");
+        String line = null;
+        StringBuilder stringBuilder = new StringBuilder();
+        String ls = System.getProperty("line.separator");
 
-        try (BufferedReader reader = new BufferedReader( new FileReader (file))) {
-            while( ( line = reader.readLine() ) != null ) {
-                stringBuilder.append( line );
-                stringBuilder.append( ls );
+        try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
+            while ((line = reader.readLine()) != null) {
+                stringBuilder.append(line);
+                stringBuilder.append(ls);
             }
             return stringBuilder.toString();
         }
     }
 
-
+    /**
+     * main.
+     *
+     * @param args String[] of arguments
+     */
     public static void main(String[] args) {
         try {
             PolicyEngine policyEngine = new PolicyEngine("config.properties");
-            PolicyParameters policyParameters = new PolicyParameters();
-            Map<String, String> attrib= new HashMap<>();
-            attrib.put("cpu","80");
+            Map<String, String> attrib = new HashMap<>();
+            attrib.put("cpu", "80");
             attrib.put("memory", "50");
             Map<AttributeType, Map<String, String>> attributes = new HashMap<>();
             attributes.put(AttributeType.RULE, attrib);
 
+            PolicyParameters policyParameters = new PolicyParameters();
             // Set Policy Type
-            policyParameters.setPolicyConfigType(PolicyConfigType.BRMS_RAW); //required
-            policyParameters.setPolicyName("Lakshman.testBRMSRawAPITwo"); //required
-            policyParameters.setPolicyDescription("This is a sample BRMS Raw policy body");  //optional
+            policyParameters.setPolicyConfigType(PolicyConfigType.BRMS_RAW); // required
+            policyParameters.setPolicyName("Lakshman.testBRMSRawAPITwo"); // required
+            policyParameters.setPolicyDescription("This is a sample BRMS Raw policy body"); // optional
             policyParameters.setAttributes(attributes);
-            //policyParameters.setPolicyScope("Lakshman"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI
+            // policyParameters.setPolicyScope("Lakshman"); //Directory will be created where the Policies are saved...
+            // this displays a a subscope on the GUI
             policyParameters.setRequestID(UUID.randomUUID());
 
             // Set Safe Policy value for Risk Type
@@ -104,10 +109,10 @@
                 response = policyEngine.updatePolicy(policyParameters);
             }
 
-            if(response.getResponseCode()==200){
+            if (response.getResponseCode() == 200) {
                 System.out.println(response.getResponseMessage());
                 System.out.println("Policy Created Successfully!");
-            }else{
+            } else {
                 System.out.println("Error! " + response.getResponseMessage());
             }
         } catch (Exception e) {
@@ -116,5 +121,3 @@
     }
 
 }
-
-
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/ClosedLoopPolicyClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/ClosedLoopPolicyClient.java
index 29a0f43..13b9f47 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/ClosedLoopPolicyClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/ClosedLoopPolicyClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,83 +43,88 @@
 import org.onap.policy.api.PolicyType;
 
 public class ClosedLoopPolicyClient {
-	//For updating a ClosedLoop_Fault policy set the "isEdit" flag to true.   
-	//For creating a ClosedLoop_Fault policy set the "isEdit" flag to false.  
-	static Boolean isEdit = false;
-	     
-	//Builds JSONObject from File  
-	private static JsonObject buildJSON(File jsonInput, String jsonString) throws FileNotFoundException {
-	    JsonObject json = null;;
-	    JsonReader jsonReader = null;    
-	    if (jsonString != null && jsonInput == null) {
-	        StringReader in = null;
-	            in = new StringReader(jsonString);
-	            jsonReader = Json.createReader(in);
-	            json = jsonReader.readObject();
-	            in.close();
-	    }else {
-	        InputStream in = null;
-	        in = new FileInputStream(jsonInput);
-	        jsonReader = Json.createReader(in);
-	        json = jsonReader.readObject();
-	        try {
-				in.close();
-			} catch (IOException e) {
-				System.err.println("Exception Occured while closing input stream"+e);
-			}
-	    }
-	    jsonReader.close();
-	           
-	    return json;
-	}
-	public static void main(String[] args) {
-			try {
-				PolicyEngine policyEngine = new PolicyEngine("config.properties");
-				PolicyParameters policyParameters = new PolicyParameters();
-				// Set Policy Type 
-				policyParameters.setPolicyConfigType(PolicyConfigType.ClosedLoop_Fault);
-				policyParameters.setPolicyName("MikeAPItests.ClosedLoopFaultApiTest45");
-				policyParameters.setPolicyDescription("This is a sample ClosedLoop_Fault policy CREATE example");
-				//policyParameters.setPolicyScope("MikeAPItests");
-				
-				// Set up Micro Services Attributes 
-				File jsonFile = null;
-				String MSjsonString= null;
-				Path file = Paths.get("C:\\policyAPI\\ClosedLoopJSON\\faultTestJson.json");
-				jsonFile = file.toFile();
-				
-				policyParameters.setConfigBody(buildJSON(jsonFile, MSjsonString).toString());		
-				policyParameters.setConfigBodyType(PolicyType.JSON);
+    // For updating a ClosedLoop_Fault policy set the "isEdit" flag to true.
+    // For creating a ClosedLoop_Fault policy set the "isEdit" flag to false.
+    static Boolean isEdit = false;
 
-				policyParameters.setRequestID(UUID.randomUUID());
-	            // Set Safe Policy value for Risk Type
-				SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
-				Date date = dateformat3.parse("15/10/2016");
-				policyParameters.setTtlDate(date);
-				// Set Safe Policy value for Guard
-				policyParameters.setGuard(true);
-				// Set Safe Policy value for Risk Level
-				policyParameters.setRiskLevel("5");
-				// Set Safe Policy value for Risk Type
-				policyParameters.setRiskType("PROD");
-				
-				// API method to create or update Policy. 
-	 	        PolicyChangeResponse response = null;
-		        if (!isEdit) {
-		            response = policyEngine.createPolicy(policyParameters);
-		        } 
-		        else {	
-		        	response = policyEngine.updatePolicy(policyParameters);
-		        }
-		        
-				if(response.getResponseCode()==200){
-					System.out.println(response.getResponseMessage());
-					System.out.println("Policy Created Successfully!");
-				}else{
-					System.out.println("Error! " + response.getResponseMessage());
-				}
-			} catch (Exception e) {
-				System.err.println(e.getMessage());
-			}
-		}
+    // Builds JSONObject from File
+    private static JsonObject buildJson(File jsonInput, String jsonString) throws FileNotFoundException {
+        JsonObject json = null;;
+        JsonReader jsonReader = null;
+        if (jsonString != null && jsonInput == null) {
+            StringReader in = null;
+            in = new StringReader(jsonString);
+            jsonReader = Json.createReader(in);
+            json = jsonReader.readObject();
+            in.close();
+        } else {
+            InputStream in = null;
+            in = new FileInputStream(jsonInput);
+            jsonReader = Json.createReader(in);
+            json = jsonReader.readObject();
+            try {
+                in.close();
+            } catch (IOException e) {
+                System.err.println("Exception Occured while closing input stream" + e);
+            }
+        }
+        jsonReader.close();
+
+        return json;
+    }
+
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
+        try {
+            PolicyEngine policyEngine = new PolicyEngine("config.properties");
+            PolicyParameters policyParameters = new PolicyParameters();
+            // Set Policy Type
+            policyParameters.setPolicyConfigType(PolicyConfigType.ClosedLoop_Fault);
+            policyParameters.setPolicyName("MikeAPItests.ClosedLoopFaultApiTest45");
+            policyParameters.setPolicyDescription("This is a sample ClosedLoop_Fault policy CREATE example");
+            // policyParameters.setPolicyScope("MikeAPItests");
+
+            // Set up Micro Services Attributes
+            File jsonFile = null;
+            String msJsonString = null;
+            Path file = Paths.get("C:\\policyAPI\\ClosedLoopJSON\\faultTestJson.json");
+            jsonFile = file.toFile();
+
+            policyParameters.setConfigBody(buildJson(jsonFile, msJsonString).toString());
+            policyParameters.setConfigBodyType(PolicyType.JSON);
+
+            policyParameters.setRequestID(UUID.randomUUID());
+            // Set Safe Policy value for Risk Type
+            SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
+            Date date = dateformat3.parse("15/10/2016");
+            policyParameters.setTtlDate(date);
+            // Set Safe Policy value for Guard
+            policyParameters.setGuard(true);
+            // Set Safe Policy value for Risk Level
+            policyParameters.setRiskLevel("5");
+            // Set Safe Policy value for Risk Type
+            policyParameters.setRiskType("PROD");
+
+            // API method to create or update Policy.
+            PolicyChangeResponse response = null;
+            if (!isEdit) {
+                response = policyEngine.createPolicy(policyParameters);
+            } else {
+                response = policyEngine.updatePolicy(policyParameters);
+            }
+
+            if (response.getResponseCode() == 200) {
+                System.out.println(response.getResponseMessage());
+                System.out.println("Policy Created Successfully!");
+            } else {
+                System.out.println("Error! " + response.getResponseMessage());
+            }
+        } catch (Exception e) {
+            System.err.println(e.getMessage());
+        }
+    }
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/ClosedLoopPolicyPerformanceMetricClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/ClosedLoopPolicyPerformanceMetricClient.java
index eaee2a3..bcdeaab 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/ClosedLoopPolicyPerformanceMetricClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/ClosedLoopPolicyPerformanceMetricClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,85 +43,88 @@
 import org.onap.policy.api.PolicyType;
 
 public class ClosedLoopPolicyPerformanceMetricClient {
-	
-	//For updating a ClosedLoop_Fault policy set the "isEdit" flag to true.   
-	//For creating a ClosedLoop_Fault policy set the "isEdit" flag to false.  
-	static Boolean isEdit = true;
-	     
-	//Builds JSONObject from File  
-	private static JsonObject buildJSON(File jsonInput, String jsonString) throws FileNotFoundException {
-	    JsonObject json = null;;
-	    JsonReader jsonReader = null;     
-	    if (jsonString != null && jsonInput == null) {
-	        StringReader in = null;
-	            in = new StringReader(jsonString);
-	            jsonReader = Json.createReader(in);
-	            json = jsonReader.readObject();
-	            in.close();
-	    }
-	    else {
-	        InputStream in = null;
-	        in = new FileInputStream(jsonInput);
-	        jsonReader = Json.createReader(in);
-	        json = jsonReader.readObject();
-	        try {
-				in.close();
-			} catch (IOException e) {
-				System.err.println("Exception Occured while closing input stream"+e);
-			}
-	    }
-	    jsonReader.close();   
-	    return json;
-	}
-	
-	public static void main(String[] args) {
-			try {
-				PolicyEngine policyEngine = new PolicyEngine("config.properties");
-				PolicyParameters policyParameters = new PolicyParameters();
-				// Set Policy Type 
-				policyParameters.setPolicyConfigType(PolicyConfigType.ClosedLoop_PM);
-				policyParameters.setPolicyName("MikeAPItests.ClosedLoopPmApiTest");
-				policyParameters.setPolicyDescription("This is a sample ClosedLoop_PM policy CREATE example");
-				//policyParameters.setPolicyScope("MikeAPItests");
-				
-				// Set up Micro Services Attributes 
-				File jsonFile = null;
-				String MSjsonString= null;
-				Path file = Paths.get("C:\\policyAPI\\ClosedLoopJSON\\pmTestJson.json");
-				jsonFile = file.toFile();
-				
-				policyParameters.setConfigBody(buildJSON(jsonFile, MSjsonString).toString());		
-				policyParameters.setConfigBodyType(PolicyType.JSON);
 
-				policyParameters.setRequestID(UUID.randomUUID());
-	            // Set Safe Policy value for Risk Type
-				SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
-				Date date = dateformat3.parse("15/10/2016");
-				policyParameters.setTtlDate(date);
-				// Set Safe Policy value for Guard
-				policyParameters.setGuard(true);
-				// Set Safe Policy value for Risk Level
-				policyParameters.setRiskLevel("5");
-				// Set Safe Policy value for Risk Type
-				policyParameters.setRiskType("PROD");
-				
-				// API method to create or update Policy. 
-	 	        PolicyChangeResponse response = null;
-		        if (!isEdit) {
-		            response = policyEngine.createPolicy(policyParameters);
-		        } 
-		        else {	
-		        	response = policyEngine.updatePolicy(policyParameters);
-		        }
-		        
-				if(response.getResponseCode()==200){
-					System.out.println(response.getResponseMessage());
-					System.out.println("Policy Created Successfully!");
-				}else{
-					System.out.println("Error! " + response.getResponseMessage());
-				}
-			} catch (Exception e) {
-				System.err.println(e.getMessage());
-			}
-		}
+    // For updating a ClosedLoop_Fault policy set the "isEdit" flag to true.
+    // For creating a ClosedLoop_Fault policy set the "isEdit" flag to false.
+    static Boolean isEdit = true;
+
+    // Builds JSONObject from File
+    private static JsonObject buildJson(File jsonInput, String jsonString) throws FileNotFoundException {
+        JsonObject json = null;;
+        JsonReader jsonReader = null;
+        if (jsonString != null && jsonInput == null) {
+            StringReader in = null;
+            in = new StringReader(jsonString);
+            jsonReader = Json.createReader(in);
+            json = jsonReader.readObject();
+            in.close();
+        } else {
+            InputStream in = null;
+            in = new FileInputStream(jsonInput);
+            jsonReader = Json.createReader(in);
+            json = jsonReader.readObject();
+            try {
+                in.close();
+            } catch (IOException e) {
+                System.err.println("Exception Occured while closing input stream" + e);
+            }
+        }
+        jsonReader.close();
+        return json;
+    }
+
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
+        try {
+            PolicyEngine policyEngine = new PolicyEngine("config.properties");
+            PolicyParameters policyParameters = new PolicyParameters();
+            // Set Policy Type
+            policyParameters.setPolicyConfigType(PolicyConfigType.ClosedLoop_PM);
+            policyParameters.setPolicyName("MikeAPItests.ClosedLoopPmApiTest");
+            policyParameters.setPolicyDescription("This is a sample ClosedLoop_PM policy CREATE example");
+            // policyParameters.setPolicyScope("MikeAPItests");
+
+            // Set up Micro Services Attributes
+            File jsonFile = null;
+            String msJsonString = null;
+            Path file = Paths.get("C:\\policyAPI\\ClosedLoopJSON\\pmTestJson.json");
+            jsonFile = file.toFile();
+
+            policyParameters.setConfigBody(buildJson(jsonFile, msJsonString).toString());
+            policyParameters.setConfigBodyType(PolicyType.JSON);
+
+            policyParameters.setRequestID(UUID.randomUUID());
+            // Set Safe Policy value for Risk Type
+            SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
+            Date date = dateformat3.parse("15/10/2016");
+            policyParameters.setTtlDate(date);
+            // Set Safe Policy value for Guard
+            policyParameters.setGuard(true);
+            // Set Safe Policy value for Risk Level
+            policyParameters.setRiskLevel("5");
+            // Set Safe Policy value for Risk Type
+            policyParameters.setRiskType("PROD");
+
+            // API method to create or update Policy.
+            PolicyChangeResponse response = null;
+            if (!isEdit) {
+                response = policyEngine.createPolicy(policyParameters);
+            } else {
+                response = policyEngine.updatePolicy(policyParameters);
+            }
+
+            if (response.getResponseCode() == 200) {
+                System.out.println(response.getResponseMessage());
+                System.out.println("Policy Created Successfully!");
+            } else {
+                System.out.println("Error! " + response.getResponseMessage());
+            }
+        } catch (Exception e) {
+            System.err.println(e.getMessage());
+        }
+    }
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/ConfigBasePolicyClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/ConfigBasePolicyClient.java
index cfcc146..cfc47cc 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/ConfigBasePolicyClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/ConfigBasePolicyClient.java
@@ -1,22 +1,22 @@
-    /*-
- * ============LICENSE_START=======================================================
- * PolicyEngineClient
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
+/*-
+* ============LICENSE_START=======================================================
+* PolicyEngineClient
+* ================================================================================
+* Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
+* ================================================================================
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END=========================================================
+*/
 
 package org.onap.policyengine;
 
@@ -33,59 +33,65 @@
 import org.onap.policy.api.PolicyParameters;
 import org.onap.policy.api.PolicyType;
 
-public class ConfigBasePolicyClient{
-	static Boolean isEdit = false;
-	public static void main(String[] args) {
+public class ConfigBasePolicyClient {
+    static Boolean isEdit = false;
+
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
         try {
             PolicyEngine policyEngine = new PolicyEngine("config.properties");
             PolicyParameters policyParameters = new PolicyParameters();
             // Set Policy Type
-            policyParameters.setPolicyConfigType(PolicyConfigType.Base); //required
-            policyParameters.setPolicyName("MikeConsole.testDeleteAPI6"); //required
-            policyParameters.setPolicyDescription("This is a sample Config Base policy creation example");  //optional
-            policyParameters.setOnapName("DCAE");  //required
-            policyParameters.setConfigName("testBase"); //required
-            policyParameters.setConfigBodyType(PolicyType.OTHER); //required
-            policyParameters.setConfigBody("testing");  //required
-                        
-            //Set the Config Attributes... These are Optional
-            Map<String, String> configAttributes = new HashMap<>(); 
+            policyParameters.setPolicyConfigType(PolicyConfigType.Base); // required
+            policyParameters.setPolicyName("MikeConsole.testDeleteAPI6"); // required
+            policyParameters.setPolicyDescription("This is a sample Config Base policy creation example"); // optional
+            policyParameters.setOnapName("DCAE"); // required
+            policyParameters.setConfigName("testBase"); // required
+            policyParameters.setConfigBodyType(PolicyType.OTHER); // required
+            policyParameters.setConfigBody("testing"); // required
+
+            // Set the Config Attributes... These are Optional
+            Map<String, String> configAttributes = new HashMap<>();
             configAttributes.put("Template", "SampleTemplate");
-            configAttributes.put("controller", "default"); 
+            configAttributes.put("controller", "default");
             configAttributes.put("SamPoll", "30");
-            configAttributes.put("value", "abcd"); 
-            Map<AttributeType, Map<String,String>> attributes = new HashMap<>();
+            configAttributes.put("value", "abcd");
+            Map<AttributeType, Map<String, String>> attributes = new HashMap<>();
             attributes.put(AttributeType.MATCHING, configAttributes);
             policyParameters.setAttributes(attributes);
             policyParameters.setRequestID(UUID.randomUUID());
             // Set Safe Policy value for Risk Type
-			SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
-			Date date = dateformat3.parse("15/10/2016");
-			policyParameters.setTtlDate(date);
-			// Set Safe Policy value for Guard
-			policyParameters.setGuard(true);
-			// Set Safe Policy value for Risk Level
-			policyParameters.setRiskLevel("5");
-			// Set Safe Policy value for Risk Type
-			policyParameters.setRiskType("PROD");
-            
+            SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
+            Date date = dateformat3.parse("15/10/2016");
+            policyParameters.setTtlDate(date);
+            // Set Safe Policy value for Guard
+            policyParameters.setGuard(true);
+            // Set Safe Policy value for Risk Level
+            policyParameters.setRiskLevel("5");
+            // Set Safe Policy value for Risk Type
+            policyParameters.setRiskType("PROD");
+
             // API method to create Policy or update policy
             PolicyChangeResponse response = null;
             if (!isEdit) {
                 response = policyEngine.createPolicy(policyParameters);
             } else {
-            	response = policyEngine.updatePolicy(policyParameters);
+                response = policyEngine.updatePolicy(policyParameters);
             }
-            
-            if(response.getResponseCode()==200){
+
+            if (response.getResponseCode() == 200) {
                 System.out.println(response.getResponseMessage());
                 System.out.println("Policy Created Successfully!");
-            }else{
+            } else {
                 System.out.println("Error! " + response.getResponseMessage());
             }
         } catch (Exception e) {
             System.err.println(e.getMessage());
         }
-	}
-	
+    }
+
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/ConfigFirewallPolicyClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/ConfigFirewallPolicyClient.java
index 37ec9fa..f7665f9 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/ConfigFirewallPolicyClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/ConfigFirewallPolicyClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -43,77 +43,84 @@
 import org.onap.policy.api.PolicyType;
 
 public class ConfigFirewallPolicyClient {
-	static Boolean isEdit = false;
-	public static void main(String[] args) {
-		try{	
-	        PolicyEngine policyEngine = new PolicyEngine("config.properties");
-	        PolicyParameters policyParameters = new PolicyParameters();
-	        // Set Policy Type
-	        policyParameters.setPolicyConfigType(PolicyConfigType.Firewall); //required
-	        policyParameters.setPolicyName("MikeAPItesting.testConfigFirewallPolicy1607_1"); //required
-	        //policyParameters.setPolicyScope("MikeAPItesting"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI
-	        policyParameters.setRequestID(UUID.randomUUID());
-	        
+    static Boolean isEdit = false;
+
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
+        try {
+            PolicyEngine policyEngine = new PolicyEngine("config.properties");
+            PolicyParameters policyParameters = new PolicyParameters();
+            // Set Policy Type
+            policyParameters.setPolicyConfigType(PolicyConfigType.Firewall); // required
+            policyParameters.setPolicyName("MikeAPItesting.testConfigFirewallPolicy1607_1"); // required
+            // policyParameters.setPolicyScope("MikeAPItesting"); //Directory will be created where the Policies are
+            // saved... this displays a a subscope on the GUI
+            policyParameters.setRequestID(UUID.randomUUID());
+
             // Set Safe Policy value for Risk Type
-			SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
-			Date date = dateformat3.parse("15/10/2016");
-			policyParameters.setTtlDate(date);
-			// Set Safe Policy value for Guard
-			policyParameters.setGuard(true);
-			// Set Safe Policy value for Risk Level
-			policyParameters.setRiskLevel("5");
-			// Set Safe Policy value for Risk Type
-			policyParameters.setRiskType("PROD");
-			File jsonFile = null;
-			String jsonRuleList = null;
-			Path file = Paths.get("C:\\policyAPI\\firewallRulesJSON\\Config_FW_1607Rule.json");
-			jsonFile = file.toFile();
-			
-			//buildJSON(jsonFile, jsonRuleList);
-			policyParameters.setConfigBody(buildJSON(jsonFile, jsonRuleList).toString());		
-			policyParameters.setConfigBodyType(PolicyType.JSON);
+            SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
+            Date date = dateformat3.parse("15/10/2016");
+            policyParameters.setTtlDate(date);
+            // Set Safe Policy value for Guard
+            policyParameters.setGuard(true);
+            // Set Safe Policy value for Risk Level
+            policyParameters.setRiskLevel("5");
+            // Set Safe Policy value for Risk Type
+            policyParameters.setRiskType("PROD");
+            File jsonFile = null;
+            String jsonRuleList = null;
+            Path file = Paths.get("C:\\policyAPI\\firewallRulesJSON\\Config_FW_1607Rule.json");
+            jsonFile = file.toFile();
+
+            // buildJSON(jsonFile, jsonRuleList);
+            policyParameters.setConfigBody(buildJson(jsonFile, jsonRuleList).toString());
+            policyParameters.setConfigBodyType(PolicyType.JSON);
             // API method to create Policy or update policy
             PolicyChangeResponse response = null;
             if (!isEdit) {
                 response = policyEngine.createPolicy(policyParameters);
             } else {
-            	response = policyEngine.updatePolicy(policyParameters);
+                response = policyEngine.updatePolicy(policyParameters);
             }
-            
-            if(response.getResponseCode()==200){
-	            System.out.println(response.getResponseMessage());
-	            System.out.println("Policy Created Successfully!");
-	        }else{
-	            System.out.println("Error! " + response.getResponseMessage());
-	        }
-	    } catch (Exception e) {
-	        System.err.println(e.getMessage());
-	    }
-		
-}
-	
-	private static JsonObject buildJSON(File jsonInput, String jsonString) throws FileNotFoundException {
-		JsonObject json = null;
-		JsonReader jsonReader = null;
-		if (jsonString != null && jsonInput == null) {
-			StringReader in = null;
-			in = new StringReader(jsonString);
-			jsonReader = Json.createReader(in);
-			json = jsonReader.readObject();
-			in.close();
-		} else {
-			InputStream in = null;
-			in = new FileInputStream(jsonInput); 
-			jsonReader = Json.createReader(in);
-			json = jsonReader.readObject();
-			try {
-				in.close();
-			} catch (IOException e) {
-				System.err.println("Exception Occured while closing input stream"+e);
-			}
-		}
-		jsonReader.close();
-		return json;
-	}
+
+            if (response.getResponseCode() == 200) {
+                System.out.println(response.getResponseMessage());
+                System.out.println("Policy Created Successfully!");
+            } else {
+                System.out.println("Error! " + response.getResponseMessage());
+            }
+        } catch (Exception e) {
+            System.err.println(e.getMessage());
+        }
+
+    }
+
+    private static JsonObject buildJson(File jsonInput, String jsonString) throws FileNotFoundException {
+        JsonObject json = null;
+        JsonReader jsonReader = null;
+        if (jsonString != null && jsonInput == null) {
+            StringReader in = null;
+            in = new StringReader(jsonString);
+            jsonReader = Json.createReader(in);
+            json = jsonReader.readObject();
+            in.close();
+        } else {
+            InputStream in = null;
+            in = new FileInputStream(jsonInput);
+            jsonReader = Json.createReader(in);
+            json = jsonReader.readObject();
+            try {
+                in.close();
+            } catch (IOException e) {
+                System.err.println("Exception Occured while closing input stream" + e);
+            }
+        }
+        jsonReader.close();
+        return json;
+    }
 
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/DecisionPolicyClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/DecisionPolicyClient.java
index 2ef2d3b..44fb455 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/DecisionPolicyClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/DecisionPolicyClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,81 +34,90 @@
 import org.onap.policy.api.PolicyParameters;
 
 public class DecisionPolicyClient {
-	static Boolean isEdit = true;
-	public static void main(String[] args) {
-		try {
-	        PolicyEngine policyEngine = new PolicyEngine("config.properties");
-	        PolicyParameters policyParameters = new PolicyParameters();
-	        // Set Policy Type
-	        policyParameters.setPolicyClass(PolicyClass.Decision); //required
-	        policyParameters.setPolicyName("MikeAPItests.testDecisionAPI"); //required
-	        policyParameters.setOnapName("java"); //required
-	        policyParameters.setPolicyDescription("This is a sample Decision policy UPDATE example with Settings");  //optional
-	        //policyParameters.setPolicyScope("MikeAPItests"); //Directory will be created where the Policies are saved... this displays a a subscope on the GUI
-	        
-	        //Set the Component Attributes... These are Optional
-	        Map<String, String> configAttributes = new HashMap<>(); 
-	        configAttributes.put("Template", "UpdateTemplate");
-	        configAttributes.put("controller", "default"); 
-	        configAttributes.put("SamPoll", "30");
-	        configAttributes.put("value", "abcd"); 
-	        
-	        Map<AttributeType, Map<String,String>> attributes = new HashMap<>();
-	        attributes.put(AttributeType.MATCHING, configAttributes);
-	        
-	        //Set the settings... These are Optional
-	        Map<String, String> settingsMap = new HashMap<>();
-	        settingsMap.put("server", "5");
-	        
-	        attributes.put(AttributeType.SETTINGS, settingsMap);
-	        policyParameters.setAttributes(attributes);
+    static Boolean isEdit = true;
 
-	        
-			List<String> dynamicRuleAlgorithmLabels = new LinkedList<>();
-			List<String> dynamicRuleAlgorithmFunctions = new LinkedList<>();
-			List<String> dynamicRuleAlgorithmField1 = new LinkedList<>();
-			List<String> dynamicRuleAlgorithmField2 = new LinkedList<>();
-			
-			//Example of a complex Rule algorithm using the settings in the Field1
-			/* label 	field1     	function				field2
-			 * *****************************************************
-			 * A1   	S_server   	integer-equal   			90
-			 * A2   	cap     	string-contains     		ca
-			 * A3		cobal		integer-equal				90	
-			 * A4		A2			and							A3
-			 * A5		Config		integer-greater-than		45
-			 * A6		A4	`		or							A5
-			 * A7		A1			and							A6
-			 */
-			dynamicRuleAlgorithmLabels = Arrays.asList("A1","A2","A3","A4","A5","A6","A7");
-			dynamicRuleAlgorithmField1 = Arrays.asList("S_server","cap","cobal","A2","Config","A4","A1");
-			dynamicRuleAlgorithmFunctions = Arrays.asList("integer-equal","string-contains","integer-equal","and","integer-greater-than","or","and");
-			dynamicRuleAlgorithmField2 = Arrays.asList("90","ca","90","A3","45","A5","A6");
-			        
-			policyParameters.setDynamicRuleAlgorithmLabels(dynamicRuleAlgorithmLabels);
-			policyParameters.setDynamicRuleAlgorithmField1(dynamicRuleAlgorithmField1);
-			policyParameters.setDynamicRuleAlgorithmFunctions(dynamicRuleAlgorithmFunctions);
-			policyParameters.setDynamicRuleAlgorithmField2(dynamicRuleAlgorithmField2);
-			
-	        policyParameters.setRequestID(UUID.randomUUID());
-	        
-	        // API method to create Policy or update policy
-	        PolicyChangeResponse response = null;
-	        if (!isEdit) {
-	            response = policyEngine.createPolicy(policyParameters);
-	        } else {
-	        	response = policyEngine.updatePolicy(policyParameters);
-	        }
-	        
-	        if(response.getResponseCode()==200){
-	            System.out.println(response.getResponseMessage());
-	            System.out.println("Policy Created Successfully!");
-	        }else{
-	            System.out.println("Error! " + response.getResponseMessage());
-	        }
-		} catch (Exception e) {
-			System.err.println(e.getMessage());
-		}
-	}
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
+        try {
+            PolicyEngine policyEngine = new PolicyEngine("config.properties");
+            PolicyParameters policyParameters = new PolicyParameters();
+            // Set Policy Type
+            policyParameters.setPolicyClass(PolicyClass.Decision); // required
+            policyParameters.setPolicyName("MikeAPItests.testDecisionAPI"); // required
+            policyParameters.setOnapName("java"); // required
+            policyParameters.setPolicyDescription(
+                    "This is a sample Decision policy UPDATE example with Settings"); // optional
+            // policyParameters.setPolicyScope("MikeAPItests"); //Directory will be created where the Policies are
+            // saved... this displays a a subscope on the GUI
+
+            // Set the Component Attributes... These are Optional
+            Map<String, String> configAttributes = new HashMap<>();
+            configAttributes.put("Template", "UpdateTemplate");
+            configAttributes.put("controller", "default");
+            configAttributes.put("SamPoll", "30");
+            configAttributes.put("value", "abcd");
+
+            Map<AttributeType, Map<String, String>> attributes = new HashMap<>();
+            attributes.put(AttributeType.MATCHING, configAttributes);
+
+            // Set the settings... These are Optional
+            Map<String, String> settingsMap = new HashMap<>();
+            settingsMap.put("server", "5");
+
+            attributes.put(AttributeType.SETTINGS, settingsMap);
+            policyParameters.setAttributes(attributes);
+
+            List<String> dynamicRuleAlgorithmLabels = new LinkedList<>();
+            List<String> dynamicRuleAlgorithmFunctions = new LinkedList<>();
+            List<String> dynamicRuleAlgorithmField1 = new LinkedList<>();
+
+            // Example of a complex Rule algorithm using the settings in the Field1
+            /*
+             * label field1 function field2
+             * *****************************************************
+             * A1 S_server integer-equal 90
+             * A2 cap string-contains ca
+             * A3 cobal integer-equal 90
+             * A4 A2 and A3
+             * A5 Config integer-greater-than 45
+             * A6 A4 ` or A5
+             * A7 A1 and A6
+             */
+            dynamicRuleAlgorithmLabels = Arrays.asList("A1", "A2", "A3", "A4", "A5", "A6", "A7");
+            dynamicRuleAlgorithmField1 = Arrays.asList("S_server", "cap", "cobal", "A2", "Config", "A4", "A1");
+            dynamicRuleAlgorithmFunctions = Arrays.asList("integer-equal", "string-contains", "integer-equal", "and",
+                    "integer-greater-than", "or", "and");
+            List<String> dynamicRuleAlgorithmField2 = new LinkedList<>();
+            dynamicRuleAlgorithmField2 = Arrays.asList("90", "ca", "90", "A3", "45", "A5", "A6");
+
+            policyParameters.setDynamicRuleAlgorithmLabels(dynamicRuleAlgorithmLabels);
+            policyParameters.setDynamicRuleAlgorithmField1(dynamicRuleAlgorithmField1);
+            policyParameters.setDynamicRuleAlgorithmFunctions(dynamicRuleAlgorithmFunctions);
+            policyParameters.setDynamicRuleAlgorithmField2(dynamicRuleAlgorithmField2);
+
+            policyParameters.setRequestID(UUID.randomUUID());
+
+            // API method to create Policy or update policy
+            PolicyChangeResponse response = null;
+            if (!isEdit) {
+                response = policyEngine.createPolicy(policyParameters);
+            } else {
+                response = policyEngine.updatePolicy(policyParameters);
+            }
+
+            if (response.getResponseCode() == 200) {
+                System.out.println(response.getResponseMessage());
+                System.out.println("Policy Created Successfully!");
+            } else {
+                System.out.println("Error! " + response.getResponseMessage());
+            }
+        } catch (Exception e) {
+            System.err.println(e.getMessage());
+        }
+    }
 
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/DeletePolicyClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/DeletePolicyClient.java
index c660679..e411a4c 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/DeletePolicyClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/DeletePolicyClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,36 +27,39 @@
 
 public class DeletePolicyClient {
 
-	public static void main(String[] args) {
-		try {
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
+        try {
+            DeletePolicyParameters policyParameters = new DeletePolicyParameters();
 
-			PolicyEngine policyEngine = new PolicyEngine("config.properties");
-			DeletePolicyParameters policyParameters = new DeletePolicyParameters();			
-						
-			//Parameter arguments
-			policyParameters.setPolicyName("MikeConsole.Config_testDeleteAPI6.1.xml");
-			policyParameters.setPolicyComponent("PDP");
-			policyParameters.setPdpGroup("default");
-			policyParameters.setDeleteCondition(DeletePolicyCondition.ALL);
-			policyParameters.setRequestID(null);
-			
+            // Parameter arguments
+            policyParameters.setPolicyName("MikeConsole.Config_testDeleteAPI6.1.xml");
+            policyParameters.setPolicyComponent("PDP");
+            policyParameters.setPdpGroup("default");
+            policyParameters.setDeleteCondition(DeletePolicyCondition.ALL);
+            policyParameters.setRequestID(null);
+
             // API method to Push Policy to PDP
             PolicyChangeResponse response = null;
+            PolicyEngine policyEngine = new PolicyEngine("config.properties");
             response = policyEngine.deletePolicy(policyParameters);
 
-            if(response.getResponseCode()==200){
+            if (response.getResponseCode() == 200) {
                 System.out.println(response.getResponseMessage());
                 System.out.println("Policy Deleted Successfully!");
-            }else{
+            } else {
                 System.out.println("Error! " + response.getResponseMessage());
             }
 
-		} catch (Exception e) {
-			System.err.println(e.getMessage());		
-			
-		}
-		
-	}
-	
+        } catch (Exception e) {
+            System.err.println(e.getMessage());
+
+        }
+
+    }
 
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/GeneralTestClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/GeneralTestClient.java
index 4c5a262..77a1227 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/GeneralTestClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/GeneralTestClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,6 +17,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policyengine;
 
 import java.io.FileNotFoundException;
@@ -43,347 +44,315 @@
  * Class reads from .testCases file and run the test cases available in the file
  * and generates output for each test cases specifing whether is passed or fail
  * and reason why it fails.
- * 
- * 
+ *
+ *
  * @version 1.0
  *
  */
 public class GeneralTestClient {
-	
-	private static final Logger LOGGER	= FlexLogger.getLogger(GeneralTestClient.class);
-	
-	static int totalTC = 0, passTC = 0, failTC = 0;
 
-	public static void main(String[] args) {
-		Path file;
-		/* command line arguments */
-		if (args.length != 0) {
-			for (int index = 0; index < args.length; index++) {
-				// System.out.println(args[index]);
-				file = Paths.get(args[index]);
-				runTestClientOnConfigFile(file);
-			}
-		} else {
-			/* default file */
-			file = Paths.get("input.testCases");
-			runTestClientOnConfigFile(file);
-		}
-		System.out
-		.println("###############################################################################################");
-		System.out.println("\n\t SUMMARY: TOTAL: " + totalTC + ",\tPASS: "
-				+ passTC + ",\tFAIL: " + failTC + "\n");
-		System.out
-		.println("###############################################################################################");
+    private static final Logger LOGGER = FlexLogger.getLogger(GeneralTestClient.class);
 
-		System.out.println("Enter a any key to exit");
-		try {
-			System.in.read();
-		} catch (IOException e) {
-			//
-		}
+    static int totalTC = 0;
+    static int passTC = 0;
+    static int failTC = 0;
 
-	}
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
+        Path file;
+        /* command line arguments */
+        if (args.length != 0) {
+            for (int index = 0; index < args.length; index++) {
+                // System.out.println(args[index]);
+                file = Paths.get(args[index]);
+                runTestClientOnConfigFile(file);
+            }
+        } else {
+            /* default file */
+            file = Paths.get("input.testCases");
+            runTestClientOnConfigFile(file);
+        }
+        System.out.println(
+                "###############################################################################################");
+        System.out.println("\n\t SUMMARY: TOTAL: " + totalTC + ",\tPASS: " + passTC + ",\tFAIL: " + failTC + "\n");
+        System.out.println(
+                "###############################################################################################");
 
-	/**
-	 * This function reads the files passed as arguments and runs the test cases
-	 * in the file
-	 *
-	 * @param file
-	 */
-	private static void runTestClientOnConfigFile(Path file) {
-		String resultReturned, onapComponentName;
-		int totalTCforFile = 0, passTCforFile = 0, failTCforFile = 0;
-		System.out
-		.println("\n###############################################################################################");
-		System.out.println("\tRuning test Client on Config file: " + file);
-		System.out
-		.println("###############################################################################################\n");
+        System.out.println("Enter a any key to exit");
+        try {
+            System.in.read();
+        } catch (IOException e) {
+            //
+        }
 
-		if (Files.notExists(file)) {
-			System.out.println("file doesnot exist");
-			// throw new
-			// PolicyEngineException("File doesn't exist in the specified Path "
-			// + file.toString());
-		} else if (file.toString().endsWith(".testCases")) {
-			try {
-				// read the json file
-				FileReader reader = new FileReader(file.toString());
+    }
 
-				JSONParser jsonParser = new JSONParser();
-				JSONArray jsonObjectArray = (JSONArray) jsonParser
-						.parse(reader);
-				for (Object jsonObject : jsonObjectArray) {
-					totalTC++;
-					totalTCforFile++;
-					ArrayList<String> expectedResult = new ArrayList<>();
-					ArrayList<String> resultReceived = new ArrayList<>();
-					JSONObject testCase = (JSONObject) jsonObject;
-					// get a String from the JSON object
-					long id = (long) testCase.get("id");
-					String testFor = (String) testCase.get("testFor");
-					String testCaseDescription = (String) testCase
-							.get("testCaseDescription");
-					JSONArray expectedResultJson = (JSONArray) testCase
-							.get("expectedResult");
-					@SuppressWarnings("rawtypes")
-					Iterator i = expectedResultJson.iterator();
-					while (i.hasNext()) {
-						expectedResult.add((String) i.next());
-					}
-					String pdp_urlConfigFile = (String) testCase
-							.get("PDP_URLConfigFile");
-					// System.out.println(pdp_urlConfigFile);
-					PolicyEngine policyEngine;
-					try {
-						policyEngine = new PolicyEngine(pdp_urlConfigFile);
+    /**
+     * This function reads the files passed as arguments and runs the test cases
+     * in the file.
+     *
+     * @param file Path
+     */
+    private static void runTestClientOnConfigFile(Path file) {
+        String resultReturned;
+        String onapComponentName;
+        int totalTCforFile = 0;
+        int passTCforFile = 0;
+        int failTCforFile = 0;
+        System.out.println(
+                "\n###############################################################################################");
+        System.out.println("\tRuning test Client on Config file: " + file);
+        System.out.println(
+                "###############################################################################################\n");
 
-						switch (testFor) {
+        if (Files.notExists(file)) {
+            System.out.println("file doesnot exist");
+            // throw new
+            // PolicyEngineException("File doesn't exist in the specified Path "
+            // + file.toString());
+        } else if (file.toString().endsWith(".testCases")) {
+            try {
+                // read the json file
+                FileReader reader = new FileReader(file.toString());
 
-						case "getConfig":
-							onapComponentName = (String) testCase
-							.get("ONAPName");
-							String configName = (String) testCase
-									.get("ConfigName");
-							Map<String, String> configAttributes = new HashMap<>();
-							configAttributes.put("key", "value");
-							JSONArray configAttributesJSON = (JSONArray) testCase
-									.get("configAttributes");
-							if(configAttributesJSON!=null){
-							i = configAttributesJSON.iterator();
-							while (i.hasNext()) {
-								JSONObject innerObj = (JSONObject) i.next();
-								configAttributes.put(
-										(String) innerObj.get("key"),
-										(String) innerObj.get("value"));
+                JSONParser jsonParser = new JSONParser();
+                JSONArray jsonObjectArray = (JSONArray) jsonParser.parse(reader);
+                for (Object jsonObject : jsonObjectArray) {
+                    totalTC++;
+                    totalTCforFile++;
+                    ArrayList<String> expectedResult = new ArrayList<>();
+                    ArrayList<String> resultReceived = new ArrayList<>();
+                    JSONObject testCase = (JSONObject) jsonObject;
+                    // get a String from the JSON object
+                    long id = (long) testCase.get("id");
+                    String testFor = (String) testCase.get("testFor");
+                    String testCaseDescription = (String) testCase.get("testCaseDescription");
+                    JSONArray expectedResultJson = (JSONArray) testCase.get("expectedResult");
+                    @SuppressWarnings("rawtypes")
+                    Iterator iter = expectedResultJson.iterator();
+                    while (iter.hasNext()) {
+                        expectedResult.add((String) iter.next());
+                    }
+                    String pdpUrlConfigFile = (String) testCase.get("PDP_URLConfigFile");
+                    // System.out.println(pdp_urlConfigFile);
+                    PolicyEngine policyEngine;
+                    try {
+                        policyEngine = new PolicyEngine(pdpUrlConfigFile);
 
-							}
-							}else{
-								configAttributes = null;
-							}
-							resultReceived = PolicyEngineTestClient.getConfig(
-									policyEngine, onapComponentName,
-									configName, configAttributes);
-							Collections.sort(expectedResult);
-							Collections.sort(resultReceived);
-							resultReturned = compareResults(expectedResult,resultReceived);
-							if (resultReturned.equals("PASSED")) {
-								printResult(id, testFor, testCaseDescription,
-										"PASSED");
-								passTCforFile++;
-								passTC++;
-							} else {
-								printResult(id, testFor, testCaseDescription,
-										"FAILED", resultReturned);
-								failTCforFile++;
-								failTC++;
-							}
-							break;
+                        switch (testFor) {
 
-						case "getAction":
-							Map<String, String> eventAttributes = new HashMap<>();
-							eventAttributes.put("Key", "Value");
-							JSONArray eventAttributesJSON = (JSONArray) testCase
-									.get("eventAttributes");
-							if(eventAttributesJSON != null){
-							i = eventAttributesJSON.iterator();
-							while (i.hasNext()) {
-								JSONObject innerObj = (JSONObject) i.next();
-								eventAttributes.put(
-										(String) innerObj.get("key"),
-										(String) innerObj.get("value"));
-							}
-							}else{
-								eventAttributes=null;
-							}
-							resultReceived = PolicyEngineTestClient.getAction(
-									policyEngine, eventAttributes);
-							Collections.sort(expectedResult);
-							Collections.sort(resultReceived);
-							resultReturned = compareResults(expectedResult,
-									resultReceived);
-							if (resultReturned.equals("PASSED")) {
-								printResult(id, testFor, testCaseDescription,
-										"PASSED");
-								passTCforFile++;
-								passTC++;
-							} else {
-								printResult(id, testFor, testCaseDescription,
-										"FAILED", resultReturned);
-								failTCforFile++;
-								failTC++;
-							}
-							break;
+                            case "getConfig":
+                                onapComponentName = (String) testCase.get("ONAPName");
+                                String configName = (String) testCase.get("ConfigName");
+                                Map<String, String> configAttributes = new HashMap<>();
+                                configAttributes.put("key", "value");
+                                JSONArray configAttributesJson = (JSONArray) testCase.get("configAttributes");
+                                if (configAttributesJson != null) {
+                                    iter = configAttributesJson.iterator();
+                                    while (iter.hasNext()) {
+                                        JSONObject innerObj = (JSONObject) iter.next();
+                                        configAttributes.put((String) innerObj.get("key"),
+                                                (String) innerObj.get("value"));
 
-						case "getDecision":
-							onapComponentName = (String) testCase
-							.get("ONAPName");
-							Map<String, String> decisionAttributes = new HashMap<>();
-							decisionAttributes.put("Key", "Value");
-							JSONArray decisionAttributesJSON = (JSONArray) testCase
-									.get("decisionAttributes");
-							i = decisionAttributesJSON.iterator();
-							while (i.hasNext()) {
-								JSONObject innerObj = (JSONObject) i.next();
-								decisionAttributes.put(
-										(String) innerObj.get("key"),
-										(String) innerObj.get("value"));
+                                    }
+                                } else {
+                                    configAttributes = null;
+                                }
+                                resultReceived = PolicyEngineTestClient.getConfig(policyEngine, onapComponentName,
+                                        configName, configAttributes);
+                                Collections.sort(expectedResult);
+                                Collections.sort(resultReceived);
+                                resultReturned = compareResults(expectedResult, resultReceived);
+                                if (resultReturned.equals("PASSED")) {
+                                    printResult(id, testFor, testCaseDescription, "PASSED");
+                                    passTCforFile++;
+                                    passTC++;
+                                } else {
+                                    printResult(id, testFor, testCaseDescription, "FAILED", resultReturned);
+                                    failTCforFile++;
+                                    failTC++;
+                                }
+                                break;
 
-							}
-							
-							resultReceived = PolicyEngineTestClient
-									.getDecision(policyEngine,
-											onapComponentName,
-											decisionAttributes);
-							Collections.sort(expectedResult);
-							Collections.sort(resultReceived);
-							resultReturned = compareResults(expectedResult,
-									resultReceived);
-							if (resultReturned.equals("PASSED")) {
-								printResult(id, testFor, testCaseDescription,
-										"PASSED");
-								passTCforFile++;
-								passTC++;
-							} else {
-								printResult(id, testFor, testCaseDescription,
-										"FAILED", resultReturned);
-								failTCforFile++;
-								failTC++;
-							}
-							break;
+                            case "getAction":
+                                Map<String, String> eventAttributes = new HashMap<>();
+                                eventAttributes.put("Key", "Value");
+                                JSONArray eventAttributesJson = (JSONArray) testCase.get("eventAttributes");
+                                if (eventAttributesJson != null) {
+                                    iter = eventAttributesJson.iterator();
+                                    while (iter.hasNext()) {
+                                        JSONObject innerObj = (JSONObject) iter.next();
+                                        eventAttributes.put((String) innerObj.get("key"),
+                                                (String) innerObj.get("value"));
+                                    }
+                                } else {
+                                    eventAttributes = null;
+                                }
+                                resultReceived = PolicyEngineTestClient.getAction(policyEngine, eventAttributes);
+                                Collections.sort(expectedResult);
+                                Collections.sort(resultReceived);
+                                resultReturned = compareResults(expectedResult, resultReceived);
+                                if (resultReturned.equals("PASSED")) {
+                                    printResult(id, testFor, testCaseDescription, "PASSED");
+                                    passTCforFile++;
+                                    passTC++;
+                                } else {
+                                    printResult(id, testFor, testCaseDescription, "FAILED", resultReturned);
+                                    failTCforFile++;
+                                    failTC++;
+                                }
+                                break;
 
-							// case "getManualNotification":
-							// PolicyEngineTestClient
-							// .getManualNotifications(org.onap.policyEngine);
-							// break;
-							// case "getAutoNotification":
-							// PolicyEngineTestClient
-							// .getAutoNotifications(org.onap.policyEngine);
-							// break;
+                            case "getDecision":
+                                onapComponentName = (String) testCase.get("ONAPName");
+                                Map<String, String> decisionAttributes = new HashMap<>();
+                                decisionAttributes.put("Key", "Value");
+                                JSONArray decisionAttributesJson = (JSONArray) testCase.get("decisionAttributes");
+                                iter = decisionAttributesJson.iterator();
+                                while (iter.hasNext()) {
+                                    JSONObject innerObj = (JSONObject) iter.next();
+                                    decisionAttributes.put((String) innerObj.get("key"),
+                                            (String) innerObj.get("value"));
 
-						default:
-							printResult(id, testFor, testCaseDescription,
-									"FAILED", "\tINVAILD TEST CASE.");
-							failTCforFile++;
-							failTC++;
-							break;
+                                }
 
-						}
-					} catch (PolicyEngineException e) {
-						printResult(id, testFor, testCaseDescription, "FAILED");
-						failTCforFile++;
-						failTC++;
-						LOGGER.error("Exception Occured"+e);
-					} catch (Exception e) {
-						printResult(id, testFor, testCaseDescription, "FAILED");
-						failTCforFile++;
-						failTC++;
-						LOGGER.error("Exception Occured"+e);
-					}
-				}
+                                resultReceived = PolicyEngineTestClient.getDecision(policyEngine, onapComponentName,
+                                        decisionAttributes);
+                                Collections.sort(expectedResult);
+                                Collections.sort(resultReceived);
+                                resultReturned = compareResults(expectedResult, resultReceived);
+                                if (resultReturned.equals("PASSED")) {
+                                    printResult(id, testFor, testCaseDescription, "PASSED");
+                                    passTCforFile++;
+                                    passTC++;
+                                } else {
+                                    printResult(id, testFor, testCaseDescription, "FAILED", resultReturned);
+                                    failTCforFile++;
+                                    failTC++;
+                                }
+                                break;
 
-			} catch (FileNotFoundException ex) {
-				LOGGER.error("Exception Occured due to File not found"+ex);
-			} catch (IOException ex) {
-				LOGGER.error("Exception Occured"+ex);
-			} catch (NullPointerException ex) {
-				LOGGER.error("Exception Occured due to Null Pointer"+ex);
-			} catch (org.json.simple.parser.ParseException e) {
-				LOGGER.error("Exception Occured while Parsing"+e);
-			}
-		}
-		System.out.println("\n\n\t Summary for the file: TOTAL: "
-				+ totalTCforFile + ",\tPASS: " + passTCforFile + ",\tFAIL: "
-				+ failTCforFile + "\n");
-	}
+                            // case "getManualNotification":
+                            // PolicyEngineTestClient
+                            // .getManualNotifications(org.onap.policyEngine);
+                            // break;
+                            // case "getAutoNotification":
+                            // PolicyEngineTestClient
+                            // .getAutoNotifications(org.onap.policyEngine);
+                            // break;
 
-	/**
-	 * This function prints the reason if test fails.
-	 * 
-	 * @param id
-	 * @param testFor
-	 * @param testCaseDescription
-	 * @param passFail
-	 * @param resultReturned
-	 */
-	private static void printResult(long id, String testFor,
-			String testCaseDescription, String passFail, String resultReturned) {
-		// TODO Auto-generated method stub
-		printResult(id, testFor, testCaseDescription, passFail);
-		System.out.println(resultReturned);
+                            default:
+                                printResult(id, testFor, testCaseDescription, "FAILED", "\tINVAILD TEST CASE.");
+                                failTCforFile++;
+                                failTC++;
+                                break;
 
-	}
+                        }
+                    } catch (PolicyEngineException e) {
+                        printResult(id, testFor, testCaseDescription, "FAILED");
+                        failTCforFile++;
+                        failTC++;
+                        LOGGER.error("Exception Occured" + e);
+                    } catch (Exception e) {
+                        printResult(id, testFor, testCaseDescription, "FAILED");
+                        failTCforFile++;
+                        failTC++;
+                        LOGGER.error("Exception Occured" + e);
+                    }
+                }
 
-	/**
-	 * This function prints in output in required format.
-	 * 
-	 * @param id
-	 * @param testFor
-	 * @param testCaseDescription
-	 * @param result
-	 */
-	private static void printResult(long id, String testFor,
-			String testCaseDescription, String result) {
-		System.out.println(result + " - Test Case " + id + " - Test type: "
-				+ testFor + " - " + testCaseDescription);
-	}
+            } catch (FileNotFoundException ex) {
+                LOGGER.error("Exception Occured due to File not found" + ex);
+            } catch (IOException ex) {
+                LOGGER.error("Exception Occured" + ex);
+            } catch (NullPointerException ex) {
+                LOGGER.error("Exception Occured due to Null Pointer" + ex);
+            } catch (org.json.simple.parser.ParseException e) {
+                LOGGER.error("Exception Occured while Parsing" + e);
+            }
+        }
+        System.out.println("\n\n\t Summary for the file: TOTAL: " + totalTCforFile + ",\tPASS: " + passTCforFile
+                + ",\tFAIL: " + failTCforFile + "\n");
+    }
 
-	/**
-	 * This function compares the required expected output and received output
-	 * and returns PASS if expected output and received output matches
-	 * 
-	 * @param expectedResult
-	 * @param resultReceived
-	 * @return
-	 */
-	private static String compareResults(ArrayList<String> expectedResult,
-			ArrayList<String> resultReceived) {
-		// TODO Auto-generated method stub
-		String returnString = "";
-		int index;
-//		System.out.println(expectedResult.size());
-//		System.out.println(resultReceived.size());
-		for (index = 0; index < expectedResult.size()
-				|| index < resultReceived.size(); index++) {
-			if (index < expectedResult.size() && index < resultReceived.size()) {
-				if (!expectedResult.get(index)
-						.equals(resultReceived.get(index))) {
-					//returnString = "FAILED";
-					returnString += "\tExpected Output: "
-							+ expectedResult.get(index)
-							+ ",\n\tOutput Received: "
-							+ resultReceived.get(index)+"\n";
-//				
-					//System.out.println(resultReceived.get(index));
-				} 
+    /**
+     * This function prints the reason if test fails.
+     *
+     * @param id long
+     * @param testFor String
+     * @param testCaseDescription String
+     * @param passFail String
+     * @param resultReturned String
+     */
+    private static void printResult(long id, String testFor, String testCaseDescription, String passFail,
+            String resultReturned) {
+        // TODO Auto-generated method stub
+        printResult(id, testFor, testCaseDescription, passFail);
+        System.out.println(resultReturned);
 
-			} else {
-				if (index >= expectedResult.size()) {
-					returnString += "\tExpected Size of output: "
-							+ expectedResult.size()
-							+ ", Size of output received: "
-							+ resultReceived.size()
-							+ "\n\tExpected Output: none,\n\tOutput Received: "
-							+ resultReceived.get(index)+"\n";
+    }
 
-				} else {
-					if (index >= resultReceived.size()) {
-						returnString += "\tExpected Size of output: "
-								+ expectedResult.size()
-								+ ", Size of output received: "
-								+ resultReceived.size()
-								+ "\n\tExpected Output: "
-								+ expectedResult.get(index)
-								+ ",\n\tOutput Received: none\n";
+    /**
+     * This function prints in output in required format.
+     *
+     * @param id long
+     * @param testFor String
+     * @param testCaseDescription String
+     * @param result String
+     */
+    private static void printResult(long id, String testFor, String testCaseDescription, String result) {
+        System.out.println(result + " - Test Case " + id + " - Test type: " + testFor + " - " + testCaseDescription);
+    }
 
-					}
-				}
-			}
+    /**
+     * This function compares the required expected output and received output
+     * and returns PASS if expected output and received output matches.
+     *
+     * @param expectedResult ArrayList of Strings
+     * @param resultReceived ArrayList of Strings
+     * @return String
+     */
+    private static String compareResults(ArrayList<String> expectedResult, ArrayList<String> resultReceived) {
+        // TODO Auto-generated method stub
+        String returnString = "";
+        int index;
+        // System.out.println(expectedResult.size());
+        // System.out.println(resultReceived.size());
+        for (index = 0; index < expectedResult.size() || index < resultReceived.size(); index++) {
+            if (index < expectedResult.size() && index < resultReceived.size()) {
+                if (!expectedResult.get(index).equals(resultReceived.get(index))) {
+                    // returnString = "FAILED";
+                    returnString += "\tExpected Output: " + expectedResult.get(index) + ",\n\tOutput Received: "
+                            + resultReceived.get(index) + "\n";
+                    //
+                    // System.out.println(resultReceived.get(index));
+                }
 
-		}
-		if(index==expectedResult.size() && index==resultReceived.size() && returnString.equals("")){
-			returnString="PASSED";
-		}
-		return returnString;
+            } else {
+                if (index >= expectedResult.size()) {
+                    returnString += "\tExpected Size of output: " + expectedResult.size()
+                            + ", Size of output received: " + resultReceived.size()
+                            + "\n\tExpected Output: none,\n\tOutput Received: " + resultReceived.get(index) + "\n";
 
-	}
+                } else {
+                    if (index >= resultReceived.size()) {
+                        returnString += "\tExpected Size of output: " + expectedResult.size()
+                                + ", Size of output received: " + resultReceived.size() + "\n\tExpected Output: "
+                                + expectedResult.get(index) + ",\n\tOutput Received: none\n";
+
+                    }
+                }
+            }
+
+        }
+        if (index == expectedResult.size() && index == resultReceived.size() && returnString.equals("")) {
+            returnString = "PASSED";
+        }
+        return returnString;
+
+    }
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/GetConfigSample.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/GetConfigSample.java
index 94cc69f..033ecca 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/GetConfigSample.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/GetConfigSample.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,14 +28,19 @@
 
 public class GetConfigSample {
 
-	public static void main(String[] args) throws Exception {
-		PolicyEngine pe = new PolicyEngine("config.properties");
-		ConfigRequestParameters configRequestParams = new ConfigRequestParameters();
-		configRequestParams.setPolicyName(".*");
-		Collection<PolicyConfig> configs = pe.getConfig(configRequestParams);
-		for (PolicyConfig config: configs){
-			System.out.println(config.getPolicyConfigMessage());
-			System.out.println(config.getPolicyConfigStatus());
-		}
-	}
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) throws Exception {
+        PolicyEngine pe = new PolicyEngine("config.properties");
+        ConfigRequestParameters configRequestParams = new ConfigRequestParameters();
+        configRequestParams.setPolicyName(".*");
+        Collection<PolicyConfig> configs = pe.getConfig(configRequestParams);
+        for (PolicyConfig config : configs) {
+            System.out.println(config.getPolicyConfigMessage());
+            System.out.println(config.getPolicyConfigStatus());
+        }
+    }
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/Handler.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/Handler.java
index 12fca6e..243c860 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/Handler.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/Handler.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -35,93 +35,93 @@
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
 
-public class Handler implements NotificationHandler{
+public class Handler implements NotificationHandler {
 
-	private static final Logger LOGGER	= FlexLogger.getLogger(Handler.class);
-	
-	@Override
-	public void notificationReceived(PDPNotification notification) {
-		System.out.println("Notification Received...");
-		System.out.println(notification.getNotificationType());
-		if(notification.getNotificationType().equals(NotificationType.REMOVE)){                                                                                             
-			System.out.println("Removed Policies: \n");
-			for(RemovedPolicy removedPolicy: notification.getRemovedPolicies()){
-				System.out.println(removedPolicy.getPolicyName());
-				System.out.println(removedPolicy.getVersionNo());
-			}
-		}else if(notification.getNotificationType().equals(NotificationType.UPDATE)){
-			System.out.println("Updated Policies: \n");
-			for(LoadedPolicy updatedPolicy: notification.getLoadedPolicies()){
-				System.out.println("policyName : " + updatedPolicy.getPolicyName());
-				System.out.println("policyVersion :" + updatedPolicy.getVersionNo());
-				if(updatedPolicy.getPolicyName().contains(".Config_")){
-					System.out.println("Matches: " + updatedPolicy.getMatches());
-					System.out.println("UpdateType: "+ updatedPolicy.getUpdateType());
-					// Checking the Name is correct or not. 
-					try {
-						PolicyEngine policyEngine = new PolicyEngine("config.properties");
-						@SuppressWarnings("deprecation")
-						Collection<PolicyConfig> policyConfigs = policyEngine.getConfigByPolicyName(updatedPolicy.getPolicyName());
-						for(PolicyConfig policyConfig: policyConfigs){
-							if(policyConfig.getPolicyConfigStatus().equals(PolicyConfigStatus.CONFIG_RETRIEVED)){
-								System.out.println("Policy Retrieved with this Name notified. ");
-							}else{
-								System.err.println("\n\n Fail to retrieve policy !!!!\n\n");
-							}
-							// Also Test this case. 
-							if(policyConfig.getPolicyName().equals(updatedPolicy.getPolicyName())){
-								System.out.println("Policy Name is good. ");
-							}else{
-								System.err.println("\n\n Fail to check Name \n\n");
-							}
-						}
-					} catch (PolicyEngineException e) {
-						LOGGER.error("Exception Occured"+e);
-					} catch (PolicyConfigException e) {
-						LOGGER.error("Exception Occured"+e);
-					}
-				}
-			}
-		}else if(notification.getNotificationType().equals(NotificationType.BOTH)){
-			System.out.println("Both updated and Removed Notification: \n");
-			System.out.println("Removed Policies: \n");
-			for(RemovedPolicy removedPolicy: notification.getRemovedPolicies()){
-				System.out.println(removedPolicy.getPolicyName());
-				System.out.println(removedPolicy.getVersionNo());
-			}
-			System.out.println("Updated Policies: \n");
-			for(LoadedPolicy updatedPolicy: notification.getLoadedPolicies()){
-				System.out.println("policyName : " + updatedPolicy.getPolicyName());
-				System.out.println("policyVersion :" + updatedPolicy.getVersionNo());
-				System.out.println("Matches: " + updatedPolicy.getMatches());
-				System.out.println("UpdateType: "+ updatedPolicy.getUpdateType());
-				// Checking the Name is correct or not. 
-				try {
-					PolicyEngine policyEngine = new PolicyEngine("config.properties");
-					@SuppressWarnings("deprecation")
-					Collection<PolicyConfig> policyConfigs = policyEngine.getConfigByPolicyName(updatedPolicy.getPolicyName());
-					for(PolicyConfig policyConfig: policyConfigs){
-						if(policyConfig.getPolicyConfigStatus().equals(PolicyConfigStatus.CONFIG_RETRIEVED)){
-							System.out.println("Policy Retrieved with this Name notified. ");
-						}else{
-							System.err.println("\n\n Fail to retrieve policy !!!!\n\n");
-						}
-						// Also Test this case. 
-						if(policyConfig.getPolicyName().equals(updatedPolicy.getPolicyName())){
-							System.out.println("Policy Name is good. ");
-						}else{
-							System.err.println("\n\n Fail to check Name \n\n");
-						}
-					}
-				} catch (PolicyEngineException e) {
-					LOGGER.error("Exception Occured"+e);
-				} catch (PolicyConfigException e) {
-					LOGGER.error("Exception Occured"+e);
-				}
-			}
-		}
-	}
+    private static final Logger LOGGER = FlexLogger.getLogger(Handler.class);
 
-	
-	
+    @Override
+    public void notificationReceived(PDPNotification notification) {
+        System.out.println("Notification Received...");
+        System.out.println(notification.getNotificationType());
+        if (notification.getNotificationType().equals(NotificationType.REMOVE)) {
+            System.out.println("Removed Policies: \n");
+            for (RemovedPolicy removedPolicy : notification.getRemovedPolicies()) {
+                System.out.println(removedPolicy.getPolicyName());
+                System.out.println(removedPolicy.getVersionNo());
+            }
+        } else if (notification.getNotificationType().equals(NotificationType.UPDATE)) {
+            System.out.println("Updated Policies: \n");
+            for (LoadedPolicy updatedPolicy : notification.getLoadedPolicies()) {
+                System.out.println("policyName : " + updatedPolicy.getPolicyName());
+                System.out.println("policyVersion :" + updatedPolicy.getVersionNo());
+                if (updatedPolicy.getPolicyName().contains(".Config_")) {
+                    System.out.println("Matches: " + updatedPolicy.getMatches());
+                    System.out.println("UpdateType: " + updatedPolicy.getUpdateType());
+                    // Checking the Name is correct or not.
+                    try {
+                        PolicyEngine policyEngine = new PolicyEngine("config.properties");
+                        @SuppressWarnings("deprecation")
+                        Collection<PolicyConfig> policyConfigs =
+                                policyEngine.getConfigByPolicyName(updatedPolicy.getPolicyName());
+                        for (PolicyConfig policyConfig : policyConfigs) {
+                            if (policyConfig.getPolicyConfigStatus().equals(PolicyConfigStatus.CONFIG_RETRIEVED)) {
+                                System.out.println("Policy Retrieved with this Name notified. ");
+                            } else {
+                                System.err.println("\n\n Fail to retrieve policy !!!!\n\n");
+                            }
+                            // Also Test this case.
+                            if (policyConfig.getPolicyName().equals(updatedPolicy.getPolicyName())) {
+                                System.out.println("Policy Name is good. ");
+                            } else {
+                                System.err.println("\n\n Fail to check Name \n\n");
+                            }
+                        }
+                    } catch (PolicyEngineException e) {
+                        LOGGER.error("Exception Occured" + e);
+                    } catch (PolicyConfigException e) {
+                        LOGGER.error("Exception Occured" + e);
+                    }
+                }
+            }
+        } else if (notification.getNotificationType().equals(NotificationType.BOTH)) {
+            System.out.println("Both updated and Removed Notification: \n");
+            System.out.println("Removed Policies: \n");
+            for (RemovedPolicy removedPolicy : notification.getRemovedPolicies()) {
+                System.out.println(removedPolicy.getPolicyName());
+                System.out.println(removedPolicy.getVersionNo());
+            }
+            System.out.println("Updated Policies: \n");
+            for (LoadedPolicy updatedPolicy : notification.getLoadedPolicies()) {
+                System.out.println("policyName : " + updatedPolicy.getPolicyName());
+                System.out.println("policyVersion :" + updatedPolicy.getVersionNo());
+                System.out.println("Matches: " + updatedPolicy.getMatches());
+                System.out.println("UpdateType: " + updatedPolicy.getUpdateType());
+                // Checking the Name is correct or not.
+                try {
+                    PolicyEngine policyEngine = new PolicyEngine("config.properties");
+                    @SuppressWarnings("deprecation")
+                    Collection<PolicyConfig> policyConfigs =
+                            policyEngine.getConfigByPolicyName(updatedPolicy.getPolicyName());
+                    for (PolicyConfig policyConfig : policyConfigs) {
+                        if (policyConfig.getPolicyConfigStatus().equals(PolicyConfigStatus.CONFIG_RETRIEVED)) {
+                            System.out.println("Policy Retrieved with this Name notified. ");
+                        } else {
+                            System.err.println("\n\n Fail to retrieve policy !!!!\n\n");
+                        }
+                        // Also Test this case.
+                        if (policyConfig.getPolicyName().equals(updatedPolicy.getPolicyName())) {
+                            System.out.println("Policy Name is good. ");
+                        } else {
+                            System.err.println("\n\n Fail to check Name \n\n");
+                        }
+                    }
+                } catch (PolicyEngineException e) {
+                    LOGGER.error("Exception Occured" + e);
+                } catch (PolicyConfigException e) {
+                    LOGGER.error("Exception Occured" + e);
+                }
+            }
+        }
+    }
+
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/ImportBRMSTemplate.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/ImportBRMSTemplate.java
index 20175b2..2e5f0e1 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/ImportBRMSTemplate.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/ImportBRMSTemplate.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,27 +24,33 @@
 import java.util.UUID;
 
 import org.onap.policy.api.ImportParameters;
+import org.onap.policy.api.ImportParameters.IMPORT_TYPE;
 import org.onap.policy.api.PolicyChangeResponse;
 import org.onap.policy.api.PolicyEngine;
-import org.onap.policy.api.ImportParameters.IMPORT_TYPE;
 
 public class ImportBRMSTemplate {
-	public static void main(String[] args) {
-		try{	
-	        PolicyEngine policyEngine = new PolicyEngine("config.properties");
-	        ImportParameters importParameters = new ImportParameters();
-	        importParameters.setFilePath("testResources"+File.separator+"test.drl");
-	        importParameters.setServiceName("testTemplate");
-	        importParameters.setRequestID(UUID.randomUUID());
-	        importParameters.setServiceType(IMPORT_TYPE.BRMSPARAM);
+
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
+        try {
+            ImportParameters importParameters = new ImportParameters();
+            importParameters.setFilePath("testResources" + File.separator + "test.drl");
+            importParameters.setServiceName("testTemplate");
+            importParameters.setRequestID(UUID.randomUUID());
+            importParameters.setServiceType(IMPORT_TYPE.BRMSPARAM);
 
             // API method to create Policy or update policy
-	        PolicyChangeResponse response = null;
+            PolicyChangeResponse response = null;
+            PolicyEngine policyEngine = new PolicyEngine("config.properties");
             response = policyEngine.policyEngineImport(importParameters);
             System.out.println(response.getResponseMessage());
 
-	    } catch (Exception e) {
-	        System.err.println(e.getMessage());
-	    }
-	}
+        } catch (Exception e) {
+            System.err.println(e.getMessage());
+        }
+    }
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/ImportMicroServiceClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/ImportMicroServiceClient.java
index 8643958..377dfcb 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/ImportMicroServiceClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/ImportMicroServiceClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -28,26 +28,33 @@
 import org.onap.policy.api.PolicyEngine;
 
 public class ImportMicroServiceClient {
-	static Boolean isEdit = false;
-	public static void main(String[] args) {
-		try{	
-	        PolicyEngine policyEngine = new PolicyEngine("config.properties");
-	        ImportParameters importParameters = new ImportParameters();
-	        importParameters.setFilePath("C:\\Workspaces\\models\\TestingModel\\ControllerServiceSampleSdnlServiceInstance-v0.1.0-SNAPSHOT.zip");
-	        importParameters.setServiceName("ControllerServiceSampleSdnlServiceInstance");
-	  	  	
-	        importParameters.setRequestID(UUID.randomUUID());
-	        importParameters.setServiceType(IMPORT_TYPE.MICROSERVICE);
-	        importParameters.setVersion("1607-2");
+    static Boolean isEdit = false;
+
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
+        try {
+            ImportParameters importParameters = new ImportParameters();
+            importParameters.setFilePath(
+                "C:\\Workspaces\\models\\TestingModel\\ControllerServiceSampleSdnlServiceInstance-v0.1.0-SNAPSHOT.zip");
+            importParameters.setServiceName("ControllerServiceSampleSdnlServiceInstance");
+
+            importParameters.setRequestID(UUID.randomUUID());
+            importParameters.setServiceType(IMPORT_TYPE.MICROSERVICE);
+            importParameters.setVersion("1607-2");
 
             // API method to create Policy or update policy
-	        PolicyChangeResponse response = null;
+            PolicyChangeResponse response = null;
+            PolicyEngine policyEngine = new PolicyEngine("config.properties");
             response = policyEngine.policyEngineImport(importParameters);
             System.out.println(response.getResponseMessage());
 
-	    } catch (Exception e) {
-	        System.err.println(e.getMessage());
-	    }
-	}
-	
+        } catch (Exception e) {
+            System.err.println(e.getMessage());
+        }
+    }
+
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/ListConfigPoliciesClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/ListConfigPoliciesClient.java
index 9973ce7..c56a234 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/ListConfigPoliciesClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/ListConfigPoliciesClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,44 +33,49 @@
 import org.onap.policy.common.logging.flexlogger.Logger;
 
 public class ListConfigPoliciesClient {
-	
-	private static final Logger LOGGER	= FlexLogger.getLogger(ListConfigPoliciesClient.class);
-	
-	public static void main(String[] args) {
-		PolicyEngine policyEngine;
 
-		// List Config Policies Example 
-		try {
-			policyEngine = new PolicyEngine("config.properties");
-			ConfigRequestParameters parameters = new ConfigRequestParameters();
-			
-			parameters.setPolicyName(".*");
-			parameters.setOnapName(".*");
-			parameters.setConfigName(".*");
-			
-			Map<String, String> configAttributes = new HashMap<>();
-			configAttributes.put("java", "java");
-			configAttributes.put("peach", "Tar");
-			configAttributes.put("true", "false");
-			configAttributes.put("small", "testPass");
-			parameters.setConfigAttributes(configAttributes);
-			
-			parameters.setRequestID(UUID.randomUUID());
-			
-			Collection<String> response = policyEngine.listConfig(parameters);
-	        if(response!=null && !response.contains("PE300")){
-	        	for(String configList : response){
-	        		System.out.println(configList.toString()+"\n");
-	        	}
-	        }else{
-	            System.out.println("Error! " +response);
-	        }
+    private static final Logger LOGGER = FlexLogger.getLogger(ListConfigPoliciesClient.class);
 
-		} catch (PolicyConfigException e) {
-			LOGGER.error("Exception Occured"+e);
-		} catch (PolicyEngineException e) {
-			LOGGER.error("Exception Occured"+e);
-		}
-	}
-	
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
+        PolicyEngine policyEngine;
+
+        // List Config Policies Example
+        try {
+            policyEngine = new PolicyEngine("config.properties");
+            ConfigRequestParameters parameters = new ConfigRequestParameters();
+
+            parameters.setPolicyName(".*");
+            parameters.setOnapName(".*");
+            parameters.setConfigName(".*");
+
+            Map<String, String> configAttributes = new HashMap<>();
+            configAttributes.put("java", "java");
+            configAttributes.put("peach", "Tar");
+            configAttributes.put("true", "false");
+            configAttributes.put("small", "testPass");
+            parameters.setConfigAttributes(configAttributes);
+
+            parameters.setRequestID(UUID.randomUUID());
+
+            Collection<String> response = policyEngine.listConfig(parameters);
+            if (response != null && !response.contains("PE300")) {
+                for (String configList : response) {
+                    System.out.println(configList.toString() + "\n");
+                }
+            } else {
+                System.out.println("Error! " + response);
+            }
+
+        } catch (PolicyConfigException e) {
+            LOGGER.error("Exception Occured" + e);
+        } catch (PolicyEngineException e) {
+            LOGGER.error("Exception Occured" + e);
+        }
+    }
+
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/ListPolicyClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/ListPolicyClient.java
index 785c44d..d2e6d70 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/ListPolicyClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/ListPolicyClient.java
@@ -21,6 +21,7 @@
 package org.onap.policyengine;
 
 import java.util.Collection;
+
 import org.onap.policy.api.ConfigNameRequest;
 import org.onap.policy.api.PolicyEngine;
 
@@ -30,6 +31,12 @@
  * (active version)
  */
 public class ListPolicyClient {
+
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
     public static void main(String[] args) throws Exception {
         PolicyEngine pe = new PolicyEngine("config.properties");
         ConfigNameRequest listPolicyParams = new ConfigNameRequest();
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/MainClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/MainClient.java
index 210499c..dfd06e5 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/MainClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/MainClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -46,80 +46,93 @@
 import org.w3c.dom.Document;
 
 public class MainClient {
-	
-	private static final Logger LOGGER	= FlexLogger.getLogger(MainClient.class);
-	
-	public static void main(String[] args) {
-		PolicyEngine policyEngine;
-		try {
-			policyEngine = new PolicyEngine("config.properties");
-			Map<String, String> configAttributes = new HashMap<>();
-			configAttributes.put("java", "java");
-			configAttributes.put("peach", "Tar");
-			configAttributes.put("true", "false");
-			configAttributes.put("small", "testPass");
-			Map<String, String> eventAttributes = new HashMap<>();
-			eventAttributes.put("true", "true");
-			eventAttributes.put("cpu", "91");
-			Map<String, String> decisionAttributes = new HashMap<>();
-			decisionAttributes.put("Key", "Value");
-			
-			// Config Example 
-			try {
-				@SuppressWarnings("deprecation")
-				Collection<PolicyConfig> policyConfigs = policyEngine.getConfigByPolicyName(".*");//(onapComponentName, configName, configAttributes);
-				if(policyConfigs!=null && !policyConfigs.isEmpty()){
-					for(PolicyConfig policyConfig: policyConfigs){
-						System.out.println("\nConfig Message: "+ policyConfig.getPolicyConfigMessage());
-						System.out.println("Config Status: " + policyConfig.getPolicyConfigStatus());
-						System.out.println("Policy Name: "+ policyConfig.getPolicyName());
-						System.out.println("policy Version: " + policyConfig.getPolicyVersion());
-					}
-				}
-			} catch (PolicyConfigException e) {
-				LOGGER.error("Exception Occured"+e);
-			}
-			
-			// Manual Notifications.. 
-			policyEngine.setScheme(NotificationScheme.MANUAL_ALL_NOTIFICATIONS);
-			if(policyEngine.getNotification()!=null){
-				System.out.println(policyEngine.getNotification().getNotificationType());
-				for(LoadedPolicy updated: policyEngine.getNotification().getLoadedPolicies()){
-					System.out.println(updated.getPolicyName());
-					System.out.println(updated.getVersionNo());
-					System.out.println(updated.getMatches());
-				}
-				for(RemovedPolicy removed: policyEngine.getNotification().getRemovedPolicies()){
-					System.out.println(removed.getPolicyName());
-					System.out.println(removed.getVersionNo());
-				}
-			}
-			// Auto Notifications..
-			Handler handler = new Handler();
-			policyEngine.setNotification(NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler);
-			//
-			System.out.println("Enter a any key to exit");
-			try {
-				System.in.read();
-			} catch (IOException e) {
-				System.err.println("Exception Occured"+e);
-			}
-			
-		} catch (PolicyEngineException e1) {
-			System.err.println("Exception Occured"+e1);
-		}
-	}
-	
-	public static void printDocument(Document doc, OutputStream out) throws IOException, TransformerException {
-	    TransformerFactory tf = TransformerFactory.newInstance();
-	    Transformer transformer = tf.newTransformer();
-	    transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
-	    transformer.setOutputProperty(OutputKeys.METHOD, "xml");
-	    transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-	    transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
-	    transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
 
-	    transformer.transform(new DOMSource(doc), 
-	         new StreamResult(new OutputStreamWriter(out, "UTF-8")));
-	}
+    private static final Logger LOGGER = FlexLogger.getLogger(MainClient.class);
+
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
+        PolicyEngine policyEngine;
+        try {
+            policyEngine = new PolicyEngine("config.properties");
+            Map<String, String> configAttributes = new HashMap<>();
+            configAttributes.put("java", "java");
+            configAttributes.put("peach", "Tar");
+            configAttributes.put("true", "false");
+            configAttributes.put("small", "testPass");
+            Map<String, String> eventAttributes = new HashMap<>();
+            eventAttributes.put("true", "true");
+            eventAttributes.put("cpu", "91");
+            Map<String, String> decisionAttributes = new HashMap<>();
+            decisionAttributes.put("Key", "Value");
+
+            // Config Example
+            try {
+                @SuppressWarnings("deprecation")
+                Collection<PolicyConfig> policyConfigs = policyEngine.getConfigByPolicyName(".*");
+                if (policyConfigs != null && !policyConfigs.isEmpty()) {
+                    for (PolicyConfig policyConfig : policyConfigs) {
+                        System.out.println("\nConfig Message: " + policyConfig.getPolicyConfigMessage());
+                        System.out.println("Config Status: " + policyConfig.getPolicyConfigStatus());
+                        System.out.println("Policy Name: " + policyConfig.getPolicyName());
+                        System.out.println("policy Version: " + policyConfig.getPolicyVersion());
+                    }
+                }
+            } catch (PolicyConfigException e) {
+                LOGGER.error("Exception Occured" + e);
+            }
+
+            // Manual Notifications..
+            policyEngine.setScheme(NotificationScheme.MANUAL_ALL_NOTIFICATIONS);
+            if (policyEngine.getNotification() != null) {
+                System.out.println(policyEngine.getNotification().getNotificationType());
+                for (LoadedPolicy updated : policyEngine.getNotification().getLoadedPolicies()) {
+                    System.out.println(updated.getPolicyName());
+                    System.out.println(updated.getVersionNo());
+                    System.out.println(updated.getMatches());
+                }
+                for (RemovedPolicy removed : policyEngine.getNotification().getRemovedPolicies()) {
+                    System.out.println(removed.getPolicyName());
+                    System.out.println(removed.getVersionNo());
+                }
+            }
+            // Auto Notifications..
+            Handler handler = new Handler();
+            policyEngine.setNotification(NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler);
+            //
+            System.out.println("Enter a any key to exit");
+            try {
+                System.in.read();
+            } catch (IOException e) {
+                System.err.println("Exception Occured" + e);
+            }
+
+        } catch (PolicyEngineException e1) {
+            System.err.println("Exception Occured" + e1);
+        }
+    }
+
+    /**
+     * printDocument.
+     *
+     * @param doc Document
+     * @param out OutputStream
+     * @throws IOException IOException
+     * @throws TransformerException TransformerException
+     */
+    public static void printDocument(Document doc, OutputStream out)
+            throws IOException, TransformerException {
+        TransformerFactory tf = TransformerFactory.newInstance();
+        Transformer transformer = tf.newTransformer();
+        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
+        transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+        transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
+
+        transformer.transform(new DOMSource(doc), new StreamResult(new OutputStreamWriter(out, "UTF-8")));
+    }
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/MicroServicesPolicyClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/MicroServicesPolicyClient.java
index b05e447..d592e7c 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/MicroServicesPolicyClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/MicroServicesPolicyClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,6 +31,7 @@
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.UUID;
+
 import javax.json.Json;
 import javax.json.JsonObject;
 import javax.json.JsonReader;
@@ -40,88 +41,89 @@
 import org.onap.policy.api.PolicyEngine;
 import org.onap.policy.api.PolicyParameters;
 import org.onap.policy.api.PolicyType;
+
 public class MicroServicesPolicyClient {
-     
-//For updating a Micro Services policy set the "isEdit" flag to true.   
-//For creating a Micro Services policy set the "isEdit" flag to false.  
-static Boolean isEdit = false;
-     
-//Builds JSONObject from File  
-private static JsonObject buildJSON(File jsonInput, String jsonString) throws FileNotFoundException {
-    JsonObject json = null;;
-    JsonReader jsonReader = null;  
-    if (jsonString != null && jsonInput == null) {
-        StringReader in = null;
+
+    // For updating a Micro Services policy set the "isEdit" flag to true.
+    // For creating a Micro Services policy set the "isEdit" flag to false.
+    static Boolean isEdit = false;
+
+    // Builds JSONObject from File
+    private static JsonObject buildJson(File jsonInput, String jsonString) throws FileNotFoundException {
+        JsonObject json = null;;
+        JsonReader jsonReader = null;
+        if (jsonString != null && jsonInput == null) {
+            StringReader in = null;
             in = new StringReader(jsonString);
             jsonReader = Json.createReader(in);
             json = jsonReader.readObject();
             in.close();
+        } else {
+            InputStream in = null;
+            in = new FileInputStream(jsonInput);
+            jsonReader = Json.createReader(in);
+            json = jsonReader.readObject();
+            try {
+                in.close();
+            } catch (IOException e) {
+                System.err.println("Exception Occured while closing input stream" + e);
+            }
+        }
+        jsonReader.close();
+        return json;
     }
-    else {
-        InputStream in = null;
-        in = new FileInputStream(jsonInput);
-        jsonReader = Json.createReader(in);
-        json = jsonReader.readObject();
-        try {
-			in.close();
-		} catch (IOException e) {
-			System.err.println("Exception Occured while closing input stream"+e);
-		}
-    }
-    jsonReader.close();    
-    return json;
-}
-public static void main(String[] args) {
-		try {
-			PolicyEngine policyEngine = new PolicyEngine("config.properties");
-			PolicyParameters policyParameters = new PolicyParameters();
-			// Set Policy Type 
-			policyParameters.setPolicyConfigType(PolicyConfigType.MicroService);
-			policyParameters.setPolicyName("Katrina.configuration_dcae_microservice_stringmatcher");
-			//policyParameters.setPolicyDescription("This is a sample Micro Service policy Create example");
-			policyParameters.setOnapName("DCAE");
-			//policyParameters.setConfigName("Collector");
-			//policyParameters.setPriority("1");
-			//policyParameters.setPolicyScope("service=vSCP;resource=F5;type=configuration;closedLoopControlName=vSCP_F5_Firewall_d925ed73-8231-4d02-9545-db4e113213abab322");
-			
-			// Set up Micro Services Attributes 
-			File jsonFile = null;
-			String MSjsonString= null;
-			Path file = Paths.get("C:\\policyAPI\\MicroServicesJSON\\testStringMatching.json");
-			jsonFile = file.toFile();
-			
-			policyParameters.setConfigBody(buildJSON(jsonFile, MSjsonString).toString());		
-			policyParameters.setConfigBodyType(PolicyType.JSON);
 
-			policyParameters.setRequestID(UUID.randomUUID());
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
+        try {
+            PolicyEngine policyEngine = new PolicyEngine("config.properties");
+            PolicyParameters policyParameters = new PolicyParameters();
+            // Set Policy Type
+            policyParameters.setPolicyConfigType(PolicyConfigType.MicroService);
+            policyParameters.setPolicyName("Katrina.configuration_dcae_microservice_stringmatcher");
+            policyParameters.setOnapName("DCAE");
+
+            // Set up Micro Services Attributes
+            File jsonFile = null;
+            String msJsonString = null;
+            Path file = Paths.get("C:\\policyAPI\\MicroServicesJSON\\testStringMatching.json");
+            jsonFile = file.toFile();
+
+            policyParameters.setConfigBody(buildJson(jsonFile, msJsonString).toString());
+            policyParameters.setConfigBodyType(PolicyType.JSON);
+
+            policyParameters.setRequestID(UUID.randomUUID());
             // Set Safe Policy value for Risk Type
-			SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
-			Date date = dateformat3.parse("15/10/2016");
-			policyParameters.setTtlDate(date);
-			// Set Safe Policy value for Guard
-			policyParameters.setGuard(true);
-			// Set Safe Policy value for Risk Level
-			policyParameters.setRiskLevel("5");
-			// Set Safe Policy value for Risk Type
-			policyParameters.setRiskType("PROD");
-			
-			// API method to create or update Policy. 
- 	        PolicyChangeResponse response = null;
-	        if (!isEdit) {
-	            response = policyEngine.createPolicy(policyParameters);
-	        } 
-	        else {	
-	        	response = policyEngine.updatePolicy(policyParameters);
-	        }
-	        
-			if(response.getResponseCode()==200){
-				System.out.println(response.getResponseMessage());
-				System.out.println("Policy Created Successfully!");
-			}else{
-				System.out.println("Error! " + response.getResponseMessage());
-			}
-		} catch (Exception e) {
-			System.err.println(e.getMessage());
-		}
-	}
+            SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
+            Date date = dateformat3.parse("15/10/2016");
+            policyParameters.setTtlDate(date);
+            // Set Safe Policy value for Guard
+            policyParameters.setGuard(true);
+            // Set Safe Policy value for Risk Level
+            policyParameters.setRiskLevel("5");
+            // Set Safe Policy value for Risk Type
+            policyParameters.setRiskType("PROD");
+
+            // API method to create or update Policy.
+            PolicyChangeResponse response = null;
+            if (!isEdit) {
+                response = policyEngine.createPolicy(policyParameters);
+            } else {
+                response = policyEngine.updatePolicy(policyParameters);
+            }
+
+            if (response.getResponseCode() == 200) {
+                System.out.println(response.getResponseMessage());
+                System.out.println("Policy Created Successfully!");
+            } else {
+                System.out.println("Error! " + response.getResponseMessage());
+            }
+        } catch (Exception e) {
+            System.err.println(e.getMessage());
+        }
+    }
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/OptimizationPolicyJavaAPIClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/OptimizationPolicyJavaAPIClient.java
index 090ec39..1d765c3 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/OptimizationPolicyJavaAPIClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/OptimizationPolicyJavaAPIClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -31,6 +31,7 @@
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.UUID;
+
 import javax.json.Json;
 import javax.json.JsonObject;
 import javax.json.JsonReader;
@@ -40,89 +41,94 @@
 import org.onap.policy.api.PolicyEngine;
 import org.onap.policy.api.PolicyParameters;
 import org.onap.policy.api.PolicyType;
+
 public class OptimizationPolicyJavaAPIClient {
-	
-/*
- * THIS IS AN EXAMPLE JAVA CLIENT API FOR CREATE/UPDATE Optimization Policies
- */
-//For updating a Optmization  policy set the "isEdit" flag to true.   
-//For creating a Optmization  policy set the "isEdit" flag to false.  
-static Boolean isEdit = false;
-     
-//Builds JSONObject from File  
-private static JsonObject buildJSON(File jsonInput, String jsonString) throws FileNotFoundException {
-    JsonObject json = null;;
-    JsonReader jsonReader = null;  
-    if (jsonString != null && jsonInput == null) {
-        StringReader in = null;
+
+    /*
+     * THIS IS AN EXAMPLE JAVA CLIENT API FOR CREATE/UPDATE Optimization Policies
+     */
+    // For updating a Optmization policy set the "isEdit" flag to true.
+    // For creating a Optmization policy set the "isEdit" flag to false.
+    static Boolean isEdit = false;
+
+    // Builds JSONObject from File
+    private static JsonObject buildJson(File jsonInput, String jsonString) throws FileNotFoundException {
+        JsonObject json = null;;
+        JsonReader jsonReader = null;
+        if (jsonString != null && jsonInput == null) {
+            StringReader in = null;
             in = new StringReader(jsonString);
             jsonReader = Json.createReader(in);
             json = jsonReader.readObject();
             in.close();
+        } else {
+            InputStream in = null;
+            in = new FileInputStream(jsonInput);
+            jsonReader = Json.createReader(in);
+            json = jsonReader.readObject();
+            try {
+                in.close();
+            } catch (IOException e) {
+                System.err.println("Exception Occured while closing input stream" + e);
+            }
+        }
+        jsonReader.close();
+        return json;
     }
-    else {
-        InputStream in = null;
-        in = new FileInputStream(jsonInput);
-        jsonReader = Json.createReader(in);
-        json = jsonReader.readObject();
+
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
         try {
-			in.close();
-		} catch (IOException e) {
-			System.err.println("Exception Occured while closing input stream"+e);
-		}
-    }
-    jsonReader.close();    
-    return json;
-}
-public static void main(String[] args) {
-		try {
-			PolicyEngine policyEngine = new PolicyEngine("config.properties");
-			PolicyParameters policyParameters = new PolicyParameters();
-			// Set Policy Type 
-			policyParameters.setPolicyConfigType(PolicyConfigType.Optimization);
-			policyParameters.setPolicyName("Mike.testOOFPolicyFromJavaClient");
-			policyParameters.setPolicyDescription("This is a sample Optimization policy");
-			policyParameters.setOnapName("OOF");
+            PolicyEngine policyEngine = new PolicyEngine("config.properties");
+            PolicyParameters policyParameters = new PolicyParameters();
+            // Set Policy Type
+            policyParameters.setPolicyConfigType(PolicyConfigType.Optimization);
+            policyParameters.setPolicyName("Mike.testOOFPolicyFromJavaClient");
+            policyParameters.setPolicyDescription("This is a sample Optimization policy");
+            policyParameters.setOnapName("OOF");
 
-			File jsonFile = null;
-			String OOFjsonString= null;
-			
-			//path where you store the json payload
-			Path file = Paths.get("/home/users/PolicyEngine/json/optimizationPolicy.json");
-			jsonFile = file.toFile();
-			
-			policyParameters.setConfigBody(buildJSON(jsonFile, OOFjsonString).toString());		
-			policyParameters.setConfigBodyType(PolicyType.JSON);
+            File jsonFile = null;
+            String oofJsonString = null;
 
-			policyParameters.setRequestID(UUID.randomUUID());
+            // path where you store the json payload
+            Path file = Paths.get("/home/users/PolicyEngine/json/optimizationPolicy.json");
+            jsonFile = file.toFile();
+
+            policyParameters.setConfigBody(buildJson(jsonFile, oofJsonString).toString());
+            policyParameters.setConfigBodyType(PolicyType.JSON);
+
+            policyParameters.setRequestID(UUID.randomUUID());
             // Set Safe Policy value for Risk Type
-			SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
-			Date date = dateformat3.parse("15/10/2016");
-			policyParameters.setTtlDate(date);
-			// Set Safe Policy value for Guard
-			policyParameters.setGuard(false);
-			// Set Safe Policy value for Risk Level
-			policyParameters.setRiskLevel("5");
-			// Set Safe Policy value for Risk Type
-			policyParameters.setRiskType("TEST");
-			
-			// API method to create or update Policy. 
- 	        PolicyChangeResponse response = null;
-	        if (!isEdit) {
-	            response = policyEngine.createPolicy(policyParameters);
-	        } 
-	        else {	
-	        	response = policyEngine.updatePolicy(policyParameters);
-	        }
-	        
-			if(response.getResponseCode()==200){
-				System.out.println(response.getResponseMessage());
-				System.out.println("Policy Created Successfully!");
-			}else{
-				System.out.println("Error! " + response.getResponseMessage());
-			}
-		} catch (Exception e) {
-			System.err.println(e.getMessage());
-		}
-	}
+            SimpleDateFormat dateformat3 = new SimpleDateFormat("dd/MM/yyyy");
+            Date date = dateformat3.parse("15/10/2016");
+            policyParameters.setTtlDate(date);
+            // Set Safe Policy value for Guard
+            policyParameters.setGuard(false);
+            // Set Safe Policy value for Risk Level
+            policyParameters.setRiskLevel("5");
+            // Set Safe Policy value for Risk Type
+            policyParameters.setRiskType("TEST");
+
+            // API method to create or update Policy.
+            PolicyChangeResponse response = null;
+            if (!isEdit) {
+                response = policyEngine.createPolicy(policyParameters);
+            } else {
+                response = policyEngine.updatePolicy(policyParameters);
+            }
+
+            if (response.getResponseCode() == 200) {
+                System.out.println(response.getResponseMessage());
+                System.out.println("Policy Created Successfully!");
+            } else {
+                System.out.println("Error! " + response.getResponseMessage());
+            }
+        } catch (Exception e) {
+            System.err.println(e.getMessage());
+        }
+    }
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/PolicyEngineTestClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/PolicyEngineTestClient.java
index 9ce4a2a..9e055eb 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/PolicyEngineTestClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/PolicyEngineTestClient.java
@@ -7,9 +7,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,6 +17,7 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policyengine;
 
 import java.io.IOException;
@@ -39,155 +40,143 @@
 /**
  * Class contains static functions which make call to policy engine using API.
  * This class is used by generalTestClient.java
- * 
- * 
+ *
+ *
  * @version 1.0
  *
  */
 public class PolicyEngineTestClient {
-	/**
-	 * This fuction make API call to policy engine to get config. And returns
-	 * policy name, policy version and policy configStatus
-	 * 
-	 * @param org.onap.policyEngine
-	 * @param onapComponentName
-	 * @param configName
-	 * @param configAttributes
-	 * @return
-	 */
+    /**
+     * This function make API call to policy engine to get config. And returns
+     * policy name, policy version and policy configStatus
+     *
+     * @param policyEngine Policy Engine object
+     * @param onapComponentName String
+     * @param configName String
+     * @param configAttributes Map of String to String
+     * @return ArrayList of String
+     */
 
-	@SuppressWarnings("deprecation")
-	public static ArrayList<String> getConfig(PolicyEngine policyEngine,
-			String onapComponentName, String configName,
-			Map<String, String> configAttributes) {
-		ArrayList<String> resultReceived = new ArrayList<>();
-		try {
-			UUID requestID = UUID.randomUUID();
-			Collection<PolicyConfig> policyConfigs;
-			if (configName == null) {
-				policyConfigs = policyEngine.getConfig(onapComponentName, requestID);
-			} else {
-				if (configAttributes == null) {
-					policyConfigs = policyEngine.getConfig(onapComponentName,
-							configName, requestID);
-				} else {
-					
-					policyConfigs = policyEngine.getConfig(onapComponentName,
-							configName, configAttributes, requestID);
-				}
-			}
-			if (policyConfigs != null && !policyConfigs.isEmpty()) {
-				for (PolicyConfig policyConfig : policyConfigs) {
-					resultReceived.add("Policy Name: "
-							+ policyConfig.getPolicyName()
-							+ " Policy version: "
-							+ policyConfig.getPolicyVersion() + " - "
-							+ policyConfig.getPolicyConfigStatus());
-				}
-			}
-		} catch (PolicyConfigException e) {
-//			logger.error("Exception Occured"+e);
-			resultReceived.add(""+e);
-		}
-		return resultReceived;
-	}
+    @SuppressWarnings("deprecation")
+    public static ArrayList<String> getConfig(PolicyEngine policyEngine, String onapComponentName, String configName,
+            Map<String, String> configAttributes) {
+        ArrayList<String> resultReceived = new ArrayList<>();
+        try {
+            UUID requestID = UUID.randomUUID();
+            Collection<PolicyConfig> policyConfigs;
+            if (configName == null) {
+                policyConfigs = policyEngine.getConfig(onapComponentName, requestID);
+            } else {
+                if (configAttributes == null) {
+                    policyConfigs = policyEngine.getConfig(onapComponentName, configName, requestID);
+                } else {
 
-	/**
-	 * This functions make API call to policy engine to get decision. And
-	 * returns policy Decision
-	 * 
-	 * @param org.onap.policyEngine
-	 * @param onapComponentName
-	 * @param decisionAttributes
-	 * @return
-	 */
-	public static ArrayList<String> getDecision(PolicyEngine policyEngine,
-			String onapComponentName, Map<String, String> decisionAttributes) {
-		ArrayList<String> resultReceived = new ArrayList<>();
-		// Decision example
-		try {
-			UUID requestID = UUID.randomUUID();
-			@SuppressWarnings("deprecation")
-			DecisionResponse policyDecision = policyEngine.getDecision(
-					onapComponentName, decisionAttributes, requestID);
-			resultReceived.add(policyDecision.getDecision().toString());
-		} catch (PolicyDecisionException e) {
-//			logger.error("Exception Occured"+e);
-			resultReceived.add(""+e);
-		}
-		return resultReceived;
-	}
+                    policyConfigs = policyEngine.getConfig(onapComponentName, configName, configAttributes, requestID);
+                }
+            }
+            if (policyConfigs != null && !policyConfigs.isEmpty()) {
+                for (PolicyConfig policyConfig : policyConfigs) {
+                    resultReceived.add("Policy Name: " + policyConfig.getPolicyName() + " Policy version: "
+                            + policyConfig.getPolicyVersion() + " - " + policyConfig.getPolicyConfigStatus());
+                }
+            }
+        } catch (PolicyConfigException e) {
+            // logger.error("Exception Occured"+e);
+            resultReceived.add("" + e);
+        }
+        return resultReceived;
+    }
 
-	/**
-	 * This function makes API call to policy engine to get action. And returns
-	 * responseMessage and responseStatus
-	 * 
-	 * @param org.onap.policyEngine
-	 * @param eventAttributes
-	 * @return
-	 */
-	public static ArrayList<String> getAction(PolicyEngine policyEngine,
-			Map<String, String> eventAttributes) {
-		ArrayList<String> resultReceived = new ArrayList<>();
-		try {
-			UUID requestID = UUID.randomUUID();
-			@SuppressWarnings("deprecation")
-			Collection<PolicyResponse> policyResponses = policyEngine
-					.sendEvent(eventAttributes, requestID);
-			if (policyResponses != null && !policyResponses.isEmpty()) {
-				for (PolicyResponse policyResponse : policyResponses) {
-					resultReceived.add(policyResponse
-							.getPolicyResponseMessage()
-							+ " : "
-							+ policyResponse.getPolicyResponseStatus());
-				}
-			}
-		} catch (PolicyEventException e) {
-//			logger.error("Exception Occured"+e);
-			resultReceived.add(""+e);
-		}
-		return resultReceived;
-	}
+    /**
+     * This functions make API call to policy engine to get decision. And
+     * returns policy Decision
+     *
+     * @param policyEngine Policy Engine
+     * @param onapComponentName String
+     * @param decisionAttributes Map of String
+     * @return List of String
+     */
+    public static ArrayList<String> getDecision(PolicyEngine policyEngine, String onapComponentName,
+            Map<String, String> decisionAttributes) {
+        ArrayList<String> resultReceived = new ArrayList<>();
+        // Decision example
+        try {
+            UUID requestID = UUID.randomUUID();
+            @SuppressWarnings("deprecation")
+            DecisionResponse policyDecision =
+                    policyEngine.getDecision(onapComponentName, decisionAttributes, requestID);
+            resultReceived.add(policyDecision.getDecision().toString());
+        } catch (PolicyDecisionException e) {
+            // logger.error("Exception Occured"+e);
+            resultReceived.add("" + e);
+        }
+        return resultReceived;
+    }
 
-	/**
-	 * This function makes API call to policy engine to get manual
-	 * notifications.
-	 * 
-	 * @param org.onap.policyEngine
-	 */
+    /**
+     * This function makes API call to policy engine to get action. And returns
+     * responseMessage and responseStatus
+     *
+     * @param policyEngine Policy Engine object
+     * @param eventAttributes Map of String
+     * @return List of String
+     */
+    public static ArrayList<String> getAction(PolicyEngine policyEngine, Map<String, String> eventAttributes) {
+        ArrayList<String> resultReceived = new ArrayList<>();
+        try {
+            UUID requestID = UUID.randomUUID();
+            @SuppressWarnings("deprecation")
+            Collection<PolicyResponse> policyResponses = policyEngine.sendEvent(eventAttributes, requestID);
+            if (policyResponses != null && !policyResponses.isEmpty()) {
+                for (PolicyResponse policyResponse : policyResponses) {
+                    resultReceived.add(policyResponse.getPolicyResponseMessage() + " : "
+                            + policyResponse.getPolicyResponseStatus());
+                }
+            }
+        } catch (PolicyEventException e) {
+            // logger.error("Exception Occured"+e);
+            resultReceived.add("" + e);
+        }
+        return resultReceived;
+    }
 
-	public static void getManualNotifications(PolicyEngine policyEngine) {
-		policyEngine.setScheme(NotificationScheme.MANUAL_ALL_NOTIFICATIONS);
-		System.out.println(policyEngine.getNotification().getNotificationType());
-		for (LoadedPolicy updated : policyEngine.getNotification().getLoadedPolicies()) {
-			System.out.println(updated.getPolicyName());
-			System.out.println(updated.getVersionNo());
-			System.out.println(updated.getMatches());
-		}
-		for (RemovedPolicy removed : policyEngine.getNotification()
-				.getRemovedPolicies()) {
-			System.out.println(removed.getPolicyName());
-			System.out.println(removed.getVersionNo());
-		}
-	}
+    /**
+     * This function makes API call to policy engine to get manual
+     * notifications.
+     *
+     * @param policyEngine Policy Engine object
+     */
 
-	/**
-	 * This function makes API call to policy engine to get automatic
-	 * notifications.
-	 * 
-	 * @param org.onap.policyEngine
-	 */
-	public static void getAutoNotifications(PolicyEngine policyEngine) {
-		Handler handler = new Handler();
-		policyEngine.setNotification(NotificationScheme.AUTO_ALL_NOTIFICATIONS,
-				handler);
-		//
-		System.out.println("Enter a any key to exit");
-		try {
-			System.in.read();
-		} catch (IOException e) {
-			//
-		}
-	}
+    public static void getManualNotifications(PolicyEngine policyEngine) {
+        policyEngine.setScheme(NotificationScheme.MANUAL_ALL_NOTIFICATIONS);
+        System.out.println(policyEngine.getNotification().getNotificationType());
+        for (LoadedPolicy updated : policyEngine.getNotification().getLoadedPolicies()) {
+            System.out.println(updated.getPolicyName());
+            System.out.println(updated.getVersionNo());
+            System.out.println(updated.getMatches());
+        }
+        for (RemovedPolicy removed : policyEngine.getNotification().getRemovedPolicies()) {
+            System.out.println(removed.getPolicyName());
+            System.out.println(removed.getVersionNo());
+        }
+    }
+
+    /**
+     * This function makes API call to policy engine to get automatic
+     * notifications.
+     *
+     * @param policyEngine Policy Engine object
+     */
+    public static void getAutoNotifications(PolicyEngine policyEngine) {
+        Handler handler = new Handler();
+        policyEngine.setNotification(NotificationScheme.AUTO_ALL_NOTIFICATIONS, handler);
+        //
+        System.out.println("Enter a any key to exit");
+        try {
+            System.in.read();
+        } catch (IOException e) {
+            //
+        }
+    }
 
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/PushPoliciesToPDP.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/PushPoliciesToPDP.java
index 880af06..3a3b9e7 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/PushPoliciesToPDP.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/PushPoliciesToPDP.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,35 +25,39 @@
 import org.onap.policy.api.PushPolicyParameters;
 
 public class PushPoliciesToPDP {
-	public static void main(String[] args) {
-		try {
 
-			PolicyEngine policyEngine = new PolicyEngine("config.properties");
-			PushPolicyParameters policyParameters = new PushPolicyParameters();			
-						
-			//Parameter arguments
-			policyParameters.setPolicyName("Mike.testCase1");
-			policyParameters.setPolicyType("Base");
-			//policyParameters.setPolicyScope("MikeAPItesting");
-			policyParameters.setPdpGroup("default");			
-			policyParameters.setRequestID(null);
-			
+    /**
+     * main.
+     *
+     * @param args String[] args
+     */
+    public static void main(String[] args) {
+        try {
+            PushPolicyParameters policyParameters = new PushPolicyParameters();
+
+            // Parameter arguments
+            policyParameters.setPolicyName("Mike.testCase1");
+            policyParameters.setPolicyType("Base");
+            // policyParameters.setPolicyScope("MikeAPItesting");
+            policyParameters.setPdpGroup("default");
+            policyParameters.setRequestID(null);
+
             // API method to Push Policy to PDP
             PolicyChangeResponse response = null;
-            response = policyEngine.pushPolicy(policyParameters);
+            response = new PolicyEngine("config.properties").pushPolicy(policyParameters);
 
-            if(response.getResponseCode()==204){
+            if (response.getResponseCode() == 204) {
                 System.out.println(response.getResponseMessage());
                 System.out.println("Policy Pushed Successfully!");
-            }else{
+            } else {
                 System.out.println("Error! " + response.getResponseMessage());
             }
 
-		} catch (Exception e) {
-			System.err.println(e.getMessage());		
-			
-		}
-		
-	}
+        } catch (Exception e) {
+            System.err.println(e.getMessage());
+
+        }
+
+    }
 
 }
diff --git a/PolicyEngineClient/src/test/java/org/onap/policyengine/RawDecisionPolicyClient.java b/PolicyEngineClient/src/test/java/org/onap/policyengine/RawDecisionPolicyClient.java
index 5f0e74f..de28ae8 100644
--- a/PolicyEngineClient/src/test/java/org/onap/policyengine/RawDecisionPolicyClient.java
+++ b/PolicyEngineClient/src/test/java/org/onap/policyengine/RawDecisionPolicyClient.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * PolicyEngineClient
  * ================================================================================
- * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,6 +21,7 @@
 package org.onap.policyengine;
 
 import java.util.UUID;
+
 import org.onap.policy.api.PolicyChangeResponse;
 import org.onap.policy.api.PolicyClass;
 import org.onap.policy.api.PolicyEngine;
@@ -29,15 +30,16 @@
 
 public class RawDecisionPolicyClient {
     /*
-     * 
+     *
      * To Create a Decision Policy Use case. User need provide valid PolicySet or Policy Type xacml. On Setting below
      * required attributes the Decision Raw policy will be created successfully.
-     * 
+     *
      */
     static Boolean isEdit = true;
 
     /**
      * Sample code to create Decison Raw Policy.
+     *
      * @param args with policy parameters
      */
     public static void main(String[] args) {
