From 7d84af85e8de7b32e313be943b146845c411e51b Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Thu, 16 Jan 2025 09:54:19 +0100 Subject: [PATCH 1/9] feat: add TCs for deletedAt in normalized temporal representation --- .../020_17.robot | 66 ++++++++++++++++ ...resentation-languageproperty-020-17.jsonld | 14 ++++ ...oral-representation-property-020-17.jsonld | 12 +++ ...-representation-relationship-020-17.jsonld | 12 +++ ...entation-different-attributes-types.jsonld | 49 ++++++++++++ doc/analysis/initial_setup.py | 1 - doc/analysis/requests.py | 6 +- .../Consumption/020_17.json | 79 +++++++++++++++++++ ...oralContextInformationConsumption.resource | 4 + resources/AssertionUtils.resource | 7 +- 10 files changed, 244 insertions(+), 6 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_17.robot create mode 100644 data/temporalEntities/expectations/vehicle-temporal-representation-languageproperty-020-17.jsonld create mode 100644 data/temporalEntities/expectations/vehicle-temporal-representation-property-020-17.jsonld create mode 100644 data/temporalEntities/expectations/vehicle-temporal-representation-relationship-020-17.jsonld create mode 100644 data/temporalEntities/vehicle-temporal-representation-different-attributes-types.jsonld create mode 100644 doc/files/ContextInformation/Consumption/020_17.json diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_17.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_17.robot new file mode 100644 index 000000000..cf3a12ae6 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_17.robot @@ -0,0 +1,66 @@ +*** Settings *** +Documentation Check that one can retrieve the temporal evolution of an entity following the deletedAt temporal property + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Temporal Entity +Test Teardown Delete Initial Temporal Entity +Test Template Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= vehicle-temporal-representation-different-attributes-types.jsonld + + +*** Test Cases *** ATTR_NAME EXPECTATION_FILENAME +020_17_01 With a Property + [Tags] te-retrieve 5_7_3 since_v1.6.1 + fuelLevel vehicle-temporal-representation-property-020-17.jsonld +020_17_02 With a Relationship + [Tags] te-retrieve 5_7_3 since_v1.6.1 + isParkedIn vehicle-temporal-representation-relationship-020-17.jsonld +020_17_03 With a LanguageProperty + [Tags] te-retrieve 5_7_3 4_5_18 since_v1.6.1 + name vehicle-temporal-representation-languageproperty-020-17.jsonld + + +*** Keywords *** +Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute + [Documentation] Check that one can retrieve the temporal evolution of an entity following the deletedAt temporal property + [Arguments] ${attr_name} ${expectation_filename} + ${response}= Delete Entity Attributes + ... entityId=${temporal_entity_representation_id} + ... attributeId=${attr_name} + ... datasetId=${EMPTY} + ... deleteAll=false + ... context=${ngsild_test_suite_context} + + ${response2}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... timeproperty=deletedAt + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response2.status_code} + Check Response Body Containing EntityTemporal element + ... filename=${expectation_filename} + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... response_body=${response2.json()} + ... excluded_regex=deletedAt + Should Have Value In Json + ... json_object=${response2.json()} + ... json_path=['${attr_name}']['deletedAt'] + +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${create_response}= Create Temporal Representation Of Entity + ... ${vehicle_payload_file} + ... ${temporal_entity_representation_id} + Check Response Status Code 201 ${create_response.status_code} + Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-languageproperty-020-17.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-languageproperty-020-17.jsonld new file mode 100644 index 000000000..e786bf3a4 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-languageproperty-020-17.jsonld @@ -0,0 +1,14 @@ +{ + "id": "urn:ngsi-ld:Vehicle:7802230401235560", + "type": "Vehicle", + "name": { + "type": "LanguageProperty", + "instanceId": "urn:ngsi-ld:Instance:ad40c1f5-9995-408a-8651-51be67124a4d", + "languageMap": { + "@none": "urn:ngsi-ld:null" + }, + "deletedAt": "2024-12-11T15:01:49.723294Z" + }, + "isParkedIn": [], + "fuelLevel": [] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-property-020-17.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-property-020-17.jsonld new file mode 100644 index 000000000..61e8c1812 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-property-020-17.jsonld @@ -0,0 +1,12 @@ +{ + "id": "urn:ngsi-ld:Vehicle:6684954483670853", + "type": "Vehicle", + "fuelLevel": { + "type": "Property", + "value": "urn:ngsi-ld:null", + "instanceId": "urn:ngsi-ld:Instance:901883e6-3c93-4a2f-8099-da1d72151f2a", + "deletedAt": "2024-12-09T17:16:12.031483Z" + }, + "isParkedIn": [], + "name": [] +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-relationship-020-17.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-relationship-020-17.jsonld new file mode 100644 index 000000000..95b180056 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-relationship-020-17.jsonld @@ -0,0 +1,12 @@ +{ + "id": "urn:ngsi-ld:Vehicle:3786481415227169", + "type": "Vehicle", + "isParkedIn": { + "type": "Relationship", + "object": "urn:ngsi-ld:null", + "instanceId": "urn:ngsi-ld:Instance:5be942ce-3ea5-4701-8d1d-6b29897f246f", + "deletedAt": "2024-12-11T11:02:49.270530Z" + }, + "fuelLevel": [], + "name": [] +} \ No newline at end of file diff --git a/data/temporalEntities/vehicle-temporal-representation-different-attributes-types.jsonld b/data/temporalEntities/vehicle-temporal-representation-different-attributes-types.jsonld new file mode 100644 index 000000000..a5c7152b1 --- /dev/null +++ b/data/temporalEntities/vehicle-temporal-representation-different-attributes-types.jsonld @@ -0,0 +1,49 @@ +{ + "id":"urn:ngsi-ld:Vehicle:randomUUID", + "type":"Vehicle", + "isParkedIn":[ + { + "type":"Relationship", + "object":"urn:ngsi-ld:OffStreetParking:Commerce", + "observedAt":"2024-12-01T12:00:00Z" + }, + { + "type":"Relationship", + "object":"urn:ngsi-ld:OffStreetParking:Graslin", + "observedAt":"2024-12-05T12:00:00Z" + } + ], + "name":[ + { + "type":"LanguageProperty", + "languageMap": { + "fr": "Ma voiture", + "en": "My vehicle" + }, + "observedAt":"2024-12-01T12:00:00Z" + }, + { + "type":"LanguageProperty", + "languageMap": { + "fr": "Ma jolie voiture", + "en": "My pretty vehicle" + }, + "observedAt":"2024-12-05T12:00:00Z" + } + ], + "fuelLevel":[ + { + "type":"Property", + "value":67, + "observedAt":"2020-08-01T12:03:00Z" + }, + { + "type":"Property", + "value":53, + "observedAt":"2020-08-01T13:05:00Z" + } + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/doc/analysis/initial_setup.py b/doc/analysis/initial_setup.py index 0c773f43f..5c1f40e3a 100644 --- a/doc/analysis/initial_setup.py +++ b/doc/analysis/initial_setup.py @@ -96,7 +96,6 @@ class InitialSetup: the SUT being in the "initial state" and the SUT containing an initial Temporal Entity ${entity} with an id set to ${temporal_entity_representation_id} - and an attribute with an id set to ${atrId} }''' return data diff --git a/doc/analysis/requests.py b/doc/analysis/requests.py index 513d4ae70..60f2cb369 100644 --- a/doc/analysis/requests.py +++ b/doc/analysis/requests.py @@ -96,7 +96,7 @@ class Requests: 'positions': [], 'params': ['temporal_entity_representation_id', 'attrs', 'options', 'context', 'timerel', 'timeAt', 'endTimeAt', 'lastN', 'accept', - 'aggrMethods', 'aggrPeriodDuration'] + 'aggrMethods', 'aggrPeriodDuration', 'timeproperty'] }, 'Delete Entity by Id': { 'positions': [0], @@ -1185,7 +1185,7 @@ class Requests: def retrieve_temporal_representation_of_entity(kwargs) -> str: expected_parameters = ['temporal_entity_representation_id', 'attrs', 'options', 'context', 'timerel', 'timeAt', 'endTimeAt', 'lastN', 'accept', - 'aggrMethods', 'aggrPeriodDuration'] + 'aggrMethods', 'aggrPeriodDuration', 'timeproperty'] result = [x for x in kwargs if x not in expected_parameters] response = "Retrieve Temporal Representation of Entity" for key, value in kwargs.items(): @@ -1214,6 +1214,8 @@ class Requests: response = f"{response} and\n Query Parameter: aggrMethods set to '{value}'" case 'aggrPeriodDuration': response = f"{response} and\n Query Parameter: aggrPeriodDuration set to '{value}'" + case 'timeproperty': + response = f"{response} and\n Query Parameter: timeproperty set to '{value}'" # If an exact match is not confirmed, this last case will be used if provided case _: raise Exception(f"ERROR: unexpected attribute(s) {result}, the attributes expected are " diff --git a/doc/files/ContextInformation/Consumption/020_17.json b/doc/files/ContextInformation/Consumption/020_17.json new file mode 100644 index 000000000..c15d6bfe6 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_17.json @@ -0,0 +1,79 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_17", + "test_objective": "Check that one can retrieve the temporal evolution of an entity following the deletedAt temporal property", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 5.7.3", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.18", + "5.7.3" + ], + "pics_selection": "", + "keywords": [ + "Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute", + "Create Temporal Entity", + "Delete Initial Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n}", + "test_cases": [ + { + "name": "020_17_01 With a Property", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_17_01", + "doc": "Check that one can retrieve the temporal evolution of an entity following the deletedAt temporal property", + "tags": [ + "5_7_3", + "since_v1.6.1", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-representation-property-020-17.jsonld'\n * the id was changed to 'temporal_entity_representation_id=${temporal_entity_representation_id}'\n * response body to be checked set to 'response_body=${response2.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to 'fuelLevel' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "020_17_02 With a Relationship", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_17_02", + "doc": "Check that one can retrieve the temporal evolution of an entity following the deletedAt temporal property", + "tags": [ + "5_7_3", + "since_v1.6.1", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-representation-relationship-020-17.jsonld'\n * the id was changed to 'temporal_entity_representation_id=${temporal_entity_representation_id}'\n * response body to be checked set to 'response_body=${response2.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to 'isParkedIn' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "020_17_03 With a LanguageProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_17_03", + "doc": "Check that one can retrieve the temporal evolution of an entity following the deletedAt temporal property", + "tags": [ + "4_5_18", + "5_7_3", + "since_v1.6.1", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-representation-languageproperty-020-17.jsonld'\n * the id was changed to 'temporal_entity_representation_id=${temporal_entity_representation_id}'\n * response body to be checked set to 'response_body=${response2.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to 'name' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_17" +} \ No newline at end of file diff --git a/resources/ApiUtils/TemporalContextInformationConsumption.resource b/resources/ApiUtils/TemporalContextInformationConsumption.resource index 71ca1cfe5..5b7328b72 100755 --- a/resources/ApiUtils/TemporalContextInformationConsumption.resource +++ b/resources/ApiUtils/TemporalContextInformationConsumption.resource @@ -198,6 +198,7 @@ Retrieve Temporal Representation Of Entity ... ${accept}=${EMPTY} ... ${aggrMethods}=${EMPTY} ... ${aggrPeriodDuration}=${EMPTY} + ... ${timeproperty}=${EMPTY} ${attrs_length}= Get Length ${attrs} ${options_length}= Get Length ${options} &{headers}= Create Dictionary @@ -227,6 +228,9 @@ Retrieve Temporal Representation Of Entity IF '${aggrPeriodDuration}'!='' Set To Dictionary ${params} aggrPeriodDuration=${aggrPeriodDuration} END + IF '${timeproperty}'!='' + Set To Dictionary ${params} timeproperty=${timeproperty} + END ${response}= GET ... url=${temporal_api_url}/${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id} diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index b6754cdc7..708b42c89 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -191,17 +191,18 @@ Check Response Body Containing List Containing Entity Elements With Different Ty Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} Check Response Body Containing EntityTemporal element - [Arguments] ${filename} ${temporal_entity_representation_id} ${response_body} + [Arguments] ${filename} ${temporal_entity_representation_id} ${response_body} ${excluded_regex}=${None} ${temporal_entity_representation_payload}= Load JSON From File ... ${EXECDIR}/data/temporalEntities/expectations/${filename} + ${all_excluded_regex}= Create List ${instance_id_regex_expr} ${excluded_regex} ${temporal_entity_representation}= Update Value To JSON ... ${temporal_entity_representation_payload} - ... $..id + ... $.id ... ${temporal_entity_representation_id} ${comparison_result}= Compare Dictionaries Ignoring Keys ... ${temporal_entity_representation} ... ${response_body} - ... ${instance_id_regex_expr} + ... ${all_excluded_regex} Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} Check Response Body Containing List Containing EntityTemporal elements -- GitLab From 9ad3ccc285499ae7129c26253404da4bec891f02 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Thu, 16 Jan 2025 09:56:21 +0100 Subject: [PATCH 2/9] feat: add TCs for deletedAt in simplified temporal representation --- .../020_18.robot | 69 ++++++++++++++++ ...resentation-languageproperty-020-18.jsonld | 25 ++++++ ...lues-representation-property-020-18.jsonld | 21 +++++ ...-representation-relationship-020-18.jsonld | 21 +++++ .../Consumption/020_18.json | 79 +++++++++++++++++++ resources/AssertionUtils.resource | 11 ++- 6 files changed, 224 insertions(+), 2 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_18.robot create mode 100644 data/temporalEntities/expectations/vehicle-temporal-values-representation-languageproperty-020-18.jsonld create mode 100644 data/temporalEntities/expectations/vehicle-temporal-values-representation-property-020-18.jsonld create mode 100644 data/temporalEntities/expectations/vehicle-temporal-values-representation-relationship-020-18.jsonld create mode 100644 doc/files/ContextInformation/Consumption/020_18.json diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_18.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_18.robot new file mode 100644 index 000000000..71ad4dc79 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_18.robot @@ -0,0 +1,69 @@ +*** Settings *** +Documentation Check that one can retrieve the temporal evolution of an entity following the deletedAt temporal property with temporal values + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Temporal Entity +Test Teardown Delete Initial Temporal Entity +Test Template Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= vehicle-temporal-representation-different-attributes-types.jsonld + + +*** Test Cases *** ATTR_NAME SIMPLIFIED_TEMPORAL_KEY EXPECTATION_FILENAME +020_18_01 With a Property + [Tags] te-retrieve 5_7_3 since_v1.6.1 + fuelLevel values vehicle-temporal-values-representation-property-020-18.jsonld +020_18_02 With a Relationship + [Tags] te-retrieve 5_7_3 since_v1.6.1 + isParkedIn objects vehicle-temporal-values-representation-relationship-020-18.jsonld +020_18_03 With a LanguageProperty + [Tags] te-retrieve 5_7_3 4_5_18 since_v1.6.1 + name languageMaps vehicle-temporal-values-representation-languageproperty-020-18.jsonld + + +*** Keywords *** +Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute + [Documentation] Check that one can retrieve the temporal evolution of an entity following the deletedAt temporal property with temporal values + [Arguments] ${attr_name} ${simplified_temporal_key} ${expectation_filename} + ${response}= Delete Entity Attributes + ... entityId=${temporal_entity_representation_id} + ... attributeId=${attr_name} + ... datasetId=${EMPTY} + ... deleteAll=false + ... context=${ngsild_test_suite_context} + + ${response2}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... timeproperty=deletedAt + ... options=temporalValues + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response2.status_code} + # Ignore the deletedAt value when checking the response body + Check Response Body Containing EntityTemporal element + ... filename=${expectation_filename} + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... response_body=${response2.json()} + ... excluded_regex=root\\['${attr_name}'\\]\\['${simplified_temporal_key}'\\]\\[0\\]\\[1\\] + # Check the deletedAt value is present in the response body + Should Have Value In Json + ... json_object=${response2.json()} + ... json_path=['${attr_name}']['${simplified_temporal_key}'][0][1] + +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${create_response}= Create Temporal Representation Of Entity + ... ${vehicle_payload_file} + ... ${temporal_entity_representation_id} + Check Response Status Code 201 ${create_response.status_code} + Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/data/temporalEntities/expectations/vehicle-temporal-values-representation-languageproperty-020-18.jsonld b/data/temporalEntities/expectations/vehicle-temporal-values-representation-languageproperty-020-18.jsonld new file mode 100644 index 000000000..b0954e0db --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-values-representation-languageproperty-020-18.jsonld @@ -0,0 +1,25 @@ +{ + "id": "urn:ngsi-ld:Vehicle:4537446855480368", + "type": "Vehicle", + "name": { + "type": "LanguageProperty", + "languageMaps": [ + [ + { + "languageMap": { + "@none": "urn:ngsi-ld:null" + } + }, + "2024-12-11T16:21:08.388531Z" + ] + ] + }, + "fuelLevel": { + "type": "Property", + "values": [] + }, + "isParkedIn": { + "type": "Relationship", + "objects": [] + } +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-values-representation-property-020-18.jsonld b/data/temporalEntities/expectations/vehicle-temporal-values-representation-property-020-18.jsonld new file mode 100644 index 000000000..ab89abcb1 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-values-representation-property-020-18.jsonld @@ -0,0 +1,21 @@ +{ + "id": "urn:ngsi-ld:Vehicle:7616794302108220", + "type": "Vehicle", + "fuelLevel": { + "type": "Property", + "values": [ + [ + "urn:ngsi-ld:null", + "2024-12-11T15:19:24.514781Z" + ] + ] + }, + "isParkedIn": { + "type": "Relationship", + "objects": [] + }, + "name": { + "type": "LanguageProperty", + "languageMaps": [] + } +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-values-representation-relationship-020-18.jsonld b/data/temporalEntities/expectations/vehicle-temporal-values-representation-relationship-020-18.jsonld new file mode 100644 index 000000000..7ae19b047 --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-values-representation-relationship-020-18.jsonld @@ -0,0 +1,21 @@ +{ + "id": "urn:ngsi-ld:Vehicle:3894486412971043", + "type": "Vehicle", + "isParkedIn": { + "type": "Relationship", + "objects": [ + [ + "urn:ngsi-ld:null", + "2024-12-11T15:19:24.696152Z" + ] + ] + }, + "name": { + "type": "LanguageProperty", + "languageMaps": [] + }, + "fuelLevel": { + "type": "Property", + "values": [] + } +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/020_18.json b/doc/files/ContextInformation/Consumption/020_18.json new file mode 100644 index 000000000..27a51be27 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_18.json @@ -0,0 +1,79 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_18", + "test_objective": "Check that one can retrieve the temporal evolution of an entity following the deletedAt temporal property with temporal values", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 5.7.3", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.18", + "5.7.3" + ], + "pics_selection": "", + "keywords": [ + "Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute", + "Create Temporal Entity", + "Delete Initial Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n}", + "test_cases": [ + { + "name": "020_18_01 With a Property", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_18_01", + "doc": "Check that one can retrieve the temporal evolution of an entity following the deletedAt temporal property with temporal values", + "tags": [ + "5_7_3", + "since_v1.6.1", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-values-representation-property-020-18.jsonld'\n * the id was changed to 'temporal_entity_representation_id=${temporal_entity_representation_id}'\n * response body to be checked set to 'response_body=${response2.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to 'fuelLevel' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "020_18_02 With a Relationship", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_18_02", + "doc": "Check that one can retrieve the temporal evolution of an entity following the deletedAt temporal property with temporal values", + "tags": [ + "5_7_3", + "since_v1.6.1", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-values-representation-relationship-020-18.jsonld'\n * the id was changed to 'temporal_entity_representation_id=${temporal_entity_representation_id}'\n * response body to be checked set to 'response_body=${response2.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to 'isParkedIn' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + }, + { + "name": "020_18_03 With a LanguageProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_18_03", + "doc": "Check that one can retrieve the temporal evolution of an entity following the deletedAt temporal property with temporal values", + "tags": [ + "4_5_18", + "5_7_3", + "since_v1.6.1", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-values-representation-languageproperty-020-18.jsonld'\n * the id was changed to 'temporal_entity_representation_id=${temporal_entity_representation_id}'\n * response body to be checked set to 'response_body=${response2.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to 'name' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_18" +} \ No newline at end of file diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 708b42c89..bc570ecc2 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -191,10 +191,17 @@ Check Response Body Containing List Containing Entity Elements With Different Ty Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} Check Response Body Containing EntityTemporal element - [Arguments] ${filename} ${temporal_entity_representation_id} ${response_body} ${excluded_regex}=${None} + [Arguments] + ... ${filename} + ... ${temporal_entity_representation_id} + ... ${response_body} + ... ${excluded_regex}=${EMPTY} ${temporal_entity_representation_payload}= Load JSON From File ... ${EXECDIR}/data/temporalEntities/expectations/${filename} - ${all_excluded_regex}= Create List ${instance_id_regex_expr} ${excluded_regex} + ${all_excluded_regex}= Create List ${instance_id_regex_expr} + IF $excluded_regex != '' + Append To List ${all_excluded_regex} ${excluded_regex} + END ${temporal_entity_representation}= Update Value To JSON ... ${temporal_entity_representation_payload} ... $.id -- GitLab From 783edafdd15059cd104d71c4b3d6104a97494f37 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Thu, 16 Jan 2025 10:00:50 +0100 Subject: [PATCH 3/9] feat: add TCs for NGSI-LD Null in Merge Entity operation --- .../Entities/MergeEntity/060_01.robot | 60 ++++++++++ .../Entities/MergeEntity/060_02.robot | 60 ++++++++++ .../Entities/MergeEntity/060_03.robot | 60 ++++++++++ .../Entities/MergeEntity/060_04.robot | 60 ++++++++++ .../merge/building-attributes-edited.jsonld | 23 ++++ ...eleted-geoproperty-default-instance.jsonld | 55 +++++++++ ...ilding-deleted-geoproperty-instance.jsonld | 58 ++++++++++ .../merge/building-deleted-geoproperty.jsonld | 20 ++++ ...d-languageproperty-default-instance.jsonld | 58 ++++++++++ ...g-deleted-languageproperty-instance.jsonld | 61 ++++++++++ .../building-deleted-languageproperty.jsonld | 23 ++++ ...g-deleted-property-default-instance.jsonld | 61 ++++++++++ .../building-deleted-property-instance.jsonld | 64 +++++++++++ .../merge/building-deleted-property.jsonld | 26 +++++ ...leted-relationship-default-instance.jsonld | 61 ++++++++++ ...lding-deleted-relationship-instance.jsonld | 64 +++++++++++ .../building-deleted-relationship.jsonld | 26 +++++ .../merge/building-non-edited.jsonld | 23 ++++ ...ilding-with-changed-airQualityLevel.jsonld | 23 ++++ .../merge/building-with-relationship.jsonld | 27 +++++ .../building-null-geoproperty-instance.jsonld | 10 ++ .../merge/building-null-geoproperty.jsonld | 9 ++ ...ding-null-languageproperty-instance.jsonld | 12 ++ .../building-null-languageproperty.jsonld | 11 ++ .../building-null-property-instance.jsonld | 10 ++ .../merge/building-null-property.jsonld | 9 ++ ...building-null-relationship-instance.jsonld | 10 ++ .../merge/building-null-relationship.jsonld | 9 ++ ...rent-attributes-instances-and-types.jsonld | 71 ++++++++++++ ...building-different-attributes-types.jsonld | 30 +++++ ...ault-attributes-instances-and-types.jsonld | 67 +++++++++++ doc/analysis/generaterobotdata.py | 1 + doc/analysis/requests.py | 31 +++++ .../ContextInformation/Provision/060_01.json | 99 ++++++++++++++++ .../ContextInformation/Provision/060_02.json | 101 +++++++++++++++++ .../ContextInformation/Provision/060_03.json | 106 ++++++++++++++++++ .../ContextInformation/Provision/060_04.json | 106 ++++++++++++++++++ .../test_ContextInformation_Provision.py | 28 +++++ .../ContextInformationProvision.resource | 22 ++++ 39 files changed, 1655 insertions(+) create mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_01.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_02.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_03.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_04.robot create mode 100644 data/entities/expectations/merge/building-attributes-edited.jsonld create mode 100644 data/entities/expectations/merge/building-deleted-geoproperty-default-instance.jsonld create mode 100644 data/entities/expectations/merge/building-deleted-geoproperty-instance.jsonld create mode 100644 data/entities/expectations/merge/building-deleted-geoproperty.jsonld create mode 100644 data/entities/expectations/merge/building-deleted-languageproperty-default-instance.jsonld create mode 100644 data/entities/expectations/merge/building-deleted-languageproperty-instance.jsonld create mode 100644 data/entities/expectations/merge/building-deleted-languageproperty.jsonld create mode 100644 data/entities/expectations/merge/building-deleted-property-default-instance.jsonld create mode 100644 data/entities/expectations/merge/building-deleted-property-instance.jsonld create mode 100644 data/entities/expectations/merge/building-deleted-property.jsonld create mode 100644 data/entities/expectations/merge/building-deleted-relationship-default-instance.jsonld create mode 100644 data/entities/expectations/merge/building-deleted-relationship-instance.jsonld create mode 100644 data/entities/expectations/merge/building-deleted-relationship.jsonld create mode 100644 data/entities/expectations/merge/building-non-edited.jsonld create mode 100644 data/entities/expectations/merge/building-with-changed-airQualityLevel.jsonld create mode 100644 data/entities/expectations/merge/building-with-relationship.jsonld create mode 100644 data/entities/fragmentEntities/merge/building-null-geoproperty-instance.jsonld create mode 100644 data/entities/fragmentEntities/merge/building-null-geoproperty.jsonld create mode 100644 data/entities/fragmentEntities/merge/building-null-languageproperty-instance.jsonld create mode 100644 data/entities/fragmentEntities/merge/building-null-languageproperty.jsonld create mode 100644 data/entities/fragmentEntities/merge/building-null-property-instance.jsonld create mode 100644 data/entities/fragmentEntities/merge/building-null-property.jsonld create mode 100644 data/entities/fragmentEntities/merge/building-null-relationship-instance.jsonld create mode 100644 data/entities/fragmentEntities/merge/building-null-relationship.jsonld create mode 100644 data/entities/merge/building-different-attributes-instances-and-types.jsonld create mode 100644 data/entities/merge/building-different-attributes-types.jsonld create mode 100644 data/entities/merge/building-different-default-attributes-instances-and-types.jsonld create mode 100644 doc/files/ContextInformation/Provision/060_01.json create mode 100644 doc/files/ContextInformation/Provision/060_02.json create mode 100644 doc/files/ContextInformation/Provision/060_03.json create mode 100644 doc/files/ContextInformation/Provision/060_04.json diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_01.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_01.robot new file mode 100644 index 000000000..3d020de73 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_01.robot @@ -0,0 +1,60 @@ +*** Settings *** +Documentation Check that one can merge an entity + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Merge Entity Scenarios + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${entity_payload_filename}= merge/building-merge-data.jsonld + + +*** Test Cases *** FILENAME EXPECTATION_FILENAME +060_01_01 MergeAnEmptyEntity + [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 + building-minimal.jsonld merge/building-non-edited.jsonld +060_01_02 MergeSimpleProperties + [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 + building-simple-attributes-second.jsonld merge/building-attributes-edited.jsonld +060_01_03 MergeSimpleRelationship + [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 + building-relationship.jsonld merge/building-with-relationship.jsonld +060_01_04 MergePropertyWithPartialData + [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 + merge/building-only-airQualityLevel-value.jsonld merge/building-with-changed-airQualityLevel.jsonld + + +*** Keywords *** +Merge Entity Scenarios + [Documentation] Check that one can merge an entity + [Arguments] ${filename} ${expectation_filename} + ${first_entity}= Load Entity ${filename} ${entity_id} + ${response}= Merge Entity + ... entity_id=${entity_id} + ... entity_fragment=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${response1}= Query Entity + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Body Containing Entity element + ... expectation_filename=${expectation_filename} + ... entity_id=${entity_id} + ... response_body=${response1.json()} + +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity ${entity_payload_filename} ${entity_id} + Set Test Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_02.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_02.robot new file mode 100644 index 000000000..815324b51 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_02.robot @@ -0,0 +1,60 @@ +*** Settings *** +Documentation Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Merge Entity Scenarios + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${entity_payload_filename}= merge/building-different-attributes-types.jsonld + + +*** Test Cases *** FILENAME EXPECTATION_FILENAME +060_02_01 Delete a Property + [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 + fragmentEntities/merge/building-null-property.jsonld merge/building-deleted-property.jsonld +060_02_02 Delete a Relationship + [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 + fragmentEntities/merge/building-null-relationship.jsonld merge/building-deleted-relationship.jsonld +060_02_03 Delete a GeoProperty + [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 + fragmentEntities/merge/building-null-geoproperty.jsonld merge/building-deleted-geoproperty.jsonld +060_02_04 Delete a LanguageProperty + [Tags] be-merge 5_6_17 6_5_3_4 4_5_18 since_v1.6.1 + fragmentEntities/merge/building-null-languageproperty.jsonld merge/building-deleted-languageproperty.jsonld + + +*** Keywords *** +Merge Entity Scenarios + [Documentation] Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation + [Arguments] ${filename} ${expectation_filename} + ${first_entity}= Load Entity ${filename} ${entity_id} + ${response}= Merge Entity + ... entity_id=${entity_id} + ... entity_fragment=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${response1}= Query Entity + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Body Containing Entity element + ... expectation_filename=${expectation_filename} + ... entity_id=${entity_id} + ... response_body=${response1.json()} + +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity ${entity_payload_filename} ${entity_id} + Set Test Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_03.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_03.robot new file mode 100644 index 000000000..f06a6ab7f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_03.robot @@ -0,0 +1,60 @@ +*** Settings *** +Documentation Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Merge Entity Scenarios + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${entity_payload_filename}= merge/building-different-attributes-instances-and-types.jsonld + + +*** Test Cases *** FILENAME EXPECTATION_FILENAME +060_03_01 Delete a Property instance + [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 + fragmentEntities/merge/building-null-property-instance.jsonld merge/building-deleted-property-instance.jsonld +060_03_02 Delete a Relationship instance + [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 + fragmentEntities/merge/building-null-relationship-instance.jsonld merge/building-deleted-relationship-instance.jsonld +060_03_03 Delete a GeoProperty instance + [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 + fragmentEntities/merge/building-null-geoproperty-instance.jsonld merge/building-deleted-geoproperty-instance.jsonld +060_03_04 Delete a LanguageProperty instance + [Tags] be-merge 5_6_17 6_5_3_4 4_5_18 4_5_5 since_v1.6.1 + fragmentEntities/merge/building-null-languageproperty-instance.jsonld merge/building-deleted-languageproperty-instance.jsonld + + +*** Keywords *** +Merge Entity Scenarios + [Documentation] Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation + [Arguments] ${filename} ${expectation_filename} + ${first_entity}= Load Entity ${filename} ${entity_id} + ${response}= Merge Entity + ... entity_id=${entity_id} + ... entity_fragment=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${response1}= Query Entity + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Body Containing Entity element + ... expectation_filename=${expectation_filename} + ... entity_id=${entity_id} + ... response_body=${response1.json()} + +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity ${entity_payload_filename} ${entity_id} + Set Test Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_04.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_04.robot new file mode 100644 index 000000000..37a91e38f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_04.robot @@ -0,0 +1,60 @@ +*** Settings *** +Documentation Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Merge Entity Scenarios + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${entity_payload_filename}= merge/building-different-default-attributes-instances-and-types.jsonld + + +*** Test Cases *** FILENAME EXPECTATION_FILENAME +060_04_01 Delete a Property instance + [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 + fragmentEntities/merge/building-null-property.jsonld merge/building-deleted-property-default-instance.jsonld +060_04_02 Delete a Relationship instance + [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 + fragmentEntities/merge/building-null-relationship.jsonld merge/building-deleted-relationship-default-instance.jsonld +060_04_03 Delete a GeoProperty instance + [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 + fragmentEntities/merge/building-null-geoproperty.jsonld merge/building-deleted-geoproperty-default-instance.jsonld +060_04_04 Delete a LanguageProperty instance + [Tags] be-merge 5_6_17 6_5_3_4 4_5_18 4_5_5 since_v1.6.1 + fragmentEntities/merge/building-null-languageproperty.jsonld merge/building-deleted-languageproperty-default-instance.jsonld + + +*** Keywords *** +Merge Entity Scenarios + [Documentation] Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation + [Arguments] ${filename} ${expectation_filename} + ${first_entity}= Load Entity ${filename} ${entity_id} + ${response}= Merge Entity + ... entity_id=${entity_id} + ... entity_fragment=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${response1}= Query Entity + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Body Containing Entity element + ... expectation_filename=${expectation_filename} + ... entity_id=${entity_id} + ... response_body=${response1.json()} + +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity ${entity_payload_filename} ${entity_id} + Set Test Variable ${entity_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/data/entities/expectations/merge/building-attributes-edited.jsonld b/data/entities/expectations/merge/building-attributes-edited.jsonld new file mode 100644 index 000000000..d517227c7 --- /dev/null +++ b/data/entities/expectations/merge/building-attributes-edited.jsonld @@ -0,0 +1,23 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "Pisa Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "airQualityLevel": { + "type": "Property", + "value": 6, + "unitCode": "C62", + "observedAt": "2020-10-10T16:40:00.000Z" + }, + "almostFull": { + "type": "Property", + "value": true + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} \ No newline at end of file diff --git a/data/entities/expectations/merge/building-deleted-geoproperty-default-instance.jsonld b/data/entities/expectations/merge/building-deleted-geoproperty-default-instance.jsonld new file mode 100644 index 000000000..20d7c7357 --- /dev/null +++ b/data/entities/expectations/merge/building-deleted-geoproperty-default-instance.jsonld @@ -0,0 +1,55 @@ +{ + "id": "urn:ngsi-ld:Building:9515150307734355", + "type": "Building", + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.3514, + 48.8575 + ] + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + "name": [ + { + "type": "Property", + "value": "Eiffel Tower", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "Property", + "value": "The iron lady" + } + ], + "street": [ + { + "type": "LanguageProperty", + "datasetId": "urn:ngsi-ld:Dataset:01", + "languageMap": { + "fr": "Jardin de la Tour Eiffel", + "en": "Eiffel Tower Garden" + } + }, + { + "type": "LanguageProperty", + "languageMap": { + "fr": "Avenue Gustave Eiffel", + "en": "Avenue Gustave Eiffel" + } + } + ], + "locatedAt": [ + { + "type": "Relationship", + "datasetId": "urn:ngsi-ld:Dataset:01", + "object": "urn:ngsi-ld:City:Paris" + }, + { + "type": "Relationship", + "object": "urn:ngsi-ld:District:Paris:08" + } + ], + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} \ No newline at end of file diff --git a/data/entities/expectations/merge/building-deleted-geoproperty-instance.jsonld b/data/entities/expectations/merge/building-deleted-geoproperty-instance.jsonld new file mode 100644 index 000000000..18cfe269e --- /dev/null +++ b/data/entities/expectations/merge/building-deleted-geoproperty-instance.jsonld @@ -0,0 +1,58 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": [ + { + "type": "Property", + "value": "Eiffel Tower", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "Property", + "value": "The iron lady", + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "locatedAt": [ + { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "Relationship", + "object": "urn:ngsi-ld:District:Paris:08", + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.2944, + 48.8585 + ] + }, + "datasetId": "urn:ngsi-ld:Dataset:02" + }, + "street": [ + { + "type": "LanguageProperty", + "languageMap": { + "fr": "Jardin de la Tour Eiffel", + "en": "Eiffel Tower Garden" + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "LanguageProperty", + "languageMap": { + "fr": "Avenue Gustave Eiffel", + "en": "Avenue Gustave Eiffel" + }, + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/expectations/merge/building-deleted-geoproperty.jsonld b/data/entities/expectations/merge/building-deleted-geoproperty.jsonld new file mode 100644 index 000000000..2107e51a9 --- /dev/null +++ b/data/entities/expectations/merge/building-deleted-geoproperty.jsonld @@ -0,0 +1,20 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris" + }, + "street": { + "type": "LanguageProperty", + "languageMap": { + "fr": "Grand Place", + "nl": "Grote Markt" + } + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/expectations/merge/building-deleted-languageproperty-default-instance.jsonld b/data/entities/expectations/merge/building-deleted-languageproperty-default-instance.jsonld new file mode 100644 index 000000000..fb9ba985b --- /dev/null +++ b/data/entities/expectations/merge/building-deleted-languageproperty-default-instance.jsonld @@ -0,0 +1,58 @@ +{ + "id": "urn:ngsi-ld:Building:6714892315708870", + "type": "Building", + "location": [ + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.3514, + 48.8575 + ] + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.2944, + 48.8585 + ] + } + } + ], + "name": [ + { + "type": "Property", + "value": "Eiffel Tower", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "Property", + "value": "The iron lady" + } + ], + "street": { + "type": "LanguageProperty", + "datasetId": "urn:ngsi-ld:Dataset:01", + "languageMap": { + "fr": "Jardin de la Tour Eiffel", + "en": "Eiffel Tower Garden" + } + }, + "locatedAt": [ + { + "type": "Relationship", + "datasetId": "urn:ngsi-ld:Dataset:01", + "object": "urn:ngsi-ld:City:Paris" + }, + { + "type": "Relationship", + "object": "urn:ngsi-ld:District:Paris:08" + } + ], + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} \ No newline at end of file diff --git a/data/entities/expectations/merge/building-deleted-languageproperty-instance.jsonld b/data/entities/expectations/merge/building-deleted-languageproperty-instance.jsonld new file mode 100644 index 000000000..386c940f6 --- /dev/null +++ b/data/entities/expectations/merge/building-deleted-languageproperty-instance.jsonld @@ -0,0 +1,61 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": [ + { + "type": "Property", + "value": "Eiffel Tower", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "Property", + "value": "The iron lady", + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "locatedAt": [ + { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "Relationship", + "object": "urn:ngsi-ld:District:Paris:08", + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "location": [ + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.3514, + 48.8575 + ] + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.2944, + 48.8585 + ] + }, + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "street": { + "type": "LanguageProperty", + "languageMap": { + "fr": "Avenue Gustave Eiffel", + "en": "Avenue Gustave Eiffel" + }, + "datasetId": "urn:ngsi-ld:Dataset:02" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/expectations/merge/building-deleted-languageproperty.jsonld b/data/entities/expectations/merge/building-deleted-languageproperty.jsonld new file mode 100644 index 000000000..25c735136 --- /dev/null +++ b/data/entities/expectations/merge/building-deleted-languageproperty.jsonld @@ -0,0 +1,23 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris" + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + -8.5, + 41.2 + ] + } + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/expectations/merge/building-deleted-property-default-instance.jsonld b/data/entities/expectations/merge/building-deleted-property-default-instance.jsonld new file mode 100644 index 000000000..0c7b3c5c1 --- /dev/null +++ b/data/entities/expectations/merge/building-deleted-property-default-instance.jsonld @@ -0,0 +1,61 @@ +{ + "id": "urn:ngsi-ld:Building:5130936833350484", + "type": "Building", + "location": [ + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.3514, + 48.8575 + ] + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.2944, + 48.8585 + ] + } + } + ], + "name": { + "type": "Property", + "value": "Eiffel Tower", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + "street": [ + { + "type": "LanguageProperty", + "datasetId": "urn:ngsi-ld:Dataset:01", + "languageMap": { + "fr": "Jardin de la Tour Eiffel", + "en": "Eiffel Tower Garden" + } + }, + { + "type": "LanguageProperty", + "languageMap": { + "fr": "Avenue Gustave Eiffel", + "en": "Avenue Gustave Eiffel" + } + } + ], + "locatedAt": [ + { + "type": "Relationship", + "datasetId": "urn:ngsi-ld:Dataset:01", + "object": "urn:ngsi-ld:City:Paris" + }, + { + "type": "Relationship", + "object": "urn:ngsi-ld:District:Paris:08" + } + ], + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} \ No newline at end of file diff --git a/data/entities/expectations/merge/building-deleted-property-instance.jsonld b/data/entities/expectations/merge/building-deleted-property-instance.jsonld new file mode 100644 index 000000000..476c3735e --- /dev/null +++ b/data/entities/expectations/merge/building-deleted-property-instance.jsonld @@ -0,0 +1,64 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "The iron lady", + "datasetId": "urn:ngsi-ld:Dataset:02" + }, + "locatedAt": [ + { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "Relationship", + "object": "urn:ngsi-ld:District:Paris:08", + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "location": [ + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.3514, + 48.8575 + ] + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.2944, + 48.8585 + ] + }, + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "street": [ + { + "type": "LanguageProperty", + "languageMap": { + "fr": "Jardin de la Tour Eiffel", + "en": "Eiffel Tower Garden" + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "LanguageProperty", + "languageMap": { + "fr": "Avenue Gustave Eiffel", + "en": "Avenue Gustave Eiffel" + }, + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/expectations/merge/building-deleted-property.jsonld b/data/entities/expectations/merge/building-deleted-property.jsonld new file mode 100644 index 000000000..a7ca1ece1 --- /dev/null +++ b/data/entities/expectations/merge/building-deleted-property.jsonld @@ -0,0 +1,26 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris" + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + -8.5, + 41.2 + ] + } + }, + "street": { + "type": "LanguageProperty", + "languageMap": { + "fr": "Grand Place", + "nl": "Grote Markt" + } + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/expectations/merge/building-deleted-relationship-default-instance.jsonld b/data/entities/expectations/merge/building-deleted-relationship-default-instance.jsonld new file mode 100644 index 000000000..8bf48529e --- /dev/null +++ b/data/entities/expectations/merge/building-deleted-relationship-default-instance.jsonld @@ -0,0 +1,61 @@ +{ + "id": "urn:ngsi-ld:Building:6038695373002945", + "type": "Building", + "location": [ + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.3514, + 48.8575 + ] + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.2944, + 48.8585 + ] + } + } + ], + "name": [ + { + "type": "Property", + "value": "Eiffel Tower", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "Property", + "value": "The iron lady" + } + ], + "street": [ + { + "type": "LanguageProperty", + "datasetId": "urn:ngsi-ld:Dataset:01", + "languageMap": { + "fr": "Jardin de la Tour Eiffel", + "en": "Eiffel Tower Garden" + } + }, + { + "type": "LanguageProperty", + "languageMap": { + "fr": "Avenue Gustave Eiffel", + "en": "Avenue Gustave Eiffel" + } + } + ], + "locatedAt": { + "type": "Relationship", + "datasetId": "urn:ngsi-ld:Dataset:01", + "object": "urn:ngsi-ld:City:Paris" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} \ No newline at end of file diff --git a/data/entities/expectations/merge/building-deleted-relationship-instance.jsonld b/data/entities/expectations/merge/building-deleted-relationship-instance.jsonld new file mode 100644 index 000000000..56bd06cfe --- /dev/null +++ b/data/entities/expectations/merge/building-deleted-relationship-instance.jsonld @@ -0,0 +1,64 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": [ + { + "type": "Property", + "value": "Eiffel Tower", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "Property", + "value": "The iron lady", + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:District:Paris:08", + "datasetId": "urn:ngsi-ld:Dataset:02" + }, + "location": [ + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.3514, + 48.8575 + ] + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.2944, + 48.8585 + ] + }, + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "street": [ + { + "type": "LanguageProperty", + "languageMap": { + "fr": "Jardin de la Tour Eiffel", + "en": "Eiffel Tower Garden" + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "LanguageProperty", + "languageMap": { + "fr": "Avenue Gustave Eiffel", + "en": "Avenue Gustave Eiffel" + }, + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/expectations/merge/building-deleted-relationship.jsonld b/data/entities/expectations/merge/building-deleted-relationship.jsonld new file mode 100644 index 000000000..392cbeb22 --- /dev/null +++ b/data/entities/expectations/merge/building-deleted-relationship.jsonld @@ -0,0 +1,26 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + -8.5, + 41.2 + ] + } + }, + "street": { + "type": "LanguageProperty", + "languageMap": { + "fr": "Grand Place", + "nl": "Grote Markt" + } + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/expectations/merge/building-non-edited.jsonld b/data/entities/expectations/merge/building-non-edited.jsonld new file mode 100644 index 000000000..3270014f0 --- /dev/null +++ b/data/entities/expectations/merge/building-non-edited.jsonld @@ -0,0 +1,23 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "airQualityLevel": { + "type": "Property", + "value": 4, + "unitCode": "C62", + "observedAt": "2020-09-09T16:40:00.000Z" + }, + "almostFull": { + "type": "Property", + "value": false + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} \ No newline at end of file diff --git a/data/entities/expectations/merge/building-with-changed-airQualityLevel.jsonld b/data/entities/expectations/merge/building-with-changed-airQualityLevel.jsonld new file mode 100644 index 000000000..7974c64e0 --- /dev/null +++ b/data/entities/expectations/merge/building-with-changed-airQualityLevel.jsonld @@ -0,0 +1,23 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "airQualityLevel": { + "type": "Property", + "unitCode": "C62", + "value": 1, + "observedAt": "2024-01-01T00:00:00.000Z" + }, + "almostFull": { + "type": "Property", + "value": false + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} \ No newline at end of file diff --git a/data/entities/expectations/merge/building-with-relationship.jsonld b/data/entities/expectations/merge/building-with-relationship.jsonld new file mode 100644 index 000000000..f5dbc7672 --- /dev/null +++ b/data/entities/expectations/merge/building-with-relationship.jsonld @@ -0,0 +1,27 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "airQualityLevel": { + "type": "Property", + "value": 4, + "unitCode": "C62", + "observedAt": "2020-09-09T16:40:00.000Z" + }, + "almostFull": { + "type": "Property", + "value": false + }, + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} \ No newline at end of file diff --git a/data/entities/fragmentEntities/merge/building-null-geoproperty-instance.jsonld b/data/entities/fragmentEntities/merge/building-null-geoproperty-instance.jsonld new file mode 100644 index 000000000..0655bdf59 --- /dev/null +++ b/data/entities/fragmentEntities/merge/building-null-geoproperty-instance.jsonld @@ -0,0 +1,10 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "location": { + "type": "GeoProperty", + "value": "urn:ngsi-ld:null", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/fragmentEntities/merge/building-null-geoproperty.jsonld b/data/entities/fragmentEntities/merge/building-null-geoproperty.jsonld new file mode 100644 index 000000000..5892343a8 --- /dev/null +++ b/data/entities/fragmentEntities/merge/building-null-geoproperty.jsonld @@ -0,0 +1,9 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "location": { + "type": "GeoProperty", + "value": "urn:ngsi-ld:null" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/fragmentEntities/merge/building-null-languageproperty-instance.jsonld b/data/entities/fragmentEntities/merge/building-null-languageproperty-instance.jsonld new file mode 100644 index 000000000..e46b1cf8c --- /dev/null +++ b/data/entities/fragmentEntities/merge/building-null-languageproperty-instance.jsonld @@ -0,0 +1,12 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "street": { + "type": "LanguageProperty", + "languageMap": { + "@none": "urn:ngsi-ld:null" + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/fragmentEntities/merge/building-null-languageproperty.jsonld b/data/entities/fragmentEntities/merge/building-null-languageproperty.jsonld new file mode 100644 index 000000000..1bdc9dc92 --- /dev/null +++ b/data/entities/fragmentEntities/merge/building-null-languageproperty.jsonld @@ -0,0 +1,11 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "street": { + "type": "LanguageProperty", + "languageMap": { + "@none": "urn:ngsi-ld:null" + } + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/fragmentEntities/merge/building-null-property-instance.jsonld b/data/entities/fragmentEntities/merge/building-null-property-instance.jsonld new file mode 100644 index 000000000..647d12271 --- /dev/null +++ b/data/entities/fragmentEntities/merge/building-null-property-instance.jsonld @@ -0,0 +1,10 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "urn:ngsi-ld:null", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/fragmentEntities/merge/building-null-property.jsonld b/data/entities/fragmentEntities/merge/building-null-property.jsonld new file mode 100644 index 000000000..cba5e874c --- /dev/null +++ b/data/entities/fragmentEntities/merge/building-null-property.jsonld @@ -0,0 +1,9 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "urn:ngsi-ld:null" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/fragmentEntities/merge/building-null-relationship-instance.jsonld b/data/entities/fragmentEntities/merge/building-null-relationship-instance.jsonld new file mode 100644 index 000000000..021291f00 --- /dev/null +++ b/data/entities/fragmentEntities/merge/building-null-relationship-instance.jsonld @@ -0,0 +1,10 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:null", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/fragmentEntities/merge/building-null-relationship.jsonld b/data/entities/fragmentEntities/merge/building-null-relationship.jsonld new file mode 100644 index 000000000..1fc9f5d85 --- /dev/null +++ b/data/entities/fragmentEntities/merge/building-null-relationship.jsonld @@ -0,0 +1,9 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:null" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/merge/building-different-attributes-instances-and-types.jsonld b/data/entities/merge/building-different-attributes-instances-and-types.jsonld new file mode 100644 index 000000000..68ac0f1dc --- /dev/null +++ b/data/entities/merge/building-different-attributes-instances-and-types.jsonld @@ -0,0 +1,71 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": [ + { + "type": "Property", + "value": "Eiffel Tower", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "Property", + "value": "The iron lady", + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "locatedAt": [ + { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "Relationship", + "object": "urn:ngsi-ld:District:Paris:08", + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "location": [ + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.3514, + 48.8575 + ] + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.2944, + 48.8585 + ] + }, + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "street": [ + { + "type": "LanguageProperty", + "languageMap": { + "fr": "Jardin de la Tour Eiffel", + "en": "Eiffel Tower Garden" + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "LanguageProperty", + "languageMap": { + "fr": "Avenue Gustave Eiffel", + "en": "Avenue Gustave Eiffel" + }, + "datasetId": "urn:ngsi-ld:Dataset:02" + } + ], + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/merge/building-different-attributes-types.jsonld b/data/entities/merge/building-different-attributes-types.jsonld new file mode 100644 index 000000000..6102b5694 --- /dev/null +++ b/data/entities/merge/building-different-attributes-types.jsonld @@ -0,0 +1,30 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "type": "Property", + "value": "Eiffel Tower" + }, + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris" + }, + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + -8.5, + 41.2 + ] + } + }, + "street": { + "type": "LanguageProperty", + "languageMap": { + "fr": "Grand Place", + "nl": "Grote Markt" + } + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/merge/building-different-default-attributes-instances-and-types.jsonld b/data/entities/merge/building-different-default-attributes-instances-and-types.jsonld new file mode 100644 index 000000000..79c0355b1 --- /dev/null +++ b/data/entities/merge/building-different-default-attributes-instances-and-types.jsonld @@ -0,0 +1,67 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": [ + { + "type": "Property", + "value": "Eiffel Tower", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "Property", + "value": "The iron lady" + } + ], + "locatedAt": [ + { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "Relationship", + "object": "urn:ngsi-ld:District:Paris:08" + } + ], + "location": [ + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.3514, + 48.8575 + ] + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + 2.2944, + 48.8585 + ] + } + } + ], + "street": [ + { + "type": "LanguageProperty", + "languageMap": { + "fr": "Jardin de la Tour Eiffel", + "en": "Eiffel Tower Garden" + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + { + "type": "LanguageProperty", + "languageMap": { + "fr": "Avenue Gustave Eiffel", + "en": "Avenue Gustave Eiffel" + } + } + ], + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/doc/analysis/generaterobotdata.py b/doc/analysis/generaterobotdata.py index 40a032f67..987447d0f 100644 --- a/doc/analysis/generaterobotdata.py +++ b/doc/analysis/generaterobotdata.py @@ -43,6 +43,7 @@ class GenerateRobotData: 'Discovery/RetrieveDetailsOfAvailableAttributes': 'DISC', 'Entity/RetrieveEntity': 'E', 'Entities/CreateEntity': 'E', + 'Entities/MergeEntity': 'E', 'Entities/ReplaceEntity': 'E', 'Entity/QueryEntities': 'E', 'Entities/DeleteEntity': 'E', diff --git a/doc/analysis/requests.py b/doc/analysis/requests.py index 60f2cb369..5c4d50f49 100644 --- a/doc/analysis/requests.py +++ b/doc/analysis/requests.py @@ -110,6 +110,10 @@ class Requests: 'positions': [0, 1, 2, 3], 'params': ['entity_id', 'entity_fragment', 'content_type', 'context'] }, + 'Merge Entity': { + 'positions': [0, 1, 2, 3], + 'params': ['entity_id', 'entity_fragment', 'content_type', 'context'] + }, 'Replace Attribute Selecting Content Type': { 'positions': [0, 1, 2, 3, 4], 'params': ['entity_id', 'attr_id', 'attribute_fragment', 'content_type', 'context'] @@ -326,6 +330,8 @@ class Requests: Requests.replace_entity, 'Replace Entity Selecting Content Type': Requests.replace_entity_selecting_content_type, + 'Merge Entity': + Requests.merge_entity, 'Replace Attribute Selecting Content Type': Requests.replace_attribute_selecting_content_type, 'Append Entity Attributes': @@ -1422,6 +1428,31 @@ class Requests: return response + @staticmethod + def merge_entity(kwargs) -> str: + expected_parameters = ['entity_id', 'entity_fragment', 'content_type', 'context'] + + if 'context' not in kwargs: + kwargs['context'] = '${EMPTY}' + + result = [x for x in kwargs if x not in expected_parameters] + response = "Merge Entity" + for key, value in kwargs.items(): + match key: + case 'entity_id': + response = f"{response} and\n Query Parameter: entity_id set to '{value}'" + case 'entity_fragment': + response = f"{response} and\n Query Parameter: entity_fragment set to '{value}'" + case 'content_type': + response = f"{response} and\n Query Parameter: content_type set to '{value}'" + case 'context': + response = f"{response} and\n Query Parameter: context set to '{value}'" + case _: + raise Exception(f"ERROR: unexpected attribute {result}, the attributes expected are " + f"{expected_parameters}, but received: {kwargs}") + + return response + @staticmethod def replace_attribute_selecting_content_type(kwargs) -> str: expected_parameters = ['entity_id', 'attr_id', 'attribute_fragment', 'content_type', 'context'] diff --git a/doc/files/ContextInformation/Provision/060_01.json b/doc/files/ContextInformation/Provision/060_01.json new file mode 100644 index 000000000..e81b74de3 --- /dev/null +++ b/doc/files/ContextInformation/Provision/060_01.json @@ -0,0 +1,99 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/060_01", + "test_objective": "Check that one can merge an entity", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 5.6.17, 6.5.3.4", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "5.6.17", + "6.5.3.4" + ], + "pics_selection": "", + "keywords": [ + "Merge Entity Scenarios", + "Setup Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "060_01_01 MergeAnEmptyEntity", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_01_01", + "doc": "Check that one can merge an entity", + "tags": [ + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-non-edited.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'building-minimal.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "060_01_02 MergeSimpleProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_01_02", + "doc": "Check that one can merge an entity", + "tags": [ + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-attributes-edited.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'building-simple-attributes-second.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "060_01_03 MergeSimpleRelationship", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_01_03", + "doc": "Check that one can merge an entity", + "tags": [ + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-with-relationship.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'building-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "060_01_04 MergePropertyWithPartialData", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_01_04", + "doc": "Check that one can merge an entity", + "tags": [ + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-with-changed-airQualityLevel.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'merge/building-only-airQualityLevel-value.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/Entities/MergeEntity", + "robotfile": "060_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/060_02.json b/doc/files/ContextInformation/Provision/060_02.json new file mode 100644 index 000000000..beaeac8cf --- /dev/null +++ b/doc/files/ContextInformation/Provision/060_02.json @@ -0,0 +1,101 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/060_02", + "test_objective": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 5.6.17, 6.5.3.4", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.18", + "5.6.17", + "6.5.3.4" + ], + "pics_selection": "", + "keywords": [ + "Merge Entity Scenarios", + "Setup Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "060_02_01 Delete a Property", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_02_01", + "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-property.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-property.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "060_02_02 Delete a Relationship", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_02_02", + "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-relationship.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "060_02_03 Delete a GeoProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_02_03", + "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-geoproperty.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-geoproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "060_02_04 Delete a LanguageProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_02_04", + "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "4_5_18", + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-languageproperty.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-languageproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/Entities/MergeEntity", + "robotfile": "060_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/060_03.json b/doc/files/ContextInformation/Provision/060_03.json new file mode 100644 index 000000000..3da7a0474 --- /dev/null +++ b/doc/files/ContextInformation/Provision/060_03.json @@ -0,0 +1,106 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/060_03", + "test_objective": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 4.5.5, 5.6.17, 6.5.3.4", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.18", + "4.5.5", + "5.6.17", + "6.5.3.4" + ], + "pics_selection": "", + "keywords": [ + "Merge Entity Scenarios", + "Setup Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "060_03_01 Delete a Property instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_03_01", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "4_5_5", + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-property-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-property-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "060_03_02 Delete a Relationship instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_03_02", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "4_5_5", + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-relationship-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-relationship-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "060_03_03 Delete a GeoProperty instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_03_03", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "4_5_5", + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-geoproperty-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-geoproperty-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "060_03_04 Delete a LanguageProperty instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_03_04", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "4_5_18", + "4_5_5", + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-languageproperty-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-languageproperty-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/Entities/MergeEntity", + "robotfile": "060_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/060_04.json b/doc/files/ContextInformation/Provision/060_04.json new file mode 100644 index 000000000..06cae06ef --- /dev/null +++ b/doc/files/ContextInformation/Provision/060_04.json @@ -0,0 +1,106 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/060_04", + "test_objective": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 4.5.5, 5.6.17, 6.5.3.4", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.18", + "4.5.5", + "5.6.17", + "6.5.3.4" + ], + "pics_selection": "", + "keywords": [ + "Merge Entity Scenarios", + "Setup Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "060_04_01 Delete a Property instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_04_01", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "4_5_5", + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-property-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-property.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "060_04_02 Delete a Relationship instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_04_02", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "4_5_5", + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-relationship-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "060_04_03 Delete a GeoProperty instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_04_03", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "4_5_5", + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-geoproperty-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-geoproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "060_04_04 Delete a LanguageProperty instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_04_04", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "4_5_18", + "4_5_5", + "5_6_17", + "6_5_3_4", + "be-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-languageproperty-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-languageproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/Entities/MergeEntity", + "robotfile": "060_04" +} \ No newline at end of file diff --git a/doc/tests/test_ContextInformation_Provision.py b/doc/tests/test_ContextInformation_Provision.py index c50e9bcb2..ddcb97afe 100644 --- a/doc/tests/test_ContextInformation_Provision.py +++ b/doc/tests/test_ContextInformation_Provision.py @@ -343,6 +343,34 @@ class TestCIProvision(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_060_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/060_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/060_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_060_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_060_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/060_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/060_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_060_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_060_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/060_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/060_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_060_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_060_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/DeleteEntity/060_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/060_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_060_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_010_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/AppendEntityAttributes/010_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/010_01.json' diff --git a/resources/ApiUtils/ContextInformationProvision.resource b/resources/ApiUtils/ContextInformationProvision.resource index f46f97142..fd8e1e57b 100755 --- a/resources/ApiUtils/ContextInformationProvision.resource +++ b/resources/ApiUtils/ContextInformationProvision.resource @@ -323,6 +323,28 @@ Replace Entity Selecting Content Type Output ${response} Replace Entity Selecting Content Type RETURN ${response} +Merge Entity + [Arguments] + ... ${entity_id} + ... ${entity_fragment} + ... ${content_type} + ... ${context}=${EMPTY} + ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${entity_fragment} + ${entity}= Update Value To JSON ${entity_payload} $.id ${entity_id} + &{headers}= Create Dictionary Content-Type=${content_type} + IF '${context}'!='' + Set To Dictionary + ... ${headers} + ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" + END + ${response}= PATCH + ... url=${url}/${ENTITIES_ENDPOINT_PATH}${entity_id} + ... headers=${headers} + ... json=${entity} + ... expected_status=any + Output ${response} Merge Entity + RETURN ${response} + Replace Attribute Selecting Content Type [Arguments] ... ${entity_id} -- GitLab From 4a1abb5d013fc1b4d48a8876ad20b25124ba23c4 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Thu, 16 Jan 2025 10:33:56 +0100 Subject: [PATCH 4/9] feat: add TCs for NGSI-LD Null in Update Attributes operation --- .../Entities/MergeEntity/060_01.robot | 6 +- .../Entities/MergeEntity/060_02.robot | 16 +-- .../Entities/MergeEntity/060_03.robot | 16 +-- .../Entities/MergeEntity/060_04.robot | 16 +-- .../UpdateEntityAttributes/011_07.robot | 66 ++++++++++++ .../UpdateEntityAttributes/011_08.robot | 66 ++++++++++++ .../UpdateEntityAttributes/011_09.robot | 66 ++++++++++++ ...rent-attributes-instances-and-types.jsonld | 0 ...building-different-attributes-types.jsonld | 0 ...ault-attributes-instances-and-types.jsonld | 0 ...eleted-geoproperty-default-instance.jsonld | 0 ...ilding-deleted-geoproperty-instance.jsonld | 0 .../building-deleted-geoproperty.jsonld | 0 ...d-languageproperty-default-instance.jsonld | 0 ...g-deleted-languageproperty-instance.jsonld | 0 .../building-deleted-languageproperty.jsonld | 0 ...g-deleted-property-default-instance.jsonld | 0 .../building-deleted-property-instance.jsonld | 0 .../building-deleted-property.jsonld | 0 ...leted-relationship-default-instance.jsonld | 0 ...lding-deleted-relationship-instance.jsonld | 0 .../building-deleted-relationship.jsonld | 0 .../building-null-geoproperty-instance.jsonld | 0 .../building-null-geoproperty.jsonld | 0 ...ding-null-languageproperty-instance.jsonld | 0 .../building-null-languageproperty.jsonld | 0 .../building-null-property-instance.jsonld | 0 .../building-null-property.jsonld | 0 ...building-null-relationship-instance.jsonld | 0 .../building-null-relationship.jsonld | 0 .../null-geoproperty-instance.jsonld | 8 ++ .../ngsild-null/null-geoproperty.jsonld | 7 ++ .../null-languageproperty-instance.jsonld | 10 ++ .../ngsild-null/null-languageproperty.jsonld | 9 ++ .../ngsild-null/null-property-instance.jsonld | 8 ++ .../ngsild-null/null-property.jsonld | 7 ++ .../null-relationship-instance.jsonld | 8 ++ .../ngsild-null/null-relationship.jsonld | 7 ++ doc/analysis/requests.py | 8 +- .../ContextInformation/Provision/011_07.json | 101 ++++++++++++++++++ .../ContextInformation/Provision/011_08.json | 101 ++++++++++++++++++ .../ContextInformation/Provision/011_09.json | 101 ++++++++++++++++++ .../ContextInformation/Provision/060_01.json | 8 +- .../ContextInformation/Provision/060_02.json | 16 +-- .../ContextInformation/Provision/060_03.json | 16 +-- .../ContextInformation/Provision/060_04.json | 16 +-- .../test_ContextInformation_Provision.py | 21 ++++ .../ContextInformationProvision.resource | 4 +- 48 files changed, 647 insertions(+), 61 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_07.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_08.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_09.robot rename data/entities/{merge => }/building-different-attributes-instances-and-types.jsonld (100%) rename data/entities/{merge => }/building-different-attributes-types.jsonld (100%) rename data/entities/{merge => }/building-different-default-attributes-instances-and-types.jsonld (100%) rename data/entities/expectations/{merge => ngsild-null}/building-deleted-geoproperty-default-instance.jsonld (100%) rename data/entities/expectations/{merge => ngsild-null}/building-deleted-geoproperty-instance.jsonld (100%) rename data/entities/expectations/{merge => ngsild-null}/building-deleted-geoproperty.jsonld (100%) rename data/entities/expectations/{merge => ngsild-null}/building-deleted-languageproperty-default-instance.jsonld (100%) rename data/entities/expectations/{merge => ngsild-null}/building-deleted-languageproperty-instance.jsonld (100%) rename data/entities/expectations/{merge => ngsild-null}/building-deleted-languageproperty.jsonld (100%) rename data/entities/expectations/{merge => ngsild-null}/building-deleted-property-default-instance.jsonld (100%) rename data/entities/expectations/{merge => ngsild-null}/building-deleted-property-instance.jsonld (100%) rename data/entities/expectations/{merge => ngsild-null}/building-deleted-property.jsonld (100%) rename data/entities/expectations/{merge => ngsild-null}/building-deleted-relationship-default-instance.jsonld (100%) rename data/entities/expectations/{merge => ngsild-null}/building-deleted-relationship-instance.jsonld (100%) rename data/entities/expectations/{merge => ngsild-null}/building-deleted-relationship.jsonld (100%) rename data/entities/fragmentEntities/{merge => ngsild-null}/building-null-geoproperty-instance.jsonld (100%) rename data/entities/fragmentEntities/{merge => ngsild-null}/building-null-geoproperty.jsonld (100%) rename data/entities/fragmentEntities/{merge => ngsild-null}/building-null-languageproperty-instance.jsonld (100%) rename data/entities/fragmentEntities/{merge => ngsild-null}/building-null-languageproperty.jsonld (100%) rename data/entities/fragmentEntities/{merge => ngsild-null}/building-null-property-instance.jsonld (100%) rename data/entities/fragmentEntities/{merge => ngsild-null}/building-null-property.jsonld (100%) rename data/entities/fragmentEntities/{merge => ngsild-null}/building-null-relationship-instance.jsonld (100%) rename data/entities/fragmentEntities/{merge => ngsild-null}/building-null-relationship.jsonld (100%) create mode 100644 data/entities/fragmentEntities/ngsild-null/null-geoproperty-instance.jsonld create mode 100644 data/entities/fragmentEntities/ngsild-null/null-geoproperty.jsonld create mode 100644 data/entities/fragmentEntities/ngsild-null/null-languageproperty-instance.jsonld create mode 100644 data/entities/fragmentEntities/ngsild-null/null-languageproperty.jsonld create mode 100644 data/entities/fragmentEntities/ngsild-null/null-property-instance.jsonld create mode 100644 data/entities/fragmentEntities/ngsild-null/null-property.jsonld create mode 100644 data/entities/fragmentEntities/ngsild-null/null-relationship-instance.jsonld create mode 100644 data/entities/fragmentEntities/ngsild-null/null-relationship.jsonld create mode 100644 doc/files/ContextInformation/Provision/011_07.json create mode 100644 doc/files/ContextInformation/Provision/011_08.json create mode 100644 doc/files/ContextInformation/Provision/011_09.json diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_01.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_01.robot index 3d020de73..6571e802e 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_01.robot @@ -35,10 +35,9 @@ ${entity_payload_filename}= merge/building-merge-data.jsonld Merge Entity Scenarios [Documentation] Check that one can merge an entity [Arguments] ${filename} ${expectation_filename} - ${first_entity}= Load Entity ${filename} ${entity_id} ${response}= Merge Entity ... entity_id=${entity_id} - ... entity_fragment=${filename} + ... entity_filename=${filename} ... content_type=${CONTENT_TYPE_LD_JSON} Check Response Status Code 204 ${response.status_code} @@ -53,8 +52,9 @@ Merge Entity Scenarios Setup Initial Entity ${entity_id}= Generate Random Entity Id ${building_id_prefix} - Create Entity ${entity_payload_filename} ${entity_id} + ${response}= Create Entity ${entity_payload_filename} ${entity_id} Set Test Variable ${entity_id} + Check Response Status Code 201 ${response.status_code} Delete Initial Entity Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_02.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_02.robot index 815324b51..1ce991b4f 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_02.robot @@ -13,32 +13,31 @@ Test Template Merge Entity Scenarios *** Variables *** ${building_id_prefix}= urn:ngsi-ld:Building: -${entity_payload_filename}= merge/building-different-attributes-types.jsonld +${entity_payload_filename}= building-different-attributes-types.jsonld *** Test Cases *** FILENAME EXPECTATION_FILENAME 060_02_01 Delete a Property [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 - fragmentEntities/merge/building-null-property.jsonld merge/building-deleted-property.jsonld + fragmentEntities/ngsild-null/building-null-property.jsonld ngsild-null/building-deleted-property.jsonld 060_02_02 Delete a Relationship [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 - fragmentEntities/merge/building-null-relationship.jsonld merge/building-deleted-relationship.jsonld + fragmentEntities/ngsild-null/building-null-relationship.jsonld ngsild-null/building-deleted-relationship.jsonld 060_02_03 Delete a GeoProperty [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 - fragmentEntities/merge/building-null-geoproperty.jsonld merge/building-deleted-geoproperty.jsonld + fragmentEntities/ngsild-null/building-null-geoproperty.jsonld ngsild-null/building-deleted-geoproperty.jsonld 060_02_04 Delete a LanguageProperty [Tags] be-merge 5_6_17 6_5_3_4 4_5_18 since_v1.6.1 - fragmentEntities/merge/building-null-languageproperty.jsonld merge/building-deleted-languageproperty.jsonld + fragmentEntities/ngsild-null/building-null-languageproperty.jsonld ngsild-null/building-deleted-languageproperty.jsonld *** Keywords *** Merge Entity Scenarios [Documentation] Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation [Arguments] ${filename} ${expectation_filename} - ${first_entity}= Load Entity ${filename} ${entity_id} ${response}= Merge Entity ... entity_id=${entity_id} - ... entity_fragment=${filename} + ... entity_filename=${filename} ... content_type=${CONTENT_TYPE_LD_JSON} Check Response Status Code 204 ${response.status_code} @@ -53,8 +52,9 @@ Merge Entity Scenarios Setup Initial Entity ${entity_id}= Generate Random Entity Id ${building_id_prefix} - Create Entity ${entity_payload_filename} ${entity_id} + ${response}= Create Entity ${entity_payload_filename} ${entity_id} Set Test Variable ${entity_id} + Check Response Status Code 201 ${response.status_code} Delete Initial Entity Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_03.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_03.robot index f06a6ab7f..0b65da88e 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_03.robot @@ -13,32 +13,31 @@ Test Template Merge Entity Scenarios *** Variables *** ${building_id_prefix}= urn:ngsi-ld:Building: -${entity_payload_filename}= merge/building-different-attributes-instances-and-types.jsonld +${entity_payload_filename}= building-different-attributes-instances-and-types.jsonld *** Test Cases *** FILENAME EXPECTATION_FILENAME 060_03_01 Delete a Property instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 - fragmentEntities/merge/building-null-property-instance.jsonld merge/building-deleted-property-instance.jsonld + fragmentEntities/ngsild-null/building-null-property-instance.jsonld ngsild-null/building-deleted-property-instance.jsonld 060_03_02 Delete a Relationship instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 - fragmentEntities/merge/building-null-relationship-instance.jsonld merge/building-deleted-relationship-instance.jsonld + fragmentEntities/ngsild-null/building-null-relationship-instance.jsonld ngsild-null/building-deleted-relationship-instance.jsonld 060_03_03 Delete a GeoProperty instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 - fragmentEntities/merge/building-null-geoproperty-instance.jsonld merge/building-deleted-geoproperty-instance.jsonld + fragmentEntities/ngsild-null/building-null-geoproperty-instance.jsonld ngsild-null/building-deleted-geoproperty-instance.jsonld 060_03_04 Delete a LanguageProperty instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_18 4_5_5 since_v1.6.1 - fragmentEntities/merge/building-null-languageproperty-instance.jsonld merge/building-deleted-languageproperty-instance.jsonld + fragmentEntities/ngsild-null/building-null-languageproperty-instance.jsonld ngsild-null/building-deleted-languageproperty-instance.jsonld *** Keywords *** Merge Entity Scenarios [Documentation] Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation [Arguments] ${filename} ${expectation_filename} - ${first_entity}= Load Entity ${filename} ${entity_id} ${response}= Merge Entity ... entity_id=${entity_id} - ... entity_fragment=${filename} + ... entity_filename=${filename} ... content_type=${CONTENT_TYPE_LD_JSON} Check Response Status Code 204 ${response.status_code} @@ -53,8 +52,9 @@ Merge Entity Scenarios Setup Initial Entity ${entity_id}= Generate Random Entity Id ${building_id_prefix} - Create Entity ${entity_payload_filename} ${entity_id} + ${response}= Create Entity ${entity_payload_filename} ${entity_id} Set Test Variable ${entity_id} + Check Response Status Code 201 ${response.status_code} Delete Initial Entity Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_04.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_04.robot index 37a91e38f..b35d7a3cc 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_04.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_04.robot @@ -13,32 +13,31 @@ Test Template Merge Entity Scenarios *** Variables *** ${building_id_prefix}= urn:ngsi-ld:Building: -${entity_payload_filename}= merge/building-different-default-attributes-instances-and-types.jsonld +${entity_payload_filename}= building-different-default-attributes-instances-and-types.jsonld *** Test Cases *** FILENAME EXPECTATION_FILENAME 060_04_01 Delete a Property instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 - fragmentEntities/merge/building-null-property.jsonld merge/building-deleted-property-default-instance.jsonld + fragmentEntities/ngsild-null/building-null-property.jsonld ngsild-null/building-deleted-property-default-instance.jsonld 060_04_02 Delete a Relationship instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 - fragmentEntities/merge/building-null-relationship.jsonld merge/building-deleted-relationship-default-instance.jsonld + fragmentEntities/ngsild-null/building-null-relationship.jsonld ngsild-null/building-deleted-relationship-default-instance.jsonld 060_04_03 Delete a GeoProperty instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 - fragmentEntities/merge/building-null-geoproperty.jsonld merge/building-deleted-geoproperty-default-instance.jsonld + fragmentEntities/ngsild-null/building-null-geoproperty.jsonld ngsild-null/building-deleted-geoproperty-default-instance.jsonld 060_04_04 Delete a LanguageProperty instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_18 4_5_5 since_v1.6.1 - fragmentEntities/merge/building-null-languageproperty.jsonld merge/building-deleted-languageproperty-default-instance.jsonld + fragmentEntities/ngsild-null/building-null-languageproperty.jsonld ngsild-null/building-deleted-languageproperty-default-instance.jsonld *** Keywords *** Merge Entity Scenarios [Documentation] Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation [Arguments] ${filename} ${expectation_filename} - ${first_entity}= Load Entity ${filename} ${entity_id} ${response}= Merge Entity ... entity_id=${entity_id} - ... entity_fragment=${filename} + ... entity_filename=${filename} ... content_type=${CONTENT_TYPE_LD_JSON} Check Response Status Code 204 ${response.status_code} @@ -53,8 +52,9 @@ Merge Entity Scenarios Setup Initial Entity ${entity_id}= Generate Random Entity Id ${building_id_prefix} - Create Entity ${entity_payload_filename} ${entity_id} + ${response}= Create Entity ${entity_payload_filename} ${entity_id} Set Test Variable ${entity_id} + Check Response Status Code 201 ${response.status_code} Delete Initial Entity Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_07.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_07.robot new file mode 100644 index 000000000..c38f31ee8 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_07.robot @@ -0,0 +1,66 @@ +*** Settings *** +Documentation Check that one can delete an attribute using NGSI-LD Null in an Update Attributes operation + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Update Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= building-different-attributes-types.jsonld + + +*** Test Cases *** STATUS_CODE FRAGMENT_FILENAME EXPECTATION_FILENAME +011_07_01 Delete a Property + [Tags] ea-update 5_6_2 6_6_3_2 since_v1.6.1 + 204 ngsild-null/null-property.jsonld ngsild-null/building-deleted-property.jsonld +011_07_02 Delete a Relationship + [Tags] ea-update 5_6_2 6_6_3_2 since_v1.6.1 + 204 ngsild-null/null-relationship.jsonld ngsild-null/building-deleted-relationship.jsonld +011_07_03 Delete a GeoProperty + [Tags] ea-update 5_6_2 6_6_3_2 since_v1.6.1 + 204 ngsild-null/null-geoproperty.jsonld ngsild-null/building-deleted-geoproperty.jsonld +011_07_04 Delete a LanguageProperty + [Tags] ea-update 5_6_2 6_6_3_2 4_5_18 since_v1.6.1 + 204 ngsild-null/null-languageproperty.jsonld ngsild-null/building-deleted-languageproperty.jsonld + + +*** Keywords *** +Update Attributes + [Documentation] Check that one can delete an attribute using NGSI-LD Null in an Update Attributes operation + [Arguments] + ... ${status_code} + ... ${fragment_filename} + ... ${expectation_filename} + ${response}= Update Entity Attributes + ... ${entity_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_LD_JSON} + + Check Response Status Code ${status_code} ${response.status_code} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Body Containing Entity element + ... expectation_filename=${expectation_filename} + ... entity_id=${entity_id} + ... response_body=${response1.json()} + +Delete Initial Entity + Delete Entity by Id ${entity_id} + +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_08.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_08.robot new file mode 100644 index 000000000..a170a794b --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_08.robot @@ -0,0 +1,66 @@ +*** Settings *** +Documentation Check that one can delete a specific attribute instance using NGSI-LD Null in an Update Attributes operation + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Update Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= building-different-attributes-instances-and-types.jsonld + + +*** Test Cases *** STATUS_CODE FRAGMENT_FILENAME EXPECTATION_FILENAME +011_08_01 Delete a Property + [Tags] ea-update 5_6_2 6_6_3_2 since_v1.6.1 + 204 ngsild-null/null-property-instance.jsonld ngsild-null/building-deleted-property-instance.jsonld +011_08_02 Delete a Relationship + [Tags] ea-update 5_6_2 6_6_3_2 since_v1.6.1 + 204 ngsild-null/null-relationship-instance.jsonld ngsild-null/building-deleted-relationship-instance.jsonld +011_08_03 Delete a GeoProperty + [Tags] ea-update 5_6_2 6_6_3_2 since_v1.6.1 + 204 ngsild-null/null-geoproperty-instance.jsonld ngsild-null/building-deleted-geoproperty-instance.jsonld +011_08_04 Delete a LanguageProperty + [Tags] ea-update 5_6_2 6_6_3_2 4_5_18 since_v1.6.1 + 204 ngsild-null/null-languageproperty-instance.jsonld ngsild-null/building-deleted-languageproperty-instance.jsonld + + +*** Keywords *** +Update Attributes + [Documentation] Check that one can delete a specific attribute instance using NGSI-LD Null in an Update Attributes operation + [Arguments] + ... ${status_code} + ... ${fragment_filename} + ... ${expectation_filename} + ${response}= Update Entity Attributes + ... ${entity_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_LD_JSON} + + Check Response Status Code ${status_code} ${response.status_code} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Body Containing Entity element + ... expectation_filename=${expectation_filename} + ... entity_id=${entity_id} + ... response_body=${response1.json()} + +Delete Initial Entity + Delete Entity by Id ${entity_id} + +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_09.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_09.robot new file mode 100644 index 000000000..f5dd1fb7c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_09.robot @@ -0,0 +1,66 @@ +*** Settings *** +Documentation Check that one can delete the default attribute instance using NGSI-LD Null in an Update Attributes operation + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Update Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= building-different-default-attributes-instances-and-types.jsonld + + +*** Test Cases *** STATUS_CODE FRAGMENT_FILENAME EXPECTATION_FILENAME +011_09_01 Delete a Property + [Tags] ea-update 5_6_2 6_6_3_2 since_v1.6.1 + 204 ngsild-null/null-property.jsonld ngsild-null/building-deleted-property-default-instance.jsonld +011_09_02 Delete a Relationship + [Tags] ea-update 5_6_2 6_6_3_2 since_v1.6.1 + 204 ngsild-null/null-relationship.jsonld ngsild-null/building-deleted-relationship-default-instance.jsonld +011_09_03 Delete a GeoProperty + [Tags] ea-update 5_6_2 6_6_3_2 since_v1.6.1 + 204 ngsild-null/null-geoproperty.jsonld ngsild-null/building-deleted-geoproperty-default-instance.jsonld +011_09_04 Delete a LanguageProperty + [Tags] ea-update 5_6_2 6_6_3_2 4_5_18 since_v1.6.1 + 204 ngsild-null/null-languageproperty.jsonld ngsild-null/building-deleted-languageproperty-default-instance.jsonld + + +*** Keywords *** +Update Attributes + [Documentation] Check that one can delete the default attribute instance using NGSI-LD Null in an Update Attributes operation + [Arguments] + ... ${status_code} + ... ${fragment_filename} + ... ${expectation_filename} + ${response}= Update Entity Attributes + ... ${entity_id} + ... ${fragment_filename} + ... ${CONTENT_TYPE_LD_JSON} + + Check Response Status Code ${status_code} ${response.status_code} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Body Containing Entity element + ... expectation_filename=${expectation_filename} + ... entity_id=${entity_id} + ... response_body=${response1.json()} + +Delete Initial Entity + Delete Entity by Id ${entity_id} + +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} diff --git a/data/entities/merge/building-different-attributes-instances-and-types.jsonld b/data/entities/building-different-attributes-instances-and-types.jsonld similarity index 100% rename from data/entities/merge/building-different-attributes-instances-and-types.jsonld rename to data/entities/building-different-attributes-instances-and-types.jsonld diff --git a/data/entities/merge/building-different-attributes-types.jsonld b/data/entities/building-different-attributes-types.jsonld similarity index 100% rename from data/entities/merge/building-different-attributes-types.jsonld rename to data/entities/building-different-attributes-types.jsonld diff --git a/data/entities/merge/building-different-default-attributes-instances-and-types.jsonld b/data/entities/building-different-default-attributes-instances-and-types.jsonld similarity index 100% rename from data/entities/merge/building-different-default-attributes-instances-and-types.jsonld rename to data/entities/building-different-default-attributes-instances-and-types.jsonld diff --git a/data/entities/expectations/merge/building-deleted-geoproperty-default-instance.jsonld b/data/entities/expectations/ngsild-null/building-deleted-geoproperty-default-instance.jsonld similarity index 100% rename from data/entities/expectations/merge/building-deleted-geoproperty-default-instance.jsonld rename to data/entities/expectations/ngsild-null/building-deleted-geoproperty-default-instance.jsonld diff --git a/data/entities/expectations/merge/building-deleted-geoproperty-instance.jsonld b/data/entities/expectations/ngsild-null/building-deleted-geoproperty-instance.jsonld similarity index 100% rename from data/entities/expectations/merge/building-deleted-geoproperty-instance.jsonld rename to data/entities/expectations/ngsild-null/building-deleted-geoproperty-instance.jsonld diff --git a/data/entities/expectations/merge/building-deleted-geoproperty.jsonld b/data/entities/expectations/ngsild-null/building-deleted-geoproperty.jsonld similarity index 100% rename from data/entities/expectations/merge/building-deleted-geoproperty.jsonld rename to data/entities/expectations/ngsild-null/building-deleted-geoproperty.jsonld diff --git a/data/entities/expectations/merge/building-deleted-languageproperty-default-instance.jsonld b/data/entities/expectations/ngsild-null/building-deleted-languageproperty-default-instance.jsonld similarity index 100% rename from data/entities/expectations/merge/building-deleted-languageproperty-default-instance.jsonld rename to data/entities/expectations/ngsild-null/building-deleted-languageproperty-default-instance.jsonld diff --git a/data/entities/expectations/merge/building-deleted-languageproperty-instance.jsonld b/data/entities/expectations/ngsild-null/building-deleted-languageproperty-instance.jsonld similarity index 100% rename from data/entities/expectations/merge/building-deleted-languageproperty-instance.jsonld rename to data/entities/expectations/ngsild-null/building-deleted-languageproperty-instance.jsonld diff --git a/data/entities/expectations/merge/building-deleted-languageproperty.jsonld b/data/entities/expectations/ngsild-null/building-deleted-languageproperty.jsonld similarity index 100% rename from data/entities/expectations/merge/building-deleted-languageproperty.jsonld rename to data/entities/expectations/ngsild-null/building-deleted-languageproperty.jsonld diff --git a/data/entities/expectations/merge/building-deleted-property-default-instance.jsonld b/data/entities/expectations/ngsild-null/building-deleted-property-default-instance.jsonld similarity index 100% rename from data/entities/expectations/merge/building-deleted-property-default-instance.jsonld rename to data/entities/expectations/ngsild-null/building-deleted-property-default-instance.jsonld diff --git a/data/entities/expectations/merge/building-deleted-property-instance.jsonld b/data/entities/expectations/ngsild-null/building-deleted-property-instance.jsonld similarity index 100% rename from data/entities/expectations/merge/building-deleted-property-instance.jsonld rename to data/entities/expectations/ngsild-null/building-deleted-property-instance.jsonld diff --git a/data/entities/expectations/merge/building-deleted-property.jsonld b/data/entities/expectations/ngsild-null/building-deleted-property.jsonld similarity index 100% rename from data/entities/expectations/merge/building-deleted-property.jsonld rename to data/entities/expectations/ngsild-null/building-deleted-property.jsonld diff --git a/data/entities/expectations/merge/building-deleted-relationship-default-instance.jsonld b/data/entities/expectations/ngsild-null/building-deleted-relationship-default-instance.jsonld similarity index 100% rename from data/entities/expectations/merge/building-deleted-relationship-default-instance.jsonld rename to data/entities/expectations/ngsild-null/building-deleted-relationship-default-instance.jsonld diff --git a/data/entities/expectations/merge/building-deleted-relationship-instance.jsonld b/data/entities/expectations/ngsild-null/building-deleted-relationship-instance.jsonld similarity index 100% rename from data/entities/expectations/merge/building-deleted-relationship-instance.jsonld rename to data/entities/expectations/ngsild-null/building-deleted-relationship-instance.jsonld diff --git a/data/entities/expectations/merge/building-deleted-relationship.jsonld b/data/entities/expectations/ngsild-null/building-deleted-relationship.jsonld similarity index 100% rename from data/entities/expectations/merge/building-deleted-relationship.jsonld rename to data/entities/expectations/ngsild-null/building-deleted-relationship.jsonld diff --git a/data/entities/fragmentEntities/merge/building-null-geoproperty-instance.jsonld b/data/entities/fragmentEntities/ngsild-null/building-null-geoproperty-instance.jsonld similarity index 100% rename from data/entities/fragmentEntities/merge/building-null-geoproperty-instance.jsonld rename to data/entities/fragmentEntities/ngsild-null/building-null-geoproperty-instance.jsonld diff --git a/data/entities/fragmentEntities/merge/building-null-geoproperty.jsonld b/data/entities/fragmentEntities/ngsild-null/building-null-geoproperty.jsonld similarity index 100% rename from data/entities/fragmentEntities/merge/building-null-geoproperty.jsonld rename to data/entities/fragmentEntities/ngsild-null/building-null-geoproperty.jsonld diff --git a/data/entities/fragmentEntities/merge/building-null-languageproperty-instance.jsonld b/data/entities/fragmentEntities/ngsild-null/building-null-languageproperty-instance.jsonld similarity index 100% rename from data/entities/fragmentEntities/merge/building-null-languageproperty-instance.jsonld rename to data/entities/fragmentEntities/ngsild-null/building-null-languageproperty-instance.jsonld diff --git a/data/entities/fragmentEntities/merge/building-null-languageproperty.jsonld b/data/entities/fragmentEntities/ngsild-null/building-null-languageproperty.jsonld similarity index 100% rename from data/entities/fragmentEntities/merge/building-null-languageproperty.jsonld rename to data/entities/fragmentEntities/ngsild-null/building-null-languageproperty.jsonld diff --git a/data/entities/fragmentEntities/merge/building-null-property-instance.jsonld b/data/entities/fragmentEntities/ngsild-null/building-null-property-instance.jsonld similarity index 100% rename from data/entities/fragmentEntities/merge/building-null-property-instance.jsonld rename to data/entities/fragmentEntities/ngsild-null/building-null-property-instance.jsonld diff --git a/data/entities/fragmentEntities/merge/building-null-property.jsonld b/data/entities/fragmentEntities/ngsild-null/building-null-property.jsonld similarity index 100% rename from data/entities/fragmentEntities/merge/building-null-property.jsonld rename to data/entities/fragmentEntities/ngsild-null/building-null-property.jsonld diff --git a/data/entities/fragmentEntities/merge/building-null-relationship-instance.jsonld b/data/entities/fragmentEntities/ngsild-null/building-null-relationship-instance.jsonld similarity index 100% rename from data/entities/fragmentEntities/merge/building-null-relationship-instance.jsonld rename to data/entities/fragmentEntities/ngsild-null/building-null-relationship-instance.jsonld diff --git a/data/entities/fragmentEntities/merge/building-null-relationship.jsonld b/data/entities/fragmentEntities/ngsild-null/building-null-relationship.jsonld similarity index 100% rename from data/entities/fragmentEntities/merge/building-null-relationship.jsonld rename to data/entities/fragmentEntities/ngsild-null/building-null-relationship.jsonld diff --git a/data/entities/fragmentEntities/ngsild-null/null-geoproperty-instance.jsonld b/data/entities/fragmentEntities/ngsild-null/null-geoproperty-instance.jsonld new file mode 100644 index 000000000..fe5a66ec7 --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-geoproperty-instance.jsonld @@ -0,0 +1,8 @@ +{ + "location": { + "type": "GeoProperty", + "value": "urn:ngsi-ld:null", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/fragmentEntities/ngsild-null/null-geoproperty.jsonld b/data/entities/fragmentEntities/ngsild-null/null-geoproperty.jsonld new file mode 100644 index 000000000..883309266 --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-geoproperty.jsonld @@ -0,0 +1,7 @@ +{ + "location": { + "type": "GeoProperty", + "value": "urn:ngsi-ld:null" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/fragmentEntities/ngsild-null/null-languageproperty-instance.jsonld b/data/entities/fragmentEntities/ngsild-null/null-languageproperty-instance.jsonld new file mode 100644 index 000000000..88936b717 --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-languageproperty-instance.jsonld @@ -0,0 +1,10 @@ +{ + "street": { + "type": "LanguageProperty", + "languageMap": { + "@none": "urn:ngsi-ld:null" + }, + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/fragmentEntities/ngsild-null/null-languageproperty.jsonld b/data/entities/fragmentEntities/ngsild-null/null-languageproperty.jsonld new file mode 100644 index 000000000..9e11ed0d4 --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-languageproperty.jsonld @@ -0,0 +1,9 @@ +{ + "street": { + "type": "LanguageProperty", + "languageMap": { + "@none": "urn:ngsi-ld:null" + } + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/fragmentEntities/ngsild-null/null-property-instance.jsonld b/data/entities/fragmentEntities/ngsild-null/null-property-instance.jsonld new file mode 100644 index 000000000..f988ff7ee --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-property-instance.jsonld @@ -0,0 +1,8 @@ +{ + "name": { + "type": "Property", + "value": "urn:ngsi-ld:null", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/fragmentEntities/ngsild-null/null-property.jsonld b/data/entities/fragmentEntities/ngsild-null/null-property.jsonld new file mode 100644 index 000000000..fc106c494 --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-property.jsonld @@ -0,0 +1,7 @@ +{ + "name": { + "type": "Property", + "value": "urn:ngsi-ld:null" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/fragmentEntities/ngsild-null/null-relationship-instance.jsonld b/data/entities/fragmentEntities/ngsild-null/null-relationship-instance.jsonld new file mode 100644 index 000000000..b26000a22 --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-relationship-instance.jsonld @@ -0,0 +1,8 @@ +{ + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:null", + "datasetId": "urn:ngsi-ld:Dataset:01" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/data/entities/fragmentEntities/ngsild-null/null-relationship.jsonld b/data/entities/fragmentEntities/ngsild-null/null-relationship.jsonld new file mode 100644 index 000000000..324743e9c --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-relationship.jsonld @@ -0,0 +1,7 @@ +{ + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:null" + }, + "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" +} diff --git a/doc/analysis/requests.py b/doc/analysis/requests.py index 5c4d50f49..adb4ec00e 100644 --- a/doc/analysis/requests.py +++ b/doc/analysis/requests.py @@ -112,7 +112,7 @@ class Requests: }, 'Merge Entity': { 'positions': [0, 1, 2, 3], - 'params': ['entity_id', 'entity_fragment', 'content_type', 'context'] + 'params': ['entity_id', 'entity_filename', 'content_type', 'context'] }, 'Replace Attribute Selecting Content Type': { 'positions': [0, 1, 2, 3, 4], @@ -1430,7 +1430,7 @@ class Requests: @staticmethod def merge_entity(kwargs) -> str: - expected_parameters = ['entity_id', 'entity_fragment', 'content_type', 'context'] + expected_parameters = ['entity_id', 'entity_filename', 'content_type', 'context'] if 'context' not in kwargs: kwargs['context'] = '${EMPTY}' @@ -1441,8 +1441,8 @@ class Requests: match key: case 'entity_id': response = f"{response} and\n Query Parameter: entity_id set to '{value}'" - case 'entity_fragment': - response = f"{response} and\n Query Parameter: entity_fragment set to '{value}'" + case 'entity_filename': + response = f"{response} and\n Query Parameter: entity_filename set to '{value}'" case 'content_type': response = f"{response} and\n Query Parameter: content_type set to '{value}'" case 'context': diff --git a/doc/files/ContextInformation/Provision/011_07.json b/doc/files/ContextInformation/Provision/011_07.json new file mode 100644 index 000000000..316571a4d --- /dev/null +++ b/doc/files/ContextInformation/Provision/011_07.json @@ -0,0 +1,101 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/011_07", + "test_objective": "Check that one can delete an attribute using NGSI-LD Null in an Update Attributes operation", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 5.6.2, 6.6.3.2", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.18", + "5.6.2", + "6.6.3.2" + ], + "pics_selection": "", + "keywords": [ + "Update Attributes", + "Delete Initial Entity", + "Setup Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "011_07_01 Delete a Property", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_07_01", + "doc": "Check that one can delete an attribute using NGSI-LD Null in an Update Attributes operation", + "tags": [ + "5_6_2", + "6_6_3_2", + "ea-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-property.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "011_07_02 Delete a Relationship", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_07_02", + "doc": "Check that one can delete an attribute using NGSI-LD Null in an Update Attributes operation", + "tags": [ + "5_6_2", + "6_6_3_2", + "ea-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "011_07_03 Delete a GeoProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_07_03", + "doc": "Check that one can delete an attribute using NGSI-LD Null in an Update Attributes operation", + "tags": [ + "5_6_2", + "6_6_3_2", + "ea-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-geoproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "011_07_04 Delete a LanguageProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_07_04", + "doc": "Check that one can delete an attribute using NGSI-LD Null in an Update Attributes operation", + "tags": [ + "4_5_18", + "5_6_2", + "6_6_3_2", + "ea-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-languageproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes", + "robotfile": "011_07" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/011_08.json b/doc/files/ContextInformation/Provision/011_08.json new file mode 100644 index 000000000..6c68bcdbe --- /dev/null +++ b/doc/files/ContextInformation/Provision/011_08.json @@ -0,0 +1,101 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/011_08", + "test_objective": "Check that one can delete a specific attribute instance using NGSI-LD Null in an Update Attributes operation", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 5.6.2, 6.6.3.2", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.18", + "5.6.2", + "6.6.3.2" + ], + "pics_selection": "", + "keywords": [ + "Update Attributes", + "Delete Initial Entity", + "Setup Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "011_08_01 Delete a Property", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_08_01", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in an Update Attributes operation", + "tags": [ + "5_6_2", + "6_6_3_2", + "ea-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-property-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "011_08_02 Delete a Relationship", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_08_02", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in an Update Attributes operation", + "tags": [ + "5_6_2", + "6_6_3_2", + "ea-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-relationship-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "011_08_03 Delete a GeoProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_08_03", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in an Update Attributes operation", + "tags": [ + "5_6_2", + "6_6_3_2", + "ea-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-geoproperty-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "011_08_04 Delete a LanguageProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_08_04", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in an Update Attributes operation", + "tags": [ + "4_5_18", + "5_6_2", + "6_6_3_2", + "ea-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-languageproperty-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes", + "robotfile": "011_08" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/011_09.json b/doc/files/ContextInformation/Provision/011_09.json new file mode 100644 index 000000000..d6cb542f8 --- /dev/null +++ b/doc/files/ContextInformation/Provision/011_09.json @@ -0,0 +1,101 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/011_09", + "test_objective": "Check that one can delete the default attribute instance using NGSI-LD Null in an Update Attributes operation", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 5.6.2, 6.6.3.2", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.18", + "5.6.2", + "6.6.3.2" + ], + "pics_selection": "", + "keywords": [ + "Update Attributes", + "Delete Initial Entity", + "Setup Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "011_09_01 Delete a Property", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_09_01", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in an Update Attributes operation", + "tags": [ + "5_6_2", + "6_6_3_2", + "ea-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-property.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "011_09_02 Delete a Relationship", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_09_02", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in an Update Attributes operation", + "tags": [ + "5_6_2", + "6_6_3_2", + "ea-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "011_09_03 Delete a GeoProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_09_03", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in an Update Attributes operation", + "tags": [ + "5_6_2", + "6_6_3_2", + "ea-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-geoproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "011_09_04 Delete a LanguageProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/011_09_04", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in an Update Attributes operation", + "tags": [ + "4_5_18", + "5_6_2", + "6_6_3_2", + "ea-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-languageproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes", + "robotfile": "011_09" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/060_01.json b/doc/files/ContextInformation/Provision/060_01.json index e81b74de3..095684f9d 100644 --- a/doc/files/ContextInformation/Provision/060_01.json +++ b/doc/files/ContextInformation/Provision/060_01.json @@ -31,7 +31,7 @@ "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-non-edited.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'building-minimal.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'building-minimal.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, @@ -49,7 +49,7 @@ "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-attributes-edited.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'building-simple-attributes-second.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'building-simple-attributes-second.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, @@ -67,7 +67,7 @@ "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-with-relationship.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'building-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'building-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, @@ -85,7 +85,7 @@ "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-with-changed-airQualityLevel.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'merge/building-only-airQualityLevel-value.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'merge/building-only-airQualityLevel-value.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" } diff --git a/doc/files/ContextInformation/Provision/060_02.json b/doc/files/ContextInformation/Provision/060_02.json index beaeac8cf..930aa6163 100644 --- a/doc/files/ContextInformation/Provision/060_02.json +++ b/doc/files/ContextInformation/Provision/060_02.json @@ -31,8 +31,8 @@ "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-property.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-property.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-property.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, @@ -49,8 +49,8 @@ "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-relationship.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, @@ -67,8 +67,8 @@ "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-geoproperty.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-geoproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-geoproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, @@ -86,8 +86,8 @@ "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-languageproperty.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-languageproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-languageproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" } diff --git a/doc/files/ContextInformation/Provision/060_03.json b/doc/files/ContextInformation/Provision/060_03.json index 3da7a0474..f2cc1f391 100644 --- a/doc/files/ContextInformation/Provision/060_03.json +++ b/doc/files/ContextInformation/Provision/060_03.json @@ -33,8 +33,8 @@ "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-property-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-property-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-property-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, @@ -52,8 +52,8 @@ "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-relationship-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-relationship-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-relationship-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, @@ -71,8 +71,8 @@ "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-geoproperty-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-geoproperty-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-geoproperty-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, @@ -91,8 +91,8 @@ "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-languageproperty-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-languageproperty-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-languageproperty-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" } diff --git a/doc/files/ContextInformation/Provision/060_04.json b/doc/files/ContextInformation/Provision/060_04.json index 06cae06ef..0caa7cfdb 100644 --- a/doc/files/ContextInformation/Provision/060_04.json +++ b/doc/files/ContextInformation/Provision/060_04.json @@ -33,8 +33,8 @@ "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-property-default-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-property.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-property.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, @@ -52,8 +52,8 @@ "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-relationship-default-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, @@ -71,8 +71,8 @@ "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-geoproperty-default-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-geoproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-geoproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, @@ -91,8 +91,8 @@ "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'merge/building-deleted-languageproperty-default-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_fragment set to 'fragmentEntities/merge/building-null-languageproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-languageproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" } diff --git a/doc/tests/test_ContextInformation_Provision.py b/doc/tests/test_ContextInformation_Provision.py index ddcb97afe..cabdadd96 100644 --- a/doc/tests/test_ContextInformation_Provision.py +++ b/doc/tests/test_ContextInformation_Provision.py @@ -546,6 +546,27 @@ class TestCIProvision(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_011_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/011_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_011_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_011_08(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_08.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/011_08.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_011_08.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_011_09(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_09.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/011_09.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_011_09.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_007_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/TemporalEntity/CreateTemporalRepresentationOfEntity/007_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/007_01.json' diff --git a/resources/ApiUtils/ContextInformationProvision.resource b/resources/ApiUtils/ContextInformationProvision.resource index fd8e1e57b..545537306 100755 --- a/resources/ApiUtils/ContextInformationProvision.resource +++ b/resources/ApiUtils/ContextInformationProvision.resource @@ -326,10 +326,10 @@ Replace Entity Selecting Content Type Merge Entity [Arguments] ... ${entity_id} - ... ${entity_fragment} + ... ${entity_filename} ... ${content_type} ... ${context}=${EMPTY} - ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${entity_fragment} + ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${entity_filename} ${entity}= Update Value To JSON ${entity_payload} $.id ${entity_id} &{headers}= Create Dictionary Content-Type=${content_type} IF '${context}'!='' -- GitLab From 7a7fca94a1e5a8b39fbbccfe9da3f7e2538fb52f Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Thu, 16 Jan 2025 10:48:35 +0100 Subject: [PATCH 5/9] feat: add TCs for NGSI-LD Null in Partial Attribute Update operation --- .../PartialAttributeUpdate/012_05.robot | 68 ++++++++++++ .../PartialAttributeUpdate/012_06.robot | 68 ++++++++++++ .../PartialAttributeUpdate/012_07.robot | 68 ++++++++++++ .../null-geoproperty-fragment.jsonld | 7 ++ .../null-geoproperty-instance-fragment.jsonld | 8 ++ .../null-languageproperty-fragment.jsonld | 9 ++ ...-languageproperty-instance-fragment.jsonld | 10 ++ .../ngsild-null/null-property-fragment.jsonld | 7 ++ .../null-property-instance-fragment.jsonld | 8 ++ .../null-relationship-fragment.jsonld | 7 ++ ...null-relationship-instance-fragment.jsonld | 8 ++ .../ContextInformation/Provision/012_05.json | 101 ++++++++++++++++++ .../ContextInformation/Provision/012_06.json | 101 ++++++++++++++++++ .../ContextInformation/Provision/012_07.json | 101 ++++++++++++++++++ .../test_ContextInformation_Provision.py | 21 ++++ 15 files changed, 592 insertions(+) create mode 100644 TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_05.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_06.robot create mode 100644 TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_07.robot create mode 100644 data/entities/fragmentEntities/ngsild-null/null-geoproperty-fragment.jsonld create mode 100644 data/entities/fragmentEntities/ngsild-null/null-geoproperty-instance-fragment.jsonld create mode 100644 data/entities/fragmentEntities/ngsild-null/null-languageproperty-fragment.jsonld create mode 100644 data/entities/fragmentEntities/ngsild-null/null-languageproperty-instance-fragment.jsonld create mode 100644 data/entities/fragmentEntities/ngsild-null/null-property-fragment.jsonld create mode 100644 data/entities/fragmentEntities/ngsild-null/null-property-instance-fragment.jsonld create mode 100644 data/entities/fragmentEntities/ngsild-null/null-relationship-fragment.jsonld create mode 100644 data/entities/fragmentEntities/ngsild-null/null-relationship-instance-fragment.jsonld create mode 100644 doc/files/ContextInformation/Provision/012_05.json create mode 100644 doc/files/ContextInformation/Provision/012_06.json create mode 100644 doc/files/ContextInformation/Provision/012_07.json diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_05.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_05.robot new file mode 100644 index 000000000..48bd9fb88 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_05.robot @@ -0,0 +1,68 @@ +*** Settings *** +Documentation Check that one can delete an attribute using NGSI-LD Null in an Partial Attribute Update operation + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Update Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= building-different-attributes-types.jsonld + + +*** Test Cases *** STATUS_CODE ATTR_NAME FRAGMENT_FILENAME EXPECTATION_FILENAME +012_05_01 Delete a Property + [Tags] ea-partial-update 5_6_4 6_7_3_1 since_v1.6.1 + 204 name ngsild-null/null-property-fragment.jsonld ngsild-null/building-deleted-property.jsonld +012_05_02 Delete a Relationship + [Tags] ea-partial-update 5_6_4 6_7_3_1 since_v1.6.1 + 204 locatedAt ngsild-null/null-relationship-fragment.jsonld ngsild-null/building-deleted-relationship.jsonld +012_05_03 Delete a GeoProperty + [Tags] ea-partial-update 5_6_4 6_7_3_1 since_v1.6.1 + 204 location ngsild-null/null-geoproperty-fragment.jsonld ngsild-null/building-deleted-geoproperty.jsonld +012_05_04 Delete a LanguageProperty + [Tags] ea-partial-update 5_6_4 6_7_3_1 4_5_18 since_v1.6.1 + 204 street ngsild-null/null-languageproperty-fragment.jsonld ngsild-null/building-deleted-languageproperty.jsonld + + +*** Keywords *** +Update Attributes + [Documentation] Check that one can delete an attribute using NGSI-LD Null in an Partial Attribute Update operation + [Arguments] + ... ${status_code} + ... ${attr_name} + ... ${fragment_filename} + ... ${expectation_filename} + ${response}= Partial Update Entity Attributes + ... entityId=${entity_id} + ... attributeId=${attr_name} + ... fragment_filename=${fragment_filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + + Check Response Status Code ${status_code} ${response.status_code} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Body Containing Entity element + ... expectation_filename=${expectation_filename} + ... entity_id=${entity_id} + ... response_body=${response1.json()} + +Delete Initial Entity + Delete Entity by Id ${entity_id} + +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_06.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_06.robot new file mode 100644 index 000000000..3f9beead5 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_06.robot @@ -0,0 +1,68 @@ +*** Settings *** +Documentation Check that one can delete a specific attribute instance using NGSI-LD Null in an Partial Attribute Update operation + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Update Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= building-different-attributes-instances-and-types.jsonld + + +*** Test Cases *** STATUS_CODE ATTR_NAME FRAGMENT_FILENAME EXPECTATION_FILENAME +012_06_01 Delete a Property + [Tags] ea-partial-update 5_6_4 6_7_3_1 since_v1.6.1 + 204 name ngsild-null/null-property-instance-fragment.jsonld ngsild-null/building-deleted-property-instance.jsonld +012_06_02 Delete a Relationship + [Tags] ea-partial-update 5_6_4 6_7_3_1 since_v1.6.1 + 204 locatedAt ngsild-null/null-relationship-instance-fragment.jsonld ngsild-null/building-deleted-relationship-instance.jsonld +012_06_03 Delete a GeoProperty + [Tags] ea-partial-update 5_6_4 6_7_3_1 since_v1.6.1 + 204 location ngsild-null/null-geoproperty-instance-fragment.jsonld ngsild-null/building-deleted-geoproperty-instance.jsonld +012_06_04 Delete a LanguageProperty + [Tags] ea-partial-update 5_6_4 6_7_3_1 4_5_18 since_v1.6.1 + 204 street ngsild-null/null-languageproperty-instance-fragment.jsonld ngsild-null/building-deleted-languageproperty-instance.jsonld + + +*** Keywords *** +Update Attributes + [Documentation] Check that one can delete a specific attribute instance using NGSI-LD Null in an Partial Attribute Update operation + [Arguments] + ... ${status_code} + ... ${attr_name} + ... ${fragment_filename} + ... ${expectation_filename} + ${response}= Partial Update Entity Attributes + ... entityId=${entity_id} + ... attributeId=${attr_name} + ... fragment_filename=${fragment_filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + + Check Response Status Code ${status_code} ${response.status_code} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Body Containing Entity element + ... expectation_filename=${expectation_filename} + ... entity_id=${entity_id} + ... response_body=${response1.json()} + +Delete Initial Entity + Delete Entity by Id ${entity_id} + +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_07.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_07.robot new file mode 100644 index 000000000..c2a477cbe --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_07.robot @@ -0,0 +1,68 @@ +*** Settings *** +Documentation Check that one can delete the default attribute instance using NGSI-LD Null in an Partial Attribute Update operation + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Update Attributes + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${filename}= building-different-default-attributes-instances-and-types.jsonld + + +*** Test Cases *** STATUS_CODE ATTR_NAME FRAGMENT_FILENAME EXPECTATION_FILENAME +012_07_01 Delete a Property + [Tags] ea-partial-update 5_6_4 6_7_3_1 since_v1.6.1 + 204 name ngsild-null/null-property-fragment.jsonld ngsild-null/building-deleted-property-default-instance.jsonld +012_07_02 Delete a Relationship + [Tags] ea-partial-update 5_6_4 6_7_3_1 since_v1.6.1 + 204 locatedAt ngsild-null/null-relationship-fragment.jsonld ngsild-null/building-deleted-relationship-default-instance.jsonld +012_07_03 Delete a GeoProperty + [Tags] ea-partial-update 5_6_4 6_7_3_1 since_v1.6.1 + 204 location ngsild-null/null-geoproperty-fragment.jsonld ngsild-null/building-deleted-geoproperty-default-instance.jsonld +012_07_04 Delete a LanguageProperty + [Tags] ea-partial-update 5_6_4 6_7_3_1 4_5_18 since_v1.6.1 + 204 street ngsild-null/null-languageproperty-fragment.jsonld ngsild-null/building-deleted-languageproperty-default-instance.jsonld + + +*** Keywords *** +Update Attributes + [Documentation] Check that one can delete the default attribute instance using NGSI-LD Null in an Partial Attribute Update operation + [Arguments] + ... ${status_code} + ... ${attr_name} + ... ${fragment_filename} + ... ${expectation_filename} + ${response}= Partial Update Entity Attributes + ... entityId=${entity_id} + ... attributeId=${attr_name} + ... fragment_filename=${fragment_filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + + Check Response Status Code ${status_code} ${response.status_code} + ${response1}= Retrieve Entity by Id + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Body Containing Entity element + ... expectation_filename=${expectation_filename} + ... entity_id=${entity_id} + ... response_body=${response1.json()} + +Delete Initial Entity + Delete Entity by Id ${entity_id} + +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${vehicle_id_prefix} + Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} diff --git a/data/entities/fragmentEntities/ngsild-null/null-geoproperty-fragment.jsonld b/data/entities/fragmentEntities/ngsild-null/null-geoproperty-fragment.jsonld new file mode 100644 index 000000000..5f3de4b2b --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-geoproperty-fragment.jsonld @@ -0,0 +1,7 @@ +{ + "type": "GeoProperty", + "value": "urn:ngsi-ld:null", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/data/entities/fragmentEntities/ngsild-null/null-geoproperty-instance-fragment.jsonld b/data/entities/fragmentEntities/ngsild-null/null-geoproperty-instance-fragment.jsonld new file mode 100644 index 000000000..9a3f7d659 --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-geoproperty-instance-fragment.jsonld @@ -0,0 +1,8 @@ +{ + "type": "GeoProperty", + "value": "urn:ngsi-ld:null", + "datasetId": "urn:ngsi-ld:Dataset:01", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/data/entities/fragmentEntities/ngsild-null/null-languageproperty-fragment.jsonld b/data/entities/fragmentEntities/ngsild-null/null-languageproperty-fragment.jsonld new file mode 100644 index 000000000..1f5f2bf94 --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-languageproperty-fragment.jsonld @@ -0,0 +1,9 @@ +{ + "type": "LanguageProperty", + "languageMap": { + "@none": "urn:ngsi-ld:null" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/data/entities/fragmentEntities/ngsild-null/null-languageproperty-instance-fragment.jsonld b/data/entities/fragmentEntities/ngsild-null/null-languageproperty-instance-fragment.jsonld new file mode 100644 index 000000000..534d6ad76 --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-languageproperty-instance-fragment.jsonld @@ -0,0 +1,10 @@ +{ + "type": "LanguageProperty", + "languageMap": { + "@none": "urn:ngsi-ld:null" + }, + "datasetId": "urn:ngsi-ld:Dataset:01", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/data/entities/fragmentEntities/ngsild-null/null-property-fragment.jsonld b/data/entities/fragmentEntities/ngsild-null/null-property-fragment.jsonld new file mode 100644 index 000000000..24bf9b68a --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-property-fragment.jsonld @@ -0,0 +1,7 @@ +{ + "type": "Property", + "value": "urn:ngsi-ld:null", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/data/entities/fragmentEntities/ngsild-null/null-property-instance-fragment.jsonld b/data/entities/fragmentEntities/ngsild-null/null-property-instance-fragment.jsonld new file mode 100644 index 000000000..b049b9b94 --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-property-instance-fragment.jsonld @@ -0,0 +1,8 @@ +{ + "type": "Property", + "value": "urn:ngsi-ld:null", + "datasetId": "urn:ngsi-ld:Dataset:01", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/data/entities/fragmentEntities/ngsild-null/null-relationship-fragment.jsonld b/data/entities/fragmentEntities/ngsild-null/null-relationship-fragment.jsonld new file mode 100644 index 000000000..59328e2ea --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-relationship-fragment.jsonld @@ -0,0 +1,7 @@ +{ + "type": "Relationship", + "object": "urn:ngsi-ld:null", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/data/entities/fragmentEntities/ngsild-null/null-relationship-instance-fragment.jsonld b/data/entities/fragmentEntities/ngsild-null/null-relationship-instance-fragment.jsonld new file mode 100644 index 000000000..0453eb31a --- /dev/null +++ b/data/entities/fragmentEntities/ngsild-null/null-relationship-instance-fragment.jsonld @@ -0,0 +1,8 @@ +{ + "type": "Relationship", + "object": "urn:ngsi-ld:null", + "datasetId": "urn:ngsi-ld:Dataset:01", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/doc/files/ContextInformation/Provision/012_05.json b/doc/files/ContextInformation/Provision/012_05.json new file mode 100644 index 000000000..529bb3ad6 --- /dev/null +++ b/doc/files/ContextInformation/Provision/012_05.json @@ -0,0 +1,101 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/012_05", + "test_objective": "Check that one can delete an attribute using NGSI-LD Null in an Partial Attribute Update operation", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 5.6.4, 6.7.3.1", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.18", + "5.6.4", + "6.7.3.1" + ], + "pics_selection": "", + "keywords": [ + "Update Attributes", + "Delete Initial Entity", + "Setup Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "012_05_01 Delete a Property", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_05_01", + "doc": "Check that one can delete an attribute using NGSI-LD Null in an Partial Attribute Update operation", + "tags": [ + "5_6_4", + "6_7_3_1", + "ea-partial-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'name' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-property-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_05_02 Delete a Relationship", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_05_02", + "doc": "Check that one can delete an attribute using NGSI-LD Null in an Partial Attribute Update operation", + "tags": [ + "5_6_4", + "6_7_3_1", + "ea-partial-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'locatedAt' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-relationship-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_05_03 Delete a GeoProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_05_03", + "doc": "Check that one can delete an attribute using NGSI-LD Null in an Partial Attribute Update operation", + "tags": [ + "5_6_4", + "6_7_3_1", + "ea-partial-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'location' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-geoproperty-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_05_04 Delete a LanguageProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_05_04", + "doc": "Check that one can delete an attribute using NGSI-LD Null in an Partial Attribute Update operation", + "tags": [ + "4_5_18", + "5_6_4", + "6_7_3_1", + "ea-partial-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'street' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-languageproperty-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate", + "robotfile": "012_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/012_06.json b/doc/files/ContextInformation/Provision/012_06.json new file mode 100644 index 000000000..23e46b695 --- /dev/null +++ b/doc/files/ContextInformation/Provision/012_06.json @@ -0,0 +1,101 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/012_06", + "test_objective": "Check that one can delete a specific attribute instance using NGSI-LD Null in an Partial Attribute Update operation", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 5.6.4, 6.7.3.1", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.18", + "5.6.4", + "6.7.3.1" + ], + "pics_selection": "", + "keywords": [ + "Update Attributes", + "Delete Initial Entity", + "Setup Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "012_06_01 Delete a Property", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_06_01", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in an Partial Attribute Update operation", + "tags": [ + "5_6_4", + "6_7_3_1", + "ea-partial-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'name' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-property-instance-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_06_02 Delete a Relationship", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_06_02", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in an Partial Attribute Update operation", + "tags": [ + "5_6_4", + "6_7_3_1", + "ea-partial-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'locatedAt' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-relationship-instance-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_06_03 Delete a GeoProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_06_03", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in an Partial Attribute Update operation", + "tags": [ + "5_6_4", + "6_7_3_1", + "ea-partial-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'location' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-geoproperty-instance-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_06_04 Delete a LanguageProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_06_04", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in an Partial Attribute Update operation", + "tags": [ + "4_5_18", + "5_6_4", + "6_7_3_1", + "ea-partial-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'street' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-languageproperty-instance-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate", + "robotfile": "012_06" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/012_07.json b/doc/files/ContextInformation/Provision/012_07.json new file mode 100644 index 000000000..18c0a6a72 --- /dev/null +++ b/doc/files/ContextInformation/Provision/012_07.json @@ -0,0 +1,101 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/EA/012_07", + "test_objective": "Check that one can delete the default attribute instance using NGSI-LD Null in an Partial Attribute Update operation", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 5.6.4, 6.7.3.1", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.18", + "5.6.4", + "6.7.3.1" + ], + "pics_selection": "", + "keywords": [ + "Update Attributes", + "Delete Initial Entity", + "Setup Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "012_07_01 Delete a Property", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_07_01", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in an Partial Attribute Update operation", + "tags": [ + "5_6_4", + "6_7_3_1", + "ea-partial-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'name' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-property-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_07_02 Delete a Relationship", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_07_02", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in an Partial Attribute Update operation", + "tags": [ + "5_6_4", + "6_7_3_1", + "ea-partial-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'locatedAt' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-relationship-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_07_03 Delete a GeoProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_07_03", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in an Partial Attribute Update operation", + "tags": [ + "5_6_4", + "6_7_3_1", + "ea-partial-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'location' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-geoproperty-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "012_07_04 Delete a LanguageProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/012_07_04", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in an Partial Attribute Update operation", + "tags": [ + "4_5_18", + "5_6_4", + "6_7_3_1", + "ea-partial-update", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Update Attributes", + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'street' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-languageproperty-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate", + "robotfile": "012_07" +} \ No newline at end of file diff --git a/doc/tests/test_ContextInformation_Provision.py b/doc/tests/test_ContextInformation_Provision.py index cabdadd96..1c4fb7364 100644 --- a/doc/tests/test_ContextInformation_Provision.py +++ b/doc/tests/test_ContextInformation_Provision.py @@ -504,6 +504,27 @@ class TestCIProvision(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_012_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/012_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_012_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_012_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/012_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_012_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_012_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/PartialAttributeUpdate/012_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/012_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_012_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_011_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/UpdateEntityAttributes/011_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/011_01.json' -- GitLab From 9b71145fa516e8f4bc02aa16988a37e9eeabd878 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Thu, 16 Jan 2025 10:49:39 +0100 Subject: [PATCH 6/9] chore: move Merge Entity TCs to reserved 056 series --- .../{060_01.robot => 056_01.robot} | 8 ++++---- .../{060_02.robot => 056_02.robot} | 8 ++++---- .../{060_03.robot => 056_03.robot} | 8 ++++---- .../{060_04.robot => 056_04.robot} | 8 ++++---- .../Provision/{060_01.json => 056_01.json} | 20 +++++++++---------- .../Provision/{060_02.json => 056_02.json} | 20 +++++++++---------- .../Provision/{060_03.json => 056_03.json} | 20 +++++++++---------- .../Provision/{060_04.json => 056_04.json} | 20 +++++++++---------- 8 files changed, 56 insertions(+), 56 deletions(-) rename TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/{060_01.robot => 056_01.robot} (94%) rename TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/{060_02.robot => 056_02.robot} (95%) rename TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/{060_03.robot => 056_03.robot} (94%) rename TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/{060_04.robot => 056_04.robot} (94%) rename doc/files/ContextInformation/Provision/{060_01.json => 056_01.json} (91%) rename doc/files/ContextInformation/Provision/{060_02.json => 056_02.json} (91%) rename doc/files/ContextInformation/Provision/{060_03.json => 056_03.json} (91%) rename doc/files/ContextInformation/Provision/{060_04.json => 056_04.json} (91%) diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_01.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_01.robot similarity index 94% rename from TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_01.robot rename to TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_01.robot index 6571e802e..8f38d5657 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_01.robot @@ -17,16 +17,16 @@ ${entity_payload_filename}= merge/building-merge-data.jsonld *** Test Cases *** FILENAME EXPECTATION_FILENAME -060_01_01 MergeAnEmptyEntity +056_01_01 MergeAnEmptyEntity [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 building-minimal.jsonld merge/building-non-edited.jsonld -060_01_02 MergeSimpleProperties +056_01_02 MergeSimpleProperties [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 building-simple-attributes-second.jsonld merge/building-attributes-edited.jsonld -060_01_03 MergeSimpleRelationship +056_01_03 MergeSimpleRelationship [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 building-relationship.jsonld merge/building-with-relationship.jsonld -060_01_04 MergePropertyWithPartialData +056_01_04 MergePropertyWithPartialData [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 merge/building-only-airQualityLevel-value.jsonld merge/building-with-changed-airQualityLevel.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_02.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_02.robot similarity index 95% rename from TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_02.robot rename to TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_02.robot index 1ce991b4f..437abd847 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_02.robot @@ -17,16 +17,16 @@ ${entity_payload_filename}= building-different-attributes-types.jsonld *** Test Cases *** FILENAME EXPECTATION_FILENAME -060_02_01 Delete a Property +056_02_01 Delete a Property [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 fragmentEntities/ngsild-null/building-null-property.jsonld ngsild-null/building-deleted-property.jsonld -060_02_02 Delete a Relationship +056_02_02 Delete a Relationship [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 fragmentEntities/ngsild-null/building-null-relationship.jsonld ngsild-null/building-deleted-relationship.jsonld -060_02_03 Delete a GeoProperty +056_02_03 Delete a GeoProperty [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 fragmentEntities/ngsild-null/building-null-geoproperty.jsonld ngsild-null/building-deleted-geoproperty.jsonld -060_02_04 Delete a LanguageProperty +056_02_04 Delete a LanguageProperty [Tags] be-merge 5_6_17 6_5_3_4 4_5_18 since_v1.6.1 fragmentEntities/ngsild-null/building-null-languageproperty.jsonld ngsild-null/building-deleted-languageproperty.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_03.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_03.robot similarity index 94% rename from TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_03.robot rename to TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_03.robot index 0b65da88e..ad7fdae11 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_03.robot @@ -17,16 +17,16 @@ ${entity_payload_filename}= building-different-attributes-instances-and-type *** Test Cases *** FILENAME EXPECTATION_FILENAME -060_03_01 Delete a Property instance +056_03_01 Delete a Property instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 fragmentEntities/ngsild-null/building-null-property-instance.jsonld ngsild-null/building-deleted-property-instance.jsonld -060_03_02 Delete a Relationship instance +056_03_02 Delete a Relationship instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 fragmentEntities/ngsild-null/building-null-relationship-instance.jsonld ngsild-null/building-deleted-relationship-instance.jsonld -060_03_03 Delete a GeoProperty instance +056_03_03 Delete a GeoProperty instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 fragmentEntities/ngsild-null/building-null-geoproperty-instance.jsonld ngsild-null/building-deleted-geoproperty-instance.jsonld -060_03_04 Delete a LanguageProperty instance +056_03_04 Delete a LanguageProperty instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_18 4_5_5 since_v1.6.1 fragmentEntities/ngsild-null/building-null-languageproperty-instance.jsonld ngsild-null/building-deleted-languageproperty-instance.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_04.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_04.robot similarity index 94% rename from TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_04.robot rename to TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_04.robot index b35d7a3cc..f272a7425 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/060_04.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_04.robot @@ -17,16 +17,16 @@ ${entity_payload_filename}= building-different-default-attributes-instances- *** Test Cases *** FILENAME EXPECTATION_FILENAME -060_04_01 Delete a Property instance +056_04_01 Delete a Property instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 fragmentEntities/ngsild-null/building-null-property.jsonld ngsild-null/building-deleted-property-default-instance.jsonld -060_04_02 Delete a Relationship instance +056_04_02 Delete a Relationship instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 fragmentEntities/ngsild-null/building-null-relationship.jsonld ngsild-null/building-deleted-relationship-default-instance.jsonld -060_04_03 Delete a GeoProperty instance +056_04_03 Delete a GeoProperty instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 fragmentEntities/ngsild-null/building-null-geoproperty.jsonld ngsild-null/building-deleted-geoproperty-default-instance.jsonld -060_04_04 Delete a LanguageProperty instance +056_04_04 Delete a LanguageProperty instance [Tags] be-merge 5_6_17 6_5_3_4 4_5_18 4_5_5 since_v1.6.1 fragmentEntities/ngsild-null/building-null-languageproperty.jsonld ngsild-null/building-deleted-languageproperty-default-instance.jsonld diff --git a/doc/files/ContextInformation/Provision/060_01.json b/doc/files/ContextInformation/Provision/056_01.json similarity index 91% rename from doc/files/ContextInformation/Provision/060_01.json rename to doc/files/ContextInformation/Provision/056_01.json index 095684f9d..bb0c95ac8 100644 --- a/doc/files/ContextInformation/Provision/060_01.json +++ b/doc/files/ContextInformation/Provision/056_01.json @@ -1,5 +1,5 @@ { - "tp_id": "TP/NGSI-LD/CI/Prov/E/060_01", + "tp_id": "TP/NGSI-LD/CI/Prov/E/056_01", "test_objective": "Check that one can merge an entity", "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 5.6.17, 6.5.3.4", "config_id": "", @@ -18,8 +18,8 @@ "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", "test_cases": [ { - "name": "060_01_01 MergeAnEmptyEntity", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_01_01", + "name": "056_01_01 MergeAnEmptyEntity", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_01_01", "doc": "Check that one can merge an entity", "tags": [ "5_6_17", @@ -36,8 +36,8 @@ "endpoint": "entities/{entity_id}" }, { - "name": "060_01_02 MergeSimpleProperties", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_01_02", + "name": "056_01_02 MergeSimpleProperties", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_01_02", "doc": "Check that one can merge an entity", "tags": [ "5_6_17", @@ -54,8 +54,8 @@ "endpoint": "entities/{entity_id}" }, { - "name": "060_01_03 MergeSimpleRelationship", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_01_03", + "name": "056_01_03 MergeSimpleRelationship", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_01_03", "doc": "Check that one can merge an entity", "tags": [ "5_6_17", @@ -72,8 +72,8 @@ "endpoint": "entities/{entity_id}" }, { - "name": "060_01_04 MergePropertyWithPartialData", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_01_04", + "name": "056_01_04 MergePropertyWithPartialData", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_01_04", "doc": "Check that one can merge an entity", "tags": [ "5_6_17", @@ -95,5 +95,5 @@ "when" ], "robotpath": "ContextInformation/Provision/Entities/MergeEntity", - "robotfile": "060_01" + "robotfile": "056_01" } \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/060_02.json b/doc/files/ContextInformation/Provision/056_02.json similarity index 91% rename from doc/files/ContextInformation/Provision/060_02.json rename to doc/files/ContextInformation/Provision/056_02.json index 930aa6163..9e6fcf346 100644 --- a/doc/files/ContextInformation/Provision/060_02.json +++ b/doc/files/ContextInformation/Provision/056_02.json @@ -1,5 +1,5 @@ { - "tp_id": "TP/NGSI-LD/CI/Prov/E/060_02", + "tp_id": "TP/NGSI-LD/CI/Prov/E/056_02", "test_objective": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 5.6.17, 6.5.3.4", "config_id": "", @@ -19,8 +19,8 @@ "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", "test_cases": [ { - "name": "060_02_01 Delete a Property", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_02_01", + "name": "056_02_01 Delete a Property", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_02_01", "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", "tags": [ "5_6_17", @@ -37,8 +37,8 @@ "endpoint": "entities/{entity_id}" }, { - "name": "060_02_02 Delete a Relationship", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_02_02", + "name": "056_02_02 Delete a Relationship", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_02_02", "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", "tags": [ "5_6_17", @@ -55,8 +55,8 @@ "endpoint": "entities/{entity_id}" }, { - "name": "060_02_03 Delete a GeoProperty", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_02_03", + "name": "056_02_03 Delete a GeoProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_02_03", "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", "tags": [ "5_6_17", @@ -73,8 +73,8 @@ "endpoint": "entities/{entity_id}" }, { - "name": "060_02_04 Delete a LanguageProperty", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_02_04", + "name": "056_02_04 Delete a LanguageProperty", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_02_04", "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_18", @@ -97,5 +97,5 @@ "when" ], "robotpath": "ContextInformation/Provision/Entities/MergeEntity", - "robotfile": "060_02" + "robotfile": "056_02" } \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/060_03.json b/doc/files/ContextInformation/Provision/056_03.json similarity index 91% rename from doc/files/ContextInformation/Provision/060_03.json rename to doc/files/ContextInformation/Provision/056_03.json index f2cc1f391..64daa19a5 100644 --- a/doc/files/ContextInformation/Provision/060_03.json +++ b/doc/files/ContextInformation/Provision/056_03.json @@ -1,5 +1,5 @@ { - "tp_id": "TP/NGSI-LD/CI/Prov/E/060_03", + "tp_id": "TP/NGSI-LD/CI/Prov/E/056_03", "test_objective": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 4.5.5, 5.6.17, 6.5.3.4", "config_id": "", @@ -20,8 +20,8 @@ "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", "test_cases": [ { - "name": "060_03_01 Delete a Property instance", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_03_01", + "name": "056_03_01 Delete a Property instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_03_01", "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_5", @@ -39,8 +39,8 @@ "endpoint": "entities/{entity_id}" }, { - "name": "060_03_02 Delete a Relationship instance", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_03_02", + "name": "056_03_02 Delete a Relationship instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_03_02", "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_5", @@ -58,8 +58,8 @@ "endpoint": "entities/{entity_id}" }, { - "name": "060_03_03 Delete a GeoProperty instance", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_03_03", + "name": "056_03_03 Delete a GeoProperty instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_03_03", "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_5", @@ -77,8 +77,8 @@ "endpoint": "entities/{entity_id}" }, { - "name": "060_03_04 Delete a LanguageProperty instance", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_03_04", + "name": "056_03_04 Delete a LanguageProperty instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_03_04", "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_18", @@ -102,5 +102,5 @@ "when" ], "robotpath": "ContextInformation/Provision/Entities/MergeEntity", - "robotfile": "060_03" + "robotfile": "056_03" } \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/060_04.json b/doc/files/ContextInformation/Provision/056_04.json similarity index 91% rename from doc/files/ContextInformation/Provision/060_04.json rename to doc/files/ContextInformation/Provision/056_04.json index 0caa7cfdb..07b1ba992 100644 --- a/doc/files/ContextInformation/Provision/060_04.json +++ b/doc/files/ContextInformation/Provision/056_04.json @@ -1,5 +1,5 @@ { - "tp_id": "TP/NGSI-LD/CI/Prov/E/060_04", + "tp_id": "TP/NGSI-LD/CI/Prov/E/056_04", "test_objective": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 4.5.5, 5.6.17, 6.5.3.4", "config_id": "", @@ -20,8 +20,8 @@ "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", "test_cases": [ { - "name": "060_04_01 Delete a Property instance", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_04_01", + "name": "056_04_01 Delete a Property instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_04_01", "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_5", @@ -39,8 +39,8 @@ "endpoint": "entities/{entity_id}" }, { - "name": "060_04_02 Delete a Relationship instance", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_04_02", + "name": "056_04_02 Delete a Relationship instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_04_02", "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_5", @@ -58,8 +58,8 @@ "endpoint": "entities/{entity_id}" }, { - "name": "060_04_03 Delete a GeoProperty instance", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_04_03", + "name": "056_04_03 Delete a GeoProperty instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_04_03", "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_5", @@ -77,8 +77,8 @@ "endpoint": "entities/{entity_id}" }, { - "name": "060_04_04 Delete a LanguageProperty instance", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/060_04_04", + "name": "056_04_04 Delete a LanguageProperty instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_04_04", "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_18", @@ -102,5 +102,5 @@ "when" ], "robotpath": "ContextInformation/Provision/Entities/MergeEntity", - "robotfile": "060_04" + "robotfile": "056_04" } \ No newline at end of file -- GitLab From b7a3d92fcc4668fa8fbeebb82748fa3e51a13533 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Thu, 16 Jan 2025 10:55:58 +0100 Subject: [PATCH 7/9] feat: add TCs for Merge Entity error cases --- .../Entities/MergeEntity/056_01.robot | 8 +- .../Entities/MergeEntity/056_02.robot | 62 +++++----- .../Entities/MergeEntity/056_03.robot | 30 ++--- .../Entities/MergeEntity/056_04.robot | 22 ++-- .../Entities/MergeEntity/056_05.robot | 60 ++++++++++ .../Entities/ReplaceEntity/054_02.robot | 2 +- .../ContextInformation/Provision/054_02.json | 2 +- .../ContextInformation/Provision/056_01.json | 8 +- .../ContextInformation/Provision/056_02.json | 62 ++++------ .../ContextInformation/Provision/056_03.json | 45 ++++---- .../ContextInformation/Provision/056_04.json | 34 +++--- .../ContextInformation/Provision/056_05.json | 106 ++++++++++++++++++ 12 files changed, 290 insertions(+), 151 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_05.robot create mode 100644 doc/files/ContextInformation/Provision/056_05.json diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_01.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_01.robot index 8f38d5657..72c4959ce 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_01.robot @@ -18,16 +18,16 @@ ${entity_payload_filename}= merge/building-merge-data.jsonld *** Test Cases *** FILENAME EXPECTATION_FILENAME 056_01_01 MergeAnEmptyEntity - [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 + [Tags] e-merge 5_6_17 6_5_3_4 since_v1.6.1 building-minimal.jsonld merge/building-non-edited.jsonld 056_01_02 MergeSimpleProperties - [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 + [Tags] e-merge 5_6_17 6_5_3_4 since_v1.6.1 building-simple-attributes-second.jsonld merge/building-attributes-edited.jsonld 056_01_03 MergeSimpleRelationship - [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 + [Tags] e-merge 5_6_17 6_5_3_4 since_v1.6.1 building-relationship.jsonld merge/building-with-relationship.jsonld 056_01_04 MergePropertyWithPartialData - [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 + [Tags] e-merge 5_6_17 6_5_3_4 since_v1.6.1 merge/building-only-airQualityLevel-value.jsonld merge/building-with-changed-airQualityLevel.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_02.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_02.robot index 437abd847..f277ea307 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_02.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation +Documentation Check that if the target entity ID is faulty an error is raised Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource @@ -8,52 +8,48 @@ Resource ${EXECDIR}/resources/JsonUtils.resource Test Setup Setup Initial Entity Test Teardown Delete Initial Entity -Test Template Merge Entity Scenarios +Test Template Merge an existing entity with a faulty ID *** Variables *** -${building_id_prefix}= urn:ngsi-ld:Building: -${entity_payload_filename}= building-different-attributes-types.jsonld +${building_id_prefix} urn:ngsi-ld:Building: +${entity_filename} building-simple-attributes.json +${entity_replacement_filename} building-locatedAt-and-name.json -*** Test Cases *** FILENAME EXPECTATION_FILENAME -056_02_01 Delete a Property - [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 - fragmentEntities/ngsild-null/building-null-property.jsonld ngsild-null/building-deleted-property.jsonld -056_02_02 Delete a Relationship - [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 - fragmentEntities/ngsild-null/building-null-relationship.jsonld ngsild-null/building-deleted-relationship.jsonld -056_02_03 Delete a GeoProperty - [Tags] be-merge 5_6_17 6_5_3_4 since_v1.6.1 - fragmentEntities/ngsild-null/building-null-geoproperty.jsonld ngsild-null/building-deleted-geoproperty.jsonld -056_02_04 Delete a LanguageProperty - [Tags] be-merge 5_6_17 6_5_3_4 4_5_18 since_v1.6.1 - fragmentEntities/ngsild-null/building-null-languageproperty.jsonld ngsild-null/building-deleted-languageproperty.jsonld +*** Test Cases *** FAULTY_ENTITY_ID EXPECTED_STATUS_CODE +056_02_01 Merge an existing entity giving an invalid Id + [Tags] e-merge 5_6_17 6_5_3_4 since_v1.6.1 + invalidUri 400 +056_02_02 Merge an existing entity without giving an Id + [Tags] e-merge 5_6_17 6_5_3_4 since_v1.6.1 + ${EMPTY} 400 +056_02_03 Merge an existing entity giving a nonexistent Id + [Tags] e-merge 5_6_17 6_5_3_4 since_v1.6.1 + urn:ngsi-ld:Building:Nonexistent 404 *** Keywords *** -Merge Entity Scenarios - [Documentation] Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation - [Arguments] ${filename} ${expectation_filename} - ${response}= Merge Entity - ... entity_id=${entity_id} - ... entity_filename=${filename} - ... content_type=${CONTENT_TYPE_LD_JSON} - Check Response Status Code 204 ${response.status_code} +Merge an existing entity with a faulty ID + [Documentation] Check that if the target entity ID is faulty an error is raised + [Arguments] ${faulty_entity_id} ${expected_status_code} - ${response1}= Query Entity - ... id=${entity_id} + ${response}= Merge Entity + ... entity_id=${faulty_entity_id} + ... entity_filename=${entity_replacement_filename} ... context=${ngsild_test_suite_context} - ... accept=${CONTENT_TYPE_LD_JSON} - Check Response Body Containing Entity element - ... expectation_filename=${expectation_filename} - ... entity_id=${entity_id} - ... response_body=${response1.json()} + ... content_type=${CONTENT_TYPE_JSON} + + Check Response Status Code ${expected_status_code} ${response.status_code} Setup Initial Entity ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} Set Test Variable ${entity_id} + ${response}= Create Entity Selecting Content Type + ... ${entity_filename} + ... ${entity_id} + ... ${CONTENT_TYPE_JSON} + ... ${ngsild_test_suite_context} Check Response Status Code 201 ${response.status_code} Delete Initial Entity diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_03.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_03.robot index ad7fdae11..3e878bec5 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_03.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation +Documentation Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource @@ -13,27 +13,27 @@ Test Template Merge Entity Scenarios *** Variables *** ${building_id_prefix}= urn:ngsi-ld:Building: -${entity_payload_filename}= building-different-attributes-instances-and-types.jsonld +${entity_payload_filename}= building-different-attributes-types.jsonld *** Test Cases *** FILENAME EXPECTATION_FILENAME -056_03_01 Delete a Property instance - [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 - fragmentEntities/ngsild-null/building-null-property-instance.jsonld ngsild-null/building-deleted-property-instance.jsonld -056_03_02 Delete a Relationship instance - [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 - fragmentEntities/ngsild-null/building-null-relationship-instance.jsonld ngsild-null/building-deleted-relationship-instance.jsonld -056_03_03 Delete a GeoProperty instance - [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 - fragmentEntities/ngsild-null/building-null-geoproperty-instance.jsonld ngsild-null/building-deleted-geoproperty-instance.jsonld -056_03_04 Delete a LanguageProperty instance - [Tags] be-merge 5_6_17 6_5_3_4 4_5_18 4_5_5 since_v1.6.1 - fragmentEntities/ngsild-null/building-null-languageproperty-instance.jsonld ngsild-null/building-deleted-languageproperty-instance.jsonld +056_03_01 Delete a Property + [Tags] e-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 + fragmentEntities/ngsild-null/building-null-property.jsonld ngsild-null/building-deleted-property.jsonld +056_03_02 Delete a Relationship + [Tags] e-merge 5_6_17 6_5_3_4 since_v1.6.1 + fragmentEntities/ngsild-null/building-null-relationship.jsonld ngsild-null/building-deleted-relationship.jsonld +056_03_03 Delete a GeoProperty + [Tags] e-merge 5_6_17 6_5_3_4 since_v1.6.1 + fragmentEntities/ngsild-null/building-null-geoproperty.jsonld ngsild-null/building-deleted-geoproperty.jsonld +056_03_04 Delete a LanguageProperty + [Tags] e-merge 5_6_17 6_5_3_4 4_5_18 since_v1.6.1 + fragmentEntities/ngsild-null/building-null-languageproperty.jsonld ngsild-null/building-deleted-languageproperty.jsonld *** Keywords *** Merge Entity Scenarios - [Documentation] Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation + [Documentation] Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation [Arguments] ${filename} ${expectation_filename} ${response}= Merge Entity ... entity_id=${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_04.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_04.robot index f272a7425..a2bda14cb 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_04.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_04.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation +Documentation Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource @@ -13,27 +13,27 @@ Test Template Merge Entity Scenarios *** Variables *** ${building_id_prefix}= urn:ngsi-ld:Building: -${entity_payload_filename}= building-different-default-attributes-instances-and-types.jsonld +${entity_payload_filename}= building-different-attributes-instances-and-types.jsonld *** Test Cases *** FILENAME EXPECTATION_FILENAME 056_04_01 Delete a Property instance - [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 - fragmentEntities/ngsild-null/building-null-property.jsonld ngsild-null/building-deleted-property-default-instance.jsonld + [Tags] e-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 + fragmentEntities/ngsild-null/building-null-property-instance.jsonld ngsild-null/building-deleted-property-instance.jsonld 056_04_02 Delete a Relationship instance - [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 - fragmentEntities/ngsild-null/building-null-relationship.jsonld ngsild-null/building-deleted-relationship-default-instance.jsonld + [Tags] e-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 + fragmentEntities/ngsild-null/building-null-relationship-instance.jsonld ngsild-null/building-deleted-relationship-instance.jsonld 056_04_03 Delete a GeoProperty instance - [Tags] be-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 - fragmentEntities/ngsild-null/building-null-geoproperty.jsonld ngsild-null/building-deleted-geoproperty-default-instance.jsonld + [Tags] e-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 + fragmentEntities/ngsild-null/building-null-geoproperty-instance.jsonld ngsild-null/building-deleted-geoproperty-instance.jsonld 056_04_04 Delete a LanguageProperty instance - [Tags] be-merge 5_6_17 6_5_3_4 4_5_18 4_5_5 since_v1.6.1 - fragmentEntities/ngsild-null/building-null-languageproperty.jsonld ngsild-null/building-deleted-languageproperty-default-instance.jsonld + [Tags] e-merge 5_6_17 6_5_3_4 4_5_18 4_5_5 since_v1.6.1 + fragmentEntities/ngsild-null/building-null-languageproperty-instance.jsonld ngsild-null/building-deleted-languageproperty-instance.jsonld *** Keywords *** Merge Entity Scenarios - [Documentation] Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation + [Documentation] Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation [Arguments] ${filename} ${expectation_filename} ${response}= Merge Entity ... entity_id=${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_05.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_05.robot new file mode 100644 index 000000000..027e63d08 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/MergeEntity/056_05.robot @@ -0,0 +1,60 @@ +*** Settings *** +Documentation Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Setup Initial Entity +Test Teardown Delete Initial Entity +Test Template Merge Entity Scenarios + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${entity_payload_filename}= building-different-default-attributes-instances-and-types.jsonld + + +*** Test Cases *** FILENAME EXPECTATION_FILENAME +056_05_01 Delete a Property instance + [Tags] e-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 + fragmentEntities/ngsild-null/building-null-property.jsonld ngsild-null/building-deleted-property-default-instance.jsonld +056_05_02 Delete a Relationship instance + [Tags] e-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 + fragmentEntities/ngsild-null/building-null-relationship.jsonld ngsild-null/building-deleted-relationship-default-instance.jsonld +056_05_03 Delete a GeoProperty instance + [Tags] e-merge 5_6_17 6_5_3_4 4_5_5 since_v1.6.1 + fragmentEntities/ngsild-null/building-null-geoproperty.jsonld ngsild-null/building-deleted-geoproperty-default-instance.jsonld +056_05_04 Delete a LanguageProperty instance + [Tags] e-merge 5_6_17 6_5_3_4 4_5_18 4_5_5 since_v1.6.1 + fragmentEntities/ngsild-null/building-null-languageproperty.jsonld ngsild-null/building-deleted-languageproperty-default-instance.jsonld + + +*** Keywords *** +Merge Entity Scenarios + [Documentation] Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation + [Arguments] ${filename} ${expectation_filename} + ${response}= Merge Entity + ... entity_id=${entity_id} + ... entity_filename=${filename} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${response1}= Query Entity + ... id=${entity_id} + ... context=${ngsild_test_suite_context} + ... accept=${CONTENT_TYPE_LD_JSON} + Check Response Body Containing Entity element + ... expectation_filename=${expectation_filename} + ... entity_id=${entity_id} + ... response_body=${response1.json()} + +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${response}= Create Entity ${entity_payload_filename} ${entity_id} + Set Test Variable ${entity_id} + Check Response Status Code 201 ${response.status_code} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/ReplaceEntity/054_02.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/ReplaceEntity/054_02.robot index f60447e8a..47b262fe7 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/ReplaceEntity/054_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/ReplaceEntity/054_02.robot @@ -24,7 +24,7 @@ ${entity_replacement_filename} building-locatedAt-and-name.json 054_02_02 Replace an existing entity without giving an Id [Tags] e-replace 5_6_18 6_5_3_3 since_v1.6.1 ${EMPTY} 400 -054_02_03 Replace an existing entity giving a nonexsitent Id +054_02_03 Replace an existing entity giving a nonexistent Id [Tags] e-replace 5_6_18 6_5_3_3 since_v1.6.1 urn:ngsi-ld:Building:Nonexistent 404 diff --git a/doc/files/ContextInformation/Provision/054_02.json b/doc/files/ContextInformation/Provision/054_02.json index 35e9446bf..0c06fec8c 100644 --- a/doc/files/ContextInformation/Provision/054_02.json +++ b/doc/files/ContextInformation/Provision/054_02.json @@ -54,7 +54,7 @@ "endpoint": "entities/{entity_id}" }, { - "name": "054_02_03 Replace an existing entity giving a nonexsitent Id", + "name": "054_02_03 Replace an existing entity giving a nonexistent Id", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/054_02_03", "doc": "Check that if the target entity ID is faulty an error is raised", "tags": [ diff --git a/doc/files/ContextInformation/Provision/056_01.json b/doc/files/ContextInformation/Provision/056_01.json index bb0c95ac8..191a578b4 100644 --- a/doc/files/ContextInformation/Provision/056_01.json +++ b/doc/files/ContextInformation/Provision/056_01.json @@ -24,7 +24,7 @@ "tags": [ "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", @@ -42,7 +42,7 @@ "tags": [ "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", @@ -60,7 +60,7 @@ "tags": [ "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", @@ -78,7 +78,7 @@ "tags": [ "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", diff --git a/doc/files/ContextInformation/Provision/056_02.json b/doc/files/ContextInformation/Provision/056_02.json index 9e6fcf346..302506cb2 100644 --- a/doc/files/ContextInformation/Provision/056_02.json +++ b/doc/files/ContextInformation/Provision/056_02.json @@ -1,17 +1,16 @@ { "tp_id": "TP/NGSI-LD/CI/Prov/E/056_02", - "test_objective": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", - "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 5.6.17, 6.5.3.4", + "test_objective": "Check that if the target entity ID is faulty an error is raised", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 5.6.17, 6.5.3.4", "config_id": "", "parent_release": "v1.6.1", "clauses": [ - "4.5.18", "5.6.17", "6.5.3.4" ], "pics_selection": "", "keywords": [ - "Merge Entity Scenarios", + "Merge an existing entity with a faulty ID", "Setup Initial Entity", "Delete Initial Entity" ], @@ -19,75 +18,56 @@ "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", "test_cases": [ { - "name": "056_02_01 Delete a Property", + "name": "056_02_01 Merge an existing entity giving an invalid Id", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_02_01", - "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", + "doc": "Check that if the target entity ID is faulty an error is raised", "tags": [ "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", - "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-property.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "template": "Merge an existing entity with a faulty ID", + "then": "then {\n the SUT sends a valid Response for the operation:\n Merge Entity with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to 'invalidUri' and\n Query Parameter: entity_filename set to '${entity_replacement_filename}' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, { - "name": "056_02_02 Delete a Relationship", + "name": "056_02_02 Merge an existing entity without giving an Id", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_02_02", - "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", + "doc": "Check that if the target entity ID is faulty an error is raised", "tags": [ "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", - "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "template": "Merge an existing entity with a faulty ID", + "then": "then {\n the SUT sends a valid Response for the operation:\n Merge Entity with Response Status Code set to 400\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${EMPTY}' and\n Query Parameter: entity_filename set to '${entity_replacement_filename}' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, { - "name": "056_02_03 Delete a GeoProperty", + "name": "056_02_03 Merge an existing entity giving a nonexistent Id", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_02_03", - "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", + "doc": "Check that if the target entity ID is faulty an error is raised", "tags": [ "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", - "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-geoproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", - "http_verb": "PATCH", - "endpoint": "entities/{entity_id}" - }, - { - "name": "056_02_04 Delete a LanguageProperty", - "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_02_04", - "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", - "tags": [ - "4_5_18", - "5_6_17", - "6_5_3_4", - "be-merge", - "since_v1.6.1" - ], - "setup": "Setup Initial Entity", - "teardown": "Delete Initial Entity", - "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-languageproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "template": "Merge an existing entity with a faulty ID", + "then": "then {\n the SUT sends a valid Response for the operation:\n Merge Entity with Response Status Code set to 404\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to 'urn:ngsi-ld:Building:Nonexistent' and\n Query Parameter: entity_filename set to '${entity_replacement_filename}' and\n Query Parameter: content_type set to 'application/json' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" } diff --git a/doc/files/ContextInformation/Provision/056_03.json b/doc/files/ContextInformation/Provision/056_03.json index 64daa19a5..439979548 100644 --- a/doc/files/ContextInformation/Provision/056_03.json +++ b/doc/files/ContextInformation/Provision/056_03.json @@ -1,6 +1,6 @@ { "tp_id": "TP/NGSI-LD/CI/Prov/E/056_03", - "test_objective": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", + "test_objective": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 4.5.5, 5.6.17, 6.5.3.4", "config_id": "", "parent_release": "v1.6.1", @@ -20,79 +20,76 @@ "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", "test_cases": [ { - "name": "056_03_01 Delete a Property instance", + "name": "056_03_01 Delete a Property", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_03_01", - "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", + "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_5", "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-property-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-property.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, { - "name": "056_03_02 Delete a Relationship instance", + "name": "056_03_02 Delete a Relationship", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_03_02", - "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", + "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", "tags": [ - "4_5_5", "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-relationship-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, { - "name": "056_03_03 Delete a GeoProperty instance", + "name": "056_03_03 Delete a GeoProperty", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_03_03", - "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", + "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", "tags": [ - "4_5_5", "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-geoproperty-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-geoproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, { - "name": "056_03_04 Delete a LanguageProperty instance", + "name": "056_03_04 Delete a LanguageProperty", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_03_04", - "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", + "doc": "Check that one can delete an attribute using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_18", - "4_5_5", "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-languageproperty-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-languageproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" } diff --git a/doc/files/ContextInformation/Provision/056_04.json b/doc/files/ContextInformation/Provision/056_04.json index 07b1ba992..ee31f3ed0 100644 --- a/doc/files/ContextInformation/Provision/056_04.json +++ b/doc/files/ContextInformation/Provision/056_04.json @@ -1,6 +1,6 @@ { "tp_id": "TP/NGSI-LD/CI/Prov/E/056_04", - "test_objective": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "test_objective": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 4.5.5, 5.6.17, 6.5.3.4", "config_id": "", "parent_release": "v1.6.1", @@ -22,77 +22,77 @@ { "name": "056_04_01 Delete a Property instance", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_04_01", - "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_5", "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property-default-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-property.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-property-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, { "name": "056_04_02 Delete a Relationship instance", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_04_02", - "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_5", "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship-default-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-relationship-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, { "name": "056_04_03 Delete a GeoProperty instance", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_04_03", - "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_5", "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty-default-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-geoproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-geoproperty-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" }, { "name": "056_04_04 Delete a LanguageProperty instance", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_04_04", - "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "doc": "Check that one can delete a specific attribute instance using NGSI-LD Null in a Merge Entity operation", "tags": [ "4_5_18", "4_5_5", "5_6_17", "6_5_3_4", - "be-merge", + "e-merge", "since_v1.6.1" ], "setup": "Setup Initial Entity", "teardown": "Delete Initial Entity", "template": "Merge Entity Scenarios", - "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty-default-instance.jsonld'\n}", - "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-languageproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-languageproperty-instance.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", "http_verb": "PATCH", "endpoint": "entities/{entity_id}" } diff --git a/doc/files/ContextInformation/Provision/056_05.json b/doc/files/ContextInformation/Provision/056_05.json new file mode 100644 index 000000000..0961c38a0 --- /dev/null +++ b/doc/files/ContextInformation/Provision/056_05.json @@ -0,0 +1,106 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/E/056_05", + "test_objective": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 4.5.5, 5.6.17, 6.5.3.4", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.18", + "4.5.5", + "5.6.17", + "6.5.3.4" + ], + "pics_selection": "", + "keywords": [ + "Merge Entity Scenarios", + "Setup Initial Entity", + "Delete Initial Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "056_05_01 Delete a Property instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_05_01", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "4_5_5", + "5_6_17", + "6_5_3_4", + "e-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-property-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-property.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "056_05_02 Delete a Relationship instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_05_02", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "4_5_5", + "5_6_17", + "6_5_3_4", + "e-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-relationship-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "056_05_03 Delete a GeoProperty instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_05_03", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "4_5_5", + "5_6_17", + "6_5_3_4", + "e-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-geoproperty-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-geoproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "056_05_04 Delete a LanguageProperty instance", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/E/056_05_04", + "doc": "Check that one can delete the default attribute instance using NGSI-LD Null in a Merge Entity operation", + "tags": [ + "4_5_18", + "4_5_5", + "5_6_17", + "6_5_3_4", + "e-merge", + "since_v1.6.1" + ], + "setup": "Setup Initial Entity", + "teardown": "Delete Initial Entity", + "template": "Merge Entity Scenarios", + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Query Entity with Response Body containing en entity element with id set to 'entity_id=${entity_id}' and body content set to 'ngsild-null/building-deleted-languageproperty-default-instance.jsonld'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-languageproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Provision/Entities/MergeEntity", + "robotfile": "056_05" +} \ No newline at end of file -- GitLab From 49d914c866f5df5f8367dc8fc27bef3f8412f76e Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Thu, 16 Jan 2025 10:59:49 +0100 Subject: [PATCH 8/9] feat: add TCs for Temporal Representation of deleted scopes --- .../020_19.robot | 60 ++++++++++++++++++ .../020_20.robot | 61 +++++++++++++++++++ ...oral-representation-property-020-19.jsonld | 10 +++ ...oral-representation-property-020-20.jsonld | 17 ++++++ ...hicle-temporal-representation-scope.jsonld | 23 +++++++ .../Consumption/020_19.json | 44 +++++++++++++ .../Consumption/020_20.json | 44 +++++++++++++ 7 files changed, 259 insertions(+) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_19.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_20.robot create mode 100644 data/temporalEntities/expectations/vehicle-temporal-representation-property-020-19.jsonld create mode 100644 data/temporalEntities/expectations/vehicle-temporal-representation-property-020-20.jsonld create mode 100644 data/temporalEntities/vehicle-temporal-representation-scope.jsonld create mode 100644 doc/files/ContextInformation/Consumption/020_19.json create mode 100644 doc/files/ContextInformation/Consumption/020_20.json diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_19.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_19.robot new file mode 100644 index 000000000..ce06dcfc4 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_19.robot @@ -0,0 +1,60 @@ +*** Settings *** +Documentation Check that one can retrieve the temporal evolution of a scope following the deletedAt temporal property + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Temporal Entity +Test Teardown Delete Initial Temporal Entity +Test Template Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= vehicle-temporal-representation-scope.jsonld + + +*** Test Cases *** EXPECTATION_FILENAME +020_19_01 With a Scope + [Tags] te-retrieve 4_18 5_7_3 6_19_3_1 since_v1.6.1 + vehicle-temporal-representation-property-020-19.jsonld + + +*** Keywords *** +Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute + [Documentation] Check that one can retrieve the temporal evolution of a scope following the deletedAt temporal property + [Arguments] ${expectation_filename} + ${response}= Delete Entity Attributes + ... entityId=${temporal_entity_representation_id} + ... attributeId=scope + ... datasetId=${EMPTY} + ... deleteAll=false + ... context=${ngsild_test_suite_context} + + ${response2}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... timeproperty=deletedAt + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response2.status_code} + Check Response Body Containing EntityTemporal element + ... filename=${expectation_filename} + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... response_body=${response2.json()} + ... excluded_regex=deletedAt + Should Have Value In Json + ... json_object=${response2.json()} + ... json_path=['scope']['deletedAt'] + +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${create_response}= Create Temporal Representation Of Entity + ... ${vehicle_payload_file} + ... ${temporal_entity_representation_id} + Check Response Status Code 201 ${create_response.status_code} + Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_20.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_20.robot new file mode 100644 index 000000000..5ecf2beb4 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_20.robot @@ -0,0 +1,61 @@ +*** Settings *** +Documentation Check that one can retrieve the temporal evolution of a scope following the deletedAt temporal property with temporal values + +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Temporal Entity +Test Teardown Delete Initial Temporal Entity +Test Template Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${vehicle_payload_file}= vehicle-temporal-representation-scope.jsonld + + +*** Test Cases *** EXPECTATION_FILENAME +020_20_01 With a Scope + [Tags] te-retrieve 4_18 5_7_3 6_19_3_1 since_v1.6.1 + vehicle-temporal-representation-property-020-20.jsonld + + +*** Keywords *** +Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute + [Documentation] Check that one can retrieve the temporal evolution of a scope following the deletedAt temporal property with temporal values + [Arguments] ${expectation_filename} + ${response}= Delete Entity Attributes + ... entityId=${temporal_entity_representation_id} + ... attributeId=scope + ... datasetId=${EMPTY} + ... deleteAll=false + ... context=${ngsild_test_suite_context} + + ${response2}= Retrieve Temporal Representation Of Entity + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... timeproperty=deletedAt + ... options=temporalValues + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response2.status_code} + Check Response Body Containing EntityTemporal element + ... filename=${expectation_filename} + ... temporal_entity_representation_id=${temporal_entity_representation_id} + ... response_body=${response2.json()} + ... excluded_regex=root\\['scope'\\]\\['values'\\]\\[0\\]\\[1\\] + Should Have Value In Json + ... json_object=${response2.json()} + ... json_path=['scope']['values'][0][1] + +Create Temporal Entity + ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${create_response}= Create Temporal Representation Of Entity + ... ${vehicle_payload_file} + ... ${temporal_entity_representation_id} + Check Response Status Code 201 ${create_response.status_code} + Set Suite Variable ${temporal_entity_representation_id} + +Delete Initial Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-property-020-19.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-property-020-19.jsonld new file mode 100644 index 000000000..42930839f --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-property-020-19.jsonld @@ -0,0 +1,10 @@ +{ + "id": "urn:ngsi-ld:Vehicle:4413459323492023", + "type": "Vehicle", + "fuelLevel": [], + "scope": { + "type": "Property", + "value": [], + "deletedAt": "2024-12-19T08:43:32.422444Z" + } +} \ No newline at end of file diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-property-020-20.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-property-020-20.jsonld new file mode 100644 index 000000000..cf5f41aba --- /dev/null +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-property-020-20.jsonld @@ -0,0 +1,17 @@ +{ + "id": "urn:ngsi-ld:Vehicle:3998258693070791", + "type": "Vehicle", + "fuelLevel": { + "type": "Property", + "values": [] + }, + "scope": { + "type": "Property", + "values": [ + [ + [], + "2024-12-19T08:48:50.936936Z" + ] + ] + } +} \ No newline at end of file diff --git a/data/temporalEntities/vehicle-temporal-representation-scope.jsonld b/data/temporalEntities/vehicle-temporal-representation-scope.jsonld new file mode 100644 index 000000000..372efae63 --- /dev/null +++ b/data/temporalEntities/vehicle-temporal-representation-scope.jsonld @@ -0,0 +1,23 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "scope": [ + "/Madrid/Gardens/ParqueNorte", + "/CompanyA/OrganizationB/UnitC" + ], + "fuelLevel": [ + { + "type": "Property", + "value": 67, + "observedAt": "2020-08-01T12:03:00Z" + }, + { + "type": "Property", + "value": 53, + "observedAt": "2020-08-01T13:05:00Z" + } + ], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/020_19.json b/doc/files/ContextInformation/Consumption/020_19.json new file mode 100644 index 000000000..5085fe9db --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_19.json @@ -0,0 +1,44 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_19", + "test_objective": "Check that one can retrieve the temporal evolution of a scope following the deletedAt temporal property", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.18, 5.7.3, 6.19.3.1", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.18", + "5.7.3", + "6.19.3.1" + ], + "pics_selection": "", + "keywords": [ + "Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute", + "Create Temporal Entity", + "Delete Initial Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n}", + "test_cases": [ + { + "name": "020_19_01 With a Scope", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_19_01", + "doc": "Check that one can retrieve the temporal evolution of a scope following the deletedAt temporal property", + "tags": [ + "4_18", + "5_7_3", + "6_19_3_1", + "since_v1.6.1", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-representation-property-020-19.jsonld'\n * the id was changed to 'temporal_entity_representation_id=${temporal_entity_representation_id}'\n * response body to be checked set to 'response_body=${response2.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to 'scope' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_19" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/020_20.json b/doc/files/ContextInformation/Consumption/020_20.json new file mode 100644 index 000000000..4e570587d --- /dev/null +++ b/doc/files/ContextInformation/Consumption/020_20.json @@ -0,0 +1,44 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/TE/020_20", + "test_objective": "Check that one can retrieve the temporal evolution of a scope following the deletedAt temporal property with temporal values", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.18, 5.7.3, 6.19.3.1", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.18", + "5.7.3", + "6.19.3.1" + ], + "pics_selection": "", + "keywords": [ + "Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute", + "Create Temporal Entity", + "Delete Initial Temporal Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Temporal Entity ${entity} \n with an id set to ${temporal_entity_representation_id} \n}", + "test_cases": [ + { + "name": "020_20_01 With a Scope", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/020_20_01", + "doc": "Check that one can retrieve the temporal evolution of a scope following the deletedAt temporal property with temporal values", + "tags": [ + "4_18", + "5_7_3", + "6_19_3_1", + "since_v1.6.1", + "te-retrieve" + ], + "setup": "Create Temporal Entity", + "teardown": "Delete Initial Temporal Entity", + "template": "Delete Temporal Attribute and Retrieve Temporal Evolution of Attribute", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Temporal Representation Of Entity with Response Status Code set to 200 and\n Retrieve Temporal Representation Of Entity with Response Body containing EntityTemporal element containing attribute instances in the time range specified by the NGSI-LD temporal query:\n * the payload is defined in the file set to 'vehicle-temporal-representation-property-020-20.jsonld'\n * the id was changed to 'temporal_entity_representation_id=${temporal_entity_representation_id}'\n * response body to be checked set to 'response_body=${response2.json()}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${temporal_entity_representation_id}' and\n Query Parameter: attributeId set to 'scope' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to 'false' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity", + "robotfile": "020_20" +} \ No newline at end of file -- GitLab From 471a5aba3e4d233b78e33e16b18fe18dec905669 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Thu, 16 Jan 2025 11:35:00 +0100 Subject: [PATCH 9/9] feat: add TCs for entityDeleted and attributeDeleted notification triggers in subscriptions (#25) --- .../046_06.robot | 8 +- .../046_21_01.robot | 48 ++++++++++ .../046_21_02.robot | 51 +++++++++++ .../046_22_01.robot | 50 ++++++++++ .../046_22_02.robot | 52 +++++++++++ .../046_22_03.robot | 44 +++++++++ .../046_22_04.robot | 52 +++++++++++ .../046_22_05.robot | 51 +++++++++++ .../046_22_06.robot | 52 +++++++++++ .../046_22_07.robot | 52 +++++++++++ .../046_22_08.robot | 53 +++++++++++ .../046_22_09.robot | 89 ++++++++++++++++++ .../046_22_10.robot | 89 ++++++++++++++++++ .../046_22_11.robot | 89 ++++++++++++++++++ .../UpdateSubscription/029_06.robot | 2 +- ...ted-name-attribute-instance-keyValues.json | 18 ++++ ...ed-name-attribute-instance-normalized.json | 36 ++++++++ ...tity-deleted-name-attribute-keyValues.json | 8 ++ ...ity-deleted-name-attribute-normalized.json | 22 +++++ ...eleted-locatedAt-attribute-normalized.json | 29 ++++++ ...pes-deleted-name-attribute-normalized.json | 29 ++++++ ...s-deleted-street-attribute-normalized.json | 28 ++++++ .../expectations/subscription-028-01.jsonld | 4 + ...subscription-vehicle-expanded-types.jsonld | 4 + .../expectations/subscription-vehicle.jsonld | 4 + .../expectations/subscriptions-030-03.json | 6 +- .../expectations/subscriptions-031-01.json | 18 +++- ...entities-attributeDeleted-keyValues.jsonld | 22 +++++ ...Deleted-languageproperty-normalized.jsonld | 25 +++++ ...buteDeleted-relationship-normalized.jsonld | 25 +++++ ...eleted-specific-attribute-keyValues.jsonld | 25 +++++ ...cific-attribute-normalized-sysAttrs.jsonld | 26 ++++++ ...leted-specific-attribute-normalized.jsonld | 25 +++++ ...on-building-entities-entityCreated.jsonld} | 5 +- ...ing-entities-entityDeleted-sysAttrs.jsonld | 23 +++++ ...ion-building-entities-entityDeleted.jsonld | 22 +++++ doc/analysis/checks.py | 16 +++- doc/analysis/initial_setup.py | 12 +++ .../Subscription/029_06.json | 4 +- .../Subscription/046_06.json | 9 +- .../Subscription/046_21_01.json | 39 ++++++++ .../Subscription/046_21_02.json | 39 ++++++++ .../Subscription/046_22_01.json | 39 ++++++++ .../Subscription/046_22_02.json | 39 ++++++++ .../Subscription/046_22_03.json | 39 ++++++++ .../Subscription/046_22_04.json | 39 ++++++++ .../Subscription/046_22_05.json | 39 ++++++++ .../Subscription/046_22_06.json | 41 +++++++++ .../Subscription/046_22_07.json | 41 +++++++++ .../Subscription/046_22_08.json | 41 +++++++++ .../Subscription/046_22_09.json | 77 ++++++++++++++++ .../Subscription/046_22_10.json | 77 ++++++++++++++++ .../Subscription/046_22_11.json | 81 +++++++++++++++++ .../test_ContextInformation_Subscription.py | 91 +++++++++++++++++++ .../ContextInformationProvision.resource | 2 + .../ContextInformationSubscription.resource | 2 + resources/AssertionUtils.resource | 11 +++ resources/SubscriptionUtils.resource | 30 ++++++ 58 files changed, 1976 insertions(+), 18 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_01.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_01.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_02.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_03.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_04.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_05.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_06.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_07.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_08.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_09.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_10.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_11.robot create mode 100644 data/subscriptions/expectations/entity-deleted-name-attribute-instance-keyValues.json create mode 100644 data/subscriptions/expectations/entity-deleted-name-attribute-instance-normalized.json create mode 100644 data/subscriptions/expectations/entity-deleted-name-attribute-keyValues.json create mode 100644 data/subscriptions/expectations/entity-deleted-name-attribute-normalized.json create mode 100644 data/subscriptions/expectations/entity-different-attributes-types-deleted-locatedAt-attribute-normalized.json create mode 100644 data/subscriptions/expectations/entity-different-attributes-types-deleted-name-attribute-normalized.json create mode 100644 data/subscriptions/expectations/entity-different-attributes-types-deleted-street-attribute-normalized.json create mode 100644 data/subscriptions/subscription-building-entities-attributeDeleted-keyValues.jsonld create mode 100644 data/subscriptions/subscription-building-entities-attributeDeleted-languageproperty-normalized.jsonld create mode 100644 data/subscriptions/subscription-building-entities-attributeDeleted-relationship-normalized.jsonld create mode 100644 data/subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-keyValues.jsonld create mode 100644 data/subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-normalized-sysAttrs.jsonld create mode 100644 data/subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-normalized.jsonld rename data/subscriptions/{subscription-building-entities-active-query.jsonld => subscription-building-entities-entityCreated.jsonld} (89%) create mode 100644 data/subscriptions/subscription-building-entities-entityDeleted-sysAttrs.jsonld create mode 100644 data/subscriptions/subscription-building-entities-entityDeleted.jsonld create mode 100644 doc/files/ContextInformation/Subscription/046_21_01.json create mode 100644 doc/files/ContextInformation/Subscription/046_21_02.json create mode 100644 doc/files/ContextInformation/Subscription/046_22_01.json create mode 100644 doc/files/ContextInformation/Subscription/046_22_02.json create mode 100644 doc/files/ContextInformation/Subscription/046_22_03.json create mode 100644 doc/files/ContextInformation/Subscription/046_22_04.json create mode 100644 doc/files/ContextInformation/Subscription/046_22_05.json create mode 100644 doc/files/ContextInformation/Subscription/046_22_06.json create mode 100644 doc/files/ContextInformation/Subscription/046_22_07.json create mode 100644 doc/files/ContextInformation/Subscription/046_22_08.json create mode 100644 doc/files/ContextInformation/Subscription/046_22_09.json create mode 100644 doc/files/ContextInformation/Subscription/046_22_10.json create mode 100644 doc/files/ContextInformation/Subscription/046_22_11.json create mode 100644 resources/SubscriptionUtils.resource diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_06.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_06.robot index f98d8714a..a5bc12c4f 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_06.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_06.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation If a Subscription does not define a timeInterval member, the notification shall be sent whenever an entity matches the query defined in the subscription. The notification message shall include all the subscribed Entities that changed and that match (as mandated by clauses 4.9 and 4.10) the query and geoquery conditions +Documentation Check that a notification is sent when an entity is created and entityCreated notification trigger is configured Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource @@ -13,7 +13,7 @@ Suite Teardown Delete Server And Subscriptions *** Variables *** ${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${subscription_payload_file_path}= subscriptions/subscription-building-entities-active-query.jsonld +${subscription_payload_file_path}= subscriptions/subscription-building-entities-entityCreated.jsonld ${building_id_prefix}= urn:ngsi-ld:Building: ${building_filename}= building-location-attribute.jsonld ${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify @@ -21,8 +21,8 @@ ${notification_server_send_url}= http://${notification_server_host}:${not *** Test Cases *** 046_06_01 Check that a notification is sent with all matching entities - [Documentation] only the subscribed Entities matching the query and watched attributes shall be included. - [Tags] sub-notification 5_8_6 + [Documentation] Check that a notification is sent when an entity is created and entityCreated notification trigger is configured + [Tags] sub-notification 5_8_6 since_v1.6.1 ${entity_id}= Generate Random Entity Id ${building_id_prefix} Set Suite Variable ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_01.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_01.robot new file mode 100644 index 000000000..2e5b8f652 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_01.robot @@ -0,0 +1,48 @@ +*** Settings *** +Documentation Check that a notification is sent when an entity is deleted +... and entityDeleted notification trigger is configured + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/SubscriptionUtils.resource + +Test Setup Create Initial Subscription And Entity +Test Teardown Delete Initial Subscription And Entity + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-building-entities-entityDeleted.jsonld +${building_filename}= building-location-attribute.jsonld + + +*** Test Cases *** +046_21_01 Check that a notification is sent with matching entity + [Documentation] Delete an entity and check the received notification + [Tags] sub-notification 5_8_6 since_v1.6.1 + + ${response}= Delete Entity by Id + ... id=${entity_id} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + ${notified_entity}= Set Variable ${notification}[data][0] + Length Should Be ${notified_entity} ${3} + Should be Equal ${entity_id} ${notified_entity}[id] + Should Have Value In Json + ... json_object=${notified_entity} + ... json_path=['deletedAt'] + + +*** Keywords *** +Create Initial Subscription And Entity + Create Subscription And Entity ${subscription_payload_file_path} ${building_filename} + Start Local Server ${notification_server_host} ${notification_server_port} + +Delete Initial Subscription And Entity + Delete Subscription ${subscription_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot new file mode 100644 index 000000000..6138ce24e --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation Check that a notification is sent with sysAttrs when an entity is deleted +... and entityDeleted notification trigger is configured + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/SubscriptionUtils.resource + +Test Setup Create Initial Subscription And Entity +Test Teardown Delete Initial Subscription And Entity + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-building-entities-entityDeleted-sysAttrs.jsonld +${building_filename}= building-location-attribute.jsonld + + +*** Test Cases *** +046_21_02 Check that a notification is sent with matching entity + [Documentation] Delete an entity and check the received notification + [Tags] sub-notification 5_8_6 since_v1.6.1 + + ${response}= Delete Entity by Id + ... id=${entity_id} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + ${notified_entity}= Set Variable ${notification}[data][0] + Length Should Be ${notified_entity} ${4} + Should be Equal ${entity_id} ${notified_entity}[id] + Should Have Value In Json + ... json_object=${notified_entity} + ... json_path=['createdAt'] + Should Have Value In Json + ... json_object=${notified_entity} + ... json_path=['deletedAt'] + + +*** Keywords *** +Create Initial Subscription And Entity + Create Subscription And Entity ${subscription_payload_file_path} ${building_filename} + Start Local Server ${notification_server_host} ${notification_server_port} + +Delete Initial Subscription And Entity + Delete Subscription ${subscription_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_01.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_01.robot new file mode 100644 index 000000000..25ed9e54f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_01.robot @@ -0,0 +1,50 @@ +*** Settings *** +Documentation Check that a notification is sent with keyValues when an attribute is deleted +... and attributeDeleted notification trigger is configured + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/SubscriptionUtils.resource + +Test Setup Create Initial Subscription And Entity +Test Teardown Delete Initial Subscription And Entity + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-building-entities-attributeDeleted-keyValues.jsonld +${building_filename}= building-simple-attributes.jsonld +${entity_expectation_file_path}= entity-deleted-name-attribute-keyValues.json + + +*** Test Cases *** +046_22_01 Check that a notification is sent with matching entity + [Documentation] Delete an attribute and check the received notification + [Tags] sub-notification 5_8_6 since_v1.6.1 + + ${response}= Delete Entity Attributes + ... entityId=${entity_id} + ... attributeId=name + ... datasetId=${EMPTY} + ... deleteAll=${EMPTY} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Should be Equal ${entity_id} ${notification}[data][0][id] + Check Notification Containing Entity Element + ... ${entity_expectation_file_path} + ... ${notification} + + +*** Keywords *** +Create Initial Subscription And Entity + Create Subscription And Entity ${subscription_payload_file_path} ${building_filename} + Start Local Server ${notification_server_host} ${notification_server_port} + +Delete Initial Subscription And Entity + Delete Subscription ${subscription_id} + Delete Entity by Id ${entity_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_02.robot new file mode 100644 index 000000000..aeffec036 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_02.robot @@ -0,0 +1,52 @@ +*** Settings *** +Documentation Check that a notification is sent with keyValues when an attribute is deleted +... and attributeDeleted notification trigger is configured for this specific attribute + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/SubscriptionUtils.resource + +Test Setup Create Initial Subscription And Entity +Test Teardown Delete Initial Subscription And Entity + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-keyValues.jsonld +${building_filename}= building-simple-attributes.jsonld +${entity_expectation_file_path}= entity-deleted-name-attribute-keyValues.json + + +*** Test Cases *** +046_22_02 Check that a notification is sent with matching entity + [Documentation] Delete an attribute and check the received notification + [Tags] sub-notification 5_8_6 since_v1.6.1 + + ${response}= Delete Entity Attributes + ... entityId=${entity_id} + ... attributeId=name + ... datasetId=${EMPTY} + ... deleteAll=${EMPTY} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Check Notification Containing Entity Element + ... ${entity_expectation_file_path} + ... ${notification} + + +*** Keywords *** +Create Initial Subscription And Entity + Create Subscription And Entity ${subscription_payload_file_path} ${building_filename} + Start Local Server ${notification_server_host} ${notification_server_port} + +Delete Initial Subscription And Entity + Delete Subscription ${subscription_id} + Delete Entity by Id ${entity_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_03.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_03.robot new file mode 100644 index 000000000..f7a5cf821 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_03.robot @@ -0,0 +1,44 @@ +*** Settings *** +Documentation Check that a notification is not sent when an attribute is deleted +... and attributeDeleted notification trigger is not configured for this specific attribute + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/SubscriptionUtils.resource + +Test Setup Create Initial Subscription And Entity +Test Teardown Delete Initial Subscription And Entity + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-keyValues.jsonld +${building_filename}= building-simple-attributes.jsonld + + +*** Test Cases *** +046_22_03 Check that a notification is not sent with updated entity + [Documentation] Delete a not watched attribute and check no notification is received + [Tags] sub-notification 5_8_6 since_v1.6.1 + + ${response}= Delete Entity Attributes + ... entityId=${entity_id} + ... attributeId=airQualityLevel + ... datasetId=${EMPTY} + ... deleteAll=${EMPTY} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for no notification timeout=${10} + + +*** Keywords *** +Create Initial Subscription And Entity + Create Subscription And Entity ${subscription_payload_file_path} ${building_filename} + Start Local Server ${notification_server_host} ${notification_server_port} + +Delete Initial Subscription And Entity + Delete Subscription ${subscription_id} + Delete Entity by Id ${entity_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_04.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_04.robot new file mode 100644 index 000000000..ec7f5e8e0 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_04.robot @@ -0,0 +1,52 @@ +*** Settings *** +Documentation Check that a notification is sent in normalized format when an attribute is deleted +... and attributeDeleted notification trigger is configured for this specific attribute + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/SubscriptionUtils.resource + +Test Setup Create Initial Subscription And Entity +Test Teardown Delete Initial Subscription And Entity + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-normalized.jsonld +${building_filename}= building-simple-attributes.jsonld +${entity_expectation_file_path}= entity-deleted-name-attribute-normalized.json + + +*** Test Cases *** +046_22_04 Check that a notification is sent with matching entity + [Documentation] Delete an attribute and check the received notification + [Tags] sub-notification 5_8_6 since_v1.6.1 + + ${response}= Delete Entity Attributes + ... entityId=${entity_id} + ... attributeId=name + ... datasetId=${EMPTY} + ... deleteAll=${EMPTY} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Check Notification Containing Entity Element + ... ${entity_expectation_file_path} + ... ${notification} + + +*** Keywords *** +Create Initial Subscription And Entity + Create Subscription And Entity ${subscription_payload_file_path} ${building_filename} + Start Local Server ${notification_server_host} ${notification_server_port} + +Delete Initial Subscription And Entity + Delete Subscription ${subscription_id} + Delete Entity by Id ${entity_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_05.robot new file mode 100644 index 000000000..5c0c837f5 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_05.robot @@ -0,0 +1,51 @@ +*** Settings *** +Documentation Check that a notification is sent in normalized format with sysAttrs when an attribute is deleted +... and attributeDeleted notification trigger is configured for this specific attribute + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/SubscriptionUtils.resource + +Test Setup Create Initial Subscription And Entity +Test Teardown Delete Initial Subscription And Entity + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-normalized-sysAttrs.jsonld +${building_filename}= building-simple-attributes.jsonld + + +*** Test Cases *** +046_22_05 Check that a notification is sent with matching entity + [Documentation] Delete an attribute and check the received notification + [Tags] sub-notification 5_8_6 since_v1.6.1 + + ${response}= Delete Entity Attributes + ... entityId=${entity_id} + ... attributeId=name + ... datasetId=${EMPTY} + ... deleteAll=${EMPTY} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Should Have Value In Json + ... json_object=${notification}[data][0][name] + ... json_path=['deletedAt'] + + +*** Keywords *** +Create Initial Subscription And Entity + Create Subscription And Entity ${subscription_payload_file_path} ${building_filename} + Start Local Server ${notification_server_host} ${notification_server_port} + +Delete Initial Subscription And Entity + Delete Subscription ${subscription_id} + Delete Entity by Id ${entity_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_06.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_06.robot new file mode 100644 index 000000000..09856c7d3 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_06.robot @@ -0,0 +1,52 @@ +*** Settings *** +Documentation Check that a notification is sent in normalized format when an attribute with a specific datasetId is deleted +... and attributeDeleted notification trigger is configured for this specific attribute + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/SubscriptionUtils.resource + +Test Setup Create Initial Subscription And Entity +Test Teardown Delete Initial Subscription And Entity + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-normalized.jsonld +${building_filename}= building-multi-instances-attributes.jsonld +${entity_expectation_file_path}= entity-deleted-name-attribute-instance-normalized.json + + +*** Test Cases *** +046_22_06 Check that a notification is sent with matching entity + [Documentation] Delete an attribute with a specific datasetId and check the received notification + [Tags] sub-notification 5_8_6 4_5_5 since_v1.6.1 + + ${response}= Delete Entity Attributes + ... entityId=${entity_id} + ... attributeId=name + ... datasetId=urn:ngsi-ld:Dataset:french-name + ... deleteAll=${EMPTY} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Check Notification Containing Entity Element + ... ${entity_expectation_file_path} + ... ${notification} + + +*** Keywords *** +Create Initial Subscription And Entity + Create Subscription And Entity ${subscription_payload_file_path} ${building_filename} + Start Local Server ${notification_server_host} ${notification_server_port} + +Delete Initial Subscription And Entity + Delete Subscription ${subscription_id} + Delete Entity by Id ${entity_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_07.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_07.robot new file mode 100644 index 000000000..5d1f1e3b2 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_07.robot @@ -0,0 +1,52 @@ +*** Settings *** +Documentation Check that a notification is sent with keyValues when an attribute with a specific datasetId is deleted +... and attributeDeleted notification trigger is configured for this specific attribute + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/SubscriptionUtils.resource + +Test Setup Create Initial Subscription And Entity +Test Teardown Delete Initial Subscription And Entity + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-keyValues.jsonld +${building_filename}= building-multi-instances-attributes.jsonld +${entity_expectation_file_path}= entity-deleted-name-attribute-instance-keyValues.json + + +*** Test Cases *** +046_22_07 Check that a notification is sent with matching entity + [Documentation] Delete an attribute with a specific datasetId and check the received notification + [Tags] sub-notification 5_8_6 4_5_5 since_v1.6.1 + + ${response}= Delete Entity Attributes + ... entityId=${entity_id} + ... attributeId=name + ... datasetId=urn:ngsi-ld:Dataset:french-name + ... deleteAll=${EMPTY} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Check Notification Containing Entity Element + ... ${entity_expectation_file_path} + ... ${notification} + + +*** Keywords *** +Create Initial Subscription And Entity + Create Subscription And Entity ${subscription_payload_file_path} ${building_filename} + Start Local Server ${notification_server_host} ${notification_server_port} + +Delete Initial Subscription And Entity + Delete Subscription ${subscription_id} + Delete Entity by Id ${entity_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_08.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_08.robot new file mode 100644 index 000000000..caa9fd639 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_08.robot @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Check that a notification is sent when all instances of an attribute are deleted +... and attributeDeleted notification trigger is configured for this specific attribute + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/SubscriptionUtils.resource + +Test Setup Create Initial Subscription And Entity +Test Teardown Delete Initial Subscription And Entity + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-normalized.jsonld +${building_filename}= building-multi-instances-attributes.jsonld +${entity_expectation_file_path}= entity-deleted-name-attribute-instance-normalized.json + + +*** Test Cases *** +046_22_08 Check that a notification is sent with matching entity + [Documentation] Delete all instances of an attribute and check the received notification + [Tags] sub-notification 5_8_6 4_5_5 since_v1.6.1 + + ${response}= Delete Entity Attributes + ... entityId=${entity_id} + ... attributeId=name + ... datasetId=${EMPTY} + ... deleteAll=${true} + ... context=${ngsild_test_suite_context} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Check JSON Value In Response Body + ... json_path_expr=['name']['value'] + ... value_to_check=urn:ngsi-ld:null + ... response_body=${notification}[data][0] + + +*** Keywords *** +Create Initial Subscription And Entity + Create Subscription And Entity ${subscription_payload_file_path} ${building_filename} + Start Local Server ${notification_server_host} ${notification_server_port} + +Delete Initial Subscription And Entity + Delete Subscription ${subscription_id} + Delete Entity by Id ${entity_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_09.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_09.robot new file mode 100644 index 000000000..3d9162c68 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_09.robot @@ -0,0 +1,89 @@ +*** Settings *** +Documentation Check that a notification is sent in normalized format when an attribute is deleted via NGSI-LD Null +... in a Merge Entity operation and attributeDeleted notification trigger is configured for this specific attribute + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/SubscriptionUtils.resource + +Test Setup Create Initial Subscription And Entity +Test Teardown Delete Initial Subscription And Entity + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-normalized.jsonld +${building_filename}= building-different-attributes-types.jsonld +${entity_expectation_file_path}= entity-different-attributes-types-deleted-name-attribute-normalized.json + + +*** Test Cases *** +046_22_09_01 Check that a notification is sent with matching entity when deleting via Merge Entity operation + [Documentation] Delete an attribute via Merge Entity operation and check the received notification + [Tags] sub-notification 5_8_6 since_v1.6.1 + + ${response}= Merge Entity + ... entity_id=${entity_id} + ... entity_filename=fragmentEntities/ngsild-null/building-null-property.jsonld + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Check Notification Containing Entity Element + ... ${entity_expectation_file_path} + ... ${notification} + +046_22_09_02 Check that a notification is sent with matching entity when deleting via Update Attributes operation + [Documentation] Delete an attribute via Update Attributes operation and check the received notification + [Tags] sub-notification 5_8_6 since_v1.6.1 + + ${response}= Update Entity Attributes + ... id=${entity_id} + ... fragment_filename=ngsild-null/null-property.jsonld + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Check Notification Containing Entity Element + ... ${entity_expectation_file_path} + ... ${notification} + +046_22_09_03 Check that a notification is sent with matching entity when deleting via Partial Attribute Update operation + [Documentation] Delete an attribute via Update Partial Attribute Update operation and check the received notification + [Tags] sub-notification 5_8_6 since_v1.6.1 + + ${response}= Partial Update Entity Attributes + ... entityId=${entity_id} + ... attributeId=name + ... fragment_filename=ngsild-null/null-property-fragment.jsonld + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Check Notification Containing Entity Element + ... ${entity_expectation_file_path} + ... ${notification} + + +*** Keywords *** +Create Initial Subscription And Entity + Create Subscription And Entity ${subscription_payload_file_path} ${building_filename} + Start Local Server ${notification_server_host} ${notification_server_port} + +Delete Initial Subscription And Entity + Delete Subscription ${subscription_id} + Delete Entity by Id ${entity_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_10.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_10.robot new file mode 100644 index 000000000..fd960fb8f --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_10.robot @@ -0,0 +1,89 @@ +*** Settings *** +Documentation Check that a notification is sent in normalized format when a relationship is deleted via NGSI-LD Null +... in a Merge Entity operation and attributeDeleted notification trigger is configured for this specific relationship + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/SubscriptionUtils.resource + +Test Setup Create Initial Subscription And Entity +Test Teardown Delete Initial Subscription And Entity + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-building-entities-attributeDeleted-relationship-normalized.jsonld +${building_filename}= building-different-attributes-types.jsonld +${entity_expectation_file_path}= entity-different-attributes-types-deleted-locatedAt-attribute-normalized.json + + +*** Test Cases *** +046_22_10_01 Check that a notification is sent with matching entity when deleting via Merge Entity operation + [Documentation] Delete a relationship via Merge Entity operation and check the received notification + [Tags] sub-notification 5_8_6 since_v1.6.1 + + ${response}= Merge Entity + ... entity_id=${entity_id} + ... entity_filename=fragmentEntities/ngsild-null/building-null-relationship.jsonld + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Check Notification Containing Entity Element + ... ${entity_expectation_file_path} + ... ${notification} + +046_22_10_02 Check that a notification is sent with matching entity when deleting via Update Attributes operation + [Documentation] Delete a relationship via Update Attributes operation and check the received notification + [Tags] sub-notification 5_8_6 since_v1.6.1 + + ${response}= Update Entity Attributes + ... id=${entity_id} + ... fragment_filename=ngsild-null/null-relationship.jsonld + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Check Notification Containing Entity Element + ... ${entity_expectation_file_path} + ... ${notification} + +046_22_10_03 Check that a notification is sent with matching entity when deleting via Partial Attribute Update operation + [Documentation] Delete a relationship via Update Partial Attribute Update operation and check the received notification + [Tags] sub-notification 5_8_6 since_v1.6.1 + + ${response}= Partial Update Entity Attributes + ... entityId=${entity_id} + ... attributeId=locatedAt + ... fragment_filename=ngsild-null/null-relationship-fragment.jsonld + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Check Notification Containing Entity Element + ... ${entity_expectation_file_path} + ... ${notification} + + +*** Keywords *** +Create Initial Subscription And Entity + Create Subscription And Entity ${subscription_payload_file_path} ${building_filename} + Start Local Server ${notification_server_host} ${notification_server_port} + +Delete Initial Subscription And Entity + Delete Subscription ${subscription_id} + Delete Entity by Id ${entity_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_11.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_11.robot new file mode 100644 index 000000000..69d425a86 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_11.robot @@ -0,0 +1,89 @@ +*** Settings *** +Documentation Check that a notification is sent in normalized format when a language property is deleted via NGSI-LD Null +... in a Merge Entity operation and attributeDeleted notification trigger is configured for this specific property + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/SubscriptionUtils.resource + +Test Setup Create Initial Subscription And Entity +Test Teardown Delete Initial Subscription And Entity + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-building-entities-attributeDeleted-languageproperty-normalized.jsonld +${building_filename}= building-different-attributes-types.jsonld +${entity_expectation_file_path}= entity-different-attributes-types-deleted-street-attribute-normalized.json + + +*** Test Cases *** +046_22_11_01 Check that a notification is sent with matching entity when deleting via Merge Entity operation + [Documentation] Delete a language property via Merge Entity operation and check the received notification + [Tags] sub-notification 5_8_6 4_5_18 since_v1.6.1 + + ${response}= Merge Entity + ... entity_id=${entity_id} + ... entity_filename=fragmentEntities/ngsild-null/building-null-languageproperty.jsonld + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Check Notification Containing Entity Element + ... ${entity_expectation_file_path} + ... ${notification} + +046_22_11_02 Check that a notification is sent with matching entity when deleting via Update Attributes operation + [Documentation] Delete a language property via Update Attributes operation and check the received notification + [Tags] sub-notification 5_8_6 4_5_18 since_v1.6.1 + + ${response}= Update Entity Attributes + ... id=${entity_id} + ... fragment_filename=ngsild-null/null-languageproperty.jsonld + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Check Notification Containing Entity Element + ... ${entity_expectation_file_path} + ... ${notification} + +046_22_11_03 Check that a notification is sent with matching entity when deleting via Partial Attribute Update operation + [Documentation] Delete a language property via Update Partial Attribute Update operation and check the received notification + [Tags] sub-notification 5_8_6 4_5_18 since_v1.6.1 + + ${response}= Partial Update Entity Attributes + ... entityId=${entity_id} + ... attributeId=street + ... fragment_filename=ngsild-null/null-languageproperty-fragment.jsonld + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 204 ${response.status_code} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Length Should Be ${notification}[data] ${1} + Should be Equal ${entity_id} ${notification}[data][0][id] + Check Notification Containing Entity Element + ... ${entity_expectation_file_path} + ... ${notification} + + +*** Keywords *** +Create Initial Subscription And Entity + Create Subscription And Entity ${subscription_payload_file_path} ${building_filename} + Start Local Server ${notification_server_host} ${notification_server_port} + +Delete Initial Subscription And Entity + Delete Subscription ${subscription_id} + Delete Entity by Id ${entity_id} + Stop Local Server diff --git a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot index c51ad7a43..45b847e29 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/UpdateSubscription/029_06.robot @@ -31,7 +31,7 @@ ${subscription_update_fragment_file_path}= subscriptions/fragments/subscrip ... id=${subscription_id} ... accept=${CONTENT_TYPE_LD_JSON} ... context=${ngsild_test_suite_context} - ${ignored_attributes}= Create List ${status_regex_expr} + ${ignored_attributes}= Create List ${status_regex_expr} notificationTrigger Check Updated Resource Set To ... updated_resource=${subscription} ... response_body=${response1.json()} diff --git a/data/subscriptions/expectations/entity-deleted-name-attribute-instance-keyValues.json b/data/subscriptions/expectations/entity-deleted-name-attribute-instance-keyValues.json new file mode 100644 index 000000000..cbd8cdbae --- /dev/null +++ b/data/subscriptions/expectations/entity-deleted-name-attribute-instance-keyValues.json @@ -0,0 +1,18 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": { + "dataset": { + "urn:ngsi-ld:Dataset:german-name": "Eiffelturm", + "@none": "Eiffel Tower", + "urn:ngsi-ld:Dataset:french-name": "urn:ngsi-ld:null" + } + }, + "locatedAt": { + "dataset": { + "urn:ngsi-ld:Dataset:french-name": "urn:ngsi-ld:Ville:Paris", + "urn:ngsi-ld:Dataset:spanish-name": "urn:ngsi-ld:Ciudad:Par\u00c3\u00ads", + "@none": "urn:ngsi-ld:City:Paris" + } + } +} \ No newline at end of file diff --git a/data/subscriptions/expectations/entity-deleted-name-attribute-instance-normalized.json b/data/subscriptions/expectations/entity-deleted-name-attribute-instance-normalized.json new file mode 100644 index 000000000..b96b1e6c0 --- /dev/null +++ b/data/subscriptions/expectations/entity-deleted-name-attribute-instance-normalized.json @@ -0,0 +1,36 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "name": [ + { + "type": "Property", + "value": "Eiffel Tower" + }, + { + "type": "Property", + "datasetId": "urn:ngsi-ld:Dataset:german-name", + "value": "Eiffelturm" + }, + { + "type": "Property", + "datasetId": "urn:ngsi-ld:Dataset:french-name", + "value": "urn:ngsi-ld:null" + } + ], + "locatedAt": [ + { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris" + }, + { + "type": "Relationship", + "datasetId": "urn:ngsi-ld:Dataset:french-name", + "object": "urn:ngsi-ld:Ville:Paris" + }, + { + "type": "Relationship", + "datasetId": "urn:ngsi-ld:Dataset:spanish-name", + "object": "urn:ngsi-ld:Ciudad:Par\u00c3\u00ads" + } + ] +} \ No newline at end of file diff --git a/data/subscriptions/expectations/entity-deleted-name-attribute-keyValues.json b/data/subscriptions/expectations/entity-deleted-name-attribute-keyValues.json new file mode 100644 index 000000000..a604bbd23 --- /dev/null +++ b/data/subscriptions/expectations/entity-deleted-name-attribute-keyValues.json @@ -0,0 +1,8 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "almostFull": false, + "subCategory": "tourism", + "airQualityLevel": 4, + "name": "urn:ngsi-ld:null" +} \ No newline at end of file diff --git a/data/subscriptions/expectations/entity-deleted-name-attribute-normalized.json b/data/subscriptions/expectations/entity-deleted-name-attribute-normalized.json new file mode 100644 index 000000000..f84706a7e --- /dev/null +++ b/data/subscriptions/expectations/entity-deleted-name-attribute-normalized.json @@ -0,0 +1,22 @@ +{ + "id": "urn:ngsi-ld:Building:randomUUID", + "type": "Building", + "almostFull": { + "type": "Property", + "value": false + }, + "subCategory": { + "type": "Property", + "value": "tourism" + }, + "airQualityLevel": { + "type": "Property", + "value": 4, + "unitCode": "C62", + "observedAt": "2020-09-09T16:40:00.000Z" + }, + "name": { + "type": "Property", + "value": "urn:ngsi-ld:null" + } +} \ No newline at end of file diff --git a/data/subscriptions/expectations/entity-different-attributes-types-deleted-locatedAt-attribute-normalized.json b/data/subscriptions/expectations/entity-different-attributes-types-deleted-locatedAt-attribute-normalized.json new file mode 100644 index 000000000..8e92bea6e --- /dev/null +++ b/data/subscriptions/expectations/entity-different-attributes-types-deleted-locatedAt-attribute-normalized.json @@ -0,0 +1,29 @@ +{ + "id": "urn:ngsi-ld:Building:4446320091579470", + "type": "Building", + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + -8.5, + 41.2 + ] + } + }, + "street": { + "type": "LanguageProperty", + "languageMap": { + "fr": "Grand Place", + "nl": "Grote Markt" + } + }, + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:null" + }, + "name": { + "type": "Property", + "value": "Eiffel Tower" + } +} \ No newline at end of file diff --git a/data/subscriptions/expectations/entity-different-attributes-types-deleted-name-attribute-normalized.json b/data/subscriptions/expectations/entity-different-attributes-types-deleted-name-attribute-normalized.json new file mode 100644 index 000000000..44fc4c470 --- /dev/null +++ b/data/subscriptions/expectations/entity-different-attributes-types-deleted-name-attribute-normalized.json @@ -0,0 +1,29 @@ +{ + "id": "urn:ngsi-ld:Building:4446320091579470", + "type": "Building", + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + -8.5, + 41.2 + ] + } + }, + "street": { + "type": "LanguageProperty", + "languageMap": { + "fr": "Grand Place", + "nl": "Grote Markt" + } + }, + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris" + }, + "name": { + "type": "Property", + "value": "urn:ngsi-ld:null" + } +} \ No newline at end of file diff --git a/data/subscriptions/expectations/entity-different-attributes-types-deleted-street-attribute-normalized.json b/data/subscriptions/expectations/entity-different-attributes-types-deleted-street-attribute-normalized.json new file mode 100644 index 000000000..c887b198c --- /dev/null +++ b/data/subscriptions/expectations/entity-different-attributes-types-deleted-street-attribute-normalized.json @@ -0,0 +1,28 @@ +{ + "id": "urn:ngsi-ld:Building:4446320091579470", + "type": "Building", + "location": { + "type": "GeoProperty", + "value": { + "type": "Point", + "coordinates": [ + -8.5, + 41.2 + ] + } + }, + "street": { + "type": "LanguageProperty", + "languageMap": { + "@none": "urn:ngsi-ld:null" + } + }, + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris" + }, + "name": { + "type": "Property", + "value": "Eiffel Tower" + } +} \ No newline at end of file diff --git a/data/subscriptions/expectations/subscription-028-01.jsonld b/data/subscriptions/expectations/subscription-028-01.jsonld index 81afd4bd0..f0ba00845 100644 --- a/data/subscriptions/expectations/subscription-028-01.jsonld +++ b/data/subscriptions/expectations/subscription-028-01.jsonld @@ -15,6 +15,10 @@ } }, "status": "active", + "notificationTrigger": [ + "attributeCreated", + "attributeUpdated" + ], "@context":[ "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" ] diff --git a/data/subscriptions/expectations/subscription-vehicle-expanded-types.jsonld b/data/subscriptions/expectations/subscription-vehicle-expanded-types.jsonld index 2ba30b1f0..e46028212 100644 --- a/data/subscriptions/expectations/subscription-vehicle-expanded-types.jsonld +++ b/data/subscriptions/expectations/subscription-vehicle-expanded-types.jsonld @@ -15,6 +15,10 @@ } }, "status": "active", + "notificationTrigger": [ + "attributeCreated", + "attributeUpdated" + ], "@context":[ "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" ] diff --git a/data/subscriptions/expectations/subscription-vehicle.jsonld b/data/subscriptions/expectations/subscription-vehicle.jsonld index d7a683113..0ea0358d2 100644 --- a/data/subscriptions/expectations/subscription-vehicle.jsonld +++ b/data/subscriptions/expectations/subscription-vehicle.jsonld @@ -15,6 +15,10 @@ } }, "status": "active", + "notificationTrigger": [ + "attributeCreated", + "attributeUpdated" + ], "@context":[ "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" ] diff --git a/data/subscriptions/expectations/subscriptions-030-03.json b/data/subscriptions/expectations/subscriptions-030-03.json index 4056c0ab7..ea252d490 100644 --- a/data/subscriptions/expectations/subscriptions-030-03.json +++ b/data/subscriptions/expectations/subscriptions-030-03.json @@ -14,5 +14,9 @@ "accept":"application/json" } }, - "status": "active" + "status": "active", + "notificationTrigger": [ + "attributeCreated", + "attributeUpdated" + ] } \ No newline at end of file diff --git a/data/subscriptions/expectations/subscriptions-031-01.json b/data/subscriptions/expectations/subscriptions-031-01.json index 765af41a7..92a8cb331 100644 --- a/data/subscriptions/expectations/subscriptions-031-01.json +++ b/data/subscriptions/expectations/subscriptions-031-01.json @@ -15,7 +15,11 @@ "accept":"application/json" } }, - "status": "active" + "status": "active", + "notificationTrigger": [ + "attributeCreated", + "attributeUpdated" + ] }, { "id":"urn:ngsi-ld:Subscription:randomUUID", @@ -36,7 +40,11 @@ "accept":"application/json" } }, - "status": "active" + "status": "active", + "notificationTrigger": [ + "attributeCreated", + "attributeUpdated" + ] }, { "id":"urn:ngsi-ld:Subscription:randomUUID", @@ -54,6 +62,10 @@ } }, "isActive": false, - "status": "paused" + "status": "paused", + "notificationTrigger": [ + "attributeCreated", + "attributeUpdated" + ] } ] \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-attributeDeleted-keyValues.jsonld b/data/subscriptions/subscription-building-entities-attributeDeleted-keyValues.jsonld new file mode 100644 index 000000000..d3c47f1bc --- /dev/null +++ b/data/subscriptions/subscription-building-entities-attributeDeleted-keyValues.jsonld @@ -0,0 +1,22 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "notificationTrigger": [ + "attributeDeleted" + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-attributeDeleted-languageproperty-normalized.jsonld b/data/subscriptions/subscription-building-entities-attributeDeleted-languageproperty-normalized.jsonld new file mode 100644 index 000000000..f06986f08 --- /dev/null +++ b/data/subscriptions/subscription-building-entities-attributeDeleted-languageproperty-normalized.jsonld @@ -0,0 +1,25 @@ +{ + "id": "urn:ngsi-ld:Subscription:randomUUID", + "type": "Subscription", + "entities": [ + { + "type": "Building" + } + ], + "watchedAttributes": [ + "street" + ], + "notification": { + "format": "normalized", + "endpoint": { + "uri": "http://my.endpoint.org/notify", + "accept": "application/json" + } + }, + "notificationTrigger": [ + "attributeDeleted" + ], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-attributeDeleted-relationship-normalized.jsonld b/data/subscriptions/subscription-building-entities-attributeDeleted-relationship-normalized.jsonld new file mode 100644 index 000000000..4c70ac8b9 --- /dev/null +++ b/data/subscriptions/subscription-building-entities-attributeDeleted-relationship-normalized.jsonld @@ -0,0 +1,25 @@ +{ + "id": "urn:ngsi-ld:Subscription:randomUUID", + "type": "Subscription", + "entities": [ + { + "type": "Building" + } + ], + "watchedAttributes": [ + "locatedAt" + ], + "notification": { + "format": "normalized", + "endpoint": { + "uri": "http://my.endpoint.org/notify", + "accept": "application/json" + } + }, + "notificationTrigger": [ + "attributeDeleted" + ], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-keyValues.jsonld b/data/subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-keyValues.jsonld new file mode 100644 index 000000000..815d142b9 --- /dev/null +++ b/data/subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-keyValues.jsonld @@ -0,0 +1,25 @@ +{ + "id": "urn:ngsi-ld:Subscription:randomUUID", + "type": "Subscription", + "entities": [ + { + "type": "Building" + } + ], + "watchedAttributes": [ + "name" + ], + "notification": { + "format": "keyValues", + "endpoint": { + "uri": "http://my.endpoint.org/notify", + "accept": "application/json" + } + }, + "notificationTrigger": [ + "attributeDeleted" + ], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-normalized-sysAttrs.jsonld b/data/subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-normalized-sysAttrs.jsonld new file mode 100644 index 000000000..b58af8160 --- /dev/null +++ b/data/subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-normalized-sysAttrs.jsonld @@ -0,0 +1,26 @@ +{ + "id": "urn:ngsi-ld:Subscription:randomUUID", + "type": "Subscription", + "entities": [ + { + "type": "Building" + } + ], + "watchedAttributes": [ + "name" + ], + "notification": { + "format": "normalized", + "sysAttrs": true, + "endpoint": { + "uri": "http://my.endpoint.org/notify", + "accept": "application/json" + } + }, + "notificationTrigger": [ + "attributeDeleted" + ], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-normalized.jsonld b/data/subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-normalized.jsonld new file mode 100644 index 000000000..e2587812a --- /dev/null +++ b/data/subscriptions/subscription-building-entities-attributeDeleted-specific-attribute-normalized.jsonld @@ -0,0 +1,25 @@ +{ + "id": "urn:ngsi-ld:Subscription:randomUUID", + "type": "Subscription", + "entities": [ + { + "type": "Building" + } + ], + "watchedAttributes": [ + "name" + ], + "notification": { + "format": "normalized", + "endpoint": { + "uri": "http://my.endpoint.org/notify", + "accept": "application/json" + } + }, + "notificationTrigger": [ + "attributeDeleted" + ], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-active-query.jsonld b/data/subscriptions/subscription-building-entities-entityCreated.jsonld similarity index 89% rename from data/subscriptions/subscription-building-entities-active-query.jsonld rename to data/subscriptions/subscription-building-entities-entityCreated.jsonld index 716605713..252c42f05 100644 --- a/data/subscriptions/subscription-building-entities-active-query.jsonld +++ b/data/subscriptions/subscription-building-entities-entityCreated.jsonld @@ -1,13 +1,11 @@ { "id":"urn:ngsi-ld:Subscription:randomUUID", "type":"Subscription", - "isActive": true, "entities":[ { "type":"Building" } ], - "q":"name==\"Eiffel Tower\"", "notification":{ "format":"keyValues", "endpoint":{ @@ -15,6 +13,9 @@ "accept":"application/json" } }, + "notificationTrigger": [ + "entityCreated" + ], "@context":[ "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" ] diff --git a/data/subscriptions/subscription-building-entities-entityDeleted-sysAttrs.jsonld b/data/subscriptions/subscription-building-entities-entityDeleted-sysAttrs.jsonld new file mode 100644 index 000000000..9757ec95e --- /dev/null +++ b/data/subscriptions/subscription-building-entities-entityDeleted-sysAttrs.jsonld @@ -0,0 +1,23 @@ +{ + "id": "urn:ngsi-ld:Subscription:randomUUID", + "type": "Subscription", + "entities": [ + { + "type": "Building" + } + ], + "notification": { + "format": "keyValues", + "sysAttrs": true, + "endpoint": { + "uri": "http://my.endpoint.org/notify", + "accept": "application/json" + } + }, + "notificationTrigger": [ + "entityDeleted" + ], + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-building-entities-entityDeleted.jsonld b/data/subscriptions/subscription-building-entities-entityDeleted.jsonld new file mode 100644 index 000000000..da29f4ce5 --- /dev/null +++ b/data/subscriptions/subscription-building-entities-entityDeleted.jsonld @@ -0,0 +1,22 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "notificationTrigger": [ + "entityDeleted" + ], + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/doc/analysis/checks.py b/doc/analysis/checks.py index cda630ac1..61c260e35 100644 --- a/doc/analysis/checks.py +++ b/doc/analysis/checks.py @@ -147,7 +147,9 @@ class Checks: 'Check Content Range Part Equal': Checks.check_content_range_part_equal, 'Check Data Is Empty': - Checks.check_data_is_empty + Checks.check_data_is_empty, + 'Check Notification Containing Entity Element': + Checks.check_notification_containing_entity_element, } self.args = { @@ -430,6 +432,10 @@ class Checks: 'params': ['data'], 'position': [0] }, + 'Check Notification Containing Entity Element': { + 'params': ['filename', 'notification'], + 'position': [0, 1] + } } @staticmethod @@ -1162,6 +1168,11 @@ class Checks: else: raise Exception(f"ERROR, Expected the field to be equal 'expected_field' but received: '{kwargs}'") + @staticmethod + def check_notification_containing_entity_element(kwargs: list) -> str: + if 'filename' in kwargs and 'notification' in kwargs: + return f"Notification containing entity element set to '{kwargs['filename']}'" + @staticmethod def check_content_range_part_equal(kwargs: list) -> str: if 'expected_part' in kwargs and 'part' in kwargs: @@ -1290,6 +1301,9 @@ if __name__ == "__main__": print() print(data.get_checks(checks='Check Response Headers Containing NGSILD-Results-Count Equals To')) + print() + print(data.get_checks(checks='Check Notification Containing Entity Element')) + # Check exceptions try: print(data.get_checks(checks='Check Response Body Containing an Attribute set to')) diff --git a/doc/analysis/initial_setup.py b/doc/analysis/initial_setup.py index 5c1f40e3a..c39a9d72f 100644 --- a/doc/analysis/initial_setup.py +++ b/doc/analysis/initial_setup.py @@ -23,6 +23,7 @@ class InitialSetup: 'Create Id': InitialSetup.init_temporal_entity2(), 'Create Initial Subscription': InitialSetup.init_subscription(), 'Setup Initial Subscriptions': InitialSetup.init_subscription(), + 'Create Initial Subscription And Entity': InitialSetup.init_subscription_and_entity(), 'Start Mqtt Server And Connect': InitialSetup.init_mqtt_subscription(), 'Setup Initial Entities': InitialSetup.init_entities(), 'Setup Initial Temporal Entities': InitialSetup.init_temporal_entities(), @@ -117,6 +118,17 @@ class InitialSetup: }''' return data + @staticmethod + def init_subscription_and_entity() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing an initial Subscription ${subscription} + with an id set to ${subscription_id} + and an initial Entity ${entity} + with an id set to ${entity_id} +}''' + return data + @staticmethod def init_mqtt_subscription() -> str: data = '''with diff --git a/doc/files/ContextInformation/Subscription/029_06.json b/doc/files/ContextInformation/Subscription/029_06.json index fcb7c5fe8..d7bff83e6 100644 --- a/doc/files/ContextInformation/Subscription/029_06.json +++ b/doc/files/ContextInformation/Subscription/029_06.json @@ -1,6 +1,6 @@ { "tp_id": "TP/NGSI-LD/CI/SUB/029_06", - "test_objective": "Check that you can update a subscription: The implementation shall modify the target Subscription", + "test_objective": "Check that one can update a subscription: The implementation shall modify the target Subscription", "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.2", "config_id": "", "parent_release": "v1.3.1", @@ -18,7 +18,7 @@ { "name": "029_06_01 Update Subscription", "permutation_tp_id": "TP/NGSI-LD/CI/SUB/029_06_01", - "doc": "Check that you can update a subscription: The implementation shall modify the target Subscription", + "doc": "Check that one can update a subscription: The implementation shall modify the target Subscription", "tags": [ "5_8_2", "sub-update" diff --git a/doc/files/ContextInformation/Subscription/046_06.json b/doc/files/ContextInformation/Subscription/046_06.json index 82b54629c..ecd8e96a1 100644 --- a/doc/files/ContextInformation/Subscription/046_06.json +++ b/doc/files/ContextInformation/Subscription/046_06.json @@ -1,9 +1,9 @@ { "tp_id": "TP/NGSI-LD/CI/SUB/046_06", - "test_objective": "If a Subscription does not define a timeInterval member, the notification shall be sent whenever an entity matches the query defined in the subscription. The notification message shall include all the subscribed Entities that changed and that match (as mandated by clauses 4.9 and 4.10) the query and geoquery conditions", - "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "test_objective": "Check that a notification is sent when an entity is created and entityCreated notification trigger is configured", + "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.8.6", "config_id": "", - "parent_release": "v1.3.1", + "parent_release": "v1.6.1", "clauses": [ "5.8.6" ], @@ -18,9 +18,10 @@ { "name": "046_06_01 Check that a notification is sent with all matching entities", "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_06_01", - "doc": "only the subscribed Entities matching the query and watched attributes shall be included.", + "doc": "Check that a notification is sent when an entity is created and entityCreated notification trigger is configured", "tags": [ "5_8_6", + "since_v1.6.1", "sub-notification" ], "setup": null, diff --git a/doc/files/ContextInformation/Subscription/046_21_01.json b/doc/files/ContextInformation/Subscription/046_21_01.json new file mode 100644 index 000000000..dbd661418 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_21_01.json @@ -0,0 +1,39 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_21_01", + "test_objective": "Check that a notification is sent when an entity is deleted\nand entityDeleted notification trigger is configured", + "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Subscription And Entity", + "Delete Initial Subscription And Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id}\n and an initial Entity ${entity}\n with an id set to ${entity_id}\n}", + "test_cases": [ + { + "name": "046_21_01 Check that a notification is sent with matching entity", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_21_01", + "doc": "Delete an entity and check the received notification", + "tags": [ + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Entity by Id with Response Status Code set to 204\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'DELETE'\n Delete Entity Request with id set to '${entity_id}'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_21_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_21_02.json b/doc/files/ContextInformation/Subscription/046_21_02.json new file mode 100644 index 000000000..26c31225f --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_21_02.json @@ -0,0 +1,39 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_21_02", + "test_objective": "Check that a notification is sent with sysAttrs when an entity is deleted\nand entityDeleted notification trigger is configured", + "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Subscription And Entity", + "Delete Initial Subscription And Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id}\n and an initial Entity ${entity}\n with an id set to ${entity_id}\n}", + "test_cases": [ + { + "name": "046_21_02 Check that a notification is sent with matching entity", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_21_02", + "doc": "Delete an entity and check the received notification", + "tags": [ + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Entity by Id with Response Status Code set to 204\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'DELETE'\n Delete Entity Request with id set to '${entity_id}'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_21_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_22_01.json b/doc/files/ContextInformation/Subscription/046_22_01.json new file mode 100644 index 000000000..d828a3fe0 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_22_01.json @@ -0,0 +1,39 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_22_01", + "test_objective": "Check that a notification is sent with keyValues when an attribute is deleted\nand attributeDeleted notification trigger is configured", + "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Subscription And Entity", + "Delete Initial Subscription And Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id}\n and an initial Entity ${entity}\n with an id set to ${entity_id}\n}", + "test_cases": [ + { + "name": "046_22_01 Check that a notification is sent with matching entity", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_01", + "doc": "Delete an attribute and check the received notification", + "tags": [ + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Entity Attributes with Response Status Code set to 204 and\n Notification with Notification containing entity element set to 'entity-deleted-name-attribute-keyValues.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: attributeId set to 'name' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to '${EMPTY}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_22_01" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_22_02.json b/doc/files/ContextInformation/Subscription/046_22_02.json new file mode 100644 index 000000000..1b84bd833 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_22_02.json @@ -0,0 +1,39 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_22_02", + "test_objective": "Check that a notification is sent with keyValues when an attribute is deleted\nand attributeDeleted notification trigger is configured for this specific attribute", + "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Subscription And Entity", + "Delete Initial Subscription And Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id}\n and an initial Entity ${entity}\n with an id set to ${entity_id}\n}", + "test_cases": [ + { + "name": "046_22_02 Check that a notification is sent with matching entity", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_02", + "doc": "Delete an attribute and check the received notification", + "tags": [ + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Entity Attributes with Response Status Code set to 204 and\n Notification with Notification containing entity element set to 'entity-deleted-name-attribute-keyValues.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: attributeId set to 'name' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to '${EMPTY}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_22_02" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_22_03.json b/doc/files/ContextInformation/Subscription/046_22_03.json new file mode 100644 index 000000000..cfb5747b9 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_22_03.json @@ -0,0 +1,39 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_22_03", + "test_objective": "Check that a notification is not sent when an attribute is deleted\nand attributeDeleted notification trigger is not configured for this specific attribute", + "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Subscription And Entity", + "Delete Initial Subscription And Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id}\n and an initial Entity ${entity}\n with an id set to ${entity_id}\n}", + "test_cases": [ + { + "name": "046_22_03 Check that a notification is not sent with updated entity", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_03", + "doc": "Delete a not watched attribute and check no notification is received", + "tags": [ + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Entity Attributes with Response Status Code set to 204\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: attributeId set to 'airQualityLevel' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to '${EMPTY}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_22_03" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_22_04.json b/doc/files/ContextInformation/Subscription/046_22_04.json new file mode 100644 index 000000000..116d77302 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_22_04.json @@ -0,0 +1,39 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_22_04", + "test_objective": "Check that a notification is sent in normalized format when an attribute is deleted\nand attributeDeleted notification trigger is configured for this specific attribute", + "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Subscription And Entity", + "Delete Initial Subscription And Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id}\n and an initial Entity ${entity}\n with an id set to ${entity_id}\n}", + "test_cases": [ + { + "name": "046_22_04 Check that a notification is sent with matching entity", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_04", + "doc": "Delete an attribute and check the received notification", + "tags": [ + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Entity Attributes with Response Status Code set to 204 and\n Notification with Notification containing entity element set to 'entity-deleted-name-attribute-normalized.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: attributeId set to 'name' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to '${EMPTY}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_22_04" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_22_05.json b/doc/files/ContextInformation/Subscription/046_22_05.json new file mode 100644 index 000000000..f1dc5d432 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_22_05.json @@ -0,0 +1,39 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_22_05", + "test_objective": "Check that a notification is sent in normalized format with sysAttrs when an attribute is deleted\nand attributeDeleted notification trigger is configured for this specific attribute", + "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Subscription And Entity", + "Delete Initial Subscription And Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id}\n and an initial Entity ${entity}\n with an id set to ${entity_id}\n}", + "test_cases": [ + { + "name": "046_22_05 Check that a notification is sent with matching entity", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_05", + "doc": "Delete an attribute and check the received notification", + "tags": [ + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Delete Entity Attributes with Response Status Code set to 204\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: attributeId set to 'name' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to '${EMPTY}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_22_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_22_06.json b/doc/files/ContextInformation/Subscription/046_22_06.json new file mode 100644 index 000000000..4ce967b70 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_22_06.json @@ -0,0 +1,41 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_22_06", + "test_objective": "Check that a notification is sent in normalized format when an attribute with a specific datasetId is deleted\nand attributeDeleted notification trigger is configured for this specific attribute", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.5, 5.8.6", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.5", + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Subscription And Entity", + "Delete Initial Subscription And Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id}\n and an initial Entity ${entity}\n with an id set to ${entity_id}\n}", + "test_cases": [ + { + "name": "046_22_06 Check that a notification is sent with matching entity", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_06", + "doc": "Delete an attribute with a specific datasetId and check the received notification", + "tags": [ + "4_5_5", + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Entity Attributes with Response Status Code set to 204 and\n Notification with Notification containing entity element set to 'entity-deleted-name-attribute-instance-normalized.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: attributeId set to 'name' and\n Query Parameter: datasetId set to 'urn:ngsi-ld:Dataset:french-name' and\n Query Parameter: deleteAll set to '${EMPTY}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_22_06" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_22_07.json b/doc/files/ContextInformation/Subscription/046_22_07.json new file mode 100644 index 000000000..a3c7ef803 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_22_07.json @@ -0,0 +1,41 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_22_07", + "test_objective": "Check that a notification is sent with keyValues when an attribute with a specific datasetId is deleted\nand attributeDeleted notification trigger is configured for this specific attribute", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.5, 5.8.6", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.5", + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Subscription And Entity", + "Delete Initial Subscription And Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id}\n and an initial Entity ${entity}\n with an id set to ${entity_id}\n}", + "test_cases": [ + { + "name": "046_22_07 Check that a notification is sent with matching entity", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_07", + "doc": "Delete an attribute with a specific datasetId and check the received notification", + "tags": [ + "4_5_5", + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Entity Attributes with Response Status Code set to 204 and\n Notification with Notification containing entity element set to 'entity-deleted-name-attribute-instance-keyValues.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: attributeId set to 'name' and\n Query Parameter: datasetId set to 'urn:ngsi-ld:Dataset:french-name' and\n Query Parameter: deleteAll set to '${EMPTY}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_22_07" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_22_08.json b/doc/files/ContextInformation/Subscription/046_22_08.json new file mode 100644 index 000000000..20a17bad0 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_22_08.json @@ -0,0 +1,41 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_22_08", + "test_objective": "Check that a notification is sent when all instances of an attribute are deleted\nand attributeDeleted notification trigger is configured for this specific attribute", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.5, 5.8.6", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.5", + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Subscription And Entity", + "Delete Initial Subscription And Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id}\n and an initial Entity ${entity}\n with an id set to ${entity_id}\n}", + "test_cases": [ + { + "name": "046_22_08 Check that a notification is sent with matching entity", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_08", + "doc": "Delete all instances of an attribute and check the received notification", + "tags": [ + "4_5_5", + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Delete Entity Attributes with Response Status Code set to 204 and\n Notification with Response Body containing the key 'json_path_expr=['name']['value']', with the value 'value_to_check=urn:ngsi-ld:null'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}?${params_as_string}'\n method set to 'DELETE'\n Delete Entity Attributes: and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: attributeId set to 'name' and\n Query Parameter: datasetId set to '${EMPTY}' and\n Query Parameter: deleteAll set to '${true}' and\n Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld'\n}", + "http_verb": "DELETE", + "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_22_08" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_22_09.json b/doc/files/ContextInformation/Subscription/046_22_09.json new file mode 100644 index 000000000..567efd0e1 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_22_09.json @@ -0,0 +1,77 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_22_09", + "test_objective": "Check that a notification is sent in normalized format when an attribute is deleted via NGSI-LD Null\nin a Merge Entity operation and attributeDeleted notification trigger is configured for this specific attribute", + "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Subscription And Entity", + "Delete Initial Subscription And Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id}\n and an initial Entity ${entity}\n with an id set to ${entity_id}\n}", + "test_cases": [ + { + "name": "046_22_09_01 Check that a notification is sent with matching entity when deleting via Merge Entity operation", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_09_01", + "doc": "Delete an attribute via Merge Entity operation and check the received notification", + "tags": [ + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Notification with Notification containing entity element set to 'entity-different-attributes-types-deleted-name-attribute-normalized.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-property.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "046_22_09_02 Check that a notification is sent with matching entity when deleting via Update Attributes operation", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_09_02", + "doc": "Delete an attribute via Update Attributes operation and check the received notification", + "tags": [ + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Notification with Notification containing entity element set to 'entity-different-attributes-types-deleted-name-attribute-normalized.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-property.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "046_22_09_03 Check that a notification is sent with matching entity when deleting via Partial Attribute Update operation", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_09_03", + "doc": "Delete an attribute via Update Partial Attribute Update operation and check the received notification", + "tags": [ + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Notification with Notification containing entity element set to 'entity-different-attributes-types-deleted-name-attribute-normalized.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'name' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-property-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "endpoint", + "then", + "when" + ], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_22_09" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_22_10.json b/doc/files/ContextInformation/Subscription/046_22_10.json new file mode 100644 index 000000000..b1528a118 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_22_10.json @@ -0,0 +1,77 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_22_10", + "test_objective": "Check that a notification is sent in normalized format when a relationship is deleted via NGSI-LD Null\nin a Merge Entity operation and attributeDeleted notification trigger is configured for this specific relationship", + "reference": "ETSI GS CIM 009 V1.6.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Subscription And Entity", + "Delete Initial Subscription And Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id}\n and an initial Entity ${entity}\n with an id set to ${entity_id}\n}", + "test_cases": [ + { + "name": "046_22_10_01 Check that a notification is sent with matching entity when deleting via Merge Entity operation", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_10_01", + "doc": "Delete a relationship via Merge Entity operation and check the received notification", + "tags": [ + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Notification with Notification containing entity element set to 'entity-different-attributes-types-deleted-locatedAt-attribute-normalized.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "046_22_10_02 Check that a notification is sent with matching entity when deleting via Update Attributes operation", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_10_02", + "doc": "Delete a relationship via Update Attributes operation and check the received notification", + "tags": [ + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Notification with Notification containing entity element set to 'entity-different-attributes-types-deleted-locatedAt-attribute-normalized.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-relationship.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "046_22_10_03 Check that a notification is sent with matching entity when deleting via Partial Attribute Update operation", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_10_03", + "doc": "Delete a relationship via Update Partial Attribute Update operation and check the received notification", + "tags": [ + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Notification with Notification containing entity element set to 'entity-different-attributes-types-deleted-locatedAt-attribute-normalized.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'locatedAt' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-relationship-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "endpoint", + "then", + "when" + ], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_22_10" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_22_11.json b/doc/files/ContextInformation/Subscription/046_22_11.json new file mode 100644 index 000000000..1c51f23dc --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_22_11.json @@ -0,0 +1,81 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_22_11", + "test_objective": "Check that a notification is sent in normalized format when a language property is deleted via NGSI-LD Null\nin a Merge Entity operation and attributeDeleted notification trigger is configured for this specific property", + "reference": "ETSI GS CIM 009 V1.6.1 [], clauses 4.5.18, 5.8.6", + "config_id": "", + "parent_release": "v1.6.1", + "clauses": [ + "4.5.18", + "5.8.6" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Subscription And Entity", + "Delete Initial Subscription And Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Subscription ${subscription} \n with an id set to ${subscription_id}\n and an initial Entity ${entity}\n with an id set to ${entity_id}\n}", + "test_cases": [ + { + "name": "046_22_11_01 Check that a notification is sent with matching entity when deleting via Merge Entity operation", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_11_01", + "doc": "Delete a language property via Merge Entity operation and check the received notification", + "tags": [ + "4_5_18", + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Merge Entity with Response Status Code set to 204 and\n Notification with Notification containing entity element set to 'entity-different-attributes-types-deleted-street-attribute-normalized.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entity_id}'\n method set to 'PATCH'\n Merge Entity and\n Query Parameter: entity_id set to '${entity_id}' and\n Query Parameter: entity_filename set to 'fragmentEntities/ngsild-null/building-null-languageproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json' and\n Query Parameter: context set to ''\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entity_id}" + }, + { + "name": "046_22_11_02 Check that a notification is sent with matching entity when deleting via Update Attributes operation", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_11_02", + "doc": "Delete a language property via Update Attributes operation and check the received notification", + "tags": [ + "4_5_18", + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Update Entity Attributes with Response Status Code set to 204 and\n Notification with Notification containing entity element set to 'entity-different-attributes-types-deleted-street-attribute-normalized.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-languageproperty.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + }, + { + "name": "046_22_11_03 Check that a notification is sent with matching entity when deleting via Partial Attribute Update operation", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_22_11_03", + "doc": "Delete a language property via Update Partial Attribute Update operation and check the received notification", + "tags": [ + "4_5_18", + "5_8_6", + "since_v1.6.1", + "sub-notification" + ], + "setup": "Create Initial Subscription And Entity", + "teardown": "Delete Initial Subscription And Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Partial Update Entity Attributes with Response Status Code set to 204 and\n Notification with Notification containing entity element set to 'entity-different-attributes-types-deleted-street-attribute-normalized.json'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Request Partial Update Entity Attributes and\n Query Parameter: entityId set to '${entity_id}' and\n Query Parameter: AttributeId set to 'street' and\n Query Parameter: fragment_filename set to 'ngsild-null/null-languageproperty-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [ + "endpoint", + "then", + "when" + ], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_22_11" +} \ No newline at end of file diff --git a/doc/tests/test_ContextInformation_Subscription.py b/doc/tests/test_ContextInformation_Subscription.py index fdd551bbf..b2496348c 100644 --- a/doc/tests/test_ContextInformation_Subscription.py +++ b/doc/tests/test_ContextInformation_Subscription.py @@ -229,6 +229,97 @@ class TestCISubscription(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_046_21_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_21_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_21_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_21_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_21_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_21_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_22_01(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_01.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_22_01.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_22_01.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_22_02(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_02.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_22_02.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_22_02.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_22_03(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_03.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_22_03.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_22_03.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_22_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_22_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_22_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_22_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_22_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_22_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_22_06(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_06.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_22_06.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_22_06.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_22_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_22_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_22_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_22_08(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_08.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_22_08.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_22_08.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_22_09(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_09.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_22_09.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_22_09.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_22_10(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_10.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_22_10.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_22_10.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_046_22_11(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_22_11.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_22_11.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_22_11.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_031_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/QuerySubscriptions/031_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/031_01.json' diff --git a/resources/ApiUtils/ContextInformationProvision.resource b/resources/ApiUtils/ContextInformationProvision.resource index 545537306..cfc16434a 100755 --- a/resources/ApiUtils/ContextInformationProvision.resource +++ b/resources/ApiUtils/ContextInformationProvision.resource @@ -23,6 +23,8 @@ ${BATCH_MERGE_ENDPOINT_PATH} entityOperations/merge ${ENTITIES_ENDPOINT_PATH} entities/ +${BUILDING_ID_PREFIX} urn:ngsi-ld:Building: + ${CONTENT_TYPE_JSON} application/json ${CONTENT_TYPE_LD_JSON} application/ld+json ${CONTENT_TYPE_MERGE_PATCH_JSON} application/merge-patch+json diff --git a/resources/ApiUtils/ContextInformationSubscription.resource b/resources/ApiUtils/ContextInformationSubscription.resource index 268e90a88..d6b175261 100755 --- a/resources/ApiUtils/ContextInformationSubscription.resource +++ b/resources/ApiUtils/ContextInformationSubscription.resource @@ -13,6 +13,8 @@ ${SUBSCRIPTION_ENDPOINT_PATH} subscriptions/ ${CONTENT_TYPE_JSON} application/json ${CONTENT_TYPE_LD_JSON} application/ld+json +${SUBSCRIPTION_ID_PREFIX} urn:ngsi-ld:Subscription: + ${ERROR_TYPE_BAD_REQUEST_DATA} https://uri.etsi.org/ngsi-ld/errors/BadRequestData ${ERROR_TYPE_INVALID_REQUEST} https://uri.etsi.org/ngsi-ld/errors/InvalidRequest ${ERROR_TYPE_RESOURCE_NOT_FOUND} https://uri.etsi.org/ngsi-ld/errors/ResourceNotFound diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index bc570ecc2..1cb78c3fc 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -438,6 +438,17 @@ Check NotificationParams Should Not Be Empty ${response_body['notification']['${expected_additional_member}']} END +Check Notification Containing Entity Element + [Arguments] ${filename} ${notification} + ${expected_entity_in_notification}= Load JSON From File + ... ${EXECDIR}/data/subscriptions/expectations/${filename} + ${ignored_keys}= Create List id + ${comparison_result}= Compare Dictionaries Ignoring Keys + ... ${expected_entity_in_notification} + ... ${notification['data'][0]} + ... ${ignored_keys} + Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} + Check Pagination Prev And Next Headers [Arguments] ${prev_link} ${next_link} ${response_headers} ${expected_links}= Create List ${prev_link} ${next_link} diff --git a/resources/SubscriptionUtils.resource b/resources/SubscriptionUtils.resource new file mode 100644 index 000000000..60101652c --- /dev/null +++ b/resources/SubscriptionUtils.resource @@ -0,0 +1,30 @@ +*** Settings *** +Documentation Common keywords used in setup steps for subscriptions + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + + +*** Keywords *** +Create Subscription And Entity + [Arguments] ${subscription_payload_file_path} ${building_filename} + + ${entity_id}= Generate Random Entity Id ${BUILDING_ID_PREFIX} + Set Suite Variable ${entity_id} + ${create_entity_response}= Create Entity Selecting Content Type + ... ${building_filename} + ... ${entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_entity_response.status_code} + + ${subscription_id}= Generate Random Entity Id ${SUBSCRIPTION_ID_PREFIX} + Set Suite Variable ${subscription_id} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ${create_subscription_response}= Create Subscription From Subscription Payload + ... ${subscription_payload} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_subscription_response.status_code} -- GitLab