From 1f79dfc886f68f46904ebdfb0fae4fea12fae5d5 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Tue, 25 Mar 2025 18:01:27 +0000 Subject: [PATCH] feat: add an option to automatically delete a temporal entity when corresponding entity is deleted (#28) --- README.md | 2 ++ resources/ApiUtils/ContextInformationProvision.resource | 4 ++++ resources/variables.py | 3 +++ 3 files changed, 9 insertions(+) diff --git a/README.md b/README.md index 14439ebc5..ad385d9e8 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,8 @@ Default value: `0.0.0.0` and `8086`. - `context_server_host` and `context_server_port` : The address and port used for the context server provider. Default value: `0.0.0.0` and `8087`. - `core_context`: The default cached core context used by the Brokers. +- `delete_temporal_on_core_delete`: Whether the Temporal Representation of an Entity should be deleted when an Entity is deleted. +Default value: True When you execute locally the tests, you can leave the default values as they are. NGSI-LD Test Suite provides a mockup services to provide the notification functionality and therefore the notification_server_host can be diff --git a/resources/ApiUtils/ContextInformationProvision.resource b/resources/ApiUtils/ContextInformationProvision.resource index cfc16434a..defb0c4f1 100755 --- a/resources/ApiUtils/ContextInformationProvision.resource +++ b/resources/ApiUtils/ContextInformationProvision.resource @@ -5,6 +5,7 @@ Library RequestsLibrary Library OperatingSystem Library Collections Library JSONLibrary +Resource ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource Resource ${EXECDIR}/resources/JsonUtils.resource @@ -241,6 +242,9 @@ Delete Entity by Id ${response}= DELETE ... url=${base_url}/${ENTITIES_ENDPOINT_PATH}${id} ... expected_status=any + IF ${delete_temporal_on_core_delete} + Delete Temporal Representation Of Entity ${id} + END Output ${response} Delete Entity by Id RETURN ${response} diff --git a/resources/variables.py b/resources/variables.py index 8e4a64ba7..f570a71ec 100644 --- a/resources/variables.py +++ b/resources/variables.py @@ -11,6 +11,9 @@ context_server_host = '0.0.0.0' context_server_port = 8087 core_context = 'https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld' +# whether the Temporal Representation of an Entity should be deleted when an Entity is deleted +delete_temporal_on_core_delete = True + #DistOps variables remote_url = 'http://0.0.0.0:8081/ngsi-ld/v1' context_source_endpoint = 'http://0.0.0.0:8081' -- GitLab