From d64abf5cf6380d8c4c8dae9a58faf734e924c973 Mon Sep 17 00:00:00 2001 From: Marco Cavalli Date: Thu, 18 Sep 2025 09:26:25 +0200 Subject: [PATCH 01/12] feat: add tests and data files --- .../Entities/CreateEntity/D001_01_exc.robot | 57 ++++++++++++++++++ .../Entities/CreateEntity/D001_02_exc.robot | 56 ++++++++++++++++++ .../Entities/DeleteEntity/D002_01_exc.robot | 59 +++++++++++++++++++ ...t-source-registration-vehicle-speed.jsonld | 21 +++++++ data/entities/vehicle-speed-attribute.json | 12 ++++ 5 files changed, 205 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_exc.robot create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_exc.robot create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_exc.robot create mode 100644 data/csourceRegistrations/context-source-registration-vehicle-speed.jsonld create mode 100644 data/entities/vehicle-speed-attribute.json diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_exc.robot new file mode 100644 index 00000000..6f03e6fe --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_exc.robot @@ -0,0 +1,57 @@ +*** Settings *** +Documentation Verify that an entity can be created exclusively on a Context Source, the entity shall be retrieved correctly. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Setup Create Entity And Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + +*** Test Cases *** +D001_01_01_exc Create Entity and Registration And Start Context Source Mock Server + [Documentation] Check that the entity is created correctly on both the Context Broker and the Context Source. The entity shall be retrieved correctly. + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_7_1 + ${speed_entity}= Load Entity ${entity_speed_filename} ${entity_id} + Set Stub Reply GET /broker1/ngsi-ld/v1/entities/${entity_id} 200 ${speed_entity} + + ${response}= Retrieve Entity By Id ${entity_id} context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + +*** Keywords *** +Create Entity And Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_exc.robot new file mode 100644 index 00000000..76d55850 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_exc.robot @@ -0,0 +1,56 @@ +*** Settings *** +Documentation Verify that a registration made without the correct operations cannot create an entity on a Context Source and shall raise an error. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Setup Create Entity And Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} fragmentEntities/vehicle-simple-attribute-fragment.jsonld +${entity_speed_filename} vehicle-speed-attribute.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-exclusive.jsonld + +*** Test Cases *** +D002_01_exc Create Entity and Registration And Start Context Source Mock Server + [Documentation] Check that the entity cannot be created in the Context Source. The creation shall raise a conflict error. + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_7_1 + ${speed_entity}= Load Entity ${entity_speed_filename} ${entity_id} + Set Stub Reply POST /broker1/ngsi-ld/v1/entities 409 + ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entities + Should Be True ${stub_count} == 0 + +*** Keywords *** +Create Entity And Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_exc.robot new file mode 100644 index 00000000..5a1cf413 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_01_exc.robot @@ -0,0 +1,59 @@ +*** Settings *** +Documentation Verify that an entity can be deleted on the Context Source and the Context Broker by using an exclusive registration which supports all operations. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Setup Create Entity And Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + +*** Test Cases *** +D002_01_exc Create Entity and Registration And Start Context Source Mock Server + [Documentation] Check that the entity is deleted correctly in the Context Sources. + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_7_1 + ${speed_entity}= Load Entity ${entity_speed_filename} ${entity_id} + + Set Stub Reply DELETE /broker1/ngsi-ld/v1/entities/${entity_id} 204 + ${response}= Delete Entity by Id ${entity_id} + Check Response Status Code 204 ${response.status_code} + ${stub_count}= Get Stub Count DELETE /broker1/ngsi-ld/v1/entities/${entity_id} + Should Be True ${stub_count} > 0 + +*** Keywords *** +Create Entity And Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-vehicle-speed.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-speed.jsonld new file mode 100644 index 00000000..b1798060 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-vehicle-speed.jsonld @@ -0,0 +1,21 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle" + } + + ], + "propertyNames":["speed"] + } + ], + "operations": ["redirectionOps"], + "endpoint": "http://my.csource.org:1026/", + "@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-attribute.json b/data/entities/vehicle-speed-attribute.json new file mode 100644 index 00000000..f9a2fdc0 --- /dev/null +++ b/data/entities/vehicle-speed-attribute.json @@ -0,0 +1,12 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "Property", + "value": 56, + "source": { + "type": "Property", + "value": "Speedometer" + } + } +} \ No newline at end of file -- GitLab From 6aebd41aa3f5e67f282a025677ca01770baf8b31 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 18 Sep 2025 13:13:23 +0200 Subject: [PATCH 02/12] feat: add test QueryEntities --- .../Entity/QueryEntities/D011_01_exc.robot | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot new file mode 100644 index 00000000..c09c793c --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot @@ -0,0 +1,58 @@ +*** Settings *** +Documentation Verify that, when one has an exclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker the query gets merge with the Context Source correctly + +Resource ${EXECDIR}/resources/ApiUtils/Common.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource + +Test Setup Setup Registration And Start Context Source Mock Server +Test Teardown Delete Registration And Stop Context Source Mock Server + + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + + +*** Test Cases *** +D011_01_exc Query The Context Broker With Type + [Documentation] Check that if one queries the Context Broker for type, entity with matching type on a Context Source gets merged correctly + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_2 5_7_2 + ${entity_speed}= Load Entity ${entity_speed_filename} ${entity_id} + Set Stub Reply GET /broker1/ngsi-ld/v1/entities?type=Vehicle 200 ${entity_speed} + + ${response}= Query Entities entity_types=Vehicle context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + +*** Keywords *** +Setup Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ${response1}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response1.status_code} + Start Context Source Mock Server + +Delete Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity by Id ${entity_id} + Stop Context Source Mock Server -- GitLab From 3a3febe7adf5d495b5c2a4efe9e1fec8f0e03eb0 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 18 Sep 2025 13:14:46 +0200 Subject: [PATCH 03/12] feat: add test and data in UpdateEntityAttributes --- .../UpdateEntityAttributes/D004_01_exc.robot | 64 +++++++++++++++++++ .../vehicle-speed-different-attribute.jsonld | 15 +++++ 2 files changed, 79 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot create mode 100644 data/entities/fragmentEntities/vehicle-speed-different-attribute.jsonld diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot new file mode 100644 index 00000000..dd50dae8 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/UpdateEntityAttributes/D004_01_exc.robot @@ -0,0 +1,64 @@ +*** Settings *** +Documentation Verify that an entity on the Context Source can be updated correctly. The whole entity shall have the new attribute. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Setup Create Entity And Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.json +${entity_newSpeed_filename} vehicle-speed-different-attribute.jsonld +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld + +*** Test Cases *** +D004_01_exc Create Entity and Registration And Start Context Source Mock Server + [Documentation] Check that the entity is updated correctly in the Context Sources. It shall be retrieved correctly with the updated attributes. + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_7_1 + ${speed_entity}= Load Entity ${entity_speed_filename} ${entity_id} + + Set Stub Reply PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ 204 + ${response}= Update Entity Attributes + ... ${entity_id} + ... ${entity_newSpeed_filename} + ... ${CONTENT_TYPE_LD_JSON} + ${response}= Check Response Status Code 204 ${response.status_code} + + ${stub_count}= Get Stub Count PATCH /broker1/ngsi-ld/v1/entities/${entity_id}/attrs/ + Should Be True ${stub_count} > 0 + +*** Keywords *** +Create Entity And Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server diff --git a/data/entities/fragmentEntities/vehicle-speed-different-attribute.jsonld b/data/entities/fragmentEntities/vehicle-speed-different-attribute.jsonld new file mode 100644 index 00000000..dc6f3b80 --- /dev/null +++ b/data/entities/fragmentEntities/vehicle-speed-different-attribute.jsonld @@ -0,0 +1,15 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "Property", + "value": 66, + "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" + ] +} \ No newline at end of file -- GitLab From 9c4550ffb88f50d14407ae5a653197f86ef2e515 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 23 Sep 2025 11:55:00 +0200 Subject: [PATCH 04/12] fix: changed error message to 404, corrected file names and removed useless lines --- .../Entities/CreateEntity/D001_02_exc.robot | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_exc.robot index 76d55850..a6a21cd3 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_02_exc.robot @@ -15,17 +15,15 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour *** Variables *** ${entity_id_prefix} urn:ngsi-ld:Vehicle: -${entity_payload_filename} fragmentEntities/vehicle-simple-attribute-fragment.jsonld -${entity_speed_filename} vehicle-speed-attribute.json +${entity_payload_filename} vehicle-simple-attributes.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-exclusive.jsonld - +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-no-redirection-ops.jsonld *** Test Cases *** -D002_01_exc Create Entity and Registration And Start Context Source Mock Server +D001_02_exc Create Entity and Registration And Start Context Source Mock Server [Documentation] Check that the entity cannot be created in the Context Source. The creation shall raise a conflict error. [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_7_1 - ${speed_entity}= Load Entity ${entity_speed_filename} ${entity_id} - Set Stub Reply POST /broker1/ngsi-ld/v1/entities 409 + + Set Stub Reply POST /broker1/ngsi-ld/v1/entities 404 ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entities Should Be True ${stub_count} == 0 -- GitLab From 325faa84b215088d90b2d4e9581b4dc245542cbd Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 23 Sep 2025 11:56:43 +0200 Subject: [PATCH 05/12] fix: corrected mistakes in documentation --- .../Consumption/Entity/QueryEntities/D011_01_exc.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot index c09c793c..bd212c3d 100644 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Verify that, when one has an exclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker the query gets merge with the Context Source correctly +Documentation Verify that, when one has an exclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker the query gets merged correctly with the Context Source Resource ${EXECDIR}/resources/ApiUtils/Common.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource -- GitLab From b3b2c6b62541e4e0c35aa438e3666c1e6ca0a50f Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 23 Sep 2025 11:58:41 +0200 Subject: [PATCH 06/12] feat: add delete test with no redirection ops --- .../Entities/DeleteEntity/D002_02_exc.robot | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_exc.robot diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_exc.robot new file mode 100644 index 00000000..24fc8af0 --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/DeleteEntity/D002_02_exc.robot @@ -0,0 +1,55 @@ +*** Settings *** +Documentation Verify that an entity cannot be deleted on the Context Source if the registration does not support the correct operations. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Setup Create Entity And Registration And Start Context Source Mock Server +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-no-redirection-ops.jsonld + +*** Test Cases *** +D002_01_exc Create Entity and Registration And Start Context Source Mock Server + [Documentation] Check that the entity is deleted correctly in the Context Sources. + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_7_1 + + Set Stub Reply DELETE /broker1/ngsi-ld/v1/entities/${entity_id} 404 + ${stub_count}= Get Stub Count DELETE /broker1/ngsi-ld/v1/entities/${entity_id} + Should Be True ${stub_count} == 0 + +*** Keywords *** +Create Entity And Registration And Start Context Source Mock Server + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + + Start Context Source Mock Server + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file -- GitLab From 63cc4517fc413c9d71f4dc3ce333b7f9bc81dbfc Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 23 Sep 2025 12:07:22 +0200 Subject: [PATCH 07/12] add: new context source file - exclusive no redirection ops --- ...on-vehicle-speed-no-redirection-ops.jsonld | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 data/csourceRegistrations/context-source-registration-vehicle-speed-no-redirection-ops.jsonld diff --git a/data/csourceRegistrations/context-source-registration-vehicle-speed-no-redirection-ops.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-speed-no-redirection-ops.jsonld new file mode 100644 index 00000000..f325fae3 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-vehicle-speed-no-redirection-ops.jsonld @@ -0,0 +1,19 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle" + } + ], + "propertyNames":["speed"] + } + ], + "endpoint": "http://my.csource.org:1026", + "@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 -- GitLab From e1fd44c8e7f2fb74c3db4b61a5b97f91e0546771 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 23 Sep 2025 12:19:38 +0200 Subject: [PATCH 08/12] feat: add test to QueryEntities --- .../Entity/QueryEntities/D011_02_exc.robot | 73 +++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_exc.robot diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_exc.robot new file mode 100644 index 00000000..91c087ef --- /dev/null +++ b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_exc.robot @@ -0,0 +1,73 @@ +*** Settings *** +Documentation Verify that an entity can be retrieved with queryEntity and queryBatch while using an exclusive registration. + +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST +Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server + +*** Variables *** +${entity_id_prefix} urn:ngsi-ld:Vehicle: +${entity_payload_filename} vehicle-simple-attributes.jsonld +${entity_speed_filename} vehicle-speed-attribute.json +${registration_id_prefix} urn:ngsi-ld:Registration: +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-no-redirection-ops.jsonld + +*** Test Cases *** +D0011_02_01_exc Query The Context Broker By Id Via GET using the queryEntity operation + [Documentation] Check that if one queries the Context Broker for type via GET, and the registration only allows the queryEntity operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_2 5_7_2 6_23_3 + [Template] Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST + queryEntity GET /broker1/ngsi-ld/v1/entities?type=Vehicle + +D011_02_02_exc Query The Context Broker By Id Via POST using the queryBatch operation + [Documentation] Check that if one queries the Context Broker for type via POST, and the registration only allows the queryBatch operation, the request is forwarded as expected + [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_2 5_7_2 6_23_3 + [Template] Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST + queryBatch POST /broker1/ngsi-ld/v1/entityOperations/query + +*** Keywords *** +Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST + [Arguments] ${operation} ${method} ${url} + ${entity_id}= Generate Random Vehicle Entity Id + Set Suite Variable ${entity_id} + + ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} + Check Response Status Code 201 ${response.status_code} + + ${registration_id}= Generate Random CSR Id + ${operations}= Create List ${operation} + Set Suite Variable ${registration_id} + ${registration_payload}= Prepare Context Source Registration From File + ... ${registration_id} + ... ${registration_payload_file_path} + ... entity_id=${entity_id} + ... mode=exclusive + ... endpoint=/broker1 + ... operations=${operations} + ${response}= Create Context Source Registration With Return ${registration_payload} + Check Response Status Code 201 ${response.status_code} + Start Context Source Mock Server + + ${entity_speed}= Load Entity ${entity_speed_filename} ${entity_id} + Set Stub Reply ${method} ${url} 200 ${entity_speed} + &{entities}= Create Dictionary + Set To Dictionary ${entities} id=${entity_id} + @{entities}= Create List ${entities} + ${response}= Query Entities Via POST entities=${entities} context=${ngsild_test_suite_context} + + Check Response Status Code 200 ${response.status_code} + @{entities_id}= Create List ${entity_id} + Check Response Body Containing Entities URIS set to ${entities_id} ${response.json()} + +Delete Created Entity And Registration And Stop Context Source Mock Server + Delete Context Source Registration ${registration_id} + Delete Entity By Id ${entity_id} + Stop Context Source Mock Server \ No newline at end of file -- GitLab From 736f0c5fa2b9868cb4a790a922bc113491756a1f Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 23 Sep 2025 12:36:25 +0200 Subject: [PATCH 09/12] Revert "feat: add test QueryEntities" This reverts commit 6aebd41aa3f5e67f282a025677ca01770baf8b31. --- .../Entity/QueryEntities/D011_01_exc.robot | 58 ------------------- 1 file changed, 58 deletions(-) delete mode 100644 TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot deleted file mode 100644 index bd212c3d..00000000 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_01_exc.robot +++ /dev/null @@ -1,58 +0,0 @@ -*** Settings *** -Documentation Verify that, when one has an exclusive registration on a Context Broker and an entity only on a Context Source, if one queries the Context Broker the query gets merged correctly with the Context Source - -Resource ${EXECDIR}/resources/ApiUtils/Common.resource -Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource -Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource -Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource -Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource -Resource ${EXECDIR}/resources/MockServerUtils.resource - -Test Setup Setup Registration And Start Context Source Mock Server -Test Teardown Delete Registration And Stop Context Source Mock Server - - -*** Variables *** -${entity_id_prefix} urn:ngsi-ld:Vehicle: -${entity_payload_filename} vehicle-simple-attributes.jsonld -${entity_speed_filename} vehicle-speed-attribute.json -${registration_id_prefix} urn:ngsi-ld:Registration: -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld - - -*** Test Cases *** -D011_01_exc Query The Context Broker With Type - [Documentation] Check that if one queries the Context Broker for type, entity with matching type on a Context Source gets merged correctly - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_2 5_7_2 - ${entity_speed}= Load Entity ${entity_speed_filename} ${entity_id} - Set Stub Reply GET /broker1/ngsi-ld/v1/entities?type=Vehicle 200 ${entity_speed} - - ${response}= Query Entities entity_types=Vehicle context=${ngsild_test_suite_context} - Check Response Status Code 200 ${response.status_code} - -*** Keywords *** -Setup Registration And Start Context Source Mock Server - ${entity_id}= Generate Random Vehicle Entity Id - Set Suite Variable ${entity_id} - - ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} - Check Response Status Code 201 ${response.status_code} - - ${registration_id}= Generate Random CSR Id - Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File - ... ${registration_id} - ... ${registration_payload_file_path} - ... entity_id=${entity_id} - ... mode=exclusive - ... endpoint=/broker1 - ${response1}= Create Context Source Registration With Return ${registration_payload} - Check Response Status Code 201 ${response1.status_code} - Start Context Source Mock Server - -Delete Registration And Stop Context Source Mock Server - Delete Context Source Registration ${registration_id} - Delete Entity by Id ${entity_id} - Stop Context Source Mock Server -- GitLab From ee70ef5745e5400037869a1520be407ee82454f7 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 23 Sep 2025 14:31:53 +0200 Subject: [PATCH 10/12] Revert "feat: add test to QueryEntities" This reverts commit e1fd44c8e7f2fb74c3db4b61a5b97f91e0546771. --- .../Entity/QueryEntities/D011_02_exc.robot | 73 ------------------- 1 file changed, 73 deletions(-) delete mode 100644 TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_exc.robot diff --git a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_exc.robot deleted file mode 100644 index 91c087ef..00000000 --- a/TP/NGSI-LD/DistributedOperations/Consumption/Entity/QueryEntities/D011_02_exc.robot +++ /dev/null @@ -1,73 +0,0 @@ -*** Settings *** -Documentation Verify that an entity can be retrieved with queryEntity and queryBatch while using an exclusive registration. - -Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource -Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource -Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource -Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource -Resource ${EXECDIR}/resources/MockServerUtils.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource - -Test Template Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST -Test Teardown Delete Created Entity And Registration And Stop Context Source Mock Server - -*** Variables *** -${entity_id_prefix} urn:ngsi-ld:Vehicle: -${entity_payload_filename} vehicle-simple-attributes.jsonld -${entity_speed_filename} vehicle-speed-attribute.json -${registration_id_prefix} urn:ngsi-ld:Registration: -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-no-redirection-ops.jsonld - -*** Test Cases *** -D0011_02_01_exc Query The Context Broker By Id Via GET using the queryEntity operation - [Documentation] Check that if one queries the Context Broker for type via GET, and the registration only allows the queryEntity operation, the request is forwarded as expected - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_2 5_7_2 6_23_3 - [Template] Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST - queryEntity GET /broker1/ngsi-ld/v1/entities?type=Vehicle - -D011_02_02_exc Query The Context Broker By Id Via POST using the queryBatch operation - [Documentation] Check that if one queries the Context Broker for type via POST, and the registration only allows the queryBatch operation, the request is forwarded as expected - [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_2 5_7_2 6_23_3 - [Template] Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST - queryBatch POST /broker1/ngsi-ld/v1/entityOperations/query - -*** Keywords *** -Setup Registration, Context Source Mock Server And Query The Context Broker With Type Via POST - [Arguments] ${operation} ${method} ${url} - ${entity_id}= Generate Random Vehicle Entity Id - Set Suite Variable ${entity_id} - - ${response}= Create Entity ${entity_payload_filename} ${entity_id} local=${True} - Check Response Status Code 201 ${response.status_code} - - ${registration_id}= Generate Random CSR Id - ${operations}= Create List ${operation} - Set Suite Variable ${registration_id} - ${registration_payload}= Prepare Context Source Registration From File - ... ${registration_id} - ... ${registration_payload_file_path} - ... entity_id=${entity_id} - ... mode=exclusive - ... endpoint=/broker1 - ... operations=${operations} - ${response}= Create Context Source Registration With Return ${registration_payload} - Check Response Status Code 201 ${response.status_code} - Start Context Source Mock Server - - ${entity_speed}= Load Entity ${entity_speed_filename} ${entity_id} - Set Stub Reply ${method} ${url} 200 ${entity_speed} - &{entities}= Create Dictionary - Set To Dictionary ${entities} id=${entity_id} - @{entities}= Create List ${entities} - ${response}= Query Entities Via POST entities=${entities} context=${ngsild_test_suite_context} - - Check Response Status Code 200 ${response.status_code} - @{entities_id}= Create List ${entity_id} - Check Response Body Containing Entities URIS set to ${entities_id} ${response.json()} - -Delete Created Entity And Registration And Stop Context Source Mock Server - Delete Context Source Registration ${registration_id} - Delete Entity By Id ${entity_id} - Stop Context Source Mock Server \ No newline at end of file -- GitLab From 0d6005fc18f6726ce7fb166f644def446cec5539 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Thu, 25 Sep 2025 10:32:08 +0200 Subject: [PATCH 11/12] Merge remote-tracking branch 'origin/develop' --- .../Provision/Entities/CreateEntity/001_02.robot | 4 ++-- .../SubscriptionNotificationBehaviour/046_21_02.robot | 2 +- resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot index a9d3a691..47a71624 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_02.robot @@ -17,9 +17,9 @@ Test Template Create Entity With Invalid Request Scenarios 001_02_03 EntityWithNoContext [Tags] e-create 5_6_1 building-minimal.json ${ERROR_TYPE_BAD_REQUEST_DATA} -001_02_04 EntityWithNoContext +001_02_04 EntityWithInvalidType [Tags] e-create 5_6_1 - invalid-type.jsonld ${ERROR_TYPE_INVALID_REQUEST} + invalid-type.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} *** Keywords *** diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot index acd4e36c..6ff061b9 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_21_02.robot @@ -31,7 +31,7 @@ ${building_filename}= building-location-attribute.jsonld 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} + Length Should Be ${notified_entity} ${5} Should be Equal ${entity_id} ${notified_entity}[id] Should Have Value In Json ... json_object=${notified_entity} diff --git a/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld b/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld index 88d10bcb..ba572931 100644 --- a/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld +++ b/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld @@ -1,6 +1,6 @@ { "@context": [ "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite.jsonld", - "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.6.jsonld" + "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context-v1.8.jsonld" ] } -- GitLab From 4e546102bbca073763b616d1bebccd81126eb298 Mon Sep 17 00:00:00 2001 From: Benedetta Arena Date: Tue, 7 Oct 2025 16:39:11 +0200 Subject: [PATCH 12/12] fix: update test for exclusive creation --- .../Entities/CreateEntity/D001_01_exc.robot | 11 ++++++----- data/entities/vehicle-speed-attribute.jsonld | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 data/entities/vehicle-speed-attribute.jsonld diff --git a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_exc.robot index 6f03e6fe..048cec17 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/Entities/CreateEntity/D001_01_exc.robot @@ -16,7 +16,7 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour *** Variables *** ${entity_id_prefix} urn:ngsi-ld:Vehicle: ${entity_payload_filename} vehicle-simple-attributes.jsonld -${entity_speed_filename} vehicle-speed-attribute.json +${entity_speed_filename} vehicle-speed-attribute.jsonld ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed.jsonld @@ -24,11 +24,12 @@ ${registration_payload_file_path} csourceRegistrations/context-source-regi D001_01_01_exc Create Entity and Registration And Start Context Source Mock Server [Documentation] Check that the entity is created correctly on both the Context Broker and the Context Source. The entity shall be retrieved correctly. [Tags] since_v1.6.1 dist-ops 4_3_3 cf_06 proxy-redirect 4_3_6_3 5_7_1 - ${speed_entity}= Load Entity ${entity_speed_filename} ${entity_id} - Set Stub Reply GET /broker1/ngsi-ld/v1/entities/${entity_id} 200 ${speed_entity} + Set Stub Reply POST /broker1/ngsi-ld/v1/entities 201 + ${speed_entity}= Create Entity ${entity_speed_filename} ${entity_id} + Check Response Status Code 201 ${speed_entity.status_code} - ${response}= Retrieve Entity By Id ${entity_id} context=${ngsild_test_suite_context} - Check Response Status Code 200 ${response.status_code} + ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entities + Should Be True ${stub_count} > 0 *** Keywords *** Create Entity And Registration And Start Context Source Mock Server diff --git a/data/entities/vehicle-speed-attribute.jsonld b/data/entities/vehicle-speed-attribute.jsonld new file mode 100644 index 00000000..74623080 --- /dev/null +++ b/data/entities/vehicle-speed-attribute.jsonld @@ -0,0 +1,15 @@ +{ + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle", + "speed": { + "type": "Property", + "value": 56, + "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" + ] +} \ No newline at end of file -- GitLab