summaryrefslogtreecommitdiffstats
path: root/BRMSGateway/src/main/java
diff options
context:
space:
mode:
authorTej, Tarun <tt3868@att.com>2017-09-16 12:56:31 -0400
committerTej, Tarun <tt3868@att.com>2017-09-18 15:53:59 -0400
commitdc35b06ecbff453135aa9c1a557e55995f3e9020 (patch)
tree5279b2804f853ea3175c7363ebf89d7d74560f19 /BRMSGateway/src/main/java
parentbdbaad66f2a42d4ef9f58a9d7cf3747afb61407a (diff)
Adding JUnits for additional coverage
PolicyEngine Utils and BRMSGW Junit Issue-Id: POLICY-52 Change-Id: I8e18e8bd6dc5eec0874b9ffe3aebf8e399ff3326 Signed-off-by: Tej, Tarun <tt3868@att.com>
Diffstat (limited to 'BRMSGateway/src/main/java')
-rw-r--r--BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java
index b09a3d8c8..c923c3c34 100644
--- a/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java
+++ b/BRMSGateway/src/main/java/org/onap/policy/brmsInterface/BRMSPush.java
@@ -137,6 +137,9 @@ public class BRMSPush {
private boolean syncFlag = false;
public BRMSPush(String propertiesFile, 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);
if (Files.notExists(file)) {
@@ -185,7 +188,9 @@ public class BRMSPush {
} catch (Exception e) {
LOGGER.error("Error starting BackUpMonitor: " + e);
}
- config.setProperty(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML, "META-INF/persistenceBRMS.xml");
+ if(!config.containsKey(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML)){
+ config.setProperty(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML, "META-INF/persistenceBRMS.xml");
+ }
EntityManagerFactory emf = Persistence.createEntityManagerFactory("BRMSGW", config);
em = emf.createEntityManager();
defaultName = config.getProperty("defaultName");
@@ -1014,6 +1019,10 @@ public class BRMSPush {
private void readGroups(Properties config) throws PolicyException {
String[] groupNames = null;
+ if (!config.containsKey("groupNames") || config.getProperty("groupNames")==null){
+ throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE
+ + "groupNames property is missing or empty from the property file ");
+ }
if (config.getProperty("groupNames").contains(",")) {
groupNames = config.getProperty("groupNames").replaceAll(" ", "").split(",");
} else {