diff --git a/BRMSGateway/pom.xml b/BRMSGateway/pom.xml
index 2f4612a..9be5c30 100644
--- a/BRMSGateway/pom.xml
+++ b/BRMSGateway/pom.xml
@@ -19,134 +19,166 @@
   -->
 
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-	<modelVersion>4.0.0</modelVersion>
-	<parent>
-		<groupId>org.onap.policy.engine</groupId>
-		<artifactId>PolicyEngineSuite</artifactId>
-		<version>1.2.0-SNAPSHOT</version>
-	</parent>
-	<artifactId>BRMSGateway</artifactId>
-	<description>This application will take in BRMS rules and acts as interface between PR and PDP XACML</description>
-	<dependencies>
-		<dependency>
-			<groupId>com.h2database</groupId>
-			<artifactId>h2</artifactId>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.onap.policy.engine</groupId>
-			<artifactId>PolicyEngineAPI</artifactId>
-			<version>${project.version}</version>
-			<exclusions>
-				<exclusion>
-					<groupId>com.att.nsa</groupId>
-					<artifactId>cambriaClient</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.maven</groupId>
-			<artifactId>maven-model</artifactId>
-			<version>3.5.3</version>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.maven.shared</groupId>
-			<artifactId>maven-invoker</artifactId>
-			<version>3.0.0</version>
-		</dependency>
-		<dependency>
-			<groupId>org.onap.policy.common</groupId>
-			<artifactId>integrity-monitor</artifactId>
-			<version>${project.version}</version>
-		</dependency>
-		<!--
-		CLM security fix - force use of commons-collections 3.2.2.
-		Remove this if a new version of nexus-rest-client-java is upgraded
-		to not use velocity (and then subsequently commons-collections v3.1 
-		 -->
-		<dependency>
-		    <groupId>commons-collections</groupId>
-		    <artifactId>commons-collections</artifactId>
-		    <version>3.2.2</version>
-		</dependency>
-		<dependency>
-			<groupId>org.sonatype.nexus</groupId>
-			<artifactId>nexus-rest-client-java</artifactId>
-			<version>2.3.1-01</version>
-			<exclusions>
-				<exclusion>
-					<groupId>commons-collections</groupId>
-					<artifactId>commons-collections</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>com.thoughtworks.xstream</groupId>
-			<artifactId>xstream</artifactId>
-			<version>1.4.10</version>
-		</dependency>
-		<dependency>
-			<groupId>com.att.nsa</groupId>
-			<artifactId>cambriaClient</artifactId>
-			<version>0.0.1</version>
-			<exclusions>
-				<exclusion>
-					<groupId>org.slf4j</groupId>
-					<artifactId>slf4j-log4j12</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
-			<artifactId>dmaapClient</artifactId>
-			<version>${dmaap.version}</version>
-			<exclusions>
-				<exclusion>
-					<groupId>org.slf4j</groupId>
-					<artifactId>slf4j-log4j12</artifactId>
-				</exclusion>
-				<exclusion>
-					<groupId>com.att.aft</groupId>
-					<artifactId>dme2</artifactId>
-				</exclusion>
-			</exclusions>
-		</dependency>
-		<dependency>
-			<groupId>org.apache.httpcomponents</groupId>
-			<artifactId>httpclient</artifactId>
-			<version>${httpclient.version}</version>
-		</dependency>
-	</dependencies>
-	<build>
-		<plugins>
-			<plugin>
-				<!-- Build an executable JAR -->
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-assembly-plugin</artifactId>
-				<version>2.2</version>
-				<configuration>
-					<archive>
-						<manifest>
-							<addClasspath>true</addClasspath>
-							<classpathPrefix>lib/</classpathPrefix>
-							<mainClass>org.onap.policy.brmsInterface.BRMSGateway</mainClass>
-						</manifest>
-					</archive>
-					<descriptorRefs>
-						<descriptorRef>jar-with-dependencies</descriptorRef>
-					</descriptorRefs>
-				</configuration>
-				<executions>
-					<execution>
-						<id>make-assembly</id>
-						<phase>package</phase>
-						<goals>
-							<goal>single</goal>
-						</goals>
-					</execution>
-				</executions>
-			</plugin>
-		</plugins>
-	</build>
+    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.onap.policy.engine</groupId>
+        <artifactId>PolicyEngineSuite</artifactId>
+        <version>1.2.0-SNAPSHOT</version>
+    </parent>
+    <artifactId>BRMSGateway</artifactId>
+    <description>This application will take in BRMS rules and acts as interface between PR and PDP XACML</description>
+    <dependencies>
+        <dependency>
+            <groupId>com.h2database</groupId>
+            <artifactId>h2</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.policy.engine</groupId>
+            <artifactId>PolicyEngineAPI</artifactId>
+            <version>${project.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>com.att.nsa</groupId>
+                    <artifactId>cambriaClient</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven</groupId>
+            <artifactId>maven-model</artifactId>
+            <version>3.5.3</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.maven.shared</groupId>
+            <artifactId>maven-invoker</artifactId>
+            <version>3.0.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.policy.common</groupId>
+            <artifactId>integrity-monitor</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- CLM security fix - force use of commons-collections 3.2.2. Remove 
+            this if a new version of nexus-rest-client-java is upgraded to not use velocity 
+            (and then subsequently commons-collections v3.1 -->
+        <dependency>
+            <groupId>commons-collections</groupId>
+            <artifactId>commons-collections</artifactId>
+            <version>3.2.2</version>
+        </dependency>
+        <dependency>
+            <groupId>org.sonatype.nexus</groupId>
+            <artifactId>nexus-rest-client-java</artifactId>
+            <version>2.3.1-01</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-collections</groupId>
+                    <artifactId>commons-collections</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.4.10</version>
+        </dependency>
+        <dependency>
+            <groupId>com.att.nsa</groupId>
+            <artifactId>cambriaClient</artifactId>
+            <version>0.0.1</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.onap.dmaap.messagerouter.dmaapclient</groupId>
+            <artifactId>dmaapClient</artifactId>
+            <version>${dmaap.version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-log4j12</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>com.att.aft</groupId>
+                    <artifactId>dme2</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.httpcomponents</groupId>
+            <artifactId>httpclient</artifactId>
+            <version>${httpclient.version}</version>
+        </dependency>
+    </dependencies>
+    <build>
+        <plugins>
+            <plugin>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>onap-java-style</id>
+                        <goals>
+                            <goal>check</goal>
+                        </goals>
+                        <phase>process-sources</phase>
+                        <configuration>
+                            <!-- Use Google Java Style Guide: https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml 
+                                with minor changes -->
+                            <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
+                            <!-- <sourceDirectory> is needed so that checkstyle 
+                                ignores the generated sources directory -->
+                            <sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
+                            <includeResources>true</includeResources>
+                            <includeTestSourceDirectory>true</includeTestSourceDirectory>
+                            <includeTestResources>true</includeTestResources>
+                            <consoleOutput>true</consoleOutput>
+                            <failOnViolation>true</failOnViolation>
+                            <violationSeverity>warning</violationSeverity>
+                        </configuration>
+                    </execution>
+                </executions>
+                <dependencies>
+                    <dependency>
+                        <groupId>org.onap.oparent</groupId>
+                        <artifactId>checkstyle</artifactId>
+                        <version>0.1.1</version>
+                        <scope>compile</scope>
+                    </dependency>
+                </dependencies>
+            </plugin>
+            <plugin>
+                <!-- Build an executable JAR -->
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-assembly-plugin</artifactId>
+                <version>2.2</version>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <addClasspath>true</addClasspath>
+                            <classpathPrefix>lib/</classpathPrefix>
+                            <mainClass>org.onap.policy.brmsInterface.BRMSGateway</mainClass>
+                        </manifest>
+                    </archive>
+                    <descriptorRefs>
+                        <descriptorRef>jar-with-dependencies</descriptorRef>
+                    </descriptorRefs>
+                </configuration>
+                <executions>
+                    <execution>
+                        <id>make-assembly</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
 </project>
diff --git a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSGateway.java b/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsGateway.java
similarity index 75%
rename from BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSGateway.java
rename to BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsGateway.java
index 98c49ce..d121783 100644
--- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSGateway.java
+++ b/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsGateway.java
@@ -18,7 +18,7 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.policy.brmsInterface;
+package org.onap.policy.brms.api;
 
 import org.onap.policy.api.NotificationScheme;
 import org.onap.policy.api.PolicyEngine;
@@ -28,29 +28,30 @@
 import org.onap.policy.xacml.api.XACMLErrorConstants;
 
 /**
- * BRMSGateway: This application acts as the Gateway interface between the PDP XACML and PDP Drools. The listens for
- * BRMS based policies and pushes them to the specified Policy Repository, from where the PDP Drools reads the Rule Jar.
+ * BRMSGateway: This application acts as the Gateway interface between the PDP XACML and PDP Drools.
+ * The listens for BRMS based policies and pushes them to the specified Policy Repository, from
+ * where the PDP Drools reads the Rule Jar.
  * 
  * @version 0.1
  */
-class BRMSGateway {
-	
-    private static final Logger logger = FlexLogger.getLogger(BRMSGateway.class);
+class BrmsGateway {
+
+    private static final Logger logger = FlexLogger.getLogger(BrmsGateway.class);
     private static final String CONFIGFILE = "config.properties";
 
     private static PolicyEngine policyEngine = null;
 
-    private BRMSGateway() {
-    	// Default private constructor
+    private BrmsGateway() {
+        // Default private constructor
     }
-    
-    public static void main(String[] args) throws Exception {
+
+    public static void main(final String[] args) throws Exception {
         // Initialize Handler.
         logger.info("Initializing BRMS Handler");
-        BRMSHandler bRMSHandler = null;
+        BrmsHandler brmsHandler = null;
         try {
-            bRMSHandler = new BRMSHandler(CONFIGFILE);
-        } catch (PolicyException e) {
+            brmsHandler = new BrmsHandler(CONFIGFILE);
+        } catch (final PolicyException e) {
             logger.error("Check your property file: " + e.getMessage(), e);
             System.exit(1);
         }
@@ -58,24 +59,24 @@
         // Set Handler with Auto Notification and initialize policyEngine
         try {
             logger.info("Initializing policyEngine with Auto Notifications");
-            policyEngine = new PolicyEngine(CONFIGFILE, NotificationScheme.AUTO_ALL_NOTIFICATIONS, bRMSHandler);
-        } catch (Exception e) {
+            policyEngine = new PolicyEngine(CONFIGFILE, NotificationScheme.AUTO_ALL_NOTIFICATIONS, brmsHandler);
+        } catch (final Exception e) {
             logger.error(XACMLErrorConstants.ERROR_UNKNOWN + "Error while Initializing Policy Engine " + e.getMessage(),
                     e);
         }
 
         // Keep Running....
-        Runnable runnable = () -> {
+        final Runnable runnable = () -> {
             while (true) {
                 try {
                     Thread.sleep(30000);
-                } catch (InterruptedException e) {
+                } catch (final InterruptedException e) {
                     logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "Thread Exception " + e.getMessage());
                     Thread.currentThread().interrupt();
                 }
             }
         };
-        Thread thread = new Thread(runnable);
+        final Thread thread = new Thread(runnable);
         thread.start();
     }
 
diff --git a/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsHandler.java b/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsHandler.java
new file mode 100644
index 0000000..0f686fe
--- /dev/null
+++ b/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsHandler.java
@@ -0,0 +1,200 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2017-2018 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.policy.brms.api;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.onap.policy.api.ConfigRequestParameters;
+import org.onap.policy.api.LoadedPolicy;
+import org.onap.policy.api.NotificationType;
+import org.onap.policy.api.PDPNotification;
+import org.onap.policy.api.PolicyConfig;
+import org.onap.policy.api.PolicyConfigStatus;
+import org.onap.policy.api.PolicyEngine;
+import org.onap.policy.api.PolicyException;
+import org.onap.policy.api.RemovedPolicy;
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
+import org.onap.policy.utils.BackUpHandler;
+import org.onap.policy.xacml.api.XACMLErrorConstants;
+
+/**
+ * BRMSHandler: Notification Handler which listens for PDP Notifications. Take action only for BRMS
+ * policies.
+ * 
+ * @version 0.3
+ */
+public class BrmsHandler implements BackUpHandler {
+
+    private static final Logger logger = FlexLogger.getLogger(BrmsHandler.class.getName());
+
+    private BrmsPush brmsPush = null;
+
+    public BrmsHandler(final String propertiesFile) throws PolicyException {
+        setBrmsPush(new BrmsPush(propertiesFile, this));
+    }
+
+    public void setBrmsPush(final BrmsPush brmsPush) {
+        this.brmsPush = brmsPush;
+    }
+
+    /*
+     * This Method is executed upon notification by the Policy Engine API Notification.
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.onap.policy.utils.BackUpHandler#notificationReceived(org.onap.policy.api.PDPNotification)
+     */
+    @Override
+    public void notificationReceived(final PDPNotification notification) {
+        logger.info("Notification Recieved");
+        logger.info(notification.getNotificationType().toString());
+        final Boolean flag = BrmsPush.getBackUpMonitor().getFlag();
+        brmsPush.initiate(flag);
+        if (flag) {
+            logger.info("Master Application performing on Notification ");
+            runOnNotification(notification);
+        } else {
+            logger.info("Slave application Skipping Notification.. ");
+        }
+    }
+
+    /*
+     * Executed when a policy is removed from PDP.
+     */
+    private void removedPolicies(final Collection<RemovedPolicy> removedPolicies) {
+        Boolean removed = false;
+        logger.info("Removed Policies");
+        for (final RemovedPolicy removedPolicy : removedPolicies) {
+            logger.info(removedPolicy.getPolicyName());
+            logger.info(removedPolicy.getVersionNo());
+            if (removedPolicy.getPolicyName().contains("_BRMS_")) {
+                try {
+                    logger.info("Policy Removed with this policy Name : " + removedPolicy.getPolicyName());
+                    brmsPush.removeRule(removedPolicy.getPolicyName());
+                    removed = true;
+                } catch (final Exception e) {
+                    logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Rertriving policy failed " + e.getMessage(),
+                            e);
+                }
+            }
+        }
+        Boolean failureFlag;
+        int index = 0;
+        do {
+            failureFlag = false;
+            if (removed) {
+                try {
+                    brmsPush.pushRules();
+                } catch (final PolicyException e) {
+                    // Upon Notification failure
+                    failureFlag = true;
+                    brmsPush.rotateUrls();
+                    logger.error("Failure during Push Operation ", e);
+                }
+            }
+            index++;
+        } 
+        while (failureFlag && index < brmsPush.urlListSize());
+    }
+
+    /*
+     * This method is executed if BRMSGW is "MASTER" (non-Javadoc)
+     * 
+     * @see
+     * org.onap.policy.utils.BackUpHandler#runOnNotification(org.onap.policy.api.PDPNotification)
+     */
+    @Override
+    public void runOnNotification(final PDPNotification notification) {
+        // reset the BRMSPush data structures
+        brmsPush.resetDs();
+        if (notification.getNotificationType().equals(NotificationType.REMOVE)) {
+            removedPolicies(notification.getRemovedPolicies());
+        } else if (notification.getNotificationType().equals(NotificationType.UPDATE)
+                || notification.getNotificationType().equals(NotificationType.BOTH)) {
+            logger.info("Updated Policies: \n");
+            final ArrayList<PolicyConfig> brmsPolicies = addedPolicies(notification);
+            Boolean successFlag = false;
+            for (int i = 0; !successFlag && i < brmsPush.urlListSize(); i++) {
+                if (i != 0) {
+                    for (final PolicyConfig policyConfig : brmsPolicies) {
+                        logger.info("Policy Retry with this Name notified: " + policyConfig.getPolicyName());
+                        brmsPush.addRule(policyConfig.getPolicyName(), policyConfig.toOther(),
+                                policyConfig.getResponseAttributes());
+                    }
+                }
+                try {
+                    brmsPush.pushRules();
+                    successFlag = true;
+                } catch (final PolicyException e) {
+                    // Upon Notification failure
+                    successFlag = false;
+                    brmsPush.rotateUrls();
+                    logger.error("Failure during Push Operation ", e);
+                }
+            }
+        }
+    }
+
+    /*
+     * Executed when a policy is added to PDP.
+     */
+    private ArrayList<PolicyConfig> addedPolicies(final PDPNotification notification) {
+        final ArrayList<PolicyConfig> result = new ArrayList<>();
+        for (final LoadedPolicy updatedPolicy : notification.getLoadedPolicies()) {
+            logger.info("policyName : " + updatedPolicy.getPolicyName());
+            logger.info("policyVersion :" + updatedPolicy.getVersionNo());
+            logger.info("Matches: " + updatedPolicy.getMatches());
+            // Checking the Name is correct or not.
+            if (updatedPolicy.getPolicyName().contains("_BRMS_")) {
+                try {
+                    final PolicyEngine policyEngine = getPolicyEngine();
+                    if (policyEngine != null) {
+                        final ConfigRequestParameters configRequestParameters = new ConfigRequestParameters();
+                        configRequestParameters.setPolicyName(updatedPolicy.getPolicyName());
+                        final Collection<PolicyConfig> policyConfigs = policyEngine.getConfig(configRequestParameters);
+                        for (final PolicyConfig policyConfig : policyConfigs) {
+                            if (policyConfig.getPolicyConfigStatus().equals(PolicyConfigStatus.CONFIG_RETRIEVED)) {
+                                logger.info(
+                                        "Policy Retrieved with this Name notified: " + policyConfig.getPolicyName());
+                                result.add(policyConfig);
+                                brmsPush.addRule(policyConfig.getPolicyName(), policyConfig.toOther(),
+                                        policyConfig.getResponseAttributes());
+                            } else {
+                                logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR
+                                        + "Fail to retrieve policy so rule will not be pushed to PolicyRepo !!!!\n\n");
+                            }
+                        }
+                    }
+                } catch (final Exception e) {
+                    logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Rertriving policy failed " + e.getMessage(),
+                            e);
+                }
+            }
+        }
+        return result;
+    }
+
+    public PolicyEngine getPolicyEngine() {
+        return BrmsGateway.getPolicyEngine();
+    }
+}
diff --git a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java b/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsPush.java
similarity index 61%
rename from BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java
rename to BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsPush.java
index 86cd066..63b6d2c 100644
--- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java
+++ b/BRMSGateway/src/main/java/org/onap/policy/brms/api/BrmsPush.java
@@ -18,7 +18,12 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.policy.brmsInterface;
+package org.onap.policy.brms.api;
+
+import com.att.nsa.cambria.client.CambriaBatchingPublisher;
+import com.att.nsa.cambria.client.CambriaClientBuilders;
+import com.att.nsa.cambria.client.CambriaClientBuilders.PublisherBuilder;
+import com.fasterxml.jackson.core.JsonProcessingException;
 
 import java.io.File;
 import java.io.FileInputStream;
@@ -71,9 +76,9 @@
 import org.eclipse.persistence.config.PersistenceUnitProperties;
 import org.onap.policy.api.PEDependency;
 import org.onap.policy.api.PolicyException;
-import org.onap.policy.brmsInterface.jpa.BRMSGroupInfo;
-import org.onap.policy.brmsInterface.jpa.BRMSPolicyInfo;
-import org.onap.policy.brmsInterface.jpa.DependencyInfo;
+import org.onap.policy.brms.entity.BrmsGroupInfo;
+import org.onap.policy.brms.entity.BrmsPolicyInfo;
+import org.onap.policy.brms.entity.DependencyInfo;
 import org.onap.policy.common.im.IntegrityMonitor;
 import org.onap.policy.common.logging.eelf.MessageCodes;
 import org.onap.policy.common.logging.eelf.PolicyLogger;
@@ -90,32 +95,29 @@
 import org.sonatype.nexus.client.rest.NexusRestClient;
 import org.sonatype.nexus.rest.model.NexusArtifact;
 
-import com.att.nsa.cambria.client.CambriaBatchingPublisher;
-import com.att.nsa.cambria.client.CambriaClientBuilders;
-import com.att.nsa.cambria.client.CambriaClientBuilders.PublisherBuilder;
-import com.fasterxml.jackson.core.JsonProcessingException;
-
 /**
- * BRMSPush: Application responsible to push policies to the BRMS PDP Policy Repository (PR). Mavenize and push policy
- * to PR
+ * BRMSPush: Application responsible to push policies to the BRMS PDP Policy Repository (PR).
+ * Mavenize and push policy to PR
  * 
  * @version 1.0
  */
 
 @SuppressWarnings("deprecation")
-public class BRMSPush {
+public class BrmsPush {
     private static final String GROUP_NAMES = "groupNames";
-	private static final String DROOLS_APPS_TEMPLATE_GROUP = "org.onap.policy.drools-applications.controlloop.templates";
-	private static final String DROOLS_APPS_MODEL_GROUP    = "org.onap.policy.drools-applications.controlloop.common.model-impl";
-	private static final String META_INF = "META-INF";
-	private static final String KMODULE_XML_FILE = "kmodule.xml";
-	private static final String POM_XML_FILE = "pom.xml";
-	private static final String VERSION_0_1_0 = "0.1.0";
-	private static final String RULES = "rules";
-	private static final String RESOURCES = "resources";
-	private static final Logger LOGGER = FlexLogger.getLogger(BRMSPush.class.getName());
+    private static final String DROOLS_APPS_TEMPLATE_GROUP =
+            "org.onap.policy.drools-applications.controlloop.templates";
+    private static final String DROOLS_APPS_MODEL_GROUP =
+            "org.onap.policy.drools-applications.controlloop.common.model-impl";
+    private static final String META_INF = "META-INF";
+    private static final String KMODULE_XML_FILE = "kmodule.xml";
+    private static final String POM_XML_FILE = "pom.xml";
+    private static final String VERSION_0_1_0 = "0.1.0";
+    private static final String RULES = "rules";
+    private static final String RESOURCES = "resources";
+    private static final Logger LOGGER = FlexLogger.getLogger(BrmsPush.class.getName());
     private static final String PROJECTSLOCATION = "RuleProjects";
-    private static final String[] GOALS = { "clean", "deploy" };
+    private static final String[] GOALS = {"clean", "deploy"};
     private static final String DEFAULT_VERSION = "1.2.0-SNAPSHOT";
     private static final String DEPENDENCY_FILE = "dependency.json";
     private static final String BRMSPERSISTENCE = "brmsEclipselink.persistencexml";
@@ -124,12 +126,12 @@
     private static IntegrityMonitor im;
     private static BackUpMonitor bm;
     private String defaultName = null;
-    private String repID = null;
+    private String repId = null;
     private String repName = null;
-    private ArrayList<String> repURLs = null;
+    private List<String> repUrlList = null;
     private String repUserName = null;
     private String repPassword = null;
-    private String policyKeyID = null;
+    private String policyKeyId = null;
     private boolean createFlag = false;
     private String uebList = null;
     private List<String> dmaapList = null;
@@ -139,19 +141,26 @@
     private Long uebDelay = Long.parseLong("20");
     private Long dmaapDelay = Long.parseLong("5000");
     private String notificationType = null;
-    private ArrayList<ControllerPOJO> controllers;
-    private HashMap<String, ArrayList<Object>> groupMap = new HashMap<>();
-    private Map<String, String> policyMap = new HashMap<>();
+    private List<ControllerPojo> controllers;
+    private Map<String, ArrayList<Object>> groupMap = new HashMap<>();
+    private final Map<String, String> policyMap = new HashMap<>();
     private String brmsdependencyversion;
     private EntityManager em;
     private boolean syncFlag = false;
 
-    public BRMSPush(String propertiesFile, BackUpHandler handler) throws PolicyException {
-        if(propertiesFile==null || handler==null){
+    /**
+     * Responsible to push policies to the BRMS PDP Policy Repository (PR).
+     * 
+     * @param propertiesFile the properties file
+     * @param handler the {@link BackUpHandler}
+     * @throws PolicyException PolicyException related to the operation
+     */
+    public BrmsPush(final String propertiesFile, final BackUpHandler handler) throws PolicyException {
+        if (propertiesFile == null || handler == null) {
             throw new PolicyException("Error no propertiesFile or handler");
         }
-        Properties config = new Properties();
-        Path file = Paths.get(propertiesFile);
+        final Properties config = new Properties();
+        final Path file = Paths.get(propertiesFile);
         if (Files.notExists(file)) {
             LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Config File doesn't Exist in the specified Path "
                     + file.toString());
@@ -165,12 +174,13 @@
         }
     }
 
-    private void setProperty(Path file, Properties config, BackUpHandler handler) throws PolicyException {
+    private void setProperty(final Path file, final Properties config, final BackUpHandler handler)
+            throws PolicyException {
         InputStream in;
         try {
             in = new FileInputStream(file.toFile());
             config.load(in);
-        } catch (IOException e) {
+        } catch (final IOException e) {
             LOGGER.error(
                     XACMLErrorConstants.ERROR_DATA_ISSUE + "Data/File Read Error while reading from the property file.",
                     e);
@@ -188,22 +198,23 @@
             }
             resourceName = resourceName.trim();
             setIntegrityMonitor(IntegrityMonitor.getInstance(resourceName, config));
-        } catch (Exception e) {
+        } catch (final Exception e) {
             LOGGER.error("Error starting Integerity Monitor: " + e);
         }
         LOGGER.info("Trying to set up BackUpMonitor");
         try {
             setBackupMonitor(BackUpMonitor.getInstance(BackUpMonitor.ResourceNode.BRMS.toString(), resourceName, config,
                     handler));
-        } catch (Exception e) {
+        } catch (final Exception e) {
             LOGGER.error("Error starting BackUpMonitor: " + e);
         }
-        if(!config.containsKey(BRMSPERSISTENCE)){
+        if (!config.containsKey(BRMSPERSISTENCE)) {
             config.setProperty(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML, "META-INF/persistenceBRMS.xml");
         } else {
-            config.setProperty(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML, config.getProperty(BRMSPERSISTENCE,"META-INF/persistenceBRMS.xml"));
+            config.setProperty(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML,
+                    config.getProperty(BRMSPERSISTENCE, "META-INF/persistenceBRMS.xml"));
         }
-        EntityManagerFactory emf = Persistence.createEntityManagerFactory("BRMSGW", config);
+        final EntityManagerFactory emf = Persistence.createEntityManagerFactory("BRMSGW", config);
         em = emf.createEntityManager();
         defaultName = config.getProperty("defaultName");
         if (defaultName == null) {
@@ -213,14 +224,14 @@
                     XACMLErrorConstants.ERROR_DATA_ISSUE + "defaultName property is missing from the property file");
         }
         defaultName = defaultName.trim();
-        repID = config.getProperty("repositoryID");
-        if (repID == null) {
+        repId = config.getProperty("repositoryID");
+        if (repId == null) {
             LOGGER.error(
                     XACMLErrorConstants.ERROR_DATA_ISSUE + "repositoryID property is missing from the property file ");
             throw new PolicyException(
                     XACMLErrorConstants.ERROR_DATA_ISSUE + "repositoryID property is missing from the property file ");
         }
-        repID = repID.trim();
+        repId = repId.trim();
         repName = config.getProperty("repositoryName");
         if (repName == null) {
             LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE
@@ -229,18 +240,18 @@
                     + "repositoryName property is missing from the property file ");
         }
         repName = repName.trim();
-        String repURL = config.getProperty("repositoryURL");
-        if (repURL == null) {
+        final String repUrl = config.getProperty("repositoryURL");
+        if (repUrl == null) {
             LOGGER.error(
                     XACMLErrorConstants.ERROR_DATA_ISSUE + "repositoryURL property is missing from the property file ");
             throw new PolicyException(
                     XACMLErrorConstants.ERROR_DATA_ISSUE + "repositoryURL property is missing from the property file ");
         }
-        if (repURL.contains(",")) {
-            repURLs = new ArrayList<>(Arrays.asList(repURL.trim().split(",")));
+        if (repUrl.contains(",")) {
+            repUrlList = new ArrayList<>(Arrays.asList(repUrl.trim().split(",")));
         } else {
-            repURLs = new ArrayList<>();
-            repURLs.add(repURL);
+            repUrlList = new ArrayList<>();
+            repUrlList.add(repUrl);
         }
         repUserName = config.getProperty("repositoryUsername");
         repPassword = config.getProperty("repositoryPassword");
@@ -252,15 +263,15 @@
         }
         repUserName = repUserName.trim();
         repPassword = repPassword.trim();
-        policyKeyID = config.getProperty("policyKeyID");
-        if (policyKeyID == null) {
+        policyKeyId = config.getProperty("policyKeyID");
+        if (policyKeyId == null) {
             LOGGER.error(
                     XACMLErrorConstants.ERROR_DATA_ISSUE + "policyKeyID property is missing from the property file ");
             throw new PolicyException(
                     XACMLErrorConstants.ERROR_DATA_ISSUE + "policyKeyID property is missing from the property file ");
         }
-        policyKeyID = policyKeyID.trim();
-        String syncF = config.getProperty("sync", "false").trim();
+        policyKeyId = policyKeyId.trim();
+        final String syncF = config.getProperty("sync", "false").trim();
         syncFlag = Boolean.parseBoolean(syncF);
         if (syncFlag) {
             PolicyLogger.info("SYNC Flag is turned ON. DB will be given Priority.");
@@ -282,8 +293,8 @@
             // Setting up the Publisher for DMaaP MR
             String dmaapServers = config.getProperty("NOTIFICATION_SERVERS");
             pubTopic = config.getProperty("NOTIFICATION_TOPIC");
-            String aafLogin = config.getProperty("CLIENT_ID").trim();
-            String aafPassword = config.getProperty("CLIENT_KEY").trim();
+            final String aafLogin = config.getProperty("CLIENT_ID").trim();
+            final String aafPassword = config.getProperty("CLIENT_KEY").trim();
 
             if (dmaapServers == null || pubTopic == null) {
                 LOGGER.error(
@@ -302,15 +313,15 @@
                 dmaapList.add(dmaapServers);
             }
 
-            this.publisher = new BusPublisher.DmaapPublisherWrapper(this.dmaapList, this.pubTopic, aafLogin,
-                    aafPassword);
+            this.publisher =
+                    new BusPublisher.DmaapPublisherWrapper(this.dmaapList, this.pubTopic, aafLogin, aafPassword);
 
-            String dDelay = config.getProperty("NOTIFICATION_DELAY");
-            if (dDelay != null && !dDelay.isEmpty()) {
-                dDelay = dDelay.trim();
+            String notificationDelay = config.getProperty("NOTIFICATION_DELAY");
+            if (notificationDelay != null && !notificationDelay.isEmpty()) {
+                notificationDelay = notificationDelay.trim();
                 try {
-                    dmaapDelay = Long.parseLong(dDelay);
-                } catch (NumberFormatException e) {
+                    dmaapDelay = Long.parseLong(notificationDelay);
+                } catch (final NumberFormatException e) {
                     LOGGER.error("DMAAP_DELAY not a long format number" + e);
                 }
             }
@@ -321,8 +332,6 @@
             // Setting up the Publisher for UEB
             uebList = config.getProperty("NOTIFICATION_SERVERS");
             pubTopic = config.getProperty("NOTIFICATION_TOPIC");
-            String apiKey = config.getProperty("UEB_API_KEY");
-            String apiSecret = config.getProperty("UEB_API_SECRET");
             if (uebList == null || pubTopic == null) {
                 LOGGER.error(
                         XACMLErrorConstants.ERROR_DATA_ISSUE + "UEB properties are missing from the property file ");
@@ -333,17 +342,19 @@
             pubTopic = pubTopic.trim();
             pubBuilder = new CambriaClientBuilders.PublisherBuilder();
             pubBuilder.usingHosts(uebList).onTopic(pubTopic);
+            String apiKey = config.getProperty("UEB_API_KEY");
+            String apiSecret = config.getProperty("UEB_API_SECRET");
             if (apiKey != null && !apiKey.isEmpty() && apiSecret != null && !apiSecret.isEmpty()) {
                 apiKey = apiKey.trim();
                 apiSecret = apiSecret.trim();
                 pubBuilder.authenticatedBy(apiKey, apiSecret);
             }
-            String uDelay = config.getProperty("NOTIFICATION_DELAY");
-            if (uDelay != null && !uDelay.isEmpty()) {
-                uDelay = uDelay.trim();
+            String notificationDelay = config.getProperty("NOTIFICATION_DELAY");
+            if (notificationDelay != null && !notificationDelay.isEmpty()) {
+                notificationDelay = notificationDelay.trim();
                 try {
-                    uebDelay = Long.parseLong(uDelay);
-                } catch (NumberFormatException e) {
+                    uebDelay = Long.parseLong(notificationDelay);
+                } catch (final NumberFormatException e) {
                     LOGGER.error("UEB_DELAY not a long format number" + e);
                 }
             }
@@ -353,31 +364,32 @@
 
     }
 
-    private static void setBackupMonitor(BackUpMonitor instance) {
+    private static void setBackupMonitor(final BackUpMonitor instance) {
         bm = instance;
     }
 
-    private static void setIntegrityMonitor(IntegrityMonitor instance) {
+    private static void setIntegrityMonitor(final IntegrityMonitor instance) {
         im = instance;
     }
 
     /**
      * Will Initialize the variables required for BRMSPush.
      */
-    public void initiate(boolean flag) {
+    public void initiate(final boolean flag) {
         resetModifiedGroups();
         controllers = new ArrayList<>();
         try {
             bm.updateNotification();
-        } catch (Exception e) {
+        } catch (final Exception e) {
             LOGGER.error("Error while updating Notification: " + e.getMessage(), e);
         }
-        if (flag)
+        if (flag) {
             syncGroupInfo();
+        }
     }
-    
-    public void resetDS(){
-    	resetModifiedGroups();
+
+    public void resetDs() {
+        resetModifiedGroups();
         controllers = new ArrayList<>();
     }
 
@@ -388,57 +400,56 @@
     /**
      * Will Add rules to projects. Creates necessary folders if required.
      */
-    public void addRule(String name, String rule, Map<String, String> responseAttributes) {
+    public void addRule(final String name, final String rule, final Map<String, String> responseAttributes) {
         // 1 check the response Attributes and determine if this belongs to any projects.
         // 2 if not create folder
         // 3 create pom.
         // 4 copy the rule.
         // 5 store the groups that have been updated.
-        String kSessionName = null;
+        String ksessionName = null;
         String selectedName = null;
         if (!responseAttributes.isEmpty()) {
             // Pick selected Value
             String userControllerName = null;
-            ArrayList<PEDependency> userDependencies = new ArrayList<>();
-            for (Map.Entry<String, String> entry: responseAttributes.entrySet()) {
-            	String key = entry.getKey();
-            	String value = entry.getValue();
-                if (key.equals(policyKeyID)) {
+            final ArrayList<PEDependency> userDependencies = new ArrayList<>();
+            for (final Map.Entry<String, String> entry : responseAttributes.entrySet()) {
+                final String key = entry.getKey();
+                String value = entry.getValue();
+                if (key.equals(policyKeyId)) {
                     selectedName = value;
                 }
                 // kmodule configurations
                 else if ("kSessionName".equals(key)) {
-                    kSessionName = value;
+                    ksessionName = value;
                 }
                 // Check User Specific values.
                 if ("$controller:".equals(key)) {
                     try {
-                        PEDependency dependency = PolicyUtils.jsonStringToObject(value,
-                                PEDependency.class);
+                        final PEDependency dependency = PolicyUtils.jsonStringToObject(value, PEDependency.class);
                         userControllerName = key.replaceFirst("$controller:", "");
-                        LOGGER.info("addRule: userControllerName - " + userControllerName + ", dependency: - " + dependency);
+                        LOGGER.info("addRule: userControllerName - " + userControllerName + ", dependency: - "
+                                + dependency);
                         addToGroup(userControllerName, dependency);
-                    } catch (Exception e) {
+                    } catch (final Exception e) {
                         LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while resolving Controller: " + e);
                     }
 
                 } else if ("$dependency$".equals(key) && value.startsWith("[") && value.endsWith("]")) {
                     value = value.substring(1, value.length() - 1).trim();
-                    List<String> dependencyStrings = Arrays.asList(value.split(Pattern.quote("},{")));
-                    for (String dependencyString : dependencyStrings) {
+                    final List<String> dependencyStrings = Arrays.asList(value.split(Pattern.quote("},{")));
+                    for (final String dependencyString : dependencyStrings) {
                         try {
-                            userDependencies
-                                    .add(PolicyUtils.jsonStringToObject(dependencyString, PEDependency.class));
-                        } catch (Exception e) {
-                            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW
-                                    + "Error while resolving Dependencies: " + e);
+                            userDependencies.add(PolicyUtils.jsonStringToObject(dependencyString, PEDependency.class));
+                        } catch (final Exception e) {
+                            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while resolving Dependencies: "
+                                    + e);
                         }
                     }
                 }
             }
             if (userControllerName != null) {
                 // Adding custom dependencies here.
-                ArrayList<Object> values = groupMap.get(userControllerName);
+                final ArrayList<Object> values = groupMap.get(userControllerName);
                 values.add(userDependencies);
                 groupMap.put(userControllerName, values);
                 selectedName = userControllerName;
@@ -449,45 +460,48 @@
             selectedName = defaultName;
         }
         if (groupMap.containsKey(selectedName)) {
-            // If the key is not got as parameters set by the user, setting the default value for kSessionName as
+            // If the key is not got as parameters set by the user, setting the default value for
+            // kSessionName as
             // closedLoop
-            if (kSessionName == null) {
-            	LOGGER.info("kSessionName is null, selectedName is  : " + selectedName );
+            if (ksessionName == null) {
+                LOGGER.info("kSessionName is null, selectedName is  : " + selectedName);
                 if (selectedName.equalsIgnoreCase(defaultName)) {
-                    kSessionName = "closedloop";
+                    ksessionName = "closedloop";
                 } else {
-                    kSessionName = "closedloop-" + selectedName;
+                    ksessionName = "closedloop-" + selectedName;
                 }
             }
             // create directories if missing.
-            manageProject(selectedName, kSessionName, name, rule);
-            addModifiedGroup(selectedName, "update"); // Will check for Create Later after generating the Pom.
+            manageProject(selectedName, ksessionName, name, rule);
+
+            // Will check for Create Later after generating the Pom.
+            addModifiedGroup(selectedName, "update");
         }
     }
 
     private void syncGroupInfo() {
         // Sync DB to JMemory.
-        EntityTransaction et = em.getTransaction();
+        final EntityTransaction et = em.getTransaction();
         et.begin();
-        Query query = em.createQuery("select b from BRMSGroupInfo AS b");
-        List<?> bList = query.getResultList();
-        if (bList.size() != groupMap.size()) {
-            for (Object value : bList) {
-                BRMSGroupInfo brmsGroupInfo = (BRMSGroupInfo) value;
-                PEDependency dependency = new PEDependency();
+        Query query = em.createQuery("select b from BrmsGroupInfo AS b");
+        List<?> result = query.getResultList();
+        if (result.size() != groupMap.size()) {
+            for (final Object value : result) {
+                final BrmsGroupInfo brmsGroupInfo = (BrmsGroupInfo) value;
+                final PEDependency dependency = new PEDependency();
                 dependency.setArtifactId(brmsGroupInfo.getArtifactId());
                 dependency.setGroupId(brmsGroupInfo.getGroupId());
                 dependency.setVersion(brmsGroupInfo.getVersion());
-                ArrayList<Object> values = new ArrayList<>();
+                final ArrayList<Object> values = new ArrayList<>();
                 values.add(dependency);
                 groupMap.put(brmsGroupInfo.getControllerName(), values);
             }
         }
-        query = em.createQuery("select g from BRMSPolicyInfo AS g");
-        bList = query.getResultList();
-        if (bList.size() != policyMap.size()) {
-            for (Object value : bList) {
-                BRMSPolicyInfo brmsPolicyInfo = (BRMSPolicyInfo) value;
+        query = em.createQuery("select g from BrmsPolicyInfo AS g");
+        result = query.getResultList();
+        if (result.size() != policyMap.size()) {
+            for (final Object value : result) {
+                final BrmsPolicyInfo brmsPolicyInfo = (BrmsPolicyInfo) value;
                 policyMap.put(brmsPolicyInfo.getPolicyName(), brmsPolicyInfo.getControllerName().getControllerName());
             }
         }
@@ -495,32 +509,33 @@
         LOGGER.info("Updated Local Memory values with values from database.");
     }
 
-    private void manageProject(String selectedName, String kSessionName, String name, String rule) {
+    private void manageProject(final String selectedName, final String ksessionName, final String name,
+            final String rule) {
         // Check if the Project is in Sync. If not get the latest Version.
         syncProject(selectedName);
-        createProject(PROJECTSLOCATION + File.separator + getArtifactID(selectedName) + File.separator + "src"
-                + File.separator + "main" + File.separator + RESOURCES, kSessionName);
-        copyDataToFile(PROJECTSLOCATION + File.separator + getArtifactID(selectedName) + File.separator + "src"
-                + File.separator + "main" + File.separator + RESOURCES + File.separator + RULES + File.separator
-                + name + ".drl", rule);
+        createProject(PROJECTSLOCATION + File.separator + getArtifactId(selectedName) + File.separator + "src"
+                + File.separator + "main" + File.separator + RESOURCES, ksessionName);
+        copyDataToFile(PROJECTSLOCATION + File.separator + getArtifactId(selectedName) + File.separator + "src"
+                + File.separator + "main" + File.separator + RESOURCES + File.separator + RULES + File.separator + name
+                + ".drl", rule);
         addToPolicy(name, selectedName);
     }
 
     /*
      * Add Policy to JMemory and DataBase.
      */
-    private void addToPolicy(String policyName, String controllerName) {
+    private void addToPolicy(final String policyName, final String controllerName) {
         policyMap.put(policyName, controllerName);
-        EntityTransaction et = em.getTransaction();
+        final EntityTransaction et = em.getTransaction();
         et.begin();
-        Query query = em.createQuery("select b from BRMSPolicyInfo as b where b.policyName = :pn");
+        Query query = em.createQuery("select b from BrmsPolicyInfo as b where b.policyName = :pn");
         query.setParameter("pn", policyName);
-        List<?> pList = query.getResultList();
+        final List<?> pList = query.getResultList();
         boolean create = false;
-        BRMSPolicyInfo brmsPolicyInfo = new BRMSPolicyInfo();
+        BrmsPolicyInfo brmsPolicyInfo = new BrmsPolicyInfo();
         if (!pList.isEmpty()) {
             // Already exists.
-            brmsPolicyInfo = (BRMSPolicyInfo) pList.get(0);
+            brmsPolicyInfo = (BrmsPolicyInfo) pList.get(0);
             if (!brmsPolicyInfo.getControllerName().getControllerName().equals(controllerName)) {
                 create = true;
             }
@@ -528,12 +543,12 @@
             create = true;
         }
         if (create) {
-            query = em.createQuery("select b from BRMSGroupInfo as b where b.controllerName = :cn");
+            query = em.createQuery("select b from BrmsGroupInfo as b where b.controllerName = :cn");
             query.setParameter("cn", controllerName);
-            List<?> bList = query.getResultList();
-            BRMSGroupInfo brmsGroupInfo = new BRMSGroupInfo();
+            final List<?> bList = query.getResultList();
+            BrmsGroupInfo brmsGroupInfo = new BrmsGroupInfo();
             if (!bList.isEmpty()) {
-                brmsGroupInfo = (BRMSGroupInfo) bList.get(0);
+                brmsGroupInfo = (BrmsGroupInfo) bList.get(0);
             }
             brmsPolicyInfo.setPolicyName(policyName);
             brmsPolicyInfo.setControllerName(brmsGroupInfo);
@@ -543,8 +558,8 @@
         et.commit();
     }
 
-    private void syncProject(String selectedName) {
-        boolean projectExists = checkProject(selectedName);
+    private void syncProject(final String selectedName) {
+        final boolean projectExists = checkProject(selectedName);
         if (projectExists) {
             String version;
             version = getVersion(selectedName);
@@ -553,8 +568,8 @@
                         + " going with Default value");
                 version = VERSION_0_1_0;
             }
-            String nextVersion = incrementVersion(version);
-            boolean outOfSync = checkRemoteSync(selectedName, nextVersion);
+            final String nextVersion = incrementVersion(version);
+            final boolean outOfSync = checkRemoteSync(selectedName, nextVersion);
             if (!outOfSync) {
                 return;
             }
@@ -563,80 +578,83 @@
         downloadProject(selectedName);
     }
 
-    private void downloadProject(String selectedName) {
-        NexusArtifact artifact = getLatestArtifactFromNexus(selectedName);
-        if (artifact == null)
+    private void downloadProject(final String selectedName) {
+        final NexusArtifact artifact = getLatestArtifactFromNexus(selectedName);
+        if (artifact == null) {
             return;
-        String dirName = getDirectoryName(selectedName);
+        }
+        final String dirName = getDirectoryName(selectedName);
         URL website;
-        String fileName = "rule.jar";
+        final String fileName = "rule.jar";
         try {
             website = new URL(artifact.getResourceURI());
-            try( ReadableByteChannel rbc = Channels.newChannel(website.openStream());
-            		FileOutputStream fos = new FileOutputStream(fileName)){
-            	fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+            try (ReadableByteChannel rbc = Channels.newChannel(website.openStream());
+                    FileOutputStream fos = new FileOutputStream(fileName)) {
+                fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
                 extractJar(fileName, dirName);
                 new File(fileName).delete();
-            }catch (IOException e) {
-         LOGGER.error("Error while downloading the project to File System. " + e.getMessage(), e);
-			}
-          
-        } catch (IOException e1) {
+            } catch (final IOException e) {
+                LOGGER.error("Error while downloading the project to File System. " + e.getMessage(), e);
+            }
+
+        } catch (final IOException e1) {
             LOGGER.error("Error while retrieve the artifact. " + e1.getMessage(), e1);
         }
     }
 
-private void extractJar(String jarFileName, String artifactId){
-		try (JarFile jar = new JarFile(jarFileName)) {	
-        Enumeration<?> enumEntries = jar.entries();
-        while (enumEntries.hasMoreElements()) {
-            JarEntry file = (JarEntry) enumEntries.nextElement();
-            File f = null;
-            String fileName = file.getName().substring(file.getName().lastIndexOf("/") + 1);
-            if (file.getName().endsWith(".drl")) {
-                String path = PROJECTSLOCATION + File.separator + artifactId + File.separator + "src" + File.separator
-                        + "main" + File.separator + RESOURCES + File.separator + RULES;
-                new File(path).mkdirs();
-                if (syncFlag && policyMap.containsKey(fileName.replace(".drl", ""))) {
-                    f = new File(path + File.separator + fileName);
-                } else {
-                    f = new File(path + File.separator + fileName);
+    private void extractJar(final String jarFileName, final String artifactId) {
+        try (JarFile jar = new JarFile(jarFileName)) {
+            final Enumeration<?> enumEntries = jar.entries();
+            while (enumEntries.hasMoreElements()) {
+                final JarEntry jarEntry = (JarEntry) enumEntries.nextElement();
+                File file = null;
+                final String fileName = jarEntry.getName().substring(jarEntry.getName().lastIndexOf("/") + 1);
+                if (jarEntry.getName().endsWith(".drl")) {
+                    final String path = PROJECTSLOCATION + File.separator + artifactId + File.separator + "src"
+                            + File.separator + "main" + File.separator + RESOURCES + File.separator + RULES;
+                    new File(path).mkdirs();
+                    if (syncFlag && policyMap.containsKey(fileName.replace(".drl", ""))) {
+                        file = new File(path + File.separator + fileName);
+                    } else {
+                        file = new File(path + File.separator + fileName);
+                    }
+                } else if (jarEntry.getName().endsWith(POM_XML_FILE)) {
+                    final String path = PROJECTSLOCATION + File.separator + artifactId;
+                    new File(path).mkdirs();
+                    file = new File(path + File.separator + fileName);
+                } else if (jarEntry.getName().endsWith(KMODULE_XML_FILE)) {
+                    final String path = PROJECTSLOCATION + File.separator + artifactId + File.separator + "src"
+                            + File.separator + "main" + File.separator + RESOURCES + File.separator + META_INF;
+                    new File(path).mkdirs();
+                    file = new File(path + File.separator + fileName);
                 }
-            } else if (file.getName().endsWith(POM_XML_FILE)) {
-                String path = PROJECTSLOCATION + File.separator + artifactId;
-                new File(path).mkdirs();
-                f = new File(path + File.separator + fileName);
-            } else if (file.getName().endsWith(KMODULE_XML_FILE)) {
-                String path = PROJECTSLOCATION + File.separator + artifactId + File.separator + "src" + File.separator
-                        + "main" + File.separator + RESOURCES + File.separator + META_INF;
-                new File(path).mkdirs();
-                f = new File(path + File.separator + fileName);
-            }
-            if (f != null) {
-				try (InputStream is = jar.getInputStream(file); FileOutputStream fos = new FileOutputStream(f)) {
-                while (is.available() > 0) {
-                    fos.write(is.read());
+                if (file != null) {
+                    try (InputStream is = jar.getInputStream(jarEntry);
+                            FileOutputStream fos = new FileOutputStream(file)) {
+                        while (is.available() > 0) {
+                            fos.write(is.read());
+                        }
+                        LOGGER.info(fileName + " Created..");
+                    } catch (final IOException e) {
+                        LOGGER.info("exception Occured" + e);
+                    }
                 }
-                LOGGER.info(fileName + " Created..");
-				} catch (IOException e) {
-						LOGGER.info("exception Occured" + e);
-					}
             }
-         }
-		} catch (IOException e) {
-			LOGGER.info("exception Occured" + e);
-		}
-  }
+        } catch (final IOException e) {
+            LOGGER.info("exception Occured" + e);
+        }
+    }
 
-    private NexusArtifact getLatestArtifactFromNexus(String selectedName) {
-        List<NexusArtifact> artifacts = getArtifactFromNexus(selectedName, null);
+    private NexusArtifact getLatestArtifactFromNexus(final String selectedName) {
+        final List<NexusArtifact> artifacts = getArtifactFromNexus(selectedName, null);
         int bigNum = 0;
         int smallNum = 0;
         NexusArtifact result = null;
-        for (NexusArtifact artifact : artifacts) {
-            int majorVal = Integer.parseInt(artifact.getVersion().substring(0, artifact.getVersion().indexOf(".")));
-            int minorVal = Integer.parseInt(artifact.getVersion().substring(artifact.getVersion().indexOf(".") + 1,
-                    artifact.getVersion().lastIndexOf(".")));
+        for (final NexusArtifact artifact : artifacts) {
+            final int majorVal =
+                    Integer.parseInt(artifact.getVersion().substring(0, artifact.getVersion().indexOf(".")));
+            final int minorVal = Integer.parseInt(artifact.getVersion()
+                    .substring(artifact.getVersion().indexOf(".") + 1, artifact.getVersion().lastIndexOf(".")));
             if (majorVal > bigNum) {
                 bigNum = majorVal;
                 smallNum = minorVal;
@@ -652,36 +670,36 @@
     }
 
     // Additional Check due to Limitations from Nexus API to check if the artifact is the latest.
-    private NexusArtifact additionalNexusLatestCheck(String selectedName, NexusArtifact result) {
-        if(result==null){
+    private NexusArtifact additionalNexusLatestCheck(final String selectedName, final NexusArtifact result) {
+        if (result == null) {
             return result;
         }
-        String nextVersion = incrementVersion(result.getVersion());
-        List<NexusArtifact> artifact = getArtifactFromNexus(selectedName, nextVersion);
+        final String nextVersion = incrementVersion(result.getVersion());
+        final List<NexusArtifact> artifact = getArtifactFromNexus(selectedName, nextVersion);
         return artifact.isEmpty() ? result : additionalNexusLatestCheck(selectedName, artifact.get(0));
     }
 
-    private boolean checkRemoteSync(String selectedName, String version) {
-        List<NexusArtifact> artifacts = getArtifactFromNexus(selectedName, version);
+    private boolean checkRemoteSync(final String selectedName, final String version) {
+        final List<NexusArtifact> artifacts = getArtifactFromNexus(selectedName, version);
         return artifacts.isEmpty() ? false : true;
     }
 
-    private List<NexusArtifact> getArtifactFromNexus(String selectedName, String version) {
+    private List<NexusArtifact> getArtifactFromNexus(final String selectedName, final String version) {
         final NexusClient client = new NexusRestClient();
-        int i = 0;
+        int index = 0;
         boolean flag = false;
-        while (i < repURLs.size()) {
+        while (index < repUrlList.size()) {
             try {
-                String repURL = repURLs.get(0);
-                client.connect(repURL.substring(0, repURL.indexOf(repURL.split(":[0-9]+\\/nexus")[1])), repUserName,
+                final String repUrl = repUrlList.get(0);
+                client.connect(repUrl.substring(0, repUrl.indexOf(repUrl.split(":[0-9]+\\/nexus")[1])), repUserName,
                         repPassword);
                 final NexusArtifact template = new NexusArtifact();
-                template.setGroupId(getGroupID(selectedName));
-                template.setArtifactId(getArtifactID(selectedName));
+                template.setGroupId(getGroupId(selectedName));
+                template.setArtifactId(getArtifactId(selectedName));
                 if (version != null) {
                     template.setVersion(version);
                 }
-                List<NexusArtifact> resultList = client.searchByGAV(template);
+                final List<NexusArtifact> resultList = client.searchByGAV(template);
                 if (resultList != null) {
                     flag = true;
                     return resultList;
@@ -697,29 +715,15 @@
                             + e.getMessage(), e);
                 }
                 if (!flag) {
-                    Collections.rotate(repURLs, -1);
-                    i++;
+                    Collections.rotate(repUrlList, -1);
+                    index++;
                 }
             }
         }
         return new ArrayList<>();
     }
 
-    private void setVersion(String selectedName) {
-        String newVersion = VERSION_0_1_0;
-        createFlag = false;
-        NexusArtifact artifact = getLatestArtifactFromNexus(selectedName);
-        if (artifact != null) {
-            newVersion = incrementVersion(artifact.getVersion());
-        }
-        if (VERSION_0_1_0.equals(newVersion)) {
-            createFlag = true;
-        }
-        setVersion(newVersion, selectedName);
-        LOGGER.info("Controller: " + selectedName + "is on version: " + newVersion);
-    }
-
-    private String incrementVersion(String version) {
+    private String incrementVersion(final String version) {
         int majorVal = Integer.parseInt(version.substring(0, version.indexOf(".")));
         int minorVal = Integer.parseInt(version.substring(version.indexOf(".") + 1, version.lastIndexOf(".")));
         if (minorVal >= 9) {
@@ -731,52 +735,50 @@
         return majorVal + "." + minorVal + version.substring(version.lastIndexOf("."));
     }
 
-    private boolean checkProject(String selectedName) {
+    private boolean checkProject(final String selectedName) {
         return new File(PROJECTSLOCATION + File.separator + getDirectoryName(selectedName)).exists();
     }
 
-    private String getDirectoryName(String selectedName) {
-        return getArtifactID(selectedName);
+    private String getDirectoryName(final String selectedName) {
+        return getArtifactId(selectedName);
     }
 
     /**
      * Will Push policies to the PolicyRepo.
      * 
-     * @param notificationType
-     *            <String> type of notification Type.
-     * @throws PolicyException
+     * @throws PolicyException PolicyException related to the operation
      */
     public void pushRules() throws PolicyException {
         // Check how many groups have been updated.
         // Invoke their Maven process.
         try {
             im.startTransaction();
-        } catch (Exception e) {
+        } catch (final Exception e) {
             LOGGER.error("Error while starting Transaction " + e);
         }
         if (!modifiedGroups.isEmpty()) {
             Boolean flag = false;
-            for (Map.Entry<String, String> entry : modifiedGroups.entrySet()) {
+            for (final Map.Entry<String, String> entry : modifiedGroups.entrySet()) {
                 InvocationResult result = null;
-		String group = entry.getKey();
+                final String group = entry.getKey();
                 try {
-                	LOGGER.info("PushRules: ModifiedGroups, Key: " + group + ", Value: " + entry.getValue());
-                    InvocationRequest request = new DefaultInvocationRequest();
+                    LOGGER.info("PushRules: ModifiedGroups, Key: " + group + ", Value: " + entry.getValue());
+                    final InvocationRequest request = new DefaultInvocationRequest();
                     setVersion(group);
                     createPom(group);
                     request.setPomFile(new File(
-                            PROJECTSLOCATION + File.separator + getArtifactID(group) + File.separator + POM_XML_FILE));
+                            PROJECTSLOCATION + File.separator + getArtifactId(group) + File.separator + POM_XML_FILE));
                     request.setGoals(Arrays.asList(GOALS));
-                    Invoker invoker = new DefaultInvoker();
+                    final Invoker invoker = new DefaultInvoker();
                     result = invoker.execute(request);
                     if (result.getExecutionException() != null) {
                         LOGGER.error(result.getExecutionException());
                     } else if (result.getExitCode() != 0) {
                         LOGGER.error("Maven Invocation failure..!");
                     }
-                } catch (Exception e) {
+                } catch (final Exception e) {
                     LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Maven Invocation issue for "
-                            + getArtifactID(group) + e.getMessage(), e);
+                            + getArtifactId(group) + e.getMessage(), e);
                 }
                 if (result != null && result.getExitCode() == 0) {
                     LOGGER.info("Build Completed..!");
@@ -802,8 +804,8 @@
     /**
      * Removes a Rule from Rule Projects.
      */
-    public void removeRule(String name) {
-        String controllerName = getGroupName(name);
+    public void removeRule(final String name) {
+        final String controllerName = getGroupName(name);
         if (controllerName == null) {
             LOGGER.info("Error finding the controllerName for the given Policy: " + name);
             return;
@@ -812,7 +814,7 @@
         getNameAndSetRemove(controllerName, name);
     }
 
-    private String getGroupName(String name) {
+    private String getGroupName(final String name) {
         if (policyMap.containsKey(name)) {
             return policyMap.get(name);
         } else {
@@ -821,57 +823,57 @@
         }
     }
 
-    private void addModifiedGroup(String controllerName, String operation) {
+    private void addModifiedGroup(final String controllerName, final String operation) {
         if (controllerName != null) {
             modifiedGroups.put(controllerName, operation);
         }
     }
 
-    private void addNotification(String controllerName, String operation) {
-        ControllerPOJO controllerPOJO = new ControllerPOJO();
-        controllerPOJO.setName(controllerName);
-        controllerPOJO.setOperation(operation);
-        HashMap<String, String> drools = new HashMap<>();
-        drools.put("groupId", getGroupID(controllerName));
-        drools.put("artifactId", getArtifactID(controllerName));
+    private void addNotification(final String controllerName, final String operation) {
+        final ControllerPojo controllerPojo = new ControllerPojo();
+        controllerPojo.setName(controllerName);
+        controllerPojo.setOperation(operation);
+        final HashMap<String, String> drools = new HashMap<>();
+        drools.put("groupId", getGroupId(controllerName));
+        drools.put("artifactId", getArtifactId(controllerName));
         drools.put("version", getVersion(controllerName));
-        controllerPOJO.setDrools(drools);
-        controllers.add(controllerPOJO);
+        controllerPojo.setDrools(drools);
+        controllers.add(controllerPojo);
         try {
-            LOGGER.debug("Notification added: " + PolicyUtils.objectToJsonString(controllerPOJO));
-        } catch (JsonProcessingException e) {
+            LOGGER.debug("Notification added: " + PolicyUtils.objectToJsonString(controllerPojo));
+        } catch (final JsonProcessingException e) {
             LOGGER.error(MessageCodes.ERROR_SCHEMA_INVALID + "Json Processing Error " + e);
         }
     }
 
-    private void removedRuleModifiedGroup(String controllerName) {
+    private void removedRuleModifiedGroup(final String controllerName) {
         // This will be sending Notification to PDPD directly to Lock
-        ControllerPOJO controllerPOJO = new ControllerPOJO();
-        controllerPOJO.setName(controllerName);
-        controllerPOJO.setOperation("lock");
-        List<ControllerPOJO> controllerPojos = new ArrayList<>();
-        controllerPojos.add(controllerPOJO);
+        final ControllerPojo controllerPojo = new ControllerPojo();
+        controllerPojo.setName(controllerName);
+        controllerPojo.setOperation("lock");
+        final List<ControllerPojo> controllerPojos = new ArrayList<>();
+        controllerPojos.add(controllerPojo);
         sendNotification(controllerPojos);
     }
 
-    private void sendNotification(List<ControllerPOJO> controllers) {
-        NotificationPOJO notification = new NotificationPOJO();
-        String requestId = UUID.randomUUID().toString();
+    private void sendNotification(final List<ControllerPojo> controllers) {
+        final NotificationPojo notification = new NotificationPojo();
+        final String requestId = UUID.randomUUID().toString();
         LOGGER.info("Generating notification RequestID : " + requestId);
-        notification.setRequestID(requestId);
+        notification.setRequestId(requestId);
         notification.setEntity("controller");
         notification.setControllers(controllers);
         try {
-            String notificationJson = PolicyUtils.objectToJsonString(notification);
+            final String notificationJson = PolicyUtils.objectToJsonString(notification);
             LOGGER.info("Sending Notification :\n" + notificationJson);
             sendMessage(notificationJson);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while sending notification to PDP-D "
                     + e.getMessage(), e);
         }
     }
 
-    private void sendMessage(String message) throws IOException, GeneralSecurityException, InterruptedException {
+    private void sendMessage(final String message) throws IOException, GeneralSecurityException, InterruptedException {
 
         if ("dmaap".equalsIgnoreCase(notificationType)) {
             // Sending Message through DMaaP Message Router
@@ -887,7 +889,7 @@
             // Sending Message through UEB interface.
             LOGGER.debug("UEB Publishing Message");
 
-            CambriaBatchingPublisher pub = pubBuilder.build();
+            final CambriaBatchingPublisher pub = pubBuilder.build();
             pub.send("MyPartitionKey", message);
 
             final List<?> stuck = pub.close(uebDelay, TimeUnit.SECONDS);
@@ -900,26 +902,26 @@
 
     }
 
-    private void createPom(String name) {
-        Model model = new Model();
+    private void createPom(final String name) {
+        final Model model = new Model();
         model.setModelVersion("4.0.0");
-        model.setGroupId(getGroupID(name));
-        model.setArtifactId(getArtifactID(name));
+        model.setGroupId(getGroupId(name));
+        model.setArtifactId(getArtifactId(name));
         model.setVersion(getVersion(name));
         model.setName(name);
-        DistributionManagement distributionManagement = new DistributionManagement();
-        DeploymentRepository repository = new DeploymentRepository();
-        repository.setId(repID);
+        final DistributionManagement distributionManagement = new DistributionManagement();
+        final DeploymentRepository repository = new DeploymentRepository();
+        repository.setId(repId);
         repository.setName(repName);
-        repository.setUrl(repURLs.get(0));
+        repository.setUrl(repUrlList.get(0));
         distributionManagement.setRepository(repository);
         model.setDistributionManagement(distributionManagement);
         // Dependency Management goes here.
         List<Dependency> dependencyList = new ArrayList<>();
         if (groupMap.get(name).size() > 1) {
             @SuppressWarnings("unchecked")
-            ArrayList<PEDependency> dependencies = (ArrayList<PEDependency>) groupMap.get(name).get(1);
-            for (PEDependency dependency : dependencies) {
+            final ArrayList<PEDependency> dependencies = (ArrayList<PEDependency>) groupMap.get(name).get(1);
+            for (final PEDependency dependency : dependencies) {
                 dependencyList.add(dependency.getDependency());
             }
         } else {
@@ -930,30 +932,31 @@
         Writer writer = null;
         try {
             writer = WriterFactory.newXmlWriter(
-                    new File(PROJECTSLOCATION + File.separator + getArtifactID(name) + File.separator + POM_XML_FILE));
-            MavenXpp3Writer pomWriter = new MavenXpp3Writer();
+                    new File(PROJECTSLOCATION + File.separator + getArtifactId(name) + File.separator + POM_XML_FILE));
+            final MavenXpp3Writer pomWriter = new MavenXpp3Writer();
             pomWriter.write(writer, model);
-        } catch (Exception e) {
-            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while creating POM for " + getArtifactID(name)
+        } catch (final Exception e) {
+            LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while creating POM for " + getArtifactId(name)
                     + e.getMessage(), e);
         } finally {
             IOUtil.close(writer);
         }
     }
 
-    private List<Dependency> getDependencies(String controllerName) {
+    private List<Dependency> getDependencies(final String controllerName) {
         // Read the Dependency Information from property file.
-        Path file = Paths.get(DEPENDENCY_FILE);
+        final Path file = Paths.get(DEPENDENCY_FILE);
         if (!Files.notExists(file)) {
             try {
-                String dependencyJSON = new String(Files.readAllBytes(file), StandardCharsets.UTF_8);
-                DependencyInfo dependencyInfo = PolicyUtils.jsonStringToObject(dependencyJSON, DependencyInfo.class);
+                final String dependencyJson = new String(Files.readAllBytes(file), StandardCharsets.UTF_8);
+                final DependencyInfo dependencyInfo =
+                        PolicyUtils.jsonStringToObject(dependencyJson, DependencyInfo.class);
                 String controller = "default";
                 if (dependencyInfo.getDependencies().containsKey(controllerName)) {
                     controller = controllerName;
                 }
-                List<Dependency> dependencyList = new ArrayList<>();
-                for (PEDependency dependency : dependencyInfo.getDependencies().get(controller)) {
+                final List<Dependency> dependencyList = new ArrayList<>();
+                for (final PEDependency dependency : dependencyInfo.getDependencies().get(controller)) {
                     dependencyList.add(dependency.getDependency());
                 }
                 return dependencyList;
@@ -966,49 +969,54 @@
         return defaultDependencies(controllerName);
     }
 
-    // Default Dependency Section. Can be changed as required.
-    public List<Dependency> defaultDependencies(String controllerName) {
+    /**
+     * Default Dependency Section. Can be changed as required.
+     * 
+     * @param controllerName the controller name
+     * @return changed dependency list
+     */
+    public List<Dependency> defaultDependencies(final String controllerName) {
 
-        List<Dependency> dependencyList = new ArrayList<>();
-        String version = StringEscapeUtils.escapeJava(brmsdependencyversion);
+        final List<Dependency> dependencyList = new ArrayList<>();
+        final String version = StringEscapeUtils.escapeJava(brmsdependencyversion);
 
-        Dependency demoDependency = new Dependency();
+        final Dependency demoDependency = new Dependency();
         demoDependency.setGroupId(DROOLS_APPS_TEMPLATE_GROUP);
         demoDependency.setArtifactId("template.demo");
         demoDependency.setVersion(version);
         dependencyList.add(demoDependency);
 
-        Dependency controlloopDependency = new Dependency();
+        final Dependency controlloopDependency = new Dependency();
         controlloopDependency.setGroupId(DROOLS_APPS_MODEL_GROUP);
         controlloopDependency.setArtifactId("events");
         controlloopDependency.setVersion(version);
         dependencyList.add(controlloopDependency);
 
-        Dependency restDependency = new Dependency();
+        final Dependency restDependency = new Dependency();
         restDependency.setGroupId(DROOLS_APPS_MODEL_GROUP);
         restDependency.setArtifactId("controlloop.common.model-impl.rest");
         restDependency.setVersion(version);
         dependencyList.add(restDependency);
 
-        Dependency appcDependency = new Dependency();
+        final Dependency appcDependency = new Dependency();
         appcDependency.setGroupId(DROOLS_APPS_MODEL_GROUP);
         appcDependency.setArtifactId("controlloop.common.model-impl.appc");
         appcDependency.setVersion(version);
         dependencyList.add(appcDependency);
 
-        Dependency aaiDependency = new Dependency();
+        final Dependency aaiDependency = new Dependency();
         aaiDependency.setGroupId(DROOLS_APPS_MODEL_GROUP);
         aaiDependency.setArtifactId("controlloop.common.model-impl.aai");
         aaiDependency.setVersion(version);
         dependencyList.add(aaiDependency);
 
-        Dependency msoDependency = new Dependency();
+        final Dependency msoDependency = new Dependency();
         msoDependency.setGroupId(DROOLS_APPS_MODEL_GROUP);
         msoDependency.setArtifactId("controlloop.common.model-impl.so");
         msoDependency.setVersion(version);
         dependencyList.add(msoDependency);
 
-        Dependency trafficgeneratorDependency = new Dependency();
+        final Dependency trafficgeneratorDependency = new Dependency();
         trafficgeneratorDependency.setGroupId(DROOLS_APPS_MODEL_GROUP);
         trafficgeneratorDependency.setArtifactId("controlloop.common.model-impl.trafficgenerator");
         trafficgeneratorDependency.setVersion(version);
@@ -1016,12 +1024,12 @@
         return dependencyList;
     }
 
-    private void createProject(String path, String ksessionName) {
+    private void createProject(final String path, final String ksessionName) {
         new File(path + File.separator + RULES).mkdirs();
         new File(path + File.separator + META_INF).mkdirs();
         if (!Files.exists(Paths.get(path + File.separator + META_INF + File.separator + KMODULE_XML_FILE))) {
             // Hard coding XML for PDP Drools to accept our Rules.
-            String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "\n"
+            final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "\n"
                     + "<kmodule xmlns=\"http://jboss.org/kie/6.0.0/kmodule\">" + "\n"
                     + "<kbase name=\"rules\" packages=\"rules\">" + "\n" + "<ksession name=\"" + ksessionName + "\"/>"
                     + "\n" + "</kbase></kmodule>";
@@ -1029,75 +1037,72 @@
         }
     }
 
-    private void copyDataToFile(String file, String rule) {
+    private void copyDataToFile(final String file, final String rule) {
         try {
             FileUtils.writeStringToFile(new File(file), rule);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             LOGGER.error(
                     XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error while creating Rule for " + file + e.getMessage(),
                     e);
         }
     }
 
-    private void readGroups(Properties config) throws PolicyException {
+    private void readGroups(final Properties config) throws PolicyException {
         String[] groupNames;
-        String groupNamesError = "groupNames property is missing or empty from the property file ";
-		if (!config.containsKey(GROUP_NAMES) || config.getProperty(GROUP_NAMES)==null){
-            throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE
-                    + groupNamesError);
+        final String groupNamesError = "groupNames property is missing or empty from the property file ";
+        if (!config.containsKey(GROUP_NAMES) || config.getProperty(GROUP_NAMES) == null) {
+            throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE + groupNamesError);
         }
         if (config.getProperty(GROUP_NAMES).contains(",")) {
             groupNames = config.getProperty(GROUP_NAMES).replaceAll(" ", "").split(",");
         } else {
-            groupNames = new String[] { config.getProperty(GROUP_NAMES).replaceAll(" ", "") };
+            groupNames = new String[] {config.getProperty(GROUP_NAMES).replaceAll(" ", "")};
         }
         if (groupNames == null || groupNames.length == 0) {
-            LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE
-                    + groupNamesError);
-            throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE
-                    + groupNamesError);
+            LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + groupNamesError);
+            throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE + groupNamesError);
         }
         groupMap = new HashMap<>();
         for (int counter = 0; counter < groupNames.length; counter++) {
-            String name = groupNames[counter];
-            String groupID = config.getProperty(name + ".groupID");
-            if (groupID == null) {
+            final String name = groupNames[counter];
+            final String groupId = config.getProperty(name + ".groupID");
+            if (groupId == null) {
                 LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + name
                         + ".groupID property is missing from the property file ");
                 throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE + name
                         + ".groupID property is missing from the property file ");
             }
-            String artifactID = config.getProperty(name + ".artifactID");
-            if (artifactID == null) {
+            final String artifactId = config.getProperty(name + ".artifactID");
+            if (artifactId == null) {
                 LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + name
                         + ".artifactID property is missing from the property file ");
                 throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE + name
                         + ".artifactID property is missing from the property file ");
             }
-            PEDependency dependency = new PEDependency();
-            dependency.setArtifactId(artifactID);
-            dependency.setGroupId(groupID);
+            final PEDependency dependency = new PEDependency();
+            dependency.setArtifactId(artifactId);
+            dependency.setGroupId(groupId);
             // Add to list if we got all
             addToGroup(name, dependency);
         }
     }
 
-    private void addToGroup(String name, PEDependency dependency) {
-        ArrayList<Object> values = new ArrayList<>();
+    private void addToGroup(final String name, final PEDependency dependency) {
+        final ArrayList<Object> values = new ArrayList<>();
         values.add(dependency);
         groupMap.put(name, values);
-        EntityTransaction et = em.getTransaction();
+        final EntityTransaction et = em.getTransaction();
         et.begin();
-        Query query = em.createQuery("select b from BRMSGroupInfo as b where b.controllerName = :cn");
+        final Query query = em.createQuery("select b from BrmsGroupInfo as b where b.controllerName = :cn");
         query.setParameter("cn", name);
-        List<?> groupList = query.getResultList();
-        BRMSGroupInfo brmsGroupInfo = null;
+        final List<?> groupList = query.getResultList();
+        BrmsGroupInfo brmsGroupInfo = null;
         if (!groupList.isEmpty()) {
             LOGGER.info("Controller name already Existing in DB. Will be updating the DB Values" + name);
-            brmsGroupInfo = (BRMSGroupInfo) groupList.get(0);
+            brmsGroupInfo = (BrmsGroupInfo) groupList.get(0);
         }
         if (brmsGroupInfo == null) {
-            brmsGroupInfo = new BRMSGroupInfo();
+            brmsGroupInfo = new BrmsGroupInfo();
         }
         brmsGroupInfo.setControllerName(name);
         brmsGroupInfo.setGroupId(dependency.getGroupId());
@@ -1108,23 +1113,23 @@
         et.commit();
     }
 
-    private String getArtifactID(String name) {
+    private String getArtifactId(final String name) {
         return ((PEDependency) groupMap.get(name).get(0)).getArtifactId();
     }
 
-    private String getGroupID(String name) {
+    private String getGroupId(final String name) {
         return ((PEDependency) groupMap.get(name).get(0)).getGroupId();
     }
 
-    private String getVersion(String name) {
+    private String getVersion(final String name) {
         return ((PEDependency) groupMap.get(name).get(0)).getVersion();
     }
 
-    private void getNameAndSetRemove(String controllerName, String policyName) {
-        String artifactName = getArtifactID(controllerName);
-        String ruleFolder = PROJECTSLOCATION + File.separator + artifactName + File.separator + "src" + File.separator
-                + "main" + File.separator + RESOURCES + File.separator + RULES;
-        File file = new File(ruleFolder + File.separator + policyName + ".drl");
+    private void getNameAndSetRemove(final String controllerName, final String policyName) {
+        final String artifactName = getArtifactId(controllerName);
+        final String ruleFolder = PROJECTSLOCATION + File.separator + artifactName + File.separator + "src"
+                + File.separator + "main" + File.separator + RESOURCES + File.separator + RULES;
+        final File file = new File(ruleFolder + File.separator + policyName + ".drl");
         if (file.delete()) {
             LOGGER.info("Deleted File.. " + file.getAbsolutePath());
             removePolicyFromGroup(policyName, controllerName);
@@ -1138,17 +1143,17 @@
     }
 
     // Removes Policy from Memory and Database.
-    private void removePolicyFromGroup(String policyName, String controllerName) {
+    private void removePolicyFromGroup(final String policyName, final String controllerName) {
         policyMap.remove(policyName);
-        EntityTransaction et = em.getTransaction();
+        final EntityTransaction et = em.getTransaction();
         et.begin();
-        Query query = em.createQuery("select b from BRMSPolicyInfo as b where b.policyName = :pn");
+        final Query query = em.createQuery("select b from BrmsPolicyInfo as b where b.policyName = :pn");
         query.setParameter("pn", policyName);
-        List<?> pList = query.getResultList();
-        BRMSPolicyInfo brmsPolicyInfo;
+        final List<?> pList = query.getResultList();
+        BrmsPolicyInfo brmsPolicyInfo;
         if (!pList.isEmpty()) {
             // Already exists.
-            brmsPolicyInfo = (BRMSPolicyInfo) pList.get(0);
+            brmsPolicyInfo = (BrmsPolicyInfo) pList.get(0);
             if (brmsPolicyInfo.getControllerName().getControllerName().equals(controllerName)) {
                 em.remove(brmsPolicyInfo);
                 em.flush();
@@ -1157,8 +1162,22 @@
         et.commit();
     }
 
-    private void setVersion(String newVersion, String controllerName) {
-        PEDependency userController = (PEDependency) groupMap.get(controllerName).get(0);
+    private void setVersion(final String selectedName) {
+        String newVersion = VERSION_0_1_0;
+        createFlag = false;
+        final NexusArtifact artifact = getLatestArtifactFromNexus(selectedName);
+        if (artifact != null) {
+            newVersion = incrementVersion(artifact.getVersion());
+        }
+        if (VERSION_0_1_0.equals(newVersion)) {
+            createFlag = true;
+        }
+        setVersion(newVersion, selectedName);
+        LOGGER.info("Controller: " + selectedName + "is on version: " + newVersion);
+    }
+
+    private void setVersion(final String newVersion, final String controllerName) {
+        final PEDependency userController = (PEDependency) groupMap.get(controllerName).get(0);
         userController.setVersion(newVersion);
         groupMap.get(controllerName).set(0, userController);
     }
@@ -1168,16 +1187,21 @@
         return bm;
     }
 
-    public void rotateURLs() {
-        if (repURLs != null) {
-            Collections.rotate(repURLs, -1);
+    /**
+     * Rotate URLs list.
+     */
+    public void rotateUrls() {
+        if (repUrlList != null) {
+            Collections.rotate(repUrlList, -1);
         }
     }
 
+    /**
+     * Get URL List Size.
+     * 
+     * @return URL list size
+     */
     public int urlListSize() {
-        if (repURLs != null) {
-            return repURLs.size();
-        } else
-            return 0;
+        return repUrlList != null ? repUrlList.size() : 0;
     }
 }
diff --git a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/ControllerPOJO.java b/BRMSGateway/src/main/java/org/onap/policy/brms/api/ControllerPojo.java
similarity index 60%
rename from BRMSGateway/src/main/java/org/onap/policy/brmsInterface/ControllerPOJO.java
rename to BRMSGateway/src/main/java/org/onap/policy/brms/api/ControllerPojo.java
index 5a0679c..e04a079 100644
--- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/ControllerPOJO.java
+++ b/BRMSGateway/src/main/java/org/onap/policy/brms/api/ControllerPojo.java
@@ -18,35 +18,40 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.policy.brmsInterface;
+package org.onap.policy.brms.api;
 
 import java.util.Map;
 
 /**
- * POJO for controller information. 
+ * POJO for controller information.
  * 
  */
-public class ControllerPOJO {
-	private String name;
-	private Map<String,String> drools;
-	private String operation;
-	public String getName() {
-		return name;
-	}
-	public void setName(String name) {
-		this.name = name;
-	}
-	public Map<String,String> getDrools() {
-		return drools;
-	}
-	public void setDrools(Map<String,String> drools) {
-		this.drools = drools;
-	}
-	public String getOperation() {
-		return operation;
-	}
-	public void setOperation(String operation) {
-		this.operation = operation;
-	}
-}
+public class ControllerPojo {
+    private String name;
+    private Map<String, String> drools;
+    private String operation;
 
+    public String getName() {
+        return name;
+    }
+
+    public void setName(final String name) {
+        this.name = name;
+    }
+
+    public Map<String, String> getDrools() {
+        return drools;
+    }
+
+    public void setDrools(final Map<String, String> drools) {
+        this.drools = drools;
+    }
+
+    public String getOperation() {
+        return operation;
+    }
+
+    public void setOperation(final String operation) {
+        this.operation = operation;
+    }
+}
diff --git a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/NotificationPOJO.java b/BRMSGateway/src/main/java/org/onap/policy/brms/api/NotificationPojo.java
similarity index 60%
rename from BRMSGateway/src/main/java/org/onap/policy/brmsInterface/NotificationPOJO.java
rename to BRMSGateway/src/main/java/org/onap/policy/brms/api/NotificationPojo.java
index 75bbe8a..788cbf7 100644
--- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/NotificationPOJO.java
+++ b/BRMSGateway/src/main/java/org/onap/policy/brms/api/NotificationPojo.java
@@ -18,35 +18,41 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.policy.brmsInterface;
+package org.onap.policy.brms.api;
 
 import java.util.List;
 
 /**
- * This POJO will be transformed to JSON for Notification Purposes.  
+ * This POJO will be transformed to JSON for Notification Purposes.
  * 
  */
-public class NotificationPOJO {
-	private String requestID;
-	private String entity;
-	private List<ControllerPOJO> controllers;
-	public String getRequestID() {
-		return requestID;
-	}
-	public void setRequestID(String requestID) {
-		this.requestID = requestID;
-	}
-	public String getEntity() {
-		return entity;
-	}
-	public void setEntity(String entity) {
-		this.entity = entity;
-	}
-	public List<ControllerPOJO> getControllers() {
-		return controllers;
-	}
-	public void setControllers(List<ControllerPOJO> controllers) {
-		this.controllers = controllers;
-	}
-	
+public class NotificationPojo {
+    private String requestId;
+    private String entity;
+    private List<ControllerPojo> controllers;
+
+    public String getRequestId() {
+        return requestId;
+    }
+
+    public void setRequestId(final String requestId) {
+        this.requestId = requestId;
+    }
+
+    public String getEntity() {
+        return entity;
+    }
+
+    public void setEntity(final String entity) {
+        this.entity = entity;
+    }
+
+    public List<ControllerPojo> getControllers() {
+        return controllers;
+    }
+
+    public void setControllers(final List<ControllerPojo> controllers) {
+        this.controllers = controllers;
+    }
+
 }
diff --git a/BRMSGateway/src/main/java/org/onap/policy/brms/entity/BrmsGroupInfo.java b/BRMSGateway/src/main/java/org/onap/policy/brms/entity/BrmsGroupInfo.java
new file mode 100644
index 0000000..f710b41
--- /dev/null
+++ b/BRMSGateway/src/main/java/org/onap/policy/brms/entity/BrmsGroupInfo.java
@@ -0,0 +1,76 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * 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=========================================================
+ */
+
+package org.onap.policy.brms.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+@Entity
+@Table(name = "brmsgroup_info")
+public class BrmsGroupInfo {
+
+    @Id
+    @Column(name = "controllerName", nullable = false, length = 255)
+    private String controllerName;
+
+    @Column(name = "groupId", nullable = false, length = 255)
+    private String groupId;
+
+    @Column(name = "artifactId", nullable = false, length = 255)
+    private String artifactId;
+
+    @Column(name = "version", length = 255)
+    private String version;
+
+    public String getControllerName() {
+        return controllerName;
+    }
+
+    public void setControllerName(final String controllerName) {
+        this.controllerName = controllerName;
+    }
+
+    public String getGroupId() {
+        return groupId;
+    }
+
+    public void setGroupId(final String groupId) {
+        this.groupId = groupId;
+    }
+
+    public String getArtifactId() {
+        return artifactId;
+    }
+
+    public void setArtifactId(final String artifactId) {
+        this.artifactId = artifactId;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(final String version) {
+        this.version = version;
+    }
+}
diff --git a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/jpa/BRMSPolicyInfo.java b/BRMSGateway/src/main/java/org/onap/policy/brms/entity/BrmsPolicyInfo.java
similarity index 64%
rename from BRMSGateway/src/main/java/org/onap/policy/brmsInterface/jpa/BRMSPolicyInfo.java
rename to BRMSGateway/src/main/java/org/onap/policy/brms/entity/BrmsPolicyInfo.java
index c269e29..4d7287f 100644
--- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/jpa/BRMSPolicyInfo.java
+++ b/BRMSGateway/src/main/java/org/onap/policy/brms/entity/BrmsPolicyInfo.java
@@ -17,7 +17,8 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-package org.onap.policy.brmsInterface.jpa;
+
+package org.onap.policy.brms.entity;
 
 import javax.persistence.Column;
 import javax.persistence.Entity;
@@ -27,30 +28,30 @@
 import javax.persistence.Table;
 
 @Entity
-@Table(name="brmsgroup_policy")
-public class BRMSPolicyInfo {
-	
-	@Id
-	@Column(name="policyName")
-	private String policyName;
-	
-	@ManyToOne
-	@JoinColumn(name="controllerName")
-	private BRMSGroupInfo controllerName;
-	
-	public String getPolicyName() {
-		return policyName;
-	}
+@Table(name = "brmsgroup_policy")
+public class BrmsPolicyInfo {
 
-	public void setPolicyName(String policyName) {
-		this.policyName = policyName;
-	}
+    @Id
+    @Column(name = "policyName")
+    private String policyName;
 
-	public BRMSGroupInfo getControllerName() {
-		return controllerName;
-	}
+    @ManyToOne
+    @JoinColumn(name = "controllerName")
+    private BrmsGroupInfo controllerName;
 
-	public void setControllerName(BRMSGroupInfo controllerName) {
-		this.controllerName = controllerName;
-	}
+    public String getPolicyName() {
+        return policyName;
+    }
+
+    public void setPolicyName(final String policyName) {
+        this.policyName = policyName;
+    }
+
+    public BrmsGroupInfo getControllerName() {
+        return controllerName;
+    }
+
+    public void setControllerName(final BrmsGroupInfo controllerName) {
+        this.controllerName = controllerName;
+    }
 }
diff --git a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/jpa/DependencyInfo.java b/BRMSGateway/src/main/java/org/onap/policy/brms/entity/DependencyInfo.java
similarity index 76%
rename from BRMSGateway/src/main/java/org/onap/policy/brmsInterface/jpa/DependencyInfo.java
rename to BRMSGateway/src/main/java/org/onap/policy/brms/entity/DependencyInfo.java
index 753de52..04a3730 100644
--- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/jpa/DependencyInfo.java
+++ b/BRMSGateway/src/main/java/org/onap/policy/brms/entity/DependencyInfo.java
@@ -17,7 +17,8 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
-package org.onap.policy.brmsInterface.jpa;
+
+package org.onap.policy.brms.entity;
 
 import java.util.List;
 import java.util.Map;
@@ -25,14 +26,15 @@
 import org.onap.policy.api.PEDependency;
 
 public class DependencyInfo {
-	private Map<String, List<PEDependency>> dependencies;
+    
+    private Map<String, List<PEDependency>> dependencies;
 
-	public Map<String, List<PEDependency>> getDependencies() {
-		return dependencies;
-	}
+    public Map<String, List<PEDependency>> getDependencies() {
+        return dependencies;
+    }
 
-	public void setDependencies(Map<String, List<PEDependency>> dependencies) {
-		this.dependencies = dependencies;
-	}
-	
+    public void setDependencies(final Map<String, List<PEDependency>> dependencies) {
+        this.dependencies = dependencies;
+    }
+
 }
diff --git a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSHandler.java b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSHandler.java
deleted file mode 100644
index b460fb8..0000000
--- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSHandler.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2017-2018 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.policy.brmsInterface;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.onap.policy.api.ConfigRequestParameters;
-import org.onap.policy.api.LoadedPolicy;
-import org.onap.policy.api.NotificationType;
-import org.onap.policy.api.PDPNotification;
-import org.onap.policy.api.PolicyConfig;
-import org.onap.policy.api.PolicyConfigStatus;
-import org.onap.policy.api.PolicyEngine;
-import org.onap.policy.api.PolicyException;
-import org.onap.policy.api.RemovedPolicy;
-import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
-import org.onap.policy.utils.BackUpHandler;
-import org.onap.policy.xacml.api.XACMLErrorConstants;
-
-/**
- * BRMSHandler: Notification Handler which listens for PDP Notifications. 
- * Take action only for BRMS policies. 
- * 
- * @version 0.3
- */
-public class BRMSHandler implements BackUpHandler{
-	
-	private static final Logger logger = FlexLogger.getLogger(BRMSHandler.class.getName());
-	
-	private BRMSPush bRMSPush = null;
-	
-	public BRMSHandler(String propertiesFile) throws PolicyException{
-		setBRMSPush(new BRMSPush(propertiesFile, this));
-	}
-
-	public void setBRMSPush(BRMSPush brmsPush) {
-		this.bRMSPush = brmsPush;
-	}
-	
-	/*
-	 * This Method is executed upon notification by the Policy Engine API Notification. 
-	 * (non-Javadoc)
-	 * @see org.onap.policy.utils.BackUpHandler#notificationReceived(org.onap.policy.api.PDPNotification)
-	 */
-	@Override
-	public void notificationReceived(PDPNotification notification) {
-		logger.info("Notification Recieved");
-		logger.info(notification.getNotificationType().toString());
-		Boolean flag = BRMSPush.getBackUpMonitor().getFlag();
-		bRMSPush.initiate(flag);
-		if(flag){
-			logger.info("Master Application performing on Notification ");
-			runOnNotification(notification);
-		}else{
-			logger.info("Slave application Skipping Notification.. ");
-		}
-	}
-	
-	/*
-	 * Executed when a policy is removed from PDP.  
-	 */
-	private void removedPolicies(Collection<RemovedPolicy> removedPolicies){
-		Boolean removed = false;
-		logger.info("Removed Policies");
-		for(RemovedPolicy removedPolicy: removedPolicies){
-			logger.info(removedPolicy.getPolicyName());
-			logger.info(removedPolicy.getVersionNo());
-			if(removedPolicy.getPolicyName().contains("_BRMS_")){
-				try{
-					logger.info("Policy Removed with this policy Name : " + removedPolicy.getPolicyName());
-					bRMSPush.removeRule(removedPolicy.getPolicyName());
-					removed = true;
-				}catch(Exception e){
-					logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Rertriving policy failed " + e.getMessage(), e);
-				}
-			}
-		}
-		Boolean failureFlag;
-		int i = 0;
-		do{
-			failureFlag = false;
-			if(removed){
-				try{
-					bRMSPush.pushRules();
-				}catch(PolicyException e){
-					//Upon Notification failure 
-					failureFlag = true;
-					bRMSPush.rotateURLs();
-					logger.error("Failure during Push Operation " , e);
-				}
-			}
-			i++;
-		}while(failureFlag && i< bRMSPush.urlListSize());
-	}
-	
-	/*
-	 * This method is executed if BRMSGW is "MASTER" 
-	 * (non-Javadoc)
-	 * @see org.onap.policy.utils.BackUpHandler#runOnNotification(org.onap.policy.api.PDPNotification)
-	 */
-	@Override
-	public void runOnNotification(PDPNotification notification){
-		// reset the BRMSPush data structures
-		bRMSPush.resetDS();
-		if(notification.getNotificationType().equals(NotificationType.REMOVE)){
-			removedPolicies(notification.getRemovedPolicies());
-		}else if(notification.getNotificationType().equals(NotificationType.UPDATE)|| notification.getNotificationType().equals(NotificationType.BOTH)){
-			logger.info("Updated Policies: \n");
-			ArrayList<PolicyConfig> brmsPolicies = addedPolicies(notification);
-			Boolean successFlag = false;
-			for(int i=0; !successFlag && i< bRMSPush.urlListSize(); i++){
-				if(i!=0){
-					for(PolicyConfig policyConfig: brmsPolicies){
-						logger.info("Policy Retry with this Name notified: " + policyConfig.getPolicyName());
-						bRMSPush.addRule(policyConfig.getPolicyName(),policyConfig.toOther(),policyConfig.getResponseAttributes());
-					}
-				}
-				try{
-					bRMSPush.pushRules();
-					successFlag = true;
-				}catch(PolicyException e){
-					//Upon Notification failure 
-					successFlag = false;
-					bRMSPush.rotateURLs();
-					logger.error("Failure during Push Operation " , e);
-				}
-			}
-		}
-	}
-
-	/*
-	 * Executed when a policy is added to PDP.  
-	 */
-	private ArrayList<PolicyConfig> addedPolicies(PDPNotification notification) {
-		ArrayList<PolicyConfig> result = new ArrayList<>();
-		for(LoadedPolicy updatedPolicy: notification.getLoadedPolicies()){
-			logger.info("policyName : " + updatedPolicy.getPolicyName());
-			logger.info("policyVersion :" + updatedPolicy.getVersionNo());
-			logger.info("Matches: " + updatedPolicy.getMatches());
-			// Checking the Name is correct or not. 
-			if(updatedPolicy.getPolicyName().contains("_BRMS_")){
-				try{
-					PolicyEngine policyEngine = getPolicyEngine();
-					if(policyEngine!=null){
-						ConfigRequestParameters configRequestParameters = new ConfigRequestParameters();
-						configRequestParameters.setPolicyName(updatedPolicy.getPolicyName());
-						Collection<PolicyConfig> policyConfigs = policyEngine.getConfig(configRequestParameters);
-						for(PolicyConfig policyConfig: policyConfigs){
-							if(policyConfig.getPolicyConfigStatus().equals(PolicyConfigStatus.CONFIG_RETRIEVED)){
-								logger.info("Policy Retrieved with this Name notified: " + policyConfig.getPolicyName());
-								result.add(policyConfig);
-								bRMSPush.addRule(policyConfig.getPolicyName(),policyConfig.toOther(),policyConfig.getResponseAttributes());
-							}else{
-								logger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR +"Fail to retrieve policy so rule will not be pushed to PolicyRepo !!!!\n\n");
-							}
-						}
-					}
-				}catch(Exception e){
-					logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW+"Rertriving policy failed " + e.getMessage(), e);
-				}
-			}
-		}
-		return result;
-	}
-
-	public PolicyEngine getPolicyEngine() {
-		return BRMSGateway.getPolicyEngine();
-	}
-}
diff --git a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/jpa/BRMSGroupInfo.java b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/jpa/BRMSGroupInfo.java
deleted file mode 100644
index 6b4a2bf..0000000
--- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/jpa/BRMSGroupInfo.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * 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=========================================================
- */
-package org.onap.policy.brmsInterface.jpa;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-@Entity
-@Table(name="brmsgroup_info")
-public class BRMSGroupInfo{
-	
-	@Id
-	@Column(name = "controllerName", nullable=false, length=255)
-	private String controllerName;
-	
-	@Column(name = "groupId", nullable=false, length=255)
-	private String groupId;
-	
-	@Column(name = "artifactId", nullable=false, length=255)
-	private String artifactId;
-	
-	@Column(name = "version", length=255)
-	private String version;
-	
-	public String getControllerName() {
-		return controllerName;
-	}
-
-	public void setControllerName(String controllerName) {
-		this.controllerName = controllerName;
-	}
-
-	public String getGroupId() {
-		return groupId;
-	}
-
-	public void setGroupId(String groupId) {
-		this.groupId = groupId;
-	}
-
-	public String getArtifactId() {
-		return artifactId;
-	}
-
-	public void setArtifactId(String artifactId) {
-		this.artifactId = artifactId;
-	}
-
-	public String getVersion() {
-		return version;
-	}
-
-	public void setVersion(String version) {
-		this.version = version;
-	}
-}
diff --git a/BRMSGateway/src/main/resources/META-INF/persistenceBRMS.xml b/BRMSGateway/src/main/resources/META-INF/persistenceBRMS.xml
index 99e6b92..f490218 100644
--- a/BRMSGateway/src/main/resources/META-INF/persistenceBRMS.xml
+++ b/BRMSGateway/src/main/resources/META-INF/persistenceBRMS.xml
@@ -3,7 +3,7 @@
   ============LICENSE_START=======================================================
   PolicyEngineUtils
   ================================================================================
-  Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+  Copyright (C) 2017-2018 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.
@@ -20,11 +20,11 @@
   -->
 
 <persistence version="2.1"
-	xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
-	<persistence-unit name="BRMSGW" transaction-type="RESOURCE_LOCAL">
-		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
-		<class>org.onap.policy.brmsInterface.jpa.BRMSGroupInfo</class>
-		<class>org.onap.policy.brmsInterface.jpa.BRMSPolicyInfo</class>
-	</persistence-unit>
+    xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
+    <persistence-unit name="BRMSGW" transaction-type="RESOURCE_LOCAL">
+        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
+        <class>org.onap.policy.brms.entity.BrmsGroupInfo</class>
+        <class>org.onap.policy.brms.entity.BrmsPolicyInfo</class>
+    </persistence-unit>
 </persistence>
\ No newline at end of file
diff --git a/BRMSGateway/src/test/java/org/onap/brmsgw/test/BRMSJpaTest.java b/BRMSGateway/src/test/java/org/onap/brmsgw/test/BRMSJpaTest.java
deleted file mode 100644
index ffcc2e3..0000000
--- a/BRMSGateway/src/test/java/org/onap/brmsgw/test/BRMSJpaTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2018 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.brmsgw.test;
-
-import static org.junit.Assert.assertEquals;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.junit.Test;
-import org.onap.policy.api.PEDependency;
-import org.onap.policy.brmsInterface.jpa.BRMSGroupInfo;
-import org.onap.policy.brmsInterface.jpa.BRMSPolicyInfo;
-import org.onap.policy.brmsInterface.jpa.DependencyInfo;
-
-public class BRMSJpaTest {
-	@Test
-	public void testJpa() {
-		String testVal = "testVal";
-		BRMSGroupInfo groupInfo = new BRMSGroupInfo();
-		
-		// Test group info
-		groupInfo.setControllerName(testVal);
-		assertEquals(groupInfo.getControllerName(), testVal);
-		groupInfo.setGroupId(testVal);
-		assertEquals(groupInfo.getGroupId(), testVal);
-		groupInfo.setArtifactId(testVal);
-		assertEquals(groupInfo.getArtifactId(), testVal);
-		groupInfo.setVersion(testVal);
-		assertEquals(groupInfo.getVersion(), testVal);
-		
-		// Test policy info
-		BRMSPolicyInfo policyInfo = new BRMSPolicyInfo();
-		policyInfo.setPolicyName(testVal);
-		assertEquals(policyInfo.getPolicyName(), testVal);
-		policyInfo.setControllerName(groupInfo);
-		assertEquals(policyInfo.getControllerName(), groupInfo);
-	}
-	
-	@Test
-	public void testDependencyInfo() {
-		String testKey = "testKey";
-		PEDependency dependency = new PEDependency();
-		List<PEDependency> list = new ArrayList<PEDependency>();
-		list.add(dependency);
-		Map<String, List<PEDependency>> map = new HashMap<String, List<PEDependency>>();
-		map.put(testKey, list);
-		DependencyInfo info = new DependencyInfo();
-		
-		info.setDependencies(map);
-		assertEquals(info.getDependencies(), map);
-	}
-}
diff --git a/BRMSGateway/src/test/java/org/onap/brmsgw/test/BRMSPushTest.java b/BRMSGateway/src/test/java/org/onap/brmsgw/test/BRMSPushTest.java
deleted file mode 100644
index aa25744..0000000
--- a/BRMSGateway/src/test/java/org/onap/brmsgw/test/BRMSPushTest.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * 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=========================================================
- */
-
-package org.onap.brmsgw.test;
-
-import static org.junit.Assert.assertNotNull;
-
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Properties;
-
-import org.junit.Test;
-import org.onap.policy.api.PolicyException;
-import org.onap.policy.brmsInterface.BRMSHandler;
-
-public class BRMSPushTest {
-    
-    private final String VALIDFILE = "src/test/resources/config.properties";
-    private final String INVALIDFILE = "src/test/resources/failure.properties";
-    
-    @Test (expected = PolicyException.class)
-    public void bRMSHandlerFailTest() throws PolicyException {
-        new BRMSHandler(null);
-    }
-    
-    @Test (expected = PolicyException.class)
-    public void bRMSHandlerFailTest1() throws PolicyException {
-        new BRMSHandler("src/test/resources/filenotexists.txt");
-    }
-    
-    @Test (expected = PolicyException.class)
-    public void bRMSHandlerFailTest2() throws PolicyException {
-        PropertyChange prop = new PropertyChange();
-        prop.key = "defaultName";
-        prop.remove = true;
-        List<PropertyChange> props = new LinkedList<>();
-        props.add(prop);
-        setFailureProperties(props);
-        new BRMSHandler(INVALIDFILE);
-    }
-    
-    @Test (expected = PolicyException.class)
-    public void bRMSHandlerFailTest3() throws PolicyException {
-        PropertyChange prop = new PropertyChange();
-        prop.key = "repositoryID";
-        prop.remove = true;
-        List<PropertyChange> props = new LinkedList<>();
-        props.add(prop);
-        prop = new PropertyChange();
-        prop.key = "RESOURCE_NAME";
-        prop.remove = true;
-        props.add(prop);
-        setFailureProperties(props);
-        new BRMSHandler(INVALIDFILE);
-    }
-    
-    @Test (expected = PolicyException.class)
-    public void bRMSHandlerFailTest4() throws PolicyException {
-        PropertyChange prop = new PropertyChange();
-        prop.key = "repositoryURL";
-        prop.remove = true;
-        List<PropertyChange> props = new LinkedList<>();
-        props.add(prop);
-        setFailureProperties(props);
-        new BRMSHandler(INVALIDFILE);
-    }
-    
-    @Test (expected = PolicyException.class)
-    public void bRMSHandlerFailTest5() throws PolicyException {
-        PropertyChange prop = new PropertyChange();
-        prop.key = "repositoryName";
-        prop.remove = true;
-        List<PropertyChange> props = new LinkedList<>();
-        props.add(prop);
-        setFailureProperties(props);
-        new BRMSHandler(INVALIDFILE);
-    }
-    
-    @Test (expected = PolicyException.class)
-    public void bRMSHandlerFailTest6() throws PolicyException {
-        PropertyChange prop = new PropertyChange();
-        prop.key = "repositoryURL";
-        prop.value = "http://nexus:8081/nexus/content/repositories/releases, http://nexus:8081/nexus/content/repositories/releases";
-        prop.remove = false;
-        List<PropertyChange> props = new LinkedList<>();
-        props.add(prop);
-        prop = new PropertyChange();
-        prop.key = "repositoryUsername";
-        prop.remove = true;
-        props.add(prop);
-        setFailureProperties(props);
-        new BRMSHandler(INVALIDFILE);
-    }
-    
-    @Test (expected = PolicyException.class)
-    public void bRMSHandlerFailTest7() throws PolicyException {
-        PropertyChange prop = new PropertyChange();
-        prop.key = "repositoryPassword";
-        prop.remove = true;
-        List<PropertyChange> props = new LinkedList<>();
-        props.add(prop);
-        setFailureProperties(props);
-        new BRMSHandler(INVALIDFILE);
-    }
-    
-    @Test (expected = PolicyException.class)
-    public void bRMSHandlerFailTest8() throws PolicyException {
-        PropertyChange prop = new PropertyChange();
-        prop.key = "policyKeyID";
-        prop.remove = true;
-        List<PropertyChange> props = new LinkedList<>();
-        props.add(prop);
-        setFailureProperties(props);
-        new BRMSHandler(INVALIDFILE);
-    }
-    
-    @Test (expected = PolicyException.class)
-    public void bRMSHandlerFailTest9() throws PolicyException {
-        PropertyChange prop = new PropertyChange();
-        prop.key = "sync";
-        prop.value = "true";
-        prop.remove = false;
-        List<PropertyChange> props = new LinkedList<>();
-        props.add(prop);
-        prop = new PropertyChange();
-        prop.key = "brms.dependency.version";
-        prop.remove = true;
-        props.add(prop);
-        prop = new PropertyChange();
-        prop.key = "groupNames";
-        prop.remove = true;
-        props.add(prop);
-        setFailureProperties(props);
-        new BRMSHandler(INVALIDFILE);
-    }
-    
-    @Test (expected = PolicyException.class)
-    public void bRMSHandlerFailTest10() throws PolicyException {
-        PropertyChange prop = new PropertyChange();
-        prop.key = "groupNames";
-        prop.value = "";
-        prop.remove = false;
-        List<PropertyChange> props = new LinkedList<>();
-        props.add(prop);
-        setFailureProperties(props);
-        new BRMSHandler(INVALIDFILE);
-    }
-    
-    @Test (expected = PolicyException.class)
-    public void bRMSHandlerFailTest11() throws PolicyException {
-        PropertyChange prop = new PropertyChange();
-        prop.key = "default.groupID";
-        prop.remove = true;
-        List<PropertyChange> props = new LinkedList<>();
-        props.add(prop);
-        setFailureProperties(props);
-        new BRMSHandler(INVALIDFILE);
-    }
-    
-    @Test (expected = PolicyException.class)
-    public void bRMSHandlerFailTest12() throws PolicyException {
-        PropertyChange prop = new PropertyChange();
-        prop.key = "default.artifactID";
-        prop.remove = true;
-        List<PropertyChange> props = new LinkedList<>();
-        props.add(prop);
-        setFailureProperties(props);
-        new BRMSHandler(INVALIDFILE);
-    }
-    
-    @Test (expected = PolicyException.class)
-    public void bRMSHandlerFailTest13() throws PolicyException {
-        PropertyChange prop = new PropertyChange();
-        prop.key = "NOTIFICATION_TYPE";
-        prop.value = "dmaap";
-        prop.remove = false;
-        List<PropertyChange> props = new LinkedList<>();
-        props.add(prop);
-        prop = new PropertyChange();
-        prop.key = "NOTIFICATION_SERVERS";
-        prop.remove = true;
-        props.add(prop);
-        setFailureProperties(props);
-        new BRMSHandler(INVALIDFILE);
-    }
-    
-    @Test
-    public void BRMSHandlerTest() throws PolicyException {
-        assertNotNull(new BRMSHandler(VALIDFILE));
-    }
-    
-    private void setFailureProperties(List<PropertyChange> properties) throws PolicyException {
-        Properties validProp = new Properties();
-        try {
-            validProp.load(new FileInputStream(VALIDFILE));
-            for (PropertyChange prop: properties) {
-                if(prop.remove) {
-                    validProp.remove(prop.key);
-                }else {
-                    validProp.setProperty(prop.key, prop.value);
-                }
-            }
-            validProp.store(new FileOutputStream(INVALIDFILE), null);
-        } catch (IOException e) {
-            throw new PolicyException(e);
-        }
-    }
-    
-    class PropertyChange {
-        public String key = null;
-        public String value = null;
-        public Boolean remove = false;
-    }
-}
diff --git a/BRMSGateway/src/test/java/org/onap/brmsgw/test/BrmsJpaTest.java b/BRMSGateway/src/test/java/org/onap/brmsgw/test/BrmsJpaTest.java
new file mode 100644
index 0000000..32ed314
--- /dev/null
+++ b/BRMSGateway/src/test/java/org/onap/brmsgw/test/BrmsJpaTest.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2018 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.brmsgw.test;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+import org.onap.policy.api.PEDependency;
+import org.onap.policy.brms.entity.BrmsGroupInfo;
+import org.onap.policy.brms.entity.BrmsPolicyInfo;
+import org.onap.policy.brms.entity.DependencyInfo;
+
+public class BrmsJpaTest {
+    @Test
+    public void testJpa() {
+        final String testVal = "testVal";
+        final BrmsGroupInfo groupInfo = new BrmsGroupInfo();
+
+        // Test group info
+        groupInfo.setControllerName(testVal);
+        assertEquals(groupInfo.getControllerName(), testVal);
+        groupInfo.setGroupId(testVal);
+        assertEquals(groupInfo.getGroupId(), testVal);
+        groupInfo.setArtifactId(testVal);
+        assertEquals(groupInfo.getArtifactId(), testVal);
+        groupInfo.setVersion(testVal);
+        assertEquals(groupInfo.getVersion(), testVal);
+
+        // Test policy info
+        final BrmsPolicyInfo policyInfo = new BrmsPolicyInfo();
+        policyInfo.setPolicyName(testVal);
+        assertEquals(policyInfo.getPolicyName(), testVal);
+        policyInfo.setControllerName(groupInfo);
+        assertEquals(policyInfo.getControllerName(), groupInfo);
+    }
+
+    @Test
+    public void testDependencyInfo() {
+        final String testKey = "testKey";
+        final PEDependency dependency = new PEDependency();
+        final List<PEDependency> list = new ArrayList<PEDependency>();
+        list.add(dependency);
+        final Map<String, List<PEDependency>> map = new HashMap<String, List<PEDependency>>();
+        map.put(testKey, list);
+        final DependencyInfo info = new DependencyInfo();
+
+        info.setDependencies(map);
+        assertEquals(info.getDependencies(), map);
+    }
+}
diff --git a/BRMSGateway/src/test/java/org/onap/brmsgw/test/BrmsPushTest.java b/BRMSGateway/src/test/java/org/onap/brmsgw/test/BrmsPushTest.java
new file mode 100644
index 0000000..36e6336
--- /dev/null
+++ b/BRMSGateway/src/test/java/org/onap/brmsgw/test/BrmsPushTest.java
@@ -0,0 +1,235 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * 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=========================================================
+ */
+
+package org.onap.brmsgw.test;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.onap.policy.api.PolicyException;
+import org.onap.policy.brms.api.BrmsHandler;
+
+public class BrmsPushTest {
+
+    private static final String VALID_FILE = "src/test/resources/config.properties";
+    private static final String INVALID_FILE = "src/test/resources/failure.properties";
+
+    @Test(expected = PolicyException.class)
+    public void brmsHandlerFailTest() throws PolicyException {
+        new BrmsHandler(null);
+    }
+
+    @Test(expected = PolicyException.class)
+    public void brmsHandlerFailTest1() throws PolicyException {
+        new BrmsHandler("src/test/resources/filenotexists.txt");
+    }
+
+    @Test(expected = PolicyException.class)
+    public void brmsHandlerFailTest2() throws PolicyException {
+        final PropertyChange prop = new PropertyChange();
+        prop.key = "defaultName";
+        prop.remove = true;
+        final List<PropertyChange> props = new LinkedList<>();
+        props.add(prop);
+        setFailureProperties(props);
+        new BrmsHandler(INVALID_FILE);
+    }
+
+    @Test(expected = PolicyException.class)
+    public void brmsHandlerFailTest3() throws PolicyException {
+        PropertyChange prop = new PropertyChange();
+        prop.key = "repositoryID";
+        prop.remove = true;
+        final List<PropertyChange> props = new LinkedList<>();
+        props.add(prop);
+        prop = new PropertyChange();
+        prop.key = "RESOURCE_NAME";
+        prop.remove = true;
+        props.add(prop);
+        setFailureProperties(props);
+        new BrmsHandler(INVALID_FILE);
+    }
+
+    @Test(expected = PolicyException.class)
+    public void brmsHandlerFailTest4() throws PolicyException {
+        final PropertyChange prop = new PropertyChange();
+        prop.key = "repositoryURL";
+        prop.remove = true;
+        final List<PropertyChange> props = new LinkedList<>();
+        props.add(prop);
+        setFailureProperties(props);
+        new BrmsHandler(INVALID_FILE);
+    }
+
+    @Test(expected = PolicyException.class)
+    public void brmsHandlerFailTest5() throws PolicyException {
+        final PropertyChange prop = new PropertyChange();
+        prop.key = "repositoryName";
+        prop.remove = true;
+        final List<PropertyChange> props = new LinkedList<>();
+        props.add(prop);
+        setFailureProperties(props);
+        new BrmsHandler(INVALID_FILE);
+    }
+
+    @Test(expected = PolicyException.class)
+    public void brmsHandlerFailTest6() throws PolicyException {
+        PropertyChange prop = new PropertyChange();
+        prop.key = "repositoryURL";
+        prop.value =
+                "http://nexus:8081/nexus/content/repositories/releases, http://nexus:8081/nexus/content/repositories/releases";
+        prop.remove = false;
+        final List<PropertyChange> props = new LinkedList<>();
+        props.add(prop);
+        prop = new PropertyChange();
+        prop.key = "repositoryUsername";
+        prop.remove = true;
+        props.add(prop);
+        setFailureProperties(props);
+        new BrmsHandler(INVALID_FILE);
+    }
+
+    @Test(expected = PolicyException.class)
+    public void brmsHandlerFailTest7() throws PolicyException {
+        final PropertyChange prop = new PropertyChange();
+        prop.key = "repositoryPassword";
+        prop.remove = true;
+        final List<PropertyChange> props = new LinkedList<>();
+        props.add(prop);
+        setFailureProperties(props);
+        new BrmsHandler(INVALID_FILE);
+    }
+
+    @Test(expected = PolicyException.class)
+    public void brmsHandlerFailTest8() throws PolicyException {
+        final PropertyChange prop = new PropertyChange();
+        prop.key = "policyKeyID";
+        prop.remove = true;
+        final List<PropertyChange> props = new LinkedList<>();
+        props.add(prop);
+        setFailureProperties(props);
+        new BrmsHandler(INVALID_FILE);
+    }
+
+    @Test(expected = PolicyException.class)
+    public void brmsHandlerFailTest9() throws PolicyException {
+        PropertyChange prop = new PropertyChange();
+        prop.key = "sync";
+        prop.value = "true";
+        prop.remove = false;
+        final List<PropertyChange> props = new LinkedList<>();
+        props.add(prop);
+        prop = new PropertyChange();
+        prop.key = "brms.dependency.version";
+        prop.remove = true;
+        props.add(prop);
+        prop = new PropertyChange();
+        prop.key = "groupNames";
+        prop.remove = true;
+        props.add(prop);
+        setFailureProperties(props);
+        new BrmsHandler(INVALID_FILE);
+    }
+
+    @Test(expected = PolicyException.class)
+    public void brmsHandlerFailTest10() throws PolicyException {
+        final PropertyChange prop = new PropertyChange();
+        prop.key = "groupNames";
+        prop.value = "";
+        prop.remove = false;
+        final List<PropertyChange> props = new LinkedList<>();
+        props.add(prop);
+        setFailureProperties(props);
+        new BrmsHandler(INVALID_FILE);
+    }
+
+    @Test(expected = PolicyException.class)
+    public void brmsHandlerFailTest11() throws PolicyException {
+        final PropertyChange prop = new PropertyChange();
+        prop.key = "default.groupID";
+        prop.remove = true;
+        final List<PropertyChange> props = new LinkedList<>();
+        props.add(prop);
+        setFailureProperties(props);
+        new BrmsHandler(INVALID_FILE);
+    }
+
+    @Test(expected = PolicyException.class)
+    public void brmsHandlerFailTest12() throws PolicyException {
+        final PropertyChange prop = new PropertyChange();
+        prop.key = "default.artifactID";
+        prop.remove = true;
+        final List<PropertyChange> props = new LinkedList<>();
+        props.add(prop);
+        setFailureProperties(props);
+        new BrmsHandler(INVALID_FILE);
+    }
+
+    @Test(expected = PolicyException.class)
+    public void brmsHandlerFailTest13() throws PolicyException {
+        PropertyChange prop = new PropertyChange();
+        prop.key = "NOTIFICATION_TYPE";
+        prop.value = "dmaap";
+        prop.remove = false;
+        final List<PropertyChange> props = new LinkedList<>();
+        props.add(prop);
+        prop = new PropertyChange();
+        prop.key = "NOTIFICATION_SERVERS";
+        prop.remove = true;
+        props.add(prop);
+        setFailureProperties(props);
+        new BrmsHandler(INVALID_FILE);
+    }
+
+    @Test
+    public void brmsHandlerTest() throws PolicyException {
+        assertNotNull(new BrmsHandler(VALID_FILE));
+    }
+
+    private void setFailureProperties(final List<PropertyChange> properties) throws PolicyException {
+        final Properties validProp = new Properties();
+        try {
+            validProp.load(new FileInputStream(VALID_FILE));
+            for (final PropertyChange prop : properties) {
+                if (prop.remove) {
+                    validProp.remove(prop.key);
+                } else {
+                    validProp.setProperty(prop.key, prop.value);
+                }
+            }
+            validProp.store(new FileOutputStream(INVALID_FILE), null);
+        } catch (final IOException e) {
+            throw new PolicyException(e);
+        }
+    }
+
+    class PropertyChange {
+        public String key = null;
+        public String value = null;
+        public Boolean remove = false;
+    }
+}
diff --git a/BRMSGateway/src/test/java/org/onap/brmsgw/test/ControllerPOJOTest.java b/BRMSGateway/src/test/java/org/onap/brmsgw/test/ControllerPojoTest.java
similarity index 64%
rename from BRMSGateway/src/test/java/org/onap/brmsgw/test/ControllerPOJOTest.java
rename to BRMSGateway/src/test/java/org/onap/brmsgw/test/ControllerPojoTest.java
index 5d736f6..21534dd 100644
--- a/BRMSGateway/src/test/java/org/onap/brmsgw/test/ControllerPOJOTest.java
+++ b/BRMSGateway/src/test/java/org/onap/brmsgw/test/ControllerPojoTest.java
@@ -21,25 +21,27 @@
 package org.onap.brmsgw.test;
 
 import static org.junit.Assert.assertEquals;
+
 import java.util.HashMap;
 import java.util.Map;
-import org.junit.Test;
-import org.onap.policy.brmsInterface.ControllerPOJO;
 
-public class ControllerPOJOTest {
-	@Test
-	public void testPojo() {
-		String testKey = "testKey";
-		String testVal = "testVal";
-		Map<String, String> testMap = new HashMap<String, String>();
-		testMap.put(testKey, testVal);
-		ControllerPOJO pojo = new ControllerPOJO();
-		
-		pojo.setName(testVal);
-		assertEquals(pojo.getName(), testVal);
-		pojo.setDrools(testMap);
-		assertEquals(pojo.getDrools(), testMap);
-		pojo.setOperation(testVal);
-		assertEquals(pojo.getOperation(), testVal);
-	}
+import org.junit.Test;
+import org.onap.policy.brms.api.ControllerPojo;
+
+public class ControllerPojoTest {
+    @Test
+    public void testPojo() {
+        final String testKey = "testKey";
+        final String testVal = "testVal";
+        final Map<String, String> testMap = new HashMap<String, String>();
+        testMap.put(testKey, testVal);
+        final ControllerPojo pojo = new ControllerPojo();
+
+        pojo.setName(testVal);
+        assertEquals(pojo.getName(), testVal);
+        pojo.setDrools(testMap);
+        assertEquals(pojo.getDrools(), testMap);
+        pojo.setOperation(testVal);
+        assertEquals(pojo.getOperation(), testVal);
+    }
 }
diff --git a/BRMSGateway/src/test/java/org/onap/brmsgw/test/NotificationPOJOTest.java b/BRMSGateway/src/test/java/org/onap/brmsgw/test/NotificationPojoTest.java
similarity index 61%
rename from BRMSGateway/src/test/java/org/onap/brmsgw/test/NotificationPOJOTest.java
rename to BRMSGateway/src/test/java/org/onap/brmsgw/test/NotificationPojoTest.java
index ef6585f..f83b749 100644
--- a/BRMSGateway/src/test/java/org/onap/brmsgw/test/NotificationPOJOTest.java
+++ b/BRMSGateway/src/test/java/org/onap/brmsgw/test/NotificationPojoTest.java
@@ -21,26 +21,28 @@
 package org.onap.brmsgw.test;
 
 import static org.junit.Assert.assertEquals;
+
 import java.util.ArrayList;
 import java.util.List;
-import org.junit.Test;
-import org.onap.policy.brmsInterface.ControllerPOJO;
-import org.onap.policy.brmsInterface.NotificationPOJO;
 
-public class NotificationPOJOTest {
-	@Test
-	public void testPojo() {
-		String testVal = "testVal";
-		ControllerPOJO ctrlPojo = new ControllerPOJO();
-		List<ControllerPOJO> controllers = new ArrayList<ControllerPOJO>();
-		controllers.add(ctrlPojo);
-		NotificationPOJO pojo = new NotificationPOJO();
-		
-		pojo.setRequestID(testVal);
-		assertEquals(pojo.getRequestID(), testVal);
-		pojo.setEntity(testVal);
-		assertEquals(pojo.getEntity(), testVal);
-		pojo.setControllers(controllers);
-		assertEquals(pojo.getControllers(), controllers);
-	}
+import org.junit.Test;
+import org.onap.policy.brms.api.ControllerPojo;
+import org.onap.policy.brms.api.NotificationPojo;
+
+public class NotificationPojoTest {
+    @Test
+    public void testPojo() {
+        final String testVal = "testVal";
+        final ControllerPojo ctrlPojo = new ControllerPojo();
+        final List<ControllerPojo> controllers = new ArrayList<ControllerPojo>();
+        controllers.add(ctrlPojo);
+        final NotificationPojo pojo = new NotificationPojo();
+
+        pojo.setRequestId(testVal);
+        assertEquals(pojo.getRequestId(), testVal);
+        pojo.setEntity(testVal);
+        assertEquals(pojo.getEntity(), testVal);
+        pojo.setControllers(controllers);
+        assertEquals(pojo.getControllers(), controllers);
+    }
 }
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brmsInterface/BRMSGatewayTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsGatewayTest.java
similarity index 63%
rename from BRMSGateway/src/test/java/org/onap/policy/brmsInterface/BRMSGatewayTest.java
rename to BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsGatewayTest.java
index e0b38b6..b3f836f 100644
--- a/BRMSGateway/src/test/java/org/onap/policy/brmsInterface/BRMSGatewayTest.java
+++ b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsGatewayTest.java
@@ -18,11 +18,12 @@
  * ============LICENSE_END=========================================================
  */
 
-package org.onap.policy.brmsInterface;
+package org.onap.policy.brms.api;
 
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.fail;
 import static org.mockito.Matchers.any;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.mockito.Mockito;
@@ -31,31 +32,30 @@
 import org.powermock.modules.junit4.PowerMockRunner;
 
 @RunWith(PowerMockRunner.class)
-public class BRMSGatewayTest {
-	@Test
-	public void testGet() {
-		assertNull(BRMSGateway.getPolicyEngine());
-	}
+public class BrmsGatewayTest {
+    @Test
+    public void testGet() {
+        assertNull(BrmsGateway.getPolicyEngine());
+    }
 
-	@PrepareForTest({Thread.class, BRMSGateway.class})
-	@Test
-	public void testMain() throws Exception {
-		// Mock Thread
-		PowerMockito.spy(Thread.class);
-		PowerMockito.doNothing().when(Thread.class);
-		Thread.sleep(1000);
+    @PrepareForTest({Thread.class, BrmsGateway.class})
+    @Test
+    public void testMain() throws Exception {
+        // Mock Thread
+        PowerMockito.spy(Thread.class);
+        PowerMockito.doNothing().when(Thread.class);
+        Thread.sleep(1000);
 
-		// Mock handler
-		BRMSHandler handler = Mockito.mock(BRMSHandler.class);
-		PowerMockito.whenNew(BRMSHandler.class).withArguments(any()).thenReturn(handler);
+        // Mock handler
+        final BrmsHandler handler = Mockito.mock(BrmsHandler.class);
+        PowerMockito.whenNew(BrmsHandler.class).withArguments(any()).thenReturn(handler);
 
-		// Run app
-		try {
-			String[] args = null;
-			BRMSGateway.main(args);
-		}
-		catch (Exception ex) {
-			fail("Not expected an exception: " + ex);
-		}
-	}
+        // Run app
+        try {
+            final String[] args = null;
+            BrmsGateway.main(args);
+        } catch (final Exception ex) {
+            fail("Not expected an exception: " + ex);
+        }
+    }
 }
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java
new file mode 100644
index 0000000..58bacef
--- /dev/null
+++ b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsHandlerTest.java
@@ -0,0 +1,94 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2018 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.policy.brms.api;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.any;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityTransaction;
+import javax.persistence.Persistence;
+import javax.persistence.Query;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.onap.policy.api.NotificationType;
+import org.onap.policy.std.StdPDPNotification;
+import org.onap.policy.utils.BackUpMonitor;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class BrmsHandlerTest {
+    @PrepareForTest({Persistence.class, BackUpMonitor.class})
+    @Test
+    public void negativeTestNotifications() throws Exception {
+        // Mock emf, persistence, and query
+        final EntityManagerFactory emf = Mockito.mock(EntityManagerFactory.class);
+        final EntityManager em = Mockito.mock(EntityManager.class);
+        Mockito.when(emf.createEntityManager()).thenReturn(em);
+        PowerMockito.mockStatic(Persistence.class);
+        PowerMockito.when(Persistence.createEntityManagerFactory(any(), any())).thenReturn(emf);
+        final EntityTransaction et = Mockito.mock(EntityTransaction.class);
+        Mockito.when(em.getTransaction()).thenReturn(et);
+        final Query query = Mockito.mock(Query.class);
+        Mockito.when(em.createQuery(Mockito.anyString())).thenReturn(query);
+
+        // Mock backup monitor
+        PowerMockito.mockStatic(BackUpMonitor.class);
+        final BackUpMonitor monitor = Mockito.mock(BackUpMonitor.class);
+        PowerMockito.when(BackUpMonitor.getInstance(any(), any(), any(), any())).thenReturn(monitor);
+
+        // Test constructor
+        final StdPDPNotification notification = new StdPDPNotification();
+        final String propFile = "config.properties";
+        final BrmsHandler handler = new BrmsHandler(propFile);
+        final BrmsPush brmsPush = new BrmsPush(propFile, handler);
+        handler.setBrmsPush(brmsPush);
+        assertNotNull(handler);
+        assertNotNull(brmsPush);
+        assertNull(handler.getPolicyEngine());
+
+        try {
+            // Test update
+            notification.setNotificationType(NotificationType.UPDATE);
+            handler.runOnNotification(notification);
+            handler.notificationReceived(notification);
+
+            // Test remove
+            notification.setNotificationType(NotificationType.REMOVE);
+            handler.runOnNotification(notification);
+            handler.notificationReceived(notification);
+
+            // Test both
+            notification.setNotificationType(NotificationType.BOTH);
+            handler.runOnNotification(notification);
+            handler.notificationReceived(notification);
+        } catch (final Exception ex) {
+            fail("Not expecting an exception: " + ex);
+        }
+    }
+}
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsPushTest.java b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsPushTest.java
new file mode 100644
index 0000000..2b13640
--- /dev/null
+++ b/BRMSGateway/src/test/java/org/onap/policy/brms/api/BrmsPushTest.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP Policy Engine
+ * ================================================================================
+ * Copyright (C) 2018 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.policy.brms.api;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+import static org.mockito.Matchers.any;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.persistence.EntityManager;
+import javax.persistence.EntityManagerFactory;
+import javax.persistence.EntityTransaction;
+import javax.persistence.Persistence;
+import javax.persistence.Query;
+
+import org.apache.maven.model.Dependency;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.onap.policy.api.PolicyException;
+import org.onap.policy.utils.BackUpHandler;
+import org.onap.policy.utils.BackUpMonitor;
+import org.onap.policy.utils.BackUpMonitorException;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class BrmsPushTest {
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    @PrepareForTest({Persistence.class, BackUpMonitor.class})
+    @Test
+    public void testPush() throws BackUpMonitorException, PolicyException {
+        // Mock emf, persistence, and query
+        final EntityManagerFactory emf = Mockito.mock(EntityManagerFactory.class);
+        final EntityManager em = Mockito.mock(EntityManager.class);
+        Mockito.when(emf.createEntityManager()).thenReturn(em);
+        PowerMockito.mockStatic(Persistence.class);
+        PowerMockito.when(Persistence.createEntityManagerFactory(Mockito.any(), Mockito.any())).thenReturn(emf);
+        final EntityTransaction et = Mockito.mock(EntityTransaction.class);
+        Mockito.when(em.getTransaction()).thenReturn(et);
+        final Query query = Mockito.mock(Query.class);
+        Mockito.when(em.createQuery(Mockito.anyString())).thenReturn(query);
+
+        // Mock backup monitor
+        PowerMockito.mockStatic(BackUpMonitor.class);
+        final BackUpMonitor monitor = Mockito.mock(BackUpMonitor.class);
+        PowerMockito.when(BackUpMonitor.getInstance(any(), any(), any(), any())).thenReturn(monitor);
+
+        // Test constructor
+        final String propFile = "config.properties";
+        final BackUpHandler handler = Mockito.mock(BackUpHandler.class);
+        final BrmsPush push = new BrmsPush(propFile, handler);
+        assertNotNull(push);
+
+        final String name = "testName";
+        try {
+            // Test initiate
+            push.initiate(true);
+
+            // Test reset
+            push.resetDs();
+
+            // Test add
+            final String rule = "testRule";
+            final Map<String, String> responseAttributes = new HashMap<String, String>();
+            responseAttributes.put("$controller:", "{\n\"testKey\": \"testVal\"\n}\n");
+            responseAttributes.put("$dependency$", "[a,b]");
+            push.addRule(name, rule, responseAttributes);
+        } catch (final Exception ex) {
+            fail("Not expecting an exception: " + ex);
+        }
+
+        try {
+            // Test remove
+            push.removeRule(name);
+        } catch (final Exception ex) {
+            fail("Not expecting an exception: " + ex);
+
+        }
+
+        // Test misc methods
+        final String controllerName = "testController";
+        final List<Dependency> deps = push.defaultDependencies(controllerName);
+        assertEquals(deps.size(), 7);
+        assertNotNull(BrmsPush.getBackUpMonitor());
+        assertEquals(push.urlListSize(), 1);
+
+        try {
+            push.rotateUrls();
+        } catch (final Exception ex) {
+            fail("Not expecting an exception: " + ex);
+        }
+
+        // Test push
+        thrown.expect(PolicyException.class);
+        push.pushRules();
+    }
+}
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brmsInterface/BRMSHandlerTest.java b/BRMSGateway/src/test/java/org/onap/policy/brmsInterface/BRMSHandlerTest.java
deleted file mode 100644
index 8e15cdf..0000000
--- a/BRMSGateway/src/test/java/org/onap/policy/brmsInterface/BRMSHandlerTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2018 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.policy.brmsInterface;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.EntityTransaction;
-import javax.persistence.Persistence;
-import javax.persistence.Query;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.onap.policy.api.NotificationType;
-import org.onap.policy.std.StdPDPNotification;
-import org.onap.policy.utils.BackUpMonitor;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-@RunWith(PowerMockRunner.class)
-public class BRMSHandlerTest {
-	@PrepareForTest({Persistence.class, BackUpMonitor.class})
-	@Test
-	public void negativeTestNotifications() throws Exception {
-		// Mock emf, persistence, and query
-		EntityManagerFactory emf = Mockito.mock(EntityManagerFactory.class);
-		EntityManager em = Mockito.mock(EntityManager.class);
-		Mockito.when(emf.createEntityManager()).thenReturn(em);
-		PowerMockito.mockStatic(Persistence.class);
-		PowerMockito.when(Persistence.createEntityManagerFactory(any(), any())).thenReturn(emf);
-		EntityTransaction et = Mockito.mock(EntityTransaction.class);
-		Mockito.when(em.getTransaction()).thenReturn(et);		
-		Query query = Mockito.mock(Query.class);
-		Mockito.when(em.createQuery(Mockito.anyString())).thenReturn(query);		
-		
-		// Mock backup monitor
-		PowerMockito.mockStatic(BackUpMonitor.class);
-		BackUpMonitor monitor = Mockito.mock(BackUpMonitor.class);
-		PowerMockito.when(BackUpMonitor.getInstance(any(), any(), any(), any())).thenReturn(monitor);
-
-		// Test constructor
-		StdPDPNotification notification = new StdPDPNotification();
-		String propFile = "config.properties";
-		BRMSHandler handler = new BRMSHandler(propFile);
-		BRMSPush brmsPush = new BRMSPush(propFile, handler);
-		handler.setBRMSPush(brmsPush);
-		assertNotNull(handler);
-		assertNotNull(brmsPush);
-		assertNull(handler.getPolicyEngine());
-
-		try {
-			// Test update
-			notification.setNotificationType(NotificationType.UPDATE);
-			handler.runOnNotification(notification);
-			handler.notificationReceived(notification);
-			
-			// Test remove
-			notification.setNotificationType(NotificationType.REMOVE);
-			handler.runOnNotification(notification);
-			handler.notificationReceived(notification);
-			
-			// Test both
-			notification.setNotificationType(NotificationType.BOTH);
-			handler.runOnNotification(notification);
-			handler.notificationReceived(notification);		
-		}
-		catch (Exception ex) {
-			fail("Not expecting an exception: " + ex);
-		}
-	}
-}
diff --git a/BRMSGateway/src/test/java/org/onap/policy/brmsInterface/BRMSPushTest.java b/BRMSGateway/src/test/java/org/onap/policy/brmsInterface/BRMSPushTest.java
deleted file mode 100644
index 5ca2b30..0000000
--- a/BRMSGateway/src/test/java/org/onap/policy/brmsInterface/BRMSPushTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP Policy Engine
- * ================================================================================
- * Copyright (C) 2018 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.policy.brmsInterface;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.EntityTransaction;
-import javax.persistence.Persistence;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.onap.policy.api.PolicyException;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import org.onap.policy.utils.BackUpHandler;
-import org.onap.policy.utils.BackUpMonitor;
-import org.onap.policy.utils.BackUpMonitorException;
-import org.apache.maven.model.Dependency;
-import javax.persistence.Query;
-
-@RunWith(PowerMockRunner.class)
-public class BRMSPushTest {
-	@Rule
-	public ExpectedException thrown = ExpectedException.none();
-	
-	@PrepareForTest({Persistence.class, BackUpMonitor.class})
-	@Test
-	public void testPush() throws BackUpMonitorException, PolicyException {
-		// Mock emf, persistence, and query
-		EntityManagerFactory emf = Mockito.mock(EntityManagerFactory.class);
-		EntityManager em = Mockito.mock(EntityManager.class);
-		Mockito.when(emf.createEntityManager()).thenReturn(em);
-		PowerMockito.mockStatic(Persistence.class);
-		PowerMockito.when(Persistence.createEntityManagerFactory(Mockito.any(), Mockito.any())).thenReturn(emf);
-		EntityTransaction et = Mockito.mock(EntityTransaction.class);
-		Mockito.when(em.getTransaction()).thenReturn(et);		
-		Query query = Mockito.mock(Query.class);
-		Mockito.when(em.createQuery(Mockito.anyString())).thenReturn(query);		
-
-		// Mock backup monitor
-		PowerMockito.mockStatic(BackUpMonitor.class);
-		BackUpMonitor monitor = Mockito.mock(BackUpMonitor.class);
-		PowerMockito.when(BackUpMonitor.getInstance(any(), any(), any(), any())).thenReturn(monitor);
-
-		// Test constructor
-		String propFile = "config.properties";
-		BackUpHandler handler = Mockito.mock(BackUpHandler.class);
-		BRMSPush push = new BRMSPush(propFile, handler);
-		assertNotNull(push);
-		
-		String name = "testName";
-		try {
-			// Test initiate
-			push.initiate(true);
-			
-			// Test reset
-			push.resetDS();
-		
-			// Test add
-			String rule = "testRule";
-			Map<String, String> responseAttributes = new HashMap<String, String>();
-			responseAttributes.put("$controller:", "{\n\"testKey\": \"testVal\"\n}\n");
-			responseAttributes.put("$dependency$", "[a,b]");
-			push.addRule(name, rule, responseAttributes);
-		}
-		catch (Exception ex) {
-			fail("Not expecting an exception: " + ex);
-		}
-				
-		try {
-			// Test remove
-			push.removeRule(name);
-		}
-		catch (Exception ex) {
-			fail("Not expecting an exception: " + ex);
-
-		}
-		
-		// Test misc methods
-		String controllerName = "testController";
-		List<Dependency> deps = push.defaultDependencies(controllerName);
-		assertEquals(deps.size(), 7);
-		assertNotNull(BRMSPush.getBackUpMonitor());
-		assertEquals(push.urlListSize(), 1);
-
-		try {
-			push.rotateURLs();
-		}
-		catch (Exception ex) {
-			fail("Not expecting an exception: " + ex);
-		}
-
-		// Test push
-		thrown.expect(PolicyException.class);
-		push.pushRules();
-	}
-}
diff --git a/BRMSGateway/src/test/resources/META-INF/persistenceBRMStest.xml b/BRMSGateway/src/test/resources/META-INF/persistenceBRMStest.xml
index f757aca..62ae4d0 100644
--- a/BRMSGateway/src/test/resources/META-INF/persistenceBRMStest.xml
+++ b/BRMSGateway/src/test/resources/META-INF/persistenceBRMStest.xml
@@ -24,8 +24,8 @@
     xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
     <persistence-unit name="BRMSGW" transaction-type="RESOURCE_LOCAL">
         <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
-        <class>org.onap.policy.brmsInterface.jpa.BRMSGroupInfo</class>
-        <class>org.onap.policy.brmsInterface.jpa.BRMSPolicyInfo</class>
+        <class>org.onap.policy.brms.entity.BrmsGroupInfo</class>
+        <class>org.onap.policy.brms.entity.BrmsPolicyInfo</class>
         <property name="javax.persistence.schema-generation.scripts.action"
             value="drop-and-create" />
         <property name="javax.persistence.schema-generation.scripts.create-target"
diff --git a/ONAP-PDP/pom.xml b/ONAP-PDP/pom.xml
index 27c0ec1..50f717c 100644
--- a/ONAP-PDP/pom.xml
+++ b/ONAP-PDP/pom.xml
@@ -71,22 +71,60 @@
 			<groupId>com.att.research.xacml</groupId>
 			<artifactId>xacml-pdp</artifactId>
 			<version>1.0.1</version>
-            <exclusions>
-            <!-- The LDAP PIP uses velocity which pulls this insecure jar in. We
-            are not using that PIP and can safely exclude this jar to resolve CLM issue.
-             -->
-              <exclusion>
-                <groupId>commons-collections</groupId>
-                <artifactId>commons-collections</artifactId>
-              </exclusion>
-            </exclusions>
+			<exclusions>
+				<!-- The LDAP PIP uses velocity which pulls this insecure jar in. We 
+					are not using that PIP and can safely exclude this jar to resolve CLM issue. -->
+				<exclusion>
+					<groupId>commons-collections</groupId>
+					<artifactId>commons-collections</artifactId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 		<dependency>
-      		<groupId>org.onap.policy.drools-pdp</groupId>
-      		<artifactId>policy-endpoints</artifactId>
-      		<version>${project.version}</version>
-      		<scope>test</scope>
-    	</dependency>
+			<groupId>org.onap.policy.drools-pdp</groupId>
+			<artifactId>policy-endpoints</artifactId>
+			<version>${project.version}</version>
+			<scope>test</scope>
+		</dependency>
 	</dependencies>
-
-</project>
+	<build>
+		<plugins>
+			<plugin>
+				<artifactId>maven-checkstyle-plugin</artifactId>
+				<executions>
+					<execution>
+						<id>onap-java-style</id>
+						<goals>
+							<goal>check</goal>
+						</goals>
+						<phase>process-sources</phase>
+						<configuration>
+							<!-- Use Google Java Style Guide: https://github.com/checkstyle/checkstyle/blob/master/src/main/resources/google_checks.xml 
+								with minor changes -->
+							<configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
+							<!-- <sourceDirectory> is needed so that checkstyle ignores the generated 
+								sources directory -->
+							<sourceDirectory>${project.build.sourceDirectory}</sourceDirectory>
+							<includeResources>true</includeResources>
+							<includeTestSourceDirectory>true</includeTestSourceDirectory>
+							<includeTestResources>true</includeTestResources>
+							<excludes>
+							</excludes>
+							<consoleOutput>true</consoleOutput>
+							<failOnViolation>true</failOnViolation>
+							<violationSeverity>warning</violationSeverity>
+						</configuration>
+					</execution>
+				</executions>
+				<dependencies>
+					<dependency>
+						<groupId>org.onap.oparent</groupId>
+						<artifactId>checkstyle</artifactId>
+						<version>0.1.1</version>
+						<scope>compile</scope>
+					</dependency>
+				</dependencies>
+			</plugin>
+		</plugins>
+	</build>
+</project>
\ No newline at end of file
diff --git a/ONAP-PDP/src/main/java/org/onap/policy/xacml/action/FindAction.java b/ONAP-PDP/src/main/java/org/onap/policy/xacml/action/FindAction.java
index 5fde0ad..c256626 100644
--- a/ONAP-PDP/src/main/java/org/onap/policy/xacml/action/FindAction.java
+++ b/ONAP-PDP/src/main/java/org/onap/policy/xacml/action/FindAction.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * ONAP-PDP
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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,8 +17,27 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.xacml.action;
 
+import com.att.research.xacml.api.Advice;
+import com.att.research.xacml.api.Attribute;
+import com.att.research.xacml.api.AttributeAssignment;
+import com.att.research.xacml.api.AttributeValue;
+import com.att.research.xacml.api.Identifier;
+import com.att.research.xacml.api.Obligation;
+import com.att.research.xacml.api.Request;
+import com.att.research.xacml.api.RequestAttributes;
+import com.att.research.xacml.api.Result;
+import com.att.research.xacml.std.IdentifierImpl;
+import com.att.research.xacml.std.StdAdvice;
+import com.att.research.xacml.std.StdAttributeAssignment;
+import com.att.research.xacml.std.StdAttributeValue;
+import com.att.research.xacml.std.StdMutableResponse;
+import com.att.research.xacml.std.StdMutableResult;
+import com.att.research.xacml.std.StdObligation;
+import com.att.research.xacml.util.XACMLProperties;
+
 import java.io.BufferedReader;
 import java.io.InputStreamReader;
 import java.net.URL;
@@ -43,329 +62,313 @@
 import org.onap.policy.common.logging.flexlogger.Logger;
 import org.onap.policy.rest.XACMLRestProperties;
 
-import com.att.research.xacml.api.Advice;
-import com.att.research.xacml.api.Attribute;
-import com.att.research.xacml.api.AttributeAssignment;
-import com.att.research.xacml.api.AttributeValue;
-import com.att.research.xacml.api.Identifier;
-import com.att.research.xacml.api.Obligation;
-import com.att.research.xacml.api.Request;
-import com.att.research.xacml.api.RequestAttributes;
-import com.att.research.xacml.api.Result;
-import com.att.research.xacml.std.IdentifierImpl;
-import com.att.research.xacml.std.StdAdvice;
-import com.att.research.xacml.std.StdAttributeAssignment;
-import com.att.research.xacml.std.StdAttributeValue;
-import com.att.research.xacml.std.StdMutableResponse;
-import com.att.research.xacml.std.StdMutableResult;
-import com.att.research.xacml.std.StdObligation;
-import com.att.research.xacml.util.XACMLProperties;
-
 @SuppressWarnings("deprecation")
 public class FindAction {
-	private Logger LOGGER = FlexLogger.getLogger(this.getClass());
-	private Boolean changeIt = false;
-	private String configURL = null;
-	private StdMutableResponse newResponse = new StdMutableResponse();
-	private StdMutableResult addResult = new StdMutableResult();
+    private Logger logger = FlexLogger.getLogger(this.getClass());
+    private Boolean changeIt = false;
+    private String configUrl = null;
+    private StdMutableResponse newResponse = new StdMutableResponse();
+    private StdMutableResult addResult = new StdMutableResult();
 
-	public StdMutableResponse run(StdMutableResponse stdResponse, Request pepRequest) {
-		int count = 0;
-		boolean config = false;
-		boolean decide = false; 
-		Collection<RequestAttributes> requestAttributes =  pepRequest.getRequestAttributes();
-		for(RequestAttributes requestAttribute : requestAttributes){
-			Collection<Attribute> attributes = requestAttribute.getAttributes();
-			for(Attribute attribute : attributes){
-				if(attribute.getAttributeId().stringValue().equals("urn:oasis:names:tc:xacml:1.0:action:action-id")){
-					for(AttributeValue<?> attributeValue : attribute.getValues()){
-						if(attributeValue.getValue().toString().equalsIgnoreCase("ACCESS")){
-							count++;
-						}
-						if(attributeValue.getValue().toString().equalsIgnoreCase("DECIDE")){
-							decide = true;
-						}
-					}
-				}
-				if(attribute.getAttributeId().stringValue().equals("urn:oasis:names:tc:xacml:1.0:resource:resource-id")){
-					for(AttributeValue<?> attributeValue : attribute.getValues()){
-						if(attributeValue.getValue().toString().equalsIgnoreCase("Config")){
-							count++;
-						}
-					}
-				}
-			}
-		}
-		if(count==2){
-			config = true;
-		}
-		if(!config){
-			search(stdResponse);
-		}
-		addResults(stdResponse, config , decide);
-		LOGGER.info("Original Result is " + stdResponse.toString());
-		LOGGER.info("Generated Result is " + addResult.toString());
-		return newResponse;
-	}
+    /**
+     * Generate {@link StdMutableResponse} based on input request.
+     *
+     * @param stdResponse the response
+     * @param pepRequest the request
+     * @return {@link StdMutableResponse}
+     */
+    public StdMutableResponse run(final StdMutableResponse stdResponse, final Request pepRequest) {
+        int count = 0;
+        boolean config = false;
+        boolean decide = false;
+        final Collection<RequestAttributes> requestAttributes = pepRequest.getRequestAttributes();
+        for (final RequestAttributes requestAttribute : requestAttributes) {
+            final Collection<Attribute> attributes = requestAttribute.getAttributes();
+            for (final Attribute attribute : attributes) {
+                if (attribute.getAttributeId().stringValue().equals("urn:oasis:names:tc:xacml:1.0:action:action-id")) {
+                    for (final AttributeValue<?> attributeValue : attribute.getValues()) {
+                        if (attributeValue.getValue().toString().equalsIgnoreCase("ACCESS")) {
+                            count++;
+                        }
+                        if (attributeValue.getValue().toString().equalsIgnoreCase("DECIDE")) {
+                            decide = true;
+                        }
+                    }
+                }
+                if (attribute.getAttributeId().stringValue()
+                        .equals("urn:oasis:names:tc:xacml:1.0:resource:resource-id")) {
+                    for (final AttributeValue<?> attributeValue : attribute.getValues()) {
+                        if (attributeValue.getValue().toString().equalsIgnoreCase("Config")) {
+                            count++;
+                        }
+                    }
+                }
+            }
+        }
+        if (count == 2) {
+            config = true;
+        }
+        if (!config) {
+            search(stdResponse);
+        }
+        addResults(stdResponse, config, decide);
+        logger.info("Original Result is " + stdResponse.toString());
+        logger.info("Generated Result is " + addResult.toString());
+        return newResponse;
+    }
 
-	private Collection<Obligation> obligations = new ArrayList<>();
-	private Map<String, String> matchValues = new HashMap<>();
-	private Map<String, String> headers = new HashMap<>();
-	private boolean header = false;
+    private Collection<Obligation> obligations = new ArrayList<>();
+    private Map<String, String> matchValues = new HashMap<>();
+    private Map<String, String> headers = new HashMap<>();
+    private boolean header = false;
 
-	private void search(StdMutableResponse stdResponse) {
-		for (Result result : stdResponse.getResults()) {
-			if (!result.getObligations().isEmpty()) {
-				System.out.println("Obligation Received");
-				// Is there any action that PDP needs to take
-				for (Obligation obligation : result.getObligations()) {
-					int count = 0, uri = 0, PEP = 0;
-					header = false;
-					changeIt = false;
-					Collection<AttributeAssignment> afterRemoveAssignments = new ArrayList<>();
-					Identifier oblId = new IdentifierImpl(obligation.getId().stringValue());
-					StdAttributeAssignment attributeURI = null;
-					for (AttributeAssignment attribute : obligation.getAttributeAssignments()) {
-						matchValues.put(attribute.getAttributeId().stringValue(), attribute.getAttributeValue().getValue().toString());
-						if (attribute.getAttributeId().stringValue().equalsIgnoreCase("performer")) {
-							if (attribute.getAttributeValue().getValue().toString().equalsIgnoreCase("PEPACTION")) {
-								PEP++;
-							} else if (attribute.getAttributeValue().getValue().toString().equalsIgnoreCase("PDPACTION")) {
-								count++;
-							}
-						} else if (attribute.getAttributeId().stringValue().equalsIgnoreCase("URL")) {
-							uri++;
-							if (uri == 1) {
-								configURL = attribute.getAttributeValue().getValue().toString();
-								attributeURI = new StdAttributeAssignment(attribute);
-							}
-						} else if (attribute.getAttributeId().stringValue().startsWith("headers")) {
-							LOGGER.info("Headers are : "+ attribute.getAttributeValue().getValue().toString());
-							header = true;
-							headers.put(attribute.getAttributeId().stringValue().replaceFirst("(headers).", ""),
-									attribute.getAttributeValue().getValue().toString());
-							afterRemoveAssignments.add(attribute);
-						} else if (attribute.getAttributeId().stringValue().equalsIgnoreCase("body")) { 
-							String papPath = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL);
-							papPath= papPath.replace("/pap", "");
-							matchValues.put("body",attribute.getAttributeValue().getValue().toString().replace("$URL", papPath));
-						}else {
-							StdAttributeAssignment attributeObligation = new StdAttributeAssignment(attribute);
-							afterRemoveAssignments.add(attributeObligation);
-						}
-					}
-					if (count == 1 && uri == 1 && PEP == 0) {
-						// Remove Obligation and add Advice
-						changeIt = true;
-						takeAction(stdResponse, oblId, afterRemoveAssignments);
-					} else if (PEP == 1 && count == 0) {
-						// Strip the PEPACTION if available
-						if (uri == 1) {
-							afterRemoveAssignments.add(attributeURI);
-						}
-						Obligation afterRemoveObligation = new StdObligation(
-								oblId, afterRemoveAssignments);
-						obligations.add(afterRemoveObligation);
-					} else {
-						obligations.add(obligation);
-					}
-				}
-			}
-		}
-	}
+    private void search(final StdMutableResponse stdResponse) {
+        for (final Result result : stdResponse.getResults()) {
+            if (!result.getObligations().isEmpty()) {
+                System.out.println("Obligation Received");
+                // Is there any action that PDP needs to take
+                for (final Obligation obligation : result.getObligations()) {
+                    int count = 0;
+                    int uri = 0;
+                    int pep = 0;
+                    header = false;
+                    changeIt = false;
+                    final Collection<AttributeAssignment> afterRemoveAssignments = new ArrayList<>();
+                    final Identifier oblId = new IdentifierImpl(obligation.getId().stringValue());
+                    StdAttributeAssignment attributeUri = null;
+                    for (final AttributeAssignment attribute : obligation.getAttributeAssignments()) {
+                        matchValues.put(attribute.getAttributeId().stringValue(),
+                                attribute.getAttributeValue().getValue().toString());
+                        if (attribute.getAttributeId().stringValue().equalsIgnoreCase("performer")) {
+                            if (attribute.getAttributeValue().getValue().toString().equalsIgnoreCase("PEPACTION")) {
+                                pep++;
+                            } else if (attribute.getAttributeValue().getValue().toString()
+                                    .equalsIgnoreCase("PDPACTION")) {
+                                count++;
+                            }
+                        } else if (attribute.getAttributeId().stringValue().equalsIgnoreCase("URL")) {
+                            uri++;
+                            if (uri == 1) {
+                                configUrl = attribute.getAttributeValue().getValue().toString();
+                                attributeUri = new StdAttributeAssignment(attribute);
+                            }
+                        } else if (attribute.getAttributeId().stringValue().startsWith("headers")) {
+                            logger.info("Headers are : " + attribute.getAttributeValue().getValue().toString());
+                            header = true;
+                            headers.put(attribute.getAttributeId().stringValue().replaceFirst("(headers).", ""),
+                                    attribute.getAttributeValue().getValue().toString());
+                            afterRemoveAssignments.add(attribute);
+                        } else if (attribute.getAttributeId().stringValue().equalsIgnoreCase("body")) {
+                            String papPath = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL);
+                            papPath = papPath.replace("/pap", "");
+                            matchValues.put("body",
+                                    attribute.getAttributeValue().getValue().toString().replace("$URL", papPath));
+                        } else {
+                            final StdAttributeAssignment attributeObligation = new StdAttributeAssignment(attribute);
+                            afterRemoveAssignments.add(attributeObligation);
+                        }
+                    }
+                    if (count == 1 && uri == 1 && pep == 0) {
+                        // Remove Obligation and add Advice
+                        changeIt = true;
+                        takeAction(stdResponse, oblId, afterRemoveAssignments);
+                    } else if (pep == 1 && count == 0) {
+                        // Strip the PEPACTION if available
+                        if (uri == 1) {
+                            afterRemoveAssignments.add(attributeUri);
+                        }
+                        final Obligation afterRemoveObligation = new StdObligation(oblId, afterRemoveAssignments);
+                        obligations.add(afterRemoveObligation);
+                    } else {
+                        obligations.add(obligation);
+                    }
+                }
+            }
+        }
+    }
 
-	private void takeAction(StdMutableResponse stdResponse, Identifier advId,
-			Collection<AttributeAssignment> afterRemoveAssignments) {
-		if (changeIt) {
-			LOGGER.info("the URL is :" + configURL);
-			// Calling Rest URL..
-			callRest();
-			// Including the Results in an Advice
-			Identifier id = new IdentifierImpl(
-					"org.onap.policy:pdp:reply");
-			Identifier statId = new IdentifierImpl(
-					"org:onap:onap:policy:pdp:reply:status");
-			Identifier statCategory = new IdentifierImpl(
-					"urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject");
-			Identifier strId = new IdentifierImpl(
-					"http://www.w3.org/2001/XMLSchema#string");
-			Identifier resId = new IdentifierImpl(
-					"org:onap:onap:policy:pdp:reply:resource");
-			Identifier resCategory = new IdentifierImpl(
-					"urn:oasis:names:tc:xacml:3.0:attribute-category:resource");
-			Identifier urlId = new IdentifierImpl(
-					"http://www.w3.org/2001/XMLSchema#anyURI");
-			AttributeValue<String> attributeStatusValue = new StdAttributeValue<>(
-					strId, status + response);
-			AttributeValue<String> attributeResourceValue = new StdAttributeValue<>(
-					urlId, configURL);
-			StdAttributeAssignment attributeStatus = new StdAttributeAssignment(
-					statCategory, statId, "PDP", attributeStatusValue);
-			StdAttributeAssignment attributeResouce = new StdAttributeAssignment(
-					resCategory, resId, "PDP", attributeResourceValue);
-			afterRemoveAssignments.add(attributeStatus);
-			afterRemoveAssignments.add(attributeResouce);
-			Advice advice = new StdAdvice(id, afterRemoveAssignments);
-			addResult.addAdvice(advice);
-		}
-	}
+    private void takeAction(final StdMutableResponse stdResponse, final Identifier advId,
+            final Collection<AttributeAssignment> afterRemoveAssignments) {
+        if (changeIt) {
+            logger.info("the URL is :" + configUrl);
+            // Calling Rest URL..
+            callRest();
+            // Including the Results in an Advice
+            final Identifier id = new IdentifierImpl("org.onap.policy:pdp:reply");
+            final Identifier statId = new IdentifierImpl("org:onap:onap:policy:pdp:reply:status");
+            final Identifier statCategory =
+                    new IdentifierImpl("urn:oasis:names:tc:xacml:1.0:subject-category:recipient-subject");
+            final Identifier strId = new IdentifierImpl("http://www.w3.org/2001/XMLSchema#string");
+            final Identifier resId = new IdentifierImpl("org:onap:onap:policy:pdp:reply:resource");
+            final Identifier resCategory =
+                    new IdentifierImpl("urn:oasis:names:tc:xacml:3.0:attribute-category:resource");
+            final Identifier urlId = new IdentifierImpl("http://www.w3.org/2001/XMLSchema#anyURI");
+            final AttributeValue<String> attributeStatusValue = new StdAttributeValue<>(strId, status + response);
+            final AttributeValue<String> attributeResourceValue = new StdAttributeValue<>(urlId, configUrl);
+            final StdAttributeAssignment attributeStatus =
+                    new StdAttributeAssignment(statCategory, statId, "PDP", attributeStatusValue);
+            final StdAttributeAssignment attributeResouce =
+                    new StdAttributeAssignment(resCategory, resId, "PDP", attributeResourceValue);
+            afterRemoveAssignments.add(attributeStatus);
+            afterRemoveAssignments.add(attributeResouce);
+            final Advice advice = new StdAdvice(id, afterRemoveAssignments);
+            addResult.addAdvice(advice);
+        }
+    }
 
-	private void addResults(StdMutableResponse stdResponse, boolean config, boolean decide) {
-		if(decide){
-			newResponse = stdResponse;
-			return;
-		}
-		for (Result result : stdResponse.getResults()) {
-			if(config){
-				addResult.addAdvice(result.getAssociatedAdvice());
-			}
-			addResult.addAttributeCategories(result.getAttributes());
-			addResult.addPolicyIdentifiers(result.getPolicyIdentifiers());
-			addResult.addPolicySetIdentifiers(result.getPolicySetIdentifiers());
-			addResult.setStatus(result.getStatus());
-			addResult.setDecision(result.getDecision());
-			if(!config){
-				addResult.addObligations(obligations);
-			}
-		}
-		newResponse.add(addResult);
-	}
+    private void addResults(final StdMutableResponse stdResponse, final boolean config, final boolean decide) {
+        if (decide) {
+            newResponse = stdResponse;
+            return;
+        }
+        for (final Result result : stdResponse.getResults()) {
+            if (config) {
+                addResult.addAdvice(result.getAssociatedAdvice());
+            }
+            addResult.addAttributeCategories(result.getAttributes());
+            addResult.addPolicyIdentifiers(result.getPolicyIdentifiers());
+            addResult.addPolicySetIdentifiers(result.getPolicySetIdentifiers());
+            addResult.setStatus(result.getStatus());
+            addResult.setDecision(result.getDecision());
+            if (!config) {
+                addResult.addObligations(obligations);
+            }
+        }
+        newResponse.add(addResult);
+    }
 
-	private int status;
-	private String response;
-	private DefaultHttpClient httpClient;
+    private int status;
+    private String response;
+    private DefaultHttpClient httpClient;
 
-	private void callRest() {
-		// Finding the Macros in the URL..
-		Pattern pattern = Pattern.compile("\\$([a-zA-Z0-9.:]*)");
-		Matcher match = pattern.matcher(configURL);
-		StringBuffer sb = new StringBuffer();
-		JsonReader jsonReader = null;
-		while (match.find()) {
-			LOGGER.info("Found Macro : " + match.group(1));
-			String replaceValue = matchValues.get(match.group(1));
-			LOGGER.info("Replacing with :" + replaceValue);
-			match.appendReplacement(sb, replaceValue);
-		}
-		match.appendTail(sb);
-		LOGGER.info("URL is : " + sb.toString());
-		configURL = sb.toString();
-		// Calling the Requested service. 
-		if (matchValues.get("method").equalsIgnoreCase("GET")) {
-			httpClient = new DefaultHttpClient();
-			try {
-				HttpGet getRequest = new HttpGet(configURL);
-				// Adding Headers here
-				if (header) {
-					for (String key : headers.keySet()) {
-						getRequest.addHeader(key, headers.get(key));
-					}
-				}
-				HttpResponse result = httpClient.execute(getRequest);
-				status = result.getStatusLine().getStatusCode();
-				BufferedReader br = new BufferedReader(new InputStreamReader(
-						(result.getEntity().getContent())));
-				String output = " ";
-				String out;
-				while ((out = br.readLine()) != null) {
-					output = output + out;
-				}
-				response = output;
-			} catch (Exception e) {
-				LOGGER.error(e.getMessage()+e);
-				response = e.getMessage();
-			} finally {
-				httpClient.getConnectionManager().shutdown();
-			}
-		} else if(matchValues.get("method").equalsIgnoreCase("POST")) {
-			httpClient = new DefaultHttpClient();
-			try {
-				HttpPost postRequest = new HttpPost(configURL);
-				// Adding Headers here
-				if (header) {
-					for (String key : headers.keySet()) {
-						postRequest.addHeader(key, headers.get(key));
-					}
-				}
-				// Adding the Body. 
-				URL configURL = new URL(matchValues.get("body"));
-				URLConnection connection = null;
-				connection = configURL.openConnection();
-				// InputStream in = connection.getInputStrem();
-				// LOGGER.info("The Body Content is : " + IOUtils.toString(in));
-				jsonReader = Json.createReader(connection.getInputStream());
-				StringEntity input = new StringEntity(jsonReader.readObject().toString());
-				input.setContentType("application/json");
-				postRequest.setEntity(input);
-				// Executing the Request. 
-				HttpResponse result = httpClient.execute(postRequest);
-				LOGGER.info("Result Headers are : " + result.getAllHeaders());
-				status = result.getStatusLine().getStatusCode();
-				BufferedReader br = new BufferedReader(new InputStreamReader(
-						(result.getEntity().getContent())));
-				String output = " ";
-				String out;
-				while ((out = br.readLine()) != null) {
-					output = output + out;
-				}
-				response = output;
-			}catch (Exception e) {
-				LOGGER.error(e.getMessage() +e);
-				response = e.getMessage();
-			} finally {
-			        if(jsonReader != null) {
-			            try {
-			                jsonReader.close();
-			            } catch (Exception e) {
-			                LOGGER.error("Exception Occured while closing the JsonReader"+e);
-			            }
-			        }
-				httpClient.getConnectionManager().shutdown();
-			}
-		} else if(matchValues.get("method").equalsIgnoreCase("PUT")) {
-			httpClient = new DefaultHttpClient();
-			try {
-				HttpPut putRequest = new HttpPut(configURL);
-				// Adding Headers here
-				if (header) {
-					for (String key : headers.keySet()) {
-						putRequest.addHeader(key, headers.get(key));
-					}
-				}
-				// Adding the Body. 
-				URL configURL = new URL(matchValues.get("body"));
-				URLConnection connection = null;
-				connection = configURL.openConnection();
-				//InputStream in = connection.getInputStream();
-				//LOGGER.info("The Body Content is : " + IOUtils.toString(in));
-				jsonReader = Json.createReader(connection.getInputStream());
-				StringEntity input = new StringEntity(jsonReader.readObject().toString());
-				input.setContentType("application/json");
-				putRequest.setEntity(input);
-				// Executing the Request. 
-				HttpResponse result = httpClient.execute(putRequest);
-				status = result.getStatusLine().getStatusCode();
-				BufferedReader br = new BufferedReader(new InputStreamReader(
-						(result.getEntity().getContent())));
-				String output = " ";
-				String out;
-				while ((out = br.readLine()) != null) {
-					output = output + out;
-				}
-				response = output;
-			} catch (Exception e) {
-				LOGGER.error(e.getMessage() +e);
-				response = e.getMessage();
-			}finally {
-			        if(jsonReader != null) {
-			            try {
-			                jsonReader.close();
-			            } catch (Exception e) {
-			                LOGGER.error("Exception Occured while closing the JsonReader"+e);
-			            }
-			        }
-				httpClient.getConnectionManager().shutdown();
-			}
-		}
-	}
-}
\ No newline at end of file
+    private void callRest() {
+        // Finding the Macros in the URL..
+        final Pattern pattern = Pattern.compile("\\$([a-zA-Z0-9.:]*)");
+        final Matcher match = pattern.matcher(configUrl);
+        final StringBuffer sb = new StringBuffer();
+        JsonReader jsonReader = null;
+        while (match.find()) {
+            logger.info("Found Macro : " + match.group(1));
+            final String replaceValue = matchValues.get(match.group(1));
+            logger.info("Replacing with :" + replaceValue);
+            match.appendReplacement(sb, replaceValue);
+        }
+        match.appendTail(sb);
+        logger.info("URL is : " + sb.toString());
+        configUrl = sb.toString();
+        // Calling the Requested service.
+        if (matchValues.get("method").equalsIgnoreCase("GET")) {
+            httpClient = new DefaultHttpClient();
+            try {
+                final HttpGet getRequest = new HttpGet(configUrl);
+                // Adding Headers here
+                if (header) {
+                    for (final String key : headers.keySet()) {
+                        getRequest.addHeader(key, headers.get(key));
+                    }
+                }
+                final HttpResponse result = httpClient.execute(getRequest);
+                status = result.getStatusLine().getStatusCode();
+                final BufferedReader br = new BufferedReader(new InputStreamReader((result.getEntity().getContent())));
+                String output = " ";
+                String out;
+                while ((out = br.readLine()) != null) {
+                    output = output + out;
+                }
+                response = output;
+            } catch (final Exception e) {
+                logger.error(e.getMessage() + e);
+                response = e.getMessage();
+            } finally {
+                httpClient.getConnectionManager().shutdown();
+            }
+        } else if (matchValues.get("method").equalsIgnoreCase("POST")) {
+            httpClient = new DefaultHttpClient();
+            try {
+                final HttpPost postRequest = new HttpPost(configUrl);
+                // Adding Headers here
+                if (header) {
+                    for (final String key : headers.keySet()) {
+                        postRequest.addHeader(key, headers.get(key));
+                    }
+                }
+                // Adding the Body.
+                final URL configUrl = new URL(matchValues.get("body"));
+                URLConnection connection = null;
+                connection = configUrl.openConnection();
+                // InputStream in = connection.getInputStrem();
+                // LOGGER.info("The Body Content is : " + IOUtils.toString(in));
+                jsonReader = Json.createReader(connection.getInputStream());
+                final StringEntity input = new StringEntity(jsonReader.readObject().toString());
+                input.setContentType("application/json");
+                postRequest.setEntity(input);
+                // Executing the Request.
+                final HttpResponse result = httpClient.execute(postRequest);
+                logger.info("Result Headers are : " + result.getAllHeaders());
+                status = result.getStatusLine().getStatusCode();
+                final BufferedReader br = new BufferedReader(new InputStreamReader((result.getEntity().getContent())));
+                String output = " ";
+                String out;
+                while ((out = br.readLine()) != null) {
+                    output = output + out;
+                }
+                response = output;
+            } catch (final Exception e) {
+                logger.error(e.getMessage() + e);
+                response = e.getMessage();
+            } finally {
+                if (jsonReader != null) {
+                    try {
+                        jsonReader.close();
+                    } catch (final Exception e) {
+                        logger.error("Exception Occured while closing the JsonReader" + e);
+                    }
+                }
+                httpClient.getConnectionManager().shutdown();
+            }
+        } else if (matchValues.get("method").equalsIgnoreCase("PUT")) {
+            httpClient = new DefaultHttpClient();
+            try {
+                final HttpPut putRequest = new HttpPut(configUrl);
+                // Adding Headers here
+                if (header) {
+                    for (final String key : headers.keySet()) {
+                        putRequest.addHeader(key, headers.get(key));
+                    }
+                }
+                // Adding the Body.
+                final URL configUrl = new URL(matchValues.get("body"));
+                URLConnection connection = null;
+                connection = configUrl.openConnection();
+                // InputStream in = connection.getInputStream();
+                // LOGGER.info("The Body Content is : " + IOUtils.toString(in));
+                jsonReader = Json.createReader(connection.getInputStream());
+                final StringEntity input = new StringEntity(jsonReader.readObject().toString());
+                input.setContentType("application/json");
+                putRequest.setEntity(input);
+                // Executing the Request.
+                final HttpResponse result = httpClient.execute(putRequest);
+                status = result.getStatusLine().getStatusCode();
+                final BufferedReader br = new BufferedReader(new InputStreamReader((result.getEntity().getContent())));
+                String output = " ";
+                String out;
+                while ((out = br.readLine()) != null) {
+                    output = output + out;
+                }
+                response = output;
+            } catch (final Exception e) {
+                logger.error(e.getMessage() + e);
+                response = e.getMessage();
+            } finally {
+                if (jsonReader != null) {
+                    try {
+                        jsonReader.close();
+                    } catch (final Exception e) {
+                        logger.error("Exception Occured while closing the JsonReader" + e);
+                    }
+                }
+                httpClient.getConnectionManager().shutdown();
+            }
+        }
+    }
+}
diff --git a/ONAP-PDP/src/main/java/org/onap/policy/xacml/action/package-info.java b/ONAP-PDP/src/main/java/org/onap/policy/xacml/action/package-info.java
index 82c6182..b4fd050 100644
--- a/ONAP-PDP/src/main/java/org/onap/policy/xacml/action/package-info.java
+++ b/ONAP-PDP/src/main/java/org/onap/policy/xacml/action/package-info.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * ONAP-PDP
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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,10 +21,9 @@
 package org.onap.policy.xacml.action;
 
 /**
- * org.onap.policy.xacml.action contains the implementation of the PDP Actions.
- * Changes: 
- * 	Now PDP supports actions based on PUT, GET, POST methods 
- * 
- * @version 0.2 
- * 
+ * org.onap.policy.xacml.action contains the implementation of the PDP Actions. Changes: Now PDP supports actions based
+ * on PUT, GET, POST methods
+ *
+ * @version 0.2
+ *
  */
diff --git a/ONAP-PDP/src/main/java/org/onap/policy/xacml/custom/OnapFunctionDefinitionFactory.java b/ONAP-PDP/src/main/java/org/onap/policy/xacml/custom/OnapFunctionDefinitionFactory.java
index ea4e90e..35080d3 100644
--- a/ONAP-PDP/src/main/java/org/onap/policy/xacml/custom/OnapFunctionDefinitionFactory.java
+++ b/ONAP-PDP/src/main/java/org/onap/policy/xacml/custom/OnapFunctionDefinitionFactory.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * ONAP-PDP
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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,8 +17,16 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.xacml.custom;
 
+import com.att.research.xacml.api.Identifier;
+import com.att.research.xacml.std.IdentifierImpl;
+import com.att.research.xacml.std.datatypes.DataTypes;
+import com.att.research.xacmlatt.pdp.policy.FunctionDefinition;
+import com.att.research.xacmlatt.pdp.policy.FunctionDefinitionFactory;
+import com.att.research.xacmlatt.pdp.std.StdFunctions;
+
 import java.lang.reflect.Field;
 import java.lang.reflect.Modifier;
 import java.util.HashMap;
@@ -28,60 +36,53 @@
 import org.onap.policy.common.logging.flexlogger.Logger;
 import org.onap.policy.xacml.pdp.std.functions.FunctionDefinitionCustomRegexpMatch;
 
-import com.att.research.xacml.api.Identifier;
-import com.att.research.xacml.std.IdentifierImpl;
-import com.att.research.xacml.std.datatypes.DataTypes;
-import com.att.research.xacmlatt.pdp.policy.FunctionDefinition;
-import com.att.research.xacmlatt.pdp.policy.FunctionDefinitionFactory;
-import com.att.research.xacmlatt.pdp.std.StdFunctions;
-
 public class OnapFunctionDefinitionFactory extends FunctionDefinitionFactory {
-	private static Logger logger = FlexLogger.getLogger(OnapFunctionDefinitionFactory.class);
-	private static Map<Identifier,FunctionDefinition> 	mapFunctionDefinitions	= new HashMap<>();
-	private static boolean								needMapInit				= true;
+    private static Logger logger = FlexLogger.getLogger(OnapFunctionDefinitionFactory.class);
+    private static Map<Identifier, FunctionDefinition> mapFunctionDefinitions = new HashMap<>();
+    private static boolean needMapInit = true;
 
-	public static final Identifier ID_FUNCTION_CUSTOM_REGEXP_MATCH						= new IdentifierImpl("org.onap.function.regex-match");
-	
-	private static final FunctionDefinition FD_CUSTOM_REGEXP_MATCH = new FunctionDefinitionCustomRegexpMatch<>(ID_FUNCTION_CUSTOM_REGEXP_MATCH, DataTypes.DT_STRING);
+    public static final Identifier ID_FUNCTION_CUSTOM_REGEXP_MATCH =
+            new IdentifierImpl("org.onap.function.regex-match");
 
-	private static void register(FunctionDefinition functionDefinition) {
-		mapFunctionDefinitions.put(functionDefinition.getId(), functionDefinition);
-	}
-		
-	private static void initMap() {
+    private static final FunctionDefinition FD_CUSTOM_REGEXP_MATCH =
+            new FunctionDefinitionCustomRegexpMatch<>(ID_FUNCTION_CUSTOM_REGEXP_MATCH, DataTypes.DT_STRING);
 
-			synchronized(mapFunctionDefinitions) {
-				if (needMapInit) {
-					needMapInit	= false;
-					Field[] declaredFields	= StdFunctions.class.getDeclaredFields();
-					for (Field field : declaredFields) {
-						if (Modifier.isStatic(field.getModifiers()) && 
-							field.getName().startsWith(StdFunctions.FD_PREFIX) &&
-							FunctionDefinition.class.isAssignableFrom(field.getType()) &&
-							Modifier.isPublic(field.getModifiers())
-						) {
-							try {
-								register((FunctionDefinition)(field.get(null)));
-							} catch (IllegalAccessException ex) {
-								logger.error(ex.getMessage() +ex);
-							}
-						}
-					}
-					//
-					// Our custom function
-					//
-					//register(FunctionDefinitionCustomRegexpMatch);
-					register(FD_CUSTOM_REGEXP_MATCH);
-				}
-			}
-	}
-	
-	public OnapFunctionDefinitionFactory() {
-		initMap();
-	}
+    private static void register(final FunctionDefinition functionDefinition) {
+        mapFunctionDefinitions.put(functionDefinition.getId(), functionDefinition);
+    }
 
-	@Override
-	public FunctionDefinition getFunctionDefinition(Identifier functionId) {
-		return mapFunctionDefinitions.get(functionId);
-	}
+    private static void initMap() {
+
+        synchronized (mapFunctionDefinitions) {
+            if (needMapInit) {
+                needMapInit = false;
+                final Field[] declaredFields = StdFunctions.class.getDeclaredFields();
+                for (final Field field : declaredFields) {
+                    if (Modifier.isStatic(field.getModifiers()) && field.getName().startsWith(StdFunctions.FD_PREFIX)
+                            && FunctionDefinition.class.isAssignableFrom(field.getType())
+                            && Modifier.isPublic(field.getModifiers())) {
+                        try {
+                            register((FunctionDefinition) (field.get(null)));
+                        } catch (final IllegalAccessException ex) {
+                            logger.error(ex.getMessage() + ex);
+                        }
+                    }
+                }
+                //
+                // Our custom function
+                //
+                // register(FunctionDefinitionCustomRegexpMatch);
+                register(FD_CUSTOM_REGEXP_MATCH);
+            }
+        }
+    }
+
+    public OnapFunctionDefinitionFactory() {
+        initMap();
+    }
+
+    @Override
+    public FunctionDefinition getFunctionDefinition(final Identifier functionId) {
+        return mapFunctionDefinitions.get(functionId);
+    }
 }
diff --git a/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/ONAPPDPEngine.java b/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/ONAPPDPEngine.java
deleted file mode 100644
index fb90d0a..0000000
--- a/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/ONAPPDPEngine.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP-PDP
- * ================================================================================
- * 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=========================================================
- */
-package org.onap.policy.xacml.pdp;
-
-import java.util.Properties;
-
-import org.onap.policy.xacml.action.FindAction;
-
-import com.att.research.xacml.api.Decision;
-import com.att.research.xacml.api.Request;
-import com.att.research.xacml.api.Response;
-import com.att.research.xacml.api.pdp.PDPException;
-import com.att.research.xacml.api.pdp.ScopeResolver;
-import com.att.research.xacml.std.StdMutableResponse;
-import com.att.research.xacmlatt.pdp.ATTPDPEngine;
-import com.att.research.xacmlatt.pdp.eval.EvaluationContextFactory;
-
-public class ONAPPDPEngine extends ATTPDPEngine {
-
-	public ONAPPDPEngine(EvaluationContextFactory evaluationContextFactoryIn, Decision defaultDecisionIn,
-			ScopeResolver scopeResolverIn, Properties properties) {
-		super(evaluationContextFactoryIn, defaultDecisionIn, scopeResolverIn, properties);
-	}
-
-	public ONAPPDPEngine(EvaluationContextFactory evaluationContextFactoryIn, Decision defaultDecisionIn,
-			ScopeResolver scopeResolverIn) {
-		super(evaluationContextFactoryIn, defaultDecisionIn, scopeResolverIn);
-	}
-
-	public ONAPPDPEngine(EvaluationContextFactory evaluationContextFactoryIn, ScopeResolver scopeResolverIn) {
-		super(evaluationContextFactoryIn, scopeResolverIn);
-	}
-
-	@Override
-	public Response decide(Request pepRequest) throws PDPException {
-		Response response = super.decide(pepRequest);
-		
-		FindAction findAction = new FindAction();
-		return findAction.run((StdMutableResponse) response, pepRequest);
-	}
-
-
-}
diff --git a/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/ONAPPDPEngineFactory.java b/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/ONAPPDPEngineFactory.java
deleted file mode 100644
index 2e796bf..0000000
--- a/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/ONAPPDPEngineFactory.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP-PDP
- * ================================================================================
- * 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=========================================================
- */
-package org.onap.policy.xacml.pdp;
-
-import java.util.Properties;
-
-import org.onap.policy.common.logging.flexlogger.FlexLogger; 
-import org.onap.policy.common.logging.flexlogger.Logger;
-import com.att.research.xacml.api.pdp.PDPEngine;
-import com.att.research.xacml.api.pdp.PDPEngineFactory;
-import com.att.research.xacml.util.FactoryException;
-import com.att.research.xacmlatt.pdp.eval.EvaluationContextFactory;
-
-public class ONAPPDPEngineFactory extends PDPEngineFactory {
-	private Logger logger	= FlexLogger.getLogger(this.getClass());
-
-	@Override
-	public PDPEngine newEngine() throws FactoryException {
-		EvaluationContextFactory evaluationContextFactory	= EvaluationContextFactory.newInstance();
-		if (evaluationContextFactory == null) {
-			this.logger.error("Null EvaluationContextFactory");
-			throw new FactoryException("Null EvaluationContextFactory");
-		}
-		return new ONAPPDPEngine(evaluationContextFactory, this.getDefaultBehavior(), this.getScopeResolver());
-	}
-
-	@Override
-	public PDPEngine newEngine(Properties properties) throws FactoryException {
-		EvaluationContextFactory evaluationContextFactory	= EvaluationContextFactory.newInstance(properties);
-		if (evaluationContextFactory == null) {
-			this.logger.error("Null EvaluationContextFactory");
-			throw new FactoryException("Null EvaluationContextFactory");
-		}
-		return new ONAPPDPEngine(evaluationContextFactory, this.getDefaultBehavior(), this.getScopeResolver(), properties);
-	}
-
-}
diff --git a/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/OnapPdpEngine.java b/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/OnapPdpEngine.java
new file mode 100644
index 0000000..42ab7e4
--- /dev/null
+++ b/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/OnapPdpEngine.java
@@ -0,0 +1,62 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-PDP
+ * ================================================================================
+ * Copyright (C) 2017-2018 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.policy.xacml.pdp;
+
+import com.att.research.xacml.api.Decision;
+import com.att.research.xacml.api.Request;
+import com.att.research.xacml.api.Response;
+import com.att.research.xacml.api.pdp.PDPException;
+import com.att.research.xacml.api.pdp.ScopeResolver;
+import com.att.research.xacml.std.StdMutableResponse;
+import com.att.research.xacmlatt.pdp.ATTPDPEngine;
+import com.att.research.xacmlatt.pdp.eval.EvaluationContextFactory;
+
+import java.util.Properties;
+
+import org.onap.policy.xacml.action.FindAction;
+
+public class OnapPdpEngine extends ATTPDPEngine {
+
+    public OnapPdpEngine(final EvaluationContextFactory evaluationContextFactoryIn, final Decision defaultDecisionIn,
+            final ScopeResolver scopeResolverIn, final Properties properties) {
+        super(evaluationContextFactoryIn, defaultDecisionIn, scopeResolverIn, properties);
+    }
+
+    public OnapPdpEngine(final EvaluationContextFactory evaluationContextFactoryIn, final Decision defaultDecisionIn,
+            final ScopeResolver scopeResolverIn) {
+        super(evaluationContextFactoryIn, defaultDecisionIn, scopeResolverIn);
+    }
+
+    public OnapPdpEngine(final EvaluationContextFactory evaluationContextFactoryIn,
+            final ScopeResolver scopeResolverIn) {
+        super(evaluationContextFactoryIn, scopeResolverIn);
+    }
+
+    @Override
+    public Response decide(final Request pepRequest) throws PDPException {
+        final Response response = super.decide(pepRequest);
+
+        final FindAction findAction = new FindAction();
+        return findAction.run((StdMutableResponse) response, pepRequest);
+    }
+
+
+}
diff --git a/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/OnapPdpEngineFactory.java b/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/OnapPdpEngineFactory.java
new file mode 100644
index 0000000..c19c401
--- /dev/null
+++ b/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/OnapPdpEngineFactory.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-PDP
+ * ================================================================================
+ * Copyright (C) 2017-2018 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.policy.xacml.pdp;
+
+import com.att.research.xacml.api.pdp.PDPEngine;
+import com.att.research.xacml.api.pdp.PDPEngineFactory;
+import com.att.research.xacml.util.FactoryException;
+import com.att.research.xacmlatt.pdp.eval.EvaluationContextFactory;
+
+import java.util.Properties;
+
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
+
+public class OnapPdpEngineFactory extends PDPEngineFactory {
+    private Logger logger = FlexLogger.getLogger(this.getClass());
+
+    @Override
+    public PDPEngine newEngine() throws FactoryException {
+        final EvaluationContextFactory evaluationContextFactory = EvaluationContextFactory.newInstance();
+        if (evaluationContextFactory == null) {
+            this.logger.error("Null EvaluationContextFactory");
+            throw new FactoryException("Null EvaluationContextFactory");
+        }
+        return new OnapPdpEngine(evaluationContextFactory, this.getDefaultBehavior(), this.getScopeResolver());
+    }
+
+    @Override
+    public PDPEngine newEngine(final Properties properties) throws FactoryException {
+        final EvaluationContextFactory evaluationContextFactory = EvaluationContextFactory.newInstance(properties);
+        if (evaluationContextFactory == null) {
+            this.logger.error("Null EvaluationContextFactory");
+            throw new FactoryException("Null EvaluationContextFactory");
+        }
+        return new OnapPdpEngine(evaluationContextFactory, this.getDefaultBehavior(), this.getScopeResolver(),
+                properties);
+    }
+
+}
diff --git a/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/std/functions/FunctionDefinitionCustomRegexpMatch.java b/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/std/functions/FunctionDefinitionCustomRegexpMatch.java
index 590d519..a8b0e9d 100644
--- a/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/std/functions/FunctionDefinitionCustomRegexpMatch.java
+++ b/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/std/functions/FunctionDefinitionCustomRegexpMatch.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * ONAP-PDP
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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,14 +17,9 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.xacml.pdp.std.functions;
 
-
-import java.util.List;
-
-import org.onap.policy.common.logging.flexlogger.FlexLogger;
-import org.onap.policy.common.logging.flexlogger.Logger;
-
 import com.att.research.xacml.api.DataType;
 import com.att.research.xacml.api.DataTypeException;
 import com.att.research.xacml.api.Identifier;
@@ -37,94 +32,104 @@
 import com.att.research.xacmlatt.pdp.std.functions.ConvertedArgument;
 import com.att.research.xacmlatt.pdp.std.functions.FunctionDefinitionBase;
 
+import java.util.List;
+
+import org.onap.policy.common.logging.flexlogger.FlexLogger;
+import org.onap.policy.common.logging.flexlogger.Logger;
+
 /**
  * FunctionDefinitionCustomRegexMatch implements {@link com.att.research.xacmlatt.pdp.policy.FunctionDefinition} to
- * implement the custom 'type'-regex-match predicates as functions taking two arguments, the first of <code>String</code>,
- * and the second of the type for that specific predicate as a regular expression,
- * and returning a <code>Boolean</code> for whether the regular expression matches the string representation of the first argument.
- * 
- * 
+ * implement the custom 'type'-regex-match predicates as functions taking two arguments, the first of
+ * <code>String</code>, and the second of the type for that specific predicate as a regular expression, and returning a
+ * <code>Boolean</code> for whether the regular expression matches the string representation of the first argument.
+ *
+ *
  * @version $Revision: 0.2 $
- * 
+ *
  * @param <I> the java class for the data type of the function Input arguments
  */
 public class FunctionDefinitionCustomRegexpMatch<I> extends FunctionDefinitionBase<Boolean, I> {
-	private static Logger logger = FlexLogger.getLogger(FunctionDefinitionCustomRegexpMatch.class);
-	
-	/**
-	 * Constructor - need dataTypeArgs input because of java Generic type-erasure during compilation.
-	 * 
-	 * @param idIn
-	 * @param dataTypeArgsIn
-	 */
-	public FunctionDefinitionCustomRegexpMatch(Identifier idIn, DataType<I> dataTypeArgsIn) {
-		super(idIn, DataTypes.DT_BOOLEAN, dataTypeArgsIn, false);
-	}
+    private static Logger logger = FlexLogger.getLogger(FunctionDefinitionCustomRegexpMatch.class);
+
+    /**
+     * Constructor - need dataTypeArgs input because of java Generic type-erasure during compilation.
+     *
+     * @param idIn the identifier
+     * @param dataTypeArgsIn the data type
+     */
+    public FunctionDefinitionCustomRegexpMatch(final Identifier idIn, final DataType<I> dataTypeArgsIn) {
+        super(idIn, DataTypes.DT_BOOLEAN, dataTypeArgsIn, false);
+    }
 
 
-	@Override
-	public ExpressionResult evaluate(EvaluationContext evaluationContext, List<FunctionArgument> arguments) {
+    @Override
+    public ExpressionResult evaluate(final EvaluationContext evaluationContext,
+            final List<FunctionArgument> arguments) {
 
-		if (arguments == null || arguments.size() != 2) {
-			return ExpressionResult.newError(new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, this.getShortFunctionId() + " Expected 2 arguments, got " + 
-					((arguments == null) ? "null" : arguments.size()) ));
-		}
-		
-		// get the regular expression
-		FunctionArgument regexpArgument = arguments.get(0);
+        if (arguments == null || arguments.size() != 2) {
+            return ExpressionResult
+                    .newError(new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, this.getShortFunctionId()
+                            + " Expected 2 arguments, got " + ((arguments == null) ? "null" : arguments.size())));
+        }
 
-		ConvertedArgument<String> convertedArgument = new ConvertedArgument<>(regexpArgument, DataTypes.DT_STRING, false);
-		if ( ! convertedArgument.isOk()) {
-			return ExpressionResult.newError(getFunctionStatus(convertedArgument.getStatus()));
-		}
-		
-		// String regexpValue = (String)regexpArgument.getValue().getValue();
-		String regexpValue	= convertedArgument.getValue();
+        // get the regular expression
+        final FunctionArgument regexpArgument = arguments.get(0);
 
-		
-		// now get the element to match
-		FunctionArgument elementArgument = arguments.get(1);
-		
-		ConvertedArgument<I> convertedElement = new ConvertedArgument<>(elementArgument, this.getDataTypeArgs(), false);
-		if ( ! convertedElement.isOk()) {
-			return ExpressionResult.newError(getFunctionStatus(convertedElement.getStatus()));
-		}
-		
-		I elementValueObject = convertedElement.getValue();
+        final ConvertedArgument<String> convertedArgument =
+                new ConvertedArgument<>(regexpArgument, DataTypes.DT_STRING, false);
+        if (!convertedArgument.isOk()) {
+            return ExpressionResult.newError(getFunctionStatus(convertedArgument.getStatus()));
+        }
 
-		String elementValueString;
-		try {
-			elementValueString = this.getDataTypeArgs().toStringValue(elementValueObject);
-		} catch (DataTypeException e) {
-			logger.error(e.getMessage() +e);
-			String message = e.getMessage();
-			if (e.getCause() != null) {
-				message = e.getCause().getMessage();
-			}
-			return ExpressionResult.newError(new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR, this.getShortFunctionId() + " " + message));
-		}
-		
-		// ConvertedArgument checks for null value, so do not need to do again here
-		
-		// Adding this code will Change the Functionality which allows to retrieve Multiple-policy using single request.
-		elementValueString = elementValueString + regexpValue ;
-		regexpValue = elementValueString.substring(0,(elementValueString.length()- regexpValue.length()));
-		elementValueString = elementValueString.substring(regexpValue.length(),(elementValueString.length()));
-		// 
-		// Supporting multiple values in the element and be able to query them. 
-		if(elementValueString.contains(",")){
-			String[] elements = elementValueString.split(",");
-			for(int i=0; i<elements.length; i++){
-				if(elements[i].trim().matches(regexpValue)) {
-					return ER_TRUE;
-				}
-			}
-		}
-		if (elementValueString.matches(regexpValue)) {
-			return ER_TRUE;
-		} else {
-			return ER_FALSE;
-		}
+        // String regexpValue = (String)regexpArgument.getValue().getValue();
+        String regexpValue = convertedArgument.getValue();
 
-	}
+
+        // now get the element to match
+        final FunctionArgument elementArgument = arguments.get(1);
+
+        final ConvertedArgument<I> convertedElement =
+                new ConvertedArgument<>(elementArgument, this.getDataTypeArgs(), false);
+        if (!convertedElement.isOk()) {
+            return ExpressionResult.newError(getFunctionStatus(convertedElement.getStatus()));
+        }
+
+        final I elementValueObject = convertedElement.getValue();
+
+        String elementValueString;
+        try {
+            elementValueString = this.getDataTypeArgs().toStringValue(elementValueObject);
+        } catch (final DataTypeException e) {
+            logger.error(e.getMessage() + e);
+            String message = e.getMessage();
+            if (e.getCause() != null) {
+                message = e.getCause().getMessage();
+            }
+            return ExpressionResult.newError(new StdStatus(StdStatusCode.STATUS_CODE_PROCESSING_ERROR,
+                    this.getShortFunctionId() + " " + message));
+        }
+
+        // ConvertedArgument checks for null value, so do not need to do again here
+
+        // Adding this code will Change the Functionality which allows to retrieve Multiple-policy using single request.
+        elementValueString = elementValueString + regexpValue;
+        regexpValue = elementValueString.substring(0, (elementValueString.length() - regexpValue.length()));
+        elementValueString = elementValueString.substring(regexpValue.length(), (elementValueString.length()));
+        //
+        // Supporting multiple values in the element and be able to query them.
+        if (elementValueString.contains(",")) {
+            final String[] elements = elementValueString.split(",");
+            for (int i = 0; i < elements.length; i++) {
+                if (elements[i].trim().matches(regexpValue)) {
+                    return ER_TRUE;
+                }
+            }
+        }
+        if (elementValueString.matches(regexpValue)) {
+            return ER_TRUE;
+        } else {
+            return ER_FALSE;
+        }
+
+    }
 }
diff --git a/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/std/functions/PolicyList.java b/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/std/functions/PolicyList.java
index 794276f..13b517d 100644
--- a/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/std/functions/PolicyList.java
+++ b/ONAP-PDP/src/main/java/org/onap/policy/xacml/pdp/std/functions/PolicyList.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * ONAP-PDP
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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,33 +17,43 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.xacml.pdp.std.functions;
 
 import java.util.ArrayList;
 import java.util.List;
+
 /**
  * Creates a list of policy ids.
- * 
+ *
  * @version $Revision: 1.3 $
  */
 public class PolicyList {
-	
-	private static List<String> policyList = new ArrayList<>();
-	
-	
-	public static List<String> getpolicyList(){
-		return policyList;
-	}
 
-	public static void addPolicyID(String policyID){
-		if (!policyList.contains(policyID)){
-			policyList.add(policyID);
-		}
-	}
-	
-	public static void clearPolicyList(){
-		if (!policyList.isEmpty()){
-			policyList.clear();
-		}
-	}
+    private static List<String> policyList = new ArrayList<>();
+
+
+    public static List<String> getpolicyList() {
+        return policyList;
+    }
+
+    /**
+     * Add policy id in the policy list.
+     *
+     * @param policyId the policy id
+     */
+    public static void addPolicyId(final String policyId) {
+        if (!policyList.contains(policyId)) {
+            policyList.add(policyId);
+        }
+    }
+
+    /**
+     * Clear policy list.
+     */
+    public static void clearPolicyList() {
+        if (!policyList.isEmpty()) {
+            policyList.clear();
+        }
+    }
 }
diff --git a/ONAP-PDP/src/test/java/org/onap/policy/xacml/action/DummyRest.java b/ONAP-PDP/src/test/java/org/onap/policy/xacml/action/DummyRest.java
index 7a7fe54..1a6866c 100644
--- a/ONAP-PDP/src/test/java/org/onap/policy/xacml/action/DummyRest.java
+++ b/ONAP-PDP/src/test/java/org/onap/policy/xacml/action/DummyRest.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.
@@ -25,13 +25,13 @@
 
 @Path("/")
 public class DummyRest {
-	
-	@GET
-	@Path("/foobar")
-	public String subscribe() {
 
-		return "{\"Foo\":\"bar\"}";
-	}
-	
+    @GET
+    @Path("/foobar")
+    public String subscribe() {
+
+        return "{\"Foo\":\"bar\"}";
+    }
+
 
 }
diff --git a/ONAP-PDP/src/test/java/org/onap/policy/xacml/action/FindActionTest.java b/ONAP-PDP/src/test/java/org/onap/policy/xacml/action/FindActionTest.java
index 2a36fa2..f8a5e4b 100644
--- a/ONAP-PDP/src/test/java/org/onap/policy/xacml/action/FindActionTest.java
+++ b/ONAP-PDP/src/test/java/org/onap/policy/xacml/action/FindActionTest.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,16 +17,12 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.xacml.action;
 
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.onap.policy.xacml.custom.OnapFunctionDefinitionFactory;
 import com.att.research.xacml.api.Decision;
 import com.att.research.xacml.api.Request;
 import com.att.research.xacml.api.XACML3;
@@ -45,229 +41,196 @@
 import com.att.research.xacml.std.json.JSONRequest;
 import com.att.research.xacml.util.XACMLProperties;
 
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
 import org.onap.policy.drools.http.server.HttpServletServer;
 import org.onap.policy.drools.utils.NetworkUtil;
+import org.onap.policy.xacml.custom.OnapFunctionDefinitionFactory;
 
 public class FindActionTest {
-	
 
-	String xPathExampleFromSpec = "{ " +
-			"\"Request\" : { " +
-				"\"Resource\" : { " +
-					"\"Attribute\": [ " +
-						"{ " +
-						 	"\"Id\" : \"urn:oasis:names:tc:xacml:3.0:content-selector\", " +
-						 	"\"DataType\" : \"xpathExpression\", " +
-				            "\"Value\" : { " +
-				                "\"XPathCategory\" : \"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\", " +
-				                "\"Namespaces\" : [{ " +
-				                    	"\"Namespace\" : \"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\" " +
-				                    	"}, " +
-				                    "{ " +
-				                    	"\"Prefix\" : \"md\", " +
-				                    	"\"Namespace\" : \"urn:example:med:schemas:record\" " +
-				                    "} " +
-				                "], " +
-				                "\"XPath\" : \"md:record/md:patient/md:patientDoB\" " +
-				            "} " +
-				        "} " +
-					"] " +
-				"} " +
-			"} " +
-		"} ";
-	
-	String jsonResponse;
-	Request request;
-	private static final int MOCK_SERVER_PORT = 6670;
-	
-	@BeforeClass
-	public static void setUpServer() {
+    String xpathexamplefromspec = "{ " + "\"Request\" : { " + "\"Resource\" : { " + "\"Attribute\": [ " + "{ "
+            + "\"Id\" : \"urn:oasis:names:tc:xacml:3.0:content-selector\", " + "\"DataType\" : \"xpathExpression\", "
+            + "\"Value\" : { " + "\"XPathCategory\" : \"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\", "
+            + "\"Namespaces\" : [{ " + "\"Namespace\" : \"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\" " + "}, "
+            + "{ " + "\"Prefix\" : \"md\", " + "\"Namespace\" : \"urn:example:med:schemas:record\" " + "} " + "], "
+            + "\"XPath\" : \"md:record/md:patient/md:patientDoB\" " + "} " + "} " + "] " + "} " + "} " + "} ";
+
+    String jsonResponse;
+    Request request;
+    private static final int MOCK_SERVER_PORT = 6670;
+
+    /**
+     * Setup server before test class.
+     */
+    @BeforeClass
+    public static void setUpServer() {
         try {
-        	final HttpServletServer testServer = HttpServletServer.factory.build("dmaapSim",
-        			"localhost", MOCK_SERVER_PORT, "/", false, true);
-        	testServer.addServletClass("/*", DummyRest.class.getName());
-        	testServer.waitedStart(2000);
-        	if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L))
-        		throw new IllegalStateException("cannot connect to port " + testServer.getPort());
+            final HttpServletServer testServer =
+                    HttpServletServer.factory.build("dmaapSim", "localhost", MOCK_SERVER_PORT, "/", false, true);
+            testServer.addServletClass("/*", DummyRest.class.getName());
+            testServer.waitedStart(2000);
+            if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L)) {
+                throw new IllegalStateException("cannot connect to port " + testServer.getPort());
+            }
         } catch (final Exception e) {
-        	fail(e.getMessage());
+            fail(e.getMessage());
         }
-		
-	}
-	
+
+    }
+
     @AfterClass
     public static void tearDownSimulator() {
         HttpServletServer.factory.destroy();
     }
-    
-	@Before
-	public void setUp() throws Exception {
-		new OnapFunctionDefinitionFactory();
-		request = JSONRequest.load(xPathExampleFromSpec);
 
-		try {	
-			XACMLProperties.reloadProperties();
-			System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "src/test/resources/xacml.pdp.properties");
-			XACMLProperties.getProperties();
-			
-			assertTrue(true);
-		} catch (Exception e) {
-			fail();
-			
-		}
-	}
-	
+    /**
+     * Setup before test case execution.
+     *
+     * @throws Exception if any error occurs
+     */
+    @Before
+    public void setUp() throws Exception {
+        new OnapFunctionDefinitionFactory();
+        request = JSONRequest.load(xpathexamplefromspec);
 
-	@Test
-	public final void testRun() {
-		FindAction action = new FindAction();
-		// fully-loaded multiple response
-		StdMutableResponse response = new StdMutableResponse();
-		// create a Status object
-		StdMutableStatus status = new StdMutableStatus(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
-		status.setStatusMessage("some status message");
-		StdMutableStatusDetail statusDetailIn = new StdMutableStatusDetail();
-		StdMutableMissingAttributeDetail mad = new StdMutableMissingAttributeDetail();
-		mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PEPACTION"));
-		mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_INTEGER.getId(), "PDPACTION"));
-		mad.setAttributeId(XACML3.ID_ACTION_PURPOSE);
-		mad.setCategory(XACML3.ID_ATTRIBUTE_CATEGORY_ACTION);
-		mad.setDataTypeId(XACML3.ID_DATATYPE_STRING);
-		mad.setIssuer("an Issuer");
-		statusDetailIn.addMissingAttributeDetail(mad);
-		status.setStatusDetail(statusDetailIn);
-		// create a single result object
-		StdMutableResult result = new StdMutableResult(status);
-		// set the decision
-		result.setDecision(Decision.INDETERMINATE);
-		// put the Result into the Response
-		response.add(result);
-		// create a new Result with a different Decision
-		status = new StdMutableStatus(StdStatusCode.STATUS_CODE_OK);
-		result = new StdMutableResult(status);
-		result.setDecision(Decision.DENY);
+        try {
+            XACMLProperties.reloadProperties();
+            System.setProperty(XACMLProperties.XACML_PROPERTIES_NAME, "src/test/resources/xacml.pdp.properties");
+            XACMLProperties.getProperties();
 
-		StdMutableObligation obligation = new StdMutableObligation();
-		obligation.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
-		obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-				XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
-				XACML3.ID_SUBJECT, 
-				"obligation-issuer1", 
-				new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Test")));
-		result.addObligation(obligation);
+            assertTrue(true);
+        } catch (final Exception e) {
+            fail();
 
-		StdMutableAdvice advice = new StdMutableAdvice();
-		advice.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
-		advice.addAttributeAssignment(new StdMutableAttributeAssignment(
-				XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
-				XACML3.ID_SUBJECT, 
-				"advice-issuer1", 
-				new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Test")));
-		response.add(result);
-		
-			//	The logic below exercises the  callRest and takeAction methods in FindAction
-			//	GET request
-		status = new StdMutableStatus(StdStatusCode.STATUS_CODE_OK);
-		result = new StdMutableResult(status);
-		result.setDecision(Decision.PERMIT);
-		
-		obligation = new StdMutableObligation();
-		obligation.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
-		obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-				XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
-				new IdentifierImpl("performer"), 
-				"obligation-issuer", 
-				new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PDPACTION")));
-		
-		obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-				XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
-				new IdentifierImpl("URL"), 
-				"obligation-issuer", 
-				new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT)));
-		obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-				XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
-				new IdentifierImpl("method"), 
-				"obligation-issuer", 
-				new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "GET")));
-		obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-				XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
-				new IdentifierImpl("headers"), 
-				"obligation-issuer", 
-				new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "foobar")));
+        }
+    }
 
-		
-		result.addObligation(obligation);
-		response.add(result);
-	
-			//	POST request
-		status = new StdMutableStatus(StdStatusCode.STATUS_CODE_OK);
-		result = new StdMutableResult(status);
-		result.setDecision(Decision.PERMIT);
-		
-		obligation = new StdMutableObligation();
-		obligation.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
-		obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-				XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
-				new IdentifierImpl("performer"), 
-				"obligation-issuer", 
-				new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PDPACTION")));
-		
-		obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-				XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
-				new IdentifierImpl("URL"), 
-				"obligation-issuer", 
-				new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT)));
-		obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-				XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
-				new IdentifierImpl("method"), 
-				"obligation-issuer", 
-				new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "POST")));
-		obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-				XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
-				new IdentifierImpl("body"), 
-				"obligation-issuer", 
-				new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT + "/foobar")));
-		
-		result.addObligation(obligation);
-		response.add(result);
-		
-			//PUT request
-		status = new StdMutableStatus(StdStatusCode.STATUS_CODE_OK);
-		result = new StdMutableResult(status);
-		result.setDecision(Decision.PERMIT);
-		
-		obligation = new StdMutableObligation();
-		obligation.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
-		obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-				XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
-				new IdentifierImpl("performer"), 
-				"obligation-issuer", 
-				new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PDPACTION")));
-		
-		obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-				XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
-				new IdentifierImpl("URL"), 
-				"obligation-issuer", 
-				new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT)));
-		obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-				XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
-				new IdentifierImpl("method"), 
-				"obligation-issuer", 
-				new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PUT")));
-		obligation.addAttributeAssignment(new StdMutableAttributeAssignment(
-				XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, 
-				new IdentifierImpl("body"), 
-				"obligation-issuer", 
-				new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT + "/foobar")));
-		
-		result.addObligation(obligation);
-		response.add(result);
-		
-		try {
-			assertTrue(action.run(response, request) != null);
-		} catch (Exception e) {
-			fail("operation failed, e="+e);
-		}
-	}
+
+    @Test
+    public final void testRun() {
+        final FindAction action = new FindAction();
+        // fully-loaded multiple response
+        final StdMutableResponse response = new StdMutableResponse();
+        // create a Status object
+        StdMutableStatus status = new StdMutableStatus(StdStatusCode.STATUS_CODE_MISSING_ATTRIBUTE);
+        status.setStatusMessage("some status message");
+        final StdMutableStatusDetail statusDetailIn = new StdMutableStatusDetail();
+        final StdMutableMissingAttributeDetail mad = new StdMutableMissingAttributeDetail();
+        mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PEPACTION"));
+        mad.addAttributeValue(new StdAttributeValue<String>(DataTypes.DT_INTEGER.getId(), "PDPACTION"));
+        mad.setAttributeId(XACML3.ID_ACTION_PURPOSE);
+        mad.setCategory(XACML3.ID_ATTRIBUTE_CATEGORY_ACTION);
+        mad.setDataTypeId(XACML3.ID_DATATYPE_STRING);
+        mad.setIssuer("an Issuer");
+        statusDetailIn.addMissingAttributeDetail(mad);
+        status.setStatusDetail(statusDetailIn);
+        // create a single result object
+        StdMutableResult result = new StdMutableResult(status);
+        // set the decision
+        result.setDecision(Decision.INDETERMINATE);
+        // put the Result into the Response
+        response.add(result);
+        // create a new Result with a different Decision
+        status = new StdMutableStatus(StdStatusCode.STATUS_CODE_OK);
+        result = new StdMutableResult(status);
+        result.setDecision(Decision.DENY);
+
+        StdMutableObligation obligation = new StdMutableObligation();
+        obligation.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
+        obligation.addAttributeAssignment(
+                new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, XACML3.ID_SUBJECT,
+                        "obligation-issuer1", new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Test")));
+        result.addObligation(obligation);
+
+        final StdMutableAdvice advice = new StdMutableAdvice();
+        advice.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
+        advice.addAttributeAssignment(
+                new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, XACML3.ID_SUBJECT,
+                        "advice-issuer1", new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "Test")));
+        response.add(result);
+
+        // The logic below exercises the callRest and takeAction methods in FindAction
+        // GET request
+        status = new StdMutableStatus(StdStatusCode.STATUS_CODE_OK);
+        result = new StdMutableResult(status);
+        result.setDecision(Decision.PERMIT);
+
+        obligation = new StdMutableObligation();
+        obligation.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
+        obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
+                new IdentifierImpl("performer"), "obligation-issuer",
+                new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PDPACTION")));
+
+        obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
+                new IdentifierImpl("URL"), "obligation-issuer",
+                new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT)));
+        obligation.addAttributeAssignment(
+                new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("method"),
+                        "obligation-issuer", new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "GET")));
+        obligation.addAttributeAssignment(
+                new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("headers"),
+                        "obligation-issuer", new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "foobar")));
+
+
+        result.addObligation(obligation);
+        response.add(result);
+
+        // POST request
+        status = new StdMutableStatus(StdStatusCode.STATUS_CODE_OK);
+        result = new StdMutableResult(status);
+        result.setDecision(Decision.PERMIT);
+
+        obligation = new StdMutableObligation();
+        obligation.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
+        obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
+                new IdentifierImpl("performer"), "obligation-issuer",
+                new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PDPACTION")));
+
+        obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
+                new IdentifierImpl("URL"), "obligation-issuer",
+                new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT)));
+        obligation.addAttributeAssignment(
+                new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("method"),
+                        "obligation-issuer", new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "POST")));
+        obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
+                new IdentifierImpl("body"), "obligation-issuer", new StdAttributeValue<String>(
+                        DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT + "/foobar")));
+
+        result.addObligation(obligation);
+        response.add(result);
+
+        // PUT request
+        status = new StdMutableStatus(StdStatusCode.STATUS_CODE_OK);
+        result = new StdMutableResult(status);
+        result.setDecision(Decision.PERMIT);
+
+        obligation = new StdMutableObligation();
+        obligation.setId(XACML3.ID_ACTION_IMPLIED_ACTION);
+        obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
+                new IdentifierImpl("performer"), "obligation-issuer",
+                new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PDPACTION")));
+
+        obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
+                new IdentifierImpl("URL"), "obligation-issuer",
+                new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT)));
+        obligation.addAttributeAssignment(
+                new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("method"),
+                        "obligation-issuer", new StdAttributeValue<String>(DataTypes.DT_STRING.getId(), "PUT")));
+        obligation.addAttributeAssignment(new StdMutableAttributeAssignment(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE,
+                new IdentifierImpl("body"), "obligation-issuer", new StdAttributeValue<String>(
+                        DataTypes.DT_STRING.getId(), "http://localhost:" + MOCK_SERVER_PORT + "/foobar")));
+
+        result.addObligation(obligation);
+        response.add(result);
+
+        try {
+            assertTrue(action.run(response, request) != null);
+        } catch (final Exception e) {
+            fail("operation failed, e=" + e);
+        }
+    }
 
 }
diff --git a/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/ONAPPDPEngineFactoryTest.java b/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/ONAPPDPEngineFactoryTest.java
deleted file mode 100644
index 1bde7dd..0000000
--- a/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/ONAPPDPEngineFactoryTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP-PDP
- * ================================================================================
- * Copyright (C) 2017-2018 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.policy.xacml.pdp;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import java.util.Properties;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import com.att.research.xacml.util.FactoryException;
-import com.att.research.xacml.util.FactoryFinder;
-import com.att.research.xacmlatt.pdp.eval.EvaluationContextFactory;
-
-@RunWith(PowerMockRunner.class)
-public class ONAPPDPEngineFactoryTest {
-  @Test
-  public final void testNewEngine() {
-    ONAPPDPEngineFactory pdpEngine = new ONAPPDPEngineFactory();
-    try {
-      assertTrue(pdpEngine.newEngine() != null);
-    } catch (Exception e) {
-      fail("operation failed, e=" + e);
-    }
-  }
-
-  @Test
-  public final void testNewEngineProperties() {
-    ONAPPDPEngineFactory pdpEngine = new ONAPPDPEngineFactory();
-    Properties properties = new Properties();
-    try {
-      assertTrue(pdpEngine.newEngine(properties) != null);
-    } catch (Exception e) {
-      fail("operation failed, e=" + e);
-    }
-  }
-
-  @PrepareForTest({EvaluationContextFactory.class, FactoryFinder.class})
-  @Test(expected = FactoryException.class)
-  public void negTestEngine() throws FactoryException {
-    // Setup test data
-    PowerMockito.mockStatic(FactoryFinder.class);
-    PowerMockito.when(FactoryFinder.find(Mockito.any(), Mockito.any(), Mockito.any()))
-        .thenReturn(null);
-
-    // Negative test factory
-    ONAPPDPEngineFactory factory = new ONAPPDPEngineFactory();
-    factory.newEngine();
-    fail("Expecting an exception.");
-  }
-
-  @PrepareForTest({EvaluationContextFactory.class, FactoryFinder.class})
-  @Test(expected = FactoryException.class)
-  public void negTestEngine2() throws FactoryException {
-    // Setup test data
-    PowerMockito.mockStatic(FactoryFinder.class);
-    PowerMockito.when(FactoryFinder.find(Mockito.any(), Mockito.any(), Mockito.any()))
-        .thenReturn(null);
-
-    // Negative test factory
-    ONAPPDPEngineFactory factory = new ONAPPDPEngineFactory();
-    Properties properties = new Properties();
-    factory.newEngine(properties);
-    fail("Expecting an exception.");
-  }
-}
diff --git a/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/OnapPdpEngineFactoryTest.java b/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/OnapPdpEngineFactoryTest.java
new file mode 100644
index 0000000..d3ee544
--- /dev/null
+++ b/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/OnapPdpEngineFactoryTest.java
@@ -0,0 +1,88 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-PDP
+ * ================================================================================
+ * Copyright (C) 2017-2018 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.policy.xacml.pdp;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import com.att.research.xacml.util.FactoryException;
+import com.att.research.xacml.util.FactoryFinder;
+import com.att.research.xacmlatt.pdp.eval.EvaluationContextFactory;
+
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mockito;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+
+@RunWith(PowerMockRunner.class)
+public class OnapPdpEngineFactoryTest {
+    @Test
+    public final void testNewEngine() {
+        final OnapPdpEngineFactory pdpEngine = new OnapPdpEngineFactory();
+        try {
+            assertTrue(pdpEngine.newEngine() != null);
+        } catch (final Exception e) {
+            fail("operation failed, e=" + e);
+        }
+    }
+
+    @Test
+    public final void testNewEngineProperties() {
+        final OnapPdpEngineFactory pdpEngine = new OnapPdpEngineFactory();
+        final Properties properties = new Properties();
+        try {
+            assertTrue(pdpEngine.newEngine(properties) != null);
+        } catch (final Exception e) {
+            fail("operation failed, e=" + e);
+        }
+    }
+
+    @PrepareForTest({ EvaluationContextFactory.class, FactoryFinder.class })
+    @Test(expected = FactoryException.class)
+    public void negTestEngine() throws FactoryException {
+        // Setup test data
+        PowerMockito.mockStatic(FactoryFinder.class);
+        PowerMockito.when(FactoryFinder.find(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(null);
+
+        // Negative test factory
+        final OnapPdpEngineFactory factory = new OnapPdpEngineFactory();
+        factory.newEngine();
+        fail("Expecting an exception.");
+    }
+
+    @PrepareForTest({ EvaluationContextFactory.class, FactoryFinder.class })
+    @Test(expected = FactoryException.class)
+    public void negTestEngine2() throws FactoryException {
+        // Setup test data
+        PowerMockito.mockStatic(FactoryFinder.class);
+        PowerMockito.when(FactoryFinder.find(Mockito.any(), Mockito.any(), Mockito.any())).thenReturn(null);
+
+        // Negative test factory
+        final OnapPdpEngineFactory factory = new OnapPdpEngineFactory();
+        final Properties properties = new Properties();
+        factory.newEngine(properties);
+        fail("Expecting an exception.");
+    }
+}
diff --git a/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/ONAPPDPEngineTest.java b/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/OnapPdpEngineTest.java
similarity index 71%
rename from ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/ONAPPDPEngineTest.java
rename to ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/OnapPdpEngineTest.java
index 6eb6e4c..08a8447 100644
--- a/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/ONAPPDPEngineTest.java
+++ b/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/OnapPdpEngineTest.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.
@@ -22,24 +22,26 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import org.junit.Test;
-import org.mockito.Mockito;
+
 import com.att.research.xacml.api.Request;
 import com.att.research.xacml.api.Response;
 import com.att.research.xacml.api.pdp.PDPException;
 import com.att.research.xacml.api.pdp.ScopeResolver;
 import com.att.research.xacmlatt.pdp.eval.EvaluationContextFactory;
 
-public class ONAPPDPEngineTest {
-  @Test
-  public void testEngine() throws PDPException {
-    EvaluationContextFactory factory = Mockito.mock(EvaluationContextFactory.class);
-    ScopeResolver resolver = Mockito.mock(ScopeResolver.class);
-    ONAPPDPEngine engine = new ONAPPDPEngine(factory, resolver);
-    assertNotNull(engine);
+import org.junit.Test;
+import org.mockito.Mockito;
 
-    Request pepRequest = Mockito.mock(Request.class);
-    Response response = engine.decide(pepRequest);
-    assertEquals(1, response.getResults().size());
-  }
+public class OnapPdpEngineTest {
+    @Test
+    public void testEngine() throws PDPException {
+        final EvaluationContextFactory factory = Mockito.mock(EvaluationContextFactory.class);
+        final ScopeResolver resolver = Mockito.mock(ScopeResolver.class);
+        final OnapPdpEngine engine = new OnapPdpEngine(factory, resolver);
+        assertNotNull(engine);
+
+        final Request pepRequest = Mockito.mock(Request.class);
+        final Response response = engine.decide(pepRequest);
+        assertEquals(1, response.getResults().size());
+    }
 }
diff --git a/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/std/functions/FunctionDefinitionCustomRegexpMatchTest.java b/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/std/functions/FunctionDefinitionCustomRegexpMatchTest.java
index 5100dc7..da1759a 100644
--- a/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/std/functions/FunctionDefinitionCustomRegexpMatchTest.java
+++ b/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/std/functions/FunctionDefinitionCustomRegexpMatchTest.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,12 +17,11 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.xacml.pdp.std.functions;
 
 import static org.junit.Assert.assertEquals;
-import java.util.ArrayList;
-import java.util.List;
-import org.junit.Test;
+
 import com.att.research.xacml.api.Identifier;
 import com.att.research.xacml.api.XACML;
 import com.att.research.xacml.std.IdentifierImpl;
@@ -32,23 +31,29 @@
 import com.att.research.xacmlatt.pdp.policy.FunctionArgument;
 import com.att.research.xacmlatt.pdp.policy.FunctionArgumentAttributeValue;
 
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
 public class FunctionDefinitionCustomRegexpMatchTest {
-	@Test
-	public final void testRegexp() {
-		// Setup
-		String testVal = "testVal";
-		String testId = "function:testId";
-		IdentifierImpl testFnId = new IdentifierImpl(testId);
-		Identifier identifier = XACML.ID_DATATYPE_STRING;
-		StdAttributeValue<String> attValue = new StdAttributeValue<String>(identifier, testVal);
-		FunctionArgument fArg = new FunctionArgumentAttributeValue(attValue);
-		List<FunctionArgument> listFA = new ArrayList<FunctionArgument>();
-		listFA.add(fArg);
-		listFA.add(fArg);
-		
-		// Try a match
-		FunctionDefinitionCustomRegexpMatch<String> regexpMatch = new FunctionDefinitionCustomRegexpMatch<String>(testFnId, DataTypes.DT_STRING);
-		ExpressionResult result = regexpMatch.evaluate(null, listFA);
-		assertEquals(result.getStatus().isOk(), true);
-	}
+    @Test
+    public final void testRegexp() {
+        // Setup
+        final String testVal = "testVal";
+        final String testId = "function:testId";
+        final IdentifierImpl testFnId = new IdentifierImpl(testId);
+        final Identifier identifier = XACML.ID_DATATYPE_STRING;
+        final StdAttributeValue<String> attValue = new StdAttributeValue<String>(identifier, testVal);
+        final FunctionArgument fArg = new FunctionArgumentAttributeValue(attValue);
+        final List<FunctionArgument> listFa = new ArrayList<FunctionArgument>();
+        listFa.add(fArg);
+        listFa.add(fArg);
+
+        // Try a match
+        final FunctionDefinitionCustomRegexpMatch<String> regexpMatch =
+                new FunctionDefinitionCustomRegexpMatch<String>(testFnId, DataTypes.DT_STRING);
+        final ExpressionResult result = regexpMatch.evaluate(null, listFa);
+        assertEquals(result.getStatus().isOk(), true);
+    }
 }
diff --git a/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/std/functions/PolicyListTest.java b/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/std/functions/PolicyListTest.java
index 17f509d..ccab704 100644
--- a/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/std/functions/PolicyListTest.java
+++ b/ONAP-PDP/src/test/java/org/onap/policy/xacml/pdp/std/functions/PolicyListTest.java
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * ONAP-PDP
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2018 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,47 +17,49 @@
  * limitations under the License.
  * ============LICENSE_END=========================================================
  */
+
 package org.onap.policy.xacml.pdp.std.functions;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import org.junit.Before;
 import org.junit.Test;
 
 public class PolicyListTest {
 
-	@Before
-	public void setUp() throws Exception {
-		PolicyList.addPolicyID("Test");
-	}
+    @Before
+    public void setUp() throws Exception {
+        PolicyList.addPolicyId("Test");
+    }
 
-	@Test
-	public final void testGetpolicyList() {
-		try{
-			assertTrue(PolicyList.getpolicyList().size() ==1);
-		}catch(Exception e){
-			fail("operation failed, e="+e);
-		}
-	}
+    @Test
+    public final void testGetpolicyList() {
+        try {
+            assertTrue(PolicyList.getpolicyList().size() == 1);
+        } catch (final Exception e) {
+            fail("operation failed, e=" + e);
+        }
+    }
 
-	@Test
-	public final void testAddPolicyID() {
-		try{
-			PolicyList.addPolicyID("Test");
-			assertTrue(PolicyList.getpolicyList().size() == 1);
-		}catch(Exception e){
-			fail("operation failed, e="+e);
-		}
-	}
+    @Test
+    public final void testAddPolicyId() {
+        try {
+            PolicyList.addPolicyId("Test");
+            assertTrue(PolicyList.getpolicyList().size() == 1);
+        } catch (final Exception e) {
+            fail("operation failed, e=" + e);
+        }
+    }
 
-	@Test
-	public final void testClearPolicyList() {
-		try{
-			PolicyList.clearPolicyList();
-			assertTrue(PolicyList.getpolicyList().size() == 0);
-		}catch(Exception e){
-			fail("operation failed, e="+e);
-		}
-	}
+    @Test
+    public final void testClearPolicyList() {
+        try {
+            PolicyList.clearPolicyList();
+            assertTrue(PolicyList.getpolicyList().size() == 0);
+        } catch (final Exception e) {
+            fail("operation failed, e=" + e);
+        }
+    }
 
 }
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionBodyEntityTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionBodyEntityTest.java
new file mode 100644
index 0000000..f8777d8
--- /dev/null
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ActionBodyEntityTest.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2018 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.policy.rest.jpa;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import java.util.Date;
+import org.junit.Test;
+
+public class ActionBodyEntityTest {
+  @Test
+  public void testEntity() {
+    // Set up test data
+    String value = "testVal";
+    Date date = new Date();
+    ActionBodyEntity entity = new ActionBodyEntity();
+    entity.prePersist();
+    ActionBodyEntity entity2 = new ActionBodyEntity();
+    ActionBodyEntity entity3 = new ActionBodyEntity();
+
+    // Test set and get
+    entity3.preUpdate();
+    entity3.setActionBody(value);
+    assertEquals(value, entity3.getActionBody());
+    entity3.setActionBodyName(value);
+    assertEquals(value, entity3.getActionBodyName());
+    entity3.setCreatedBy(value);
+    assertEquals(value, entity3.getCreatedBy());
+    entity3.setModifiedBy(value);
+    assertEquals(value, entity3.getModifiedBy());
+    entity3.setModifiedDate(date);
+    assertEquals(date, entity3.getModifiedDate());
+    assertEquals(0, entity3.getVersion());
+    assertNull(entity3.getCreatedDate());
+    entity3.setDeleted(true);
+    assertEquals(true, entity3.isDeleted());
+    assertEquals(0, entity3.getActionBodyId());
+
+    // Test equals method combinations
+    assertEquals(false, entity.equals(null));
+    assertEquals(true, entity.equals(entity));
+    assertEquals(false, entity.equals(value));
+    assertEquals(false, entity.equals(entity2));
+    assertThat(entity.hashCode(), is(not(0)));
+  }
+}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ConfigurationDataEntityTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ConfigurationDataEntityTest.java
new file mode 100644
index 0000000..da5dd50
--- /dev/null
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/ConfigurationDataEntityTest.java
@@ -0,0 +1,71 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2018 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.policy.rest.jpa;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.not;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import java.util.Date;
+import org.junit.Test;
+
+public class ConfigurationDataEntityTest {
+  @Test
+  public void testEquals() {
+    // Set up test data
+    String value = "testVal";
+    Date date = new Date();
+    ConfigurationDataEntity entity = new ConfigurationDataEntity();
+    entity.prePersist();
+    ConfigurationDataEntity entity2 = new ConfigurationDataEntity();
+    ConfigurationDataEntity entity3 = new ConfigurationDataEntity();
+
+    // Test set and get
+    entity3.preUpdate();
+    entity3.setConfigBody(value);
+    assertEquals(value, entity3.getConfigBody());
+    entity3.setCreatedBy(value);
+    assertEquals(value, entity3.getCreatedBy());
+    entity3.setModifiedBy(value);
+    assertEquals(value, entity3.getModifiedBy());
+    entity3.setModifiedDate(date);
+    assertEquals(date, entity3.getModifiedDate());
+    assertEquals(0, entity3.getVersion());
+    assertNull(entity3.getCreatedDate());
+    entity3.setDeleted(true);
+    assertEquals(true, entity3.isDeleted());
+    entity3.setDescription(value);
+    assertEquals(value, entity3.getDescription());
+    entity3.setConfigType(value);
+    assertEquals(value, entity3.getConfigType());
+    entity3.setConfigurationName(value);
+    assertEquals(value, entity3.getConfigurationName());
+    assertEquals(0, entity3.getConfigurationDataId());
+
+    // Test method combinations
+    assertEquals(false, entity.equals(null));
+    assertEquals(true, entity.equals(entity));
+    assertEquals(false, entity.equals(value));
+    assertEquals(false, entity.equals(entity2));
+    assertThat(entity.hashCode(), is(not(0)));
+  }
+}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroserviceHeaderdeFaultsTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroserviceHeaderdeFaultsTest.java
new file mode 100644
index 0000000..62452dc
--- /dev/null
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/MicroserviceHeaderdeFaultsTest.java
@@ -0,0 +1,53 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2018 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.policy.rest.jpa;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+public class MicroserviceHeaderdeFaultsTest {
+  @Test
+  public void testHeader() {
+    // Set up test data
+    String value = "testVal";
+    MicroserviceHeaderdeFaults header = new MicroserviceHeaderdeFaults();
+    header.prePersist();
+    header.preUpdate();
+
+    // Set data
+    header.setGuard(value);
+    header.setId(1);
+    header.setModelName(value);
+    header.setOnapName(value);
+    header.setPriority(value);
+    header.setRiskLevel(value);
+    header.setRiskType(value);
+
+    // Test gets
+    assertEquals(value, header.getGuard());
+    assertEquals(1, header.getId());
+    assertEquals(value, header.getModelName());
+    assertEquals(value, header.getOnapName());
+    assertEquals(value, header.getPriority());
+    assertEquals(value, header.getRiskLevel());
+    assertEquals(value, header.getRiskType());
+  }
+}
diff --git a/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPConfigurationTest.java b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPConfigurationTest.java
new file mode 100644
index 0000000..8d87173
--- /dev/null
+++ b/ONAP-REST/src/test/java/org/onap/policy/rest/jpa/PIPConfigurationTest.java
@@ -0,0 +1,120 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP-REST
+ * ================================================================================
+ * Copyright (C) 2018 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.policy.rest.jpa;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+import org.junit.Test;
+import com.att.research.xacml.api.pip.PIPException;
+import com.att.research.xacml.util.XACMLProperties;
+
+public class PIPConfigurationTest {
+  @Test
+  public void testConfig() throws PIPException {
+    String value = "testVal";
+    String id = "1";
+    PIPConfigParam param = new PIPConfigParam();
+    param.setParamName(value);
+    param.setParamValue(value);
+    Set<PIPConfigParam> params = new HashSet<PIPConfigParam>();
+    PIPResolver resolver = new PIPResolver();
+    resolver.setClassname(value);
+    resolver.setName(value);
+    params.add(param);
+    Set<PIPResolver> resolvers = new HashSet<PIPResolver>();
+    resolvers.add(resolver);
+    Properties props = new Properties();
+    props.setProperty(id + ".classname", value);
+    props.setProperty(XACMLProperties.PROP_PIP_ENGINES, id);
+    PIPType type = new PIPType();
+    Date date = new Date();
+
+    // Test constructors
+    PIPConfiguration config = new PIPConfiguration();
+    assertNotNull(config);
+    config.setPipconfigParams(params);
+    config.setPipresolvers(resolvers);
+    PIPConfiguration config2 = new PIPConfiguration(config, value);
+    assertNotNull(config2);
+    config2.prePersist();
+    config2.preUpdate();
+    PIPConfiguration config3 = new PIPConfiguration(id, props);
+    assertNotNull(config3);
+    PIPConfiguration config4 = new PIPConfiguration(id, props, value);
+    assertNotNull(config4);
+
+    // Test set and get
+    config.setId(1);
+    assertEquals(1, config.getId());
+    config.setDescription(value);
+    assertEquals(value, config.getDescription());
+    config.setName(id);
+    assertEquals(id, config.getName());
+    config.setClassname(value);
+    assertEquals(value, config.getClassname());
+    config.setIssuer(value);
+    assertEquals(value, config.getIssuer());
+    config.setReadOnly(true);
+    assertEquals('1', config.getReadOnly());
+    config.setReadOnly('0');
+    assertEquals('0', config.getReadOnly());
+    assertEquals(false, config.isReadOnly());
+    config.setRequiresResolvers('t');
+    assertEquals('t', config.getRequiresResolvers());
+    config.setReadOnly(false);
+    assertEquals('0', config.getReadOnly());
+    config.setPiptype(type);
+    assertEquals(type, config.getPiptype());
+    config.setRequiresResolvers(false);
+    assertEquals('0', config.getRequiresResolvers());
+    config.setCreatedBy(value);
+    assertEquals(value, config.getCreatedBy());
+    config.setCreatedDate(date);
+    assertEquals(date, config.getCreatedDate());
+    config.setModifiedBy(value);
+    assertEquals(value, config.getModifiedBy());
+    config.setModifiedDate(date);
+    assertEquals(date, config.getModifiedDate());
+    config.setRequiresResolvers(true);
+    assertEquals(true, config.requiresResolvers());
+    assertEquals(8, config.getConfiguration(id).size());
+    assertEquals(9, config.generateProperties(id).size());
+
+    // Test remove and clear
+    assertEquals(param, config.removePipconfigParam(param));
+    config.clearConfigParams();
+    assertEquals(0, config.getPipconfigParams().size());
+    config.removePipresolver(resolver);
+    assertEquals(0, config.getPipresolvers().size());
+
+    // Test import
+    assertEquals(1, PIPConfiguration.importPIPConfigurations(props).size());
+    config.readProperties(id, props);
+    assertEquals(id, config.getName());
+
+    // Test toString
+    assertEquals(332, config.toString().length());
+  }
+}
