diff options
author | 2024-11-05 10:21:30 +0000 | |
---|---|---|
committer | 2024-11-13 10:52:19 +0000 | |
commit | c37dee4816f51f750a9c92946dc9d4a558f3b812 (patch) | |
tree | d54dba7ce7c024c6be1a347190b14c8a2aecb092 /cps-ncmp-rest/src/test | |
parent | 38cea5882ab71f23eddd3ffc9fd56c5d6540f28e (diff) |
Support alternate Id interface for ncmp inventory /ch/cmhandles endpoint
Issue-ID: CPS-2481
Change-Id: I8a200495be1afb9a4f256127f886bed78c77f653
Signed-off-by: seanbeirne <sean.beirne@est.tech>
Diffstat (limited to 'cps-ncmp-rest/src/test')
-rw-r--r-- | cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy index 74e6759f72..59307640ef 100644 --- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy +++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy @@ -234,12 +234,14 @@ class NetworkCmProxyInventoryControllerSpec extends Specification { 'delete upgrade failed' | expectedSuccessResponse('cm-handle-1') | expectedSuccessResponse('cm-handle-2') | expectedFailedResponse('cm-handle-3') | expectedFailedResponse('cm-handle-4') || [] | [] | [expectedUnknownErrorResponse('cm-handle-3')] | [expectedUnknownErrorResponse('cm-handle-4')] } - def 'Get all cm handle IDs by DMI plugin identifier.'() { - given: 'an endpoint for returning cm handle IDs for a registered dmi plugin' - def getUrl = "$ncmpBasePathV1/ch/cmHandles?dmi-plugin-identifier=some-dmi-plugin-identifier" - and: 'a collection of cm handle IDs are returned' - 1 * mockNetworkCmProxyInventoryFacade.getAllCmHandleIdsByDmiPluginIdentifier('some-dmi-plugin-identifier') + def 'Get all cm handle references by DMI plugin identifier when #scenario.'() { + given: 'an endpoint for returning cm handle references for a registered dmi plugin' + def getUrl = "$ncmpBasePathV1/ch/cmHandles?dmi-plugin-identifier=some-dmi-plugin-identifier"+outputAlternateId + and: 'a collection of cm handle references are returned' + mockNetworkCmProxyInventoryFacade.getAllCmHandleReferencesByDmiPluginIdentifier('some-dmi-plugin-identifier', false) >> ['cm-handle-id-1','cm-handle-id-2'] + mockNetworkCmProxyInventoryFacade.getAllCmHandleReferencesByDmiPluginIdentifier('some-dmi-plugin-identifier', true) + >> ['alternate-id-1','alternate-id-2'] when: 'the endpoint is invoked' def response = mvc.perform( get(getUrl) @@ -247,8 +249,12 @@ class NetworkCmProxyInventoryControllerSpec extends Specification { .accept(MediaType.APPLICATION_JSON_VALUE) ).andReturn().response then: 'the response matches the result returned by the service layer' - assert response.contentAsString.contains('cm-handle-id-1') - assert response.contentAsString.contains('cm-handle-id-2') + assert response.contentAsString.contains(firstReference) + assert response.contentAsString.contains(secondReference) + where: + scenario | outputAlternateId || firstReference | secondReference + 'output returns cm handle ids' | '' || 'cm-handle-id-1' | 'cm-handle-id-2' + 'output returns alternate ids' | '&outputAlternateId=true' || 'alternate-id-1' | 'alternate-id-2' } def expectedUnknownErrorResponse(cmHandle) { |