CPS-2187 - Move Module Set Tag into request body for data access passthrough 88/138088/3
authordavid.mcweeney <david.mcweeney@est.tech>
Tue, 28 May 2024 09:45:02 +0000 (10:45 +0100)
committerdavid.mcweeney <david.mcweeney@est.tech>
Tue, 28 May 2024 13:46:06 +0000 (14:46 +0100)
Change-Id: If633e1d2cd3e9986917f3537286896198a6a3897
Signed-off-by: david.mcweeney <david.mcweeney@est.tech>
Issue-ID: CPS-2187

docs/api/swagger/openapi.yaml
openapi/components.yml
openapi/openapi.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
src/test/resources/readData.json

index ceb6191..14c721a 100644 (file)
@@ -206,15 +206,6 @@ paths:
         required: false
         schema:
           type: string
-      - description: Module set tag of the given cm handle.
-        examples:
-          sample1:
-            value: tag1
-        in: query
-        name: moduleSetTag
-        required: false
-        schema:
-          type: string
       requestBody:
         content:
           application/json:
@@ -380,16 +371,6 @@ components:
       required: false
       schema:
         type: string
-    moduleSetTagParamInQuery:
-      description: Module set tag of the given cm handle.
-      examples:
-        sample1:
-          value: tag1
-      in: query
-      name: moduleSetTag
-      required: false
-      schema:
-        type: string
     requiredTopicParamInQuery:
       description: mandatory topic name passed from client(NCMP).
       examples:
@@ -567,6 +548,7 @@ components:
         dataType: my-data-type
         cmHandleProperties:
           key: "{\"prop1\":\"value1\",\"prop2\":\"value2\"}"
+        moduleSetTag: module-set-tag1
         operation: read
       properties:
         operation:
@@ -593,6 +575,9 @@ components:
         requestId:
           example: 3a9ce55c-e365-4dc9-8da3-a06f07cbc6d7
           type: string
+        moduleSetTag:
+          example: module-set-tag1
+          type: string
       type: object
     ResourceDataOperationRequests:
       items:
index 3142654..4a6d172 100644 (file)
@@ -180,6 +180,9 @@ components:
         requestId:
           type: string
           example: 3a9ce55c-e365-4dc9-8da3-a06f07cbc6d7
+        moduleSetTag:
+          type: string
+          example: module-set-tag1
 
     cmHandleProperties:
       type: object
@@ -297,17 +300,6 @@ components:
           value:
             topic: my-topic-name
 
-    moduleSetTagParamInQuery:
-      name: moduleSetTag
-      in: query
-      description: Module set tag of the given cm handle.
-      required: false
-      schema:
-        type: string
-      examples:
-        sample1:
-          value: tag1
-
     requiredRequestIdParamInQuery:
       name: requestId
       in: query
index 38f21c1..6dbc19f 100644 (file)
@@ -128,7 +128,6 @@ paths:
         - $ref: 'components.yml#/components/parameters/resourceIdentifierInQuery'
         - $ref: 'components.yml#/components/parameters/optionsParamInQuery'
         - $ref: 'components.yml#/components/parameters/topicParamInQuery'
-        - $ref: 'components.yml#/components/parameters/moduleSetTagParamInQuery'
       requestBody:
         description: Contains collection of cm handles with it's private properties and requestId
         content:
index ec56884..cad5e72 100644 (file)
@@ -149,10 +149,8 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi {
                                                         final String resourceIdentifier,
                                                         final String optionsParamInQuery,
                                                         final String topicParamInQuery,
-                                                        final String moduleSetTagParamInQuery,
                                                         final DataAccessRequest dataAccessRequest) {
-
-        log.info("Module set tag received: {}", moduleSetTagParamInQuery);
+        log.info("Module set tag: {}", dataAccessRequest.getModuleSetTag());
         if (DatastoreType.PASSTHROUGH_OPERATIONAL == DatastoreType.fromDatastoreName(datastoreName)) {
             return dataAccessPassthroughOperational(resourceIdentifier, cmHandle, dataAccessRequest,
                     optionsParamInQuery, topicParamInQuery);
index 23b039b..a519de7 100644 (file)
@@ -341,14 +341,14 @@ class DmiRestControllerSpec extends Specification {
     def 'PassThrough logs module set tag'(){
         given: 'Passthrough read URL and request data with a module set tag (parameter)'
             def readPassThroughUrl ="${basePathV1}/ch/some-cmHandle/data/ds/ncmp-datastore:" +
-                'passthrough-running?resourceIdentifier=some-resourceIdentifier&moduleSetTag=module-set-tag1'
+                'passthrough-running?resourceIdentifier=some-resourceIdentifier'
             def jsonData = TestUtils.getResourceFileContent('readData.json')
         when: 'the request is posted'
             mvc.perform(
                 post(readPassThroughUrl).contentType(MediaType.APPLICATION_JSON).content(jsonData))
         then: 'response status is OK'
             def loggingMessage = getLoggingMessage(0)
-            assert loggingMessage.contains('module-set-tag1')
+            assert loggingMessage.contains('module-set-tag-example')
     }
 
     def 'Get resource data for pass-through running with #scenario value in resource identifier param.'() {
index 9f2b154..53f6d2e 100644 (file)
@@ -4,5 +4,6 @@
   "data": "normal request body",
   "cmHandleProperties": {
     "some-property": "some-property-value"
-  }
+  },
+  "moduleSetTag": "module-set-tag-example"
 }
\ No newline at end of file