Replaced includeCmHandlePropertiesInQuery query parameter in search CM handle api by outputDmiProperties
Issue-ID: CPS-2908
Change-Id: I4c26ed66c7fbc2ddb58c0f36b6834d5ddb4c993f
Signed-off-by: shikha0203 <shivani.khare@est.tech>
summary: Query Cm Handles for a requested DMI Service
operationId: searchCmHandles
parameters:
- - name: includeCmHandlePropertiesInQuery
+ - name: outputDmiProperties
in: query
description: Whether to include additional properties in the response.
required: false
* Execute cm handle query search and return a list of cm handle details. Any number of conditions can be applied.
*
* @param cmHandleQueryParameters the cm handle query parameters
- * @param includeCmHandlePropertiesInQuery boolean value to determine the inclusion of additional properties
+ * @param outputDmiProperties boolean value to determine the inclusion of additional properties
* @return collection of cm handles
*/
@Override
public ResponseEntity<List<RestOutputCmHandle>> searchCmHandles(
final CmHandleQueryParameters cmHandleQueryParameters,
- final Boolean includeCmHandlePropertiesInQuery) {
+ final Boolean outputDmiProperties) {
final CmHandleQueryApiParameters cmHandleQueryApiParameters =
deprecationHelper.mapOldConditionProperties(cmHandleQueryParameters);
- final boolean includeCmHandlePropertiesParameter = Boolean.TRUE.equals(includeCmHandlePropertiesInQuery);
+ final boolean outputDmiPropertiesAsPrimitive = Boolean.TRUE.equals(outputDmiProperties);
final List<RestOutputCmHandle> restOutputCmHandles =
networkCmProxyInventoryFacade.southboundCmHandleSearch(cmHandleQueryApiParameters)
.map(handle -> restOutputCmHandleMapper
- .toRestOutputCmHandle(handle, includeCmHandlePropertiesParameter))
+ .toRestOutputCmHandle(handle, outputDmiPropertiesAsPrimitive))
.collectList().block();
return ResponseEntity.ok(restOutputCmHandles);
}
def 'Get a cm handle by DMI service name.'() {
given: 'an endpoint for returning cm handles by dmi service name'
- def postUrl = "$ncmpBasePathV1/ch/searchCmHandles?includeCmHandlePropertiesInQuery=true"
+ def postUrl = "$ncmpBasePathV1/ch/searchCmHandles?outputDmiProperties=true"
String jsonString = TestUtils.getResourceFileContent('cm-handle-search-by-dmi-service.json')
and: 'a cm handle is returned'
def ncmpServiceCmHandle = new NcmpServiceCmHandle(additionalProperties: ['someName': 'my dmi'])
parameters:
- description: Whether to include additional properties in the response.
in: query
- name: includeCmHandlePropertiesInQuery
+ name: outputDmiProperties
required: false
schema:
type: boolean
} ]
}""".formatted(dmiPluginNameSearchValue)
when: 'the search is executed it returns expected CM handles'
- def result = mvc.perform(post("/ncmpInventory/v1/ch/searchCmHandles?includeCmHandlePropertiesInQuery=${includeCmHandleProperties}").contentType(MediaType.APPLICATION_JSON).content(requestBodyWithModuleCondition))
+ def result = mvc.perform(post("/ncmpInventory/v1/ch/searchCmHandles?outputDmiProperties=${outputDmiProperties}").contentType(MediaType.APPLICATION_JSON).content(requestBodyWithModuleCondition))
.andExpect(status().is2xxSuccessful())
.andExpect(jsonPath('$', hasSize(expectedCmHandleReferences.size())))
.andExpect(jsonPath('$[*].cmHandle', containsInAnyOrder(expectedCmHandleReferences.toArray())))
.andReturn()
then: 'the result response only contains additional properties when requested'
- assert result.response.contentAsString.contains('cmHandleProperties') == includeCmHandleProperties
+ assert result.response.contentAsString.contains('cmHandleProperties') == outputDmiProperties
cleanup: 'deregister the CM Handles'
requestBody = '{"dmiPlugin":"'+DMI1_URL+'", "removedCmHandles": ["ch-1", "ch-2"]}'
mvc.perform(post('/ncmpInventory/v1/ch').contentType(MediaType.APPLICATION_JSON).content(requestBody)).andExpect(status().is2xxSuccessful())
where: 'the following parameters are used'
- useCorrectDmiForSearch | includeCmHandleProperties || expectedCmHandleReferences
+ useCorrectDmiForSearch | outputDmiProperties || expectedCmHandleReferences
true | true || ['ch-1', 'ch-2']
true | false || ['ch-1', 'ch-2']
false | false || []
}
},
"url": {
- "raw": "http://{{CPS_HOST}}:{{CPS_PORT}}/ncmpInventory/v1/ch/searchCmHandles?includeAdditionalPropertiesInQuery=true",
+ "raw": "http://{{CPS_HOST}}:{{CPS_PORT}}/ncmpInventory/v1/ch/searchCmHandles?outputDmiProperties=true",
"protocol": "http",
"host": [
"{{CPS_HOST}}"
],
"query": [
{
- "key": "includeAdditionalPropertiesInQuery",
+ "key": "outputDmiProperties",
"value": "true"
},
{