CPS-2182 -#3 Include module Set Tag in dmi batch data enpoint 60/137860/15
authordavid.mcweeney <david.mcweeney@est.tech>
Wed, 8 May 2024 11:37:02 +0000 (12:37 +0100)
committerdavid.mcweeney <david.mcweeney@est.tech>
Mon, 20 May 2024 16:10:41 +0000 (17:10 +0100)
Change-Id: Ib45cc59c12062429aababa7aedb3a028aac0315c
Signed-off-by: david.mcweeney <david.mcweeney@est.tech>
Issue-ID: CPS-2182

docs/api/swagger/openapi.yaml
openapi/components.yml
src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java
src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy

index 5782a9c..0f690ef 100644 (file)
@@ -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:
index e011b16..ae9710b 100644 (file)
@@ -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
index 47b9fc3..ec56884 100644 (file)
@@ -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);
     }
 
index 520e76a..23b039b 100644 (file)
@@ -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) {