From 4436e5899ed9ffeb4d4edd30b0f5d03519b30d73 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Fri, 13 Dec 2024 18:11:07 +0100 Subject: [PATCH] feat(013_01): more robust testing with default datasetId --- .../DeleteEntityAttribute/013_01.robot | 12 ++--- .../vehicle-delete-datasetid-speed.jsonld | 43 ++++++++---------- .../vehicle-delete-default-speed.jsonld | 44 ++++++++----------- .../vehicle-delete-deleteall-speed.jsonld | 22 ++-------- .../vehicle-speed-only-multi-instances.jsonld | 35 +++++++++++++++ .../ContextInformation/Provision/013_01.json | 33 +++++++------- 6 files changed, 100 insertions(+), 89 deletions(-) create mode 100644 data/entities/vehicle-speed-only-multi-instances.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_01.robot b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_01.robot index 171fb2a4b..8bcfc2712 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/EntityAttributes/DeleteEntityAttribute/013_01.robot @@ -14,23 +14,25 @@ Test Template Delete Attributes *** Variables *** ${status_code}= 204 -${filename}= vehicle-two-datasetid-attributes.jsonld +${filename}= vehicle-speed-only-multi-instances.jsonld ${attribute_id}= speed *** Test Cases *** DATASETID DELETEALL EXPECTATION_FILENAME 013_01_01 Delete An Attribute With The Default Instance + [Tags] ea-delete 5_6_5 ${EMPTY} false vehicle-delete-default-speed.jsonld -013_01_02 Delete An Attribute With The datasetId - urn:ngsi-ld:Property:gpsBxyz123-speed false vehicle-delete-datasetid-speed.jsonld -013_01_03 Delete All Target Attribute Instances +013_01_02 Delete An Attribute With A Specific datasetId + [Tags] ea-delete 5_6_5 + urn:ngsi-ld:Dataset:gps false vehicle-delete-datasetid-speed.jsonld +013_01_03 Delete All Attribute Instances + [Tags] ea-delete 5_6_5 ${EMPTY} true vehicle-delete-deleteall-speed.jsonld *** Keywords *** Delete Attributes [Documentation] Check that one can delete an attribute from an entity - [Tags] ea-delete 5_6_5 [Arguments] ${datasetId} ${deleteAll} ${expectation_filename} ${response}= Delete Entity Attributes ... entityId=${entity_id} diff --git a/data/entities/expectations/vehicle-delete-datasetid-speed.jsonld b/data/entities/expectations/vehicle-delete-datasetid-speed.jsonld index a7238cbb9..f3efc2de0 100644 --- a/data/entities/expectations/vehicle-delete-datasetid-speed.jsonld +++ b/data/entities/expectations/vehicle-delete-datasetid-speed.jsonld @@ -1,29 +1,24 @@ { - "id": "urn:ngsi-ld:Vehicle:randomUUID", - "type": "Vehicle", - "brandName": { + "id": "urn:ngsi-ld:Vehicle:4215907728743778", + "type": "Vehicle", + "speed": [ + { + "type": "Property", + "value": 55, + "source": { "type": "Property", - "value": "Mercedes" + "value": "Feeling" + } }, - "isParked": { - "type": "Relationship", - "object": "urn:ngsi-ld:OffStreetParking:Downtown1", - "observedAt": "2017-07-29T12:00:04Z", - "providedBy": { - "type": "Relationship", - "object": "urn:ngsi-ld:Person:Bob" - }, - "datasetId": "urn:ngsi-ld:Relationship:parked12345" - }, - "speed": { + { + "type": "Property", + "value": 57, + "datasetId": "urn:ngsi-ld:Dataset:speedometer", + "source": { "type": "Property", - "value": 55, - "source": { - "type": "Property", - "value": "Speedometer" - } - }, - "@context": [ - "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" - ] + "value": "Speedometer" + } + } + ], + "@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/vehicle-delete-default-speed.jsonld b/data/entities/expectations/vehicle-delete-default-speed.jsonld index 4df3a8c4e..beff49f76 100644 --- a/data/entities/expectations/vehicle-delete-default-speed.jsonld +++ b/data/entities/expectations/vehicle-delete-default-speed.jsonld @@ -1,31 +1,25 @@ { - "id": "urn:ngsi-ld:Vehicle:randomUUID", - "type": "Vehicle", - "brandName": { + "id": "urn:ngsi-ld:Vehicle:2264127260420623", + "type": "Vehicle", + "speed": [ + { + "type": "Property", + "value": 57, + "datasetId": "urn:ngsi-ld:Dataset:speedometer", + "source": { "type": "Property", - "value": "Mercedes" - }, - "isParked": { - "type": "Relationship", - "object": "urn:ngsi-ld:OffStreetParking:Downtown1", - "observedAt": "2017-07-29T12:00:04Z", - "providedBy": { - "type": "Relationship", - "object": "urn:ngsi-ld:Person:Bob" - }, - "datasetId": "urn:ngsi-ld:Relationship:parked12345" + "value": "Speedometer" + } }, - "speed": { + "type": "Property", + "value": 54.5, + "datasetId": "urn:ngsi-ld:Dataset:gps", + "source": { "type": "Property", - "value": 54.5, - "source": { - "type": "Property", - "value": "GPS" - }, - "datasetId": "urn:ngsi-ld:Property:gpsBxyz123-speed" - }, - "@context": [ - "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" - ] + "value": "GPS" + } + } + ], + "@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/vehicle-delete-deleteall-speed.jsonld b/data/entities/expectations/vehicle-delete-deleteall-speed.jsonld index 297440614..1f0035741 100644 --- a/data/entities/expectations/vehicle-delete-deleteall-speed.jsonld +++ b/data/entities/expectations/vehicle-delete-deleteall-speed.jsonld @@ -1,21 +1,5 @@ { - "id": "urn:ngsi-ld:Vehicle:randomUUID", - "type": "Vehicle", - "brandName": { - "type": "Property", - "value": "Mercedes" - }, - "isParked": { - "type": "Relationship", - "object": "urn:ngsi-ld:OffStreetParking:Downtown1", - "observedAt": "2017-07-29T12:00:04Z", - "providedBy": { - "type": "Relationship", - "object": "urn:ngsi-ld:Person:Bob" - }, - "datasetId": "urn:ngsi-ld:Relationship:parked12345" - }, - "@context": [ - "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" - ] + "id": "urn:ngsi-ld:Vehicle:0384085170704932", + "type": "Vehicle", + "@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/vehicle-speed-only-multi-instances.jsonld b/data/entities/vehicle-speed-only-multi-instances.jsonld new file mode 100644 index 000000000..d35ab706f --- /dev/null +++ b/data/entities/vehicle-speed-only-multi-instances.jsonld @@ -0,0 +1,35 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": [ + { + "type": "Property", + "value": 55, + "source": { + "type": "Property", + "value": "Feeling" + } + }, + { + "type": "Property", + "value": 57, + "source": { + "type": "Property", + "value": "Speedometer" + }, + "datasetId": "urn:ngsi-ld:Dataset:speedometer" + }, + { + "type": "Property", + "value": 54.5, + "source": { + "type": "Property", + "value": "GPS" + }, + "datasetId": "urn:ngsi-ld:Dataset:gps" + } + ], + "@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/Provision/013_01.json b/doc/files/ContextInformation/Provision/013_01.json index 8567f7a51..27eed43f6 100644 --- a/doc/files/ContextInformation/Provision/013_01.json +++ b/doc/files/ContextInformation/Provision/013_01.json @@ -1,6 +1,6 @@ { "tp_id": "TP/NGSI-LD/CI/Prov/EA/013_01", - "test_objective": "Check that you can delete an attribute from an entity", + "test_objective": "Check that one can delete an attribute from an entity", "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.6.5", "config_id": "", "parent_release": "v1.3.1", @@ -10,56 +10,57 @@ "pics_selection": "", "keywords": [ "Delete Attributes", + "Setup Initial Entity", "Delete Initial Entities" ], "teardown": "None", - "initial_condition": "with {\n the SUT containing an initial state\n}", + "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": "013_01_01 Delete an attribute with the default instance", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/013_01_01", - "doc": "Check that you can delete an attribute from an entity", + "doc": "Check that one can delete an attribute from an entity", "tags": [ "ea-delete", "5_6_5" ], - "setup": null, + "setup": "Setup Initial Entity", "teardown": "Delete Initial Entities", "template": "Delete Attributes", - "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Delete Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Check Updated Entity and\n Query Parameter: 'updated_resource' set to 'entity_expectation_payload' and\n Query Parameter: 'response_body' set to 'response2.json()' and\n Query Parameter: 'ignored_keys' set to 'ignored_attributes'\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 'speed' and\n Query Parameter: datasetId set to '${datasetId}' and\n Query Parameter: deleteAll set to '${deleteAll}' 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}", + "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 Retrieve Entity by Id with Check Updated Entity and\n Query Parameter: 'updated_resource' set to 'entity_expectation_payload' and\n Query Parameter: 'response_body' set to 'response2.json()' and\n Query Parameter: 'ignored_keys' set to 'ignored_attributes'\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 'speed' and\n Query Parameter: datasetId set to '${datasetId}' and\n Query Parameter: deleteAll set to '${deleteAll}' and\n Query Parameter: context set to 'https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld'\n}", "http_verb": "DELETE", "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" }, { - "name": "013_01_02 Delete an attribute with the datasetId", + "name": "013_01_02 Delete an attribute with a specific datasetId", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/013_01_02", - "doc": "Check that you can delete an attribute from an entity", + "doc": "Check that one can delete an attribute from an entity", "tags": [ "ea-delete", "5_6_5" ], - "setup": null, + "setup": "Setup Initial Entity", "teardown": "Delete Initial Entities", "template": "Delete Attributes", - "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Delete Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Check Updated Entity and\n Query Parameter: 'updated_resource' set to 'entity_expectation_payload' and\n Query Parameter: 'response_body' set to 'response2.json()' and\n Query Parameter: 'ignored_keys' set to 'ignored_attributes'\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 'speed' and\n Query Parameter: datasetId set to '${datasetId}' and\n Query Parameter: deleteAll set to '${deleteAll}' 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}", + "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 Retrieve Entity by Id with Check Updated Entity and\n Query Parameter: 'updated_resource' set to 'entity_expectation_payload' and\n Query Parameter: 'response_body' set to 'response2.json()' and\n Query Parameter: 'ignored_keys' set to 'ignored_attributes'\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 'speed' and\n Query Parameter: datasetId set to '${datasetId}' and\n Query Parameter: deleteAll set to '${deleteAll}' and\n Query Parameter: context set to 'https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld'\n}", "http_verb": "DELETE", "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" }, { - "name": "013_01_03 Delete all target attribute instances", + "name": "013_01_03 Delete all attribute instances", "permutation_tp_id": "TP/NGSI-LD/CI/Prov/EA/013_01_03", - "doc": "Check that you can delete an attribute from an entity", + "doc": "Check that one can delete an attribute from an entity", "tags": [ "ea-delete", "5_6_5" ], - "setup": null, + "setup": "Setup Initial Entity", "teardown": "Delete Initial Entities", "template": "Delete Attributes", - "then": "then {\n the SUT sends a valid Response for the operations:\n Create Entity Selecting Content Type with Response Status Code set to 201 and\n Delete Entity Attributes with Response Status Code set to 204 and\n Retrieve Entity by Id with Check Updated Entity and\n Query Parameter: 'updated_resource' set to 'entity_expectation_payload' and\n Query Parameter: 'response_body' set to 'response2.json()' and\n Query Parameter: 'ignored_keys' set to 'ignored_attributes'\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 'speed' and\n Query Parameter: datasetId set to '${datasetId}' and\n Query Parameter: deleteAll set to '${deleteAll}' 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}", + "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 Retrieve Entity by Id with Check Updated Entity and\n Query Parameter: 'updated_resource' set to 'entity_expectation_payload' and\n Query Parameter: 'response_body' set to 'response2.json()' and\n Query Parameter: 'ignored_keys' set to 'ignored_attributes'\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 'speed' and\n Query Parameter: datasetId set to '${datasetId}' and\n Query Parameter: deleteAll set to '${deleteAll}' and\n Query Parameter: context set to 'https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld'\n}", "http_verb": "DELETE", "endpoint": "entities/{entityId}/attrs/{attributeId}?${params_as_string}" } -- GitLab