X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps-ncmp-rest%2Fsrc%2Ftest%2Fgroovy%2Forg%2Fonap%2Fcps%2Fncmp%2Frest%2Fcontroller%2FNetworkCmProxyControllerSpec.groovy;h=613243e28bac6d31c140245ae2b3c47ced91e867;hb=c309f24909510ebd11737efc3eadb055c91e304e;hp=73ccd6e3c2b759feac22fa294d6807723a4a9c4e;hpb=d0422226b45f752086c9920bdead753c644d9289;p=cps.git diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy index 73ccd6e3c..613243e28 100644 --- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy +++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyControllerSpec.groovy @@ -22,6 +22,8 @@ package org.onap.cps.ncmp.rest.controller +import org.onap.cps.spi.model.ModuleReference + import static org.onap.cps.spi.FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS import static org.onap.cps.spi.FetchDescendantsOption.OMIT_DESCENDANTS import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get @@ -246,5 +248,19 @@ class NetworkCmProxyControllerSpec extends Specification { and: 'resource is created' response.status == HttpStatus.CREATED.value() } + + def 'Get module references for the given dataspace and cm handle.' () { + given: 'get module references url' + def getUrl = "$ncmpBasePathV1/ch/some-cmhandle/modules" + when: 'get module resource request is performed' + def response =mvc.perform(get(getUrl)).andReturn().response + then: 'ncmp service method to get yang resource module references is called' + mockNetworkCmProxyDataService.getYangResourcesModuleReferences('some-cmhandle') + >> [new ModuleReference(moduleName: 'some-name1',revision: 'some-revision1')] + and: 'response contains an array with the module name and revision' + response.getContentAsString() == '[{"moduleName":"some-name1","revision":"some-revision1"}]' + and: 'response returns an OK http code' + response.status == HttpStatus.OK.value() + } }