From 6cf18e59f1f7fc94bcae27785dc9a17008324fa8 Mon Sep 17 00:00:00 2001 From: Ramesh Parthasarathy Date: Sat, 11 Jul 2020 19:30:10 +0000 Subject: Address NullPointerException with apih healthcheck endpoint Facing NullPointerException with apih healthcheck endpoint with elalto branch. Brittany has addressed this issue with master branch and this change brings in those changes with elalto branch This is a squashed commit cherry picked commits from master commit 4e79baed423434b42d75f0d5c26757cd6792ce79 commit b341d9cd027b0f7bec125d51b8298c3e31d7f685 commit 02b85383a1f2a7c9677db2929b30fc283ad9a00c commit 8e3e32d4c7a10ddd8ee97576e030185e273bd2c0 commit 8a1bade3296510df340d11f7c22353994cbdfa83 commit ef6d7e225d8601489f8559483e1414dc62a62e8b commit 84a201f889f635c9405ea737d814fc43d274afd7 Issue-ID: SO-3046 Signed-off-by: Ramesh Parthasarathy(rp6768) Change-Id: Ic7579f84746dad4002a5291edd54237eaaa602cf --- .../so/apihandlerinfra/E2EServiceInstances.java | 16 +++--- .../so/apihandlerinfra/JerseyConfiguration.java | 3 +- .../org/onap/so/apihandlerinfra/ManualTasks.java | 9 ++-- .../so/apihandlerinfra/OrchestrationRequests.java | 5 +- .../so/apihandlerinfra/RequestHandlerUtils.java | 9 ++-- .../ResumeOrchestrationRequest.java | 5 +- .../org/onap/so/apihandlerinfra/TasksHandler.java | 2 +- .../CloudResourcesOrchestration.java | 9 ++-- .../tenantisolation/helpers/SDCClientHelper.java | 4 +- .../process/ActivateVnfOperationalEnvironment.java | 6 +-- .../ActivateVnfStatusOperationalEnvironment.java | 4 +- .../so/apihandlerinfra/InstanceManagementTest.java | 4 +- .../onap/so/apihandlerinfra/ManualTasksTest.java | 50 ++----------------- .../apihandlerinfra/RequestHandlerUtilsTest.java | 4 +- .../so/apihandlerinfra/ServiceInstancesTest.java | 57 ++-------------------- .../java/org/onap/so/client/grm/GRMClientTest.java | 32 +----------- 16 files changed, 52 insertions(+), 167 deletions(-) (limited to 'mso-api-handlers/mso-api-handler-infra') diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java index 650922094d..0bcb0f1c86 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java @@ -295,7 +295,7 @@ public class E2EServiceInstances { msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), - MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString()); return resp; } @@ -333,7 +333,7 @@ public class E2EServiceInstances { MsoException.ServiceException, "E2E serviceId " + serviceId + " is not found in DB", ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null, version); logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), - MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), + MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(), "Null response from RequestDB when searching by serviceId"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; @@ -435,7 +435,7 @@ public class E2EServiceInstances { msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), - MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -549,7 +549,7 @@ public class E2EServiceInstances { msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), - MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity()); return getBPMNResp; } @@ -660,7 +660,7 @@ public class E2EServiceInstances { msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), - MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -760,7 +760,7 @@ public class E2EServiceInstances { msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), - MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + MSO_PROP_APIHANDLER_INFRA, ErrorCode.BusinessProcessError.getValue(), "Null response from BPEL"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -791,7 +791,7 @@ public class E2EServiceInstances { "Request Failed due to BPEL error with HTTP Status= %1 " + '\n' + camundaJSONResponseBody, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables, version); logger.error(LoggingAnchor.FOUR, MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), - requestClient.getUrl(), ErrorCode.BusinessProcesssError.getValue(), + requestClient.getUrl(), ErrorCode.BusinessProcessError.getValue(), "Response from BPEL engine is failed with HTTP Status=" + bpelStatus); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; @@ -800,7 +800,7 @@ public class E2EServiceInstances { "Request Failed due to BPEL error with HTTP Status= %1", ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables, version); logger.error("", MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), requestClient.getUrl(), - ErrorCode.BusinessProcesssError.getValue(), "Response from BPEL engine is empty"); + ErrorCode.BusinessProcessError.getValue(), "Response from BPEL engine is empty"); logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java index 271efddc71..b7288e4c91 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java @@ -45,6 +45,7 @@ import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestration; import org.onap.so.apihandlerinfra.tenantisolation.CloudResourcesOrchestration; import org.onap.so.apihandlerinfra.tenantisolation.ModelDistributionRequest; import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter; +import org.onap.so.utils.Components; import org.onap.so.web.exceptions.RuntimeExceptionMapper; import org.springframework.context.annotation.Configuration; import io.swagger.v3.jaxrs2.integration.JaxrsOpenApiContextBuilder; @@ -61,7 +62,7 @@ public class JerseyConfiguration extends ResourceConfig { @PostConstruct public void setUp() { - System.setProperty(Constants.Property.PARTNER_NAME, "SO.APIH"); + System.setProperty(Constants.Property.PARTNER_NAME, Components.APIH.toString()); register(GlobalHealthcheckHandler.class); register(NodeHealthcheckHandler.class); register(ServiceInstances.class); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java index 4bafb40b32..7e4452aeb3 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java @@ -200,8 +200,9 @@ public class ManualTasks { } if (response == null) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, - ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = + new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcessError) + .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); BPMNFailureException bpmnFailureException = @@ -229,7 +230,7 @@ public class ManualTasks { } catch (JsonProcessingException e) { ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, - ErrorCode.BusinessProcesssError).build(); + ErrorCode.BusinessProcessError).build(); ValidateException validateException = @@ -243,7 +244,7 @@ public class ManualTasks { return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestId, completeResp, apiVersion); } else { ErrorLoggerInfo errorLoggerInfo = - new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError) + new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcessError) .build(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java index 46bec9829b..49de526473 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java @@ -542,8 +542,9 @@ public class OrchestrationRequests { } if (infraActiveRequest == null) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, - ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = + new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcessError) + .build(); ValidateException validateException = new ValidateException.Builder( "Null response from RequestDB when searching by RequestId " + requestId, HttpStatus.SC_NOT_FOUND, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java index 8cdc2aaaf4..25a4e4159c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java @@ -157,8 +157,9 @@ public class RequestHandlerUtils extends AbstractRestHandler { if (response == null) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, - ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); + ErrorLoggerInfo errorLoggerInfo = + new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.BusinessProcessError) + .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build(); ClientConnectionException clientException = new ClientConnectionException.Builder(requestClient.getUrl(), HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo).build(); updateStatus(currentActiveReq, Status.FAILED, clientException.getMessage()); @@ -223,7 +224,7 @@ public class RequestHandlerUtils extends AbstractRestHandler { if (camundaJSONResponseBody != null && !camundaJSONResponseBody.isEmpty()) { ErrorLoggerInfo errorLoggerInfo = - new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError) + new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcessError) .errorSource(requestClient.getUrl()).build(); BPMNFailureException bpmnException = new BPMNFailureException.Builder(String.valueOf(bpelStatus) + camundaJSONResponseBody, bpelStatus, @@ -235,7 +236,7 @@ public class RequestHandlerUtils extends AbstractRestHandler { } else { ErrorLoggerInfo errorLoggerInfo = - new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError) + new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcessError) .errorSource(requestClient.getUrl()).build(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java index 7cf9e338a8..65537cbba0 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java @@ -122,8 +122,9 @@ public class ResumeOrchestrationRequest { if (infraActiveRequest == null) { logger.error("No infraActiveRequest record found for requestId: {} in requesteDb lookup", requestId); - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, - ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = + new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.BusinessProcessError) + .build(); ValidateException validateException = new ValidateException.Builder( "Null response from requestDB when searching by requestId: " + requestId, HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java index 09a1d9e5a6..edc287ce0a 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java @@ -203,7 +203,7 @@ public class TasksHandler { } else { ErrorLoggerInfo errorLoggerInfo = - new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcesssError) + new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.BusinessProcessError) .build(); throw new BPMNFailureException.Builder(String.valueOf(bpelStatus), bpelStatus, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build(); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java index 47d6932730..43f957174c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java @@ -134,8 +134,9 @@ public class CloudResourcesOrchestration { } if (infraActiveRequest == null) { - ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, - ErrorCode.BusinessProcesssError).build(); + ErrorLoggerInfo errorLoggerInfo = + new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.BusinessProcessError) + .build(); ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR) @@ -203,7 +204,7 @@ public class CloudResourcesOrchestration { if (requestDB == null) { ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, - ErrorCode.BusinessProcesssError).build(); + ErrorCode.BusinessProcessError).build(); ValidateException validateException = new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB", HttpStatus.SC_NO_CONTENT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR) @@ -227,7 +228,7 @@ public class CloudResourcesOrchestration { orchestrationMap = tenantIsolationRequest.getOrchestrationFilters(queryParams); } catch (ValidationException ex) { ErrorLoggerInfo errorLoggerInfo = - new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError) + new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError) .build(); ValidateException validateException = new ValidateException.Builder(ex.getMessage(), HttpStatus.SC_INTERNAL_SERVER_ERROR, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java index de5edb5b54..65d3109445 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java @@ -94,7 +94,7 @@ public class SDCClientHelper { if (basicAuthCred == null || "".equals(basicAuthCred)) { ErrorLoggerInfo errorLoggerInfo = - new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError) + new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError) .build(); throw new ValidateException.Builder( @@ -143,7 +143,7 @@ public class SDCClientHelper { return client.post(jsonPayload); } catch (Exception ex) { ErrorLoggerInfo errorLoggerInfo = - new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError) + new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError) .build(); throw new ValidateException.Builder("Bad request could not post payload", HttpStatus.SC_BAD_REQUEST, diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java index 3957f86bab..0005d26016 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java @@ -109,7 +109,7 @@ public class ActivateVnfOperationalEnvironment { logger.debug(" aai workloadContext: {}", workloadContext); if (!vidWorkloadContext.equals(workloadContext)) { ErrorLoggerInfo errorLoggerInfo = - new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError) + new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError) .build(); throw new ValidateException.Builder( " The vid workloadContext did not match from aai record. " + " vid workloadContext:" @@ -119,7 +119,7 @@ public class ActivateVnfOperationalEnvironment { } if (ecompOperationalEnvironmentId == null) { ErrorLoggerInfo errorLoggerInfo = - new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError) + new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError) .build(); throw new ValidateException.Builder( " The ECOMP OE was not in aai record; the value of relationship.relationship-data key: " @@ -183,7 +183,7 @@ public class ActivateVnfOperationalEnvironment { } else { ErrorLoggerInfo errorLoggerInfo = - new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError) + new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError) .build(); String dbErrorMessage = " Failure calling SDC: statusCode: " + statusCode + "; messageId: " + jsonResponse.get("messageId") + "; message: " + jsonResponse.get("message"); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java index 3226a0c313..624a7f6945 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java @@ -250,7 +250,7 @@ public class ActivateVnfStatusOperationalEnvironment { String dbErrorMessage = "Failure calling SDC: statusCode: " + statusCode + "; messageId: " + jsonResponse.get("messageId") + "; message: " + jsonResponse.get("message"); ErrorLoggerInfo errorLoggerInfo = - new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError) + new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError) .build(); ValidateException validateException = new ValidateException.Builder(dbErrorMessage, HttpStatus.SC_BAD_REQUEST, @@ -304,7 +304,7 @@ public class ActivateVnfStatusOperationalEnvironment { if (status.equals("Failure") && queryServiceModelResponseList.size() == count) { this.errorMessage = "Overall Activation process is a Failure. " + status; ErrorLoggerInfo errorLoggerInfo = - new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcesssError) + new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.BusinessProcessError) .build(); ValidateException validateException = new ValidateException.Builder(this.errorMessage, HttpStatus.SC_BAD_REQUEST, diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java index 276f891eb2..30c1f2a5ce 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java @@ -31,7 +31,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID; import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID; -import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID; +import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_PARTNER_NAME; import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID; import java.io.File; import java.io.IOException; @@ -85,7 +85,7 @@ public class InstanceManagementTest extends BaseTest { headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); - headers.set(CLIENT_ID, "VID"); + headers.set(ONAP_PARTNER_NAME, "VID"); headers.set(REQUESTOR_ID, "xxxxxx"); try { // generate one-time port number to avoid RANDOM port number later. initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH)); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java index 8a112e3fdd..86907e87b0 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java @@ -26,24 +26,13 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static org.onap.logging.filter.base.Constants.HttpHeaders.ECOMP_REQUEST_ID; -import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.INVOCATION_ID; -import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.PARTNER_NAME; -import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_CODE; -import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION; -import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.LOG_TIMESTAMP; -import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.SERVICE_NAME; -import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE; -import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID; +import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_PARTNER_NAME; import java.io.IOException; -import java.util.Map; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.apache.http.HttpStatus; import org.junit.Test; -import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.apihandlerinfra.tasksbeans.RequestDetails; import org.onap.so.apihandlerinfra.tasksbeans.RequestInfo; import org.onap.so.apihandlerinfra.tasksbeans.TaskRequestReference; @@ -59,7 +48,6 @@ import org.springframework.web.util.UriComponentsBuilder; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.http.Fault; -import ch.qos.logback.classic.spi.ILoggingEvent; public class ManualTasksTest extends BaseTest { @@ -89,7 +77,7 @@ public class ManualTasksTest extends BaseTest { headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); headers.set(ECOMP_REQUEST_ID, "987654321"); - headers.set(CLIENT_ID, "VID"); + headers.set(ONAP_PARTNER_NAME, "VID"); HttpEntity entity = new HttpEntity(taskReq, headers); UriComponentsBuilder builder = @@ -108,34 +96,6 @@ public class ManualTasksTest extends BaseTest { // then assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); assertThat(realResponse, sameBeanAs(expectedResponse)); - - for (ILoggingEvent logEvent : TestAppender.events) - if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter") - && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) { - Map mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get(INVOCATION_ID)); - assertEquals("UNKNOWN", mdc.get(PARTNER_NAME)); - assertEquals("tasks/v1/55/complete", mdc.get(SERVICE_NAME)); - assertEquals("INPROGRESS", mdc.get(RESPONSE_STATUS_CODE)); - } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter") - && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")) { - Map mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); - assertNotNull(mdc.get(LOG_TIMESTAMP)); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get(INVOCATION_ID)); - assertEquals("202", mdc.get(RESPONSE_CODE)); - assertEquals("UNKNOWN", mdc.get(PARTNER_NAME)); - assertEquals("tasks/v1/55/complete", mdc.get(SERVICE_NAME)); - assertEquals("COMPLETE", mdc.get(RESPONSE_STATUS_CODE)); - assertNotNull(mdc.get(RESPONSE_DESCRIPTION)); - assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0)); - assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0)); - assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0)); - assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0)); - } } @Test @@ -152,7 +112,7 @@ public class ManualTasksTest extends BaseTest { headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); headers.set(ECOMP_REQUEST_ID, "987654321"); - headers.set(CLIENT_ID, "VID"); + headers.set(ONAP_PARTNER_NAME, "VID"); HttpEntity entity = new HttpEntity(invalidRequest, headers); UriComponentsBuilder builder = @@ -189,7 +149,7 @@ public class ManualTasksTest extends BaseTest { headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); headers.set(ECOMP_REQUEST_ID, "987654321"); - headers.set(CLIENT_ID, "VID"); + headers.set(ONAP_PARTNER_NAME, "VID"); HttpEntity entity = new HttpEntity(taskReq, headers); UriComponentsBuilder builder = @@ -230,7 +190,7 @@ public class ManualTasksTest extends BaseTest { headers.set("Accept", MediaType.APPLICATION_JSON); headers.set("Content-Type", MediaType.APPLICATION_JSON); headers.set(ECOMP_REQUEST_ID, "987654321"); - headers.set(CLIENT_ID, "VID"); + headers.set(ONAP_PARTNER_NAME, "VID"); HttpEntity entity = new HttpEntity(taskReq, headers); UriComponentsBuilder builder = diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java index d0561a4518..abdf38dfa6 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java @@ -32,7 +32,7 @@ import static org.junit.Assert.assertNull; import static org.junit.Assert.assertTrue; import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID; import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID; -import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID; +import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_PARTNER_NAME; import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID; import java.io.IOException; import java.net.MalformedURLException; @@ -99,7 +99,7 @@ public class RequestHandlerUtilsTest extends BaseTest { headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); - headers.set(CLIENT_ID, "VID"); + headers.set(ONAP_PARTNER_NAME, "VID"); headers.set(REQUESTOR_ID, "xxxxxx"); try { // generate one-time port number to avoid RANDOM port number later. initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH)); diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java index 61654d18e4..b1653a2b26 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java @@ -29,14 +29,13 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; +import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_PARTNER_NAME; import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID; -import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID; import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID; -import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID; +import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; @@ -81,7 +80,6 @@ import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.github.tomakehurst.wiremock.http.Fault; -import ch.qos.logback.classic.spi.ILoggingEvent; public class ServiceInstancesTest extends BaseTest { @@ -116,7 +114,7 @@ public class ServiceInstancesTest extends BaseTest { headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d"); - headers.set(CLIENT_ID, "VID"); + headers.set(ONAP_PARTNER_NAME, "VID"); headers.set(REQUESTOR_ID, "xxxxxx"); try { // generate one-time port number to avoid RANDOM port number later. initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH)); @@ -217,37 +215,6 @@ public class ServiceInstancesTest extends BaseTest { assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value()); ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); - - - - for (ILoggingEvent logEvent : TestAppender.events) - if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter") - && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) { - Map mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); - assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); - assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances", - mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); - assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); - } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter") - && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")) { - Map mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP)); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.LOG_TIMESTAMP)); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); - assertEquals("202", mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE)); - assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); - assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances", - mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME)); - assertEquals("COMPLETE", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION)); - assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0)); - assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0)); - assertEquals("5.0.0", response.getHeaders().get("X-LatestVersion").get(0)); - } } @Test @@ -400,15 +367,6 @@ public class ServiceInstancesTest extends BaseTest { .withStatus(HttpStatus.SC_NOT_FOUND))); assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value()); - - for (ILoggingEvent logEvent : TestAppender.events) { - if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.SOAuditLogContainerFilter") - && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) { - Map mdc = logEvent.getMDCPropertyMap(); - assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertNotNull(mdc.get("PartnerName")); - } - } } @Test @@ -2572,15 +2530,6 @@ public class ServiceInstancesTest extends BaseTest { ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class); assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId")); assertEquals(response.getHeaders().get(TRANSACTION_ID).get(0), "32807a28-1a14-4b88-b7b3-2950918aa76d"); - - for (ILoggingEvent logEvent : TestAppender.events) { - if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter") - && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) { - Map mdc = logEvent.getMDCPropertyMap(); - assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(ONAPLogConstants.MDCs.REQUEST_ID)); - assertEquals("VID", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME)); - } - } } @Test diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java index cfb865c9e1..2e9576cf7c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java +++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java @@ -28,12 +28,9 @@ import static com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; import java.io.File; import java.nio.file.Files; import java.util.List; -import java.util.Map; import javax.ws.rs.core.MediaType; import org.junit.BeforeClass; import org.junit.Rule; @@ -48,7 +45,6 @@ import org.onap.so.client.grm.beans.ServiceEndPointLookupRequest; import org.onap.so.client.grm.beans.ServiceEndPointRequest; import org.onap.so.client.grm.exceptions.GRMClientCallFailed; import org.slf4j.MDC; -import ch.qos.logback.classic.spi.ILoggingEvent; public class GRMClientTest extends BaseTest { @@ -79,36 +75,10 @@ public class GRMClientTest extends BaseTest { List list = sel.getServiceEndPointList(); assertEquals(3, list.size()); - boolean foundInvoke = false; - boolean foundInvokeReturn = false; - for (ILoggingEvent logEvent : TestAppender.events) - if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter") - && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("INVOKE")) { - Map mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); - assertEquals("GRM", mdc.get("TargetEntity")); - assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); - foundInvoke = true; - } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter") - && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("INVOKE-RETURN")) { - Map mdc = logEvent.getMDCPropertyMap(); - assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID)); - assertEquals("200", mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE)); - assertEquals("COMPLETED", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE)); - foundInvokeReturn = true; - } - - if (!foundInvoke) - fail("INVOKE Marker not found"); - - if (!foundInvokeReturn) - fail("INVOKE RETURN Marker not found"); - wireMockServer.verify(postRequestedFor(urlEqualTo("/GRMLWPService/v1/serviceEndPoint/findRunning")) .withHeader(ONAPLogConstants.Headers.INVOCATION_ID.toString(), matching(uuidRegex)) .withHeader(ONAPLogConstants.Headers.REQUEST_ID.toString(), matching(uuidRegex)) - .withHeader(ONAPLogConstants.Headers.PARTNER_NAME.toString(), equalTo("SO"))); - TestAppender.events.clear(); + .withHeader(ONAPLogConstants.Headers.PARTNER_NAME.toString(), equalTo("SO.APIH"))); } @Test -- cgit 1.2.3-korg