aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/mso-infrastructure-bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/mso-infrastructure-bpmn')
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/CallbackHandlerService.java20
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java5
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java8
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowMessageResource.java5
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowResource.java1
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java1
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java63
7 files changed, 81 insertions, 22 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 f4617f9978..4ab22f4616 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
@@ -220,7 +220,7 @@ public class CallbackHandlerService {
+ " = '" + correlationValue + "'; last exception was:"
+ queryException;
logger.debug(msg);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), msg, queryException);
}
@@ -263,8 +263,8 @@ public class CallbackHandlerService {
+ " with " + correlationVariable + " = '" + correlationValue
+ "': " + ole;
logger.debug(msg);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, ole);
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
+ MsoLogger.ErrorCode.UnknownError.getValue(), msg, ole);
//Retry for OptimisticLocking Exceptions
int retryCount = 0;
@@ -296,14 +296,14 @@ public class CallbackHandlerService {
//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.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
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.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), strMsg, excep);
}
@@ -317,7 +317,7 @@ public class CallbackHandlerService {
+ " with " + correlationVariable + " = '" + correlationValue
+ "': " + e;
logger.debug(msg);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), msg, e);
}
} catch (Exception e) {
@@ -327,8 +327,8 @@ public class CallbackHandlerService {
+ " with " + correlationVariable + " = '" + correlationValue
+ "': " + e;
logger.debug(msg);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
- MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), msg, e);
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN CORRELATION ERROR -",
+ MsoLogger.ErrorCode.UnknownError.getValue(), msg, e);
}
return true;
@@ -363,10 +363,10 @@ public class CallbackHandlerService {
*/
protected void logCallbackError(String method, long startTime, String msg, Exception e) {
if (e == null) {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), msg);
} else {
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_CALLBACK_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.UnknownError.getValue(), msg, e);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
index 710144dbb9..267e24fec4 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.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
@@ -63,7 +65,6 @@ public class SDNCAdapterCallbackServiceImpl extends ProcessEngineAwareService im
String correlationVariable = "SDNCA_requestId";
String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
- MsoLogger.setServiceName("MSO." + method);
MsoLogger.setLogContext(correlationValue, "N/A");
CallbackResult result = callback.handleCallback(method, message, messageEventName,
@@ -88,4 +89,4 @@ public class SDNCAdapterCallbackServiceImpl extends ProcessEngineAwareService im
return error;
}
}
-} \ No newline at end of file
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
index 96a11d21a7..65cc70d5f4 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.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
@@ -116,7 +118,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationVariable = "VNFQ_messageId";
String correlationValue = messageId;
- MsoLogger.setServiceName("MSO." + method);
MsoLogger.setLogContext(correlationValue, "N/A");
QueryVnfNotification message = new QueryVnfNotification();
@@ -160,7 +161,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationVariable = "VNFC_messageId";
String correlationValue = messageId;
- MsoLogger.setServiceName("MSO." + method);
MsoLogger.setLogContext(correlationValue, "N/A");
CreateVnfNotification message = new CreateVnfNotification();
@@ -201,7 +201,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationVariable = "VNFU_messageId";
String correlationValue = messageId;
- MsoLogger.setServiceName("MSO." + method);
MsoLogger.setLogContext(correlationValue, "N/A");
UpdateVnfNotification message = new UpdateVnfNotification();
@@ -237,7 +236,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationVariable = "VNFDEL_uuid";
String correlationValue = messageId;
- MsoLogger.setServiceName("MSO." + method);
MsoLogger.setLogContext(correlationValue, "N/A");
DeleteVnfNotification message = new DeleteVnfNotification();
@@ -250,4 +248,4 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
callback.handleCallback(method, message, messageEventName, messageVariable,
correlationVariable, correlationValue, logMarker);
}
-} \ No newline at end of file
+}
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 8b35f0e6d6..a5af553e1c 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
@@ -79,7 +79,6 @@ public class WorkflowMessageResource{
String message) {
String method = "receiveWorkflowMessage";
- MsoLogger.setServiceName("MSO." + method);
MsoLogger.setLogContext(correlator, "N/A");
logger.debug(LOGMARKER + " Received workflow message"
@@ -91,7 +90,7 @@ public class WorkflowMessageResource{
if (messageType == null || messageType.isEmpty()) {
String msg = "Missing message type";
logger.debug(LOGMARKER + " " + msg);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
return Response.status(400).entity(msg).build();
}
@@ -99,7 +98,7 @@ public class WorkflowMessageResource{
if (correlator == null || correlator.isEmpty()) {
String msg = "Missing correlator";
logger.debug(LOGMARKER + " " + msg);
- logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN", MsoLogger.getServiceName(),
+ logger.error("{} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION.toString(), "BPMN",
MsoLogger.ErrorCode.DataError.getValue(), LOGMARKER + ":" + msg);
return Response.status(400).entity(msg).build();
}
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 92f1b7a816..d10ecd1ce2 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
@@ -237,7 +237,6 @@ public class WorkflowResource extends ProcessEngineAwareService {
}
private void setLogContext(String processKey, Map<String, Object> inputVariables) {
- MsoLogger.setServiceName("MSO." + processKey);
if (inputVariables != null) {
MsoLogger.setLogContext(getValueFromInputVariables(inputVariables, "mso-request-id"),
getValueFromInputVariables(inputVariables, "mso-service-instance-id"));
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 62aad7e345..04059557ae 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
@@ -314,7 +314,6 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
.getName();
- MsoLogger.setServiceName(processName);
String requestId = (String) execution.getVariable("mso-request-id");
String svcid = (String) execution.getVariable("mso-service-instance-id");
MsoLogger.setLogContext(requestId, svcid);
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java
new file mode 100644
index 0000000000..bdc48392af
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/adapter/sdnc/ObjectFactoryTest.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 IBM.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.common.adapter.sdnc;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class ObjectFactoryTest {
+
+ ObjectFactory objectFactory;
+
+ @Before
+ public void setUp() {
+ objectFactory = new ObjectFactory();
+ }
+
+ @Test
+ public void testCreateRequestHeader() {
+ assertEquals(RequestHeader.class.getName(), objectFactory.createRequestHeader().getClass().getName());
+ }
+
+ @Test
+ public void testCreateSDNCAdapterResponse() {
+ assertEquals(SDNCAdapterResponse.class.getName(),
+ objectFactory.createSDNCAdapterResponse().getClass().getName());
+ }
+
+ @Test
+ public void testSDNCAdapterCallbackRequest() {
+ assertEquals(SDNCAdapterCallbackRequest.class.getName(),
+ objectFactory.createSDNCAdapterCallbackRequest().getClass().getName());
+ }
+
+ @Test
+ public void testCreateCallbackHeader() {
+ assertEquals(CallbackHeader.class.getName(), objectFactory.createCallbackHeader().getClass().getName());
+ }
+
+ @Test
+ public void testCreateSDNCAdapterRequest() {
+ assertEquals(SDNCAdapterRequest.class.getName(), objectFactory.createSDNCAdapterRequest().getClass().getName());
+ }
+
+}