From 39115c9b9467eb9a24250b71d20fcd48fbc8d76e Mon Sep 17 00:00:00 2001 From: root Date: Mon, 28 Dec 2020 18:26:58 +0000 Subject: [PATCH 01/11] Added consumption/entity/001.robot --- .../Consumption/Entity/001.robot | 22 +++++++++++++++++++ resources/ApiUtils.resource | 12 +++++++++- resources/AssertionUtils.resource | 0 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/001.robot mode change 100644 => 100755 resources/ApiUtils.resource mode change 100644 => 100755 resources/AssertionUtils.resource diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001.robot new file mode 100644 index 00000000..a23c0809 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001.robot @@ -0,0 +1,22 @@ +*** 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: + +*** Test Cases *** +001_01_Check that you can 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 building-simple-attributes-sample.jsonld ${entity_id} application/ld+json + Check Response Status Code 201 ${response['status']} + + ${response}= Retrieve Entity by Id Returning Response ${entity_id} ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 200 ${response['status']} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource old mode 100644 new mode 100755 index cf0f717f..627d9725 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -64,12 +64,22 @@ Delete Entity by Id Output request Output response +Retrieve Entity by Id Returning Response + [Arguments] ${id} ${accept} ${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} + 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} diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource old mode 100644 new mode 100755 -- GitLab From 074a55054991fa7a020001a381cc86c94e2c8501 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 28 Dec 2020 18:27:29 +0000 Subject: [PATCH 02/11] Added consumption/entity/001_01.robot --- .../Consumption/Entity/{001.robot => 001_01.robot} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename TP/NGSI-LD/ContextInformation/Consumption/Entity/{001.robot => 001_01.robot} (100%) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot similarity index 100% rename from TP/NGSI-LD/ContextInformation/Consumption/Entity/001.robot rename to TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot -- GitLab From c251b3cd7e5c49c56a873be7eead09acc48e92aa Mon Sep 17 00:00:00 2001 From: root Date: Tue, 29 Dec 2020 16:17:45 +0000 Subject: [PATCH 03/11] added Consumption/Entity/001_02.robot --- .../Consumption/Entity/001_01.robot | 7 +++-- .../Consumption/Entity/001_02.robot | 28 +++++++++++++++++++ ...sample-expectation-query-attributes.jsonld | 17 +++++++++++ ...imple-attributes-sample-expectation.jsonld | 25 +++++++++++++++++ resources/ApiUtils.resource | 20 ++++++++++--- resources/AssertionUtils.resource | 7 +++++ 6 files changed, 98 insertions(+), 6 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot create mode 100644 data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld create mode 100644 data/entities/expectations/building-simple-attributes-sample-expectation.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot index a23c0809..b7dd8c46 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot @@ -6,17 +6,20 @@ 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_Check that you can get an entity by id +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 building-simple-attributes-sample.jsonld ${entity_id} application/ld+json + ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} ${response}= Retrieve Entity by Id Returning Response ${entity_id} ${CONTENT_TYPE_LD_JSON} 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/001_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot new file mode 100644 index 00000000..59040930 --- /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 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 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} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} \ 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 00000000..d562f978 --- /dev/null +++ b/data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld @@ -0,0 +1,17 @@ +{ + "id": "urn:ngsi-ld:Building:7123416795055774", + "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.jsonld b/data/entities/expectations/building-simple-attributes-sample-expectation.jsonld new file mode 100644 index 00000000..c7155bd9 --- /dev/null +++ b/data/entities/expectations/building-simple-attributes-sample-expectation.jsonld @@ -0,0 +1,25 @@ +{ + "id": "urn:ngsi-ld:Building:6539860708584325", + "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/resources/ApiUtils.resource b/resources/ApiUtils.resource index 627d9725..e289966b 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -68,12 +68,26 @@ Retrieve Entity by Id Returning Response [Arguments] ${id} ${accept} ${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" + Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type=${accept} ${response}= GET ${ENTITIES_ENDPOINT_PATH}${id} headers=${headers} Output request Output response [return] ${response} +Query Entity + [Arguments] ${id} ${accept} ${attrs}=${EMPTY} ${context}=${EMPTY} + ${attrs_length} = Get Length ${attrs} + &{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} + + ${response}= GET ${ENTITIES_ENDPOINT_PATH}${id} headers=${headers} query=${params} + Output request + Output response + [return] ${response} + Retrieve Entity by Id [Arguments] ${id} ${accept}=${CONTENT_TYPE_LD_JSON} ${context}=${EMPTY} ${headers}= Create Dictionary @@ -88,12 +102,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 index a648ed4e..c8b87ba5 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -55,6 +55,13 @@ 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} + ${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 EntityTemporal element [Arguments] ${filename} ${temporal_entity_representation_id} ${temporal_entity_representation_payload}= Load Json From File ${EXECDIR}/data/temporalEntities/expectations/${filename} -- GitLab From d970d01be69ce395d7af4cc9e15c1efa63f3bfa3 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 29 Dec 2020 17:31:29 +0000 Subject: [PATCH 04/11] added Consumption/Entity/001_03.robot --- .../Consumption/Entity/001_01.robot | 2 +- .../Consumption/Entity/001_02.robot | 4 +-- .../Consumption/Entity/001_03.robot | 26 +++++++++++++++++++ .../building-location-attribute-sample.jsonld | 23 ++++++++++++++++ ...ample-expectation-query-geoproperty.jsonld | 25 ++++++++++++++++++ resources/ApiUtils.resource | 14 ++-------- 6 files changed, 79 insertions(+), 15 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot create mode 100644 data/entities/building-location-attribute-sample.jsonld create mode 100644 data/entities/expectations/building-location-attribute-sample-expectation-query-geoproperty.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot index b7dd8c46..838e8cd9 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot @@ -18,7 +18,7 @@ ${expectation_filename}= building-simple-attributes-sample-expectation.jsonld ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Retrieve Entity by Id Returning Response ${entity_id} ${CONTENT_TYPE_LD_JSON} + ${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} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot index 59040930..4891b22d 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that you can query some attributes from entity +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 @@ -13,7 +13,7 @@ ${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 entity + [Documentation] Check that you can query some attributes from an entity [Tags] mandatory ${entity_id}= Generate Random Entity Id ${building_id_prefix} 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 00000000..37242fe9 --- /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} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} \ No newline at end of file diff --git a/data/entities/building-location-attribute-sample.jsonld b/data/entities/building-location-attribute-sample.jsonld new file mode 100644 index 00000000..ffb69e92 --- /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 00000000..823747da --- /dev/null +++ b/data/entities/expectations/building-location-attribute-sample-expectation-query-geoproperty.jsonld @@ -0,0 +1,25 @@ +{ + "id": "urn:ngsi-ld:Building:9630352980062352", + "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/resources/ApiUtils.resource b/resources/ApiUtils.resource index e289966b..24d00fd7 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -64,25 +64,15 @@ Delete Entity by Id Output request Output response -Retrieve Entity by Id Returning Response - [Arguments] ${id} ${accept} ${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=${accept} - ${response}= GET ${ENTITIES_ENDPOINT_PATH}${id} headers=${headers} - Output request - Output response - [return] ${response} - Query Entity - [Arguments] ${id} ${accept} ${attrs}=${EMPTY} ${context}=${EMPTY} + [Arguments] ${id} ${accept} ${attrs}=${EMPTY} ${context}=${EMPTY} ${geoproperty}=${EMPTY} ${attrs_length} = Get Length ${attrs} &{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} ${response}= GET ${ENTITIES_ENDPOINT_PATH}${id} headers=${headers} query=${params} Output request Output response -- GitLab From 1b6d8d2abf2afb3e85ff6fbf2609952b9b0eaea1 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 29 Dec 2020 17:54:10 +0000 Subject: [PATCH 05/11] added Consumption/Entity/001_03.robot --- .../Consumption/Entity/002.robot | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot 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 00000000..86fbbe3a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot @@ -0,0 +1,25 @@ +*** 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 + +*** Variable *** +${entity_id_empty}= +${entity_id_not_valid}= thisisaninvaliduri + +*** Test Cases *** ENTITY_ID EXPECTED_STATUS_CODE PROBLEM_TYPE +002_01_Get an entity if the Entity Id is not present ${entity_id_empty} 400 ${ERROR_TYPE_BAD_REQUEST_DATA} +002_02_Get an entity if the Entity Id is not a valid URI ${entity_id_not_valid} 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 -- GitLab From f8f65d09ff4a8bf8d6a5c611d3299dd9d7ee1e90 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 30 Dec 2020 11:30:47 +0000 Subject: [PATCH 06/11] added Consumption/Entity/003_01.robot Consumption/Entity/003_02.robot --- .../Consumption/Entity/003_01.robot | 19 +++++++++++++ .../Consumption/Entity/003_02.robot | 27 +++++++++++++++++++ .../Provision/Entities/CreateEntity/003.robot | 1 - 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/003_01.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/003_02.robot 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 00000000..59647fef --- /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 00000000..fd207890 --- /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/Provision/Entities/CreateEntity/003.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/003.robot index bf0050cc..1357d60d 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 -- GitLab From d2c337617b7a51aa4d62c29827ec595e005ce5da Mon Sep 17 00:00:00 2001 From: root Date: Wed, 30 Dec 2020 12:05:54 +0000 Subject: [PATCH 07/11] added Consumption/Entity/004.robot --- .../Consumption/Entity/004.robot | 26 +++++++++++++++++++ ...butes-sample-expectation-simplified.jsonld | 11 ++++++++ resources/ApiUtils.resource | 4 ++- 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot create mode 100644 data/entities/expectations/building-simple-attributes-sample-expectation-simplified.jsonld 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 00000000..f2b166f6 --- /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} + + [Teardown] Delete Entity by Id Returning Response ${entity_id} \ 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 00000000..8fc30e37 --- /dev/null +++ b/data/entities/expectations/building-simple-attributes-sample-expectation-simplified.jsonld @@ -0,0 +1,11 @@ +{ + "id": "urn:ngsi-ld:Building:4982132550789476", + "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/resources/ApiUtils.resource b/resources/ApiUtils.resource index 24d00fd7..b2e80977 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -65,14 +65,16 @@ Delete Entity by Id Output response Query Entity - [Arguments] ${id} ${accept} ${attrs}=${EMPTY} ${context}=${EMPTY} ${geoproperty}=${EMPTY} + [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 -- GitLab From 11382112ff91445249da1bef2889afe8e938cc4d Mon Sep 17 00:00:00 2001 From: root Date: Wed, 30 Dec 2020 12:14:56 +0000 Subject: [PATCH 08/11] changed keyword name --- TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot | 2 +- TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot | 2 +- TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot | 2 +- TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot | 2 +- TP/NGSI-LD/ContextInformation/Consumption/Entity/003_01.robot | 2 +- TP/NGSI-LD/ContextInformation/Consumption/Entity/003_02.robot | 2 +- TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot | 2 +- resources/ApiUtils.resource | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot index 838e8cd9..40abb19c 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot @@ -18,7 +18,7 @@ ${expectation_filename}= building-simple-attributes-sample-expectation.jsonld ${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} + ${response}= Get 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} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot index 4891b22d..b1f294cf 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot @@ -21,7 +21,7 @@ ${attribute_subcategory}= https://uri.fiware.org/ns/data-models#subCategory 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} + ${response}= Get 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} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot index 37242fe9..8653944f 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot @@ -19,7 +19,7 @@ ${geometry_property}= location ${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} + ${response}= Get 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} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot index 86fbbe3a..03c8211d 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot @@ -19,7 +19,7 @@ Get Entity With Invalid/Missing Id [Documentation] Check that you cannot get an entity with invalid/missing id [Tags] mandatory failing - ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} + ${response}= Get 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 index 59647fef..c1639589 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/003_01.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/003_01.robot @@ -13,7 +13,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building: [Tags] mandatory failing ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${response}= Query Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} + ${response}= Get 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 index fd207890..50e5d4d0 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/003_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/003_02.robot @@ -19,7 +19,7 @@ ${attribute_not_known}= property_not_found 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} + ${response}= Get 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} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot index f2b166f6..260e13a2 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot @@ -19,7 +19,7 @@ ${options_parameter}= keyValues ${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} + ${response}= Get 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} diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index b2e80977..5a43fb7a 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -64,7 +64,7 @@ Delete Entity by Id Output request Output response -Query Entity +Get Entity [Arguments] ${id} ${accept} ${attrs}=${EMPTY} ${context}=${EMPTY} ${geoproperty}=${EMPTY} ${options}=${EMPTY} ${attrs_length} = Get Length ${attrs} ${options_length} = Get Length ${options} -- GitLab From dc15b4c7c7362cbf9ad1b4299e083dfaa7a4808e Mon Sep 17 00:00:00 2001 From: root Date: Mon, 4 Jan 2021 19:45:35 +0000 Subject: [PATCH 09/11] added various query entities suites --- .../Consumption/Entity/001_01.robot | 4 +- .../Consumption/Entity/001_02.robot | 4 +- .../Consumption/Entity/001_03.robot | 6 +-- .../Consumption/Entity/002.robot | 2 +- .../Consumption/Entity/003_01.robot | 2 +- .../Consumption/Entity/003_02.robot | 2 +- .../Consumption/Entity/004.robot | 4 +- .../Consumption/Entity/005.robot | 27 +++++++++++ .../Consumption/Entity/006_01.robot | 42 +++++++++++++++++ .../Consumption/Entity/006_02.robot | 43 ++++++++++++++++++ .../Consumption/Entity/006_03.robot | 39 ++++++++++++++++ .../Consumption/Entity/006_04.robot | 40 +++++++++++++++++ .../Consumption/Entity/006_05.robot | 39 ++++++++++++++++ .../Consumption/Entity/007_01.robot | 42 +++++++++++++++++ .../Consumption/Entity/007_02.robot | 43 ++++++++++++++++++ .../Consumption/Entity/007_03.robot | 39 ++++++++++++++++ .../Consumption/Entity/007_04.robot | 40 +++++++++++++++++ .../Consumption/Entity/007_05.robot | 39 ++++++++++++++++ .../Consumption/Entity/008_01.robot | 40 +++++++++++++++++ .../Consumption/Entity/008_02.robot | 41 +++++++++++++++++ .../Consumption/Entity/008_03.robot | 38 ++++++++++++++++ .../Consumption/Entity/008_04.robot | 40 +++++++++++++++++ .../Consumption/Entity/008_05.robot | 38 ++++++++++++++++ ...cation-attribute-sample-expectation.jsonld | 22 +++++++++ ...building-minimal-sample-expectation.jsonld | 7 +++ ...building-vehicle-sample-expectation.jsonld | 0 .../vehicle-simple-attributes-sample.jsonld | 21 +++++++++ resources/ApiUtils.resource | 45 ++++++++++++++++++- resources/AssertionUtils.resource | 12 ++++- 29 files changed, 746 insertions(+), 15 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/005.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/006_01.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/006_02.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/006_03.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/006_04.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/006_05.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/007_01.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/007_02.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/007_03.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/007_04.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/007_05.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/008_01.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/008_02.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/008_03.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/008_04.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/008_05.robot create mode 100644 data/entities/expectations/building-location-attribute-sample-expectation.jsonld create mode 100644 data/entities/expectations/building-minimal-sample-expectation.jsonld create mode 100644 data/entities/expectations/building-vehicle-sample-expectation.jsonld create mode 100644 data/entities/vehicle-simple-attributes-sample.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot index 40abb19c..f6aeac9c 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_01.robot @@ -18,8 +18,8 @@ ${expectation_filename}= building-simple-attributes-sample-expectation.jsonld ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Get Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} + ${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} + 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 index b1f294cf..8b97f073 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_02.robot @@ -21,8 +21,8 @@ ${attribute_subcategory}= https://uri.fiware.org/ns/data-models#subCategory Check Response Status Code 201 ${response['status']} ${attributes_to_be_retrieved}= Create List ${attribute_airqualitylevel} ${attribute_subcategory} - ${response}= Get Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} attrs=${attributes_to_be_retrieved} + ${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} + 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 index 8653944f..f7a6bd76 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot @@ -8,7 +8,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource ${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 +${geometry_property}= test *** Test Cases *** 001_03_Query the geometry property from an entity @@ -19,8 +19,8 @@ ${geometry_property}= location ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Get Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} geoproperty=${geometry_property} + ${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} + 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 index 03c8211d..86fbbe3a 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot @@ -19,7 +19,7 @@ Get Entity With Invalid/Missing Id [Documentation] Check that you cannot get an entity with invalid/missing id [Tags] mandatory failing - ${response}= Get Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} + ${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 index c1639589..59647fef 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/003_01.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/003_01.robot @@ -13,7 +13,7 @@ ${building_id_prefix}= urn:ngsi-ld:Building: [Tags] mandatory failing ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${response}= Get Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} + ${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 index 50e5d4d0..fd207890 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/003_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/003_02.robot @@ -19,7 +19,7 @@ ${attribute_not_known}= property_not_found Check Response Status Code 201 ${response['status']} ${attributes_to_be_retrieved}= Create List ${attribute_not_known} - ${response}= Get Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} attrs=${attributes_to_be_retrieved} + ${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} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot index 260e13a2..d575056c 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot @@ -11,7 +11,7 @@ ${expectation_filename}= building-simple-attributes-sample-expectation-simplifi ${options_parameter}= keyValues *** Test Cases *** -004 Get an entity in a simplified representation +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 @@ -19,7 +19,7 @@ ${options_parameter}= keyValues ${request} ${response}= Create Entity Selecting Content Type ${filename} ${entity_id} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Get Entity ${entity_id} ${CONTENT_TYPE_LD_JSON} options=${options_parameter} + ${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} 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 00000000..689763fd --- /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 00000000..999bd051 --- /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 +${expection_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 ${expection_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 00000000..5be714fb --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_02.robot @@ -0,0 +1,43 @@ +*** 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: +${building_filename}= building-minimal-sample.jsonld +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld +${expection_filename}= building-vehicle-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 + + +*** 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']} + + #@{entity_types_to_be_retrieved}= Create List ${building_entity_type} ${vehicle_entity_type} + @{entity_types_to_be_retrieved}= Create List ${vehicle_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 ${building_entity_id} ${vehicle_entity_id} + ##Check Response Body Containing List Containing Entity elements ${expection_filename} ${entities_ids_to_be_retrieved} ${response['body']} + + [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/006_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_03.robot new file mode 100644 index 00000000..733d8cb5 --- /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 +${expection_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 ${expection_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 00000000..ebb41814 --- /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 +${expection_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 ${expection_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 00000000..2a3819e2 --- /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 +${expection_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 ${expection_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 00000000..38f11503 --- /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 +${expection_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 ${expection_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 00000000..9290b154 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_02.robot @@ -0,0 +1,43 @@ +*** 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: +${building_filename}= building-minimal-sample.jsonld +${vehicle_filename}= vehicle-simple-attributes-sample.jsonld +${expection_filename}= building-vehicle-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 + + +*** 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']} + + #@{entity_types_to_be_retrieved}= Create List ${building_entity_type} ${vehicle_entity_type} + @{entity_types_to_be_retrieved}= Create List ${vehicle_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 ${expection_filename} ${entities_ids_to_be_retrieved} ${response['body']} + + [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/007_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_03.robot new file mode 100644 index 00000000..9b2c7832 --- /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 +${expection_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 ${expection_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 00000000..5c18ad20 --- /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 +${expection_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 ${expection_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 00000000..542beab6 --- /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 +${expection_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 ${expection_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 00000000..569d2723 --- /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 00000000..c598a04d --- /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 00000000..999e6a45 --- /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 00000000..86368ca9 --- /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 00000000..b29b3ffc --- /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/data/entities/expectations/building-location-attribute-sample-expectation.jsonld b/data/entities/expectations/building-location-attribute-sample-expectation.jsonld new file mode 100644 index 00000000..8e67b86e --- /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 00000000..266cb229 --- /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-vehicle-sample-expectation.jsonld b/data/entities/expectations/building-vehicle-sample-expectation.jsonld new file mode 100644 index 00000000..e69de29b diff --git a/data/entities/vehicle-simple-attributes-sample.jsonld b/data/entities/vehicle-simple-attributes-sample.jsonld new file mode 100644 index 00000000..2da4522d --- /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 index 5a43fb7a..3d6b1e94 100755 --- 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,7 +65,7 @@ Delete Entity by Id Output request Output response -Get Entity +Query Entity [Arguments] ${id} ${accept} ${attrs}=${EMPTY} ${context}=${EMPTY} ${geoproperty}=${EMPTY} ${options}=${EMPTY} ${attrs_length} = Get Length ${attrs} ${options_length} = Get Length ${options} @@ -75,11 +76,53 @@ Get Entity 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 diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index c8b87ba5..1b7cf8ac 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -56,12 +56,20 @@ Check Response Body Containing Batch Operation Result END Check Response Body Containing Entity element - [Arguments] ${expectation_filename} ${entity_id} ${response} + [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} + ${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} -- GitLab From 17f34926935a03d94eff2501849e4f976bed93d8 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 5 Jan 2021 15:26:42 +0000 Subject: [PATCH 10/11] added several test suites --- .../Consumption/Entity/001_03.robot | 2 +- .../Consumption/Entity/002.robot | 8 +--- .../Consumption/Entity/004.robot | 2 +- .../Consumption/Entity/005.robot | 2 +- .../Consumption/Entity/006_01.robot | 4 +- .../Consumption/Entity/006_02.robot | 22 ++++++---- .../Consumption/Entity/006_03.robot | 4 +- .../Consumption/Entity/006_04.robot | 4 +- .../Consumption/Entity/006_05.robot | 4 +- .../Consumption/Entity/007_01.robot | 4 +- .../Consumption/Entity/007_02.robot | 20 ++++++--- .../Consumption/Entity/007_03.robot | 4 +- .../Consumption/Entity/007_04.robot | 4 +- .../Consumption/Entity/007_05.robot | 4 +- .../Consumption/Entity/009.robot | 44 +++++++++++++++++++ .../Consumption/Entity/010.robot | 43 ++++++++++++++++++ .../Consumption/Entity/011.robot | 44 +++++++++++++++++++ ...ample-expectation-query-geoproperty.jsonld | 2 +- ...sample-expectation-query-attributes.jsonld | 2 +- ...butes-sample-expectation-simplified.jsonld | 2 +- ...imple-attributes-sample-expectation.jsonld | 2 +- ...vehicle-parking-sample-expectation.jsonld} | 0 .../parking-simple-attributes-sample.jsonld | 36 +++++++++++++++ 23 files changed, 219 insertions(+), 44 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/009.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/010.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/011.robot rename data/entities/expectations/{building-vehicle-sample-expectation.jsonld => vehicle-parking-sample-expectation.jsonld} (100%) create mode 100644 data/entities/parking-simple-attributes-sample.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot index f7a6bd76..76f6b0ed 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/001_03.robot @@ -8,7 +8,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource ${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}= test +${geometry_property}= location *** Test Cases *** 001_03_Query the geometry property from an entity diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot index 86fbbe3a..282a9b00 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/002.robot @@ -5,13 +5,9 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Test Template Get Entity With Invalid/Missing Id -*** Variable *** -${entity_id_empty}= -${entity_id_not_valid}= thisisaninvaliduri - *** Test Cases *** ENTITY_ID EXPECTED_STATUS_CODE PROBLEM_TYPE -002_01_Get an entity if the Entity Id is not present ${entity_id_empty} 400 ${ERROR_TYPE_BAD_REQUEST_DATA} -002_02_Get an entity if the Entity Id is not a valid URI ${entity_id_not_valid} 400 ${ERROR_TYPE_BAD_REQUEST_DATA} +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 diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot index d575056c..b74f19dd 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/004.robot @@ -21,6 +21,6 @@ ${options_parameter}= keyValues ${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} + 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 index 689763fd..c81cc37a 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/005.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/005.robot @@ -22,6 +22,6 @@ ${accept_header}= application/geo+json ${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} + 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 index 999bd051..441ef1eb 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_01.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_01.robot @@ -7,7 +7,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: ${filename}= building-minimal-sample.jsonld -${expection_filename}= building-minimal-sample-expectation.jsonld +${expectation_filename}= building-minimal-sample-expectation.jsonld ${entity_type}= https://uri.fiware.org/ns/data-models#Building *** Test Cases *** @@ -29,7 +29,7 @@ ${entity_type}= https://uri.fiware.org/ns/data-models#Building @{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 ${expection_filename} ${entities_ids_to_be_retrieved} ${response['body']} + 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} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_02.robot index 5be714fb..be7e684a 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_02.robot @@ -7,11 +7,14 @@ 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 -${expection_filename}= building-vehicle-sample-expectation.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 *** @@ -25,19 +28,22 @@ ${vehicle_entity_type}= https://uri.fiware.org/ns/data-models#Vehicle ${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 ${building_entity_type} ${vehicle_entity_type} - @{entity_types_to_be_retrieved}= Create List ${vehicle_entity_type} + @{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 ${building_entity_id} ${vehicle_entity_id} - ##Check Response Body Containing List Containing Entity elements ${expection_filename} ${entities_ids_to_be_retrieved} ${response['body']} + @{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} + [Teardown] Delete Entities ${building_entity_id} ${vehicle_entity_id} ${parking_entity_id} *** Keywords *** Delete Entities - [Arguments] ${building_entity_id} ${vehicle_entity_id} + [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} \ No newline at end of file + 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 index 733d8cb5..7f1ef6db 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_03.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_03.robot @@ -7,7 +7,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: ${filename}= building-minimal-sample.jsonld -${expection_filename}= building-minimal-sample-expectation.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:.* @@ -27,7 +27,7 @@ ${entity_id_pattern}= urn:ngsi-ld:Building:.* @{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 ${expection_filename} ${entities_ids_to_be_retrieved} ${response['body']} + 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} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_04.robot index ebb41814..18f59109 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_04.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_04.robot @@ -7,7 +7,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: ${filename}= building-minimal-sample.jsonld -${expection_filename}= building-minimal-sample-expectation.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 @@ -28,7 +28,7 @@ ${attribute_subcategory}= https://uri.fiware.org/ns/data-models#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 ${expection_filename} ${entities_ids_to_be_retrieved} ${response['body']} + 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} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_05.robot index 2a3819e2..f4c4ac63 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_05.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/006_05.robot @@ -7,7 +7,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: ${filename}= building-minimal-sample.jsonld -${expection_filename}= building-minimal-sample-expectation.jsonld +${expectation_filename}= building-minimal-sample-expectation.jsonld ${entity_type}= https://uri.fiware.org/ns/data-models#Building ${geometry_property}= location @@ -27,7 +27,7 @@ ${geometry_property}= location @{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 ${expection_filename} ${entities_ids_to_be_retrieved} ${response['body']} + 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} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_01.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_01.robot index 38f11503..b18df22b 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_01.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_01.robot @@ -7,7 +7,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: ${filename}= building-minimal-sample.jsonld -${expection_filename}= building-minimal-sample-expectation.jsonld +${expectation_filename}= building-minimal-sample-expectation.jsonld ${entity_type}= https://uri.fiware.org/ns/data-models#Building *** Test Cases *** @@ -29,7 +29,7 @@ ${entity_type}= https://uri.fiware.org/ns/data-models#Building @{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 ${expection_filename} ${entities_ids_to_be_retrieved} ${response['body']} + 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} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_02.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_02.robot index 9290b154..6f404862 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_02.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_02.robot @@ -7,11 +7,14 @@ 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 -${expection_filename}= building-vehicle-sample-expectation.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 *** @@ -25,19 +28,22 @@ ${vehicle_entity_type}= https://uri.fiware.org/ns/data-models#Vehicle ${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 ${building_entity_type} ${vehicle_entity_type} - @{entity_types_to_be_retrieved}= Create List ${vehicle_entity_type} + @{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 ${expection_filename} ${entities_ids_to_be_retrieved} ${response['body']} + 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} + [Teardown] Delete Entities ${building_entity_id} ${vehicle_entity_id} ${parking_entity_id} *** Keywords *** Delete Entities - [Arguments] ${building_entity_id} ${vehicle_entity_id} + [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} \ No newline at end of file + 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 index 9b2c7832..fa7d2d66 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_03.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_03.robot @@ -7,7 +7,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: ${filename}= building-minimal-sample.jsonld -${expection_filename}= building-minimal-sample-expectation.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:.* @@ -27,7 +27,7 @@ ${entity_id_pattern}= urn:ngsi-ld:Building:.* @{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 ${expection_filename} ${entities_ids_to_be_retrieved} ${response['body']} + 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} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_04.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_04.robot index 5c18ad20..60e03dda 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_04.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_04.robot @@ -7,7 +7,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: ${filename}= building-minimal-sample.jsonld -${expection_filename}= building-minimal-sample-expectation.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 @@ -28,7 +28,7 @@ ${attribute_subcategory}= https://uri.fiware.org/ns/data-models#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 ${expection_filename} ${entities_ids_to_be_retrieved} ${response['body']} + 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} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_05.robot index 542beab6..60645100 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_05.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_05.robot @@ -7,7 +7,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: ${filename}= building-minimal-sample.jsonld -${expection_filename}= building-minimal-sample-expectation.jsonld +${expectation_filename}= building-minimal-sample-expectation.jsonld ${entity_type}= https://uri.fiware.org/ns/data-models#Building ${geometry_property}= location @@ -27,7 +27,7 @@ ${geometry_property}= location @{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 ${expection_filename} ${entities_ids_to_be_retrieved} ${response['body']} + #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} 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 00000000..a5ec04bd --- /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 00000000..c9df1913 --- /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 00000000..0c84970a --- /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/data/entities/expectations/building-location-attribute-sample-expectation-query-geoproperty.jsonld b/data/entities/expectations/building-location-attribute-sample-expectation-query-geoproperty.jsonld index 823747da..d023d039 100644 --- a/data/entities/expectations/building-location-attribute-sample-expectation-query-geoproperty.jsonld +++ b/data/entities/expectations/building-location-attribute-sample-expectation-query-geoproperty.jsonld @@ -1,5 +1,5 @@ { - "id": "urn:ngsi-ld:Building:9630352980062352", + "id": "urn:ngsi-ld:Building:randomUUID", "type": "https://uri.fiware.org/ns/data-models#Building", "location": { "type": "GeoProperty", 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 index d562f978..7a2623f6 100644 --- a/data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld +++ b/data/entities/expectations/building-simple-attributes-sample-expectation-query-attributes.jsonld @@ -1,5 +1,5 @@ { - "id": "urn:ngsi-ld:Building:7123416795055774", + "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", diff --git a/data/entities/expectations/building-simple-attributes-sample-expectation-simplified.jsonld b/data/entities/expectations/building-simple-attributes-sample-expectation-simplified.jsonld index 8fc30e37..e4abf08e 100644 --- a/data/entities/expectations/building-simple-attributes-sample-expectation-simplified.jsonld +++ b/data/entities/expectations/building-simple-attributes-sample-expectation-simplified.jsonld @@ -1,5 +1,5 @@ { - "id": "urn:ngsi-ld:Building:4982132550789476", + "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, diff --git a/data/entities/expectations/building-simple-attributes-sample-expectation.jsonld b/data/entities/expectations/building-simple-attributes-sample-expectation.jsonld index c7155bd9..74d575bf 100644 --- a/data/entities/expectations/building-simple-attributes-sample-expectation.jsonld +++ b/data/entities/expectations/building-simple-attributes-sample-expectation.jsonld @@ -1,5 +1,5 @@ { - "id": "urn:ngsi-ld:Building:6539860708584325", + "id": "urn:ngsi-ld:Building:randomUUID", "type": "https://uri.fiware.org/ns/data-models#Building", "name": { "type": "Property", diff --git a/data/entities/expectations/building-vehicle-sample-expectation.jsonld b/data/entities/expectations/vehicle-parking-sample-expectation.jsonld similarity index 100% rename from data/entities/expectations/building-vehicle-sample-expectation.jsonld rename to data/entities/expectations/vehicle-parking-sample-expectation.jsonld diff --git a/data/entities/parking-simple-attributes-sample.jsonld b/data/entities/parking-simple-attributes-sample.jsonld new file mode 100644 index 00000000..841177ea --- /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 -- GitLab From 189a568070adc4b7b9c900b5190e7e33f6844314 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 5 Jan 2021 15:52:24 +0000 Subject: [PATCH 11/11] added several test suites --- TP/NGSI-LD/ContextInformation/Consumption/Entity/007_05.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_05.robot index 60645100..a7ec401a 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_05.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/007_05.robot @@ -27,7 +27,7 @@ ${geometry_property}= location @{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']} + 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} -- GitLab