diff --git a/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_01.robot b/TP/NGSI-LD/ContextSource/Registration/DeleteContextSourceRegistration/035_01.robot index 08bdca8a75727a95b8d6908b72ad471efcb2be06..d8db41e78c148efdc2056d4b160c4161d5eb5395 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 61% rename from TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_01.robot rename to TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01.robot index ac196405b723df21776f3cccd23474387c00246c..75e200bec1ff38336139882d36d1e193c2c4be25 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 *** @@ -14,24 +15,43 @@ ${registration_id_prefix}= urn:ngsi-ld:Registration: ${registration_payload_file_path}= csourceRegistrations/context-source-registration-with-expiration.jsonld -*** Test Cases *** -033_01_01 Create Context Source Registration With Specific Date Expiration Date - [Documentation] Check that one can create a context source registration with specific ID and expiration date +*** Test Cases *** FILENAME HAS_MODE +033_01_01 Create Context Source Registration Without Mode And Operation + [Tags] csr-create 5_9_2 + csourceRegistrations/context-source-registration.jsonld +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_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 *** +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} ${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} ${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} - Check Created Resource Set To ${registration_payload} ${response1.json()} ${ignored_attributes} + IF ${has_mode} == ${False} + Append To List ${ignored_attributes} mode operations + END + + 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_02.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot deleted file mode 100644 index 236dc7e6fa468d120524a2a222444af7ef9e9235..0000000000000000000000000000000000000000 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_02.robot +++ /dev/null @@ -1,38 +0,0 @@ -*** Settings *** -Documentation Check that one can create a context source registration that never expires - -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.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 - ${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} - 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_02.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_02.robot index b68aee121b7218a3edacc68a84d0bd87037d5b23..bd0005ec182fa062f97ec3f5651bcc2ec2dcb7d7 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_01_03.robot b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot similarity index 87% rename from TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_03.robot rename to TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot index 55d7e7938949e53cc33d2a0f4277af045f4d2608..43f81eac06ff16ed3b5261de4054ec0337ec955a 100644 --- a/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_01_03.robot +++ b/TP/NGSI-LD/ContextSource/Registration/RegisterContextSource/033_11.robot @@ -15,7 +15,7 @@ ${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 ${payload}= Load JSON From File ${EXECDIR}/data/${registration_payload_file_path} @@ -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/data/csourceRegistrations/context-source-registration-csourceProperty.jsonld b/data/csourceRegistrations/context-source-registration-csourceProperty.jsonld index a76f1967cbf3761df68ad1fa0f1eeda5ed7663aa..63bbdf4259bbee776cbba0be5b54ad8db77dd151 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 a5603e7b82571b456458a8021ee882fe343a281b..0c2cb3e02cd2ba0321aa2f857c0c0020930608c0 100644 --- a/data/csourceRegistrations/context-source-registration-location.jsonld +++ b/data/csourceRegistrations/context-source-registration-location.jsonld @@ -18,4 +18,5 @@ "@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 484ed252cdf95a7ea63c23127513d7db8f89edf4..0361c4954f607b54bcfd4bf6dcd5e0a4dc76aaa1 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 6078f7b0da81cea9e55af6d22d1db1a0b8c82d67..f3c7395d9acff590d04a501d15d264449a5f4ff9 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 0dbf966b7a07721827dbf9b131d4b14ba7026dcd..30c64748eb064584efc850b2302c2536e75f653b 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 0000000000000000000000000000000000000000..27f2ab1691a9e4f4414cb6f542adcb5eb86eb6f5 --- /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://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 d24b35fd80a0409e072d6a9d02014d77bfe2b0f3..49ab16e120dd176cfb1ec0fc7c9056e7afda236a 100644 --- a/data/csourceRegistrations/context-source-registration.jsonld +++ b/data/csourceRegistrations/context-source-registration.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", "@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 c557935b32c73e5c7250b206b7aed5056684cedd..03e4a0d1ae5f15f9526c6b5b2c9aaf7f6583d1d0 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 a534ebc79efd2b876087d1a57917b21c67e5078d..fdc4541e1a0a46af6917217aeb8b0133d8126c7d 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 diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index b6754cdc76b5cbd2dfc210cd648d0d00d6c29f20..047f60d88e0814bed5ee83a32753d8d7da0333fb 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,14 @@ 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} + + ${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()}