summaryrefslogtreecommitdiffstats
path: root/ONAP-PDP-REST/src
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@est.tech>2019-10-29 09:25:54 +0000
committerGerrit Code Review <gerrit@onap.org>2019-10-29 09:25:54 +0000
commit87b642029080fbbacfb06daba15104f988ab6be0 (patch)
tree7c2620c07fcf8eb21ebdcf7d5af056cf3476a0e1 /ONAP-PDP-REST/src
parent2542055ec3d3f25f482b0123ce4b273bba7592f3 (diff)
parentc2ca6ea5cb44103903e1409e8dd6db80167e61e8 (diff)
Merge "CHeckstyle and JUnit for base package in ONAP-REST"
Diffstat (limited to 'ONAP-PDP-REST/src')
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/PapUrlResolver.java42
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpLoader.java45
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpRegisterThread.java12
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java26
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/NotificationService.java8
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PAPServices.java10
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java20
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/ManualNotificationUpdateThread.java22
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/NotificationController.java24
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/NotificationServer.java62
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/restauth/AuthenticationService.java4
-rw-r--r--ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java28
12 files changed, 152 insertions, 151 deletions
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/PapUrlResolver.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/PapUrlResolver.java
index 0fab3db61..237ed9334 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/PapUrlResolver.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/PapUrlResolver.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.
@@ -31,7 +31,7 @@ import java.util.Objects;
import java.util.Properties;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
-import org.onap.policy.rest.XACMLRestProperties;
+import org.onap.policy.rest.XacmlRestProperties;
import org.onap.policy.utils.PeCryptoUtils;
public class PapUrlResolver {
@@ -96,12 +96,12 @@ public class PapUrlResolver {
String papUrlFailedList = failedList;
String papUrlSuccessList = succeededList;
if (papUrlLists == null) {
- papUrlLists = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URLS);
+ papUrlLists = XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_URLS);
if (papUrlLists == null) {
- papUrlLists = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL);
+ papUrlLists = XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_URL);
}
- papUrlFailedList = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS);
- papUrlSuccessList = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS);
+ papUrlFailedList = XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS);
+ papUrlSuccessList = XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS);
}
String[] urls = papUrlLists.split(",");
@@ -116,12 +116,12 @@ public class PapUrlResolver {
String userId = null;
String pass = null;
- userId = XACMLProperties.getProperty(urls[i] + "." + XACMLRestProperties.PROP_PAP_USERID);
+ userId = XACMLProperties.getProperty(urls[i] + "." + XacmlRestProperties.PROP_PAP_USERID);
pass = XACMLProperties.getProperty(urls[i] + "."
- + PeCryptoUtils.decrypt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_PASS)));
+ + PeCryptoUtils.decrypt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_PASS)));
if (userId == null || pass == null) {
- userId = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_USERID);
- pass = PeCryptoUtils.decrypt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_PASS));
+ userId = XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_USERID);
+ pass = PeCryptoUtils.decrypt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_PASS));
}
if (userId == null || pass == null) {
userId = "";
@@ -216,9 +216,9 @@ public class PapUrlResolver {
failedPropertyString = failedPropertyString.substring(1);
succeededPropertyString = succeededPropertyString.substring(1);
urlPropertyString = urlPropertyString.substring(1);
- prop.setProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS, failedPropertyString);
- prop.setProperty(XACMLRestProperties.PROP_PAP_URLS, urlPropertyString);
- prop.setProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS, succeededPropertyString);
+ prop.setProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS, failedPropertyString);
+ prop.setProperty(XacmlRestProperties.PROP_PAP_URLS, urlPropertyString);
+ prop.setProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS, succeededPropertyString);
return prop;
}
@@ -229,12 +229,12 @@ public class PapUrlResolver {
}
Properties prop = getProperties();
- LOGGER.debug("Failed PAP Url List: " + prop.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS));
- LOGGER.debug("Succeeded PAP Url List: " + prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS));
- XACMLProperties.setProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS,
- prop.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS));
- XACMLProperties.setProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS,
- prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS));
+ LOGGER.debug("Failed PAP Url List: " + prop.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS));
+ LOGGER.debug("Succeeded PAP Url List: " + prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS));
+ XACMLProperties.setProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS,
+ prop.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS));
+ XACMLProperties.setProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS,
+ prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS));
}
// iterates to the next available PAP url, according to the priority order
@@ -333,7 +333,7 @@ public class PapUrlResolver {
// property)
private Date setHandler(Object time) {
if (time instanceof String) {
- if ("-1".equals((String) time)) {
+ if ("-1".equals(time)) {
return null;
}
try {
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpLoader.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpLoader.java
index 102d43f0c..52dcd96f3 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpLoader.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpLoader.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.
@@ -40,8 +40,8 @@ import java.util.Set;
import org.apache.commons.io.IOUtils;
import org.onap.policy.pdp.rest.notifications.NotificationController;
-import org.onap.policy.rest.XACMLRest;
-import org.onap.policy.rest.XACMLRestProperties;
+import org.onap.policy.rest.XacmlRest;
+import org.onap.policy.rest.XacmlRestProperties;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
@@ -68,8 +68,8 @@ import com.google.common.base.Splitter;
/**
* Does the work for loading policy and PIP configurations sent from the PAP
* servlet.
- *
- *
+ *
+ *
*
*/
public class XACMLPdpLoader {
@@ -167,7 +167,7 @@ public class XACMLPdpLoader {
// Reset our official properties the PDP factory
// uses to configure the PDP engine.
//
- XACMLRest.loadXacmlProperties(policyProperties, pipProperties);
+ XacmlRest.loadXacmlProperties(policyProperties, pipProperties);
//
// Dump ALL our properties that we are trying to load
//
@@ -195,10 +195,11 @@ public class XACMLPdpLoader {
}
private static HashMap<String, PolicyDef> policyContainer = null;
-
+
public static synchronized void sendNotification(){
Thread notify = new Thread(){
- public void run(){
+ @Override
+ public void run(){
try{
Thread.sleep(notifyDelay);
NotificationController.sendNotification();
@@ -209,7 +210,7 @@ public class XACMLPdpLoader {
};
notify.start();
}
-
+
public static synchronized void validatePolicies(Properties properties,
StdPDPStatus status) throws PAPException {
Set<String> rootPolicies = XACMLProperties.getRootPolicyIDs(properties);
@@ -239,13 +240,13 @@ public class XACMLPdpLoader {
policyContainer.clear();
}
-
+
public static synchronized void loadPolicy(Properties properties,
StdPDPStatus status, String id, boolean isRoot) throws PAPException {
PolicyDef policy = null;
String location = null;
URI locationURI = null;
- boolean isFile = false;
+ boolean isFile = false;
boolean rougeFile = false;
try {
location = properties.getProperty(id + ".file");
@@ -255,7 +256,7 @@ public class XACMLPdpLoader {
try (InputStream is = Files.newInputStream(Paths.get(location))) {
policy = DOMPolicyDef.load(is);
} catch (Exception e){
- // This Happens if a any issue with the error policyFile. Lets remove it.
+ // This Happens if a any issue with the error policyFile. Lets remove it.
try {
LOGGER.error("Corrupted policy file, deleting: " + location + e);
Files.delete(Paths.get(location));
@@ -296,8 +297,8 @@ public class XACMLPdpLoader {
papUrls.getNext();
break;
}
- urlConnection.setRequestProperty(XACMLRestProperties.PROP_PDP_HTTP_HEADER_ID,
- XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_ID));
+ urlConnection.setRequestProperty(XacmlRestProperties.PROP_PDP_HTTP_HEADER_ID,
+ XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_ID));
urlConnection.setRequestProperty("Authorization", "Basic " + encoding);
//
// Now construct the output file name
@@ -343,7 +344,7 @@ public class XACMLPdpLoader {
}
}while(error && errorCount>2);
}
- }
+ }
if (policy != null) {
status.addLoadedPolicy(new StdPDPPolicy(id, isRoot,
locationURI, properties));
@@ -373,7 +374,7 @@ public class XACMLPdpLoader {
try {
LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Corrupted policy file, deleting: " + location);
Files.delete(Paths.get(location));
-
+
} catch (IOException e1) {
LOGGER.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + e1);
}
@@ -424,10 +425,10 @@ public class XACMLPdpLoader {
* the local directory; if so create a ".file" property for it. - if not,
* get the "&lt;PolicyID&gt;.url" property and try to GET the policy from
* that location (and set the ".file" property)
- *
+ *
* If the ".file" property is created, then true is returned to tell the
* caller that the props object changed.
- *
+ *
* @param props
* @return true/false if anything was changed in the props object
* @throws PAPException
@@ -524,8 +525,8 @@ public class XACMLPdpLoader {
// Open the connection
//
URLConnection urlConnection = url.openConnection();
- urlConnection.setRequestProperty(XACMLRestProperties.PROP_PDP_HTTP_HEADER_ID,
- XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_ID));
+ urlConnection.setRequestProperty(XacmlRestProperties.PROP_PDP_HTTP_HEADER_ID,
+ XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_ID));
urlConnection.setRequestProperty("Authorization", "Basic " + encoding);
//
// Copy it to disk
@@ -619,7 +620,7 @@ public class XACMLPdpLoader {
public static synchronized Path getPDPConfig() throws PAPException {
Path config = Paths.get(XACMLProperties
- .getProperty(XACMLRestProperties.PROP_PDP_CONFIG));
+ .getProperty(XacmlRestProperties.PROP_PDP_CONFIG));
if (Files.notExists(config)) {
LOGGER.warn(XACMLErrorConstants.ERROR_PROCESS_FLOW + config.toAbsolutePath().toString() + " does NOT exist.");
//
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpRegisterThread.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpRegisterThread.java
index 66a74a44f..56d82bd3f 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpRegisterThread.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpRegisterThread.java
@@ -37,7 +37,7 @@ import java.util.UUID;
import org.apache.commons.io.IOUtils;
import org.onap.policy.pdp.rest.XACMLPdpServlet.PutRequest;
-import org.onap.policy.rest.XACMLRestProperties;
+import org.onap.policy.rest.XacmlRestProperties;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import com.att.research.xacml.util.XACMLProperties;
@@ -86,7 +86,7 @@ public class XACMLPdpRegisterThread implements Runnable {
/*
int seconds;
try {
- seconds = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_REGISTER_SLEEP));
+ seconds = Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_REGISTER_SLEEP));
} catch (NumberFormatException e) {
LOGGER.error( XACMLErrorConstants.ERROR_SYSTEM_ERROR +"REGISTER_SLEEP: ", e);
seconds = 5;
@@ -96,7 +96,7 @@ public class XACMLPdpRegisterThread implements Runnable {
}
int retries;
try {
- retries = Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_REGISTER_RETRIES));
+ retries = Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_REGISTER_RETRIES));
} catch (NumberFormatException e) {
LOGGER.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR +" REGISTER_SLEEP: ", e);
retries = -1;
@@ -130,7 +130,7 @@ public class XACMLPdpRegisterThread implements Runnable {
//
// Get the list of PAP Servlet URLs from the property file
//
- //String papUrlList = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL);
+ //String papUrlList = XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_URL);
//String[] papUrls = papUrlList.split(",");
//PapUrlResolver.setPapUrls(papUrls);
URL url = new URL(papUrls.getUrl());
@@ -149,8 +149,8 @@ public class XACMLPdpRegisterThread implements Runnable {
connection.setRequestProperty("Authorization", "Basic " + encoding);
connection.setRequestProperty("Accept", "text/x-java-properties");
connection.setRequestProperty("Content-Type", "text/x-java-properties");
- connection.setRequestProperty(XACMLRestProperties.PROP_PDP_HTTP_HEADER_ID, XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_ID));
- connection.setRequestProperty(XACMLRestProperties.PROP_PDP_HTTP_HEADER_JMX_PORT, XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_JMX_PORT));
+ connection.setRequestProperty(XacmlRestProperties.PROP_PDP_HTTP_HEADER_ID, XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_ID));
+ connection.setRequestProperty(XacmlRestProperties.PROP_PDP_HTTP_HEADER_JMX_PORT, XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_JMX_PORT));
connection.setRequestProperty("X-ECOMP-RequestID", requestID.toString());
connection.setUseCaches(false);
//
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java
index c3f0cac46..cae73ce29 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java
@@ -58,8 +58,8 @@ import org.onap.policy.common.logging.OnapLoggingUtils;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
import org.onap.policy.pdp.rest.jmx.PdpRestMonitor;
-import org.onap.policy.rest.XACMLRest;
-import org.onap.policy.rest.XACMLRestProperties;
+import org.onap.policy.rest.XacmlRest;
+import org.onap.policy.rest.XacmlRestProperties;
import org.onap.policy.utils.PeCryptoUtils;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.onap.policy.xacml.pdp.std.functions.PolicyList;
@@ -205,7 +205,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
//
// Initialize
//
- XACMLRest.xacmlInit(config);
+ XacmlRest.xacmlInit(config);
// Load the Notification Delay.
setNotificationDelay();
// Load Queue size. Not sure if we really need to have the queue bounded, we should look further into this
@@ -243,7 +243,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
"Error loading properties with: XACMLProperties.getProperties()");
throw new ServletException(e.getMessage(), e.getCause());
}
- if (properties.getProperty(XACMLRestProperties.PDP_RESOURCE_NAME) == null) {
+ if (properties.getProperty(XacmlRestProperties.PDP_RESOURCE_NAME) == null) {
XACMLProperties.reloadProperties();
try {
properties = XACMLProperties.getProperties();
@@ -269,7 +269,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
properties.getProperty("createUpdatePolicy.impl.className", CREATE_UPDATE_POLICY_SERVICE);
setCreateUpdatePolicyConstructor(createUpdateResourceName);
- PeCryptoUtils.initAesKey(properties.getProperty(XACMLRestProperties.PROP_AES_KEY));
+ PeCryptoUtils.initAesKey(properties.getProperty(XacmlRestProperties.PROP_AES_KEY));
// Create an IntegrityMonitor
try {
@@ -296,7 +296,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
//
// Kick off our thread to register with the PAP servlet.
//
- if (Boolean.parseBoolean(XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_REGISTER))) {
+ if (Boolean.parseBoolean(XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_REGISTER))) {
XACMLPdpServlet.registerRunnable = new XACMLPdpRegisterThread(baseLoggingContext);
XACMLPdpServlet.registerThread = new Thread(XACMLPdpServlet.registerRunnable);
XACMLPdpServlet.registerThread.start();
@@ -321,9 +321,9 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
}
private static void setPDPResourceName(Properties properties) throws ServletException {
- pdpResourceName = properties.getProperty(XACMLRestProperties.PDP_RESOURCE_NAME);
+ pdpResourceName = properties.getProperty(XacmlRestProperties.PDP_RESOURCE_NAME);
if (pdpResourceName == null) {
- PolicyLogger.error(MessageCodes.MISS_PROPERTY_ERROR, XACMLRestProperties.PDP_RESOURCE_NAME, "xacml.pdp");
+ PolicyLogger.error(MessageCodes.MISS_PROPERTY_ERROR, XacmlRestProperties.PDP_RESOURCE_NAME, "xacml.pdp");
throw new ServletException("pdpResourceName is null");
}
}
@@ -335,7 +335,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
private static void setNotificationDelay() {
try {
XACMLPdpServlet.notificationDelay =
- Integer.parseInt(XACMLProperties.getProperty(XACMLRestProperties.PROP_NOTIFICATION_DELAY));
+ Integer.parseInt(XACMLProperties.getProperty(XacmlRestProperties.PROP_NOTIFICATION_DELAY));
} catch (NumberFormatException e) {
logger.error("Error in notification delay format, Taking the default value.", e);
}
@@ -445,7 +445,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
// Dump our request out
//
if (logger.isDebugEnabled()) {
- XACMLRest.dumpRequest(request);
+ XacmlRest.dumpRequest(request);
}
try {
@@ -658,7 +658,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
loggingContext.metricEnded();
PolicyLogger.metrics("Metric example posted here - 2 of 2");
- XACMLRest.dumpRequest(request);
+ XacmlRest.dumpRequest(request);
String pathInfo = request.getRequestURI();
if (pathInfo != null && "/pdp/test".equals(pathInfo)) {
@@ -805,7 +805,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
}
if (returnHB) {
synchronized (pdpStatusLock) {
- response.addHeader(XACMLRestProperties.PROP_PDP_HTTP_HEADER_HB, status.getStatus().toString());
+ response.addHeader(XacmlRestProperties.PROP_PDP_HTTP_HEADER_HB, status.getStatus().toString());
}
}
loggingContext.transactionEnded();
@@ -876,7 +876,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
return;
}
- XACMLRest.dumpRequest(request);
+ XacmlRest.dumpRequest(request);
//
// Set our no-cache header
//
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 d61b7c006..1d9e3e13f 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
@@ -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.
@@ -39,7 +39,7 @@ import java.util.stream.Stream;
import org.onap.policy.api.PolicyException;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
-import org.onap.policy.rest.XACMLRestProperties;
+import org.onap.policy.rest.XacmlRestProperties;
import org.onap.policy.utils.BusPublisher;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.springframework.http.HttpStatus;
@@ -99,7 +99,7 @@ public class NotificationService {
private static void init() {
if (dmaapServers == null || aafLogin == null || aafPassword == null) {
- dmaapServers = XACMLProperties.getProperty(XACMLRestProperties.PROP_NOTIFICATION_SERVERS);
+ dmaapServers = XACMLProperties.getProperty(XacmlRestProperties.PROP_NOTIFICATION_SERVERS);
aafLogin = XACMLProperties.getProperty("DMAAP_AAF_LOGIN");
aafPassword = XACMLProperties.getProperty("DMAAP_AAF_PASSWORD");
interval =
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PAPServices.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PAPServices.java
index 822599f13..516d873d4 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PAPServices.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PAPServices.java
@@ -41,7 +41,7 @@ import org.onap.policy.api.PolicyException;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.pdp.rest.restauth.AuthenticationService;
-import org.onap.policy.rest.XACMLRestProperties;
+import org.onap.policy.rest.XacmlRestProperties;
import org.onap.policy.utils.PeCryptoUtils;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.onap.policy.xacml.std.pap.StdPDPPolicy;
@@ -67,9 +67,9 @@ public class PAPServices {
environment = AuthenticationService.getEnvironment();
if (paps == null) {
synchronized (papResourceLock) {
- String urlList = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URLS);
+ String urlList = XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_URLS);
if (urlList == null) {
- urlList = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_URL);
+ urlList = XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_URL);
}
paps = Arrays.asList(urlList.split(","));
}
@@ -78,8 +78,8 @@ public class PAPServices {
private String getPAPEncoding() {
if (encoding == null) {
- String userID = XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_USERID);
- String pass = PeCryptoUtils.decrypt(XACMLProperties.getProperty(XACMLRestProperties.PROP_PAP_PASS));
+ String userID = XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_USERID);
+ String pass = PeCryptoUtils.decrypt(XACMLProperties.getProperty(XacmlRestProperties.PROP_PAP_PASS));
Base64.Encoder encoder = Base64.getEncoder();
encoding = encoder.encodeToString((userID + ":" + pass).getBytes(StandardCharsets.UTF_8));
}
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java
index e61bbd3aa..9a5fc5ef2 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/api/services/PDPServices.java
@@ -8,9 +8,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.
@@ -70,7 +70,7 @@ import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.pdp.rest.XACMLPdpServlet;
import org.onap.policy.pdp.rest.api.models.PDPResponse;
-import org.onap.policy.rest.XACMLRestProperties;
+import org.onap.policy.rest.XacmlRestProperties;
import org.onap.policy.std.Matches;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.w3c.dom.Document;
@@ -207,7 +207,7 @@ public class PDPServices {
if (uri == 1) {
configUrl = attribute.getAttributeValue().getValue().toString();
pdpConfigLocation = configUrl.replace("$URL",
- XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_WEBAPPS));
+ XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_WEBAPPS));
} else {
if (!("PDP".equalsIgnoreCase(attribute.getIssuer()))) {
throw new PolicyException(XACMLErrorConstants.ERROR_DATA_ISSUE
@@ -350,7 +350,7 @@ public class PDPServices {
/**
* Process Decision Result.
- *
+ *
* @param result input from Response.
* @return pdpResposne based on result.
*/
@@ -388,7 +388,7 @@ public class PDPServices {
/**
* Check for Decision for decision based calls.
- *
+ *
* @param pdpResponseInput pdpResponse.
* @param result result.
* @return pdpResponse.
@@ -420,7 +420,7 @@ public class PDPServices {
/**
* Check if there is a configuration.
- *
+ *
* @param advice advice.
* @param configRetrieved boolean.
* @param pdpResponse pdpResposneInput.
@@ -431,7 +431,7 @@ public class PDPServices {
if (attribute.getDataTypeId().stringValue().endsWith("anyURI")) {
String configUrl = attribute.getAttributeValue().getValue().toString();
String pdpConfigLocation =
- configUrl.replace("$URL", XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_WEBAPPS));
+ configUrl.replace("$URL", XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_WEBAPPS));
// If there is a configuration.
try {
LOGGER.debug("processDecisionResult: Configuration Call to : " + configUrl);
@@ -615,7 +615,7 @@ public class PDPServices {
/**
* Returns the requestFormat.
- *
+ *
* @return the requestFormat.
*/
public String getRequestFormat() {
@@ -624,7 +624,7 @@ public class PDPServices {
/**
* Set the Request Format.
- *
+ *
* @param requestMode to set requestFormat.
*/
public void setRequestFormat(String requestMode) {
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/ManualNotificationUpdateThread.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/ManualNotificationUpdateThread.java
index 9027e27a5..9c75e1e38 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/ManualNotificationUpdateThread.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/ManualNotificationUpdateThread.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.
@@ -31,7 +31,7 @@ import java.util.UUID;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
-import org.onap.policy.rest.XACMLRestProperties;
+import org.onap.policy.rest.XacmlRestProperties;
import org.onap.policy.utils.BusConsumer;
import org.onap.policy.utils.BusPublisher;
import org.onap.policy.xacml.api.XACMLErrorConstants;
@@ -67,9 +67,9 @@ public class ManualNotificationUpdateThread implements Runnable {
}
/**
- *
+ *
* This is our thread that runs on startup if the system is configured to UEB to accept manual update requests
- *
+ *
*/
@Override
public void run() {
@@ -85,7 +85,7 @@ public class ManualNotificationUpdateThread implements Runnable {
if ("ueb".equals(propNotificationType)) {
try {
setCluster();
- String url = XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_ID);
+ String url = XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_ID);
aURL = new URL(url);
topic = aURL.getHost() + aURL.getPort();
} catch (NumberFormatException e) {
@@ -129,8 +129,8 @@ public class ManualNotificationUpdateThread implements Runnable {
} else if ("dmaap".equals(propNotificationType)) {
String dmaapServers = null;
try {
- dmaapServers = XACMLProperties.getProperty(XACMLRestProperties.PROP_NOTIFICATION_SERVERS);
- topic = XACMLProperties.getProperty(XACMLRestProperties.PROP_NOTIFICATION_TOPIC);
+ dmaapServers = XACMLProperties.getProperty(XacmlRestProperties.PROP_NOTIFICATION_SERVERS);
+ topic = XACMLProperties.getProperty(XacmlRestProperties.PROP_NOTIFICATION_TOPIC);
setAAFCreds();
} catch (Exception e) {
LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Unable to get DMaaP servers list:", e);
@@ -145,7 +145,7 @@ public class ManualNotificationUpdateThread implements Runnable {
dmaapServers = dmaapServers.trim();
topic = topic.trim();
- String consumerTopic = XACMLProperties.getProperty(XACMLRestProperties.PROP_NOTIFICATION_TOPIC).trim();
+ String consumerTopic = XACMLProperties.getProperty(XacmlRestProperties.PROP_NOTIFICATION_TOPIC).trim();
sendMessage(consumerTopic, "Starting-Topic");
dmaapList = new ArrayList<>();
for (String u : dmaapServers.split(",")) {
@@ -189,14 +189,14 @@ public class ManualNotificationUpdateThread implements Runnable {
}
private static void setCluster() {
- clusterList = XACMLProperties.getProperty(XACMLRestProperties.PROP_NOTIFICATION_SERVERS);
+ clusterList = XACMLProperties.getProperty(XacmlRestProperties.PROP_NOTIFICATION_SERVERS);
if (clusterList != null) {
clusterList = clusterList.trim();
}
}
private static void setPropNotification() {
- propNotificationType = XACMLProperties.getProperty(XACMLRestProperties.PROP_NOTIFICATION_TYPE);
+ propNotificationType = XACMLProperties.getProperty(XacmlRestProperties.PROP_NOTIFICATION_TYPE);
}
private void sendMessage(String topic, String message) {
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/NotificationController.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/NotificationController.java
index c62872fbd..974ca5c01 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/NotificationController.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/NotificationController.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.
@@ -44,7 +44,7 @@ import org.onap.policy.api.UpdateType;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.pdp.rest.PapUrlResolver;
-import org.onap.policy.rest.XACMLRestProperties;
+import org.onap.policy.rest.XacmlRestProperties;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import com.att.research.xacml.api.pap.PDPPolicy;
@@ -61,7 +61,7 @@ import com.fasterxml.jackson.databind.ObjectWriter;
/**
* NotificationController Checks for the Updated and Removed policies. It notifies the Server to send Notifications to
* the Client.
- *
+ *
* @version 0.2
*
*/
@@ -81,7 +81,7 @@ public class NotificationController {
private static Boolean notificationFlag = false;
public void check(PDPStatus newStatus, Map<String, PolicyDef> policyContainer) {
-
+
LOGGER.info("NotificationController: checking for updated and removed policies.");
boolean isUpdated = false;
boolean isRemoved = false;
@@ -101,7 +101,7 @@ public class NotificationController {
LOGGER.info("There is an Update to the PDP");
LOGGER.debug(oldStatus.getLoadedPolicies());
LOGGER.debug(newStatus.getLoadedPolicies());
-
+
// Check if there is an Update/additions in the policy.
LOGGER.info("NotificationController: check for updated or new policies");
for (PDPPolicy newPolicy : newStatus.getLoadedPolicies()) {
@@ -191,8 +191,8 @@ public class NotificationController {
}
private static void setPropNotification() {
- propNotificationType = XACMLProperties.getProperty(XACMLRestProperties.PROP_NOTIFICATION_TYPE);
- pdpURL = XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_ID);
+ propNotificationType = XACMLProperties.getProperty(XacmlRestProperties.PROP_NOTIFICATION_TYPE);
+ pdpURL = XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_ID);
}
public static void sendNotification() {
@@ -382,7 +382,7 @@ public class NotificationController {
private void removeFile(PDPPolicy oldPolicy) {
try {
- Path removedPolicyFile = Paths.get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_CONFIG)
+ Path removedPolicyFile = Paths.get(XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_CONFIG)
+ File.separator + oldPolicy.getId());
Files.deleteIfExists(removedPolicyFile);
boolean delete = false;
@@ -390,11 +390,11 @@ public class NotificationController {
if (oldPolicy.getName().contains(".Config_")) {
delete = true;
dir = new File(
- XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_WEBAPPS) + File.separator + "Config");
+ XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_WEBAPPS) + File.separator + "Config");
} else if (oldPolicy.getName().contains(".Action_")) {
delete = true;
dir = new File(
- XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_WEBAPPS) + File.separator + "Action");
+ XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_WEBAPPS) + File.separator + "Action");
}
if (delete) {
FileFilter fileFilter = new WildcardFileFilter(
@@ -412,7 +412,7 @@ public class NotificationController {
private void callPap(String urlString, String type) {
Path configLocation = Paths
- .get(XACMLProperties.getProperty(XACMLRestProperties.PROP_PDP_WEBAPPS) + File.separator + type);
+ .get(XACMLProperties.getProperty(XacmlRestProperties.PROP_PDP_WEBAPPS) + File.separator + type);
if (Files.notExists(configLocation)) {
try {
Files.createDirectories(configLocation);
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/NotificationServer.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/NotificationServer.java
index 4c2d1ef57..8c962192b 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/NotificationServer.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/notifications/NotificationServer.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.
@@ -44,7 +44,7 @@ import org.onap.policy.common.logging.eelf.PolicyLogger;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.pdp.rest.api.services.NotificationService;
-import org.onap.policy.rest.XACMLRestProperties;
+import org.onap.policy.rest.XacmlRestProperties;
import org.onap.policy.utils.BusPublisher;
import org.onap.policy.xacml.api.XACMLErrorConstants;
@@ -57,8 +57,8 @@ import com.att.research.xacml.util.XACMLProperties;
* The NotificationServer sends the Server Notifications to the Clients once there is any Event.
* WebSockets is being used as a medium for sending Notifications.
* UEB is being used as a medium for sending Notifications.
- * DMAAP is being used as a medium for sending Notifications.
- *
+ * DMAAP is being used as a medium for sending Notifications.
+ *
* @version 0.2
*
**/
@@ -67,28 +67,28 @@ public class NotificationServer {
private static final Logger LOGGER = FlexLogger.getLogger(NotificationServer.class);
private static Queue<Session> queue = new ConcurrentLinkedQueue<>();
private static String update = null;
-
+
@OnOpen
public void openConnection(Session session) {
LOGGER.info("Session Connected: " + session.getId());
queue.add(session);
}
-
+
@OnClose
public void closeConnection(Session session) {
queue.remove(session);
}
-
+
@OnError
public void error(Session session, Throwable t) {
queue.remove(session);
LOGGER.info(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Session Error for : " + session.getId() + " Error: " + t.getMessage());
-
+
}
-
+
@OnMessage
public void message(String message, Session session) {
-
+
if(message.equalsIgnoreCase("Manual")) {
try {
session.getBasicRemote().sendText(update);
@@ -96,7 +96,7 @@ public class NotificationServer {
} catch (IOException e) {
LOGGER.info(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error in sending the Event Notification: "+ e.getMessage() + e);
LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error sending Message update");
- }
+ }
}
}
@@ -115,9 +115,9 @@ public class NotificationServer {
LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error in parsing out pdpURL for UEB notfication ");
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e1, "Error in parsing out pdpURL for UEB notfication ");
}
- String hosts = XACMLProperties.getProperty(XACMLRestProperties.PROP_NOTIFICATION_SERVERS);
- String apiKey = XACMLProperties.getProperty(XACMLRestProperties.PROP_UEB_API_KEY);
- String apiSecret = XACMLProperties.getProperty(XACMLRestProperties.PROP_UEB_API_SECRET);
+ String hosts = XACMLProperties.getProperty(XacmlRestProperties.PROP_NOTIFICATION_SERVERS);
+ String apiKey = XACMLProperties.getProperty(XacmlRestProperties.PROP_UEB_API_KEY);
+ String apiSecret = XACMLProperties.getProperty(XacmlRestProperties.PROP_UEB_API_SECRET);
LOGGER.debug("Creating Publisher for host: " + hosts + " with topic: " + topic);
CambriaBatchingPublisher pub = null;
@@ -164,24 +164,24 @@ public class NotificationServer {
}
}
} else if (propNotificationType.equals("dmaap")) {
-
+
// Setting up the Publisher for DMaaP MR
- String dmaapServers = XACMLProperties.getProperty(XACMLRestProperties.PROP_NOTIFICATION_SERVERS);
- String topic = XACMLProperties.getProperty(XACMLRestProperties.PROP_NOTIFICATION_TOPIC);
+ String dmaapServers = XACMLProperties.getProperty(XacmlRestProperties.PROP_NOTIFICATION_SERVERS);
+ String topic = XACMLProperties.getProperty(XacmlRestProperties.PROP_NOTIFICATION_TOPIC);
String aafLogin = XACMLProperties.getProperty("DMAAP_AAF_LOGIN");
String aafPassword = XACMLProperties.getProperty("DMAAP_AAF_PASSWORD");
-
+
try {
if(dmaapServers==null || topic==null){
LOGGER.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "DMaaP properties are missing from the property file ");
throw new PolicyEngineException(XACMLErrorConstants.ERROR_DATA_ISSUE + "DMaaP properties are missing from the property file ");
}
-
+
dmaapServers= dmaapServers.trim();
topic= topic.trim();
aafLogin= aafLogin.trim();
aafPassword= aafPassword.trim();
-
+
List<String> dmaapList = null;
if(dmaapServers.contains(",")) {
dmaapList = new ArrayList<>(Arrays.asList(dmaapServers.split("\\s*,\\s*")));
@@ -189,23 +189,23 @@ public class NotificationServer {
dmaapList = new ArrayList<>();
dmaapList.add(dmaapServers);
}
-
- BusPublisher publisher =
- new BusPublisher.DmaapPublisherWrapper(dmaapList,
- topic,
- aafLogin,
+
+ BusPublisher publisher =
+ new BusPublisher.DmaapPublisherWrapper(dmaapList,
+ topic,
+ aafLogin,
aafPassword);
-
+
// Sending notification through DMaaP Message Router
publisher.send( "MyPartitionKey", notification);
LOGGER.debug("Message Published on DMaaP :" + dmaapList.get(0) + "for Topic: " + topic);
publisher.close();
-
+
} catch (Exception e) {
LOGGER.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error sending notification update" + e.getMessage() + e);
}
}
-
+
for(Session session: queue) {
try {
LOGGER.info("\n Sending Notification: " + notification + " for client session id: " + session.getId() + "\n "
@@ -216,12 +216,12 @@ public class NotificationServer {
LOGGER.info(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Error in sending the Event Notification: "+ e.getMessage() + e);
}
}
-
+
NotificationService.sendNotification(notification);
}
public static void setUpdate(String update) {
NotificationServer.update = update;
}
-
+
}
diff --git a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/restauth/AuthenticationService.java b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/restauth/AuthenticationService.java
index 87a46aa23..54a5151c4 100644
--- a/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/restauth/AuthenticationService.java
+++ b/ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/restauth/AuthenticationService.java
@@ -42,7 +42,7 @@ import org.onap.policy.api.PolicyEngineException;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
-import org.onap.policy.rest.XACMLRestProperties;
+import org.onap.policy.rest.XacmlRestProperties;
import org.onap.policy.utils.AAFPolicyClient;
import org.onap.policy.utils.AAFPolicyException;
import org.onap.policy.utils.PeCryptoUtils;
@@ -66,7 +66,7 @@ public class AuthenticationService {
*/
private static void setProperty() {
environment = XACMLProperties.getProperty("ENVIRONMENT", "DEVL");
- String clientFile = XACMLProperties.getProperty(XACMLRestProperties.PROP_PEP_IDFILE);
+ String clientFile = XACMLProperties.getProperty(XacmlRestProperties.PROP_PEP_IDFILE);
if (clientFile != null) {
clientPath = Paths.get(clientFile);
}
diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java
index cf3ddb3b2..fb768f7d7 100644
--- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java
+++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/PapUrlResolverTest.java
@@ -28,7 +28,7 @@ import java.util.Date;
import java.util.Properties;
import org.junit.Assert;
import org.junit.Test;
-import org.onap.policy.rest.XACMLRestProperties;
+import org.onap.policy.rest.XacmlRestProperties;
public class PapUrlResolverTest {
@@ -41,7 +41,7 @@ public class PapUrlResolverTest {
String failed = "-1,-1,-1,-1";
String succeeded = "-1,-1,-1,-1";
PapUrlResolver rs = PapUrlResolver.getInstance(urls, failed, succeeded);
- Assert.assertEquals(rs.getProperties().getProperty(XACMLRestProperties.PROP_PAP_URLS),
+ Assert.assertEquals(rs.getProperties().getProperty(XacmlRestProperties.PROP_PAP_URLS),
urls);
rs.failed();
@@ -51,12 +51,12 @@ public class PapUrlResolverTest {
Assert.assertFalse(rs.hasMoreUrls());
Properties prop = rs.getProperties();
Assert.assertEquals(df.format(new Date()) + ",-1,-1,-1",
- prop.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS));
+ prop.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS));
Assert.assertEquals("-1," + df.format(new Date()) + ",-1,-1",
- prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS));
+ prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS));
- failed = prop.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS);
- succeeded = prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS);
+ failed = prop.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS);
+ succeeded = prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS);
rs = PapUrlResolver.getInstance(urls, failed, succeeded);
Assert.assertTrue(rs.hasMoreUrls());
Assert.assertEquals("http://two.localhost.com", rs.getUrl());
@@ -74,10 +74,10 @@ public class PapUrlResolverTest {
Assert.assertFalse(rs.hasMoreUrls());
prop = rs.getProperties();
Assert.assertEquals("-1,-1,-1,-1",
- prop.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS));
+ prop.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS));
- failed = prop.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS);
- succeeded = prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS);
+ failed = prop.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS);
+ succeeded = prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS);
rs = PapUrlResolver.getInstance(urls, failed, succeeded);
Assert.assertTrue(rs.hasMoreUrls());
Assert.assertEquals("http://one.localhost.com", rs.getUrl());
@@ -85,8 +85,8 @@ public class PapUrlResolverTest {
rs.getNext();
Assert.assertFalse(rs.hasMoreUrls());
prop = rs.getProperties();
- failed = prop.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS);
- succeeded = prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS);
+ failed = prop.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS);
+ succeeded = prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS);
rs = PapUrlResolver.getInstance(urls, failed, succeeded);
Assert.assertTrue(rs.hasMoreUrls());
Assert.assertEquals("http://one.localhost.com", rs.getUrl());
@@ -94,8 +94,8 @@ public class PapUrlResolverTest {
rs.getNext();
Assert.assertFalse(rs.hasMoreUrls());
prop = rs.getProperties();
- failed = prop.getProperty(XACMLRestProperties.PROP_PAP_FAILED_URLS);
- succeeded = prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS);
+ failed = prop.getProperty(XacmlRestProperties.PROP_PAP_FAILED_URLS);
+ succeeded = prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS);
rs = PapUrlResolver.getInstance(urls, failed, succeeded);
Assert.assertTrue(rs.hasMoreUrls());
Assert.assertEquals("http://one.localhost.com", rs.getUrl());
@@ -104,7 +104,7 @@ public class PapUrlResolverTest {
Assert.assertFalse(rs.hasMoreUrls());
prop = rs.getProperties();
- succeeded = prop.getProperty(XACMLRestProperties.PROP_PAP_SUCCEEDED_URLS);
+ succeeded = prop.getProperty(XacmlRestProperties.PROP_PAP_SUCCEEDED_URLS);
}
@SuppressWarnings("unused")