Couple of JUnit additions for PAP-REST
[policy/engine.git] / ONAP-PAP-REST / src / main / java / org / onap / policy / pap / xacml / rest / XACMLPapServlet.java
index 8dc52b8..e8df2bb 100644 (file)
@@ -3,6 +3,7 @@
  * ONAP-PAP-REST
  * ================================================================================
  * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 
 package org.onap.policy.pap.xacml.rest;
 
+import com.att.research.xacml.api.pap.PAPException;
+import com.att.research.xacml.api.pap.PDPPolicy;
+import com.att.research.xacml.api.pap.PDPStatus;
+import com.att.research.xacml.util.FactoryException;
+import com.att.research.xacml.util.XACMLProperties;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Splitter;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -59,15 +68,15 @@ import org.onap.policy.common.logging.eelf.PolicyLogger;
 import org.onap.policy.common.logging.flexlogger.FlexLogger;
 import org.onap.policy.common.logging.flexlogger.Logger;
 import org.onap.policy.pap.xacml.rest.components.HandleIncomingNotifications;
-import org.onap.policy.pap.xacml.rest.components.PolicyDBDao;
-import org.onap.policy.pap.xacml.rest.components.PolicyDBDaoTransaction;
+import org.onap.policy.pap.xacml.rest.components.PolicyDbDao;
+import org.onap.policy.pap.xacml.rest.components.PolicyDbDaoTransaction;
 import org.onap.policy.pap.xacml.rest.handler.APIRequestHandler;
 import org.onap.policy.pap.xacml.rest.handler.PushPolicyHandler;
 import org.onap.policy.pap.xacml.rest.handler.SavePolicyHandler;
 import org.onap.policy.pap.xacml.restAuth.CheckPDP;
-import org.onap.policy.rest.XACMLRest;
-import org.onap.policy.rest.XACMLRestProperties;
-import org.onap.policy.rest.dao.PolicyDBException;
+import org.onap.policy.rest.XacmlRest;
+import org.onap.policy.rest.XacmlRestProperties;
+import org.onap.policy.rest.dao.PolicyDbException;
 import org.onap.policy.utils.PeCryptoUtils;
 import org.onap.policy.utils.PolicyUtils;
 import org.onap.policy.xacml.api.XACMLErrorConstants;
@@ -80,21 +89,18 @@ import org.onap.policy.xacml.std.pap.StdPDPGroup;
 import org.onap.policy.xacml.std.pap.StdPDPItemSetChangeNotifier.StdItemSetChangeListener;
 import org.onap.policy.xacml.std.pap.StdPDPPolicy;
 import org.onap.policy.xacml.std.pap.StdPDPStatus;
-import com.att.research.xacml.api.pap.PAPException;
-import com.att.research.xacml.api.pap.PDPPolicy;
-import com.att.research.xacml.api.pap.PDPStatus;
-import com.att.research.xacml.util.FactoryException;
-import com.att.research.xacml.util.XACMLProperties;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.base.Splitter;
 
 /**
  * Servlet implementation class XacmlPapServlet.
  */
-@WebServlet(description = "Implements the XACML PAP RESTful API.", urlPatterns = {"/"},
-        loadOnStartup = 1,
-        initParams = {@WebInitParam(name = "XACML_PROPERTIES_NAME", value = "xacml.pap.properties",
-                description = "The location of the properties file holding configuration information.")})
+@WebServlet(
+    description = "Implements the XACML PAP RESTful API.",
+    urlPatterns = {"/"},
+    loadOnStartup = 1,
+    initParams = {@WebInitParam(
+        name = "XACML_PROPERTIES_NAME",
+        value = "xacml.pap.properties",
+        description = "The location of the properties file holding configuration information.")})
 public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeListener, Runnable {
     private static final long serialVersionUID = 1L;
     private static final Logger LOGGER = FlexLogger.getLogger(XACMLPapServlet.class);
@@ -116,8 +122,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
      * The CopyOnWriteArrayList *should* protect from concurrency errors. This list is seldom
      * changed but often read, so the costs of this approach make sense.
      */
-    private static final CopyOnWriteArrayList<String> adminConsoleURLStringList =
-            new CopyOnWriteArrayList<>();
+    private static final CopyOnWriteArrayList<String> adminConsoleURLStringList = new CopyOnWriteArrayList<>();
 
     private static String configHome;
     private static String actionHome;
@@ -129,7 +134,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
     // The heartbeat thread.
     private static Heartbeat heartbeat = null;
     private static Thread heartbeatThread = null;
-    private static PolicyDBDao policyDbDao;
+    private static PolicyDbDao policyDbDao;
     /*
      * papEngine - This is our engine workhorse that manages the PDP Groups and Nodes.
      */
@@ -181,91 +186,83 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                 String hostname = InetAddress.getLocalHost().getCanonicalHostName();
                 baseLoggingContext.setServer(hostname);
             } catch (UnknownHostException e) {
-                LOGGER.warn(XACMLErrorConstants.ERROR_SYSTEM_ERROR
-                        + "Unable to get hostname for logging", e);
+                LOGGER.warn(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to get hostname for logging", e);
             }
 
             // Initialize
-            XACMLRest.xacmlInit(config);
+            XacmlRest.xacmlInit(config);
             // Load the properties
-            XACMLRest.loadXacmlProperties(null, null);
+            XacmlRest.loadXacmlProperties(null, null);
             /*
              * Retrieve the property values
              */
             setCommonProperties();
-            String papSiteName = XACMLProperties.getProperty(XACMLRestProperties.PAP_SITE_NAME);
+            String papSiteName = XACMLProperties.getProperty(XacmlRestProperties.PAP_SITE_NAME);
             if (papSiteName == null) {
                 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, "XACMLPapServlet",
-                        " ERROR: Bad papSiteName property entry");
+                    " ERROR: Bad papSiteName property entry");
                 throw new PAPException("papSiteName is null");
             }
-            String papNodeType = XACMLProperties.getProperty(XACMLRestProperties.PAP_NODE_TYPE);
+            String papNodeType = XACMLProperties.getProperty(XacmlRestProperties.PAP_NODE_TYPE);
             if (papNodeType == null) {
                 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, "XACMLPapServlet",
-                        " ERROR: Bad papNodeType property entry");
+                    " ERROR: Bad papNodeType property entry");
                 throw new PAPException("papNodeType is null");
             }
             // Integer will throw an exception of anything is missing or
             // unrecognized
-            int papTransWait = Integer
-                    .parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_TRANS_WAIT));
-            int papTransTimeout = Integer.parseInt(
-                    XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_TRANS_TIMEOUT));
-            int papAuditTimeout = Integer.parseInt(
-                    XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_AUDIT_TIMEOUT));
+            int papTransWait = Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_TRANS_WAIT));
+            int papTransTimeout =
+                Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_TRANS_TIMEOUT));
+            int papAuditTimeout =
+                Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_AUDIT_TIMEOUT));
             // Boolean will default to false if anything is missing or
             // unrecognized
-            boolean papAuditFlag = Boolean.parseBoolean(
-                    XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_RUN_AUDIT_FLAG));
-            boolean papFileSystemAudit = Boolean.parseBoolean(
-                    XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_AUDIT_FLAG));
-            String papDependencyGroups =
-                    XACMLProperties.getProperty(XACMLRestProperties.PAP_DEPENDENCY_GROUPS);
+            boolean papAuditFlag =
+                Boolean.parseBoolean(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_RUN_AUDIT_FLAG));
+            boolean papFileSystemAudit =
+                Boolean.parseBoolean(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_AUDIT_FLAG));
+            String papDependencyGroups = XACMLProperties.getProperty(XacmlRestProperties.PAP_DEPENDENCY_GROUPS);
             if (papDependencyGroups == null) {
                 throw new PAPException("papDependencyGroups is null");
             }
             setPAPDependencyGroups(papDependencyGroups);
             // Integer will throw an exception of anything is missing or
             // unrecognized
-            int fpMonitorInterval = Integer.parseInt(
-                    XACMLProperties.getProperty(IntegrityMonitorProperties.FP_MONITOR_INTERVAL));
-            int failedCounterThreshold = Integer.parseInt(XACMLProperties
-                    .getProperty(IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD));
-            int testTransInterval = Integer.parseInt(
-                    XACMLProperties.getProperty(IntegrityMonitorProperties.TEST_TRANS_INTERVAL));
-            int writeFpcInterval = Integer.parseInt(
-                    XACMLProperties.getProperty(IntegrityMonitorProperties.WRITE_FPC_INTERVAL));
-            LOGGER.debug("\n\n\n**************************************"
-                    + "\n*************************************" + "\n" + "\n   papDbDriver = "
-                    + papDbDriver + "\n   papDbUrl = " + papDbUrl + "\n   papDbUser = " + papDbUser
-                    + "\n   papTransWait = " + papTransWait + "\n   papTransTimeout = "
-                    + papTransTimeout + "\n   papAuditTimeout = " + papAuditTimeout
-                    + "\n   papAuditFlag = " + papAuditFlag + "\n   papFileSystemAudit = "
-                    + papFileSystemAudit + "\n papResourceName = " + papResourceName
-                    + "\n      fpMonitorInterval = " + fpMonitorInterval
-                    + "\n      failedCounterThreshold = " + failedCounterThreshold
-                    + "\n      testTransInterval = " + testTransInterval + "\n writeFpcInterval = "
-                    + writeFpcInterval + "\n   papSiteName = " + papSiteName + "\n     papNodeType = "
-                    + papNodeType + "\n        papDependencyGroupsList = " + papDependencyGroups
-                    + "\n   papIntegrityAuditPeriodSeconds = " + papIntegrityAuditPeriodSeconds
-                    + "\n\n*************************************"
-                    + "\n**************************************");
+            int fpMonitorInterval =
+                Integer.parseInt(XACMLProperties.getProperty(IntegrityMonitorProperties.FP_MONITOR_INTERVAL));
+            int failedCounterThreshold =
+                Integer.parseInt(XACMLProperties.getProperty(IntegrityMonitorProperties.FAILED_COUNTER_THRESHOLD));
+            int testTransInterval =
+                Integer.parseInt(XACMLProperties.getProperty(IntegrityMonitorProperties.TEST_TRANS_INTERVAL));
+            int writeFpcInterval =
+                Integer.parseInt(XACMLProperties.getProperty(IntegrityMonitorProperties.WRITE_FPC_INTERVAL));
+            LOGGER.debug("\n\n\n**************************************" + "\n*************************************"
+                + "\n" + "\n   papDbDriver = " + papDbDriver + "\n   papDbUrl = " + papDbUrl + "\n   papDbUser = "
+                + papDbUser + "\n   papTransWait = " + papTransWait + "\n   papTransTimeout = " + papTransTimeout
+                + "\n   papAuditTimeout = " + papAuditTimeout + "\n   papAuditFlag = " + papAuditFlag
+                + "\n   papFileSystemAudit = " + papFileSystemAudit + "\n      papResourceName = " + papResourceName
+                + "\n  fpMonitorInterval = " + fpMonitorInterval + "\n failedCounterThreshold = "
+                + failedCounterThreshold + "\n testTransInterval = " + testTransInterval + "\n writeFpcInterval = "
+                + writeFpcInterval + "\n       papSiteName = " + papSiteName + "\n     papNodeType = " + papNodeType
+                + "\n  papDependencyGroupsList = " + papDependencyGroups + "\n   papIntegrityAuditPeriodSeconds = "
+                + papIntegrityAuditPeriodSeconds + "\n\n*************************************"
+                + "\n**************************************");
             // Pull custom persistence settings
             Properties properties;
             try {
                 properties = XACMLProperties.getProperties();
-                LOGGER.debug("\n\n\n**************************************"
-                        + "\n**************************************" + "\n\n" + "properties = "
-                        + properties + "\n\n**************************************");
+                LOGGER.debug("\n\n\n**************************************" + "\n**************************************"
+                    + "\n\n" + "properties = " + properties + "\n\n**************************************");
             } catch (IOException e) {
                 PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPapServlet",
-                        " Error loading properties with: " + "XACMLProperties.getProperties()");
+                    " Error loading properties with: " + "XACMLProperties.getProperties()");
                 throw new ServletException(e.getMessage(), e.getCause());
             }
             // Create an IntegrityMonitor
             if (properties.getProperty(PERSISTENCE_JDBC_PWD) != null) {
                 properties.setProperty(PERSISTENCE_JDBC_PWD,
-                        PeCryptoUtils.decrypt(properties.getProperty(PERSISTENCE_JDBC_PWD, "")));
+                    PeCryptoUtils.decrypt(properties.getProperty(PERSISTENCE_JDBC_PWD, "")));
             }
             im = IntegrityMonitor.getInstance(papResourceName, properties);
             // Create an IntegrityAudit
@@ -274,26 +271,25 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             // we are about to call the PDPs and give them their configuration.
             // To do that we need to have the URL of this PAP so we can
             // construct the Policy file URLs
-            setPapUrl(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL));
+            setPapUrl(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_URL));
             // Create the policyDBDao
             setPolicyDbDao();
             // Load our PAP engine, first create a factory
-            ONAPPapEngineFactory factory = ONAPPapEngineFactory.newInstance(
-                    XACMLProperties.getProperty(XACMLProperties.PROP_PAP_PAPENGINEFACTORY));
+            ONAPPapEngineFactory factory = ONAPPapEngineFactory
+                .newInstance(XACMLProperties.getProperty(XACMLProperties.PROP_PAP_PAPENGINEFACTORY));
             // The factory knows how to go about creating a PAP Engine
             setPAPEngine(factory.newEngine());
             if (((org.onap.policy.xacml.std.pap.StdEngine) papEngine).wasDefaultGroupJustAdded) {
                 createDefaultGroupOnInit();
             }
             policyDbDao.setPapEngine(XACMLPapServlet.papEngine);
-            if (Boolean.parseBoolean(
-                    XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_RUN_AUDIT_FLAG))) {
+            if (Boolean.parseBoolean(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_RUN_AUDIT_FLAG))) {
                 /*
                  * Auditing the local File System groups to be in sync with the Database
                  */
 
                 // get an AuditTransaction to lock out all other transactions
-                PolicyDBDaoTransaction auditTrans = policyDbDao.getNewAuditTransaction();
+                PolicyDbDaoTransaction auditTrans = policyDbDao.getNewAuditTransaction();
 
                 LOGGER.info("PapServlet: calling auditLocalFileSystem for PDP group audit");
                 LOGGER.info("PapServlet: old group is " + papEngine.getDefaultGroup().toString());
@@ -304,8 +300,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                 if (updatedGroup != null) {
                     papEngine.updateGroup(updatedGroup);
                 }
-                LOGGER.info(
-                        "PapServlet:  updated group is " + papEngine.getDefaultGroup().toString());
+                LOGGER.info("PapServlet:  updated group is " + papEngine.getDefaultGroup().toString());
 
                 // sync up the config data from DB to file system
                 LOGGER.info("PapServlet:  Sync config data from DB to file system");
@@ -318,41 +313,37 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             // Configurable - have the PAP servlet initiate sending the latest
             // PDP policy/pip configuration
             // to all its known PDP nodes.
-            if (Boolean.parseBoolean(XACMLProperties
-                    .getProperty(XACMLRestProperties.PROP_PAP_INITIATE_PDP_CONFIG))) {
+            if (Boolean.parseBoolean(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_INITIATE_PDP_CONFIG))) {
                 startInitiateThreadService(new Thread(this));
             }
             // After startup, the PAP does Heartbeat's to each of the PDPs
             // periodically
             startHeartBeatService(new Heartbeat(XACMLPapServlet.papEngine));
         } catch (FactoryException | PAPException e) {
-            PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet",
-                    " Failed to create engine");
-            throw new ServletException(
-                    XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP not initialized; error: " + e);
+            PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet", " Failed to create engine");
+            throw new ServletException(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP not initialized; error: " + e);
         } catch (Exception e) {
             PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet",
-                    " Failed to create engine - unexpected error");
-            throw new ServletException(XACMLErrorConstants.ERROR_SYSTEM_ERROR
-                    + "PAP not initialized; unexpected error: " + e);
+                " Failed to create engine - unexpected error");
+            throw new ServletException(
+                XACMLErrorConstants.ERROR_SYSTEM_ERROR + "PAP not initialized; unexpected error: " + e);
         }
 
     }
 
     private void createDefaultGroupOnInit() {
-        PolicyDBDaoTransaction addNewGroup = null;
+        PolicyDbDaoTransaction addNewGroup = null;
         try {
             addNewGroup = policyDbDao.getNewTransaction();
             OnapPDPGroup group = papEngine.getDefaultGroup();
-            addNewGroup.createGroup(group.getId(), group.getName(), group.getDescription(),
-                    "automaticallyAdded");
+            addNewGroup.createGroup(group.getId(), group.getName(), group.getDescription(), "automaticallyAdded");
             addNewGroup.commitTransaction();
             addNewGroup = policyDbDao.getNewTransaction();
             addNewGroup.changeDefaultGroup(group, "automaticallyAdded");
             addNewGroup.commitTransaction();
         } catch (Exception e) {
             PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet",
-                    " Error creating new default group in the database");
+                " Error creating new default group in the database");
             if (addNewGroup != null) {
                 addNewGroup.rollbackTransaction();
             }
@@ -364,8 +355,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
         initiateThread.start();
     }
 
-    private static void mapperWriteValue(ObjectMapper mapper, HttpServletResponse response,
-            Object value) {
+    @VisibleForTesting
+    protected static void mapperWriteValue(ObjectMapper mapper, HttpServletResponse response, Object value) {
         try {
             mapper.writeValue(response.getOutputStream(), value);
         } catch (Exception e) {
@@ -381,13 +372,13 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
 
     private static void setPolicyDbDao() throws ServletException {
         try {
-            policyDbDao = PolicyDBDao.getPolicyDBDaoInstance();
+            policyDbDao = PolicyDbDao.getPolicyDbDaoInstance();
         } catch (Exception e) {
             throw new ServletException("Unable to Create Policy DBDao Instance", e);
         }
     }
 
-    public static PolicyDBDao getPolicyDbDao() {
+    public static PolicyDbDao getPolicyDbDao() {
         return policyDbDao;
     }
 
@@ -399,7 +390,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
         return papUrl;
     }
 
-    private static void setPAPEngine(PAPPolicyEngine newEngine) {
+    @VisibleForTesting
+    protected static void setPAPEngine(PAPPolicyEngine newEngine) {
         XACMLPapServlet.papEngine = newEngine;
     }
 
@@ -412,22 +404,19 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                 papDependencyGroupsFlatArray[i] = papDependencyGroupsFlatArray[i].trim();
             }
             try {
-                if (XACMLProperties.getProperty(
-                        XACMLRestProperties.PAP_INTEGRITY_AUDIT_PERIOD_SECONDS) != null) {
-                    papIntegrityAuditPeriodSeconds = Integer.parseInt(XACMLProperties
-                            .getProperty(XACMLRestProperties.PAP_INTEGRITY_AUDIT_PERIOD_SECONDS)
-                            .trim());
+                if (XACMLProperties.getProperty(XacmlRestProperties.PAP_INTEGRITY_AUDIT_PERIOD_SECONDS) != null) {
+                    papIntegrityAuditPeriodSeconds = Integer.parseInt(
+                        XACMLProperties.getProperty(XacmlRestProperties.PAP_INTEGRITY_AUDIT_PERIOD_SECONDS).trim());
                 }
             } catch (Exception e) {
                 String msg = "integrity_audit_period_seconds ";
                 LOGGER.error("\n\nERROR: " + msg + "Bad property entry: " + e.getMessage() + "\n");
                 PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet",
-                        " ERROR: " + msg + "Bad property entry");
+                    " ERROR: " + msg + "Bad property entry");
                 throw e;
             }
         } catch (Exception e) {
-            PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet",
-                    " ERROR: Bad property entry");
+            PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "XACMLPapServlet", " ERROR: Bad property entry");
             throw new PAPException(e);
         }
     }
@@ -435,39 +424,38 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
     private static void setCommonProperties() throws PAPException {
         setConfigHome();
         setActionHome();
-        papDbDriver = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_DRIVER);
+        papDbDriver = XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_DB_DRIVER);
         if (papDbDriver == null) {
             PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, "XACMLPapServlet",
-                    " ERROR: Bad papDbDriver property entry");
+                " ERROR: Bad papDbDriver property entry");
             throw new PAPException("papDbDriver is null");
         }
         setPapDbDriver(papDbDriver);
-        papDbUrl = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_URL);
+        papDbUrl = XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_DB_URL);
         if (papDbUrl == null) {
-            PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, "XACMLPapServlet",
-                    " ERROR: Bad papDbUrl property entry");
+            PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, "XACMLPapServlet", " ERROR: Bad papDbUrl property entry");
             throw new PAPException("papDbUrl is null");
         }
         setPapDbUrl(papDbUrl);
-        papDbUser = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_USER);
+        papDbUser = XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_DB_USER);
         if (papDbUser == null) {
             PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, "XACMLPapServlet",
-                    " ERROR: Bad papDbUser property entry");
+                " ERROR: Bad papDbUser property entry");
             throw new PAPException("papDbUser is null");
         }
         setPapDbUser(papDbUser);
-        PeCryptoUtils.initAesKey(XACMLProperties.getProperty(XACMLRestProperties.PROP_AES_KEY));
-        papDbPd = PeCryptoUtils.decrypt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_DB_PASSWORD));
+        PeCryptoUtils.initAesKey(XACMLProperties.getProperty(XacmlRestProperties.PROP_AES_KEY));
+        papDbPd = PeCryptoUtils.decrypt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_DB_PASSWORD));
         if (papDbPd == null) {
             PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, "XACMLPapServlet",
-                    " ERROR: Bad papDbPassword property entry");
+                " ERROR: Bad papDbPassword property entry");
             throw new PAPException("papDbPassword is null");
         }
         setPapDbPassword(papDbPd);
-        papResourceName = XACMLProperties.getProperty(XACMLRestProperties.PAP_RESOURCE_NAME);
+        papResourceName = XACMLProperties.getProperty(XacmlRestProperties.PAP_RESOURCE_NAME);
         if (papResourceName == null) {
             PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, "XACMLPapServlet",
-                    " ERROR: Bad papResourceName property entry");
+                " ERROR: Bad papResourceName property entry");
             throw new PAPException("papResourceName is null");
         }
         environment = XACMLProperties.getProperty("ENVIRONMENT", "DEVL");
@@ -477,13 +465,12 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
         msPolicyName = XACMLProperties.getProperty("xacml.policy.msPolicyName");
         setMsPolicyName(msPolicyName);
         // PDPId File location
-        XACMLPapServlet.pdpFile = XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_IDFILE);
+        XACMLPapServlet.pdpFile = XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_IDFILE);
         if (XACMLPapServlet.pdpFile == null) {
-            PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE
-                    + " The PDP Id Authentication File Property is not valid: "
-                    + XACMLRestProperties.PROP_PDP_IDFILE);
-            throw new PAPException("The PDP Id Authentication File Property :"
-                    + XACMLRestProperties.PROP_PDP_IDFILE + " is not Valid. ");
+            PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " The PDP Id Authentication File Property is not valid: "
+                + XacmlRestProperties.PROP_PDP_IDFILE);
+            throw new PAPException(
+                "The PDP Id Authentication File Property :" + XacmlRestProperties.PROP_PDP_IDFILE + " is not Valid. ");
         }
     }
 
@@ -517,8 +504,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                 XACMLPapServlet.heartbeatThread.join();
             } catch (InterruptedException e) {
                 XACMLPapServlet.heartbeatThread.interrupt();
-                PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet",
-                        " Error stopping heartbeat");
+                PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet", " Error stopping heartbeat");
             }
         }
         if (initiateThread != null) {
@@ -527,8 +513,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                 initiateThread.join();
             } catch (InterruptedException e) {
                 initiateThread.interrupt();
-                PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet",
-                        " Error stopping thread");
+                PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet", " Error stopping thread");
             }
         }
     }
@@ -545,21 +530,19 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
      */
     @Override
     protected void doPost(HttpServletRequest request, HttpServletResponse response)
-            throws ServletException, IOException {
-        OnapLoggingContext loggingContext =
-                OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
+        throws ServletException, IOException {
+        OnapLoggingContext loggingContext = OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
         setLoggingContext(loggingContext, "doPost", "PAP.post");
-        PolicyDBDaoTransaction pdpTransaction = null;
+        PolicyDbDaoTransaction pdpTransaction = null;
         try {
             loggingContext.metricStarted();
             im.startTransaction();
             loggingContext.metricEnded();
             PolicyLogger.metrics("XACMLPapServlet doPost im startTransaction");
         } catch (AdministrativeStateException ae) {
-            String message = "POST interface called for PAP " + papResourceName
-                    + " but it has an Administrative state of "
-                    + im.getStateManager().getAdminState() + "\n Exception Message: "
-                    + PolicyUtils.CATCH_EXCEPTION;
+            String message =
+                "POST interface called for PAP " + papResourceName + " but it has an Administrative state of "
+                    + im.getStateManager().getAdminState() + "\n Exception Message: " + PolicyUtils.CATCH_EXCEPTION;
             LOGGER.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message, ae);
             loggingContext.metricEnded();
             PolicyLogger.metrics("XACMLPapServlet doPost im startTransaction");
@@ -568,13 +551,10 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
             return;
         } catch (IntegrityMonitorException ime) {
-            String message = "POST interface called for PAP " + papResourceName
-                    + " but it has an Administrative state of "
-                    + im.getStateManager().getAdminState()
-                    + " and a Standby Status of "
-                    + im.getStateManager().getStandbyStatus()
-                    + "\n Exception Message: "
-                    + ime.getMessage();
+            String message =
+                "POST interface called for PAP " + papResourceName + " but it has an Administrative state of "
+                    + im.getStateManager().getAdminState() + " and a Standby Status of "
+                    + im.getStateManager().getStandbyStatus() + "\n Exception Message: " + ime.getMessage();
             LOGGER.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message, ime);
             loggingContext.metricEnded();
             PolicyLogger.metrics("XACMLPapServlet doPost im startTransaction");
@@ -585,7 +565,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
         }
         try {
             loggingContext.metricStarted();
-            XACMLRest.dumpRequest(request);
+            XacmlRest.dumpRequest(request);
             loggingContext.metricEnded();
             PolicyLogger.metrics("XACMLPapServlet doPost dumpRequest");
             // since getParameter reads the content string, explicitly get the
@@ -611,8 +591,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                     }
                 }
                 loggingContext.metricStarted();
-                getAcServiceInstance().doAcPost(request, response, groupId, loggingContext,
-                        papEngine);
+                getAcServiceInstance().doAcPost(request, response, groupId, loggingContext, papEngine);
                 loggingContext.metricEnded();
                 PolicyLogger.metrics("XACMLPapServlet doPost doACPost");
                 loggingContext.transactionEnded();
@@ -635,23 +614,18 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                 if (CheckPDP.validateID(id)) {
                     pdpTransaction = policyDbDao.getNewTransaction();
                     try {
-                        pdpTransaction.addPdpToGroup(id,
-                                XACMLPapServlet.papEngine.getDefaultGroup().getId(), id,
-                                "Registered on first startup", Integer.parseInt(jmxport),
-                                "PDP autoregister");
-                        XACMLPapServlet.papEngine.newPDP(id,
-                                XACMLPapServlet.papEngine.getDefaultGroup(), id,
-                                "Registered on first startup", Integer.parseInt(jmxport));
-                    } catch (NullPointerException | PAPException | IllegalArgumentException
-                            | IllegalStateException | PersistenceException | PolicyDBException e) {
+                        pdpTransaction.addPdpToGroup(id, XACMLPapServlet.papEngine.getDefaultGroup().getId(), id,
+                            "Registered on first startup", Integer.parseInt(jmxport), "PDP autoregister");
+                        XACMLPapServlet.papEngine.newPDP(id, XACMLPapServlet.papEngine.getDefaultGroup(), id,
+                            "Registered on first startup", Integer.parseInt(jmxport));
+                    } catch (NullPointerException | PAPException | IllegalArgumentException | IllegalStateException
+                        | PersistenceException | PolicyDbException e) {
                         pdpTransaction.rollbackTransaction();
                         String message = "Failed to create new PDP for id: " + id;
-                        PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet",
-                                " " + message);
+                        PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " " + message);
                         loggingContext.transactionEnded();
                         PolicyLogger.audit("Transaction Failed - See Error.log");
-                        setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
-                                e.getMessage());
+                        setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
                         im.endTransaction();
                         return;
                     }
@@ -669,8 +643,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                         PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW + " " + message);
                         loggingContext.transactionEnded();
                         PolicyLogger.audit("Transaction Failed - See Error.log");
-                        setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
-                                message);
+                        setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, message);
                         im.endTransaction();
                         return;
                     }
@@ -679,7 +652,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                     loggingContext.transactionEnded();
                     PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + " " + message);
                     setResponseError(response, HttpServletResponse.SC_UNAUTHORIZED,
-                            "PDP not Authorized to connect to this PAP. Please contact the PAP Admin for registration.");
+                        "PDP not Authorized to connect to this PAP. Please contact the PAP Admin for registration.");
                     PolicyLogger.audit("Transaction Failed - See Error.log");
                     im.endTransaction();
                     return;
@@ -691,7 +664,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                     PolicyLogger.metrics("XACMLPapServlet doPost commitTransaction");
                 } catch (Exception e) {
                     PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet",
-                            "Could not commit transaction to put pdp in the database");
+                        "Could not commit transaction to put pdp in the database");
                 }
             }
             if (jmxport != null && !"".equals(jmxport)) {
@@ -709,12 +682,12 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                 LOGGER.error(e);
             }
             if (group == null) {
-                PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW
-                        + " PDP not associated with any group, even the default");
+                PolicyLogger
+                    .error(MessageCodes.ERROR_PROCESS_FLOW + " PDP not associated with any group, even the default");
                 loggingContext.transactionEnded();
                 PolicyLogger.audit("Transaction Failed - See Error.log");
                 setResponseError(response, HttpServletResponse.SC_UNAUTHORIZED,
-                        "PDP not associated with any group, even the default");
+                    "PDP not associated with any group, even the default");
                 im.endTransaction();
                 return;
             }
@@ -783,8 +756,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             LOGGER.debug(XACMLErrorConstants.ERROR_PROCESS_FLOW + "POST exception: " + e, e);
             loggingContext.transactionEnded();
             PolicyLogger.audit("Transaction Failed - See Error.log");
-            setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
-                    e.getMessage());
+            setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
             im.endTransaction();
             return;
         }
@@ -809,12 +781,11 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
      */
     @Override
     protected void doGet(HttpServletRequest request, HttpServletResponse response)
-            throws ServletException, IOException {
-        OnapLoggingContext loggingContext =
-                OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
+        throws ServletException, IOException {
+        OnapLoggingContext loggingContext = OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
         setLoggingContext(loggingContext, "doGet", "PAP.get");
         loggingContext.metricStarted();
-        XACMLRest.dumpRequest(request);
+        XacmlRest.dumpRequest(request);
         loggingContext.metricEnded();
         PolicyLogger.metrics("XACMLPapServlet doGet dumpRequest");
         String pathInfo = request.getRequestURI();
@@ -835,13 +806,10 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             loggingContext.metricEnded();
             PolicyLogger.metrics("XACMLPapServlet doGet im startTransaction");
         } catch (IntegrityMonitorException ime) {
-            String message = "GET interface called for PAP " + papResourceName
-                    + " but it has an Administrative state of "
-                    + im.getStateManager().getAdminState()
-                    + " and a Standby Status of "
-                    + im.getStateManager().getStandbyStatus()
-                    + "\n Exception Message: "
-                    + ime.getMessage();
+            String message =
+                "GET interface called for PAP " + papResourceName + " but it has an Administrative state of "
+                    + im.getStateManager().getAdminState() + " and a Standby Status of "
+                    + im.getStateManager().getStandbyStatus() + "\n Exception Message: " + ime.getMessage();
             LOGGER.info(message, ime);
             PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
             loggingContext.transactionEnded();
@@ -868,7 +836,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                 return;
             } else {
                 String message =
-                        "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
+                    "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
                 PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + " " + message);
                 loggingContext.transactionEnded();
                 PolicyLogger.audit("Transaction Failed - See Error.log");
@@ -883,8 +851,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             // this is from the Admin Console, so handle separately
             try {
                 loggingContext.metricStarted();
-                getAcServiceInstance().doAcGet(request, response, groupId, loggingContext,
-                        papEngine);
+                getAcServiceInstance().doAcGet(request, response, groupId, loggingContext, papEngine);
                 loggingContext.metricEnded();
                 PolicyLogger.metrics("XACMLPapServlet doGet doACGet");
             } catch (IOException e) {
@@ -908,8 +875,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
         // Is it known?
         if (pdp == null) {
             // Check if request came from localhost
-            if ("localhost".equals(request.getRemoteHost())
-                    || request.getRemoteHost().equals(request.getLocalAddr())) {
+            if ("localhost".equals(request.getRemoteHost()) || request.getRemoteHost().equals(request.getLocalAddr())) {
                 // Return status information - basically all the groups
                 loggingContext.setServiceName("PAP.getGroups");
                 Set<OnapPDPGroup> groups = null;
@@ -917,12 +883,10 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                     groups = papEngine.getOnapPDPGroups();
                 } catch (PAPException e) {
                     LOGGER.debug(e);
-                    PolicyLogger.error(MessageCodes.ERROR_UNKNOWN, e, "XACMLPapServlet",
-                            " GET exception");
+                    PolicyLogger.error(MessageCodes.ERROR_UNKNOWN, e, "XACMLPapServlet", " GET exception");
                     loggingContext.transactionEnded();
                     PolicyLogger.audit("Transaction Failed - See Error.log");
-                    setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
-                            e.getMessage());
+                    setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
                     im.endTransaction();
                     return;
                 }
@@ -935,8 +899,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                 im.endTransaction();
                 return;
             }
-            String message = "Unknown PDP: " + id + " from " + request.getRemoteHost() + " us: "
-                    + request.getLocalAddr();
+            String message =
+                "Unknown PDP: " + id + " from " + request.getRemoteHost() + " us: " + request.getLocalAddr();
             PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + " " + message);
             loggingContext.transactionEnded();
             PolicyLogger.audit("Transaction Failed - See Error.log");
@@ -983,15 +947,15 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             return;
         }
         try {
-            LOGGER.warn("PolicyDebugging: Policy Validity: " + policy.isValid() + "\n "
-                    + "Policy Name : " + policy.getName() + "\n Policy URI: "
-                    + policy.getLocation().toString());
+            LOGGER.warn("PolicyDebugging: Policy Validity: " + policy.isValid() + "\n " + "Policy Name : "
+                + policy.getName() + "\n Policy URI: " + policy.getLocation().toString());
         } catch (PAPException | IOException e) {
             LOGGER.error(e);
         }
-        try (InputStream is = new FileInputStream(
-                ((StdPDPGroup) group).getDirectory().toString() + File.separator + policyId);
-                OutputStream os = response.getOutputStream()) {
+        try (
+            InputStream is =
+                new FileInputStream(((StdPDPGroup) group).getDirectory().toString() + File.separator + policyId);
+            OutputStream os = response.getOutputStream()) {
             // Send the policy back
             IOUtils.copy(is, os);
             response.setStatus(HttpServletResponse.SC_OK);
@@ -1016,9 +980,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
      */
     @Override
     protected void doPut(HttpServletRequest request, HttpServletResponse response)
-            throws ServletException, IOException {
-        OnapLoggingContext loggingContext =
-                OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
+        throws ServletException, IOException {
+        OnapLoggingContext loggingContext = OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
         setLoggingContext(loggingContext, "doPut", "PAP.put");
         try {
             loggingContext.metricStarted();
@@ -1026,13 +989,10 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             loggingContext.metricEnded();
             PolicyLogger.metrics("XACMLPapServlet doPut im startTransaction");
         } catch (IntegrityMonitorException e) {
-            String message = "PUT interface called for PAP " + papResourceName
-                    + " but it has an Administrative state of "
-                    + im.getStateManager().getAdminState()
-                    + " and a Standby Status of "
-                    + im.getStateManager().getStandbyStatus()
-                    + "\n Exception Message: "
-                    + e.getMessage();
+            String message =
+                "PUT interface called for PAP " + papResourceName + " but it has an Administrative state of "
+                    + im.getStateManager().getAdminState() + " and a Standby Status of "
+                    + im.getStateManager().getStandbyStatus() + "\n Exception Message: " + e.getMessage();
             LOGGER.info(message, e);
             PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
             loggingContext.transactionEnded();
@@ -1046,7 +1006,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
         String apiflag = request.getParameter("apiflag");
         // For Debug purposes
         if (!"api".equals(apiflag) && PolicyLogger.isDebugEnabled()) {
-            XACMLRest.dumpRequest(request);
+            XacmlRest.dumpRequest(request);
             PolicyLogger.metrics("XACMLPapServlet doPut dumpRequest");
         }
         loggingContext.metricEnded();
@@ -1067,11 +1027,9 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             }
             loggingContext.metricStarted();
             LOGGER.info("XACMLPapServlet: Calling PolicyDBDao to handlIncomingHttpNotification");
-            HandleIncomingNotifications handleIncomingNotifications =
-                    new HandleIncomingNotifications();
+            HandleIncomingNotifications handleIncomingNotifications = new HandleIncomingNotifications();
             handleIncomingNotifications.handleIncomingHttpNotification(policyDBDaoRequestUrl,
-                    policyDBDaoRequestEntityId, policyDBDaoRequestEntityType,
-                    policyDBDaoRequestExtraData, this);
+                policyDBDaoRequestEntityId, policyDBDaoRequestEntityType, policyDBDaoRequestExtraData, this);
             loggingContext.metricEnded();
             PolicyLogger.metrics("XACMLPapServlet doPut handle incoming http notification");
             response.setStatus(200);
@@ -1099,7 +1057,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                 return;
             } else {
                 String message =
-                        "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
+                    "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
                 LOGGER.error(XACMLErrorConstants.ERROR_PERMISSIONS + message);
                 loggingContext.transactionEnded();
                 PolicyLogger.audit("Transaction Failed - See Error.log");
@@ -1137,7 +1095,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             if (apiflag != null) {
                 if (!authorizeRequest(request)) {
                     String message =
-                            "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
+                        "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
                     PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + " " + message);
                     loggingContext.transactionEnded();
                     PolicyLogger.audit("Transaction Failed - See Error.log");
@@ -1159,8 +1117,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             // this is from the Admin Console, so handle separately
             try {
                 loggingContext.metricEnded();
-                getAcServiceInstance().doAcPut(request, response, groupId, loggingContext,
-                        papEngine);
+                getAcServiceInstance().doAcPut(request, response, groupId, loggingContext, papEngine);
                 loggingContext.metricEnded();
                 PolicyLogger.metrics("XACMLPapServlet goPut doACPut");
             } catch (IOException e) {
@@ -1217,12 +1174,10 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
         }
         // We do not expect anything from anywhere else.
         // This method is here in case we ever need to support other operations.
-        LOGGER.error(
-                XACMLErrorConstants.ERROR_DATA_ISSUE + "Request does not have groupId or apiflag");
+        LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Request does not have groupId or apiflag");
         loggingContext.transactionEnded();
         PolicyLogger.audit("Transaction Failed - See Error.log");
-        setResponseError(response, HttpServletResponse.SC_BAD_REQUEST,
-                "Request does not have groupId or apiflag");
+        setResponseError(response, HttpServletResponse.SC_BAD_REQUEST, "Request does not have groupId or apiflag");
         loggingContext.transactionEnded();
         PolicyLogger.audit("Transaction Failed - See error.log");
         im.endTransaction();
@@ -1233,9 +1188,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
      */
     @Override
     protected void doDelete(HttpServletRequest request, HttpServletResponse response)
-            throws ServletException, IOException {
-        OnapLoggingContext loggingContext =
-                OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
+        throws ServletException, IOException {
+        OnapLoggingContext loggingContext = OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
         setLoggingContext(loggingContext, "doDelete", "PAP.delete");
         try {
             loggingContext.metricStarted();
@@ -1243,13 +1197,10 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             loggingContext.metricEnded();
             PolicyLogger.metrics("XACMLPapServlet doDelete im startTransaction");
         } catch (IntegrityMonitorException ime) {
-            String message = "DELETE interface called for PAP " + papResourceName
-                    + " but it has an Administrative state of "
-                    + im.getStateManager().getAdminState()
-                    + " and a Standby Status of "
-                    + im.getStateManager().getStandbyStatus()
-                    + "\n Exception Message: "
-                    + ime.getMessage();
+            String message =
+                "DELETE interface called for PAP " + papResourceName + " but it has an Administrative state of "
+                    + im.getStateManager().getAdminState() + " and a Standby Status of "
+                    + im.getStateManager().getStandbyStatus() + "\n Exception Message: " + ime.getMessage();
             LOGGER.info(message, ime);
             PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
             loggingContext.transactionEnded();
@@ -1258,7 +1209,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             return;
         }
         loggingContext.metricStarted();
-        XACMLRest.dumpRequest(request);
+        XacmlRest.dumpRequest(request);
         loggingContext.metricEnded();
         PolicyLogger.metrics("XACMLPapServlet doDelete dumpRequest");
         String groupId = request.getParameter(GROUPID);
@@ -1268,7 +1219,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             if (apiflag != null) {
                 if (!authorizeRequest(request)) {
                     String message =
-                            "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
+                        "PEP not Authorized for making this Request!! \n Contact Administrator for this Scope. ";
                     PolicyLogger.error(MessageCodes.ERROR_PERMISSIONS + " " + message);
                     loggingContext.transactionEnded();
                     PolicyLogger.audit("Transaction Failed - See Error.log");
@@ -1292,8 +1243,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             // this is from the Admin Console, so handle separately
             try {
                 loggingContext.metricStarted();
-                getAcServiceInstance().doAcDelete(request, response, groupId, loggingContext,
-                        papEngine);
+                getAcServiceInstance().doAcDelete(request, response, groupId, loggingContext, papEngine);
                 loggingContext.metricEnded();
                 PolicyLogger.metrics("XACMLPapServlet doDelete doACDelete");
             } catch (IOException e) {
@@ -1308,20 +1258,16 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
         PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + " Request does not have groupId");
         loggingContext.transactionEnded();
         PolicyLogger.audit("Transaction Failed - See Error.log");
-        setResponseError(response, HttpServletResponse.SC_BAD_REQUEST,
-                "Request does not have groupId");
+        setResponseError(response, HttpServletResponse.SC_BAD_REQUEST, "Request does not have groupId");
         im.endTransaction();
     }
 
-    private boolean isPDPCurrent(Properties policies, Properties pipconfig,
-            Properties pdpProperties) {
+    private boolean isPDPCurrent(Properties policies, Properties pipconfig, Properties pdpProperties) {
         String localRootPolicies = policies.getProperty(XACMLProperties.PROP_ROOTPOLICIES);
-        String localReferencedPolicies =
-                policies.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES);
+        String localReferencedPolicies = policies.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES);
         if (localRootPolicies == null || localReferencedPolicies == null) {
-            LOGGER.warn(XACMLErrorConstants.ERROR_DATA_ISSUE
-                    + "Missing property on PAP server: RootPolicies=" + localRootPolicies
-                    + "  ReferencedPolicies=" + localReferencedPolicies);
+            LOGGER.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + "Missing property on PAP server: RootPolicies="
+                + localRootPolicies + "  ReferencedPolicies=" + localReferencedPolicies);
             return false;
         }
         // Compare the policies and pipconfig properties to the pdpProperties
@@ -1331,9 +1277,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             Properties pdpPolicies = XACMLProperties.getPolicyProperties(pdpProperties, false);
             Properties pdpPipConfig = XACMLProperties.getPipProperties(pdpProperties);
             if (localRootPolicies.equals(pdpPolicies.getProperty(XACMLProperties.PROP_ROOTPOLICIES))
-                    && localReferencedPolicies.equals(
-                            pdpPolicies.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES))
-                    && pdpPipConfig.equals(pipconfig)) {
+                && localReferencedPolicies.equals(pdpPolicies.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES))
+                && pdpPipConfig.equals(pipconfig)) {
                 // The PDP is current
                 return true;
             }
@@ -1344,13 +1289,13 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             // property.
             // Either of these cases means that the PDP is not up-to-date, so
             // just drop-through to return false.
-            PolicyLogger.error(MessageCodes.ERROR_SCHEMA_INVALID, e, "XACMLPapServlet",
-                    " PDP Error");
+            PolicyLogger.error(MessageCodes.ERROR_SCHEMA_INVALID, e, "XACMLPapServlet", " PDP Error");
         }
         return false;
     }
 
-    private void populatePolicyURL(StringBuffer urlPath, Properties policies) {
+    @VisibleForTesting
+    protected void populatePolicyURL(StringBuffer urlPath, Properties policies) {
         String lists[] = new String[2];
         lists[0] = policies.getProperty(XACMLProperties.PROP_ROOTPOLICIES);
         lists[1] = policies.getProperty(XACMLProperties.PROP_REFERENCEDPOLICIES);
@@ -1366,7 +1311,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
     }
 
     protected String getPDPID(HttpServletRequest request) {
-        String pdpURL = request.getHeader(XACMLRestProperties.PROP_PDP_HTTP_HEADER_ID);
+        String pdpURL = request.getHeader(XacmlRestProperties.PROP_PDP_HTTP_HEADER_ID);
         if (pdpURL == null || pdpURL.isEmpty()) {
             // Should send back its port for identification
             LOGGER.warn(XACMLErrorConstants.ERROR_DATA_ISSUE + "PDP did not send custom header");
@@ -1376,11 +1321,11 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
     }
 
     protected String getPDPJMX(HttpServletRequest request) {
-        String pdpJMMX = request.getHeader(XACMLRestProperties.PROP_PDP_HTTP_HEADER_JMX_PORT);
+        String pdpJMMX = request.getHeader(XacmlRestProperties.PROP_PDP_HTTP_HEADER_JMX_PORT);
         if (pdpJMMX == null || pdpJMMX.isEmpty()) {
             // Should send back its port for identification
             LOGGER.warn(XACMLErrorConstants.ERROR_DATA_ISSUE
-                    + "PDP did not send custom header for JMX Port so the value of 0 is assigned");
+                + "PDP did not send custom header for JMX Port so the value of 0 is assigned");
             return null;
         }
         return pdpJMMX;
@@ -1396,9 +1341,9 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
      * @throws ServletException
      * @throws IOException
      */
-    public void updateGroupsFromAPI(HttpServletRequest request, HttpServletResponse response,
-            String groupId, OnapLoggingContext loggingContext) throws IOException {
-        PolicyDBDaoTransaction acPutTransaction = policyDbDao.getNewTransaction();
+    public void updateGroupsFromAPI(HttpServletRequest request, HttpServletResponse response, String groupId,
+        OnapLoggingContext loggingContext) throws IOException {
+        PolicyDbDaoTransaction acPutTransaction = policyDbDao.getNewTransaction();
         PolicyLogger.audit("PolicyDBDaoTransaction started for updateGroupsFromAPI");
         try {
             String userId = request.getParameter("userId");
@@ -1424,7 +1369,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             LOGGER.info("Removing old version of the policy");
             for (PDPPolicy existingPolicy : group.getPolicies()) {
                 if (existingPolicy.getName().equals(policy.getName())
-                        && !existingPolicy.getId().equals(policy.getId())) {
+                    && !existingPolicy.getId().equals(policy.getId())) {
                     group.removePolicy(existingPolicy);
                     LOGGER.info("Removing policy: " + existingPolicy);
                     break;
@@ -1437,7 +1382,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                 acPutTransaction.updateGroup(group, "XACMLPapServlet.doACPut", userId);
             } catch (Exception e) {
                 PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet",
-                        " Error while updating group in the database: " + "group=" + group.getId());
+                    " Error while updating group in the database: " + "group=" + group.getId());
                 throw new PAPException(e.getMessage());
             }
 
@@ -1470,8 +1415,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             loggingContext.transactionEnded();
             LOGGER.info("Success");
 
-            if (policy != null && ((policy.getId().contains("Config_MS_"))
-                    || (policy.getId().contains("BRMS_Param")))) {
+            if (policy != null
+                && ((policy.getId().contains("Config_MS_")) || (policy.getId().contains("BRMS_Param")))) {
                 PushPolicyHandler pushPolicyHandler = PushPolicyHandler.getInstance();
                 if (pushPolicyHandler.preSafetyCheck(policy, configHome)) {
                     LOGGER.debug("Precheck Successful.");
@@ -1482,14 +1427,12 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             return;
         } catch (PAPException e) {
             acPutTransaction.rollbackTransaction();
-            PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet",
-                    " API PUT exception");
+            PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet", " API PUT exception");
             loggingContext.transactionEnded();
             PolicyLogger.audit("Transaction Failed - See Error.log");
             String message = XACMLErrorConstants.ERROR_PROCESS_FLOW
-                    + "Exception in request to update group from API - See Error.log on on the PAP.";
-            setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
-                    e.getMessage());
+                + "Exception in request to update group from API - See Error.log on on the PAP.";
+            setResponseError(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
             response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
             response.addHeader("error", ADD_GROUP_ERROR);
             response.addHeader("message", message);
@@ -1531,10 +1474,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
         try {
             groups = papEngine.getOnapPDPGroups();
         } catch (PAPException e) {
-            PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet",
-                    " getPDPGroups failed");
-            throw new IllegalAccessError(
-                    XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to get Groups: " + e);
+            PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet", " getPDPGroups failed");
+            throw new IllegalAccessError(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to get Groups: " + e);
         }
         for (OnapPDPGroup group : groups) {
             groupChanged(group);
@@ -1547,10 +1488,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
         try {
             groups = papEngine.getOnapPDPGroups();
         } catch (PAPException e) {
-            PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet",
-                    " getPDPGroups failed");
-            throw new IllegalAccessError(
-                    XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to get Groups: " + e);
+            PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "XACMLPapServlet", " getPDPGroups failed");
+            throw new IllegalAccessError(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Unable to get Groups: " + e);
         }
         for (OnapPDPGroup group : groups) {
             groupChanged(group, loggingContext);
@@ -1604,8 +1543,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
         }
     }
 
-    private void pdpChanged(OnapPDP pdp, OnapLoggingContext loggingContext,
-            List<Properties> pdpDataByGroup) {
+    private void pdpChanged(OnapPDP pdp, OnapLoggingContext loggingContext, List<Properties> pdpDataByGroup) {
         Thread t = new Thread(new UpdatePdpThread(pdp, loggingContext, pdpDataByGroup));
         if (CheckPDP.validateID(pdp.getId())) {
             t.start();
@@ -1622,8 +1560,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
         return dataToNotify.setPolicyConfigProperties(pdp, papEngine);
     }
 
-    private void testService(OnapLoggingContext loggingContext, HttpServletResponse response)
-            throws IOException {
+    private void testService(OnapLoggingContext loggingContext, HttpServletResponse response) throws IOException {
         LOGGER.info("Test request received");
         try {
             im.evaluateSanity();
@@ -1634,8 +1571,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             PolicyLogger.audit("Transaction Failed - See Error.log");
             response.setStatus(HttpServletResponse.SC_OK);
             return;
-        } catch (ForwardProgressException | AdministrativeStateException
-                | StandbyStatusException e) {
+        } catch (ForwardProgressException | AdministrativeStateException | StandbyStatusException e) {
             String submsg;
             if (e instanceof ForwardProgressException) {
                 submsg = " is not making forward progress.";
@@ -1645,8 +1581,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                 submsg = " Standby Status is NOT PROVIDING SERVICE.";
             }
 
-            String message = "GET:/pap/test called and PAP " + papResourceName + submsg
-                    + " Exception Message: " + e.getMessage();
+            String message =
+                "GET:/pap/test called and PAP " + papResourceName + submsg + " Exception Message: " + e.getMessage();
             LOGGER.info(message, e);
             PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
             loggingContext.transactionEnded();
@@ -1660,8 +1596,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
             if (eMsg == null) {
                 eMsg = "No Exception Message";
             }
-            String message = "GET:/pap/test called and PAP " + papResourceName
-                    + " has had a subsystem failure." + " Exception Message: " + eMsg;
+            String message = "GET:/pap/test called and PAP " + papResourceName + " has had a subsystem failure."
+                + " Exception Message: " + eMsg;
             LOGGER.info(message, e);
             PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR + " " + message);
             loggingContext.transactionEnded();
@@ -1686,18 +1622,16 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
         }
     }
 
-    private void setLoggingContext(OnapLoggingContext loggingContext, String methodType,
-            String serviceName) {
+    private void setLoggingContext(OnapLoggingContext loggingContext, String methodType, String serviceName) {
         loggingContext.transactionStarted();
         loggingContext.setServiceName(serviceName);
         if (loggingContext.getRequestId() == null || "".equals(loggingContext.getRequestId())) {
             UUID requestID = UUID.randomUUID();
             loggingContext.setRequestId(requestID.toString());
-            PolicyLogger.info("requestID not provided in call to XACMLPapServlet ('" + methodType
-                    + "') so we generated one");
+            PolicyLogger
+                .info("requestID not provided in call to XACMLPapServlet ('" + methodType + "') so we generated one");
         } else {
-            PolicyLogger.info(
-                    "requestID was provided in call to XACMLPapServlet ('" + methodType + "')");
+            PolicyLogger.info("requestID was provided in call to XACMLPapServlet ('" + methodType + "')");
         }
     }
 
@@ -1712,14 +1646,12 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
 
     private static void loadWebapps() throws PAPException {
         if (actionHome == null || configHome == null) {
-            Path webappsPath =
-                    Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_WEBAPPS));
+            Path webappsPath = Paths.get(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_WEBAPPS));
             // Sanity Check
             if (webappsPath == null) {
-                PolicyLogger.error("Invalid Webapps Path Location property : "
-                        + XACMLRestProperties.PROP_PAP_WEBAPPS);
-                throw new PAPException("Invalid Webapps Path Location property : "
-                        + XACMLRestProperties.PROP_PAP_WEBAPPS);
+                PolicyLogger.error("Invalid Webapps Path Location property : " + XacmlRestProperties.PROP_PAP_WEBAPPS);
+                throw new PAPException(
+                    "Invalid Webapps Path Location property : " + XacmlRestProperties.PROP_PAP_WEBAPPS);
             }
             Path webappsPathConfig = Paths.get(webappsPath.toString() + File.separator + "Config");
             Path webappsPathAction = Paths.get(webappsPath.toString() + File.separator + "Action");
@@ -1728,17 +1660,15 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
                     Files.createDirectories(webappsPathConfig);
                 } catch (IOException e) {
                     PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "XACMLPapServlet",
-                            "Failed to create config directory: "
-                                    + webappsPathConfig.toAbsolutePath().toString());
+                        "Failed to create config directory: " + webappsPathConfig.toAbsolutePath().toString());
                 }
             }
             if (Files.notExists(webappsPathAction)) {
                 try {
                     Files.createDirectories(webappsPathAction);
                 } catch (IOException e) {
-                    LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW
-                            + "Failed to create action directory: "
-                            + webappsPathAction.toAbsolutePath().toString(), e);
+                    LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to create action directory: "
+                        + webappsPathAction.toAbsolutePath().toString(), e);
                 }
             }
             actionHome = webappsPathAction.toString();
@@ -1790,7 +1720,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
         return papEngine;
     }
 
-    public static PolicyDBDaoTransaction getDbDaoTransaction() {
+    public static PolicyDbDaoTransaction getDbDaoTransaction() {
         return policyDbDao.getNewTransaction();
     }