summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-api-handler-common
diff options
context:
space:
mode:
authorr.bogacki <r.bogacki@samsung.com>2019-03-14 15:24:57 +0100
committerr.bogacki <r.bogacki@samsung.com>2019-03-18 11:02:58 +0100
commitfaa0b29e3b7b1fa23a1444a5d9ac020b3c60dedc (patch)
tree4839f982eb10e66e587b55b757ffc00dd5f9d30f /mso-api-handlers/mso-api-handler-common
parent4ca3abdffa40e7777a233151f66ee0b4131ed538 (diff)
Removed MsoLogger class
Bye bye MsoLogger class. Extracted constants to separated classes. Fixed imports. Change-Id: I7c8e0527e7dbd097d3ea93b9dab279354652da47 Issue-ID: LOG-631 Signed-off-by: Robert Bogacki <r.bogacki@samsung.com>
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common')
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java6
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java16
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java4
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java2
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java5
6 files changed, 18 insertions, 19 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
index d3e8323f37..9b77c1469b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
@@ -40,8 +40,8 @@ import org.onap.so.apihandler.camundabeans.CamundaInput;
import org.onap.so.apihandler.camundabeans.CamundaIntegerInput;
import org.onap.so.apihandler.camundabeans.CamundaRequest;
import org.onap.so.apihandler.camundabeans.CamundaVIDRequest;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
@@ -195,7 +195,7 @@ public class CamundaClient extends RequestClient{
logger.trace("request body is {}", jsonReq);
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapRequest",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
}
return jsonReq;
}
@@ -288,7 +288,7 @@ public class CamundaClient extends RequestClient{
logger.trace("request body is {}", jsonReq);
}catch(Exception e){
logger.error("{} {} {} {} {}", MessageEnum.APIH_WARP_REQUEST.toString(), "Camunda", "wrapVIDRequest",
- MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
+ ErrorCode.BusinessProcesssError.getValue(), "Error in APIH Warp request", e);
}
return jsonReq;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
index 3d09a30731..6b43e96b08 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
@@ -35,8 +35,8 @@ import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger;
@@ -78,7 +78,7 @@ public class ResponseHandler {
HttpEntity entity = httpResponse.getEntity();
responseBody = EntityUtils.toString(entity);
} catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("IOException getting Camunda response body", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
@@ -90,7 +90,7 @@ public class ResponseHandler {
try {
response = mapper.readValue(responseBody, CamundaResponse.class);
} catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MsoLogger.ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ValidateException validateException = new ValidateException.Builder("Cannot parse Camunda Response", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
@@ -100,7 +100,7 @@ public class ResponseHandler {
if(response!=null){
responseBody = response.getResponse();
}else{
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError)
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, ErrorCode.BusinessProcesssError)
.targetEntity("Camunda").targetServiceName("parseCamunda").build();
BPMNFailureException bpmnFailureException = new BPMNFailureException.Builder(String.valueOf(status), status, ErrorNumbers.ERROR_FROM_BPEL)
.errorInfo(errorLoggerInfo).build();
@@ -117,13 +117,13 @@ public class ResponseHandler {
}
}catch(IOException e){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Could not convert BPEL response to string", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
.errorInfo(errorLoggerInfo).build();
throw validateException;
}
if(status!=HttpStatus.SC_ACCEPTED){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError)
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, ErrorCode.BusinessProcesssError)
.targetEntity("BPEL").targetServiceName("parseBpel").build();
@@ -144,7 +144,7 @@ public class ResponseHandler {
responseBody = EntityUtils.toString(camundataskEntity);
}
}catch(IOException e) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Could not convert CamundaTask response to string", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e)
@@ -152,7 +152,7 @@ public class ResponseHandler {
throw validateException;
}
if(status!=HttpStatus.SC_NO_CONTENT && status != HttpStatus.SC_ACCEPTED){
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, MsoLogger.ErrorCode.BusinessProcesssError)
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_ERROR_FROM_BPEL_SERVER, ErrorCode.BusinessProcesssError)
.targetEntity("CAMUNDATASK").targetServiceName("parseCamundaTask").build();
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
index da13ff509b..c3dfe2c685 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/XMLValidator.java
@@ -34,9 +34,9 @@ import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.apache.commons.io.IOUtils;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.xml.sax.SAXException;
@@ -98,7 +98,7 @@ public class XMLValidator {
} catch (Exception e) {
logger.error("{} {} {}", MessageEnum.APIH_CANNOT_READ_SCHEMA.toString(),
- MsoLogger.ErrorCode.SchemaError.getValue(), "APIH cannot read schema file", e);
+ ErrorCode.SchemaError.getValue(), "APIH cannot read schema file", e);
return "ErrorDetails: " + "Unable to read the schema file";
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
index 282ca12e2b..4c069d5b1a 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiExceptionMapper.java
@@ -40,9 +40,9 @@ import javax.xml.bind.Marshaller;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.RequestError;
import org.onap.so.serviceinstancebeans.ServiceException;
@@ -137,7 +137,7 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> {
} catch (JsonProcessingException | JAXBException e) {
String errorMsg = "Exception in buildServiceErrorResponse writing exceptionType to string " + e.getMessage();
logger.error("{} {} {} {}", MessageEnum.GENERAL_EXCEPTION.toString(), "BuildServiceErrorResponse",
- MsoLogger.ErrorCode.DataError.getValue(), errorMsg, e);
+ ErrorCode.DataError.getValue(), errorMsg, e);
return errorMsg;
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java
index b0b154bc5c..058d80868c 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/logging/ErrorLoggerInfo.java
@@ -23,7 +23,7 @@ package org.onap.so.apihandlerinfra.logging;
import java.io.Serializable;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger.ErrorCode;
+import org.onap.so.logger.ErrorCode;
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
index 1be521952a..42190a4a1e 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandlerinfra/ApiExceptionTest.java
@@ -28,10 +28,9 @@ import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.exceptions.*;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
+import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
-
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
@@ -89,7 +88,7 @@ public class ApiExceptionTest {
@Test
public void testDuplicateRequestException() throws ApiException {
- ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+ ErrorLoggerInfo testLog = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
thrown.expect(DuplicateRequestException.class);
thrown.expectMessage(startsWith("Error: Locked instance"));
thrown.expect(hasProperty("httpResponseCode", is(HttpStatus.SC_NOT_FOUND)));