summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest/src/main
diff options
context:
space:
mode:
authorsourabh_sourabh <sourabh.sourabh@est.tech>2022-02-16 21:53:41 +0530
committersourabh_sourabh <sourabh.sourabh@est.tech>2022-03-10 21:44:32 +0530
commit1f2e66e720678f00682e6429aab7fa62251baf29 (patch)
tree3fa7a5d9a1934c6ed02bc36b2483ee35b0c3c4b7 /cps-ncmp-rest/src/main
parentb5a9ec3305b7d848f0fccfc6b007654679d6cf4c (diff)
Async: NCMP Rest impl. including Request ID generation
- Based on topic api can be sync or async - RequestId is generated using UUID - Used UriComponentBuilder to populate dmi service url. - New test cases are introduced to validate service url generation. Issue-ID: CPS-828 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: I2696d5cb012d9274b0c1265f16aa9b2369657f05
Diffstat (limited to 'cps-ncmp-rest/src/main')
-rwxr-xr-xcps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java14
-rwxr-xr-xcps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandler.java6
2 files changed, 16 insertions, 4 deletions
diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
index 86f4460eaa..385180d8b7 100755
--- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
+++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/controller/NetworkCmProxyController.java
@@ -76,17 +76,20 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
* @param resourceIdentifier resource identifier
* @param acceptParamInHeader accept header parameter
* @param optionsParamInQuery options query parameter
+ * @param topicParamInQuery topic query parameter
* @return {@code ResponseEntity} response from dmi plugin
*/
@Override
public ResponseEntity<Object> getResourceDataOperationalForCmHandle(final String cmHandle,
final @NotNull @Valid String resourceIdentifier,
final String acceptParamInHeader,
- final @Valid String optionsParamInQuery) {
+ final @Valid String optionsParamInQuery,
+ final @Valid String topicParamInQuery) {
final Object responseObject = networkCmProxyDataService.getResourceDataOperationalForCmHandle(cmHandle,
resourceIdentifier,
acceptParamInHeader,
- optionsParamInQuery);
+ optionsParamInQuery,
+ topicParamInQuery);
return ResponseEntity.ok(responseObject);
}
@@ -97,17 +100,20 @@ public class NetworkCmProxyController implements NetworkCmProxyApi {
* @param resourceIdentifier resource identifier
* @param acceptParamInHeader accept header parameter
* @param optionsParamInQuery options query parameter
+ * @param topicParamInQuery topic query parameter
* @return {@code ResponseEntity} response from dmi plugin
*/
@Override
public ResponseEntity<Object> getResourceDataRunningForCmHandle(final String cmHandle,
final @NotNull @Valid String resourceIdentifier,
final String acceptParamInHeader,
- final @Valid String optionsParamInQuery) {
+ final @Valid String optionsParamInQuery,
+ final @Valid String topicParamInQuery) {
final Object responseObject = networkCmProxyDataService.getResourceDataPassThroughRunningForCmHandle(cmHandle,
resourceIdentifier,
acceptParamInHeader,
- optionsParamInQuery);
+ optionsParamInQuery,
+ topicParamInQuery);
return ResponseEntity.ok(responseObject);
}
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 5aaf1c31f0..2495f36426 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
@@ -30,6 +30,7 @@ import org.onap.cps.ncmp.rest.controller.NetworkCmProxyController;
import org.onap.cps.ncmp.rest.controller.NetworkCmProxyInventoryController;
import org.onap.cps.ncmp.rest.model.ErrorMessage;
import org.onap.cps.spi.exceptions.CpsException;
+import org.onap.cps.spi.exceptions.DataNodeNotFoundException;
import org.onap.cps.spi.exceptions.DataValidationException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
@@ -69,6 +70,11 @@ public class NetworkCmProxyRestExceptionHandler {
return buildErrorResponse(HttpStatus.BAD_REQUEST, exception);
}
+ @ExceptionHandler({DataNodeNotFoundException.class})
+ public static ResponseEntity<Object> handleNotFoundExceptions(final CpsException exception) {
+ return buildErrorResponse(HttpStatus.NOT_FOUND, exception);
+ }
+
private static ResponseEntity<Object> buildErrorResponse(final HttpStatus status, final Exception exception) {
if (exception.getCause() != null || !(exception instanceof CpsException)) {
log.error("Exception occurred", exception);