From 55712cf80fa4f4f4727d38da6e92694f29833d40 Mon Sep 17 00:00:00 2001 From: Thomas BOUSSELIN Date: Wed, 4 Sep 2024 10:41:26 +0200 Subject: [PATCH 1/3] feat: 1.6.1 for CSR create-retrieve-delete (33-35-36) --- .../035_01.robot | 4 --- .../{033_01_01.robot => 033_01.robot} | 21 +++++++++-- .../{033_01_03.robot => 033_11.robot} | 4 +-- .../{033_01_02.robot => 033_12.robot} | 20 +++++++---- ...source-registration-csourceProperty.jsonld | 4 --- ...ontext-source-registration-location.jsonld | 3 ++ .../context-source-registration-no-id.jsonld | 8 +---- ...source-registration-past-expiration.jsonld | 6 ---- ...source-registration-with-expiration.jsonld | 8 +---- ...gistration-with-mode-and-operations.jsonld | 36 +++++++++++++++++++ ...egistration-without-mode-operations.jsonld | 34 ++++++++++++++++++ .../context-source-registration.jsonld | 10 ++---- ...t-source-registration-expanded-format.json | 29 ++------------- .../context-source-registration.json | 8 ++--- 14 files changed, 115 insertions(+), 80 deletions(-) rename TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/{033_01_01.robot => 033_01.robot} (66%) rename TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/{033_01_03.robot => 033_11.robot} (93%) rename TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/{033_01_02.robot => 033_12.robot} (71%) create mode 100644 data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld create mode 100644 data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld diff --git a/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_01.robot b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_01.robot index 08bdca8a..d8db41e7 100644 --- a/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_01.robot +++ b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_01.robot @@ -7,7 +7,6 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Test Setup Setup Initial Context Source Registrations -Test Teardown Delete Created Context Source Registrations *** Variables *** @@ -37,6 +36,3 @@ Setup Initial Context Source Registrations ${create_response}= Create Context Source Registration With Return ${updated_payload} Check Response Status Code 201 ${create_response.status_code} Set Test Variable ${registration_id} - -Delete Created Context Source Registrations - Delete Context Source Registration ${registration_id} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_01.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot similarity index 66% rename from TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_01.robot rename to TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot index ac196405..ff1f69a6 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_01.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot @@ -7,6 +7,7 @@ Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Teardown Delete Created Context Source Registrations +Test Template Create Context Source Registration *** Variables *** @@ -16,14 +17,30 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi *** Test Cases *** 033_01_01 Create Context Source Registration With Specific Date Expiration Date + [Tags] csr-create 5_9_2 since_v1.6.1 + csourceRegistrations/context-source-registration-with-expiration.jsonld +033_01_02 Create Context Source Registration That Never Expires + [Tags] csr-create 5_9_2 since_v1.6.1 + csourceRegistrations/context-source-registration.jsonld +033_01_03 Create Context Source Registration With Non Default Mode And Operations + [Tags] csr-create 5_9_2 since_v1.6.1 + csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld +033_01_04 Create Context Source Registration With Location + [Tags] csr-create 5_9_2 since_v1.6.1 + csourceRegistrations/context-source-registration-location.jsonld + + +*** Keywords *** +Create Context Source Registration [Documentation] Check that one can create a context source registration with specific ID and expiration date - [Tags] csr-create 5_9_2 + [Arguments] ${registration_payload_file_path} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} ${registration_payload}= Update Value To JSON ${payload} $..id ${registration_id} ${response}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response.status_code} + Check Response Headers Containing URI set to ${registration_id} ${response.headers} ${response1}= Retrieve Context Source Registration ... context_source_registration_id=${registration_id} ... context=${ngsild_test_suite_context} @@ -31,7 +48,5 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi ${ignored_attributes}= Create List ${status_regex_expr} Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} - -*** Keywords *** Delete Created Context Source Registrations Delete Context Source Registration ${registration_id} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_03.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot similarity index 93% rename from TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_03.robot rename to TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot index 55d7e793..ca26cbf6 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_03.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot @@ -15,9 +15,9 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi *** Test Cases *** -033_01_03 Create Context Source Registration Without Specifying an ID +033_11 Create Context Source Registration Without Specifying an ID [Documentation] Check that one can create a context source registration without specifying an ID - [Tags] csr-create 5_9_2 + [Tags] csr-create 5_9_2 since_v1.6.1 ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} ${response}= Create Context Source Registration With Return ${payload} Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot similarity index 71% rename from TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot rename to TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot index 236dc7e6..cc788730 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that one can create a context source registration that never expires +Documentation Check that one can create a context source registration without default mode and operations Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource @@ -11,17 +11,19 @@ Suite Teardown Delete Created Context Source Registrations *** Variables *** ${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_payload_file_path}= csourceRegistrations/context-source-registration.jsonld +${registration_payload_file_path}= csourceRegistrations/context-source-registration-without-mode-operations.jsonld *** Test Cases *** -033_01_02 Create Context Source Registration That Never Expires - [Documentation] Check that one can create a context source registration that never expires - [Tags] csr-create 5_9_2 +033_12 Create Context Source Registration Without Mode And Operation + [Documentation] Check that one can create a context source registration without mode and operations + [Tags] csr-create 5_9_2 since_v1.6.1 ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} + ${registration_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${response}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response.status_code} Check Response Headers Containing URI set to ${registration_id} ${response.headers} @@ -29,8 +31,12 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi ... context_source_registration_id=${registration_id} ... context=${ngsild_test_suite_context} ... accept=${CONTENT_TYPE_LD_JSON} - ${ignored_attributes}= Create List ${status_regex_expr} - Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} + + ${ignored_attributes}= Create List ${status_regex_expr} mode operations + ${expected_payload}= Add Object To Json ${registration_payload} $.mode inclusive + ${operations}= Create List federationOps + ${expected_payload}= Add Object To Json ${expected_payload} $.operations ${operations} + Check Created Resource Set To ${expected_payload} ${response1.json()} ${ignored_attributes} *** Keywords *** diff --git a/data/csourceRegistrations/context-source-registration-csourceProperty.jsonld b/data/csourceRegistrations/context-source-registration-csourceProperty.jsonld index a76f1967..63bbdf42 100644 --- a/data/csourceRegistrations/context-source-registration-csourceProperty.jsonld +++ b/data/csourceRegistrations/context-source-registration-csourceProperty.jsonld @@ -10,10 +10,6 @@ ] } ], - "location":{ - "type":"Point", - "coordinates":[-8.521,41.2] - }, "endpoint":"http://my.csource.org:1026", "csourceProperty1": "aValue", "csourceProperty2": "anotherValue", diff --git a/data/csourceRegistrations/context-source-registration-location.jsonld b/data/csourceRegistrations/context-source-registration-location.jsonld index a5603e7b..1f49d288 100644 --- a/data/csourceRegistrations/context-source-registration-location.jsonld +++ b/data/csourceRegistrations/context-source-registration-location.jsonld @@ -14,8 +14,11 @@ "type":"Point", "coordinates":[-8.521,41.2] }, + "mode": "inclusive", + "operations": ["federationOps"], "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/csourceRegistrations/context-source-registration-no-id.jsonld b/data/csourceRegistrations/context-source-registration-no-id.jsonld index 484ed252..0361c495 100644 --- a/data/csourceRegistrations/context-source-registration-no-id.jsonld +++ b/data/csourceRegistrations/context-source-registration-no-id.jsonld @@ -26,13 +26,7 @@ "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]] ] - }, + "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" ] diff --git a/data/csourceRegistrations/context-source-registration-past-expiration.jsonld b/data/csourceRegistrations/context-source-registration-past-expiration.jsonld index 6078f7b0..f3c7395d 100644 --- a/data/csourceRegistrations/context-source-registration-past-expiration.jsonld +++ b/data/csourceRegistrations/context-source-registration-past-expiration.jsonld @@ -28,12 +28,6 @@ } ], "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]] ] - }, "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-with-expiration.jsonld b/data/csourceRegistrations/context-source-registration-with-expiration.jsonld index 0dbf966b..30c64748 100644 --- a/data/csourceRegistrations/context-source-registration-with-expiration.jsonld +++ b/data/csourceRegistrations/context-source-registration-with-expiration.jsonld @@ -27,13 +27,7 @@ "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]] ] - }, + "endpoint": "http://my.csource.org:1026", "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/context-source-registration-with-mode-and-operations.jsonld b/data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld new file mode 100644 index 00000000..7d8cf937 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld @@ -0,0 +1,36 @@ +{ + "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"] + } + ], + "mode": "exclusive", + "operations": ["queryEntity","queryTemporal","updateOps"], + "endpoint": "http://my.csource.org:1026", + "@context": [ + "https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld b/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld new file mode 100644 index 00000000..26425332 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld @@ -0,0 +1,34 @@ +{ + "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", + "@context": [ + "https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/csourceRegistrations/context-source-registration.jsonld b/data/csourceRegistrations/context-source-registration.jsonld index d24b35fd..f19fee30 100644 --- a/data/csourceRegistrations/context-source-registration.jsonld +++ b/data/csourceRegistrations/context-source-registration.jsonld @@ -27,13 +27,9 @@ "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]] ] - }, + "mode": "inclusive", + "operations": ["federationOps"], + "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" ] diff --git a/data/csourceRegistrations/expectations/context-source-registration-expanded-format.json b/data/csourceRegistrations/expectations/context-source-registration-expanded-format.json index c557935b..03e4a0d1 100644 --- a/data/csourceRegistrations/expectations/context-source-registration-expanded-format.json +++ b/data/csourceRegistrations/expectations/context-source-registration-expanded-format.json @@ -38,31 +38,6 @@ ] } ], - "location": { - "type": "Polygon", - "coordinates": [ - [ - [ - 100.0, - 0.0 - ], - [ - 101.0, - 0.0 - ], - [ - 101.0, - 1.0 - ], - [ - 100.0, - 1.0 - ], - [ - 100.0, - 0.0 - ] - ] - ] - } + "mode": "inclusive", + "operations": ["federationOps"] } diff --git a/data/csourceRegistrations/expectations/context-source-registration.json b/data/csourceRegistrations/expectations/context-source-registration.json index a534ebc7..fdc4541e 100644 --- a/data/csourceRegistrations/expectations/context-source-registration.json +++ b/data/csourceRegistrations/expectations/context-source-registration.json @@ -28,10 +28,6 @@ } ], "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]] ] - } + "mode": "inclusive", + "operations": ["federationOps"] } \ No newline at end of file -- GitLab From 34bc428c66ed5e21a1bcc8fc171a25ba761c5c28 Mon Sep 17 00:00:00 2001 From: Thomas BOUSSELIN Date: Mon, 9 Dec 2024 15:05:21 +0100 Subject: [PATCH 2/3] fix: PR comments + some errors in 033 test --- .../RegisterContextSource/033_01.robot | 19 ++++++++------ .../RegisterContextSource/033_02.robot | 8 +++--- .../RegisterContextSource/033_11.robot | 6 +++-- .../RegisterContextSource/033_12.robot | 7 ++---- ...gistration-with-mode-and-operations.jsonld | 2 +- ...egistration-without-mode-operations.jsonld | 2 +- resources/AssertionUtils.resource | 25 +++++++++++++------ 7 files changed, 42 insertions(+), 27 deletions(-) diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot index ff1f69a6..bae8e85f 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot @@ -15,29 +15,29 @@ ${registration_id_prefix}= urn:ngsi-ld:Registration: ${registration_payload_file_path}= csourceRegistrations/context-source-registration-with-expiration.jsonld -*** Test Cases *** +*** Test Cases *** FILENAME HAS_MODE 033_01_01 Create Context Source Registration With Specific Date Expiration Date - [Tags] csr-create 5_9_2 since_v1.6.1 + [Tags] csr-create 5_9_2 csourceRegistrations/context-source-registration-with-expiration.jsonld 033_01_02 Create Context Source Registration That Never Expires - [Tags] csr-create 5_9_2 since_v1.6.1 + [Tags] csr-create 5_9_2 csourceRegistrations/context-source-registration.jsonld 033_01_03 Create Context Source Registration With Non Default Mode And Operations [Tags] csr-create 5_9_2 since_v1.6.1 - csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld + csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld ${True} 033_01_04 Create Context Source Registration With Location - [Tags] csr-create 5_9_2 since_v1.6.1 + [Tags] csr-create 5_9_2 csourceRegistrations/context-source-registration-location.jsonld *** Keywords *** Create Context Source Registration [Documentation] Check that one can create a context source registration with specific ID and expiration date - [Arguments] ${registration_payload_file_path} + [Arguments] ${registration_payload_file_path} ${has_mode}=${False} ${registration_id}= Generate Random Entity Id ${registration_id_prefix} Set Suite Variable ${registration_id} ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} - ${registration_payload}= Update Value To JSON ${payload} $..id ${registration_id} + ${registration_payload}= Update Value To JSON ${payload} $.id ${registration_id} ${response}= Create Context Source Registration With Return ${registration_payload} Check Response Status Code 201 ${response.status_code} Check Response Headers Containing URI set to ${registration_id} ${response.headers} @@ -46,6 +46,11 @@ Create Context Source Registration ... context=${ngsild_test_suite_context} ... accept=${CONTENT_TYPE_LD_JSON} ${ignored_attributes}= Create List ${status_regex_expr} + + IF ${has_mode} == ${False} + Append To List ${ignored_attributes} mode operations + END + Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} Delete Created Context Source Registrations diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_02.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_02.robot index b68aee12..bd0005ec 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_02.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_02.robot @@ -13,12 +13,12 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi *** Test Cases *** -033_02_01 Create a context source registration with invalid JSON file - [Documentation] Create a context source registration with invalid JSON file +033_02_01 Create a context source registration with invalid content + [Documentation] Check that one cannot create a context source with invalid content [Tags] csr-create 5_9_2 - ${subscription_payload}= Get File ${EXECDIR}/data/${registration_payload_file_path} + ${csr_payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} ${response}= Create Context Source Registration - ... ${subscription_payload} + ... ${csr_payload} Check Response Status Code 400 ${response.status_code} Check Response Body Type When Using Session Request ${response.json()} ${ERROR_TYPE_BAD_REQUEST_DATA} Check Response Body Title When Using Session Request ${response.json()} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot index ca26cbf6..7558a351 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot @@ -29,8 +29,10 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi ... context_source_registration_id=${registration_id} ... context=${ngsild_test_suite_context} ... accept=${CONTENT_TYPE_LD_JSON} - ${ignored_attributes}= Create List ${status_regex_expr} - Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} + Check Response Body Containing Context Source Registration element + ... ${registration_payload_file_path} + ... ${registration_id} + ... ${response1.json()} *** Keywords *** diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot index cc788730..1d63c8d1 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot @@ -32,11 +32,8 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi ... context=${ngsild_test_suite_context} ... accept=${CONTENT_TYPE_LD_JSON} - ${ignored_attributes}= Create List ${status_regex_expr} mode operations - ${expected_payload}= Add Object To Json ${registration_payload} $.mode inclusive - ${operations}= Create List federationOps - ${expected_payload}= Add Object To Json ${expected_payload} $.operations ${operations} - Check Created Resource Set To ${expected_payload} ${response1.json()} ${ignored_attributes} + ${ignored_attributes}= Create List ${status_regex_expr} mode operations timesSent timesFailed + Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} *** Keywords *** diff --git a/data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld b/data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld index 7d8cf937..27f2ab16 100644 --- a/data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld +++ b/data/csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld @@ -31,6 +31,6 @@ "operations": ["queryEntity","queryTemporal","updateOps"], "endpoint": "http://my.csource.org:1026", "@context": [ - "https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.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/csourceRegistrations/context-source-registration-without-mode-operations.jsonld b/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld index 26425332..cc9fb6f0 100644 --- a/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld +++ b/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld @@ -29,6 +29,6 @@ ], "endpoint": "http://my.csource.org:1026", "@context": [ - "https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.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/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index b6754cdc..de0fcc6c 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -21,6 +21,7 @@ ${lastNotification_regex_expr}= root\\['lastNotification'\\] ${timesFailed_regex_expr}= root\\['timesFailed'\\] ${timesSent_regex_expr}= root\\['timesSent'\\] ${is_active_expr}= root\\['isActive'\\] +${context_source_ignored_regex_expr}= root\\['@context'\\] *** Keywords *** @@ -278,14 +279,24 @@ Check Response Body Containing Number Of Entities Check Response Body Containing Context Source Registration element [Arguments] ${expectation_filename} ${context_source_registration_id} ${response_body} - ${context_source_registration_payload}= Load JSON From File ${EXECDIR}/data/${expectation_filename} - ${context_source_registration}= Update Value To JSON - ... ${context_source_registration_payload} - ... $.id - ... ${context_source_registration_id} - ${ignored_keys}= Create List ${context_regex_expr} + ${expectation_json}= Load JSON From File ${EXECDIR}/data/${expectation_filename} + + ${id_dict}= Create Dictionary id=${context_source_registration_id} + ${expectation_json_with_id}= Add Object To JSON ${expectation_json} $ ${id_dict} + + Log To Console context_source_registration_id + Log To Console ${context_source_registration_id} + Log To Console ${context_source_registration_id} + Log To Console ${context_source_registration_id} + Log To Console ${context_source_registration_id} + + Log To Console expectation_json_with_id + Log To Console ${expectation_json_with_id} + Log To Console response_body + Log To Console ${response_body} + ${ignored_keys}= Create List ${context_regex_expr} mode operations ${comparison_result}= Compare Dictionaries Ignoring Keys - ... ${context_source_registration} + ... ${expectation_json_with_id} ... ${response_body} ... ${ignored_keys} Should Be Empty ${comparison_result} msg=${comparison_result.pretty()} -- GitLab From 4daef2ec9377e4069c00308f5540511adfef94ce Mon Sep 17 00:00:00 2001 From: Thomas BOUSSELIN Date: Mon, 9 Dec 2024 15:29:02 +0100 Subject: [PATCH 3/3] fix: PR comments --- .../RegisterContextSource/033_01.robot | 12 +++--- .../RegisterContextSource/033_11.robot | 2 +- .../RegisterContextSource/033_12.robot | 41 ------------------- ...ontext-source-registration-location.jsonld | 2 - ...egistration-without-mode-operations.jsonld | 34 --------------- .../context-source-registration.jsonld | 2 - resources/AssertionUtils.resource | 10 ----- 7 files changed, 7 insertions(+), 96 deletions(-) delete mode 100644 TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot delete mode 100644 data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot index bae8e85f..75e200be 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot @@ -16,18 +16,18 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi *** Test Cases *** FILENAME HAS_MODE -033_01_01 Create Context Source Registration With Specific Date Expiration Date - [Tags] csr-create 5_9_2 - csourceRegistrations/context-source-registration-with-expiration.jsonld -033_01_02 Create Context Source Registration That Never Expires +033_01_01 Create Context Source Registration Without Mode And Operation [Tags] csr-create 5_9_2 csourceRegistrations/context-source-registration.jsonld -033_01_03 Create Context Source Registration With Non Default Mode And Operations +033_01_02 Create Context Source Registration With Non Default Mode And Operations [Tags] csr-create 5_9_2 since_v1.6.1 csourceRegistrations/context-source-registration-with-mode-and-operations.jsonld ${True} -033_01_04 Create Context Source Registration With Location +033_01_03 Create Context Source Registration With Location [Tags] csr-create 5_9_2 csourceRegistrations/context-source-registration-location.jsonld +033_01_04 Create Context Source Registration With Specific Date Expiration Date + [Tags] csr-create 5_9_2 + csourceRegistrations/context-source-registration-with-expiration.jsonld *** Keywords *** diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot index 7558a351..43f81eac 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot @@ -17,7 +17,7 @@ ${registration_payload_file_path}= csourceRegistrations/context-source-regi *** Test Cases *** 033_11 Create Context Source Registration Without Specifying an ID [Documentation] Check that one can create a context source registration without specifying an ID - [Tags] csr-create 5_9_2 since_v1.6.1 + [Tags] csr-create 5_9_2 ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} ${response}= Create Context Source Registration With Return ${payload} Check Response Status Code 201 ${response.status_code} diff --git a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot deleted file mode 100644 index 1d63c8d1..00000000 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_12.robot +++ /dev/null @@ -1,41 +0,0 @@ -*** Settings *** -Documentation Check that one can create a context source registration without default mode and operations - -Resource ${EXECDIR}/resources/ApiUtils/ContextSourceRegistration.resource -Resource ${EXECDIR}/resources/ApiUtils/ContextSourceDiscovery.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource - -Suite Teardown Delete Created Context Source Registrations - - -*** Variables *** -${registration_id_prefix}= urn:ngsi-ld:Registration: -${registration_payload_file_path}= csourceRegistrations/context-source-registration-without-mode-operations.jsonld - - -*** Test Cases *** -033_12 Create Context Source Registration Without Mode And Operation - [Documentation] Check that one can create a context source registration without mode and operations - [Tags] csr-create 5_9_2 since_v1.6.1 - ${registration_id}= Generate Random Entity Id ${registration_id_prefix} - Set Suite Variable ${registration_id} - ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} - - ${registration_payload}= Update Value To JSON ${payload} $..id ${registration_id} - - ${response}= Create Context Source Registration With Return ${registration_payload} - Check Response Status Code 201 ${response.status_code} - Check Response Headers Containing URI set to ${registration_id} ${response.headers} - ${response1}= Retrieve Context Source Registration - ... context_source_registration_id=${registration_id} - ... context=${ngsild_test_suite_context} - ... accept=${CONTENT_TYPE_LD_JSON} - - ${ignored_attributes}= Create List ${status_regex_expr} mode operations timesSent timesFailed - Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} - - -*** Keywords *** -Delete Created Context Source Registrations - Delete Context Source Registration ${registration_id} diff --git a/data/csourceRegistrations/context-source-registration-location.jsonld b/data/csourceRegistrations/context-source-registration-location.jsonld index 1f49d288..0c2cb3e0 100644 --- a/data/csourceRegistrations/context-source-registration-location.jsonld +++ b/data/csourceRegistrations/context-source-registration-location.jsonld @@ -14,8 +14,6 @@ "type":"Point", "coordinates":[-8.521,41.2] }, - "mode": "inclusive", - "operations": ["federationOps"], "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" diff --git a/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld b/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld deleted file mode 100644 index cc9fb6f0..00000000 --- a/data/csourceRegistrations/context-source-registration-without-mode-operations.jsonld +++ /dev/null @@ -1,34 +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", - "@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.jsonld b/data/csourceRegistrations/context-source-registration.jsonld index f19fee30..49ab16e1 100644 --- a/data/csourceRegistrations/context-source-registration.jsonld +++ b/data/csourceRegistrations/context-source-registration.jsonld @@ -27,8 +27,6 @@ "relationshipNames": ["isNextToBuilding"] } ], - "mode": "inclusive", - "operations": ["federationOps"], "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" diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index de0fcc6c..047f60d8 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -284,16 +284,6 @@ Check Response Body Containing Context Source Registration element ${id_dict}= Create Dictionary id=${context_source_registration_id} ${expectation_json_with_id}= Add Object To JSON ${expectation_json} $ ${id_dict} - Log To Console context_source_registration_id - Log To Console ${context_source_registration_id} - Log To Console ${context_source_registration_id} - Log To Console ${context_source_registration_id} - Log To Console ${context_source_registration_id} - - Log To Console expectation_json_with_id - Log To Console ${expectation_json_with_id} - Log To Console response_body - Log To Console ${response_body} ${ignored_keys}= Create List ${context_regex_expr} mode operations ${comparison_result}= Compare Dictionaries Ignoring Keys ... ${expectation_json_with_id} -- GitLab