From efe96fa26c01a66c673be68d5ecc70f836963505 Mon Sep 17 00:00:00 2001 From: "david.mcweeney" Date: Tue, 28 May 2024 10:45:02 +0100 Subject: CPS-2187 - Move Module Set Tag into request body for data access passthrough Change-Id: If633e1d2cd3e9986917f3537286896198a6a3897 Signed-off-by: david.mcweeney Issue-ID: CPS-2187 --- docs/api/swagger/openapi.yaml | 23 ++++------------------ openapi/components.yml | 14 +++---------- openapi/openapi.yml | 1 - .../dmi/rest/controller/DmiRestController.java | 4 +--- .../rest/controller/DmiRestControllerSpec.groovy | 4 ++-- src/test/resources/readData.json | 3 ++- 6 files changed, 12 insertions(+), 37 deletions(-) diff --git a/docs/api/swagger/openapi.yaml b/docs/api/swagger/openapi.yaml index ceb61913..14c721a3 100644 --- a/docs/api/swagger/openapi.yaml +++ b/docs/api/swagger/openapi.yaml @@ -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: diff --git a/openapi/components.yml b/openapi/components.yml index 3142654d..4a6d1729 100644 --- a/openapi/components.yml +++ b/openapi/components.yml @@ -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 diff --git a/openapi/openapi.yml b/openapi/openapi.yml index 38f21c15..6dbc19f3 100644 --- a/openapi/openapi.yml +++ b/openapi/openapi.yml @@ -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: 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 ec56884c..cad5e726 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 @@ -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); 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 23b039bd..a519de7b 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 @@ -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.'() { diff --git a/src/test/resources/readData.json b/src/test/resources/readData.json index 9f2b154f..53f6d2ed 100644 --- a/src/test/resources/readData.json +++ b/src/test/resources/readData.json @@ -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 -- cgit 1.2.3-korg