diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..f6aeac9cb7e01b257ee1bb9eeaca3c4fca483b9c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot @@ -0,0 +1,25 @@ +*** Settings *** +Documentation Check that you can get an entity by id +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.jsonld +${expectation_filename}= building-simple-attributes-sample-expectation.jsonld + +*** Test Cases *** +001_01_Get an entity by id + [Documentation] Check that you can get an entity by id + [Tags] mandatory + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 200 ${response['status']} + Check Response Body Containing Entity element ${expectation_filename} ${entity_id} ${response['body']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..8b97f07328ffa56bc936426d1056b0b44bcd337b --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot @@ -0,0 +1,28 @@ +*** Settings *** +Documentation Check that you can query some attributes from an entity +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.jsonld +${expectation_filename}= building-simple-attributes-sample-expectation-query-attributes.jsonld +${attribute_airqualitylevel}= https://uri.fiware.org/ns/data-models#airQualityLevel +${attribute_subcategory}= https://uri.fiware.org/ns/data-models#subCategory + +*** Test Cases *** +001_02_Query some attributes from an entity + [Documentation] Check that you can query some attributes from an entity + [Tags] mandatory + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${attributes_to_be_retrieved}= Create List ${attribute_airqualitylevel} ${attribute_subcategory} + ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} attrs=${attributes_to_be_retrieved} + Check Response Status Code 200 ${response['status']} + Check Response Body Containing Entity element ${expectation_filename} ${entity_id} ${response['body']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..76f6b0ed60b47e4fdf161787d61f7b7c4a491a4e --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot @@ -0,0 +1,26 @@ +*** Settings *** +Documentation Check that you can query the geometry property from an entity +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-location-attribute-sample.jsonld +${expectation_filename}= building-location-attribute-sample-expectation-query-geoproperty.jsonld +${geometry_property}= location + +*** Test Cases *** +001_03_Query the geometry property from an entity + [Documentation] Check that you can query the geometry property from an entity + [Tags] mandatory + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} geoproperty=${geometry_property} + Check Response Status Code 200 ${response['status']} + Check Response Body Containing Entity element ${expectation_filename} ${entity_id} ${response['body']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot new file mode 100644 index 0000000000000000000000000000000000000000..282a9b0048b1bcf117556ce2a67bc5f316051185 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot @@ -0,0 +1,21 @@ +*** Settings *** +Documentation Check that you cannot get an entity with invalid/missing id +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Get Entity With Invalid/Missing Id + +*** Test Cases *** ENTITY_ID EXPECTED_STATUS_CODE PROBLEM_TYPE +002_01_Get an entity if the Entity Id is not present ${EMPTY} 400 ${ERROR_TYPE_BAD_REQUEST_DATA} +002_02_Get an entity if the Entity Id is not a valid URI thisisaninvaliduri 400 ${ERROR_TYPE_BAD_REQUEST_DATA} + +*** Keywords *** +Get Entity With Invalid/Missing Id + [Arguments] ${entity_id} ${expected_status_code} ${problem_type} + [Documentation] Check that you cannot get an entity with invalid/missing id + [Tags] mandatory failing + + ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code ${expected_status_code} ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${problem_type} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/003_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/003_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..59647fef4cf26b998c2510fa6341e984391e601e --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/003_01.robot @@ -0,0 +1,19 @@ +*** Settings *** +Documentation Check that you cannot get an entity if the entity id is not known to the system +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: + +*** Test Cases *** +003_01_Get an entity if the Entity Id is not known to the system + [Documentation] Check that you cannot get an entity if the entity id or attributes are not known to the system + [Tags] mandatory failing + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 404 ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/003_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/003_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..fd207890acf451ce76e1f8b2c1d2d5ecee748961 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/003_02.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Check that you cannot get an entity if an attribute is not known to the system +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.jsonld +${attribute_not_known}= property_not_found + +*** Test Cases *** +003_02_Get an entity if an atris not known to the system + [Documentation] Check that you cannot get an entity if an attribute is not known to the system + [Tags] mandatory failing + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${attributes_to_be_retrieved}= Create List ${attribute_not_known} + ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} attrs=${attributes_to_be_retrieved} + Check Response Status Code 404 ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_RESOURCE_NOT_FOUND} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot new file mode 100644 index 0000000000000000000000000000000000000000..b74f19dd0ffc9e3a0d1d09658e5ec5a50471aa45 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot @@ -0,0 +1,26 @@ +*** Settings *** +Documentation Check that the queried entity by Id can be returned in a simplified representation +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.jsonld +${expectation_filename}= building-simple-attributes-sample-expectation-simplified.jsonld +${options_parameter}= keyValues + +*** Test Cases *** +004_Get an entity in a simplified representation + [Documentation] Check that the queried entity by Id can be returned in a simplified representation + [Tags] mandatory failing + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} options=${options_parameter} + Check Response Status Code 200 ${response['status']} + Check Response Body Containing Entity element ${expectation_filename} ${entity_id} ${response['body']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/005.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/005.robot new file mode 100644 index 0000000000000000000000000000000000000000..c81cc37a8c0ecf0bbdba9612aec28112a7ca9c3e --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/005.robot @@ -0,0 +1,27 @@ +*** Settings *** +Documentation Check that the queried entity by id can be returned in a geoJSON format +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-location-attribute-sample.jsonld +${expectation_filename}= building-simple-attributes-sample-expectation-simplified.jsonld +${options_parameter}= keyValues +${accept_header}= application/geo+json + +*** Test Cases *** +005_Get an entity by id that can be returned in a geoJSON format + [Documentation] Check that the queried entity by id can be returned in a geoJSON format + [Tags] mandatory failing + + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + ${response}= Query Entity ${entity_id} ${accept_header} options=${options_parameter} + Check Response Status Code 200 ${response['status']} + Check Response Body Containing Entity element ${expectation_filename} ${entity_id} ${response} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..441ef1ebe5ece6cf5e95c39d9d395cc2ed240c6b --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_01.robot @@ -0,0 +1,42 @@ +*** Settings *** +Documentation Check that you can query several entities based on ids +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${expectation_filename}= building-minimal-sample-expectation.jsonld +${entity_type}= https://uri.fiware.org/ns/data-models#Building + +*** Test Cases *** +006_01_Query several entities based on ids + [Documentation] Check that you can query several entities based on ids + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${third_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${third_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entities_ids_to_be_retrieved}= Create List ${first_entity_id} ${second_entity_id} + @{entity_types_to_be_retrieved}= Create List ${entity_type} + ${response}= Query Entities entity_ids=${entities_ids_to_be_retrieved} 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_retrieved} ${response['body']} + + [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} ${third_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} ${third_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} + Delete Entity by Id Returning Response ${third_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..be7e684a52cc72a63b54602ac1c3709b3125d834 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_02.robot @@ -0,0 +1,49 @@ +*** Settings *** +Documentation Check that you can query several entities based on the entities types +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${parking_id_prefix}= urn:ngsi-ld:OffStreetParking: +${building_filename}= building-minimal-sample.jsonld +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld +${parking_filename}= parking-simple-attributes-sample.jsonld +${expectation_filename}= vehicle-parking-sample-expectation.jsonld +${building_entity_type}= https://uri.fiware.org/ns/data-models#Building +${vehicle_entity_type}= https://uri.fiware.org/ns/data-models#Vehicle +${parking_entity_type}= https://uri.fiware.org/ns/data-models#OffStreetParking + + +*** Test Cases *** +006_02_Query several entities based on the entities types + [Documentation] Check that you can query several entities based on the entities types + [Tags] mandatory failing + + ${building_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${building_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${vehicle_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${vehicle_filename} ${vehicle_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${parking_entity_id}= Generate Random Entity Id ${parking_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${parking_filename} ${parking_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entity_types_to_be_retrieved}= Create List ${vehicle_entity_type} ${parking_entity_type} + ${response}= Query Entities entity_types=${entity_types_to_be_retrieved} + Check Response Status Code 200 ${response['status']} + @{entities_ids_to_be_retrieved}= Create List ${vehicle_entity_id} ${parking_entity_id} + Check Response Body Containing List Containing Entity elements ${expectation_filename} ${entities_ids_to_be_retrieved} ${response['body']} + + [Teardown] Delete Entities ${building_entity_id} ${vehicle_entity_id} ${parking_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${building_entity_id} ${vehicle_entity_id} ${parking_entity_id} + Delete Entity by Id Returning Response ${building_entity_id} + Delete Entity by Id Returning Response ${vehicle_entity_id} + Delete Entity by Id Returning Response ${parking_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..7f1ef6db68cd004a5330c272b72a742ef3a26e9d --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_03.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Check that you can query several entities based on the given id pattern +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${expectation_filename}= building-minimal-sample-expectation.jsonld +${entity_type}= https://uri.fiware.org/ns/data-models#Building +${entity_id_pattern}= urn:ngsi-ld:Building:.* + +*** Test Cases *** +006_03_Query several entities based on the given id pattern + [Documentation] Check that you can query several entities based on the given id pattern + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entities_ids_to_be_retrieved}= Create List ${first_entity_id} ${second_entity_id} + @{entity_types_to_be_retrieved}= Create List ${entity_type} + ${response}= Query Entities 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_retrieved} ${response['body']} + + [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..18f59109831326288c4eef5cf5803b88467a4a13 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_04.robot @@ -0,0 +1,40 @@ +*** Settings *** +Documentation Check that you can query several entities based on attribute names +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${expectation_filename}= building-minimal-sample-expectation.jsonld +${entity_type}= https://uri.fiware.org/ns/data-models#Building +${attribute_airqualitylevel}= https://uri.fiware.org/ns/data-models#airQualityLevel +${attribute_subcategory}= https://uri.fiware.org/ns/data-models#subCategory + +*** Test Cases *** +006_04_Query several entities based on attribute names + [Documentation] Check that you can query several entities based on attribute names + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{attributes_to_be_retrieved}= Create List ${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} + Check Response Status Code 200 ${response['status']} + Check Response Body Containing List Containing Entity elements ${expectation_filename} ${entities_ids_to_be_retrieved} ${response['body']} + + [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..f4c4ac63f947548fe04c753a72573e328366a87f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_05.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Check that you can query entitites based on a list of properties +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${expectation_filename}= building-minimal-sample-expectation.jsonld +${entity_type}= https://uri.fiware.org/ns/data-models#Building +${geometry_property}= location + +*** Test Cases *** +006_05_Query several entities based on a list of properties + [Documentation] Check that you can query entitites based on a list of properties + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entities_ids_to_be_retrieved}= Create List ${first_entity_id} ${second_entity_id} + @{entity_types_to_be_retrieved}= Create List ${entity_type} + ${response}= Query Entities entity_types=${entity_types_to_be_retrieved} geoproperty=${geometry_property} + Check Response Status Code 200 ${response['status']} + Check Response Body Containing List Containing Entity elements ${expectation_filename} ${entities_ids_to_be_retrieved} ${response['body']} + + [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..b18df22bd305f8889124ca69f4abda59134adcc3 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_01.robot @@ -0,0 +1,42 @@ +*** Settings *** +Documentation Check that you can query several entities via POST Interaction based on ids +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${expectation_filename}= building-minimal-sample-expectation.jsonld +${entity_type}= https://uri.fiware.org/ns/data-models#Building + +*** Test Cases *** +007_01_Query several entities via POST Interaction based on ids + [Documentation] Check that you can query several entities via POST Interaction based on ids + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${third_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${third_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entities_ids_to_be_retrieved}= Create List ${first_entity_id} ${second_entity_id} + @{entity_types_to_be_retrieved}= Create List ${entity_type} + ${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']} + Check Response Body Containing List Containing Entity elements ${expectation_filename} ${entities_ids_to_be_retrieved} ${response['body']} + + [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} ${third_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} ${third_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} + Delete Entity by Id Returning Response ${third_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..6f404862be6ab4ae121afbc0b387f87080687d68 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_02.robot @@ -0,0 +1,49 @@ +*** Settings *** +Documentation Check that you can query several entities via POST Interaction based on the entities types +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${parking_id_prefix}= urn:ngsi-ld:OffStreetParking: +${building_filename}= building-minimal-sample.jsonld +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld +${parking_filename}= parking-simple-attributes-sample.jsonld +${expectation_filename}= vehicle-parking-sample-expectation.jsonld +${building_entity_type}= https://uri.fiware.org/ns/data-models#Building +${vehicle_entity_type}= https://uri.fiware.org/ns/data-models#Vehicle +${parking_entity_type}= https://uri.fiware.org/ns/data-models#OffStreetParking + + +*** Test Cases *** +007_02_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 + [Tags] mandatory failing + + ${building_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${building_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${vehicle_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${vehicle_filename} ${vehicle_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${parking_entity_id}= Generate Random Entity Id ${parking_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${parking_filename} ${parking_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entity_types_to_be_retrieved}= Create List ${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}= Create List ${building_entity_id} ${vehicle_entity_id} + Check Response Body Containing List Containing Entity elements ${expectation_filename} ${entities_ids_to_be_retrieved} ${response['body']} + + [Teardown] Delete Entities ${building_entity_id} ${vehicle_entity_id} ${parking_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${building_entity_id} ${vehicle_entity_id} ${parking_entity_id} + Delete Entity by Id Returning Response ${building_entity_id} + Delete Entity by Id Returning Response ${vehicle_entity_id} + Delete Entity by Id Returning Response ${parking_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..fa7d2d6641985b98aa4d68d85ce138f19c2ed00c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_03.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Check that you can query several entities via POST Interaction based on the given id pattern +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${expectation_filename}= building-minimal-sample-expectation.jsonld +${entity_type}= https://uri.fiware.org/ns/data-models#Building +${entity_id_pattern}= urn:ngsi-ld:Building:.* + +*** Test Cases *** +007_03_Query several entities via POST Interaction based on the given id pattern + [Documentation] Check that you can query several entities via POST Interaction based on the given id pattern + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entities_ids_to_be_retrieved}= Create List ${first_entity_id} ${second_entity_id} + @{entity_types_to_be_retrieved}= Create List ${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_retrieved} ${response['body']} + + [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..60e03ddae93594bd792b180108e8de9cac178679 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_04.robot @@ -0,0 +1,40 @@ +*** Settings *** +Documentation Check that you can query several entities via POST Interaction based on attribute names +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${expectation_filename}= building-minimal-sample-expectation.jsonld +${entity_type}= https://uri.fiware.org/ns/data-models#Building +${attribute_airqualitylevel}= https://uri.fiware.org/ns/data-models#airQualityLevel +${attribute_subcategory}= https://uri.fiware.org/ns/data-models#subCategory + +*** Test Cases *** +006_04_Query several entities via POST Interaction based on attribute names + [Documentation] Check that you can query several entities via POST Interaction based on attribute names + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{attributes_to_be_retrieved}= Create List ${attribute_airqualitylevel} ${attribute_subcategory} + @{entities_ids_to_be_retrieved}= Create List ${first_entity_id} ${second_entity_id} + ${response}= Query Entities Via POST 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']} + + [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..a7ec401affcdc9333923b880b7b481ac65c67ae7 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_05.robot @@ -0,0 +1,39 @@ +*** Settings *** +Documentation Check that you can query entitites via POST Interaction based on a list of properties +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${expectation_filename}= building-minimal-sample-expectation.jsonld +${entity_type}= https://uri.fiware.org/ns/data-models#Building +${geometry_property}= location + +*** Test Cases *** +006_05_Query several entities via POST Interaction based on a list of properties + [Documentation] Check that you can query entitites via POST Interaction based on a list of properties + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entities_ids_to_be_retrieved}= Create List ${first_entity_id} ${second_entity_id} + @{entity_types_to_be_retrieved}= Create List ${entity_type} + ${response}= Query Entities Via POST entity_types=${entity_types_to_be_retrieved} geoproperty=${geometry_property} + Check Response Status Code 200 ${response['status']} + Check Response Body Containing List Containing Entity elements ${expectation_filename} ${entities_ids_to_be_retrieved} ${response['body']} + + [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_01.robot new file mode 100644 index 0000000000000000000000000000000000000000..569d2723190283ba903cb4517a49ea30de246595 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_01.robot @@ -0,0 +1,40 @@ +*** Settings *** +Documentation Check that you cannot query entities if the requested ids are incorrect +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${entity_type}= https://uri.fiware.org/ns/data-models#Building +${entity_invalid_id_one}= thisisaninvaliduri1 +${entity_invalid_id_two}= thisisaninvaliduri2 + +*** Test Cases *** +008_01_Query entities based on incorrect ids + [Documentation] Check that you cannot query entities if the requested ids are incorrect + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entities_ids_to_be_retrieved}= Create List ${entity_invalid_id_one} ${entity_invalid_id_two} + @{entity_types_to_be_retrieved}= Create List ${entity_type} + ${response}= Query Entities entity_ids=${entities_ids_to_be_retrieved} entity_types=${entity_types_to_be_retrieved} + Check Response Status Code 400 ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_02.robot new file mode 100644 index 0000000000000000000000000000000000000000..c598a04d47b054795ae23b9859e724e48b115478 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_02.robot @@ -0,0 +1,41 @@ +*** Settings *** +Documentation Check that you cannot query entities if the requested entity types are incorrect +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${building_filename}= building-minimal-sample.jsonld +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld +${invalid_entity_type_one}= invalid_entity_type_one +${invalid_entity_type_two}= invalid_entity_type_two + + +*** Test Cases *** +008_02_Query entities based on incorrect entity types + [Documentation] Check that you cannot query entities if the requested entity types are incorrect + [Tags] mandatory failing + + ${building_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${building_filename} ${building_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${vehicle_entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${vehicle_filename} ${vehicle_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entity_types_to_be_retrieved}= Create List ${invalid_entity_type_one} ${invalid_entity_type_two} + ${response}= Query Entities entity_types=${entity_types_to_be_retrieved} + Check Response Status Code 400 ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Entities ${building_entity_id} ${vehicle_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${building_entity_id} ${vehicle_entity_id} + Delete Entity by Id Returning Response ${building_entity_id} + Delete Entity by Id Returning Response ${vehicle_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_03.robot new file mode 100644 index 0000000000000000000000000000000000000000..999e6a451a6394ee2a61009f863c206f31c9edf2 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_03.robot @@ -0,0 +1,38 @@ +*** Settings *** +Documentation Check that you cannot query entities if the requested id pattern is incorrect +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${entity_type}= https://uri.fiware.org/ns/data-models#Building +${invalid_entity_id_pattern}= invalid_entity_id_pattern* + +*** Test Cases *** +008_03_Query several entities based on incorrect id pattern + [Documentation] Check that you cannot query entities if the requested id pattern is incorrect + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entity_types_to_be_retrieved}= Create List ${entity_type} + ${response}= Query Entities entity_id_pattern=${invalid_entity_id_pattern} entity_types=${entity_types_to_be_retrieved} + Check Response Status Code 400 ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..86368ca96f9a5b8f2cb29a0ec3c158f01c3e5087 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_04.robot @@ -0,0 +1,40 @@ +*** Settings *** +Documentation Check that you cannot query entities if the requested attribute names are incorrect +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${entity_type}= https://uri.fiware.org/ns/data-models#Building +${invalid_attribute_one}= invalid_attribute_one +${invalid_attribute_two}= invalid_attribute_two + +*** Test Cases *** +008_04_Query several entities based on incorrect attribute names + [Documentation] Check that you cannot query entities if the requested attribute names are incorrect + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{attributes_to_be_retrieved}= Create List ${invalid_attribute_one} ${invalid_attribute_two} + @{entities_ids_to_be_retrieved}= Create List ${first_entity_id} ${second_entity_id} + ${response}= Query Entities attrs=${attributes_to_be_retrieved} + Check Response Status Code 400 ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_05.robot new file mode 100644 index 0000000000000000000000000000000000000000..b29b3ffcd53456910f2db5155347d53822be4954 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/008_05.robot @@ -0,0 +1,38 @@ +*** Settings *** +Documentation Check that you can query entitites based on a list of properties +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${entity_type}= https://uri.fiware.org/ns/data-models#Building +${invalid_geometry_property}= invalid_geometry_property + +*** Test Cases *** +008_05_Query several entities based on a list of properties + [Documentation] Check that you can query entitites based on a list of properties + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entity_types_to_be_retrieved}= Create List ${entity_type} + ${response}= Query Entities entity_types=${entity_types_to_be_retrieved} geoproperty=${invalid_geometry_property} + Check Response Status Code 400 ${response['status']} + Check Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response} + + [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/009.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/009.robot new file mode 100644 index 0000000000000000000000000000000000000000..a5ec04bd2ef07f338293272056c6a32723a95ab5 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/009.robot @@ -0,0 +1,44 @@ +*** Settings *** +Documentation Check that the queried entities by Id can be returned in a simplified representation +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-simple-attributes-sample.jsonld +${expectation_filename}= building-simple-attributes-sample-expectation-simplified.jsonld +${options_parameter}= keyValues +${entity_type}= https://uri.fiware.org/ns/data-models#Building + +*** Test Cases *** +009_Query entities in a simplified representation + [Documentation] Check that the queried entities by Id can be returned in a simplified representation + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${third_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${third_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + + @{entities_ids_to_be_retrieved}= Create List ${first_entity_id} ${second_entity_id} + @{entity_types_to_be_retrieved}= Create List ${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_retrieved} ${response['body']} + + [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} ${third_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} ${third_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} + Delete Entity by Id Returning Response ${third_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/010.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/010.robot new file mode 100644 index 0000000000000000000000000000000000000000..c9df1913823c992f8ddef7f26b49d09e97d3a753 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/010.robot @@ -0,0 +1,43 @@ +*** Settings *** +Documentation Check that the queried entities by id can be returned in a geoJSON format +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-location-attribute-sample.jsonld +${expectation_filename}= building-simple-attributes-sample-expectation-simplified.jsonld +${entity_type}= https://uri.fiware.org/ns/data-models#Building +${accept_header}= application/geo+json + +*** Test Cases *** +010_Get an entity by id that can be returned in a geoJSON format + [Documentation] Check that the queried entities by id can be returned in a geoJSON format + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${third_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${third_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entities_ids_to_be_retrieved}= Create List ${first_entity_id} ${second_entity_id} + @{entity_types_to_be_retrieved}= Create List ${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_retrieved} ${response['body']} + + [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} ${third_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} ${third_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} + Delete Entity by Id Returning Response ${third_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/011.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/011.robot new file mode 100644 index 0000000000000000000000000000000000000000..0c84970a00d5b92c6102028c74913c4f1644e134 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/011.robot @@ -0,0 +1,44 @@ +*** Settings *** +Documentation Check that you can query entities specifying a maximum number of results +Resource ${EXECDIR}/resources/ApiUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +*** Variable *** +${building_id_prefix}= urn:ngsi-ld:Building: +${filename}= building-minimal-sample.jsonld +${expectation_filename}= building-minimal-sample-expectation.jsonld +${entity_type}= https://uri.fiware.org/ns/data-models#Building +${limit}= 2 + +*** Test Cases *** +011_Query entities specifying a maximum number of results + [Documentation] Check that you can query entities specifying a maximum number of results + [Tags] mandatory failing + + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${first_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${second_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + ${third_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${third_entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response['status']} + + @{entities_ids_to_be_retrieved}= Create List ${first_entity_id} ${second_entity_id} ${third_entity_id} + @{entity_types_to_be_retrieved}= Create List ${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} + 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} ${third_entity_id} + + +*** Keywords *** +Delete Entities + [Arguments] ${first_entity_id} ${second_entity_id} ${third_entity_id} + Delete Entity by Id Returning Response ${first_entity_id} + Delete Entity by Id Returning Response ${second_entity_id} + Delete Entity by Id Returning Response ${third_entity_id} \ No newline at end of file diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot index bf0050cceaa252870f563e3d99270ee030cb69eb..1357d60d933106e56e8448b3a6818d4e8e0848a7 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot @@ -6,7 +6,6 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: -${expected_error_message}= Already exists. ${filename}= building-minimal-sample.jsonld ${content_type}= application/ld+json diff --git a/data/entities/building-location-attribute-sample.jsonld b/data/entities/building-location-attribute-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..ffb69e9230ed6390c45fe2beffa7a1a739c256eb --- /dev/null +++ b/data/entities/building-location-attribute-sample.jsonld @@ -0,0 +1,23 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "subCategory": { + "type": "Property", + "value": ["tourism"] + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [13.3986, 52.5547] + } + }, + "@context": [ + "https://fiware.github.io/data-models/context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/building-location-attribute-sample-expectation-query-geoproperty.jsonld b/data/entities/expectations/building-location-attribute-sample-expectation-query-geoproperty.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..d023d0395e2613642e01b61049bfe47e089fe10f --- /dev/null +++ b/data/entities/expectations/building-location-attribute-sample-expectation-query-geoproperty.jsonld @@ -0,0 +1,25 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "https://uri.fiware.org/ns/data-models#Building", + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 13.3986, + 52.5547 + ] + } + }, + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "https://uri.fiware.org/ns/data-models#subCategory": { + "type": "Property", + "value": "tourism" + }, + "@context": [ + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/building-location-attribute-sample-expectation.jsonld b/data/entities/expectations/building-location-attribute-sample-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..8e67b86efdafad190ef54501f4cc3cc771255f15 --- /dev/null +++ b/data/entities/expectations/building-location-attribute-sample-expectation.jsonld @@ -0,0 +1,22 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "https://uri.fiware.org/ns/data-models#Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "https://uri.fiware.org/ns/data-models#subCategory": { + "type": "Property", + "value": ["tourism"] + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [13.3986, 52.5547] + } + }, + "@context": [ + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/building-minimal-sample-expectation.jsonld b/data/entities/expectations/building-minimal-sample-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..266cb229f5eb35eff02d14c8c9e34f72a9fdab0a --- /dev/null +++ b/data/entities/expectations/building-minimal-sample-expectation.jsonld @@ -0,0 +1,7 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "https://uri.fiware.org/ns/data-models#Building", + "@context": [ + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld b/data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..7a2623f678b7691718ae39afe1a5561da16e9b1e --- /dev/null +++ b/data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld @@ -0,0 +1,17 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "https://uri.fiware.org/ns/data-models#Building", + "https://uri.fiware.org/ns/data-models#airQualityLevel": { + "type": "Property", + "value": 4, + "observedAt": "2020-09-09T16:40:00.000Z", + "unitCode": "C62" + }, + "https://uri.fiware.org/ns/data-models#subCategory": { + "type": "Property", + "value": "tourism" + }, + "@context": [ + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/building-simple-attributes-sample-expectation-simplified.jsonld b/data/entities/expectations/building-simple-attributes-sample-expectation-simplified.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..e4abf08e07c060435f155a83c0ec94ee59322e34 --- /dev/null +++ b/data/entities/expectations/building-simple-attributes-sample-expectation-simplified.jsonld @@ -0,0 +1,11 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "https://uri.fiware.org/ns/data-models#Building", + "name": "Eiffel Tower", + "https://uri.fiware.org/ns/data-models#airQualityLevel": 4, + "https://uri.fiware.org/ns/data-models#almostFull": false, + "https://uri.fiware.org/ns/data-models#subCategory": "tourism", + "@context": [ + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/building-simple-attributes-sample-expectation.jsonld b/data/entities/expectations/building-simple-attributes-sample-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..74d575bfa7ae1b9a3493dbfd140d965550312edd --- /dev/null +++ b/data/entities/expectations/building-simple-attributes-sample-expectation.jsonld @@ -0,0 +1,25 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "https://uri.fiware.org/ns/data-models#Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "https://uri.fiware.org/ns/data-models#airQualityLevel": { + "type": "Property", + "value": 4, + "observedAt": "2020-09-09T16:40:00.000Z", + "unitCode": "C62" + }, + "https://uri.fiware.org/ns/data-models#almostFull": { + "type": "Property", + "value": false + }, + "https://uri.fiware.org/ns/data-models#subCategory": { + "type": "Property", + "value": "tourism" + }, + "@context": [ + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/vehicle-parking-sample-expectation.jsonld b/data/entities/expectations/vehicle-parking-sample-expectation.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/data/entities/parking-simple-attributes-sample.jsonld b/data/entities/parking-simple-attributes-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..841177ea1c1f5ea316c9d66af33042e2b4b9e730 --- /dev/null +++ b/data/entities/parking-simple-attributes-sample.jsonld @@ -0,0 +1,36 @@ +{ + "id": "urn:ngsi-ld:OffStreetParking:randomUUID", + "type": "OffStreetParking", + "name": { + "type": "Property", + "value": "Downtown One" + }, + "availableSpotNumber": { + "type": "Property", + "value": 121, + "observedAt": "2017-07-29T12:05:02Z", + "reliability": { + "type": "Property", + "value": 0.7 + }, + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Camera:C1" + } + }, + "totalSpotNumber": { + "type": "Property", + "value": 200 + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [-8.5, 41.2] + } + }, + "@context": [ + "https://fiware.github.io/data-models/context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] + } \ No newline at end of file diff --git a/data/entities/vehicle-simple-attributes-sample.jsonld b/data/entities/vehicle-simple-attributes-sample.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..2da4522d2847dac9ec1161c93f1626f14b9a897f --- /dev/null +++ b/data/entities/vehicle-simple-attributes-sample.jsonld @@ -0,0 +1,21 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "brandName": { + "type": "Property", + "value": "Mercedes" + }, + "isParked": { + "type": "Relationship", + "object": "urn:ngsi-ld:OffStreetParking:Downtown1", + "observedAt": "2017-07-29T12:00:04Z", + "providedBy": { + "type": "Relationship", + "object": "urn:ngsi-ld:Person:Bob" + } + }, + "@context": [ + "https://fiware.github.io/data-models/context.jsonld", + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] +} \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource old mode 100644 new mode 100755 index cf0f717f7e8ea9d8417418bd0d8ddde653d4fc15..3d6b1e94ef85ff82d4fc632afd8229483da610a9 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -13,6 +13,7 @@ ${BATCH_UPDATE_ENDPOINT_PATH} entityOperations/update ${BATCH_DELETE_ENDPOINT_PATH} entityOperations/delete &{BATCH_OPERATION_ENDPOINT_MAPPING} create=${BATCH_CREATE_ENDPOINT_PATH} upsert=${BATCH_UPSERT_ENDPOINT_PATH} update=${BATCH_UPDATE_ENDPOINT_PATH} delete=${BATCH_DELETE_ENDPOINT_PATH} ${ENTITIES_ENDPOINT_PATH} entities/ +${ENTITY_OPERATIONS_QUERY_ENDPOINT_PATH} entityOperations/query ${TEMPORAL_ENTITIES_ENDPOINT_PATH} temporal/entities ${TEMPORAL_ENTITY_OPERATIONS_ENDPOINT_PATH} temporal/entityOperations @@ -64,12 +65,70 @@ Delete Entity by Id Output request Output response +Query Entity + [Arguments] ${id} ${accept} ${attrs}=${EMPTY} ${context}=${EMPTY} ${geoproperty}=${EMPTY} ${options}=${EMPTY} + ${attrs_length} = Get Length ${attrs} + ${options_length} = Get Length ${options} + &{headers}= Create Dictionary + &{params}= Create Dictionary + Set To Dictionary ${headers} Accept ${accept} + Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type=${accept} + Run Keyword If ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} + Run Keyword If '${geoproperty}'!='' Set To Dictionary ${params} geoproperty=${geoproperty} + Run Keyword If ${options_length}>0 Set To Dictionary ${params} options=${options} + + ${response}= GET ${ENTITIES_ENDPOINT_PATH}${id} headers=${headers} query=${params} + Output request + Output response + [return] ${response} + +Query Entities + [Arguments] ${entity_ids}=${EMPTY} ${entity_types}=${EMPTY} ${accept}=${CONTENT_TYPE_LD_JSON} ${attrs}=${EMPTY} ${context}=${EMPTY} ${geoproperty}=${EMPTY} ${options}=${EMPTY} ${limit}=${EMPTY} ${entity_id_pattern}=${EMPTY} + ${attrs_length} = Get Length ${attrs} + ${options_length} = Get Length ${options} + ${entity_ids_length} = Get Length ${entity_ids} + ${entity_types_length} = Get Length ${entity_types} + &{headers}= Create Dictionary + &{params}= Create Dictionary + Set To Dictionary ${headers} Accept ${accept} + Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type=${accept} + Run Keyword If ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} + Run Keyword If '${geoproperty}'!='' Set To Dictionary ${params} geoproperty=${geoproperty} + Run Keyword If ${options_length}>0 Set To Dictionary ${params} options=${options} + Run Keyword If ${entity_ids_length}>0 Set To Dictionary ${params} id=${entity_ids} + Run Keyword If ${entity_types_length}>0 Set To Dictionary ${params} type=${entity_types} + Run Keyword If '${limit}'!='' Set To Dictionary ${params} limit=${limit} + Run Keyword If '${entity_id_pattern}'!='' Set To Dictionary ${params} idPattern=${entity_id_pattern} + + ${response}= GET ${ENTITIES_ENDPOINT_PATH} headers=${headers} query=${params} + Output request + Output response + [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} + Run Keyword If ${entity_ids_length}>0 Set To Dictionary ${params} id=${entity_ids} + Run Keyword If ${entity_types_length}>0 Set To Dictionary ${params} type=${entity_types} + Run Keyword If ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} + Run Keyword If '${entity_id_pattern}'!='' Set To Dictionary ${params} idPattern=${entity_id_pattern} + Run Keyword If '${geoproperty}'!='' Set To Dictionary ${params} geoproperty=${geoproperty} + ${response}= POST ${ENTITY_OPERATIONS_QUERY_ENDPOINT_PATH} query=${params} headers=${headers} + Output request + Output response + [return] ${response} + Retrieve Entity by Id [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${headers}= Create Dictionary Set To Dictionary ${headers} Accept ${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" - ${response}= GET ${ENTITIES_ENDPOINT_PATH}/${id} headers=${headers} + ${response}= GET ${ENTITIES_ENDPOINT_PATH}${id} headers=${headers} Output request Output response Set Test Variable ${response} @@ -78,12 +137,10 @@ Create Entity Selecting Content Type [Arguments] ${filename} ${entity_id} ${content_type} ${entity_payload}= Load Json From File ${EXECDIR}/data/entities/${filename} ${entity}= Update Value To Json ${entity_payload} $..id ${entity_id} - &{headers}= Create Dictionary Content-Type=${content_type} ${response}= POST ${ENTITIES_ENDPOINT_PATH} body=${entity} headers=${headers} - Output request - Output response ${request}= Output request + Output response [return] ${request} ${response} Create Entity diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource old mode 100644 new mode 100755 index a648ed4ebc0faf3af86f3ec628ab3be64aa3eaff..1b7cf8acc8ff82653d923c5710bdd92d80f627cc --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -55,6 +55,21 @@ Check Response Body Containing Batch Operation Result Should Not Be Empty ${response_error['error']} END +Check Response Body Containing Entity element + [Arguments] ${expectation_filename} ${entity_id} ${response_body} + ${entity_payload}= Load Json From File ${EXECDIR}/data/entities/expectations/${expectation_filename} + ${entity}= Update Value To Json ${entity_payload} $..id ${entity_id} + ${comparaison_result}= Compare Dictionaries Ignoring Keys ${response_body} ${entity} ${instance_id_regex_expr} + Should Be True ${comparaison_result} msg=Entity Comparaison Failed + +Check Response Body Containing List Containing Entity Elements + [Arguments] ${expectation_filename} ${entities_ids} ${response_body} + ${index}= Set Variable 0 + FOR ${entity_id} IN @{entities_ids} + Check Response Body Containing Entity element ${expectation_filename} ${entity_id} ${response_body[${index}]} + ${index}= Evaluate ${index} + 1 + END + Check Response Body Containing EntityTemporal element [Arguments] ${filename} ${temporal_entity_representation_id} ${temporal_entity_representation_payload}= Load Json From File ${EXECDIR}/data/temporalEntities/expectations/${filename}