From e1f41c3e6591b572a75021f4b51538f8fdbfc88d Mon Sep 17 00:00:00 2001 From: sourabh_sourabh Date: Sat, 12 Mar 2022 22:41:10 +0530 Subject: Async: NCMP Rest impl. including Request ID generation - In case of invalid topic return http status 400 with error message - Unit test is modified to handle/validate InvalidTopicException Issue-ID: CPS-828 Signed-off-by: sourabh_sourabh Change-Id: I05645c92ccebb8aa422a47f6edcde7b64088a118 --- .../cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'cps-ncmp-rest/src') diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java index 2495f36426..0843e9741e 100755 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java @@ -24,6 +24,7 @@ import lombok.AccessLevel; import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.onap.cps.ncmp.api.impl.exception.DmiRequestException; +import org.onap.cps.ncmp.api.impl.exception.InvalidTopicException; import org.onap.cps.ncmp.api.impl.exception.NcmpException; import org.onap.cps.ncmp.api.impl.exception.ServerNcmpException; import org.onap.cps.ncmp.rest.controller.NetworkCmProxyController; @@ -65,7 +66,8 @@ public class NetworkCmProxyRestExceptionHandler { return buildErrorResponse(HttpStatus.INTERNAL_SERVER_ERROR, exception); } - @ExceptionHandler({DmiRequestException.class, DataValidationException.class, HttpMessageNotReadableException.class}) + @ExceptionHandler({DmiRequestException.class, DataValidationException.class, HttpMessageNotReadableException.class, + InvalidTopicException.class}) public static ResponseEntity handleDmiRequestExceptions(final Exception exception) { return buildErrorResponse(HttpStatus.BAD_REQUEST, exception); } -- cgit 1.2.3-korg