diff options
author | david.mcweeney <david.mcweeney@est.tech> | 2024-05-02 15:14:52 +0100 |
---|---|---|
committer | david.mcweeney <david.mcweeney@est.tech> | 2024-05-16 14:14:21 +0100 |
commit | 184b681a516c08abe9ef151090c5f208f5544e0e (patch) | |
tree | 8d4c5633f9c71bd119e0aa4eff390b0938dd9764 /src/test/groovy/org | |
parent | a89971d5da7bc11f45195fbd3f8e77cb4b02e833 (diff) |
CPS-2187 - #5 Add module Set Tag to dmi (single cm handle) data request
Change-Id: Iae7e3bac67bb8e5bbb50e4157fdf7daf9fc2220f
Signed-off-by: david.mcweeney <david.mcweeney@est.tech>
Issue-ID: CPS-2187
Diffstat (limited to 'src/test/groovy/org')
-rw-r--r-- | src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy | 24 |
1 files changed, 18 insertions, 6 deletions
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 a23902fa..520e76af 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 @@ -21,7 +21,7 @@ package org.onap.cps.ncmp.dmi.rest.controller -import ch.qos.logback.classic.Level + import ch.qos.logback.classic.Logger import ch.qos.logback.classic.spi.ILoggingEvent import ch.qos.logback.core.read.ListAppender @@ -221,9 +221,8 @@ class DmiRestControllerSpec extends Specification { .contentType(MediaType.APPLICATION_JSON) .content(jsonData)) then: 'the module set tag is logged' - def loggingEvent = getLoggingEvent() - assert loggingEvent.level == Level.INFO - assert loggingEvent.formattedMessage.contains('Module set tag received: module-set-tag1') + def loggingMessage = getLoggingMessage(0) + assert loggingMessage.contains('module-set-tag1') } def 'Get resource data for pass-through operational.'() { @@ -339,6 +338,19 @@ class DmiRestControllerSpec extends Specification { resourceIdentifier << ['passthrough-operational', 'passthrough-running'] } + 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' + 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') + } + def 'Get resource data for pass-through running with #scenario value in resource identifier param.'() { given: 'Get resource data url' def getResourceDataForCmHandleUrl = "${basePathV1}/ch/some-cmHandle/data/ds/ncmp-datastore:passthrough-running" + @@ -381,7 +393,7 @@ class DmiRestControllerSpec extends Specification { assert response.status == 501 } - def getLoggingEvent() { - return logger.list[0] + def getLoggingMessage(int index) { + return logger.list[index].formattedMessage } }
\ No newline at end of file |