summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiService.java10
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/UpdatePdpThread.java24
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/XACMLPapServlet.java60
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/APIRequestHandler.java4
-rw-r--r--ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java6
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiServiceTest.java4
-rw-r--r--ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java4
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpRegisterThread.java18
-rw-r--r--ONAP-PDP-REST/src/main/java/org/onap/policy/pdp/rest/XACMLPdpServlet.java54
-rw-r--r--ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java6
-rw-r--r--ONAP-PDP/src/test/java/org/onap/policy/xacml/action/FindActionTest.java9
11 files changed, 100 insertions, 99 deletions
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiService.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiService.java
index 52e4060b5..bde5e5f09 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiService.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiService.java
@@ -35,7 +35,7 @@ import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.onap.policy.common.logging.ONAPLoggingContext;
+import org.onap.policy.common.logging.OnapLoggingContext;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
@@ -79,7 +79,7 @@ public class ConsoleAndApiService {
* @throws IOException Signals that an I/O exception has occurred.
*/
public void doAcPost(HttpServletRequest request, HttpServletResponse response, String groupId,
- ONAPLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
+ OnapLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
PolicyDBDaoTransaction doAcPostTransaction = null;
try {
String groupName = request.getParameter("groupName");
@@ -370,7 +370,7 @@ public class ConsoleAndApiService {
* @throws IOException Signals that an I/O exception has occurred.
*/
public void doAcGet(HttpServletRequest request, HttpServletResponse response, String groupId,
- ONAPLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
+ OnapLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
try {
String parameterDefault = request.getParameter("default");
String pdpId = request.getParameter("pdpId");
@@ -572,7 +572,7 @@ public class ConsoleAndApiService {
* @throws IOException Signals that an I/O exception has occurred.
*/
public void doAcPut(HttpServletRequest request, HttpServletResponse response, String groupId,
- ONAPLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
+ OnapLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
PolicyDBDaoTransaction acPutTransaction = XACMLPapServlet.getPolicyDbDao().getNewTransaction();
try {
String userId = request.getParameter("userId");
@@ -816,7 +816,7 @@ public class ConsoleAndApiService {
* @throws IOException Signals that an I/O exception has occurred.
*/
public void doAcDelete(HttpServletRequest request, HttpServletResponse response, String groupId,
- ONAPLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
+ OnapLoggingContext loggingContext, PAPPolicyEngine papEngine) throws IOException {
PolicyDBDaoTransaction removePdpOrGroupTransaction = XACMLPapServlet.getPolicyDbDao().getNewTransaction();
try {
// for all DELETE operations the group must exist before the
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/UpdatePdpThread.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/UpdatePdpThread.java
index 11576d314..c912a8047 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/UpdatePdpThread.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/UpdatePdpThread.java
@@ -28,7 +28,7 @@ import java.net.URL;
import java.util.List;
import java.util.Properties;
import java.util.UUID;
-import org.onap.policy.common.logging.ONAPLoggingContext;
+import org.onap.policy.common.logging.OnapLoggingContext;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
@@ -39,14 +39,14 @@ import org.onap.policy.xacml.api.pap.OnapPDP;
public class UpdatePdpThread implements Runnable {
private static final Logger LOGGER = FlexLogger.getLogger(UpdatePdpThread.class);
- private ONAPLoggingContext baseLoggingContext = new XACMLPapServlet().getBaseLoggingContext();
+ private OnapLoggingContext baseLoggingContext = new XACMLPapServlet().getBaseLoggingContext();
private static final Logger auditLogger = FlexLogger.getLogger("auditLogger");
private static final String XACMLPAPSERVLET = "XACMLPapServlet";
private static final String MESSAGE = " message: ";
private OnapPDP pdp;
private String requestId;
- private ONAPLoggingContext loggingContext;
+ private OnapLoggingContext loggingContext;
private List<Properties> properties;
@@ -62,11 +62,11 @@ public class UpdatePdpThread implements Runnable {
* @param loggingContext the logging context
* @param properties the properties
*/
- public UpdatePdpThread(OnapPDP pdp, ONAPLoggingContext loggingContext, List<Properties> properties) {
+ public UpdatePdpThread(OnapPDP pdp, OnapLoggingContext loggingContext, List<Properties> properties) {
this.pdp = pdp;
if (loggingContext != null
- && (loggingContext.getRequestID() != null || "".equals(loggingContext.getRequestID()))) {
- this.requestId = loggingContext.getRequestID();
+ && (loggingContext.getRequestId() != null || "".equals(loggingContext.getRequestId()))) {
+ this.requestId = loggingContext.getRequestId();
}
this.loggingContext = loggingContext;
this.properties = properties;
@@ -79,7 +79,7 @@ public class UpdatePdpThread implements Runnable {
// get a new logging context for the thread
try {
if (this.loggingContext == null) {
- loggingContext = new ONAPLoggingContext(baseLoggingContext);
+ loggingContext = new OnapLoggingContext(baseLoggingContext);
}
} catch (Exception e) {
PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, XACMLPAPSERVLET,
@@ -95,14 +95,14 @@ public class UpdatePdpThread implements Runnable {
// post to loggingContext to be used later when calling PDP
if (requestId == null || "".equals(requestId)) {
UUID requestId = UUID.randomUUID();
- loggingContext.setRequestID(requestId.toString());
+ loggingContext.setRequestId(requestId.toString());
PolicyLogger
.info("requestID not provided in call to XACMLPapSrvlet (UpdatePDPThread) so we generated one: "
- + loggingContext.getRequestID());
+ + loggingContext.getRequestId());
} else {
- loggingContext.setRequestID(requestId);
+ loggingContext.setRequestId(requestId);
PolicyLogger.info("requestID was provided in call to XACMLPapSrvlet (UpdatePDPThread): "
- + loggingContext.getRequestID());
+ + loggingContext.getRequestId());
}
loggingContext.transactionStarted();
// the Id of the PDP is its URL
@@ -120,7 +120,7 @@ public class UpdatePdpThread implements Runnable {
connection.setRequestProperty("Authorization", "Basic " + encoding);
}
connection.setRequestProperty("Content-Type", "text/x-java-properties");
- connection.setRequestProperty("X-ECOMP-RequestID", loggingContext.getRequestID());
+ connection.setRequestProperty("X-ECOMP-RequestID", loggingContext.getRequestId());
connection.setInstanceFollowRedirects(true);
connection.setDoOutput(true);
if (!writePropertiesToStream(connection)) {
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/XACMLPapServlet.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/XACMLPapServlet.java
index 85315ca54..8dc52b861 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/XACMLPapServlet.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/XACMLPapServlet.java
@@ -20,13 +20,6 @@
package org.onap.policy.pap.xacml.rest;
-import com.att.research.xacml.api.pap.PAPException;
-import com.att.research.xacml.api.pap.PDPPolicy;
-import com.att.research.xacml.api.pap.PDPStatus;
-import com.att.research.xacml.util.FactoryException;
-import com.att.research.xacml.util.XACMLProperties;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.common.base.Splitter;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -59,8 +52,8 @@ import org.onap.policy.common.im.IntegrityMonitor;
import org.onap.policy.common.im.IntegrityMonitorException;
import org.onap.policy.common.im.IntegrityMonitorProperties;
import org.onap.policy.common.im.StandbyStatusException;
-import org.onap.policy.common.logging.ONAPLoggingContext;
-import org.onap.policy.common.logging.ONAPLoggingUtils;
+import org.onap.policy.common.logging.OnapLoggingContext;
+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.common.logging.flexlogger.FlexLogger;
@@ -87,6 +80,13 @@ import org.onap.policy.xacml.std.pap.StdPDPGroup;
import org.onap.policy.xacml.std.pap.StdPDPItemSetChangeNotifier.StdItemSetChangeListener;
import org.onap.policy.xacml.std.pap.StdPDPPolicy;
import org.onap.policy.xacml.std.pap.StdPDPStatus;
+import com.att.research.xacml.api.pap.PAPException;
+import com.att.research.xacml.api.pap.PDPPolicy;
+import com.att.research.xacml.api.pap.PDPStatus;
+import com.att.research.xacml.util.FactoryException;
+import com.att.research.xacml.util.XACMLProperties;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.base.Splitter;
/**
* Servlet implementation class XacmlPapServlet.
@@ -158,7 +158,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
* this servlet starts. Its configurable by the admin.
*/
private static transient Thread initiateThread = null;
- private transient ONAPLoggingContext baseLoggingContext = null;
+ private transient OnapLoggingContext baseLoggingContext = null;
private static final String GROUPID = "groupId";
/**
@@ -175,7 +175,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
public void init(ServletConfig config) throws ServletException {
try {
// Logging
- baseLoggingContext = new ONAPLoggingContext();
+ baseLoggingContext = new OnapLoggingContext();
// fixed data that will be the same in all logging output goes here
try {
String hostname = InetAddress.getLocalHost().getCanonicalHostName();
@@ -546,8 +546,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- ONAPLoggingContext loggingContext =
- ONAPLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
+ OnapLoggingContext loggingContext =
+ OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
setLoggingContext(loggingContext, "doPost", "PAP.post");
PolicyDBDaoTransaction pdpTransaction = null;
try {
@@ -810,8 +810,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- ONAPLoggingContext loggingContext =
- ONAPLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
+ OnapLoggingContext loggingContext =
+ OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
setLoggingContext(loggingContext, "doGet", "PAP.get");
loggingContext.metricStarted();
XACMLRest.dumpRequest(request);
@@ -1017,8 +1017,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
@Override
protected void doPut(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- ONAPLoggingContext loggingContext =
- ONAPLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
+ OnapLoggingContext loggingContext =
+ OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
setLoggingContext(loggingContext, "doPut", "PAP.put");
try {
loggingContext.metricStarted();
@@ -1234,8 +1234,8 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
@Override
protected void doDelete(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- ONAPLoggingContext loggingContext =
- ONAPLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
+ OnapLoggingContext loggingContext =
+ OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
setLoggingContext(loggingContext, "doDelete", "PAP.delete");
try {
loggingContext.metricStarted();
@@ -1397,7 +1397,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
* @throws IOException
*/
public void updateGroupsFromAPI(HttpServletRequest request, HttpServletResponse response,
- String groupId, ONAPLoggingContext loggingContext) throws IOException {
+ String groupId, OnapLoggingContext loggingContext) throws IOException {
PolicyDBDaoTransaction acPutTransaction = policyDbDao.getNewTransaction();
PolicyLogger.audit("PolicyDBDaoTransaction started for updateGroupsFromAPI");
try {
@@ -1541,7 +1541,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
}
}
- public void changed(ONAPLoggingContext loggingContext) {
+ public void changed(OnapLoggingContext loggingContext) {
// all PDPs in all groups need to be updated/sync'd
Set<OnapPDPGroup> groups;
try {
@@ -1565,7 +1565,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
}
}
- public void groupChanged(OnapPDPGroup group, ONAPLoggingContext loggingContext) {
+ public void groupChanged(OnapPDPGroup group, OnapLoggingContext loggingContext) {
// all PDPs within one group need to be updated/sync'd
for (OnapPDP pdp : group.getOnapPdps()) {
pdpChanged(pdp, loggingContext, getPdpDataByGroup(group));
@@ -1585,7 +1585,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
}
}
- public void pdpChanged(OnapPDP pdp, ONAPLoggingContext loggingContext) {
+ public void pdpChanged(OnapPDP pdp, OnapLoggingContext loggingContext) {
// kick off a thread to do an event notification for each PDP.
// This needs to be on a separate thread so that PDPs that do not
// respond (down, non-existent, etc)
@@ -1604,7 +1604,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
}
}
- private void pdpChanged(OnapPDP pdp, ONAPLoggingContext loggingContext,
+ private void pdpChanged(OnapPDP pdp, OnapLoggingContext loggingContext,
List<Properties> pdpDataByGroup) {
Thread t = new Thread(new UpdatePdpThread(pdp, loggingContext, pdpDataByGroup));
if (CheckPDP.validateID(pdp.getId())) {
@@ -1622,7 +1622,7 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
return dataToNotify.setPolicyConfigProperties(pdp, papEngine);
}
- private void testService(ONAPLoggingContext loggingContext, HttpServletResponse response)
+ private void testService(OnapLoggingContext loggingContext, HttpServletResponse response)
throws IOException {
LOGGER.info("Test request received");
try {
@@ -1686,13 +1686,13 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
}
}
- private void setLoggingContext(ONAPLoggingContext loggingContext, String methodType,
+ private void setLoggingContext(OnapLoggingContext loggingContext, String methodType,
String serviceName) {
loggingContext.transactionStarted();
loggingContext.setServiceName(serviceName);
- if (loggingContext.getRequestID() == null || "".equals(loggingContext.getRequestID())) {
+ if (loggingContext.getRequestId() == null || "".equals(loggingContext.getRequestId())) {
UUID requestID = UUID.randomUUID();
- loggingContext.setRequestID(requestID.toString());
+ loggingContext.setRequestId(requestID.toString());
PolicyLogger.info("requestID not provided in call to XACMLPapServlet ('" + methodType
+ "') so we generated one");
} else {
@@ -1842,11 +1842,11 @@ public class XACMLPapServlet extends HttpServlet implements StdItemSetChangeList
XACMLPapServlet.msPolicyName = msPolicyName;
}
- public ONAPLoggingContext getBaseLoggingContext() {
+ public OnapLoggingContext getBaseLoggingContext() {
return baseLoggingContext;
}
- public void setBaseLoggingContext(ONAPLoggingContext baseLoggingContext) {
+ public void setBaseLoggingContext(OnapLoggingContext baseLoggingContext) {
this.baseLoggingContext = baseLoggingContext;
}
}
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/APIRequestHandler.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/APIRequestHandler.java
index 5bea62dff..46c2b1160 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/APIRequestHandler.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/APIRequestHandler.java
@@ -23,7 +23,7 @@ package org.onap.policy.pap.xacml.rest.handler;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.onap.policy.common.logging.ONAPLoggingContext;
+import org.onap.policy.common.logging.OnapLoggingContext;
import org.onap.policy.pap.xacml.rest.service.ImportService;
import org.onap.policy.pap.xacml.rest.service.MetricService;
import org.onap.policy.xacml.api.pap.OnapPDPGroup;
@@ -97,7 +97,7 @@ public class APIRequestHandler {
* @param apiflag the apiflag
* @throws IOException Signals that an I/O exception has occurred.
*/
- public void doDelete(HttpServletRequest request, HttpServletResponse response, ONAPLoggingContext loggingContext,
+ public void doDelete(HttpServletRequest request, HttpServletResponse response, OnapLoggingContext loggingContext,
String apiflag) throws IOException {
DeleteHandler deleteHandler = DeleteHandler.getInstance();
if ("deletePapApi".equalsIgnoreCase(apiflag)) {
diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java
index 92e43c62f..fd98279e9 100644
--- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java
+++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandler.java
@@ -31,7 +31,7 @@ import javax.script.SimpleBindings;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang3.StringUtils;
-import org.onap.policy.common.logging.ONAPLoggingContext;
+import org.onap.policy.common.logging.OnapLoggingContext;
import org.onap.policy.common.logging.eelf.MessageCodes;
import org.onap.policy.common.logging.eelf.PolicyLogger;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
@@ -352,7 +352,7 @@ public class DeleteHandler {
* @throws IOException Signals that an I/O exception has occurred.
*/
public void doApiDeleteFromPdp(HttpServletRequest request, HttpServletResponse response,
- ONAPLoggingContext loggingContext) throws IOException {
+ OnapLoggingContext loggingContext) throws IOException {
String groupId = request.getParameter("groupId");
@@ -449,7 +449,7 @@ public class DeleteHandler {
}
}
- private String deletePolicyFromPdpGroup(OnapPDPGroup group, ONAPLoggingContext loggingContext, String userId) {
+ private String deletePolicyFromPdpGroup(OnapPDPGroup group, OnapLoggingContext loggingContext, String userId) {
PolicyDBDaoTransaction acPutTransaction = XACMLPapServlet.getDbDaoTransaction();
String response = null;
loggingContext.setServiceName("API:PAP.DeleteHandler");
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiServiceTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiServiceTest.java
index 0cd70f9b5..49120a0d9 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiServiceTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/ConsoleAndApiServiceTest.java
@@ -46,7 +46,7 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.mockito.Mockito;
-import org.onap.policy.common.logging.ONAPLoggingContext;
+import org.onap.policy.common.logging.OnapLoggingContext;
import org.onap.policy.pap.xacml.rest.components.ConfigPolicy;
import org.onap.policy.pap.xacml.rest.components.Policy;
import org.onap.policy.pap.xacml.rest.components.PolicyDBDao;
@@ -83,7 +83,7 @@ public class ConsoleAndApiServiceTest {
private static final String USER_ID = "userId";
private static final String APIFLAG = "apiflag";
private static final String ENVIRONMENT_HEADER = "Environment";
- private static final ONAPLoggingContext logContext = Mockito.mock(ONAPLoggingContext.class);
+ private static final OnapLoggingContext logContext = Mockito.mock(OnapLoggingContext.class);
private static PolicyDBDao dbd;
private static StdEngine stdEngine = null;
private static SessionFactory sessionFactory = null;
diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java
index 73540033f..008f2629e 100644
--- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java
+++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/rest/handler/DeleteHandlerTest.java
@@ -37,7 +37,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
-import org.onap.policy.common.logging.ONAPLoggingContext;
+import org.onap.policy.common.logging.OnapLoggingContext;
import org.onap.policy.pap.xacml.rest.XACMLPapServlet;
import org.onap.policy.pap.xacml.rest.daoimpl.CommonClassDaoImpl;
import org.onap.policy.pap.xacml.rest.elk.client.PolicyElasticSearchController;
@@ -102,7 +102,7 @@ public class DeleteHandlerTest {
}
// Test deletion from PDP
- ONAPLoggingContext loggingContext = Mockito.mock(ONAPLoggingContext.class);
+ OnapLoggingContext loggingContext = Mockito.mock(OnapLoggingContext.class);
try {
handler.doApiDeleteFromPdp(request, response, loggingContext);
}
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 b33c4bd16..66a74a44f 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
@@ -2,15 +2,15 @@
* ============LICENSE_START=======================================================
* ONAP-PDP-REST
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017, 2019 AT&T Intellectual Property. All rights reserved.
* Modified Copyright (C) 2018 Samsung Electronics Co., Ltd.
* ================================================================================
* 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.
@@ -42,20 +42,20 @@ import org.onap.policy.rest.XACMLRestProperties;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import com.att.research.xacml.util.XACMLProperties;
-import org.onap.policy.common.logging.ONAPLoggingContext;
+import org.onap.policy.common.logging.OnapLoggingContext;
import org.onap.policy.common.logging.eelf.PolicyLogger;
-import org.onap.policy.common.logging.flexlogger.*;
+import org.onap.policy.common.logging.flexlogger.*;
public class XACMLPdpRegisterThread implements Runnable {
private static final Logger LOGGER = FlexLogger.getLogger(XACMLPdpRegisterThread.class);
private static final Logger auditLogger = FlexLogger.getLogger("auditLogger");
- private ONAPLoggingContext baseLoggingContext = null;
+ private OnapLoggingContext baseLoggingContext = null;
public volatile boolean isRunning = false;
- public XACMLPdpRegisterThread(ONAPLoggingContext baseLoggingContext) {
+ public XACMLPdpRegisterThread(OnapLoggingContext baseLoggingContext) {
this.baseLoggingContext = baseLoggingContext;
}
@@ -78,7 +78,7 @@ public class XACMLPdpRegisterThread implements Runnable {
this.isRunning = true;
}
// get a new logging context for the thread
- ONAPLoggingContext loggingContext = new ONAPLoggingContext(baseLoggingContext);
+ OnapLoggingContext loggingContext = new OnapLoggingContext(baseLoggingContext);
loggingContext.setServiceName("PDP:PAP.register");
//are we registered with at least one
boolean registered = false;
@@ -124,7 +124,7 @@ public class XACMLPdpRegisterThread implements Runnable {
// each time through the inner loop (which handles redirects) is a
// continuation of the same transaction.
UUID requestID = UUID.randomUUID();
- loggingContext.setRequestID(requestID.toString());
+ loggingContext.setRequestId(requestID.toString());
//PolicyLogger.info("Request Id generated in XACMLPdpRegisterThread under XACML-PDP-REST");
loggingContext.transactionStarted();
//
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 c86e21c09..c3f0cac46 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
@@ -20,17 +20,6 @@
package org.onap.policy.pdp.rest;
-import com.att.research.xacml.api.Request;
-import com.att.research.xacml.api.Response;
-import com.att.research.xacml.api.pap.PDPStatus.Status;
-import com.att.research.xacml.api.pdp.PDPEngine;
-import com.att.research.xacml.api.pdp.PDPException;
-import com.att.research.xacml.std.dom.DOMRequest;
-import com.att.research.xacml.std.dom.DOMResponse;
-import com.att.research.xacml.std.json.JSONRequest;
-import com.att.research.xacml.std.json.JSONResponse;
-import com.att.research.xacml.util.XACMLProperties;
-import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -64,8 +53,8 @@ import org.onap.policy.common.im.IntegrityMonitor;
import org.onap.policy.common.im.IntegrityMonitorException;
import org.onap.policy.common.im.IntegrityMonitorProperties;
import org.onap.policy.common.im.StandbyStatusException;
-import org.onap.policy.common.logging.ONAPLoggingContext;
-import org.onap.policy.common.logging.ONAPLoggingUtils;
+import org.onap.policy.common.logging.OnapLoggingContext;
+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;
@@ -75,6 +64,17 @@ import org.onap.policy.utils.PeCryptoUtils;
import org.onap.policy.xacml.api.XACMLErrorConstants;
import org.onap.policy.xacml.pdp.std.functions.PolicyList;
import org.onap.policy.xacml.std.pap.StdPDPStatus;
+import com.att.research.xacml.api.Request;
+import com.att.research.xacml.api.Response;
+import com.att.research.xacml.api.pap.PDPStatus.Status;
+import com.att.research.xacml.api.pdp.PDPEngine;
+import com.att.research.xacml.api.pdp.PDPException;
+import com.att.research.xacml.std.dom.DOMRequest;
+import com.att.research.xacml.std.dom.DOMResponse;
+import com.att.research.xacml.std.json.JSONRequest;
+import com.att.research.xacml.std.json.JSONResponse;
+import com.att.research.xacml.util.XACMLProperties;
+import com.fasterxml.jackson.databind.ObjectMapper;
/**
* Servlet implementation class XacmlPdpServlet
@@ -177,7 +177,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
//
private static transient Thread configThread = null;
private static volatile boolean configThreadTerminate = false;
- private transient ONAPLoggingContext baseLoggingContext = null;
+ private transient OnapLoggingContext baseLoggingContext = null;
private transient IntegrityMonitor im;
public IntegrityMonitor getIm() {
@@ -226,7 +226,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
//
// Logging stuff....
//
- baseLoggingContext = new ONAPLoggingContext();
+ baseLoggingContext = new OnapLoggingContext();
// fixed data that will be the same in all logging output goes here
try {
String hostname = InetAddress.getLocalHost().getCanonicalHostName();
@@ -281,7 +281,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
PolicyLogger.error(MessageCodes.ERROR_SYSTEM_ERROR, e, "Failed to create IntegrityMonitor" + e);
throw new ServletException(e);
}
-
+
try {
System.setProperty("msToscaModel.home", properties.getProperty("msToscaModel.home"));
} catch (Exception e) {
@@ -291,7 +291,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
startThreads(baseLoggingContext, new Thread(this));
}
- private static void startThreads(ONAPLoggingContext baseLoggingContext, Thread thread) {
+ private static void startThreads(OnapLoggingContext baseLoggingContext, Thread thread) {
environment = XACMLProperties.getProperty("ENVIRONMENT", "DEVL");
//
// Kick off our thread to register with the PAP servlet.
@@ -426,11 +426,11 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
@Override
protected void doPut(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- ONAPLoggingContext loggingContext = ONAPLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
+ OnapLoggingContext loggingContext = OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
loggingContext.transactionStarted();
- if ((loggingContext.getRequestID() == null) || "".equals(loggingContext.getRequestID())) {
+ if ((loggingContext.getRequestId() == null) || "".equals(loggingContext.getRequestId())) {
UUID requestID = UUID.randomUUID();
- loggingContext.setRequestID(requestID.toString());
+ loggingContext.setRequestId(requestID.toString());
PolicyLogger.info("requestID not provided in call to XACMLPdpSrvlet (doPut) so we generated one");
} else {
PolicyLogger.info("requestID was provided in call to XACMLPdpSrvlet (doPut)");
@@ -509,7 +509,7 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
}
protected void doPutConfig(String config, HttpServletRequest request, HttpServletResponse response,
- ONAPLoggingContext loggingContext) throws IOException {
+ OnapLoggingContext loggingContext) throws IOException {
try {
// prevent multiple configuration changes from stacking up
logger.info("XACMLPdpServlet: checking remainingCapacity of Queue.");
@@ -642,11 +642,11 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- ONAPLoggingContext loggingContext = ONAPLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
+ OnapLoggingContext loggingContext = OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
loggingContext.transactionStarted();
- if ((loggingContext.getRequestID() == null) || (loggingContext.getRequestID() == "")) {
+ if ((loggingContext.getRequestId() == null) || (loggingContext.getRequestId() == "")) {
UUID requestID = UUID.randomUUID();
- loggingContext.setRequestID(requestID.toString());
+ loggingContext.setRequestId(requestID.toString());
PolicyLogger.info("requestID not provided in call to XACMLPdpSrvlet (doGet) so we generated one");
} else {
PolicyLogger.info("requestID was provided in call to XACMLPdpSrvlet (doGet)");
@@ -825,12 +825,12 @@ public class XACMLPdpServlet extends HttpServlet implements Runnable {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
- ONAPLoggingContext loggingContext = ONAPLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
+ OnapLoggingContext loggingContext = OnapLoggingUtils.getLoggingContextForRequest(request, baseLoggingContext);
loggingContext.transactionStarted();
loggingContext.setServiceName("PDP.decide");
- if ((loggingContext.getRequestID() == null) || ("".equals(loggingContext.getRequestID()))) {
+ if ((loggingContext.getRequestId() == null) || ("".equals(loggingContext.getRequestId()))) {
UUID requestID = UUID.randomUUID();
- loggingContext.setRequestID(requestID.toString());
+ loggingContext.setRequestId(requestID.toString());
PolicyLogger.info("requestID not provided in call to XACMLPdpSrvlet (doPost) so we generated one");
} else {
PolicyLogger.info("requestID was provided in call to XACMLPdpSrvlet (doPost)");
diff --git a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java
index 14c231aed..17601a280 100644
--- a/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java
+++ b/ONAP-PDP-REST/src/test/java/org/onap/policy/pdp/rest/XACMLPdpServletTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-PDP-REST
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Modifications Copyright (C) 2019 Samsung
* ================================================================================
@@ -41,7 +41,7 @@ import org.mockito.Mockito;
import org.onap.policy.common.ia.IntegrityAuditProperties;
import org.onap.policy.common.im.IntegrityMonitor;
import org.onap.policy.common.im.IntegrityMonitorException;
-import org.onap.policy.common.logging.ONAPLoggingContext;
+import org.onap.policy.common.logging.OnapLoggingContext;
import org.onap.policy.common.logging.flexlogger.FlexLogger;
import org.onap.policy.common.logging.flexlogger.Logger;
import org.onap.policy.xacml.std.pap.StdPDPPolicy;
@@ -223,7 +223,7 @@ public class XACMLPdpServletTest extends TestCase {
public void testXACMLPdpRegisterThread() {
LOGGER.info("XACMLPdpServletTest - testXACMLPdpRegisterThread");
try {
- ONAPLoggingContext baseLoggingContext = new ONAPLoggingContext();
+ OnapLoggingContext baseLoggingContext = new OnapLoggingContext();
baseLoggingContext.setServer("localhost");
XACMLPdpRegisterThread regThread = new XACMLPdpRegisterThread(baseLoggingContext);
regThread.run();
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 5403f8ff1..f8729d696 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
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP-PDP
* ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 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.
@@ -46,6 +46,7 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.common.endpoints.http.server.HttpServletServer;
+import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance;
import org.onap.policy.common.utils.network.NetworkUtil;
import org.onap.policy.xacml.custom.OnapFunctionDefinitionFactory;
@@ -68,8 +69,8 @@ public class FindActionTest {
@BeforeClass
public static void setUpServer() {
try {
- final HttpServletServer testServer =
- HttpServletServer.factory.build("dmaapSim", "localhost", MOCK_SERVER_PORT, "/", false, true);
+ final HttpServletServer testServer = HttpServletServerFactoryInstance.getServerFactory().build("dmaapSim",
+ "localhost", MOCK_SERVER_PORT, "/", false, true);
testServer.addServletClass("/*", DummyRest.class.getName());
testServer.waitedStart(2000);
if (!NetworkUtil.isTcpPortOpen("localhost", testServer.getPort(), 5, 10000L)) {
@@ -83,7 +84,7 @@ public class FindActionTest {
@AfterClass
public static void tearDownSimulator() {
- HttpServletServer.factory.destroy();
+ HttpServletServerFactoryInstance.getServerFactory().destroy();
}
/**