diff options
author | Smokowski, Steven <steve.smokowski@att.com> | 2019-08-15 21:40:16 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2019-08-15 21:43:44 -0400 |
commit | fa36daa658a50d9ca2e57cae649d63c0e9e2882a (patch) | |
tree | 09bec4b384664e59c5e3671eec5f17f8c68e8a02 /mso-api-handlers/mso-api-handler-common/src/main/java | |
parent | e536a1035d0f224de32f76a1226c772b8f8d7c01 (diff) |
Initial commit of validation framework to APIH
Move ListenerRunner to common location
Adjust request params name, update junit tests
Update validations to work properly
Properly escape period for the string split
Issue-ID: SO-2232
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: Ia468cf7062cccf30e28afeb7a5cddc37ceb2e002
Diffstat (limited to 'mso-api-handlers/mso-api-handler-common/src/main/java')
3 files changed, 16 insertions, 2 deletions
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java index c7f6459482..ab2ce10690 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ApiException.java @@ -29,7 +29,7 @@ public abstract class ApiException extends Exception { * */ private static final long serialVersionUID = 683162058616691134L; - private int httpResponseCode; + private int httpResponseCode = 500; private String messageID; private ErrorLoggerInfo errorLoggerInfo; @@ -49,6 +49,15 @@ public abstract class ApiException extends Exception { super(message, cause); } + public ApiException(String message, int httpResponseCode) { + super(message); + this.httpResponseCode = httpResponseCode; + } + + public ApiException(String message) { + super(message); + } + public String getMessageID() { return messageID; } 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 66b86a6961..6a56b58f04 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 @@ -70,7 +70,7 @@ public class ApiExceptionMapper implements ExceptionMapper<ApiException> { @Override public Response toResponse(ApiException exception) { - + logger.error("Error During API Call", exception); return Response.status(exception.getHttpResponseCode()).entity(buildErrorString(exception)).build(); } diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java index 372ed30d8e..ae8256e64f 100644 --- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java +++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/exceptions/ValidateException.java @@ -28,6 +28,11 @@ public class ValidateException extends ApiException { } + public ValidateException(String errorMessage, int httpResponseCode) { + super(errorMessage, httpResponseCode); + } + + public static class Builder extends ApiException.Builder<Builder> { public Builder(String message, int httpResponseCode, String messageID) { |