diff options
author | Steve Smokowski <ss835w@att.com> | 2019-09-11 12:57:37 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-09-11 12:57:37 +0000 |
commit | 6a6ac7539aeeb83bab6d87798f1ef1a0ba98597f (patch) | |
tree | e91736ae1134da6026ae5e0d1e7806438fe03960 /bpmn | |
parent | 3f65ba0e3e311c5454fa8d7053d72ba11d025ff3 (diff) | |
parent | 2ede5f09c9601d543f20d466a21e9e85c29eacc7 (diff) |
Merge "Integrate Logging Library"
Diffstat (limited to 'bpmn')
37 files changed, 158 insertions, 156 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy index f14e3dcc42..ee70dcc89c 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy @@ -44,7 +44,7 @@ import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.openpojo.rules.HasToStringRule -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; @Deprecated class AaiUtil { @@ -96,7 +96,7 @@ class AaiUtil { String regionId = "" try{ URL Url = new URL(url) - HttpClient client = new HttpClientFactory().newXmlClient(Url, TargetEntity.AAI) + HttpClient client = new HttpClientFactory().newXmlClient(Url, ONAPComponents.AAI) client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution)) client.addAdditionalHeader("X-FromAppId", "MSO") client.addAdditionalHeader("X-TransactionId", utils.getRequestID()) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy index 2bf7298584..83784e1960 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy @@ -37,7 +37,7 @@ import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.springframework.web.util.UriUtils import javax.ws.rs.core.MediaType @@ -442,7 +442,7 @@ class CatalogDbUtils { String catalogDbEndpoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint",execution) String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint def responseData = '' - HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB) + HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.CATALOG_DB) client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', "BPMN") client.addAdditionalHeader('Accept', MediaType.APPLICATION_JSON) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy index c23150384e..195b1fc0d6 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy @@ -34,7 +34,7 @@ import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.WorkflowException import org.onap.so.logger.MessageEnum -import org.onap.so.utils.TargetEntities +import org.onap.logging.filter.base.ONAPComponentsList import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -285,7 +285,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor { logger.debug("Outgoing WorkflowException is " + exception) } - public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, TargetEntities extSystemErrorSource) { + public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, ONAPComponentsList extSystemErrorSource) { MsoUtils utils = new MsoUtils() String processKey = getProcessKey(execution); logger.debug("Building a WorkflowException for " + processKey) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy index 5525c2642b..a5111a62d3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy @@ -29,7 +29,7 @@ import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import javax.ws.rs.core.MediaType import javax.ws.rs.core.Response @@ -145,7 +145,7 @@ class ExternalAPIUtil { logger.debug( "URL to be used is: " + url) logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl")) - HttpClient client = httpClientFactory.newJsonClient(new URL(url), TargetEntity.EXTERNAL) + HttpClient client = httpClientFactory.newJsonClient(new URL(url), ONAPComponents.EXTERNAL) client.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey")) client.addAdditionalHeader("X-FromAppId", "MSO") client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, uuid) @@ -183,7 +183,7 @@ class ExternalAPIUtil { logger.debug( "URL to be used is: " + url) logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl")) - HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), TargetEntity.AAI) + HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), ONAPComponents.AAI) httpClient.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey")) httpClient.addAdditionalHeader("X-FromAppId", "MSO") httpClient.addAdditionalHeader("X-TransactionId", uuid) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy index 3008f77b62..6d4b50f690 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy @@ -42,7 +42,7 @@ import org.onap.so.client.aai.AAIObjectType import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.client.graphinventory.entities.uri.Depth -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -92,7 +92,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{ logger.debug("AAI endPoint: " + endPoint) try { - HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI) + HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), ONAPComponents.AAI) client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', 'MSO') diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy index 6583ded413..b082c1830e 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy @@ -41,7 +41,7 @@ import org.onap.so.db.catalog.beans.CloudIdentity import org.onap.so.db.catalog.beans.CloudSite import org.onap.so.db.catalog.beans.HomingInstance import org.onap.so.db.catalog.beans.ServerType -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -165,7 +165,7 @@ class OofHoming extends AbstractServiceTaskProcessor { URL url = new URL(urlString) - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.OOF) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF) httpClient.addAdditionalHeader("Authorization", authHeader) Response httpResponse = httpClient.post(oofRequest) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index 4bfb29bc45..606b97bec2 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -40,7 +40,7 @@ import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory import org.onap.so.db.catalog.beans.CloudSite import org.onap.so.db.catalog.beans.HomingInstance -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.springframework.http.HttpEntity import org.springframework.http.HttpHeaders import org.springframework.http.HttpMethod diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy index c30d807bf3..52d6758b2b 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy @@ -47,7 +47,7 @@ import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; @@ -223,7 +223,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor { URL url = new URL(sdncAdapterUrl) - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SDNC_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SDNC_ADAPTER) httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id")) httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString()) httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-SDNCAdapter") diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy index 8c2da2c112..08c032fba3 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy @@ -37,7 +37,7 @@ import org.onap.so.bpmn.core.domain.VnfResource import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.json.JSONArray @@ -136,7 +136,7 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{ logger.debug("Sniro Url is: " + urlString) URL url = new URL(urlString); - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SNIRO) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SNIRO) httpClient.addAdditionalHeader("Authorization", authHeader) Response httpResponse = httpClient.post(sniroRequest) diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy index 866229f6b8..803a3f71de 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy @@ -35,8 +35,9 @@ import org.onap.so.client.HttpClient import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import java.util.UUID +import org.onap.so.utils.Components @@ -80,7 +81,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no messageId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } execution.setVariable('VNFAResponse_CORRELATOR', messageId) @@ -94,7 +95,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } execution.setVariable(prefix + 'notificationUrl', notificationUrl) @@ -108,7 +109,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined' logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } while (vnfAdapterEndpoint.endsWith('/')) { @@ -126,7 +127,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'POST' @@ -139,7 +140,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } String vfModuleId = getChildText(root, 'vfModuleId') @@ -148,7 +149,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'PUT' @@ -162,7 +163,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } String vfModuleId = getChildText(root, 'vfModuleId') @@ -171,7 +172,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'DELETE' @@ -185,7 +186,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } String vnfId = getChildText(vfModuleRollbackNode, 'vnfId') @@ -194,7 +195,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vnfId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId') @@ -203,7 +204,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'DELETE' @@ -224,7 +225,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'PUT' @@ -240,7 +241,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'DELETE' @@ -256,7 +257,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } vnfAdapterMethod = 'DELETE' @@ -269,7 +270,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod) @@ -306,7 +307,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); logger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } } @@ -337,7 +338,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { URL url = new URL(vnfAdapterUrl); - HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.VNF_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.VNF_ADAPTER) httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue")) httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id")) @@ -357,7 +358,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus()) @@ -370,7 +371,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String msg = 'Caught exception in ' + method + ": " + e logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN", ErrorCode.UnknownError.getValue()); - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO) } } @@ -399,7 +400,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { } } catch (Exception e) { logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e) - exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", TargetEntity.SO) + exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", ONAPComponents.SO) } } @@ -418,10 +419,10 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor { String rolledBack = getChildText(root, "rolledBack") rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'" exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() + - " from VnfAdapter:" + category + message + rolledBack, TargetEntity.OPENSTACK); + " from VnfAdapter:" + category + message + rolledBack, Components.OPENSTACK); } catch (Exception e) { response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response - exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, TargetEntity.OPENSTACK) + exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, Components.OPENSTACK) } } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java index 2c1d36273d..8efb6a3e1c 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java @@ -44,7 +44,7 @@ import org.onap.so.bpmn.core.domain.VnfResource; import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.client.HttpClient; import org.onap.so.client.HttpClientFactory; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; @@ -383,7 +383,7 @@ public class ResourceRequestBuilder { HttpClient client = new HttpClientFactory().newJsonClient(UriBuilder.fromUri(catalogEndPoint) .path(SERVICE_URL_SERVICE_INSTANCE).queryParam("serviceModelUuid", uuid).build().toURL(), - TargetEntity.CATALOG_DB); + ONAPComponents.CATALOG_DB); client.addAdditionalHeader("Accept", "application/json"); client.addAdditionalHeader("Authorization", UrnPropertiesReader.getVariable("mso.db.auth")); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java index be53e505ac..7684627825 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java @@ -25,6 +25,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks; import java.util.Map; import org.camunda.bpm.engine.delegate.BpmnError; import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.onap.logging.filter.base.ONAPComponentsList; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; @@ -35,8 +36,7 @@ import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; import org.onap.so.db.catalog.client.CatalogDbClient; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.utils.TargetEntities; -import org.onap.so.utils.TargetEntity; +import org.onap.so.utils.Components; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -223,7 +223,7 @@ public class ExecuteBuildingBlockRainyDay { try { String requestId = (String) execution.getVariable("mso-request-id"); WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException"); - TargetEntities extSystemErrorSource = exception.getExtSystemErrorSource(); + ONAPComponentsList extSystemErrorSource = exception.getExtSystemErrorSource(); InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId); Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback"); if (isRollbackFailure == null) { @@ -244,10 +244,10 @@ public class ExecuteBuildingBlockRainyDay { } else if (isRollbackFailure) { logger.debug( "rollbackExtSystemErrorSource is null for isRollbackFailure. Setting rollbackExtSystemErrorSource to UNKNOWN"); - request.setRollbackExtSystemErrorSource(TargetEntity.UNKNOWN.toString()); + request.setRollbackExtSystemErrorSource(Components.UNKNOWN.toString()); } else { logger.debug("extSystemErrorSource is null. Setting extSystemErrorSource to UNKNOWN"); - request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString()); + request.setExtSystemErrorSource(Components.UNKNOWN.toString()); } request.setLastModifiedBy("CamundaBPMN"); diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java index 729f5c95c4..c26a1cfecc 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java @@ -43,8 +43,8 @@ import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvide import org.onap.so.logger.MessageEnum; import org.onap.so.objects.audit.AAIObjectAudit; import org.onap.so.objects.audit.AAIObjectAuditList; -import org.onap.so.utils.TargetEntities; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponentsList; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -92,7 +92,7 @@ public class ExceptionBuilder { } public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { String msg = "Exception in %s.%s "; try { logger.error("Exception occurred", exception); @@ -156,7 +156,7 @@ public class ExceptionBuilder { } public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { String msg = "Exception in %s.%s "; try { logger.error("Exception occurred", exception); @@ -195,7 +195,7 @@ public class ExceptionBuilder { } public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { if (execution instanceof DelegateExecutionImpl) { buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode, errorMessage, extSystemErrorSource); @@ -215,7 +215,7 @@ public class ExceptionBuilder { } public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { String processKey = getProcessKey(execution); logger.info("Building a WorkflowException for Subflow"); @@ -293,7 +293,7 @@ public class ExceptionBuilder { execution.setVariable("StatusMessage", errorMessage.toString()); } else { WorkflowException exception = - new WorkflowException(processKey, 400, errorMessage.toString(), TargetEntity.SO); + new WorkflowException(processKey, 400, errorMessage.toString(), ONAPComponents.SO); execution.setVariable("WorkflowException", exception); execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString()); logger.info("Outgoing WorkflowException is {}", exception); @@ -303,7 +303,7 @@ public class ExceptionBuilder { } else { String errorMessage = "Unable to process audit results due to auditInventoryResult being null"; - WorkflowException exception = new WorkflowException(processKey, 400, errorMessage, TargetEntity.SO); + WorkflowException exception = new WorkflowException(processKey, 400, errorMessage, ONAPComponents.SO); execution.setVariable("WorkflowException", exception); execution.setVariable("WorkflowExceptionErrorMessage", errorMessage); logger.info("Outgoing WorkflowException is {}", exception); diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy index d7438f80f9..fda6b8e6e3 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy @@ -32,7 +32,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.skyscreamer.jsonassert.JSONAssert import org.skyscreamer.jsonassert.JSONCompareMode import org.springframework.core.env.Environment @@ -127,7 +127,7 @@ class CatalogDbUtilsTest { private void mockGetResponseFromCatalogDb(String queryEndpoint) { Environment environmentMock = createEnvironmentMock() when(environmentMock.getProperty("mso.catalog.db.endpoint")).thenReturn("http://testUrl") - when(httpClientFactoryMock.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB)).thenReturn(httpClientMock) + when(httpClientFactoryMock.newJsonClient(new URL(queryEndpoint), ONAPComponents.CATALOG_DB)).thenReturn(httpClientMock) Response responseMock = mock(Response.class) when(httpClientMock.get()).thenReturn(responseMock) diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy index 837bc77f19..7abfcffb13 100644 --- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy +++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy @@ -26,7 +26,7 @@ import org.junit.Test import org.onap.logging.ref.slf4j.ONAPLogConstants import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.springframework.http.HttpStatus import javax.ws.rs.core.MediaType @@ -53,7 +53,7 @@ class ExternalAPIUtilTest { HttpClient httpClient = mock(HttpClient.class) given(httpClient.get()).willReturn(expectedResponse) HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) - given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.EXTERNAL)).willReturn(httpClient) + given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.EXTERNAL)).willReturn(httpClient) // WHEN ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), new ExceptionUtil()) @@ -75,7 +75,7 @@ class ExternalAPIUtilTest { HttpClient httpClient = mock(HttpClient.class) willThrow(new RuntimeException("error occurred")).given(httpClient).get() HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) - given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.EXTERNAL)).willReturn(httpClient) + given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.EXTERNAL)).willReturn(httpClient) DelegateExecution delegateExecution = createDelegateExecution() DummyExceptionUtil exceptionUtil = new DummyExceptionUtil() @@ -97,7 +97,7 @@ class ExternalAPIUtilTest { HttpClient httpClient = mock(HttpClient.class) willThrow(new RuntimeException("error occurred")).given(httpClient).post(BODY_PAYLOAD) HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) - given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.AAI)).willReturn(httpClient) + given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.AAI)).willReturn(httpClient) DelegateExecution delegateExecution = createDelegateExecution() DummyExceptionUtil exceptionUtil = new DummyExceptionUtil() @@ -120,7 +120,7 @@ class ExternalAPIUtilTest { HttpClient httpClient = mock(HttpClient.class) given(httpClient.post(BODY_PAYLOAD)).willReturn(expectedResponse) HttpClientFactory httpClientFactory = mock(HttpClientFactory.class) - given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.AAI)).willReturn(httpClient) + given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.AAI)).willReturn(httpClient) // WHEN ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), new ExceptionUtil()) diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java index 6a48558d11..6d5ce622d9 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java @@ -33,10 +33,11 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.db.request.beans.InfraActiveRequests; import org.onap.so.db.request.client.RequestsDbClient; -import org.onap.so.utils.TargetEntity; +import org.onap.so.utils.Components; @RunWith(MockitoJUnitRunner.class) public class ExecuteBuildingBlockRainyDayUnitTest { @@ -57,7 +58,7 @@ public class ExecuteBuildingBlockRainyDayUnitTest { @Before public void setup() { - exception = new WorkflowException("Test exception", 7000, "", "", TargetEntity.SDNC); + exception = new WorkflowException("Test exception", 7000, "", "", ONAPComponents.SDNC); noExtSystemErrorSourceException = new WorkflowException("Test exception without extsystemErrorSource", 7000, "", ""); @@ -75,7 +76,7 @@ public class ExecuteBuildingBlockRainyDayUnitTest { execution.setVariable("isRollback", false); execution.setVariable("WorkflowException", exception); executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution); - request.setExtSystemErrorSource(TargetEntity.SDNC.toString()); + request.setExtSystemErrorSource(ONAPComponents.SDNC.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } @@ -87,42 +88,42 @@ public class ExecuteBuildingBlockRainyDayUnitTest { execution.setVariable("isRollback", true); execution.setVariable("WorkflowException", exception); executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution); - request.setExtSystemErrorSource(TargetEntity.SDNC.toString()); + request.setExtSystemErrorSource(ONAPComponents.SDNC.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } @Test - public void updateExtSystemErrorSourceisRollbackTargetEntityNullTest() { + public void updateExtSystemErrorSourceisRollbackONAPComponentsNullTest() { doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId); doNothing().when(requestsDbClient).updateInfraActiveRequests(request); execution.setVariable("isRollback", true); execution.setVariable("WorkflowException", noExtSystemErrorSourceException); executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution); - request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString()); + request.setExtSystemErrorSource(Components.UNKNOWN.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } @Test - public void updateExtSystemErrorSourceTargetEntityNullTest() { + public void updateExtSystemErrorSourceONAPComponentsNullTest() { doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId); doNothing().when(requestsDbClient).updateInfraActiveRequests(request); execution.setVariable("isRollback", false); execution.setVariable("WorkflowException", noExtSystemErrorSourceException); executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution); - request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString()); + request.setExtSystemErrorSource(Components.UNKNOWN.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } @Test - public void updateExtSystemErrorSourceTargetEntityisRollbackNullTest() { + public void updateExtSystemErrorSourceONAPComponentsisRollbackNullTest() { doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId); doNothing().when(requestsDbClient).updateInfraActiveRequests(request); executionNullisRollback.setVariable("WorkflowException", exception); executeBuildingBlockRainyDay.updateExtSystemErrorSource(executionNullisRollback); - request.setExtSystemErrorSource(TargetEntity.SDNC.toString()); + request.setExtSystemErrorSource(ONAPComponents.SDNC.toString()); verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request); } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java index b109ae258d..5baafbba67 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java @@ -39,7 +39,7 @@ import org.mockito.Mock; import org.mockito.Spy; import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.bpmn.common.BuildingBlockExecution; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; @RunWith(MockitoJUnitRunner.class) public class ExceptionBuilderUnitTest { @@ -67,12 +67,12 @@ public class ExceptionBuilderUnitTest { String expectedErrorMessage = "Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message"; doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage, - TargetEntity.SDNC); + ONAPComponents.SDNC); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, TargetEntity.SDNC); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, ONAPComponents.SDNC); verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage, - TargetEntity.SDNC); + ONAPComponents.SDNC); } @Test @@ -80,12 +80,12 @@ public class ExceptionBuilderUnitTest { String expectedErrorMessage = "Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message"; doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(buildingBlockExecution, 7000, - expectedErrorMessage, TargetEntity.SDNC); + expectedErrorMessage, ONAPComponents.SDNC); - exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, e, TargetEntity.SDNC); + exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, e, ONAPComponents.SDNC); verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(buildingBlockExecution, 7000, - expectedErrorMessage, TargetEntity.SDNC); + expectedErrorMessage, ONAPComponents.SDNC); } @Test @@ -93,6 +93,6 @@ public class ExceptionBuilderUnitTest { doReturn("Process key").when(exceptionBuilder).getProcessKey(execution); thrown.expect(BpmnError.class); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC); } } diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java index 7d5bb0dcf1..f8dfad61f2 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java @@ -21,7 +21,7 @@ package org.onap.so.bpmn.core; import java.io.Serializable; -import org.onap.so.utils.TargetEntities; +import org.onap.logging.filter.base.ONAPComponentsList; /** * An object that represents a workflow exception. @@ -33,7 +33,7 @@ public class WorkflowException implements Serializable { private final int errorCode; private final String errorMessage; private final String workStep; - private TargetEntities extSystemErrorSource; + private ONAPComponentsList extSystemErrorSource; /** * Constructor @@ -50,7 +50,7 @@ public class WorkflowException implements Serializable { } public WorkflowException(String processKey, int errorCode, String errorMessage, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { this.processKey = processKey; this.errorCode = errorCode; this.errorMessage = errorMessage; @@ -66,7 +66,7 @@ public class WorkflowException implements Serializable { } public WorkflowException(String processKey, int errorCode, String errorMessage, String workStep, - TargetEntities extSystemErrorSource) { + ONAPComponentsList extSystemErrorSource) { this.processKey = processKey; this.errorCode = errorCode; this.errorMessage = errorMessage; @@ -102,7 +102,7 @@ public class WorkflowException implements Serializable { return workStep; } - public TargetEntities getExtSystemErrorSource() { + public ONAPComponentsList getExtSystemErrorSource() { return extSystemErrorSource; } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java index a049f81906..03feda6d0f 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java @@ -38,9 +38,7 @@ import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource; import org.onap.so.bpmn.common.workflow.service.WorkflowResource; import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor; import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor; -import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -65,7 +63,7 @@ public class CXFConfiguration { private WorkflowAsyncResource workflowAsyncResource; @Autowired - private JaxRsFilterLogging jaxRsFilterLogging; + private SOAuditLogContainerFilter soAuditLogContainerFilter; @Autowired private ObjectMapper mapper; @@ -108,7 +106,7 @@ public class CXFConfiguration { endpoint.setServiceBeans(Arrays.<Object>asList(wmr, workflowResource, workflowAsyncResource)); endpoint.setAddress("/"); endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature())); - endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), jaxRsFilterLogging)); + endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), soAuditLogContainerFilter)); return endpoint.create(); } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java index a4fc6e54b0..29fc4e93fc 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java @@ -33,7 +33,7 @@ import org.camunda.bpm.engine.repository.DeploymentBuilder; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; import org.onap.so.db.catalog.beans.Workflow; import org.onap.so.db.catalog.client.CatalogDbClient; -import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; +import org.onap.logging.filter.spring.MDCTaskDecorator;; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy index 901964f465..2e664d90da 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy @@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory import org.onap.so.bpmn.core.UrnPropertiesReader import javax.ws.rs.core.Response -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; /** * This groovy class supports the <class>DoCreateVFCNetworkServiceInstance.bpmn</class> process. @@ -273,7 +273,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor { // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7' // user 'bepl' authHeader is the same with mso.db.auth String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution) - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER) httpClient.addAdditionalHeader("Accept", "application/json") httpClient.addAdditionalHeader("Authorization", basicAuthValuedb) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy index 7abdd49d1d..1d3b2757e7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy @@ -52,7 +52,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.apache.commons.lang3.* import javax.ws.rs.core.MediaType import org.apache.commons.codec.binary.Base64 -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; /** diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy index 41a302f5f1..e34e505e55 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy @@ -35,7 +35,7 @@ import org.onap.so.bpmn.common.scripts.NetworkUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.common.scripts.VidUtils import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import javax.ws.rs.core.Response import org.camunda.bpm.engine.delegate.BpmnError @@ -199,7 +199,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso execution.setVariable(Prefix + "urlRollbackPoNetwork", urlRollbackPoNetwork) URL url = new URL(urlRollbackPoNetwork) - HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.OPENSTACK_ADAPTER) httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO")) Response response = httpClient.delete(rollbackNetworkRequest) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy index 1517a335d9..2def9e2d06 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy @@ -39,7 +39,7 @@ import org.slf4j.Logger import org.slf4j.LoggerFactory import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import javax.ws.rs.core.Response @@ -258,7 +258,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7' // user 'bepl' authHeader is the same with mso.db.auth String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution) - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER) httpClient.addAdditionalHeader("Accept", "application/json") httpClient.addAdditionalHeader("Authorization", basicAuthValuedb) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 731c5b8dc5..dafc4b5470 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -67,7 +67,7 @@ import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.w3c.dom.Document import org.w3c.dom.Element import org.w3c.dom.NamedNodeMap @@ -698,7 +698,7 @@ public class DoCreateVfModule extends VfModuleBase { String endPoint = aaiUriUtil.createAaiUri(uri) try { - HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), TargetEntity.AAI) + HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), ONAPComponents.AAI) client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', 'MSO') client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML) @@ -781,7 +781,7 @@ public class DoCreateVfModule extends VfModuleBase { AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId).queryParam("vf-module-name",vfModuleName) String endPoint = aaiUriUtil.createAaiUri(uri) - HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), TargetEntity.AAI) + HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), ONAPComponents.AAI) client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', 'MSO') client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index 34ea20ba62..a24bc4411e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -54,7 +54,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.springframework.web.util.UriUtils import javax.ws.rs.NotFoundException @@ -388,7 +388,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String serviceAaiPath = "${aai_endpoint}${urlLink}" URL url = new URL(serviceAaiPath) - HttpClient client = new HttpClientFactory().newXmlClient(url, TargetEntity.AAI) + HttpClient client = new HttpClientFactory().newXmlClient(url, ONAPComponents.AAI) client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution)) client.addAdditionalHeader("X-FromAppId", "MSO") client.addAdditionalHeader("X-TransactionId", utils.getRequestID()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy index df8735aaaa..09eb7994a8 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy @@ -51,7 +51,7 @@ import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import groovy.json.JsonOutput import javax.ws.rs.core.Response @@ -455,7 +455,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor { String vnfAdapterRequest = execution.getVariable(Prefix + "deleteNetworkRequest") URL url = new URL(vnfAdapterUrl) - HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.OPENSTACK_ADAPTER) httpClient.accept = "application/xml" httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO")) Response response = httpClient.delete(vnfAdapterRequest) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy index 00244aded0..28f4460d71 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy @@ -34,7 +34,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.bpmn.core.UrnPropertiesReader import javax.ws.rs.core.Response @@ -226,7 +226,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7' // user 'bepl' authHeader is the same with mso.db.auth String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution) - HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER) + HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.VNF_ADAPTER) httpClient.addAdditionalHeader("Accept", "application/json") httpClient.addAdditionalHeader("Authorization", basicAuthValuedb) @@ -257,7 +257,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces // Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7' // user 'bepl' authHeader is the same with mso.db.auth String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution) - HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER) + HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.VNF_ADAPTER) httpClient.addAdditionalHeader("Accept", "application/json") httpClient.addAdditionalHeader("Authorization", basicAuthValuedb) httpClient.addAdditionalHeader("Content-Type", "application/json") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy index 2a8cc08cdf..367975e003 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy @@ -51,7 +51,7 @@ import org.onap.so.bpmn.infrastructure.vfcmodel.LocationConstraint import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; @@ -209,7 +209,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess try{ URL url = new URL(urlString); - HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER) httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk") apiResponse = httpClient.post(requestBody) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy index 75ac6900fa..cfdba89db7 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy @@ -45,7 +45,7 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import org.onap.so.utils.TargetEntity +import org.onap.logging.filter.base.ONAPComponents; /** * This class supports the VID Flow @@ -164,7 +164,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor { logger.debug("AAI endPoint: " + endPoint) try { - HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI) + HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), ONAPComponents.AAI) client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString()) client.addAdditionalHeader('X-FromAppId', 'MSO') client.addAdditionalHeader('Content-Type', 'application/xml') diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java index f1fd23fe82..f10b503ed3 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java @@ -65,7 +65,7 @@ import org.onap.so.client.sniro.beans.ServiceInfo; import org.onap.so.client.sniro.beans.SniroManagerRequest; import org.onap.so.client.sniro.beans.SubscriberInfo; import org.onap.so.db.catalog.beans.OrchestrationStatus; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -162,14 +162,14 @@ public class SniroHomingV2 { } catch (BpmnError e) { logger.error(EXCEPTION_OCCURRED, e); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(), - TargetEntity.SNIRO); + ONAPComponents.SNIRO); } catch (BadResponseException e) { logger.error(EXCEPTION_OCCURRED, e); - exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO); + exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), ONAPComponents.SNIRO); } catch (Exception e) { logger.error(EXCEPTION_OCCURRED, e); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, - "Internal Error - occurred while preparing sniro request: " + e.getMessage(), TargetEntity.SO); + "Internal Error - occurred while preparing sniro request: " + e.getMessage(), ONAPComponents.SO); } } @@ -214,15 +214,15 @@ public class SniroHomingV2 { } catch (BpmnError e) { logger.error(EXCEPTION_OCCURRED, e); exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(), - TargetEntity.SNIRO); + ONAPComponents.SNIRO); } catch (BadResponseException e) { logger.error(EXCEPTION_OCCURRED, e); - exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO); + exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), ONAPComponents.SNIRO); } catch (Exception e) { logger.error(EXCEPTION_OCCURRED, e); exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL, "Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage(), - TargetEntity.SO); + ONAPComponents.SO); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java index e9d33f46ab..2705d00d6b 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java @@ -38,11 +38,12 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest; import org.onap.so.adapters.nwrest.UpdateNetworkResponse; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.NetworkAdapterResources; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.onap.so.utils.Components; @Component public class NetworkAdapterRestV1 { @@ -94,7 +95,7 @@ public class NetworkAdapterRestV1 { throw new Exception("No Network Request was created. networkAdapterRequest was null."); } } catch (Exception ex) { - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } @@ -139,7 +140,7 @@ public class NetworkAdapterRestV1 { } } catch (Exception e) { logger.error("Error in Openstack Adapter callback", e); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.OPENSTACK); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), Components.OPENSTACK); } } @@ -152,7 +153,7 @@ public class NetworkAdapterRestV1 { public void handleTimeOutException(DelegateExecution execution) { exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, - "Error timed out waiting on Openstack Async-Response", TargetEntity.SO); + "Error timed out waiting on Openstack Async-Response", ONAPComponents.SO); } public void handleSyncError(DelegateExecution execution) { @@ -160,6 +161,6 @@ public class NetworkAdapterRestV1 { String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE); String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = " + responseString; - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, TargetEntity.OPENSTACK); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, Components.OPENSTACK); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java index 080d6d34b1..192cb3fc90 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java @@ -32,7 +32,7 @@ import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.SDNCVnfResources; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.onap.so.client.orchestration.SDNCVfModuleResources; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -80,13 +80,13 @@ public class SDNCQueryTasks { } catch (BadResponseException ex) { logger.error("Exception occurred", ex); if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC); } else { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } catch (Exception ex) { logger.error("Exception occurred", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } @@ -121,9 +121,9 @@ public class SDNCQueryTasks { } catch (BadResponseException ex) { logger.error("Exception occurred for BadResponse ", ex); if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC); } else { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } catch (Exception ex) { logger.error("Exception occurred", ex); @@ -158,18 +158,18 @@ public class SDNCQueryTasks { // module id, then we should throw // the error as normal if (!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, ONAPComponents.SO); } } catch (BadResponseException ex) { logger.error("Error occurred for BadResponseException in SDNCQueryTasks queryVfModuleForVolumeGroup ", ex); if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC); } else { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } catch (Exception ex) { logger.error("Exception occurred", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO); } } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java index 03714db943..3383fde0a8 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java @@ -37,7 +37,7 @@ import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCRequest; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -80,19 +80,19 @@ public class SDNCRequestTasks { } catch (PathNotFoundException e) { logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, - "Recieved invalid response from SDNC, unable to read message content.", TargetEntity.SO); + "Recieved invalid response from SDNC, unable to read message content.", ONAPComponents.SO); } catch (MapperException e) { logger.error("Failed to map SDNC object to JSON prior to POST.", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, - "Failed to map SDNC object to JSON prior to POST.", TargetEntity.SO); + "Failed to map SDNC object to JSON prior to POST.", ONAPComponents.SO); } catch (BadResponseException e) { logger.error("Did not receive a successful response from SDNC.", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage(), - TargetEntity.SDNC); + ONAPComponents.SDNC); } catch (HttpClientErrorException e) { logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.", - TargetEntity.SO); + ONAPComponents.SO); } } @@ -123,17 +123,17 @@ public class SDNCRequestTasks { } } catch (SDNCErrorResponseException e) { logger.error("SDNC error response - " + e.getMessage()); - exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC); } catch (Exception e) { logger.error("Error processing SDNC callback", e); exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error processing SDNC callback", - TargetEntity.SO); + ONAPComponents.SO); } } public void handleTimeOutException(DelegateExecution execution) { exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, - "Error timed out waiting on SDNC Async-Response", TargetEntity.SO); + "Error timed out waiting on SDNC Async-Response", ONAPComponents.SO); } protected boolean convertIndicatorToBoolean(String finalMessageIndicator) { diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java index 8aea2d2650..3994208d23 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java @@ -39,7 +39,8 @@ import org.onap.so.bpmn.BaseTaskTest; import org.onap.so.client.exception.BadResponseException; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.exception.MapperException; -import org.onap.so.utils.TargetEntity; +import org.onap.so.utils.Components; +import org.onap.logging.filter.base.ONAPComponents; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.eq; @@ -113,7 +114,7 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest { delegateExecution.setVariable("NetworkAResponse_MESSAGE", updateNetworkResponse.toXmlString()); doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder).buildAndThrowWorkflowException( - any(DelegateExecution.class), anyInt(), any(String.class), any(TargetEntity.class)); + any(DelegateExecution.class), anyInt(), any(String.class), any(ONAPComponents.class)); try { networkAdapterRestV1Tasks.processCallback(delegateExecution); @@ -122,6 +123,6 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest { } assertNull(delegateExecution.getVariable("updateNetworkResponse")); verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), eq(7000), - eq("test error message"), eq(TargetEntity.OPENSTACK)); + eq("test error message"), eq(Components.OPENSTACK)); } } diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java index 0ba9237aaf..e158925568 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java @@ -44,8 +44,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.BadResponseException; -import org.onap.so.utils.TargetEntities; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponentsList; +import org.onap.logging.filter.base.ONAPComponents; public class SDNCQueryTasksTest extends BaseTaskTest { @InjectMocks @@ -65,7 +65,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { vfModule = setVfModule(); doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException( - any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(TargetEntities.class)); + any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(ONAPComponentsList.class)); when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID))) .thenReturn(serviceInstance); @@ -98,7 +98,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVfModule(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC); } @Test @@ -109,7 +109,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVfModule(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO); } @Test @@ -133,7 +133,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVnf(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC); } @Test @@ -144,7 +144,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVnf(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO); } @Test @@ -169,7 +169,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVfModuleForVolumeGroup(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC); } @Test @@ -180,7 +180,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest { expectedException.expect(BpmnError.class); sdncQueryTasks.queryVfModuleForVolumeGroup(execution); - verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO); + verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO); } @Test diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java index 0fc33fe5ce..e435909f59 100644 --- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java @@ -49,7 +49,7 @@ import org.onap.so.client.exception.MapperException; import org.onap.so.client.sdnc.SDNCClient; import org.onap.so.client.sdnc.beans.SDNCRequest; import org.onap.so.client.sdnc.endpoint.SDNCTopology; -import org.onap.so.utils.TargetEntity; +import org.onap.logging.filter.base.ONAPComponents; import org.w3c.dom.Document; import org.xml.sax.InputSource; import com.fasterxml.jackson.core.JsonParseException; |