diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_01_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_01_04.robot index bc6823c2268b67faf8cb3511568f99e9c78da408..907b16f252f8ace8f8b7cc90abec2a8d78dfd58d 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_01_04.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_01_04.robot @@ -26,10 +26,10 @@ Query several entities based on attribute names Check Response Status Code 201 ${response['status']} ${attributes_to_be_retrieved}= Catenate SEPARATOR=, ${attribute_airqualitylevel} ${attribute_subcategory} - ${entities_ids_to_be_retrieved}= Catenate SEPARATOR=, ${first_entity_id} + @{entities_ids_to_be_compared}= Create List ${first_entity_id} ${response}= Query Entities attrs=${attributes_to_be_retrieved} Check Response Status Code 200 ${response['status']} - Check Response Body Containing List Containing Entity elements ${expectation_filename} ${entities_ids_to_be_retrieved} ${response['body']} + Check Response Body Containing List Containing Entity elements ${expectation_filename} ${entities_ids_to_be_compared} ${response['body']} [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_02_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_02_02.robot index f2aec8601e836eb0d284c3cc45f91ea9368e51e0..f6af3e504d2fd57e5b790fa32c8118c43c1ebb4c 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_02_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_02_02.robot @@ -16,7 +16,6 @@ ${building_entity_type}= https://ngsi-ld-test-suite/context#Building ${vehicle_entity_type}= https://ngsi-ld-test-suite/context#Vehicle ${parking_entity_type}= https://ngsi-ld-test-suite/context#OffStreetParking - *** Test Cases *** Query several entities via POST Interaction based on the entities types [Documentation] Check that you can query several entities via POST Interaction based on the entities types @@ -36,11 +35,9 @@ Query several entities via POST Interaction based on the entities types ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${vehicle_entity_type} ${parking_entity_type} ${response}= Query Entities Via POST entity_types=${entity_types_to_be_retrieved} Check Response Status Code 200 ${response['status']} - @{entities_ids_to_be_retrieved}= Catenate SEPARATOR=, ${building_entity_id} ${vehicle_entity_id} Check Response Body Containing List Containing Entity elements ${expectation_filename} ${entity_types_to_be_compared} ${response['body']} - [Teardown] Delete Entities ${building_entity_id} ${vehicle_entity_id} ${parking_entity_id} - + [Teardown] Delete Entities ${building_entity_id} ${vehicle_entity_id} ${parking_entity_id} *** Keywords *** Delete Entities diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_02_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_02_03.robot index 9b5e746c9a09d561e20d030277b44c8945db87b6..438c15b9bf2853adde403df6e47c8af4f8680fa7 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_02_03.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_02_03.robot @@ -24,15 +24,13 @@ Query several entities via POST Interaction based on the given id pattern Check Response Status Code 201 ${response['status']} @{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}= Create List ${entity_type} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} ${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']} Check Response Body Containing List Containing Entity elements ${expectation_filename} ${entities_ids_to_be_compared} ${response['body']} [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} - *** Keywords *** Delete Entities [Arguments] ${first_entity_id} ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_04.robot index 27d45e27ca3b07b48b5b1e6544268063b943c45b..514da40c9079e8d80e279f573ea21b517d47c8bc 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_04.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_04.robot @@ -28,7 +28,7 @@ Query entities in a simplified representation @{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}= Create List ${entity_type} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} ${response}= Query Entities entity_ids=${entities_ids_to_be_retrieved} entity_types=${entity_types_to_be_retrieved} options=${options_parameter} Check Response Status Code 200 ${response['status']} Check Response Body Containing List Containing Entity elements ${expectation_filename} ${entities_ids_to_be_compared} ${response['body']} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_05.robot index 0a32c62e50a356b2298f4b714404f5fd0f9650e8..a48764cb6f7525e56dd822d884abc52f572b3e5a 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_05.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_05.robot @@ -28,7 +28,7 @@ Get an entity by id that can be returned in a geoJSON format @{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}= Create List ${entity_type} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} ${response}= Query Entities entity_ids=${entities_ids_to_be_retrieved} entity_types=${entity_types_to_be_retrieved} accept=${accept_header} Check Response Status Code 200 ${response['status']} Check Response Body Containing List Containing Entity elements ${expectation_filename} ${entities_ids_to_be_compared} ${response['body']} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_06.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_06.robot index d23a840145552545fd8e87e62d5e27f64cbf1a3f..625df83af74bbc0141e896e606a27179f5fcc497 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_06.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/019_06.robot @@ -27,7 +27,7 @@ Query entities specifying a maximum number of results Check Response Status Code 201 ${response['status']} ${entities_ids_to_be_retrieved}= Catenate SEPARATOR=, ${first_entity_id} ${second_entity_id} ${third_entity_id} - @{entity_types_to_be_retrieved}= Create List ${entity_type} + ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} ${response}= Query Entities entity_ids=${entities_ids_to_be_retrieved} entity_types=${entity_types_to_be_retrieved} limit=${limit} Check Response Status Code 200 ${response['status']} @{entities_ids_to_be_compared}= Create List ${first_entity_id} ${second_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_01.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_01.robot index 759b23ab5b4feb82524f7a095088b8ed68f1d874..2945ae8eae6c75c750a0b7349696b99a6251471d 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_01.robot @@ -4,21 +4,37 @@ Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Test Template Append Attributes - *** Variable *** ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: ${filename}= vehicle-speed-two-datasetid-sample.jsonld -*** Test Cases *** STATUS_CODE OVERWRITE FRAGMENT_FILENAME EXPECTATION_FILENAME -010_01_01_Append entity attributes 204 ${EMPTY} vehicle-attribute-to-add-fragment.jsonld ${EMPTY} -010_01_02_Append entity attributes 207 noOverwrite vehicle-attribute-to-add-fragment.jsonld add-attribute-expectation.jsonld -010_01_03_Append entity attributes 204 ${EMPTY} vehicle-speed-different-datasetid-fragment.jsonld ${EMPTY} -010_01_04_Append entity attributes 204 noOverwrite vehicle-speed-different-datasetid-fragment.jsonld ${EMPTY} +*** Test Cases *** +010_01_01_Append entity attributes + Append Attributes Without Params 204 vehicle-attribute-to-add-fragment.jsonld +010_01_02_Append entity attributes + Append Attributes With Params 207 vehicle-attribute-to-add-fragment.jsonld add-attribute-expectation.jsonld +010_01_03_Append entity attributes + Append Attributes Without Params 204 vehicle-speed-different-datasetid-fragment.jsonld +010_01_04_Append entity attributes + Append Attributes With Params 204 vehicle-speed-different-datasetid-fragment.jsonld ${EMPTY} *** Keywords *** -Append Attributes - [Arguments] ${status_code} ${overwrite} ${fragment_filename} ${expectation_filename} +Append Attributes Without Params + [Arguments] ${status_code} ${fragment_filename} + [Documentation] Check that you can append entity attributes + [Tags] /entities/{entityId}/attrs/ 5_6_3 + + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Append Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${status_code} ${response['status']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} + +Append Attributes With Params + [Arguments] ${status_code} ${fragment_filename} ${expectation_filename} [Documentation] Check that you can append entity attributes [Tags] /entities/{entityId}/attrs/ 5_6_3 @@ -26,7 +42,7 @@ Append Attributes ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Append Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} ${overwrite} + ${response}= Append Entity Attributes With Parameters ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} noOverwrite Check Response Status Code ${status_code} ${response['status']} Run Keyword If "${expectation_filename}"!="${EMPTY}" Check Response Body Content ${expectation_filename} ${response['body']} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_02.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_02.robot index 3564e43f5a8913df8f2ae12448338eff86edda65..67bb6c3426e9bfa78a3b34a48a4013170e65816b 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/010_02.robot @@ -12,10 +12,10 @@ ${status_code}= 400 ${invalid_fragment_filename}= invalid-fragment.jsonld *** Test Cases *** -#010_02_01_Append entity attributes if the entity Id is not present -# Append Attributes ${EMPTY} -#010_02_02_Append entity attributes if the Entity Id is not a valid URI -# Append Attributes thisisaninvaliduri +010_02_01_Append entity attributes if the entity Id is not present + Append Attributes ${EMPTY} +010_02_02_Append entity attributes if the Entity Id is not a valid URI + Append Attributes thisisaninvaliduri 010_02_03_Append entity attributes with invalid entity fragments Append entity attributes with invalid entity fragments diff --git a/data/entities/fragmentEntities/vehicle-speed-equal-datasetid-different-type-fragment.jsonld b/data/entities/fragmentEntities/vehicle-speed-equal-datasetid-different-type-fragment.jsonld index e104e4d043cd3cb391ca2a4a57c69018bbaca132..e865fd84c919b6b926050cde2d9eb35b9dc542f5 100644 --- a/data/entities/fragmentEntities/vehicle-speed-equal-datasetid-different-type-fragment.jsonld +++ b/data/entities/fragmentEntities/vehicle-speed-equal-datasetid-different-type-fragment.jsonld @@ -8,6 +8,7 @@ }, "datasetId": "urn:ngsi-ld:Property:speedometerA4567-speed" }, - "@context": - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.3.jsonld" + "@context": [ + "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld" + ] } \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 74de3e93eaccb5aad36edfb00c130ab2dc523e48..42a29b9bd5a4520a3bdbb3b5e613f31d9151ecaa 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -125,6 +125,15 @@ Create Entity Selecting Content Type [return] ${request} ${response} Append Entity Attributes + [Arguments] ${id} ${fragment_filename} ${content_type} + &{headers}= Create Dictionary Content-Type=${content_type} + ${fragment_payload}= Load Json From File ${EXECDIR}/data/entities/fragmentEntities/${fragment_filename} + ${response}= POST ${ENTITIES_ENDPOINT_PATH}${id}/attrs/ body=${fragment_payload} headers=${headers} + Output request + Output response + [return] ${response} + +Append Entity Attributes With Parameters [Arguments] ${id} ${fragment_filename} ${content_type} ${options} &{headers}= Create Dictionary Content-Type=${content_type} ${fragment_payload}= Load Json From File ${EXECDIR}/data/entities/fragmentEntities/${fragment_filename}