From 1f650618de509e1f16e833ea2a2b95d40647d804 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sat, 23 Sep 2023 10:49:26 +0200 Subject: [PATCH] fix: do a POST (and not a GET) query for TCs checking this operation --- .../Entity/QueryEntities/019_02_01.robot | 2 +- .../Entity/QueryEntities/019_02_02.robot | 2 +- .../Entity/QueryEntities/019_02_03.robot | 2 +- .../Entity/QueryEntities/019_02_04.robot | 2 +- .../Entity/QueryEntities/019_02_05.robot | 2 +- .../ContextInformationConsumption.resource | 52 ++++++++++++++++--- 6 files changed, 49 insertions(+), 13 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_01.robot index 9fa9533e..3d0d9fa0 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_01.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_01.robot @@ -44,7 +44,7 @@ ${entity_type}= https://ngsi-ld-test-suite/context#Building @{entities_ids_to_be_compared}= Create List ${first_entity_id} ${second_entity_id} ${entities_ids_to_be_retrieved}= Catenate SEPARATOR=, ${first_entity_id} ${second_entity_id} ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} - ${response}= Query Entities + ${response}= Query Entities Via POST ... entity_ids=${entities_ids_to_be_retrieved} ... entity_types=${entity_types_to_be_retrieved} Check Response Status Code 200 ${response.status_code} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_02.robot index 9c61a79e..168f397c 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_02.robot @@ -49,7 +49,7 @@ ${parking_entity_type}= https://ngsi-ld-test-suite/context#OffStreetParking Check Response Status Code 201 ${response.status_code} @{entity_types_to_be_compared}= Create List ${vehicle_entity_type} ${parking_entity_type} ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${vehicle_entity_type} ${parking_entity_type} - ${response}= Query Entities entity_types=${entity_types_to_be_retrieved} + ${response}= Query Entities Via POST entity_types=${entity_types_to_be_retrieved} Check Response Status Code 200 ${response.status_code} Check Response Body Containing List Containing Entity elements ... ${expectation_filename} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_03.robot index 86d068e6..3ac26510 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_03.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_03.robot @@ -37,7 +37,7 @@ ${entity_id_pattern}= urn:ngsi-ld:Building:.* Check Response Status Code 201 ${response.status_code} @{entities_ids_to_be_compared}= Create List ${first_entity_id} ${second_entity_id} ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} - ${response}= Query Entities + ${response}= Query Entities Via POST ... entity_id_pattern=${entity_id_pattern} ... entity_types=${entity_types_to_be_retrieved} Check Response Status Code 200 ${response.status_code} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_04.robot index d6e227b8..58a65d1e 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_04.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_04.robot @@ -40,7 +40,7 @@ ${attribute_subcategory}= https://ngsi-ld-test-suite/context#subCatego ... ${attribute_airqualitylevel} ... ${attribute_subcategory} @{entities_ids_to_be_retrieved}= Create List ${first_entity_id} ${second_entity_id} - ${response}= Query Entities attrs=${attributes_to_be_retrieved} + ${response}= Query Entities Via POST attrs=${attributes_to_be_retrieved} Check Response Status Code 200 ${response.status_code} Check Response Body Containing List Containing Entity elements ... ${expectation_filename} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_05.robot index 849a2a13..accbccb2 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_05.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_02_05.robot @@ -37,7 +37,7 @@ ${geometry_property}= location Check Response Status Code 201 ${response.status_code} @{entities_ids_to_be_compared}= Create List ${first_entity_id} ${second_entity_id} @{entity_types_to_be_retrieved}= Create List ${entity_type} - ${response}= Query Entities + ${response}= Query Entities Via POST ... entity_types=${entity_types_to_be_retrieved} ... geoproperty=${geometry_property} Check Response Status Code 200 ${response.status_code} diff --git a/resources/ApiUtils/ContextInformationConsumption.resource b/resources/ApiUtils/ContextInformationConsumption.resource index 442f2929..281890a5 100755 --- a/resources/ApiUtils/ContextInformationConsumption.resource +++ b/resources/ApiUtils/ContextInformationConsumption.resource @@ -7,17 +7,18 @@ Library RequestsLibrary *** Variables *** -${ATTRIBUTES_ENDPOINT_PATH} attributes -${ENTITIES_ENDPOINT_PATH} entities/ -${ENTITIES_TYPES_ENDPOINT_PATH} types +${ATTRIBUTES_ENDPOINT_PATH} attributes +${ENTITIES_ENDPOINT_PATH} entities/ +${ENTITY_OPERATIONS_QUERY_ENDPOINT_PATH} entityOperations/query +${ENTITIES_TYPES_ENDPOINT_PATH} types -${CONTENT_TYPE_LD_JSON} application/ld+json +${CONTENT_TYPE_LD_JSON} application/ld+json -${ERROR_TYPE_BAD_REQUEST_DATA} https://uri.etsi.org/ngsi-ld/errors/BadRequestData -${ERROR_TYPE_INVALID_REQUEST} https://uri.etsi.org/ngsi-ld/errors/InvalidRequest -${ERROR_TYPE_RESOURCE_NOT_FOUND} https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound +${ERROR_TYPE_BAD_REQUEST_DATA} https://uri.etsi.org/ngsi-ld/errors/BadRequestData +${ERROR_TYPE_INVALID_REQUEST} https://uri.etsi.org/ngsi-ld/errors/InvalidRequest +${ERROR_TYPE_RESOURCE_NOT_FOUND} https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound -${response} ${EMPTY} +${response} ${EMPTY} *** Keywords *** @@ -83,6 +84,41 @@ Query Entities Output ${response} Query Entities RETURN ${response} +Query Entities Via POST + [Arguments] + ... ${entity_ids}=${EMPTY} + ... ${entity_types}=${EMPTY} + ... ${content_type}=${CONTENT_TYPE_LD_JSON} + ... ${attrs}=${EMPTY} + ... ${entity_id_pattern}=${EMPTY} + ... ${geoproperty}=${EMPTY} + &{headers}= Create Dictionary + &{params}= Create Dictionary + ${entity_ids_length}= Get Length ${entity_ids} + ${entity_types_length}= Get Length ${entity_types} + ${attrs_length}= Get Length ${attrs} + Set To Dictionary ${headers} Content-Type ${content_type} + IF ${entity_ids_length}>0 + Set To Dictionary ${params} id=${entity_ids} + END + IF ${entity_types_length}>0 + Set To Dictionary ${params} type=${entity_types} + END + IF ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} + IF '${entity_id_pattern}'!='' + Set To Dictionary ${params} idPattern=${entity_id_pattern} + END + IF '${geoproperty}'!='' + Set To Dictionary ${params} geoproperty=${geoproperty} + END + ${response}= POST + ... url=${url}/${ENTITY_OPERATIONS_QUERY_ENDPOINT_PATH} + ... json=${params} + ... headers=${headers} + ... expected_status=any + Output ${response} Query Entities Via POST + RETURN ${response} + Query Entity [Arguments] ... ${id} -- GitLab