From 51d7eff179d612c7c7967c514f4bfe36236f25e5 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Fri, 29 Sep 2023 18:09:11 +0200 Subject: [PATCH 1/3] fix: first round of fixes in CSRs Test Cases - remove timestamp property (from a wrong example in C.3) - only replace id at the root of test samples (what is actually needed, avoids breaking entities infos in CSRs) - remove a duplicate sample CSR payload - 037_01: fix expectation in 037_01 (only one CSR is expected) - O37_04: add type when querying since only id is not allowed --- .../037_04.robot | 2 +- .../RegisterContextSource/033_01_02.robot | 2 +- .../RegisterContextSource/033_03.robot | 2 +- .../RegisterContextSource/033_06.robot | 2 +- .../RegisterContextSource/033_07.robot | 2 +- .../RegisterContextSource/033_09.robot | 2 +- ...-source-registration-invalid-sample.jsonld | 3 -- ...xt-source-registration-no-id-sample.jsonld | 3 -- ...registration-past-expiration-sample.jsonld | 3 -- .../context-source-registration-sample.jsonld | 3 -- ...t-source-registration-simple-sample.jsonld | 43 ------------------- ...registration-with-expiration-sample.jsonld | 3 -- ...urce-registrations-037-01-expectation.json | 14 ------ ...-registration-different-type-sample.jsonld | 3 -- resources/JsonUtils.resource | 2 +- 15 files changed, 7 insertions(+), 82 deletions(-) delete mode 100644 data/csourceRegistrations/context-source-registration-simple-sample.jsonld diff --git a/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_04.robot b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_04.robot index 4430c7fe..8d89de76 100644 --- a/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_04.robot +++ b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_04.robot @@ -12,7 +12,7 @@ Suite Teardown Delete Created Context Source Registration *** Variables *** ${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: -${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld +${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-detailed-information-sample.jsonld ${expectation_file_path}= csourceRegistrations/expectations/context-source-registrations-037-04-expectation.json diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot index c12761ce..3487a96d 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot @@ -11,7 +11,7 @@ Suite Teardown Delete Created Context Source Registrations *** Variables *** ${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_payload_file_path}= csourceRegistrations/context-source-registration-simple-sample.jsonld +${registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld *** Test Cases *** diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_03.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_03.robot index 6ec328ca..cffdca07 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_03.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_03.robot @@ -10,7 +10,7 @@ Suite Teardown Delete Created Context Source Registrations *** Variables *** ${registration_id_prefix}= urn:ngsi-ld:Registration: -${filename}= csourceRegistrations/context-source-registration-simple-sample.jsonld +${filename}= csourceRegistrations/context-source-registration-sample.jsonld *** Test Cases *** diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_06.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_06.robot index 9a13159e..8247cb99 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_06.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_06.robot @@ -8,7 +8,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variables *** ${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_payload_file_path}= csourceRegistrations/context-source-registration-simple-sample.jsonld +${registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld *** Test Cases *** diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_07.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_07.robot index 5c85cabe..5b04fc52 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_07.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_07.robot @@ -11,7 +11,7 @@ Suite Teardown Delete Created Context Source Registrations *** Variables *** ${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_payload_file_path}= csourceRegistrations/context-source-registration-simple-sample.jsonld +${registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld *** Test Cases *** diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_09.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_09.robot index c11ec047..cc17f1d9 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_09.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_09.robot @@ -8,7 +8,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource *** Variables *** ${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_payload_file_path}= csourceRegistrations/context-source-registration-simple-sample.jsonld +${registration_payload_file_path}= csourceRegistrations/context-source-registration-sample.jsonld *** Test Cases *** diff --git a/data/csourceRegistrations/context-source-registration-invalid-sample.jsonld b/data/csourceRegistrations/context-source-registration-invalid-sample.jsonld index 3a401bad..06fe7cc9 100644 --- a/data/csourceRegistrations/context-source-registration-invalid-sample.jsonld +++ b/data/csourceRegistrations/context-source-registration-invalid-sample.jsonld @@ -34,9 +34,6 @@ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]] ] }, - "timestamp": { - "startAt": " 2017-11-29T14:53:15Z" - }, "@context": [ "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" ] diff --git a/data/csourceRegistrations/context-source-registration-no-id-sample.jsonld b/data/csourceRegistrations/context-source-registration-no-id-sample.jsonld index ed9e1d8e..484ed252 100644 --- a/data/csourceRegistrations/context-source-registration-no-id-sample.jsonld +++ b/data/csourceRegistrations/context-source-registration-no-id-sample.jsonld @@ -33,9 +33,6 @@ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]] ] }, - "timestamp": { - "startAt": " 2017-11-29T14:53:15Z" - }, "@context": [ "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" ] diff --git a/data/csourceRegistrations/context-source-registration-past-expiration-sample.jsonld b/data/csourceRegistrations/context-source-registration-past-expiration-sample.jsonld index 38760ce0..6078f7b0 100644 --- a/data/csourceRegistrations/context-source-registration-past-expiration-sample.jsonld +++ b/data/csourceRegistrations/context-source-registration-past-expiration-sample.jsonld @@ -34,9 +34,6 @@ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]] ] }, - "timestamp": { - "startAt": " 2017-11-29T14:53:15Z" - }, "expiresAt": " 2018-11-29T14:53:15Z", "@context": [ "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" diff --git a/data/csourceRegistrations/context-source-registration-sample.jsonld b/data/csourceRegistrations/context-source-registration-sample.jsonld index 68ef4bc9..d24b35fd 100644 --- a/data/csourceRegistrations/context-source-registration-sample.jsonld +++ b/data/csourceRegistrations/context-source-registration-sample.jsonld @@ -34,9 +34,6 @@ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]] ] }, - "timestamp": { - "startAt": "2017-11-29T14:53:15Z" - }, "@context": [ "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" ] diff --git a/data/csourceRegistrations/context-source-registration-simple-sample.jsonld b/data/csourceRegistrations/context-source-registration-simple-sample.jsonld deleted file mode 100644 index 7d83cbbc..00000000 --- a/data/csourceRegistrations/context-source-registration-simple-sample.jsonld +++ /dev/null @@ -1,43 +0,0 @@ -{ - "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", - "type": "ContextSourceRegistration", - "information": [ - { - "entities": [ - { - "id": "urn:ngsi-ld:Vehicle:A456", - "type": "Vehicle" - } - ], - "propertyNames": ["brandName","speed"], - "relationshipNames": ["isParked"] - }, - { - "entities": [ - { - "idPattern": ".*downtown$", - "type": "OffStreetParking" - }, - { - "idPattern": ".*47$", - "type": "OffStreetParking" - } - ], - "propertyNames": ["availableSpotNumber","totalSpotNumber"], - "relationshipNames": ["isNextToBuilding"] - } - ], - "endpoint": "http://my.csource.org:1026", - "location": { - "type": "Polygon", - "coordinates": [ - [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], - [100.0, 1.0], [100.0, 0.0]] ] - }, - "timestamp": { - "startAt": " 2017-11-29T14:53:15Z" - }, - "@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/csourceRegistrations/context-source-registration-with-expiration-sample.jsonld b/data/csourceRegistrations/context-source-registration-with-expiration-sample.jsonld index d638652d..0dbf966b 100644 --- a/data/csourceRegistrations/context-source-registration-with-expiration-sample.jsonld +++ b/data/csourceRegistrations/context-source-registration-with-expiration-sample.jsonld @@ -34,9 +34,6 @@ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]] ] }, - "timestamp": { - "startAt": "2017-11-29T14:53:15Z" - }, "expiresAt": "2025-11-29T14:53:15Z", "@context": [ "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" diff --git a/data/csourceRegistrations/expectations/context-source-registrations-037-01-expectation.json b/data/csourceRegistrations/expectations/context-source-registrations-037-01-expectation.json index b8d0242e..2b81da66 100644 --- a/data/csourceRegistrations/expectations/context-source-registrations-037-01-expectation.json +++ b/data/csourceRegistrations/expectations/context-source-registrations-037-01-expectation.json @@ -1,18 +1,4 @@ [ - { - "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", - "type":"ContextSourceRegistration", - "information":[ - { - "entities":[ - { - "type":"Building" - } - ] - } - ], - "endpoint":"http://my.csource.org:1026" - }, { "id":"urn:ngsi-ld:ContextSourceRegistration:randomUUID", "type":"ContextSourceRegistration", diff --git a/data/csourceRegistrations/fragments/context-source-registration-different-type-sample.jsonld b/data/csourceRegistrations/fragments/context-source-registration-different-type-sample.jsonld index 09591732..19ef6f5b 100644 --- a/data/csourceRegistrations/fragments/context-source-registration-different-type-sample.jsonld +++ b/data/csourceRegistrations/fragments/context-source-registration-different-type-sample.jsonld @@ -34,9 +34,6 @@ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]] ] }, - "timestamp": { - "startAt": " 2017-11-29T14:53:15Z" - }, "@context": [ "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" ] diff --git a/resources/JsonUtils.resource b/resources/JsonUtils.resource index 52cd6969..7cd02b4d 100644 --- a/resources/JsonUtils.resource +++ b/resources/JsonUtils.resource @@ -23,7 +23,7 @@ Load Test Sample [Arguments] ${test_sample_file_path} ${test_sample_id}=${EMPTY} ${test_sample_payload}= Load JSON From File ${EXECDIR}/data/${test_sample_file_path} - ${test_sample}= Update Value To JSON ${test_sample_payload} $..id ${test_sample_id} + ${test_sample}= Update Value To JSON ${test_sample_payload} $.id ${test_sample_id} IF '${test_sample_id}'=='' Delete Object From JSON ${test_sample} $..id -- GitLab From 92076bed0c02d1016693ae364e1ee8977e3a4cfc Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sat, 30 Sep 2023 07:02:29 +0200 Subject: [PATCH 2/3] fix: missing updates in JsonUtils.resource --- resources/JsonUtils.resource | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/JsonUtils.resource b/resources/JsonUtils.resource index 7cd02b4d..3e3d8014 100644 --- a/resources/JsonUtils.resource +++ b/resources/JsonUtils.resource @@ -16,7 +16,7 @@ Load Entity [Arguments] ${entity_file_name} ${entity_id} ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${entity_file_name} - ${entity}= Update Value To JSON ${entity_payload} $..id ${entity_id} + ${entity}= Update Value To JSON ${entity_payload} $.id ${entity_id} RETURN ${entity} Load Test Sample @@ -26,7 +26,7 @@ Load Test Sample ${test_sample}= Update Value To JSON ${test_sample_payload} $.id ${test_sample_id} IF '${test_sample_id}'=='' - Delete Object From JSON ${test_sample} $..id + Delete Object From JSON ${test_sample} $.id END RETURN ${test_sample} -- GitLab From 5da0388a89c6980c2a0e198973f6943033cd5415 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sat, 30 Sep 2023 07:04:46 +0200 Subject: [PATCH 3/3] fix: forgotten change in commit --- .../Discovery/QueryContextSourceRegistrations/037_04.robot | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_04.robot b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_04.robot index 8d89de76..c2cbb462 100644 --- a/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_04.robot +++ b/TP/NGSI-LD/ContextSource/Discovery/QueryContextSourceRegistrations/037_04.robot @@ -14,13 +14,14 @@ Suite Teardown Delete Created Context Source Registration ${context_source_registration_id_prefix}= urn:ngsi-ld:ContextSourceRegistration: ${context_source_registration_payload_file_path}= csourceRegistrations/context-source-registration-detailed-information-sample.jsonld ${expectation_file_path}= csourceRegistrations/expectations/context-source-registrations-037-04-expectation.json +${entity_type}= https://ngsi-ld-test-suite/context#Building *** Test Cases *** 037_04_01 Query Context Source Registrations Without Context [Documentation] Check that you can query context source registrations. If a JSON-LD context is not provided, then all the query terms shall be resolved against the default JSON-LD @context [Tags] csr-query 5_10_2 - ${response}= Query Context Source Registrations id=${context_source_registration_id} + ${response}= Query Context Source Registrations id=${context_source_registration_id} type=${entity_type} @{expected_context_source_registration_ids}= Create List ${context_source_registration_id} Check Response Status Code 200 ${response.status_code} Check Response Body Containing List Containing Context Source Registrations elements -- GitLab