diff options
Diffstat (limited to 'bpmn/mso-infrastructure-bpmn')
21 files changed, 324 insertions, 331 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java index 02164ccec1..920cb11e4c 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,6 +35,8 @@ import org.camunda.bpm.engine.runtime.MessageCorrelationResult; import org.onap.so.bpmn.core.UrnPropertiesReader; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -47,7 +51,7 @@ public class CallbackHandlerService { public static final long FAST_POLL_INT_MS = 100; public static final long SLOW_POLL_INT_MS = 1000; - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CallbackHandlerService.class); + private static final Logger logger = LoggerFactory.getLogger(CallbackHandlerService.class); @Autowired RuntimeService runtimeService; @@ -75,7 +79,7 @@ public class CallbackHandlerService { long startTime = System.currentTimeMillis(); - LOGGER.debug(logMarker + " " + method + " received message: " + logger.debug(logMarker + " " + method + " received message: " + (message == null ? "" : System.lineSeparator()) + message); try { @@ -101,7 +105,7 @@ public class CallbackHandlerService { logCallbackSuccess(method, startTime); return new CallbackSuccess(); } catch (Exception e) { - LOGGER.debug("Exception :",e); + logger.debug("Exception :",e); String msg = "Caught " + e.getClass().getSimpleName() + " processing " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "'"; @@ -133,7 +137,7 @@ public class CallbackHandlerService { protected boolean correlate(String messageEventName, String correlationVariable, String correlationValue, Map<String, Object> variables, String logMarker) { try{ - LOGGER.debug(logMarker + " Attempting to find process waiting" + logger.debug(logMarker + " Attempting to find process waiting" + " for " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "'"); @@ -200,7 +204,7 @@ public class CallbackHandlerService { execInfoList.add(new ExecInfo(execution)); } - LOGGER.debug(logMarker + " Found " + count + " process(es) waiting" + logger.debug(logMarker + " Found " + count + " process(es) waiting" + " for " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "': " + execInfoList); @@ -211,9 +215,9 @@ public class CallbackHandlerService { + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "'; last exception was:" + queryException; - LOGGER.debug(msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, queryException); + logger.debug(msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), msg, queryException); } return false; @@ -234,7 +238,7 @@ public class CallbackHandlerService { // acknowledged the notification associated with request #1. try { - LOGGER.debug(logMarker + " Running " + execInfoList.get(0) + " to receive " + logger.debug(logMarker + " Running " + execInfoList.get(0) + " to receive " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "'"); @@ -254,9 +258,9 @@ public class CallbackHandlerService { String msg = "Caught " + ole.getClass().getSimpleName() + " after receiving " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "': " + ole; - LOGGER.debug(msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, ole); + logger.debug(msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, ole); //Retry for OptimisticLocking Exceptions int retryCount = 0; @@ -269,7 +273,7 @@ public class CallbackHandlerService { } } - LOGGER.debug("Retry correlate for OptimisticLockingException, retryCount:" + retryCount); + logger.debug("Retry correlate for OptimisticLockingException, retryCount:{}", retryCount); for (; retryCount >0 ; retryCount--) { @@ -283,20 +287,20 @@ public class CallbackHandlerService { .processInstanceVariableEquals(correlationVariable, correlationValue) .correlateWithResult(); retryCount = 0; - LOGGER.debug("OptimisticLockingException retry was successful, seting retryCount: " + retryCount); + logger.debug("OptimisticLockingException retry was successful, seting retryCount: {}", retryCount); } catch (OptimisticLockingException olex) { //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException; String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + olex; - LOGGER.debug(strMsg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, strMsg, olex); + logger.debug(strMsg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, olex); } catch (Exception excep) { retryCount = 0; //oleFlag = ex instanceof org.camunda.bpm.engine.OptimisticLockingException; String strMsg = "Received exception, OptimisticLockingException retry failed, retryCount:" + retryCount + " | exception returned: " + excep; - LOGGER.debug(strMsg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, strMsg, excep); + logger.debug(strMsg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, excep); } } @@ -308,9 +312,9 @@ public class CallbackHandlerService { + execInfoList.get(0) + " after receiving " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "': " + e; - LOGGER.debug(msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, e); + logger.debug(msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); } } catch (Exception e) { // This must be an exception from the flow itself. Log it, but don't @@ -318,9 +322,9 @@ public class CallbackHandlerService { String msg = "Caught " + e.getClass().getSimpleName() + " after receiving " + messageEventName + " with " + correlationVariable + " = '" + correlationValue + "': " + e; - LOGGER.debug(msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN CORRELATION ERROR -", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, e); + logger.debug(msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); } return true; @@ -332,12 +336,6 @@ public class CallbackHandlerService { * @param startTime the request start time */ protected void logCallbackSuccess(String method, long startTime) { - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, - MsoLogger.ResponseCode.Suc, "Completed " + method); - - LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, - MsoLogger.ResponseCode.Suc, "Completed " + method, - "BPMN", MsoLogger.getServiceName(), null); } /** @@ -361,19 +359,12 @@ public class CallbackHandlerService { */ protected void logCallbackError(String method, long startTime, String msg, Exception e) { if (e == null) { - LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), msg); } else { - LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, msg, e); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), msg, e); } - - LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, - MsoLogger.ResponseCode.InternalError, "Completed " + method); - - LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, - MsoLogger.ResponseCode.InternalError, "Completed " + method, - "BPMN", MsoLogger.getServiceName(), null); } /** diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java index 014b06deff..f9f06447a7 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -39,8 +41,9 @@ import org.onap.logging.ref.slf4j.ONAPLogConstants; import org.onap.so.bpmn.common.workflow.context.WorkflowContext; import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder; import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; -import org.onap.so.logger.MsoLogger; import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -79,7 +82,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService { this.processor = processor; } - protected static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,WorkflowAsyncResource.class); + protected static final Logger logger = LoggerFactory.getLogger(WorkflowAsyncResource.class); protected static final long DEFAULT_WAIT_TIME = 60000; //default wait time /** diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java index 02cda8009f..8b35f0e6d6 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -36,6 +38,8 @@ import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackE import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -54,7 +58,7 @@ import io.swagger.annotations.ApiOperation; @Api(description = "Provides a generic service to inject messages into a waiting BPMN Proccess") @Component public class WorkflowMessageResource{ - private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowMessageResource.class); + private static final Logger logger = LoggerFactory.getLogger(WorkflowMessageResource.class); private static final String LOGMARKER = "[WORKFLOW-MESSAGE]"; @Autowired @@ -78,7 +82,7 @@ public class WorkflowMessageResource{ MsoLogger.setServiceName("MSO." + method); MsoLogger.setLogContext(correlator, "N/A"); - LOGGER.debug(LOGMARKER + " Received workflow message" + logger.debug(LOGMARKER + " Received workflow message" + " type='" + messageType + "'" + " correlator='" + correlator + "'" + (contentType == null ? "" : " contentType='" + contentType + "'") @@ -86,17 +90,17 @@ public class WorkflowMessageResource{ if (messageType == null || messageType.isEmpty()) { String msg = "Missing message type"; - LOGGER.debug(LOGMARKER + " " + msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg); + logger.debug(LOGMARKER + " " + msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); return Response.status(400).entity(msg).build(); } if (correlator == null || correlator.isEmpty()) { String msg = "Missing correlator"; - LOGGER.debug(LOGMARKER + " " + msg); - LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.DataError, LOGMARKER + ":" + msg); + logger.debug(LOGMARKER + " " + msg); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg); return Response.status(400).entity(msg).build(); } @@ -121,4 +125,4 @@ public class WorkflowMessageResource{ return Response.status(204).build(); } } -}
\ No newline at end of file +} diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java index 5afd7e00e8..b1062962a6 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -29,15 +31,16 @@ import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.runtime.ProcessInstance; import org.camunda.bpm.engine.variable.impl.VariableMapImpl; import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; -import org.onap.so.logger.MsoLogger; import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @Service public class WorkflowProcessor extends ProcessEngineAwareService { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowProcessor.class); + private static final Logger logger = LoggerFactory.getLogger(WorkflowProcessor.class); protected static final String logMarker = "[WRKFLOW-RESOURCE]"; @Async @@ -55,21 +58,17 @@ public class WorkflowProcessor extends ProcessEngineAwareService { // Note: this creates a random businessKey if it wasn't specified. String businessKey = getBusinessKey(inputVariables); - msoLogger.debug("***Received MSO startProcessInstanceByKey with processKey: " + processKey - + " and variables: " + inputVariables); + logger.debug("***Received MSO startProcessInstanceByKey with processKey: {} and variables: {}", processKey, + inputVariables); RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processKey, businessKey, inputVariables); processInstanceId = processInstance.getId(); - msoLogger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " " + logger.debug(logMarker + "Process " + processKey + ":" + processInstanceId + " " + (processInstance.isEnded() ? "ENDED" : "RUNNING")); } catch (Exception e) { - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, - logMarker + "Error in starting the process: " + e.getMessage()); - WorkflowResponse workflowResponse = new WorkflowResponse(); workflowResponse.setResponse("Error occurred while executing the process: " + e); workflowResponse.setProcessInstanceID(processInstanceId); diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java index c2a7f41140..92f1b7a816 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java @@ -5,6 +5,8 @@ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -50,6 +52,8 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowResponse; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.slf4j.MDC; import org.springframework.stereotype.Component; @@ -61,7 +65,7 @@ import io.swagger.annotations.ApiOperation; @Component public class WorkflowResource extends ProcessEngineAwareService { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowResource.class); + private static final Logger logger = LoggerFactory.getLogger(WorkflowResource.class); private static final String LOGMARKER = "[WRKFLOW-RESOURCE]"; private static final int DEFAULT_WAIT_TIME = 30000; @@ -99,7 +103,7 @@ public class WorkflowResource extends ProcessEngineAwareService { try { //Kickoff the process - ProcessThread thread = new ProcessThread(inputVariables,processKey,msoLogger); + ProcessThread thread = new ProcessThread(inputVariables,processKey); thread.start(); Map<String, Object> responseMap = null; @@ -141,7 +145,7 @@ public class WorkflowResource extends ProcessEngineAwareService { processInstance = thread.getProcessInstance(); if (processInstance == null) { - msoLogger.debug(LOGMARKER + processKey + " process has not been created yet"); + logger.debug("{} process has not been created yet", LOGMARKER + processKey ); continue; } @@ -151,7 +155,7 @@ public class WorkflowResource extends ProcessEngineAwareService { responseMap = getResponseMap(processInstance, processKey, timeProcessEnded); if (responseMap == null) { - msoLogger.debug(LOGMARKER + processKey + " has not produced a response yet"); + logger.debug("{} has not produced a response yet", LOGMARKER + processKey); if (timeProcessEnded.longValue() != 0) { long elapsedSinceEnded = System.currentTimeMillis() - timeProcessEnded.longValue(); @@ -192,14 +196,15 @@ public class WorkflowResource extends ProcessEngineAwareService { workflowResponse.setMessageCode(500); return Response.status(500).entity(workflowResponse).build(); } catch (Exception ex) { - msoLogger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex); + logger.debug(LOGMARKER + "Exception in startProcessInstance by key",ex); workflowResponse.setMessage("Fail" ); workflowResponse.setResponse("Error occurred while executing the process: " + ex.getMessage()); if (processInstance != null) workflowResponse.setProcessInstanceID(processInstance.getId()); - - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), - MsoLogger.ErrorCode.UnknownError, LOGMARKER + workflowResponse.getMessage() - + " for processKey: " + processKey + " with response: " + workflowResponse.getResponse()); + + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey), + MsoLogger.ErrorCode.UnknownError.getValue(), + LOGMARKER + workflowResponse.getMessage() + " for processKey: " + processKey + " with response: " + + workflowResponse.getResponse()); workflowResponse.setMessageCode(500); recordEvents(processKey, workflowResponse, startTime); @@ -222,21 +227,13 @@ public class WorkflowResource extends ProcessEngineAwareService { try { return Integer.parseInt(timeout)*1000; } catch (NumberFormatException nex) { - msoLogger.debug("Invalid input for mso-service-request-timeout"); + logger.debug("Invalid input for mso-service-request-timeout"); } } return DEFAULT_WAIT_TIME; } private void recordEvents(String processKey, WorkflowResponse response, long startTime) { - - msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - LOGMARKER + response.getMessage() + " for processKey: " - + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - LOGMARKER + response.getMessage() + " for processKey: " - + processKey + " with response: " + response.getResponse()); } private void setLogContext(String processKey, Map<String, Object> inputVariables) { @@ -266,7 +263,7 @@ public class WorkflowResource extends ProcessEngineAwareService { try { return pes.getRuntimeService().createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult() == null ? true : false ; } catch (Exception e) { - msoLogger.debug("Exception :",e); + logger.debug("Exception :",e); return true; } } @@ -287,7 +284,7 @@ public class WorkflowResource extends ProcessEngineAwareService { try { workflowResponse.setMessageCode(Integer.parseInt(responseCode)); } catch(NumberFormatException nex) { - msoLogger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode); + logger.debug(LOGMARKER + "Failed to parse ResponseCode: " + responseCode); workflowResponse.setMessageCode(-1); } @@ -298,7 +295,7 @@ public class WorkflowResource extends ProcessEngineAwareService { } else if ("Fail".equalsIgnoreCase(String.valueOf(status))) { workflowResponse.setMessage("Fail"); } else { - msoLogger.debug(LOGMARKER + "Unrecognized Status: " + responseCode); + logger.debug(LOGMARKER + "Unrecognized Status: " + responseCode); workflowResponse.setMessage("Fail"); } } @@ -310,15 +307,13 @@ public class WorkflowResource extends ProcessEngineAwareService { private class ProcessThread extends Thread { private final Map<String,Object> inputVariables; private final String processKey; - private final MsoLogger msoLogger; private final String businessKey; private ProcessInstance processInstance = null; private Exception exception = null; - public ProcessThread(Map<String, Object> inputVariables, String processKey, MsoLogger msoLogger) { + public ProcessThread(Map<String, Object> inputVariables, String processKey) { this.inputVariables = inputVariables; this.processKey = processKey; - this.msoLogger = msoLogger; this.businessKey = UUID.randomUUID().toString(); } @@ -352,14 +347,6 @@ public class WorkflowResource extends ProcessEngineAwareService { long startTime = System.currentTimeMillis(); try { - msoLogger.debug(LOGMARKER + "***Received MSO startProcessInstanceByKey with processKey:" - + processKey + " and variables: " + inputVariables); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER - + "Call to MSO workflow/services in Camunda. Received MSO startProcessInstanceByKey with" - + " processKey:" + processKey - + " businessKey:" + businessKey - + " variables: " + inputVariables); RuntimeService runtimeService = getProcessEngineServices().getRuntimeService(); @@ -370,7 +357,7 @@ public class WorkflowResource extends ProcessEngineAwareService { processKey, inputVariables); } catch (Exception e) { - msoLogger.debug(LOGMARKER + "ProcessThread caught an exception executing " + logger.debug(LOGMARKER + "ProcessThread caught an exception executing " + processKey + ": " + e); setException(e); } @@ -441,7 +428,7 @@ public class WorkflowResource extends ProcessEngineAwareService { responseMapVariable); if (responseMap != null) { - msoLogger.debug(LOGMARKER + "Obtained " + responseMapVariable + logger.debug(LOGMARKER + "Obtained " + responseMapVariable + " from process " + processInstanceId + " history"); return responseMap; } @@ -455,12 +442,12 @@ public class WorkflowResource extends ProcessEngineAwareService { // Check for 'WorkflowResponse' variable Object workflowResponseObject = getVariableFromHistory(historyService, processInstanceId, "WorkflowResponse"); String workflowResponse = workflowResponseObject == null ? null : String.valueOf(workflowResponseObject); - msoLogger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse); + logger.debug(LOGMARKER + "WorkflowResponse: " + workflowResponse); if (workflowResponse != null) { Object responseCodeObject = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); String responseCode = responseCodeObject == null ? null : String.valueOf(responseCodeObject); - msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); + logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); responseMap = new HashMap<>(); responseMap.put("WorkflowResponse", workflowResponse); responseMap.put("ResponseCode", responseCode); @@ -496,17 +483,17 @@ public class WorkflowResource extends ProcessEngineAwareService { } } - msoLogger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText); + logger.debug(LOGMARKER + "WorkflowException: " + workflowExceptionText); // BEGIN LEGACY SUPPORT. TODO: REMOVE THIS CODE Object object = getVariableFromHistory(historyService, processInstanceId, processKey + "Response"); String response = object == null ? null : String.valueOf(object); - msoLogger.debug(LOGMARKER + processKey + "Response: " + response); + logger.debug(LOGMARKER + processKey + "Response: " + response); if (response != null) { object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); String responseCode = object == null ? null : String.valueOf(object); - msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); + logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); responseMap = new HashMap<>(); responseMap.put("Response", response); responseMap.put("ResponseCode", responseCode); @@ -516,12 +503,12 @@ public class WorkflowResource extends ProcessEngineAwareService { object = getVariableFromHistory(historyService, processInstanceId, prefix + "ErrorResponse"); String errorResponse = object == null ? null : String.valueOf(object); - msoLogger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse); + logger.debug(LOGMARKER + prefix + "ErrorResponse: " + errorResponse); if (errorResponse != null) { object = getVariableFromHistory(historyService, processInstanceId, prefix + "ResponseCode"); String responseCode = object == null ? null : String.valueOf(object); - msoLogger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); + logger.debug(LOGMARKER + prefix + "ResponseCode: " + responseCode); responseMap = new HashMap<>(); responseMap.put("Response", errorResponse); responseMap.put("ResponseCode", responseCode); @@ -545,7 +532,7 @@ public class WorkflowResource extends ProcessEngineAwareService { return runtimeService.getVariable(executionId, variableName); } catch (ProcessEngineException e) { // Most likely cause is that the execution no longer exists. - msoLogger.debug("Error retrieving execution " + executionId + logger.debug("Error retrieving execution " + executionId + " variable " + variableName + ": " + e); return null; } @@ -562,8 +549,8 @@ public class WorkflowResource extends ProcessEngineAwareService { .processInstanceId(processInstanceId).variableName(variableName).singleResult(); return v == null ? null : v.getValue(); } catch (Exception e) { - msoLogger.debug("Error retrieving process " + processInstanceId - + " variable " + variableName + " from history: " + e); + logger.debug("Error retrieving process {} variable {} from history: ", processInstanceId, + variableName, e); return null; } } @@ -589,42 +576,27 @@ public class WorkflowResource extends ProcessEngineAwareService { variablesMap.put(variableInstance.getName(), variableInstance.getValue().toString()); } - msoLogger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " + variablesMap.toString()); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, LOGMARKER - + "Call to MSO workflow/services in Camunda. Received MSO getProcessVariables with processKey:" - + processKey + " and variables: " - + variablesMap.toString()); - + logger.debug(LOGMARKER + "***Received MSO getProcessVariables with processKey:" + processKey + " and variables: " + + variablesMap.toString()); response.setVariables(variablesMap); response.setMessage("Success"); response.setResponse("Successfully retrieved the variables"); response.setProcessInstanceID(processInstanceId); - msoLogger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response.getResponse()); + logger.debug(LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response + .getResponse()); } catch (Exception ex) { response.setMessage("Fail"); response.setResponse("Failed to retrieve the variables," + ex.getMessage()); response.setProcessInstanceID(processInstanceId); - - msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "BPMN", MDC.get(processKey), MsoLogger.ErrorCode.UnknownError, LOGMARKER - + response.getMessage() - + " for processKey: " - + processKey - + " with response: " - + response.getResponse()); - msoLogger.debug("Exception :",ex); + + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "BPMN", MDC.get(processKey), + MsoLogger.ErrorCode.UnknownError.getValue(), + LOGMARKER + response.getMessage() + " for processKey: " + processKey + " with response: " + response + .getResponse()); + logger.debug("Exception :",ex); } - - msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - LOGMARKER + response.getMessage() + " for processKey: " - + processKey + " with response: " + response.getResponse(), "BPMN", MDC.get(processKey), null); - - msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - LOGMARKER + response.getMessage() + " for processKey: " - + processKey + " with response: " + response.getResponse()); - return response; } } diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java index 5435194f39..62aad7e345 100644 --- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java +++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -56,7 +58,8 @@ import org.onap.so.bpmn.core.BPMNLogger; import org.onap.so.logger.MessageEnum; import org.onap.so.logger.MsoLogger; -import org.slf4j.MDC; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.AbstractEnvironment; import org.springframework.core.env.Environment; @@ -279,7 +282,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { * Logs details about the current activity. */ public class LoggingExecutionListener implements ExecutionListener { - private final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,LoggingExecutionListener.class); + private final Logger logger = LoggerFactory.getLogger(LoggingExecutionListener.class); private String event; @@ -317,7 +320,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin { MsoLogger.setLogContext(requestId, svcid); } } catch(Exception e) { - logger.error(e); + logger.error("Exception occurred", e); } } } 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 62be1330b1..cb20ded8de 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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -36,10 +38,11 @@ import org.onap.so.bpmn.common.adapter.vnf.VnfAdapterNotify; import org.onap.so.bpmn.common.workflow.service.WorkflowAsyncResource; import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource; import org.onap.so.bpmn.common.workflow.service.WorkflowResource; -import org.onap.so.logger.MsoLogger; 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.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; @@ -52,7 +55,7 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider; @Configuration public class CXFConfiguration { - private static final MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CXFConfiguration.class); + private static final Logger logger = LoggerFactory.getLogger(CXFConfiguration.class); @Autowired private Bus bus; 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 7956ecc363..af9ab2899e 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 @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -28,8 +30,9 @@ import org.camunda.bpm.application.PreUndeploy; import org.camunda.bpm.application.ProcessApplicationInfo; import org.camunda.bpm.engine.ProcessEngine; import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator; -import org.onap.so.logger.MsoLogger; import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -52,8 +55,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class) }) public class MSOInfrastructureApplication { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - MSOInfrastructureApplication.class); + private static final Logger logger = LoggerFactory.getLogger(MSOInfrastructureApplication.class); @Value("${mso.async.core-pool-size}") private int corePoolSize; @@ -81,20 +83,11 @@ public class MSOInfrastructureApplication { @PostDeploy public void postDeploy(ProcessEngine processEngineInstance) { - long startTime = System.currentTimeMillis(); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Post deployment complete..."); } @PreUndeploy public void cleanup(ProcessEngine processEngine, ProcessApplicationInfo processApplicationInfo, List<ProcessEngine> processEngines) { - long startTime = System.currentTimeMillis(); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Pre Undeploy complete..."); - } @Bean @@ -109,4 +102,4 @@ public class MSOInfrastructureApplication { executor.initialize(); return executor; } -}
\ No newline at end of file +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java index fd38ff024d..f6284f3535 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleIT.java @@ -3,7 +3,9 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -31,14 +33,12 @@ import java.util.HashMap; import java.util.Map; import java.util.UUID; -import org.camunda.bpm.engine.RuntimeService; -import org.camunda.bpm.engine.test.Deployment; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.core.WorkflowException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit test for CreateAAIVfModule.bpmn. @@ -46,7 +46,7 @@ import org.onap.so.logger.MsoLogger; public class CreateAAIVfModuleIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class); + Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class); @Test public void TestCreateGenericVnfSuccess_200() { @@ -264,4 +264,4 @@ public class CreateAAIVfModuleIT extends BaseIntegrationTest { .withStatus(200))); } -}
\ No newline at end of file +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java index 6af705fd54..f72ca79dc6 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/CreateAAIVfModuleVolumeGroupIT.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -34,7 +36,8 @@ import org.junit.Assert; import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit tests for CreateAAIVfModuleVolumeGroup.bpmn. @@ -42,7 +45,7 @@ import org.onap.so.logger.MsoLogger; public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleVolumeGroupIT.class); + Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleVolumeGroupIT.class); /** * Test the happy path through the flow. @@ -66,8 +69,8 @@ public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(200, responseCode.intValue()); logEnd(); @@ -93,8 +96,8 @@ public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_getVfModuleResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); logEnd(); @@ -122,8 +125,8 @@ public class CreateAAIVfModuleVolumeGroupIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "CAAIVfModVG_updateVfModuleResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); logEnd(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java index 27b39aec64..f98e4477aa 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/DeleteAAIVfModuleIT.java @@ -33,11 +33,11 @@ import java.util.UUID; import org.camunda.bpm.engine.RuntimeService; import org.camunda.bpm.engine.test.Deployment; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.core.WorkflowException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit test for DeleteAAIVfModule.bpmn. @@ -46,7 +46,7 @@ import org.onap.so.logger.MsoLogger; public class DeleteAAIVfModuleIT extends BaseIntegrationTest { private static final String EOL = "\n"; - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,DeleteAAIVfModuleIT.class); + Logger logger = LoggerFactory.getLogger(DeleteAAIVfModuleIT.class); @Test public void TestDeleteGenericVnfSuccess_200() { diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java index a6d26540dc..f477926f99 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/FalloutHandlerIT.java @@ -3,7 +3,9 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,7 +35,8 @@ import java.util.UUID; import org.junit.Assert; import org.junit.Test; import org.onap.so.BaseIntegrationTest; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit test for FalloutHandler.bpmn. @@ -41,7 +44,7 @@ import org.onap.so.logger.MsoLogger; public class FalloutHandlerIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,FalloutHandlerIT.class); + Logger logger = LoggerFactory.getLogger(FalloutHandlerIT.class); private void setupMocks() { @@ -147,7 +150,7 @@ public class FalloutHandlerIT extends BaseIntegrationTest { public void msoFalloutHandlerWithNotificationurlNoRequestId() throws Exception{ String method = getClass().getSimpleName() + "." + new Object() { }.getClass().getEnclosingMethod().getName(); - logger.debug("STARTED TEST: " + method); + logger.debug("STARTED TEST: {}", method); //Setup Mocks setupMocks(); //Execute Flow @@ -186,7 +189,7 @@ public class FalloutHandlerIT extends BaseIntegrationTest { public void msoFalloutHandlerWithNoNotificationurlNoRequestId() throws Exception{ String method = getClass().getSimpleName() + "." + new Object() { }.getClass().getEnclosingMethod().getName(); - logger.debug("STARTED TEST: " + method); + logger.debug("STARTED TEST: {}", method); //Setup Mocks setupMocks(); //Execute Flow diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java index 744ef9bea5..67ae7de928 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/ManualHandlingIT.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,13 +35,14 @@ import org.camunda.bpm.engine.task.TaskQuery; import org.junit.Assert; import org.junit.Test; import org.onap.so.BaseIntegrationTest; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit test for RainyDayHandler.bpmn. */ public class ManualHandlingIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,ManualHandlingIT.class); + Logger logger = LoggerFactory.getLogger(ManualHandlingIT.class); @Test public void TestManualHandlingSuccess() { @@ -76,8 +79,8 @@ public class ManualHandlingIT extends BaseIntegrationTest { List<Task> tasks = q.orderByTaskCreateTime().asc().list(); for (Task task : tasks) { - logger.debug("TASK ID: " + task.getId()); - logger.debug("TASK NAME: " + task.getName()); + logger.debug("TASK ID: {}", task.getId()); + logger.debug("TASK NAME: {}", task.getName()); try { logger.debug("Completing the task"); @@ -85,7 +88,7 @@ public class ManualHandlingIT extends BaseIntegrationTest { completeVariables.put("responseValue", "skip"); taskService.complete(task.getId(), completeVariables); } catch(Exception e) { - logger.debug("GOT EXCEPTION: " + e.getMessage()); + logger.debug("GOT EXCEPTION: {}", e.getMessage()); } } @@ -93,4 +96,4 @@ public class ManualHandlingIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); } -}
\ No newline at end of file +} diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java index 398efb972f..b370e6c48f 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -34,7 +36,8 @@ import org.onap.so.bpmn.core.domain.ServiceDecomposition; import org.onap.so.bpmn.core.domain.ServiceInstance; import org.onap.so.bpmn.core.domain.VnfResource; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.ArrayList; @@ -56,7 +59,7 @@ import static org.onap.so.bpmn.mock.StubResponseOof.mockOof_500; @Ignore public class OofHomingTestIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class); + Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class); ServiceDecomposition serviceDecomposition = new ServiceDecomposition(); String subscriber = ""; @@ -261,7 +264,7 @@ public class OofHomingTestIT extends BaseIntegrationTest { vnfModel.setModelType("testModelTypeVNF"); vnf.setModelInfo(vnfModel); vnfList.add(vnf); - logger.debug("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString()); + logger.debug("SERVICE DECOMP: {}", serviceDecomposition.getServiceResourcesJsonString()); serviceDecomposition.setModelInfo(sModel); serviceDecomposition.setAllottedResources(arList); serviceDecomposition.setVnfResources(vnfList); @@ -416,9 +419,8 @@ public class OofHomingTestIT extends BaseIntegrationTest { ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition"); - logger.debug("In testHoming_success_vnfResourceList, ServiceDecomposition = " + sd); + logger.debug("In testHoming_success_vnfResourceList, ServiceDecomposition = {}", sd); List<VnfResource> vnfResourceList = sd.getVnfResources(); -//logger.debug(" vnfResourceList = " + vnfResourceList); vnfResourceList.get(0).setResourceId("test-resource-id-000"); // Invoke Homing @@ -454,29 +456,27 @@ public class OofHomingTestIT extends BaseIntegrationTest { "WorkflowException"); ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); - logger.debug("serviceDecompositionExp is: " + serviceDecompositionExp); + logger.debug("serviceDecompositionExp is: {}", serviceDecompositionExp); Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000"); - logger.debug("resourceVnf is: " + resourceVnf); + logger.debug("resourceVnf is: {}", resourceVnf); HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution(); String resourceVnfHomingString = resourceVnfHoming.toString(); - logger.debug("resourceVnfHomingString is: " + resourceVnfHomingString); + logger.debug("resourceVnfHomingString is: {}", resourceVnfHomingString); resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " "); - logger.debug("Now resourceVnfHomingString is: " + resourceVnfHomingString); + logger.debug("Now resourceVnfHomingString is: {}", resourceVnfHomingString); assertNull(workflowException); //Verify request String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); - logger.debug("oofRequest is: " + oofRequest); + logger.debug("oofRequest is: {}", oofRequest); assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf"). replaceAll("\n", "").replaceAll("\r", ""). replaceAll("\t", ""), oofRequest.replaceAll("\n", ""). replaceAll("\r", "").replaceAll("\t", "")); - //logger.debug("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId()); - assertEquals(homingSolutionService("service", "service-instance-01234", "MDTNJ01", "test-resource-id-000","CloudOwner", "mtmnj1a", @@ -539,7 +539,6 @@ public class OofHomingTestIT extends BaseIntegrationTest { } @Test - public void testHoming_error_inputVariable() throws Exception { String businessKey = UUID.randomUUID().toString(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java index b8ae341361..8b8abab6b2 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/PrepareUpdateAAIVfModuleIT.java @@ -3,7 +3,9 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -33,12 +35,12 @@ import java.util.UUID; import org.camunda.bpm.engine.test.Deployment; import org.junit.Assert; -import org.junit.Ignore; import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit tests for PrepareUpdateAAIVfModule.bpmn. @@ -46,7 +48,7 @@ import org.onap.so.logger.MsoLogger; public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,PrepareUpdateAAIVfModuleIT.class); + Logger logger = LoggerFactory.getLogger(PrepareUpdateAAIVfModuleIT.class); /** * Test the happy path through the flow. @@ -73,11 +75,11 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(200, responseCode.intValue()); String heatStackId = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_heatStackId"); - logger.debug("Ouput heat-stack-id:" + heatStackId); + logger.debug("Ouput heat-stack-id:{}", heatStackId); Assert.assertEquals("slowburn", heatStackId); logEnd(); @@ -106,11 +108,11 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_getVnfResponseCode"); WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); Assert.assertNotNull(workflowException); - logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage()); logEnd(); } @@ -137,7 +139,7 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); Assert.assertNotNull(workflowException); - logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage()); Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: Orchestration")); logEnd(); @@ -165,7 +167,7 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); Assert.assertNotNull(workflowException); - logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage()); Assert.assertTrue(workflowException.getErrorMessage().startsWith("VF Module validation error: VF Module")); logEnd(); @@ -196,11 +198,11 @@ public class PrepareUpdateAAIVfModuleIT extends BaseIntegrationTest { String response = (String) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "PUAAIVfMod_updateVfModuleResponseCode"); WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); Assert.assertNotNull(workflowException); - logger.debug("Subflow WorkflowException error message: " + workflowException.getErrorMessage()); + logger.debug("Subflow WorkflowException error message: {}", workflowException.getErrorMessage()); logEnd(); } diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java index baf41d120b..12e12dc7d6 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SDNCAdapterRestV2IT.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -35,7 +37,8 @@ import org.junit.Ignore; import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit tests for SDNCAdapterRestV2.bpmn. @@ -48,7 +51,7 @@ public class SDNCAdapterRestV2IT extends BaseIntegrationTest { private final CallbackSet callbacks = new CallbackSet(); - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,SDNCAdapterRestV2IT.class); + Logger logger = LoggerFactory.getLogger(SDNCAdapterRestV2IT.class); /** diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java index f3f950746c..2205d01cca 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/SniroHomingV1IT.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -38,7 +40,8 @@ import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.core.domain.*; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** @@ -47,7 +50,7 @@ import org.onap.so.logger.MsoLogger; @Ignore public class SniroHomingV1IT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,SniroHomingV1IT.class); + Logger logger = LoggerFactory.getLogger(SniroHomingV1IT.class); ServiceDecomposition serviceDecomposition = new ServiceDecomposition(); @@ -121,7 +124,7 @@ public class SniroHomingV1IT extends BaseIntegrationTest { vnfModel.setModelType("testModelTypeVNF"); vnf.setModelInfo(vnfModel); vnfList.add(vnf); - logger.debug("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString()); + logger.debug("SERVICE DECOMP: {}", serviceDecomposition.getServiceResourcesJsonString()); serviceDecomposition.setModelInfo(sModel); serviceDecomposition.setAllottedResources(arList); serviceDecomposition.setVnfResources(vnfList); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java index e1a265b274..48790708f0 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIGenericVnfIT.java @@ -3,7 +3,9 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -39,7 +41,8 @@ import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.core.WorkflowException; import org.onap.so.bpmn.mock.FileUtil; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit tests for UpdateAAIGenericVnf bpmn. @@ -47,7 +50,7 @@ import org.onap.so.logger.MsoLogger; public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class); + Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class); /** @@ -73,8 +76,8 @@ public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(200, responseCode.intValue()); logEnd(); @@ -103,7 +106,7 @@ public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - logger.debug("Workflow Exception: " + workflowException); + logger.debug("Workflow Exception: {}", workflowException); Assert.assertNotNull(workflowException); logEnd(); @@ -132,8 +135,8 @@ public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_getGenericVnfResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); logEnd(); @@ -164,8 +167,8 @@ public class UpdateAAIGenericVnfIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIGenVnf_updateGenericVnfResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); logEnd(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java index 3ff2657193..3dd2ac957c 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/UpdateAAIVfModuleIT.java @@ -3,7 +3,9 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -39,6 +41,8 @@ import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.mock.FileUtil; import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit tests for UpdateAAIVfModuleTest.bpmn. @@ -46,7 +50,7 @@ import org.onap.so.logger.MsoLogger; public class UpdateAAIVfModuleIT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CreateAAIVfModuleIT.class); + Logger logger = LoggerFactory.getLogger(CreateAAIVfModuleIT.class); /** @@ -72,8 +76,8 @@ public class UpdateAAIVfModuleIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(200, responseCode.intValue()); logEnd(); @@ -101,8 +105,8 @@ public class UpdateAAIVfModuleIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_getVfModuleResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); logEnd(); @@ -132,8 +136,8 @@ public class UpdateAAIVfModuleIT extends BaseIntegrationTest { Assert.assertTrue(isProcessEnded(businessKey)); String response = (String) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponse"); Integer responseCode = (Integer) getVariableFromHistory(businessKey, "UAAIVfMod_updateVfModuleResponseCode"); - logger.debug("Subflow response code: " + responseCode); - logger.debug("Subflow response: " + response); + logger.debug("Subflow response code: {}", responseCode); + logger.debug("Subflow response: {}", response); Assert.assertEquals(404, responseCode.intValue()); logEnd(); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java index fc15e92bca..ad08f8b2bb 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/VnfAdapterRestV1IT.java @@ -1,9 +1,11 @@ /*- - * ============LICENSE_START======================================================= + * ============LICENSE_START======================================================= * ONAP - SO - * ================================================================================ + * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -38,7 +40,8 @@ import org.junit.Ignore; import org.junit.Test; import org.onap.so.BaseIntegrationTest; import org.onap.so.bpmn.core.WorkflowException; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Unit tests for VnfAdapterRestV1. @@ -46,7 +49,7 @@ import org.onap.so.logger.MsoLogger; public class VnfAdapterRestV1IT extends BaseIntegrationTest { - MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,VnfAdapterRestV1IT.class); + Logger logger = LoggerFactory.getLogger(VnfAdapterRestV1IT.class); private static final String EOL = "\n"; @@ -256,7 +259,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { waitForProcessEnd(businessKey, 10000); String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); - logger.debug("Response:\n" + response); + logger.debug("Response:\n{}", response); assertTrue(response!=null && response.contains("<createVfModuleResponse>")); assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); @@ -285,7 +288,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { waitForProcessEnd(businessKey, 10000); String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); - logger.debug("Response:\n" + response); + logger.debug("Response:\n{}", response); assertTrue(response.contains("<updateVfModuleResponse>")); assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); @@ -314,7 +317,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { waitForProcessEnd(businessKey, 10000); String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); - logger.debug("Response:\n" + response); + logger.debug("Response:\n{}", response); assertTrue(response.contains("<deleteVfModuleResponse>")); assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); @@ -343,7 +346,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { waitForProcessEnd(businessKey, 10000); String response = (String) getVariableFromHistory(businessKey, "vnfAdapterRestV1Response"); - logger.debug("Response:\n" + response); + logger.debug("Response:\n{}", response); assertTrue(response.contains("<rollbackVfModuleResponse>")); assertTrue((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); @@ -376,7 +379,7 @@ public class VnfAdapterRestV1IT extends BaseIntegrationTest { logger.debug(wfe.toString()); String response = (String) getVariableFromHistory(businessKey, "WorkflowResponse"); - logger.debug("Response:\n" + response); + logger.debug("Response:\n{}", response); assertTrue(response.contains("<vfModuleException>")); assertFalse((boolean) getVariableFromHistory(businessKey, "VNFREST_SuccessIndicator")); diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java index d24e953196..117d3b213a 100644 --- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java +++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -81,7 +83,8 @@ import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource; import org.onap.so.bpmn.common.workflow.service.WorkflowResource; import org.onap.so.bpmn.core.domain.Resource; import org.onap.so.bpmn.core.domain.ServiceDecomposition; -import org.onap.so.logger.MsoLogger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -106,7 +109,7 @@ import org.xml.sax.SAXException; public abstract class WorkflowTest { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowTest.class); + private static final Logger logger = LoggerFactory.getLogger(WorkflowTest.class); //TODO this is not used anymore, can maybe be removed @Rule @@ -165,14 +168,14 @@ public abstract class WorkflowTest { * Logs a test start method. */ protected void logStart() { - msoLogger.debug("STARTED TEST"); + logger.debug("STARTED TEST"); } /** * Logs a test end method. */ protected void logEnd() { - msoLogger.debug("ENDED TEST"); + logger.debug("ENDED TEST"); } /** @@ -184,14 +187,14 @@ public abstract class WorkflowTest { protected void invokeSubProcess(String processKey, String businessKey, Map<String, Object> injectedVariables) { RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); List<String> arguments = runtimeMxBean.getInputArguments(); - msoLogger.debug("JVM args = " + arguments); + logger.debug("JVM args = {}", arguments); msoRequestId = (String) injectedVariables.get("mso-request-id"); String requestId = (String) injectedVariables.get("msoRequestId"); if (msoRequestId == null && requestId == null) { String msg = "mso-request-id variable was not provided"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -205,14 +208,14 @@ public abstract class WorkflowTest { protected String invokeSubProcess(String processKey, Map<String, Object> injectedVariables) { RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); List<String> arguments = runtimeMxBean.getInputArguments(); - msoLogger.debug("JVM args = " + arguments); + logger.debug("JVM args = {}", arguments); msoRequestId = (String) injectedVariables.get("mso-request-id"); String requestId = (String) injectedVariables.get("msoRequestId"); if (msoRequestId == null && requestId == null) { String msg = "mso-request-id variable was not provided"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -256,13 +259,13 @@ public abstract class WorkflowTest { RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); List<String> arguments = runtimeMxBean.getInputArguments(); - msoLogger.debug("JVM args = " + arguments); + logger.debug("JVM args = {}", arguments); Map<String, Object> variables = createVariables(schemaVersion, businessKey, request, injectedVariables, false); VariableMapImpl variableMapImpl = createVariableMapImpl(variables); - msoLogger.debug("Sending " + request + " to " + processKey + " process"); + logger.debug("Sending {} to {} process", request, processKey); TestAsyncResponse asyncResponse = new TestAsyncResponse(); @@ -290,13 +293,13 @@ public abstract class WorkflowTest { RuntimeMXBean runtimeMxBean = ManagementFactory.getRuntimeMXBean(); List<String> arguments = runtimeMxBean.getInputArguments(); - msoLogger.debug("JVM args = " + arguments); + logger.debug("JVM args = {}", arguments); Map<String, Object> variables = createVariables(schemaVersion, businessKey, request, injectedVariables, serviceInstantiationModel); VariableMapImpl variableMapImpl = createVariableMapImpl(variables); - msoLogger.debug("Sending " + request + " to " + processKey + " process"); + logger.debug("Sending {} to {} process", request, processKey); return workflowResource.startProcessInstanceByKey( processKey, variableMapImpl); @@ -337,7 +340,7 @@ public abstract class WorkflowTest { for (String var : notAllowed) { if (var.equals(key)) { String msg = "Cannot specify " + var + " in injected variables"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } } @@ -367,11 +370,11 @@ public abstract class WorkflowTest { catch(Exception e) { } if (msoRequestId == null || msoRequestId.trim().equals("")) { - msoLogger.debug("No requestId element in injectedVariables"); + logger.debug("No requestId element in injectedVariables"); variables.put("mso-request-id", UUID.randomUUID().toString()); } if (msoServiceInstanceId == null || msoServiceInstanceId.trim().equals("")) { - msoLogger.debug("No seviceInstanceId element in injectedVariables"); + logger.debug("No seviceInstanceId element in injectedVariables"); variables.put("mso-service-instance-id", UUID.randomUUID().toString()); } @@ -387,7 +390,7 @@ public abstract class WorkflowTest { } if (msoRequestId == null || msoRequestId.trim().equals("")) { String msg = "No request-id element in " + request; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } } @@ -446,8 +449,7 @@ public abstract class WorkflowTest { */ protected WorkflowResponse receiveResponse(String businessKey, TestAsyncResponse asyncResponse, long timeout) { - msoLogger.debug("Waiting " + timeout + "ms for process with business key " + businessKey - + " to send a response"); + logger.debug("Waiting {}ms for process with business key {} to send a response", timeout, businessKey); long now = System.currentTimeMillis() + timeout; long endTime = now + timeout; @@ -456,7 +458,7 @@ public abstract class WorkflowTest { Response response = asyncResponse.getResponse(); if (response != null) { - msoLogger.debug("Received a response from process with business key " + businessKey); + logger.debug("Received a response from process with business key {}", businessKey); Object entity = response.getEntity(); @@ -464,7 +466,7 @@ public abstract class WorkflowTest { String msg = "Response entity is " + (entity == null ? "null" : entity.getClass().getName()) + ", expected WorkflowResponse"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); return null; // unreachable } @@ -477,7 +479,7 @@ public abstract class WorkflowTest { } catch (InterruptedException e) { String msg = "Interrupted waiting for a response from process with business key " + businessKey; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); return null; // unreachable } @@ -487,7 +489,7 @@ public abstract class WorkflowTest { String msg = "No response received from process with business key " + businessKey + " within " + timeout + "ms"; - msoLogger.debug(msg); + logger.debug(msg); fail("Process with business key " + businessKey + " did not end within 10000ms"); return null; // unreachable } @@ -525,7 +527,7 @@ public abstract class WorkflowTest { if (callbackData == null) { String msg = "No callback defined for '" + action + "' SDNC request"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -536,7 +538,7 @@ public abstract class WorkflowTest { contentType = JSON; } else { String msg = "Invalid SDNC program modifier: '" + modifier + "'"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -625,7 +627,7 @@ public abstract class WorkflowTest { if (callbackData == null) { String msg = "No callback defined for '" + action + "' SDNC request"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -637,7 +639,7 @@ public abstract class WorkflowTest { if (callbackData == null) { String msg = "No callback defined for '" + action + "' SDNC request"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -650,7 +652,7 @@ public abstract class WorkflowTest { respMsg = "SERVER ERROR"; } else { String msg = "Invalid SDNC program modifier: '" + modifier + "'"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -699,7 +701,7 @@ public abstract class WorkflowTest { if (callbackData == null) { String msg = "No callback defined for '" + action + "' VNF REST request"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -710,7 +712,7 @@ public abstract class WorkflowTest { contentType = "text/plain"; } else { String msg = "Invalid VNF REST program modifier: '" + modifier + "'"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -763,18 +765,18 @@ public abstract class WorkflowTest { if (callbackData == null) { String msg = "No callback defined for '" + action + "' VNF request"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } content = callbackData.getContent(); } else if ("ERR".equals(modifier)) { String msg = "Currently unsupported VNF program modifier: '" + modifier + "'"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } else { String msg = "Invalid VNF program modifier: '" + modifier + "'"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -790,7 +792,7 @@ public abstract class WorkflowTest { if (!injected) { String msg = "Failed to inject VNF '" + action + "' callback"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -810,8 +812,7 @@ public abstract class WorkflowTest { * @param timeout the timeout in milliseconds */ protected void waitForRunningProcessCount(String processKey, int count, long timeout) { - msoLogger.debug("Waiting " + timeout + "ms for there to be " + count + " " - + processKey + " instances"); + logger.debug("Waiting {}ms for there to be {} {} instances", timeout, count, processKey); long now = System.currentTimeMillis() + timeout; long endTime = now + timeout; @@ -824,8 +825,7 @@ public abstract class WorkflowTest { .list().size(); if (actual != last) { - msoLogger.debug("There are now " + actual + " " - + processKey + " instances"); + logger.debug("There are now {} {} instances", actual, processKey); last = actual; } @@ -838,7 +838,7 @@ public abstract class WorkflowTest { } catch (InterruptedException e) { String msg = "Interrupted waiting for there to be " + count + " " + processKey + " instances"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -847,7 +847,7 @@ public abstract class WorkflowTest { String msg = "Timed out waiting for there to be " + count + " " + processKey + " instances"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -862,8 +862,7 @@ public abstract class WorkflowTest { protected Object getProcessVariable(String processKey, String variable, long timeout) { - msoLogger.debug("Waiting " + timeout + "ms for " - + processKey + "." + variable + " to be set"); + logger.debug("Waiting " + timeout + "ms for " + processKey + "." + variable + " to be set"); long now = System.currentTimeMillis() + timeout; long endTime = now + timeout; @@ -874,10 +873,10 @@ public abstract class WorkflowTest { while (value == null) { if (now > endTime) { if (processInstance == null) { - msoLogger.debug("Timed out waiting for " + logger.debug("Timed out waiting for " + processKey + " to start"); } else { - msoLogger.debug("Timed out waiting for " + logger.debug("Timed out waiting for " + processKey + "[" + processInstance.getId() + "]." + variable + " to be set"); } @@ -896,7 +895,8 @@ public abstract class WorkflowTest { processInstance = processInstanceQuery.singleResult(); }else{ //TODO There shouldnt be more than one in the list but seems to be happening, need to figure out why happening and best way to get correct one from list - msoLogger.debug("Process Instance Query returned " + processInstanceQuery.count() + " instance. Getting the last instance in the list"); + logger.debug("Process Instance Query returned {} instance. Getting the last instance in the list", + processInstanceQuery.count()); List<ProcessInstance> processList = processInstanceQuery.list(); processInstance = processList.get((processList.size() - 1)); } @@ -910,15 +910,14 @@ public abstract class WorkflowTest { try { Thread.sleep(200); } catch (InterruptedException e) { - msoLogger.debug("Interrupted waiting for " - + processKey + "." + variable + " to be set"); + logger.debug("Interrupted waiting for {}.{} to be set", processKey, variable); return null; } now = System.currentTimeMillis(); } - msoLogger.debug(processKey + "[" + logger.debug(processKey + "[" + processInstance.getId() + "]." + variable + "=" + value); @@ -952,10 +951,10 @@ public abstract class WorkflowTest { // Deprecated usage. All test code should switch to the (( ... )) syntax. content = content.replace("{{REQUEST-ID}}", sdncRequestId); - msoLogger.debug("Injecting SDNC adapter callback"); + logger.debug("Injecting SDNC adapter callback"); Response response = workflowMessageResource.deliver(contentType, "SDNCAResponse", sdncRequestId, content); - msoLogger.debug("Workflow response to SDNC adapter callback: " + response); + logger.debug("Workflow response to SDNC adapter callback: " + response); return true; } @@ -987,7 +986,7 @@ public abstract class WorkflowTest { // TODO this needs to be fixed. It is causing double tags and content // Need to parse content before setting below since content includes not just RequestData or modify callback files to only contain RequestData contents. - msoLogger.debug("Injecting SDNC adapter callback"); + logger.debug("Injecting SDNC adapter callback"); CallbackHeader callbackHeader = new CallbackHeader(); callbackHeader.setRequestId(sdncRequestId); callbackHeader.setResponseCode(String.valueOf(respCode)); @@ -996,7 +995,7 @@ public abstract class WorkflowTest { sdncAdapterCallbackRequest.setCallbackHeader(callbackHeader); sdncAdapterCallbackRequest.setRequestData(content); SDNCAdapterResponse sdncAdapterResponse = callbackService.sdncAdapterCallback(sdncAdapterCallbackRequest); - msoLogger.debug("Workflow response to SDNC adapter callback: " + sdncAdapterResponse); + logger.debug("Workflow response to SDNC adapter callback: " + sdncAdapterResponse); return true; } @@ -1023,10 +1022,10 @@ public abstract class WorkflowTest { // Deprecated usage. All test code should switch to the (( ... )) syntax. content = content.replace("{{MESSAGE-ID}}", messageId); - msoLogger.debug("Injecting VNF adapter callback"); + logger.debug("Injecting VNF adapter callback"); Response response = workflowMessageResource.deliver(contentType, "VNFAResponse", messageId, content); - msoLogger.debug("Workflow response to VNF adapter callback: " + response); + logger.debug("Workflow response to VNF adapter callback: {}", response); return true; } @@ -1059,7 +1058,7 @@ public abstract class WorkflowTest { content = content.replace("{{REQUEST-ID}}", msoRequestId); } - msoLogger.debug("Injecting VNF adapter callback"); + logger.debug("Injecting VNF adapter callback"); // Is it possible to unmarshal this with JAXB? I couldn't. @@ -1132,8 +1131,8 @@ public abstract class WorkflowTest { createVnfNotification.setRollback(rollback); } catch (Exception e) { - msoLogger.debug("Failed to unmarshal VNF callback content:"); - msoLogger.debug(content); + logger.debug("Failed to unmarshal VNF callback content:"); + logger.debug(content); return false; } @@ -1175,7 +1174,7 @@ public abstract class WorkflowTest { // Deprecated usage. All test code should switch to the (( ... )) syntax. content = content.replace("{{MESSAGE-ID}}", messageId); - msoLogger.debug("Injecting VNF adapter delete callback"); + logger.debug("Injecting VNF adapter delete callback"); // Is it possible to unmarshal this with JAXB? I couldn't. @@ -1195,8 +1194,8 @@ public abstract class WorkflowTest { } } catch (Exception e) { - msoLogger.debug("Failed to unmarshal VNF Delete callback content:"); - msoLogger.debug(content); + logger.debug("Failed to unmarshal VNF Delete callback content:"); + logger.debug(content); return false; } @@ -1239,7 +1238,7 @@ public abstract class WorkflowTest { // Deprecated usage. All test code should switch to the (( ... )) syntax. content = content.replace("{{REQUEST-ID}}", msoRequestId); - msoLogger.debug("Injecting VNF adapter callback"); + logger.debug("Injecting VNF adapter callback"); // Is it possible to unmarshal this with JAXB? I couldn't. @@ -1308,8 +1307,8 @@ public abstract class WorkflowTest { updateVnfNotification.setRollback(rollback); } catch (Exception e) { - msoLogger.debug("Failed to unmarshal VNF callback content:"); - msoLogger.debug(content); + logger.debug("Failed to unmarshal VNF callback content:"); + logger.debug(content); return false; } @@ -1362,7 +1361,7 @@ public abstract class WorkflowTest { if (callbackData == null) { String msg = "No '" + action + "' workflow message callback is defined"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1370,7 +1369,7 @@ public abstract class WorkflowTest { if (messageType == null || messageType.trim().equals("")) { String msg = "No workflow message type is defined in the '" + action + "' callback"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1378,7 +1377,7 @@ public abstract class WorkflowTest { contentType = callbackData.getContentType(); } else { String msg = "Invalid workflow message program modifier: '" + modifier + "'"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1416,10 +1415,10 @@ public abstract class WorkflowTest { content = content.replace("((CORRELATOR))", correlator); } - msoLogger.debug("Injecting " + messageType + " message"); + logger.debug("Injecting " + messageType + " message"); Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content); - msoLogger.debug("Workflow response to " + messageType + " message: " + response); + logger.debug("Workflow response to {} message: {}", messageType, response); return true; } @@ -1458,7 +1457,7 @@ public abstract class WorkflowTest { if (callbackData == null) { String msg = "No '" + action + "' workflow message callback is defined"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1466,7 +1465,7 @@ public abstract class WorkflowTest { if (messageType == null || messageType.trim().equals("")) { String msg = "No workflow message type is defined in the '" + action + "' callback"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1474,7 +1473,7 @@ public abstract class WorkflowTest { contentType = callbackData.getContentType(); } else { String msg = "Invalid workflow message program modifier: '" + modifier + "'"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1588,10 +1587,10 @@ public abstract class WorkflowTest { } } } - msoLogger.debug("Injecting " + messageType + " message"); + logger.debug("Injecting " + messageType + " message"); Response response = workflowMessageResource.deliver(contentType, messageType, correlator, content); - msoLogger.debug("Workflow response to " + messageType + " message: " + response); + logger.debug("Workflow response to {} message: {}", messageType, response); return true; } @@ -1602,15 +1601,14 @@ public abstract class WorkflowTest { * @param timeout the amount of time to wait, in milliseconds */ protected void waitForProcessEnd(String businessKey, long timeout) { - msoLogger.debug("Waiting " + timeout + "ms for process with business key " + - businessKey + " to end"); + logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey); long now = System.currentTimeMillis() + timeout; long endTime = now + timeout; while (now <= endTime) { if (isProcessEnded(businessKey)) { - msoLogger.debug("Process with business key " + businessKey + " has ended"); + logger.debug("Process with business key {} has ended", businessKey); return; } @@ -1619,7 +1617,7 @@ public abstract class WorkflowTest { } catch (InterruptedException e) { String msg = "Interrupted waiting for process with business key " + businessKey + " to end"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1628,7 +1626,7 @@ public abstract class WorkflowTest { String msg = "Process with business key " + businessKey + " did not end within " + timeout + "ms"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1643,15 +1641,14 @@ public abstract class WorkflowTest { * @author cb645j */ protected void waitForProcessEnd(String businessKey, String processName, long timeout) { - msoLogger.debug("Waiting " + timeout + "ms for process with business key " + - businessKey + " to end"); + logger.debug("Waiting {}ms for process with business key {} to end", timeout, businessKey); long now = System.currentTimeMillis() + timeout; long endTime = now + timeout; while (now <= endTime) { if (isProcessEnded(businessKey, processName)) { - msoLogger.debug("Process with business key " + businessKey + " has ended"); + logger.debug("Process with business key {} has ended", businessKey); return; } @@ -1660,7 +1657,7 @@ public abstract class WorkflowTest { } catch (InterruptedException e) { String msg = "Interrupted waiting for process with business key " + businessKey + " to end"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1669,7 +1666,7 @@ public abstract class WorkflowTest { String msg = "Process with business key " + businessKey + " did not end within " + timeout + "ms"; - msoLogger.debug(msg); + logger.debug(msg); fail(msg); } @@ -1747,8 +1744,8 @@ public abstract class WorkflowTest { .variableName(variableName).singleResult(); return v == null ? null : v.getValue(); } catch (Exception e) { - msoLogger.debug("Error retrieving variable " + variableName + - " from historical process with business key " + businessKey + ": " + e); + logger.debug("Error retrieving variable {} from historical process with business key {}: ", variableName, businessKey, + e); return null; } } @@ -1777,10 +1774,12 @@ public abstract class WorkflowTest { return variable == null ? null : variable.getValue(); }catch(ProcessEngineException e){ - msoLogger.debug("Multiple proccess instances exist with process name " + processName + " and business key " + businessKey + ". Must pass instance index as a parameter."); + logger.debug("Multiple proccess instances exist with process name {} and business key {}. Must pass instance " + + "index as a parameter.", processName, businessKey); return null; }catch(Exception e){ - msoLogger.debug("Error retrieving variable " + variableName + " from historical process for process " + processName + " with business key " + businessKey + ": " + e); + logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ", + variableName, processName, businessKey, e); return null; } } @@ -1814,7 +1813,8 @@ public abstract class WorkflowTest { return variable == null ? null : variable.getValue(); }catch(Exception e) { - msoLogger.debug("Error retrieving variable " + variableName + " from historical process for process " + processName + " with business key " + businessKey + ": " + e); + logger.debug("Error retrieving variable {} from historical process for process {} with business key {}: ", + variableName, processName, businessKey, e); return null; } } @@ -1851,8 +1851,7 @@ public abstract class WorkflowTest { .variableName(variableName).singleResult(); return v == null ? null : v.getValue(); } catch (Exception e) { - msoLogger.debug("Error retrieving variable " + variableName + - " from sub flow: " + subflowName + ", Exception is: " + e); + logger.debug("Error retrieving variable {} from sub flow: {}, Exception is: ", variableName, subflowName, e); return null; } } @@ -1886,8 +1885,8 @@ public abstract class WorkflowTest { .variableName(variableName).singleResult(); return v == null ? null : v.getValue(); } catch (Exception e) { - msoLogger.debug("Error retrieving variable " + variableName + - " from " + subflowInstanceIndex + " instance index of sub flow: " + subflowName + ", Exception is: " + e); + logger.debug("Error retrieving variable {} from {} instance index of sub flow: {}, Exception is: ", variableName, + subflowInstanceIndex, subflowName, e); return null; } } |