aboutsummaryrefslogtreecommitdiffstats
path: root/ONAP-PDP-REST
diff options
context:
space:
mode:
authorTej, Tarun <tt3868@att.com>2017-09-15 00:52:13 -0400
committerTej, Tarun <tt3868@att.com>2017-09-15 01:37:52 -0400
commite0385921034ae9ce860038ea65d2d13259f7cc4c (patch)
treefa9461d587584fca27fc9a4a81614c91dcac6231 /ONAP-PDP-REST
parente9e7bef3c130f7525a5ad250f365ee910bebe85a (diff)
Adding Junits for policy engine
Adding Junits to Policy Engine Utils project, removed duplicates, fixed few defects along the way and fixes to projects. Issue-Id: POLICY-52 Change-Id: Ia0598300f9bd60f5372b9ef7d8984657478a1611 Signed-off-by: Tej, Tarun <tt3868@att.com>
Diffstat (limited to 'ONAP-PDP-REST')
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ConfigPolicyService.java4
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/CreateUpdatePolicyServiceImpl.java4
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/NotificationService.java4
-rw-r--r--ONAP-PDP-REST/xacml.pdp.properties4
4 files changed, 10 insertions, 6 deletions
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ConfigPolicyService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ConfigPolicyService.java
index c8d3d74d1..690e94a5e 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ConfigPolicyService.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/ConfigPolicyService.java
@@ -82,12 +82,12 @@ public class ConfigPolicyService {
message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Config Name given.";
return false;
}
- message = PolicyUtils.emptyPolicyValidator(onapName);
+ message = PolicyUtils.policySpecialCharValidator(onapName);
if(!message.contains("success")){
message = XACMLErrorConstants.ERROR_DATA_ISSUE+ message;
return false;
}
- message = PolicyUtils.emptyPolicyValidator(configName);
+ message = PolicyUtils.policySpecialCharValidator(configName);
if(!message.contains("success")){
message = XACMLErrorConstants.ERROR_DATA_ISSUE+ message;
return false;
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/CreateUpdatePolicyServiceImpl.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/CreateUpdatePolicyServiceImpl.java
index 945cdba8b..528e5cda9 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/CreateUpdatePolicyServiceImpl.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/CreateUpdatePolicyServiceImpl.java
@@ -234,12 +234,12 @@ public class CreateUpdatePolicyServiceImpl implements CreateUpdatePolicyService
message = XACMLErrorConstants.ERROR_DATA_ISSUE + "No Policy Name given.";
return false;
}
- message = PolicyUtils.emptyPolicyValidator(policyScope);
+ message = PolicyUtils.policySpecialCharValidator(policyScope);
if(!message.contains("success")){
message = XACMLErrorConstants.ERROR_DATA_ISSUE+ message;
return false;
}
- message = PolicyUtils.emptyPolicyValidator(policyName);
+ message = PolicyUtils.policySpecialCharValidator(policyName);
if(!message.contains("success")){
message = XACMLErrorConstants.ERROR_DATA_ISSUE+ message;
return false;
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/NotificationService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/NotificationService.java
index 6ca52ca40..bba51965b 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/NotificationService.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/NotificationService.java
@@ -99,7 +99,7 @@ public class NotificationService {
dmaapServers = XACMLProperties.getProperty(XACMLRestProperties.PROP_NOTIFICATION_SERVERS);
aafLogin = XACMLProperties.getProperty("DMAAP_AAF_LOGIN");
aafPassword = XACMLProperties.getProperty("DMAAP_AAF_PASSWORD");
- interval = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_NOTIFICATION_DELAY, Integer.toString(interval)));
+ interval = Integer.parseInt(XACMLProperties.getProperty("CLIENT_INTERVAL", Integer.toString(interval)));
if(dmaapServers==null || aafLogin==null || aafPassword==null){
logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "DMaaP properties are missing from the property file ");
return;
@@ -269,7 +269,7 @@ public class NotificationService {
Date currentTime = new Date();
long timeDiff = 0;
timeDiff = currentTime.getTime()-map.getValue().getTime();
- if(timeDiff < (interval+1500)){
+ if(timeDiff > (interval+1500)){
removeTopic(map.getKey());
}
}
diff --git a/ONAP-PDP-REST/xacml.pdp.properties b/ONAP-PDP-REST/xacml.pdp.properties
index b88c93543..6cf2e945b 100644
--- a/ONAP-PDP-REST/xacml.pdp.properties
+++ b/ONAP-PDP-REST/xacml.pdp.properties
@@ -118,6 +118,10 @@ xacml.rest.pap.password=alpha123
# Delay for Notifications Don't change this. Value in milliSec.
xacml.rest.notification.delay=30
+
+# Client interval to ping notification service.
+CLIENT_INTERVAL=15000
+
# Buffer Size.
REQUEST_BUFFER_SIZE=15