summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorraviteja.karumuri <raviteja.karumuri@est.tech>2023-05-24 18:23:38 +0100
committerraviteja.karumuri <raviteja.karumuri@est.tech>2023-06-01 12:08:20 +0100
commit7272f11fa4a3876cf61451a21916a7244c2d045b (patch)
tree18be57cf71e4877da7df5f4b33c011645ad3b60d /src
parent4679c1c64a88ee65b0f86e14be32a8b82f8da469 (diff)
DMI-Plugin : Update batch endpoint (move url param into rest body)
Issue-ID: CPS-1636 Signed-off-by: raviteja.karumuri <raviteja.karumuri@est.tech> Change-Id: I787be1be899a69c0972ccfd17016e67eaf8a771a
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java13
-rw-r--r--src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy23
2 files changed, 18 insertions, 18 deletions
diff --git a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java
index 9459d1b1..6a404c6a 100644
--- a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java
+++ b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation
+ * Copyright (C) 2021-2023 Nordix Foundation
* Modifications Copyright (C) 2022 Bell Canada
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -35,6 +35,7 @@ import org.onap.cps.ncmp.dmi.model.DataAccessRequest;
import org.onap.cps.ncmp.dmi.model.ModuleReferencesRequest;
import org.onap.cps.ncmp.dmi.model.ModuleResourcesReadRequest;
import org.onap.cps.ncmp.dmi.model.ModuleSet;
+import org.onap.cps.ncmp.dmi.model.ResourceBatchRequest;
import org.onap.cps.ncmp.dmi.model.YangResources;
import org.onap.cps.ncmp.dmi.notifications.async.AsyncTaskExecutor;
import org.onap.cps.ncmp.dmi.rest.api.DmiPluginApi;
@@ -106,14 +107,14 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi {
/**
* This method is not implemented for ONAP DMI plugin.
*
- * @param datastoreName name of the data store
- * @param topic Kafka topic name
- * @param body list of cm-handles
+ * @param requestId requestId generated by NCMP as an ack for client
+ * @param topic client given topic name
+ * @param resourceDataBatchRequest list of operation details
* @return (@ code ResponseEntity) response entity
*/
@Override
- public ResponseEntity<Void> getResourceDataByCmHandles(final String datastoreName, final String topic,
- final Object body) {
+ public ResponseEntity<Void> getResourceDataForCmHandleBatch(final String requestId, final String topic,
+ final List<ResourceBatchRequest> resourceDataBatchRequest) {
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}
diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy
index acc8b63b..8499ae25 100644
--- a/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy
+++ b/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy
@@ -1,6 +1,6 @@
/*
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation
+ * Copyright (C) 2021-2023 Nordix Foundation
* Modifications Copyright (C) 2021-2022 Bell Canada
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -312,18 +312,17 @@ class DmiRestControllerSpec extends Specification {
}
- def 'Get resource data for a collection of cm handles (unimplemented).'() {
- given: 'an endpoint for adding a batch of cm handle Ids'
- def url = "$basePathV1/ch/batch/data/ds/test-datastore?topic=test"
- and: 'a request body'
- def body = '{"CmHandles": []}'
- when: 'the endpoint is invoked'
+ def 'Get resource data for a list of operations.'() {
+ given: 'an endpoint for a batch data request with list of cmhandles in request body'
+ def resourceDataUrl = "$basePathV1/data?topic=client-topic-name&requestId=some-requestId"
+ and: 'list of operation details are received into request body'
+ def batchDataRequestBody = '[{"operation": "read", "operationId": "14", "datastore": "ncmp-datastore:passthrough-operational", "options": "some options", "resourceIdentifier": "some resourceIdentifier",' +
+ ' "cmhandles": [ {"id": "cmHanlde123", "cmHandleProperties": { "myProp`": "some value", "otherProp": "other value"}}]}]'
+ when: 'the dmi resource data for batch operation api is called.'
def response = mvc.perform(
- post(url)
- .contentType(MediaType.APPLICATION_JSON)
- .content(body)
+ post(resourceDataUrl).contentType(MediaType.APPLICATION_JSON).content(batchDataRequestBody)
).andReturn().response
- then: 'the response status code is 501'
+ then: 'the batch data endpoint returns the not implemented response'
assert response.status == 501
}
-}
+} \ No newline at end of file