X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps-ncmp-service%2Fsrc%2Ftest%2Fgroovy%2Forg%2Fonap%2Fcps%2Fncmp%2Fapi%2Fimpl%2Foperation%2FDmiOperationsSpec.groovy;h=3c9b16440817835b9bc9a6ddb9145fde27e3d034;hb=0af60de4fbb3a3e6c828e179c667b173b1539b62;hp=c2a135e670599825660c350c1583c8a78a7bec91;hpb=7edbeb6d5853206cc1d3b4cadd7ba50e96f4f04d;p=cps.git diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operation/DmiOperationsSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operation/DmiOperationsSpec.groovy index c2a135e67..3c9b16440 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operation/DmiOperationsSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/operation/DmiOperationsSpec.groovy @@ -41,44 +41,55 @@ class DmiOperationsSpec extends Specification { def 'call get resource data for pass-through:operational datastore from DMI.'() { given: 'expected url' - def expectedUrl = 'testDmiBasePath/dmi/api/v1/ch/testCmhandle/data/ds' + - '/ncmp-datastore:passthrough-operational/testResourceId?fields=testFieldsQuery&depth=10' + def expectedUrl = 'testDmiBasePath/dmi/api/v1/ch/testCmhandle/data/ds' + + '/ncmp-datastore:passthrough-operational/testResourceId?fields=testFieldsQuery&depth=10' when: 'get resource data is called to DMI' - objectUnderTest.getResourceDataOperationalFromDmi('testDmiBasePath', - 'testCmhandle', - 'testResourceId', - 'testFieldsQuery', - 10, - 'testAcceptJson', - 'testJsonbody') + objectUnderTest.getResourceDataOperationalFromDmi('testDmiBasePath', + 'testCmhandle', + 'testResourceId', + 'testFieldsQuery', + 10, + 'testAcceptJson', + 'testJsonbody') then: 'the put operation is executed with the correct URL' - 1 * mockDmiRestClient.putOperationWithJsonData(expectedUrl, 'testJsonbody', _ as HttpHeaders) + 1 * mockDmiRestClient.putOperationWithJsonData(expectedUrl, 'testJsonbody', _ as HttpHeaders) } def 'call get resource data for pass-through:running datastore from DMI.'() { given: 'expected url' - def expectedUrl = 'testDmiBasePath/dmi/api/v1/ch/testCmhandle/data/ds' + - '/ncmp-datastore:passthrough-running/testResourceId?fields=testFieldsQuery&depth=10' + def expectedUrl = 'testDmiBasePath/dmi/api/v1/ch/testCmhandle/data/ds' + + '/ncmp-datastore:passthrough-running/testResourceId?fields=testFieldsQuery&depth=10' when: 'get resource data is called to DMI' - objectUnderTest.getResourceDataPassThroughRunningFromDmi('testDmiBasePath', - 'testCmhandle', - 'testResourceId', - 'testFieldsQuery', - 10, - 'testAcceptJson', - 'testJsonbody') + objectUnderTest.getResourceDataPassThroughRunningFromDmi('testDmiBasePath', + 'testCmhandle', + 'testResourceId', + 'testFieldsQuery', + 10, + 'testAcceptJson', + 'testJsonbody') then: 'the put operation is executed with the correct URL' - 1 * mockDmiRestClient.putOperationWithJsonData(expectedUrl, 'testJsonbody', _ as HttpHeaders) + 1 * mockDmiRestClient.putOperationWithJsonData(expectedUrl, 'testJsonbody', _ as HttpHeaders) } def 'call create resource data for pass-through:running datastore from DMI.'() { given: 'expected url' - def expectedUrl = 'testDmiBasePath/dmi/api/v1/ch/testCmhandle/data/ds' + - '/ncmp-datastore:passthrough-running/testResourceId' + def expectedUrl = 'testDmiBasePath/dmi/api/v1/ch/testCmhandle/data/ds' + + '/ncmp-datastore:passthrough-running/testResourceId' when: 'get resource data is called to DMI' - objectUnderTest.createResourceDataPassThroughRunningFromDmi('testDmiBasePath', - 'testCmhandle', - 'testResourceId', - 'testJsonbody') + objectUnderTest.createResourceDataPassThroughRunningFromDmi('testDmiBasePath', + 'testCmhandle', + 'testResourceId', + 'testJsonbody') then: 'the put operation is executed with the correct URL' - 1 * mockDmiRestClient.postOperationWithJsonData(expectedUrl, 'testJsonbody', _ as HttpHeaders) + 1 * mockDmiRestClient.postOperationWithJsonData(expectedUrl, 'testJsonbody', _ as HttpHeaders) + } + + def 'Call get resource from dmi.'() { + given: 'expected url' + def expectedUrl = 'testDmiBasePath/dmi/api/v1/ch/testCmhandle/modules' + when: 'get resource data is called to dmi' + objectUnderTest.getResourceFromDmi('testDmiBasePath', + 'testCmhandle', + 'modules') + then: 'the post operation is executed with the correct URL' + 1 * mockDmiRestClient.postOperation(expectedUrl, _ as HttpHeaders) } } \ No newline at end of file