summaryrefslogtreecommitdiffstats
path: root/adapters/mso-sdnc-adapter/src/main/java
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-11-16 12:40:25 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-11-27 17:09:25 -0500
commitfbe2ea46cf3d8902bf2425f12e679523455beaa3 (patch)
tree1d878c49399aa4a3d2e21352a820ac196481f974 /adapters/mso-sdnc-adapter/src/main/java
parent36f1cf5f916d97dfb8c1b345771e58951fea8849 (diff)
Remove all usage of AlarmLogger
Fix broken UT from removing alarm logger fixed compilation and merge issues Remove all usage of AlarmLogger Change-Id: Ic87abd51423274570bfca0ed976d9642a91a843d Issue-ID: SO-1229 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'adapters/mso-sdnc-adapter/src/main/java')
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java6
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java12
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java14
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java12
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java10
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java6
6 files changed, 28 insertions, 32 deletions
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
index a0e3a17496..4a6ac9f5e2 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
@@ -28,7 +28,7 @@ import org.onap.so.adapters.sdnc.SDNCAdapterPortType;
import org.onap.so.adapters.sdnc.SDNCAdapterRequest;
import org.onap.so.adapters.sdnc.SDNCAdapterResponse;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoAlarmLogger;
+
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -41,7 +41,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCAdapterPortTypeImpl.class);
- private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+
@Autowired
private SDNCRestClient sdncClient;
@@ -71,7 +71,7 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
catch (Exception e){
String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage();
msoLogger.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.DataError, respMsg, e);
- alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg);
+
SDNCResponse sdncResp = new SDNCResponse(bpelReqId);
sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
sdncResp.setRespMsg(respMsg);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
index fd924cad79..4b3181e6e9 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
@@ -52,7 +52,7 @@ import org.onap.so.adapters.sdnc.client.SDNCAdapterCallbackRequest;
import org.onap.so.adapters.sdnc.client.SDNCCallbackAdapterPortType;
import org.onap.so.adapters.sdnc.client.SDNCCallbackAdapterService;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoAlarmLogger;
+
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
@@ -74,7 +74,7 @@ public class SDNCRestClient{
private MapRequestTunables tunablesMapper;
private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCRestClient.class);
- private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+
private static final String EXCEPTION_MSG="Exception while evaluate xpath";
private static final String MSO_INTERNAL_ERROR="MsoInternalError";
private static final String CAMUNDA="Camunda";
@@ -257,7 +257,7 @@ public class SDNCRestClient{
sdncResp.setRespMsg(respMsg);
msoLogger.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with SDNC", e);
- alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, respMsg);
+
return sdncResp;
}
finally
@@ -287,7 +287,7 @@ public class SDNCRestClient{
} catch (MalformedURLException e1) {
error = "Caught exception initializing Callback wsdl " + e1.getMessage();
msoLogger.error(MessageEnum.RA_INIT_CALLBACK_WSDL_ERR, CAMUNDA, "", MsoLogger.ErrorCode.DataError, "Exception initializing Callback wsdl", e1);
- alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, error);
+
}
SDNCCallbackAdapterService cbSvc = new SDNCCallbackAdapterService();
@@ -317,7 +317,7 @@ public class SDNCRestClient{
catch (Exception e2) {
error = "Unable to set authorization in callback request " + e2.getMessage();
msoLogger.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception - Unable to set authorization in callback request", e2);
- alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, error);
+
}
msoLogger.debug("Invoking Bpel Callback. BpelCallbackUrl:" + bpelUrl);
@@ -328,7 +328,7 @@ public class SDNCRestClient{
{
error = "Error sending BpelCallback request" + e.getMessage();
msoLogger.error("Error " + MsoLogger.ErrorCode.BusinessProcesssError + " - " + MessageEnum.RA_CALLBACK_BPEL_EXC + " - " + error, e);
- alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, error);
+
}
msoLogger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), CAMUNDA, "");
return;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
index 9c4dd5e8a0..aaf6cc7d70 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
@@ -35,7 +35,7 @@ import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoAlarmLogger;
+
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -48,7 +48,7 @@ import org.springframework.core.env.Environment;
@Component
public class BPRestCallback {
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,BPRestCallback.class);
- private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
+
private static final String CAMUNDA="Camunda";
private static final String MSO_INTERNAL_ERROR="MsoInternalError";
@Autowired
@@ -125,9 +125,7 @@ public class BPRestCallback {
method.setHeader("Authorization", authorization);
} catch (Exception e) {
LOGGER.error(MessageEnum.RA_SET_CALLBACK_AUTH_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError,
- "Unable to set authorization in callback request", e);
- ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL,
- "Unable to set authorization in callback request: " + e.getMessage());
+ "Unable to set authorization in callback request", e);
error = true;
}
@@ -144,15 +142,13 @@ public class BPRestCallback {
if (httpResponse.getStatusLine().getStatusCode() >= 300) {
String msg = "Received error response to callback request: " + httpResponse.getStatusLine();
LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError, msg);
- ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, msg);
+
}
}
return true;
} catch (Exception e) {
LOGGER.error(MessageEnum.RA_CALLBACK_BPEL_EXC, CAMUNDA, "", MsoLogger.ErrorCode.BusinessProcesssError,
- "Error sending callback request", e);
- ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL,
- "Error sending callback request: " + e.getMessage());
+ "Error sending callback request", e);
return false;
} finally {
if (httpResponse != null) {
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
index da00a6fafa..6f40ba07a9 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
@@ -25,7 +25,7 @@ package org.onap.so.adapters.sdnc.sdncrest;
import org.onap.so.adapters.sdnc.exception.SDNCAdapterException;
import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoAlarmLogger;
+
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
@@ -36,7 +36,7 @@ public class MapTypedRequestTunablesData {
private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,MapTypedRequestTunablesData.class);
- private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+
private static final String MISSING_CONFIGURATION_ERROR_MSG= "Missing configuration for: ";
private static final String MISSING_CONFIG_PARAM_ERROR_MSG="Missing config param";
@@ -55,7 +55,7 @@ public class MapTypedRequestTunablesData {
if ("".equals(value)) {
error= MISSING_CONFIGURATION_ERROR_MSG + reqTunable.getKey();
msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, reqTunable.getKey(), "SDNC", "", MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG);
- alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, reqTunable.getError());
+
throw new SDNCAdapterException(error);
}
@@ -64,7 +64,7 @@ public class MapTypedRequestTunablesData {
if (parts.length != 5) {
error="Invalid configuration for: " + reqTunable.getKey();
msoLogger.error(MessageEnum.RA_SDNC_INVALID_CONFIG, reqTunable.getKey(), value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config");
- alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, reqTunable.getError());
+
throw new SDNCAdapterException(error);
}
@@ -80,7 +80,7 @@ public class MapTypedRequestTunablesData {
if ("".equals(reqTunable.getSdncUrl())) {
error=MISSING_CONFIGURATION_ERROR_MSG + urlPropKey;
msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, urlPropKey, "SDNC", "", MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG);
- alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, reqTunable.getError());
+
throw new SDNCAdapterException(error);
}
@@ -98,7 +98,7 @@ public class MapTypedRequestTunablesData {
error=MISSING_CONFIGURATION_ERROR_MSG + Constants.MY_URL_PROP;
msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.MY_URL_PROP, "SDNC", "",
MsoLogger.ErrorCode.DataError, MISSING_CONFIG_PARAM_ERROR_MSG);
- alarmLogger.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, reqTunable.getError());
+
throw new SDNCAdapterException(error);
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
index 1c5025a59d..3ecf6337cf 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
@@ -52,7 +52,7 @@ import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.adapters.sdncrest.SDNCErrorCommon;
import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoAlarmLogger;
+
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -69,7 +69,7 @@ import org.springframework.core.env.Environment;
@Component
public abstract class SDNCConnector {
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCConnector.class);
- private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
+
private static final String MSO_INTERNAL_ERROR="MsoInternalError";
private static final String XPATH_EXCEPTION="XPath Exception";
@Autowired
@@ -149,7 +149,7 @@ public abstract class SDNCConnector {
}
logError(errMsg);
- ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, errMsg);
+
return createErrorResponse(statusCode, errMsg, rt);
}
@@ -199,13 +199,13 @@ public abstract class SDNCConnector {
protected void logError(String errMsg) {
LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "",
MsoLogger.ErrorCode.AvailabilityError, errMsg);
- ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, errMsg);
+
}
protected void logError(String errMsg, Throwable t) {
LOGGER.error(MessageEnum.RA_EXCEPTION_COMMUNICATE_SDNC, "SDNC", "",
MsoLogger.ErrorCode.AvailabilityError, errMsg, t);
- ALARMLOGGER.sendAlarm(MSO_INTERNAL_ERROR, MsoAlarmLogger.CRITICAL, errMsg);
+
}
/**
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
index 4c85241f9a..48bc2d84bb 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
@@ -33,7 +33,7 @@ import javax.ws.rs.core.Response;
import org.onap.so.adapters.sdnc.impl.Constants;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoAlarmLogger;
+
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
@@ -48,7 +48,7 @@ import org.springframework.stereotype.Component;
@Component
public class SNIROResponse {
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SNIROResponse.class);
- private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
+
@Autowired
private Environment env;
@@ -71,7 +71,7 @@ public class SNIROResponse {
String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP;
LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "",
MsoLogger.ErrorCode.DataError, "Missing config param");
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
+
return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build();
}