From 3ded17abdb8d92a147ed293040079a2d288fff19 Mon Sep 17 00:00:00 2001 From: gpoujol Date: Mon, 20 Mar 2023 17:42:32 +0100 Subject: [PATCH 1/4] fix(016_01): using timeproperty parameter instead of sysAttrs options --- .../016_01.robot | 28 +++++--- ...artial-update-attribute-expectation.jsonld | 70 +++++++++---------- ...temporal-instanceid-update-fragment.jsonld | 2 +- resources/ApiUtils.resource | 4 +- 4 files changed, 56 insertions(+), 48 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot index 9a9f5863..e80cad6c 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot @@ -17,22 +17,28 @@ ${attributeId}= speed [Tags] tea-partial-update 5_6_14 ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} Set Suite Variable ${temporal_entity_representation_id} + ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${filename} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} sysAttrs ${ngsild_test_suite_context} - ${createdAt_before_update}= Set Variable ${response['body']['speed'][0]['createdAt']} - ${modifiedAt_before_update}= Set Variable ${response['body']['speed'][0]['modifiedAt']} + + ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} time_property=createdAt ${instanceId}= Set Variable ${response['body']['speed'][0]['instanceId']} + ${createdAt_before_update}= Set Variable ${response['body']['speed'][0]['createdAt']} + + ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} time_property=modifiedAt + Should Be Empty ${response['body']['speed']} + ${response}= Partial Update Attribute From Temporal Entity ${temporal_entity_representation_id} ${attributeId} ${instanceId} ${fragment_filename} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} Check Response Status Code 204 ${response['status']} - ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} sysAttrs - ${createdAt_after_update}= Set Variable ${response['body']['speed'][0]['createdAt']} - ${modifiedAt_after_update}= Set Variable ${response['body']['speed'][0]['modifiedAt']} - Should Be Equal As Strings ${createdAt_before_update} ${modifiedAt_before_update} - Should Be Equal As Strings ${createdAt_before_update} ${createdAt_after_update} - ${modifiedAt_before_update_date}= Convert Date ${modifiedAt_before_update} epoch - ${modifiedAt_after_update_date}= Convert Date ${modifiedAt_after_update} epoch - Should Be True ${modifiedAt_before_update_date}<${modifiedAt_after_update_date} + + ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} time_property=createdAt + ${createdAt_before_update}= Set Variable ${response['body']['speed'][0]['createdAt']} + + Should Be Equal As Strings ${createdAt_before_update} ${createdAt_before_update} + + ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} time_property=modifiedAt + Should Not Be Empty ${response['body']['speed']} + ${temporal_entity_expectation_payload}= Load Test Sample temporalEntities/expectations/${expectation_filename} ${temporal_entity_representation_id} Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} context=${ngsild_test_suite_context} accept=${CONTENT_TYPE_LD_JSON} ${ignored_attributes}= Create List instanceId @context diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-partial-update-attribute-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-partial-update-attribute-expectation.jsonld index 0fbbb7c0..b53ea18b 100644 --- a/data/temporalEntities/expectations/vehicle-temporal-representation-partial-update-attribute-expectation.jsonld +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-partial-update-attribute-expectation.jsonld @@ -1,37 +1,37 @@ { - "id":"urn:ngsi-ld:Vehicle:randomUUID", - "type":"Vehicle", - "speed":[ - { - "type":"Property", + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": [ + { + "type": "Property", + "value": 120, + "observedAt": "2020-09-01T12:03:00Z" + }, + { + "type": "Property", "value":129, - "observedAt":"2020-09-01T12:03:00Z" - }, - { - "type":"Property", - "value":80, - "observedAt":"2020-09-01T12:05:00Z" - } - ], - "fuelLevel":[ - { - "type":"Property", - "value":67, - "observedAt":"2020-09-01T12:03:00Z" - }, - { - "type":"Property", - "value":53, - "observedAt":"2020-09-01T13:05:00Z" - }, - { - "type":"Property", - "value":40, - "observedAt":"2020-09-01T14:07:00Z", - "datasetId":"urn:ngsi-ld:Vehicle:12345-fuel" - } - ], - "@context":[ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" - ] - } \ No newline at end of file + "observedAt": "2020-09-01T12:05:00Z" + } + ], + "fuelLevel": [ + { + "type": "Property", + "value": 67, + "observedAt": "2020-09-01T12:03:00Z" + }, + { + "type": "Property", + "value": 53, + "observedAt": "2020-09-01T13:05:00Z" + }, + { + "type": "Property", + "value": 40, + "observedAt": "2020-09-01T14:07:00Z", + "datasetId": "urn:ngsi-ld:Vehicle:12345-fuel" + } + ], + "@context": [ + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + ] +} \ No newline at end of file diff --git a/data/temporalEntities/fragments/vehicle-temporal-instanceid-update-fragment.jsonld b/data/temporalEntities/fragments/vehicle-temporal-instanceid-update-fragment.jsonld index df735987..5776dc1a 100644 --- a/data/temporalEntities/fragments/vehicle-temporal-instanceid-update-fragment.jsonld +++ b/data/temporalEntities/fragments/vehicle-temporal-instanceid-update-fragment.jsonld @@ -1,4 +1,4 @@ { "value":129, - "observedAt":"2020-09-01T12:03:00Z" + "observedAt":"2020-09-01T12:05:00Z" } \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 68d3f6de..8e5adfd3 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -386,13 +386,15 @@ Delete Several Temporal Representations Of Entities END Get Temporal Representation Of Entity - [Arguments] ${temporal_entity_representation_id} ${accept}=${EMPTY} ${options}=${EMPTY} ${context}=${EMPTY} + [Arguments] ${temporal_entity_representation_id} ${accept}=${EMPTY} ${options}=${EMPTY} ${context}=${EMPTY} ${time_property}=${EMPTY} &{headers}= Create Dictionary &{params}= Create Dictionary ${options_length} = Get Length ${options} + ${time_property_length} = Get Length ${time_property} Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" Run Keyword If ${options_length}>0 Set To Dictionary ${params} options=${options} + Run Keyword If ${time_property_length}>0 Set To Dictionary ${params} timeproperty=${time_property} ${response}= GET ${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id} headers=${headers} query=${params} Output request Output response -- GitLab From cf00c7a9424e86e95fd066d2b7a789219ace349a Mon Sep 17 00:00:00 2001 From: gpoujol Date: Thu, 23 Mar 2023 16:10:06 +0100 Subject: [PATCH 2/4] fix: check modify attribute instance temporal correclty --- .../016_01.robot | 23 ++++++++----------- ...artial-update-attribute-expectation.jsonld | 4 ++-- ...temporal-instanceid-update-fragment.jsonld | 11 +++++---- resources/ApiUtils.resource | 4 +--- 4 files changed, 19 insertions(+), 23 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot index e80cad6c..64aa8d09 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot @@ -21,26 +21,21 @@ ${attributeId}= speed ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${filename} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} time_property=createdAt - ${instanceId}= Set Variable ${response['body']['speed'][0]['instanceId']} - ${createdAt_before_update}= Set Variable ${response['body']['speed'][0]['createdAt']} + ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} + ${instanceId_before_update}= Set Variable ${response['body']['speed'][0]['instanceId']} - ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} time_property=modifiedAt - Should Be Empty ${response['body']['speed']} - - ${response}= Partial Update Attribute From Temporal Entity ${temporal_entity_representation_id} ${attributeId} ${instanceId} ${fragment_filename} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} + ${response}= Partial Update Attribute From Temporal Entity ${temporal_entity_representation_id} ${attributeId} ${instanceId_before_update} ${fragment_filename} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} Check Response Status Code 204 ${response['status']} - ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} time_property=createdAt - ${createdAt_before_update}= Set Variable ${response['body']['speed'][0]['createdAt']} - - Should Be Equal As Strings ${createdAt_before_update} ${createdAt_before_update} + ${temporal_entity_expectation_payload}= Load Test Sample temporalEntities/expectations/${expectation_filename} ${temporal_entity_representation_id} + ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} + ${instanceId_after_update}= Set Variable ${response['body']['speed'][0]['instanceId']} - ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} time_property=modifiedAt - Should Not Be Empty ${response['body']['speed']} + Should Not Be Empty ${response['body']['speed'][0]['modifiedAt']} + Should Be Equal As Strings ${instanceId_before_update} ${instanceId_after_update} ${temporal_entity_expectation_payload}= Load Test Sample temporalEntities/expectations/${expectation_filename} ${temporal_entity_representation_id} Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} context=${ngsild_test_suite_context} accept=${CONTENT_TYPE_LD_JSON} - ${ignored_attributes}= Create List instanceId @context + ${ignored_attributes}= Create List instanceId @context modifiedAt Check Updated Resource Set To ${temporal_entity_expectation_payload} ${ignored_attributes} [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-partial-update-attribute-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-partial-update-attribute-expectation.jsonld index b53ea18b..7267dd62 100644 --- a/data/temporalEntities/expectations/vehicle-temporal-representation-partial-update-attribute-expectation.jsonld +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-partial-update-attribute-expectation.jsonld @@ -4,12 +4,12 @@ "speed": [ { "type": "Property", - "value": 120, + "value": 129, "observedAt": "2020-09-01T12:03:00Z" }, { "type": "Property", - "value":129, + "value":80, "observedAt": "2020-09-01T12:05:00Z" } ], diff --git a/data/temporalEntities/fragments/vehicle-temporal-instanceid-update-fragment.jsonld b/data/temporalEntities/fragments/vehicle-temporal-instanceid-update-fragment.jsonld index 5776dc1a..f9261a45 100644 --- a/data/temporalEntities/fragments/vehicle-temporal-instanceid-update-fragment.jsonld +++ b/data/temporalEntities/fragments/vehicle-temporal-instanceid-update-fragment.jsonld @@ -1,4 +1,7 @@ -{ - "value":129, - "observedAt":"2020-09-01T12:05:00Z" -} \ No newline at end of file +[ + { + "type":"Property", + "value":129, + "observedAt":"2020-09-01T12:03:00Z" + } +] \ No newline at end of file diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 8e5adfd3..68d3f6de 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -386,15 +386,13 @@ Delete Several Temporal Representations Of Entities END Get Temporal Representation Of Entity - [Arguments] ${temporal_entity_representation_id} ${accept}=${EMPTY} ${options}=${EMPTY} ${context}=${EMPTY} ${time_property}=${EMPTY} + [Arguments] ${temporal_entity_representation_id} ${accept}=${EMPTY} ${options}=${EMPTY} ${context}=${EMPTY} &{headers}= Create Dictionary &{params}= Create Dictionary ${options_length} = Get Length ${options} - ${time_property_length} = Get Length ${time_property} Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" Run Keyword If ${options_length}>0 Set To Dictionary ${params} options=${options} - Run Keyword If ${time_property_length}>0 Set To Dictionary ${params} timeproperty=${time_property} ${response}= GET ${TEMPORAL_ENTITIES_ENDPOINT_PATH}/${temporal_entity_representation_id} headers=${headers} query=${params} Output request Output response -- GitLab From 5d68c09455f1c2d832ae5ce34ae8089f7b6c6a4a Mon Sep 17 00:00:00 2001 From: gpoujol Date: Tue, 28 Mar 2023 12:06:18 +0200 Subject: [PATCH 3/4] fix: rename some test name and update context in some files --- .../DeleteAttributeInstance/017_03.robot | 4 +-- .../016_01.robot | 10 +++---- .../016_02.robot | 29 ++++++++++--------- .../016_03.robot | 23 ++++++++------- ...ntation-added-attribute-expectation.jsonld | 2 +- ...l-representation-create-expectation.jsonld | 5 +++- ...ete-fuelLevel-datasetid-expectation.jsonld | 2 +- ...tation-delete-fuelLevel-expectation.jsonld | 2 +- ...ion-deleteall-fuelLevel-expectation.jsonld | 2 +- ...ify-attribute-instance-expectation.jsonld} | 2 +- ...l-representation-update-expectation.jsonld | 2 +- ...modify-attribute-instance-fragment.jsonld} | 0 resources/ApiUtils.resource | 2 +- 13 files changed, 47 insertions(+), 38 deletions(-) rename TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/{PartialUpdateAttributeInstance => ModifyAttributeInstance}/016_01.robot (79%) rename TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/{PartialUpdateAttributeInstance => ModifyAttributeInstance}/016_02.robot (55%) rename TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/{PartialUpdateAttributeInstance => ModifyAttributeInstance}/016_03.robot (59%) rename data/temporalEntities/expectations/{vehicle-temporal-representation-partial-update-attribute-expectation.jsonld => vehicle-temporal-representation-modify-attribute-instance-expectation.jsonld} (85%) rename data/temporalEntities/fragments/{vehicle-temporal-instanceid-update-fragment.jsonld => vehicle-temporal-modify-attribute-instance-fragment.jsonld} (100%) diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_03.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_03.robot index e4e72ea9..5f5682db 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_03.robot @@ -4,7 +4,7 @@ Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Create Id -Test Template Partially Update Temporal Entity +Test Template Modify Attribute Instance Temporal Entity *** Variable *** ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: @@ -22,7 +22,7 @@ ${status_code}= 404 ${temporal_entity_representation_id} speed urn:ngsi-ld:01234567890123456789 *** Keywords *** -Partially Update Temporal Entity +Modify Attribute Instance Temporal Entity [Arguments] ${temporal_entity_id} ${attributeId} ${instanceId} [Documentation] Check that you cannot delete an attribute instance in temporal representation of an entity if the entity/attribute/instance id is not found [Tags] tea-instance-delete 5_6_15 diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_01.robot similarity index 79% rename from TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot rename to TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_01.robot index 64aa8d09..170fd077 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_01.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that you can partially update an attribute instance of a temporal representation of an entity +Documentation Check that you can modify attribute instance in temporal representation of an entity Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource @@ -7,12 +7,12 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variable *** ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: ${filename}= vehicle-temporal-representation-sample.jsonld -${fragment_filename}= vehicle-temporal-instanceid-update-fragment.jsonld -${expectation_filename}= vehicle-temporal-representation-partial-update-attribute-expectation.jsonld +${fragment_filename}= vehicle-temporal-modify-attribute-instance-fragment.jsonld +${expectation_filename}= vehicle-temporal-representation-modify-attribute-instance-expectation.jsonld ${attributeId}= speed *** Test Cases *** -016_01_Partially update an attribute instance of a temporal representation of an entity +016_01_Modify attribute instance in temporal representation of an entity [Documentation] Check that you can partially update an attribute instance of a temporal representation of an entity [Tags] tea-partial-update 5_6_14 ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} @@ -24,7 +24,7 @@ ${attributeId}= speed ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} ${instanceId_before_update}= Set Variable ${response['body']['speed'][0]['instanceId']} - ${response}= Partial Update Attribute From Temporal Entity ${temporal_entity_representation_id} ${attributeId} ${instanceId_before_update} ${fragment_filename} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} + ${response}= Modify Attribute Instance From Temporal Entity ${temporal_entity_representation_id} ${attributeId} ${instanceId_before_update} ${fragment_filename} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} Check Response Status Code 204 ${response['status']} ${temporal_entity_expectation_payload}= Load Test Sample temporalEntities/expectations/${expectation_filename} ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_02.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_02.robot similarity index 55% rename from TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_02.robot rename to TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_02.robot index fbae4f06..245b6378 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_02.robot @@ -1,44 +1,44 @@ *** Settings *** -Documentation Check that you cannot partially update an attribute instance in temporal representation of an entity if the entityId/attributeId/instanceId is not right +Documentation Check that you cannot partially modify attribute instance in temporal representation of an entity if the entityId/attributeId/instanceId is not right Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Create Id -Test Template Partially Update Temporal Entity +Suite Teardown Delete Temporal Entity +Test Template Modify Attribute Instance Temporal Entity *** Variable *** ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: ${filename}= vehicle-temporal-representation-sample.jsonld -${fragment_filename}= vehicle-temporal-instanceid-update-fragment.jsonld +${fragment_filename}= vehicle-temporal-modify-attribute-instance-fragment.jsonld ${status_code}= 400 *** Test Cases *** TEMPORAL_ENTITY_ID ATTRIBUTE_ID INSTANCE_ID -016_02_01_update an attribute instance in temporal representation of an entity if the entity id is not valid +016_02_01_modify attribute instance in temporal representation of an entity if the entity id is not valid invalidId speed ${valid_instanceId} -016_02_02_update an attribute instance in temporal representation of an entity if the entity id is not present +016_02_02_modify attribute instance in temporal representation of an entity if the entity id is not present ${EMPTY} speed ${valid_instanceId} -016_02_03_update an attribute instance in temporal representation of an entity if the instance id is not valid +016_02_03_modify attribute instance in temporal representation of an entity if the instance id is not valid ${temporal_entity_representation_id} speed invalidId -016_02_04_update an attribute instance in temporal representation of an entity if the instance id is not present +016_02_04_modify attribute instance in temporal representation of an entity if the instance id is not present ${temporal_entity_representation_id} speed ${EMPTY} -016_02_05_update an attribute instance in temporal representation of an entity if the attribute name is not a valid name +016_02_05_modify attribute instance in temporal representation of an entity if the attribute name is not a valid name ${temporal_entity_representation_id} invalid(Id ${valid_instanceId} -016_02_06_update an attribute instance in temporal representation of an entity if the attribute name is not present +016_02_06_modify attribute instance in temporal representation of an entity if the attribute name is not present ${temporal_entity_representation_id} ${EMPTY} ${valid_instanceId} *** Keywords *** -Partially Update Temporal Entity +Modify Attribute Instance Temporal Entity [Arguments] ${temporal_entity_id} ${attributeId} ${instanceId} - [Documentation] Check that you cannot partially update an attribute instance in temporal representation of an entity if the entityId/attributeId/instanceId is not right + [Documentation] Check that you cannot partially modify attribute instance in temporal representation of an entity if the entityId/attributeId/instanceId is not right [Tags] tea-partial-update 5_6_14 - ${response}= Partial Update Attribute From Temporal Entity ${temporal_entity_id} ${attributeId} ${instanceId} ${fragment_filename} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} + ${response}= Modify Attribute Instance From Temporal Entity ${temporal_entity_id} ${attributeId} ${instanceId} ${fragment_filename} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} Check Response Status Code ${status_code} ${response['status']} - [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} Create Id ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} @@ -48,3 +48,6 @@ Create Id ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} sysAttrs ${ngsild_test_suite_context} ${valid_instanceId}= Set Variable ${response['body']['speed'][0]['instanceId']} Set Suite Variable ${valid_instanceId} + +Delete Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_03.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_03.robot similarity index 59% rename from TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_03.robot rename to TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_03.robot index 7e4dc05b..3d9cfa71 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/PartialUpdateAttributeInstance/016_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_03.robot @@ -1,35 +1,35 @@ *** Settings *** -Documentation Check that you cannot partially update an attribute instance in temporal representation of an entity if the entityId/attributeId/instanceId is not right +Documentation Check that you cannot partially modify attribute instance in temporal representation of an entity if the entityId/attributeId/instanceId is not right Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Create Id -Test Template Partially Update Temporal Entity +Suite Teardown Delete Temporal Entity +Test Template Modify Attribute Instance Temporal Entity *** Variable *** ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: ${filename}= vehicle-temporal-representation-sample.jsonld -${fragment_filename}= vehicle-temporal-instanceid-update-fragment.jsonld +${fragment_filename}= vehicle-temporal-modify-attribute-instance-fragment.jsonld ${status_code}= 404 *** Test Cases *** TEMPORAL_ENTITY_ID ATTRIBUTE_ID INSTANCE_ID -016_03_01_update an attribute instance in temporal representation of an entity if the entity with given id is not found +016_03_01_modify attribute instance in temporal representation of an entity if the entity with given id is not found ${unknown_temporal_entity_id} speed ${valid_instanceId} -016_03_02_update an attribute instance in temporal representation of an entity if the target attribute is not found +016_03_02_modify attribute instance in temporal representation of an entity if the target attribute is not found ${temporal_entity_representation_id} speed2 ${valid_instanceId} -016_03_03_update an attribute instance in temporal representation of an entity if the target attribute instance is not found +016_03_03_modify attribute instance in temporal representation of an entity if the target attribute instance is not found ${temporal_entity_representation_id} speed urn:ngsi-ld:01234567890123456789 *** Keywords *** -Partially Update Temporal Entity +Modify Attribute Instance Temporal Entity [Arguments] ${temporal_entity_id} ${attributeId} ${instanceId} - [Documentation] Check that you cannot partially update an attribute instance in temporal representation of an entity if the entity/attribute/instance id is not found + [Documentation] Check that you cannot partially modify attribute instance in temporal representation of an entity if the entity/attribute/instance id is not found [Tags] tea-partial-update 5_6_14 - ${response}= Partial Update Attribute From Temporal Entity ${temporal_entity_id} ${attributeId} ${instanceId} ${fragment_filename} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} + ${response}= Modify Attribute Instance From Temporal Entity ${temporal_entity_id} ${attributeId} ${instanceId} ${fragment_filename} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} Check Response Status Code ${status_code} ${response['status']} - [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} Create Id ${temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} @@ -41,3 +41,6 @@ Create Id ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} sysAttrs ${ngsild_test_suite_context} ${valid_instanceId}= Set Variable ${response['body']['speed'][0]['instanceId']} Set Suite Variable ${valid_instanceId} + +Delete Temporal Entity + Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-added-attribute-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-added-attribute-expectation.jsonld index e369877c..c4089b8e 100644 --- a/data/temporalEntities/expectations/vehicle-temporal-representation-added-attribute-expectation.jsonld +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-added-attribute-expectation.jsonld @@ -49,6 +49,6 @@ } ], "@context":[ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + "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/temporalEntities/expectations/vehicle-temporal-representation-create-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-create-expectation.jsonld index 22b52c9f..7c893130 100644 --- a/data/temporalEntities/expectations/vehicle-temporal-representation-create-expectation.jsonld +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-create-expectation.jsonld @@ -30,5 +30,8 @@ "observedAt":"2020-09-01T14:07:00Z", "datasetId":"urn:ngsi-ld:Vehicle:12345-fuel" } - ] + ], + "@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/temporalEntities/expectations/vehicle-temporal-representation-delete-fuelLevel-datasetid-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-delete-fuelLevel-datasetid-expectation.jsonld index bdf28c38..ad6ecbd1 100644 --- a/data/temporalEntities/expectations/vehicle-temporal-representation-delete-fuelLevel-datasetid-expectation.jsonld +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-delete-fuelLevel-datasetid-expectation.jsonld @@ -26,6 +26,6 @@ } ], "@context":[ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + "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/temporalEntities/expectations/vehicle-temporal-representation-delete-fuelLevel-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-delete-fuelLevel-expectation.jsonld index 9687c225..6b84b98c 100644 --- a/data/temporalEntities/expectations/vehicle-temporal-representation-delete-fuelLevel-expectation.jsonld +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-delete-fuelLevel-expectation.jsonld @@ -22,6 +22,6 @@ } ], "@context":[ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + "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/temporalEntities/expectations/vehicle-temporal-representation-deleteall-fuelLevel-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-deleteall-fuelLevel-expectation.jsonld index 90083d35..29f7c564 100644 --- a/data/temporalEntities/expectations/vehicle-temporal-representation-deleteall-fuelLevel-expectation.jsonld +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-deleteall-fuelLevel-expectation.jsonld @@ -14,6 +14,6 @@ } ], "@context":[ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + "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/temporalEntities/expectations/vehicle-temporal-representation-partial-update-attribute-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-modify-attribute-instance-expectation.jsonld similarity index 85% rename from data/temporalEntities/expectations/vehicle-temporal-representation-partial-update-attribute-expectation.jsonld rename to data/temporalEntities/expectations/vehicle-temporal-representation-modify-attribute-instance-expectation.jsonld index 7267dd62..375f5a31 100644 --- a/data/temporalEntities/expectations/vehicle-temporal-representation-partial-update-attribute-expectation.jsonld +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-modify-attribute-instance-expectation.jsonld @@ -32,6 +32,6 @@ } ], "@context": [ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + "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/temporalEntities/expectations/vehicle-temporal-representation-update-expectation.jsonld b/data/temporalEntities/expectations/vehicle-temporal-representation-update-expectation.jsonld index e2bf75b9..33fb63cd 100644 --- a/data/temporalEntities/expectations/vehicle-temporal-representation-update-expectation.jsonld +++ b/data/temporalEntities/expectations/vehicle-temporal-representation-update-expectation.jsonld @@ -42,6 +42,6 @@ } ], "@context":[ - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld" + "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/temporalEntities/fragments/vehicle-temporal-instanceid-update-fragment.jsonld b/data/temporalEntities/fragments/vehicle-temporal-modify-attribute-instance-fragment.jsonld similarity index 100% rename from data/temporalEntities/fragments/vehicle-temporal-instanceid-update-fragment.jsonld rename to data/temporalEntities/fragments/vehicle-temporal-modify-attribute-instance-fragment.jsonld diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 68d3f6de..6176176b 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -349,7 +349,7 @@ Append Attribute To Temporal Entity Using Session Set Test Variable ${response} [return] ${response} -Partial Update Attribute From Temporal Entity +Modify Attribute Instance From Temporal Entity [Arguments] ${temporal_entity_id} ${attributeId} ${instanceId} ${fragment_filename} ${content_type} ${context}=${EMPTY} &{headers}= Create Dictionary Content-Type=${content_type} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" -- GitLab From 232e648acd7336cf34209e8ff18276544a89654f Mon Sep 17 00:00:00 2001 From: gpoujol Date: Wed, 29 Mar 2023 10:53:02 +0200 Subject: [PATCH 4/4] fix: rename documentation and use one function to retrieve temporal entity --- .../DeleteAttributeInstance/017_01.robot | 2 +- .../DeleteAttributeInstance/017_03.robot | 4 ++-- .../ModifyAttributeInstance/016_01.robot | 8 +++----- .../ModifyAttributeInstance/016_02.robot | 2 +- .../ModifyAttributeInstance/016_03.robot | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_01.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_01.robot index 4206061e..b0b0ed18 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_01.robot @@ -18,7 +18,7 @@ ${expectation_filename}= vehicle-temporal-representation-delete-speed-instanc Set Suite Variable ${temporal_entity_representation_id} ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${filename} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} sysAttrs ${ngsild_test_suite_context} + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} context=${ngsild_test_suite_context} accept=${CONTENT_TYPE_LD_JSON} ${instanceId}= Set Variable ${response['body']['speed'][0]['instanceId']} ${response}= Delete Attribute Instance From Temporal Entity ${temporal_entity_representation_id} ${attributeId} ${instanceId} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} Check Response Status Code 204 ${response['status']} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_03.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_03.robot index 5f5682db..4aadafe9 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/DeleteAttributeInstance/017_03.robot @@ -4,7 +4,7 @@ Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Create Id -Test Template Modify Attribute Instance Temporal Entity +Test Template Delete Attribute Instance *** Variable *** ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: @@ -22,7 +22,7 @@ ${status_code}= 404 ${temporal_entity_representation_id} speed urn:ngsi-ld:01234567890123456789 *** Keywords *** -Modify Attribute Instance Temporal Entity +Delete Attribute Instance [Arguments] ${temporal_entity_id} ${attributeId} ${instanceId} [Documentation] Check that you cannot delete an attribute instance in temporal representation of an entity if the entity/attribute/instance id is not found [Tags] tea-instance-delete 5_6_15 diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_01.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_01.robot index 170fd077..f75abc6c 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_01.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that you can modify attribute instance in temporal representation of an entity +Documentation Check that you can modify an attribute instance in temporal representation of an entity Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource @@ -21,21 +21,19 @@ ${attributeId}= speed ${response}= Create Or Update Temporal Representation Of Entity Selecting Content Type ${temporal_entity_representation_id} ${filename} ${CONTENT_TYPE_LD_JSON} Check Response Status Code 201 ${response['status']} - ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} context=${ngsild_test_suite_context} accept=${CONTENT_TYPE_LD_JSON} ${instanceId_before_update}= Set Variable ${response['body']['speed'][0]['instanceId']} ${response}= Modify Attribute Instance From Temporal Entity ${temporal_entity_representation_id} ${attributeId} ${instanceId_before_update} ${fragment_filename} ${CONTENT_TYPE_JSON} ${ngsild_test_suite_context} Check Response Status Code 204 ${response['status']} ${temporal_entity_expectation_payload}= Load Test Sample temporalEntities/expectations/${expectation_filename} ${temporal_entity_representation_id} - ${response}= Get Temporal Representation Of Entity ${temporal_entity_representation_id} ${CONTENT_TYPE_LD_JSON} context=${ngsild_test_suite_context} + Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} context=${ngsild_test_suite_context} accept=${CONTENT_TYPE_LD_JSON} ${instanceId_after_update}= Set Variable ${response['body']['speed'][0]['instanceId']} - Should Not Be Empty ${response['body']['speed'][0]['modifiedAt']} Should Be Equal As Strings ${instanceId_before_update} ${instanceId_after_update} ${temporal_entity_expectation_payload}= Load Test Sample temporalEntities/expectations/${expectation_filename} ${temporal_entity_representation_id} - Retrieve Temporal Representation Of Entity ${temporal_entity_representation_id} context=${ngsild_test_suite_context} accept=${CONTENT_TYPE_LD_JSON} ${ignored_attributes}= Create List instanceId @context modifiedAt Check Updated Resource Set To ${temporal_entity_expectation_payload} ${ignored_attributes} [Teardown] Delete Temporal Representation Of Entity ${temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_02.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_02.robot index 245b6378..2bfdfe95 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_02.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that you cannot partially modify attribute instance in temporal representation of an entity if the entityId/attributeId/instanceId is not right +Documentation Check that you cannot modify an attribute instance in temporal representation of an entity if the entityId/attributeId/instanceId is not right Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource diff --git a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_03.robot b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_03.robot index 3d9cfa71..168d4040 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_03.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/TemporalEntityAttributes/ModifyAttributeInstance/016_03.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that you cannot partially modify attribute instance in temporal representation of an entity if the entityId/attributeId/instanceId is not right +Documentation Check that you cannot modify an attribute instance in temporal representation of an entity if the entityId/attributeId/instanceId is not right Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -- GitLab