summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSourabh Sourabh <sourabh.sourabh@est.tech>2024-05-20 16:27:44 +0000
committerGerrit Code Review <gerrit@onap.org>2024-05-20 16:27:44 +0000
commit495ba782c8e39a09a92edfc4ad85b22bb8bb89ff (patch)
tree7de2265f3b270879aa3140e31b9b17a0eea30b5a
parentd1cc02203e433cd2581a958b12b239e6f5b2d136 (diff)
parent3cadc1985c5f8cdc3f1914b95fe43d5e0987743b (diff)
Merge "CPS-2182 -#3 Include module Set Tag in dmi batch data enpoint"
-rw-r--r--docs/api/swagger/openapi.yaml2
-rw-r--r--openapi/components.yml10
-rw-r--r--src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java11
-rw-r--r--src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy9
4 files changed, 28 insertions, 4 deletions
diff --git a/docs/api/swagger/openapi.yaml b/docs/api/swagger/openapi.yaml
index 5782a9c8..0f690ef5 100644
--- a/docs/api/swagger/openapi.yaml
+++ b/docs/api/swagger/openapi.yaml
@@ -671,10 +671,12 @@ components:
cmHandleProperties:
myProp: some value
otherProp: other value
+ moduleSetTag: module-set-tag1
- id: cmHandle123
cmHandleProperties:
myProp: some value
otherProp: other value
+ moduleSetTag: module-set-tag2
operation: read
properties:
operation:
diff --git a/openapi/components.yml b/openapi/components.yml
index e011b16d..ae9710b1 100644
--- a/openapi/components.yml
+++ b/openapi/components.yml
@@ -76,27 +76,31 @@ components:
cmHandles:
type: array
items:
- $ref: '#/components/schemas/cmHandle'
+ $ref: '#/components/schemas/dmiOperationCmHandle'
required:
- operation
- operationId
- datastore
- cmHandles
- cmHandle:
+ dmiOperationCmHandle:
type: object
- title: 'cmHandle'
+ title: 'CmHandle with properties for DMI'
properties:
id:
type: string
cmHandleProperties:
additionalProperties:
type: string
+ moduleSetTag:
+ type: string
+ example: module-set-tag1
example:
id: cmHandle123
cmHandleProperties:
myProp: some value
otherProp: other value
+ moduleSetTag: module-set-tag1
ModuleResourcesReadRequest:
type: object
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 47b9fc3e..ec56884c 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
@@ -116,6 +116,17 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi {
@Override
public ResponseEntity<Void> getResourceDataForCmHandleDataOperation(final String topic, final String requestId,
final ResourceDataOperationRequests resourceDataOperationRequests) {
+ log.info("Request Details (for testing purposes)");
+ log.info("Request Id: {}", requestId);
+ log.info("Topic: {}", topic);
+
+ log.info("Details of the first Operation");
+ log.info("Resource Identifier: {}", resourceDataOperationRequests.get(0).getResourceIdentifier());
+ log.info("Module Set Tag: {}", resourceDataOperationRequests.get(0).getCmHandles().get(0).getModuleSetTag());
+ log.info("Operation Id: {}", resourceDataOperationRequests.get(0).getOperationId());
+ log.info("Cm Handles: {}", resourceDataOperationRequests.get(0).getCmHandles());
+ log.info("Options: {}", resourceDataOperationRequests.get(0).getOptions());
+
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 520e76af..23b039bd 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
@@ -384,13 +384,20 @@ class DmiRestControllerSpec extends Specification {
def resourceDataUrl = "$basePathV1/data?topic=client-topic-name&requestId=some-requestId"
and: 'list of operation details are received into request body'
def dataOperationRequestBody = '[{"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"}}]}]'
+ '"cmHandles": [ {"id": "cmHandle123", "moduleSetTag": "module-set-tag1", "cmHandleProperties": { "myProp`": "some value", "otherProp": "other value"}}]}]'
when: 'the dmi resource data for dataOperation api is called.'
def response = mvc.perform(
post(resourceDataUrl).contentType(MediaType.APPLICATION_JSON).content(dataOperationRequestBody)
).andReturn().response
then: 'the resource data operation endpoint returns the not implemented response'
assert response.status == 501
+ and: 'the job details are correctly received (logged)'
+ assert getLoggingMessage(1).contains('some-requestId')
+ assert getLoggingMessage(2).contains('client-topic-name')
+ assert getLoggingMessage(4).contains('some resourceIdentifier')
+ assert getLoggingMessage(5).contains('module-set-tag1')
+ and: 'the operation Id is correctly received (logged)'
+ assert getLoggingMessage(6).contains('14')
}
def getLoggingMessage(int index) {