From 84b2ef899b5645e909ca262992215d7b13844d2a Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sun, 27 Mar 2022 18:14:06 +0200 Subject: [PATCH 01/11] fix(subscriptions): rename timeinterval to timeInterval --- .../ContextInformation/Subscription/Notification/046_02.robot | 2 +- .../expectations/subscription-sample-expectation.json | 1 + data/subscriptions/subscription-sample.jsonld | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_02.robot index 99b1e92e..8b87d793 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_02.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_02.robot @@ -43,7 +43,7 @@ After Test *** Test Case *** -Check that a notification is sent on the timeinterval +Check that a notification is sent on the timeInterval [Documentation] If a Subscription defines a timeInterval member, a Notification shall be sent periodically, when the time interval (in seconds) specified in such value field is reached, regardless of Attribute changes." [Tags] sub-notification 5_11_7 046_02 diff --git a/data/csourceSubscriptions/expectations/subscription-sample-expectation.json b/data/csourceSubscriptions/expectations/subscription-sample-expectation.json index 42d6c58f..e672a7f7 100644 --- a/data/csourceSubscriptions/expectations/subscription-sample-expectation.json +++ b/data/csourceSubscriptions/expectations/subscription-sample-expectation.json @@ -6,6 +6,7 @@ "type": "https://ngsi-ld-test-suite/context#Building" } ], + "timeInterval": 5, "notification": { "endpoint": { "accept": "application/json", diff --git a/data/subscriptions/subscription-sample.jsonld b/data/subscriptions/subscription-sample.jsonld index 21ccd03c..6af4f401 100644 --- a/data/subscriptions/subscription-sample.jsonld +++ b/data/subscriptions/subscription-sample.jsonld @@ -1,7 +1,7 @@ { "id":"urn:ngsi-ld:Subscription:randomUUID", "type":"Subscription", - "timeinterval": 5, + "timeInterval": 5, "entities":[ { "type":"Building" -- GitLab From 1e146a8e19e84e83a0aeaac959f01b6a425a248c Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sun, 27 Mar 2022 18:16:31 +0200 Subject: [PATCH 02/11] fix: a list of one single element is rendered as a string due to how JSON-LD expansion works --- data/entities/building-location-attribute-sample.jsonld | 2 +- data/entities/building-location-attribute.jsonld | 2 +- data/entities/building-relationship-of-property-sample.jsonld | 2 +- data/entities/building-simple-attributes-sample.json | 2 +- data/entities/building-simple-attributes-sample.jsonld | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/data/entities/building-location-attribute-sample.jsonld b/data/entities/building-location-attribute-sample.jsonld index cba71b77..1cda399b 100644 --- a/data/entities/building-location-attribute-sample.jsonld +++ b/data/entities/building-location-attribute-sample.jsonld @@ -7,7 +7,7 @@ }, "subCategory": { "type": "Property", - "value": ["tourism"] + "value": "tourism" }, "location": { "type": "GeoProperty", diff --git a/data/entities/building-location-attribute.jsonld b/data/entities/building-location-attribute.jsonld index 0bb447e8..e03c467a 100644 --- a/data/entities/building-location-attribute.jsonld +++ b/data/entities/building-location-attribute.jsonld @@ -7,7 +7,7 @@ }, "subCategory": { "type": "Property", - "value": ["tourism"] + "value": "tourism" }, "location": { "type": "GeoProperty", diff --git a/data/entities/building-relationship-of-property-sample.jsonld b/data/entities/building-relationship-of-property-sample.jsonld index 2b21215c..5518b700 100644 --- a/data/entities/building-relationship-of-property-sample.jsonld +++ b/data/entities/building-relationship-of-property-sample.jsonld @@ -7,7 +7,7 @@ }, "subCategory": { "type": "Property", - "value": ["tourism"] + "value": "tourism" }, "airQualityLevel": { "type": "Property", diff --git a/data/entities/building-simple-attributes-sample.json b/data/entities/building-simple-attributes-sample.json index c0beff52..7b86aadd 100644 --- a/data/entities/building-simple-attributes-sample.json +++ b/data/entities/building-simple-attributes-sample.json @@ -7,7 +7,7 @@ }, "subCategory": { "type": "Property", - "value": ["tourism"] + "value": "tourism" }, "airQualityLevel": { "type": "Property", diff --git a/data/entities/building-simple-attributes-sample.jsonld b/data/entities/building-simple-attributes-sample.jsonld index dcf11f9f..49993315 100644 --- a/data/entities/building-simple-attributes-sample.jsonld +++ b/data/entities/building-simple-attributes-sample.jsonld @@ -7,7 +7,7 @@ }, "subCategory": { "type": "Property", - "value": ["tourism"] + "value": "tourism" }, "airQualityLevel": { "type": "Property", -- GitLab From 18e358f884e9e5ee94fba9ae1ac3dd48394b586c Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sun, 27 Mar 2022 18:17:28 +0200 Subject: [PATCH 03/11] fix: typo in comparison_result variable name --- resources/AssertionUtils.resource | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/AssertionUtils.resource b/resources/AssertionUtils.resource index 1a8e33f1..d207b58e 100755 --- a/resources/AssertionUtils.resource +++ b/resources/AssertionUtils.resource @@ -111,7 +111,7 @@ Check Response Body Containing List Containing Entity Elements With Different Ty ${entities_representation_payload}= Update Value To Json ${entities_representation_payload} $.[${index}]..id ${entity_representation_id} ${index}= Evaluate ${index} + 1 END - ${comparaison_result}= Compare Dictionaries Ignoring Keys ${entities_representation_payload} ${response_body} ${instance_id_regex_expr} group_by=id + ${comparison_result}= Compare Dictionaries Ignoring Keys ${entities_representation_payload} ${response_body} ${instance_id_regex_expr} group_by=id Should Be True ${comparison_result=={}} msg=${comparison_result.pretty()} Check Response Body Containing EntityTemporal element @@ -219,7 +219,7 @@ Check Response Body Containing List Containing Context Source Registrations elem ${expected_context_source_registrations_payload}= Update Value To Json ${expected_context_source_registrations_payload} $.[${index}]..id ${expected_context_source_registration_id} ${index}= Evaluate ${index} + 1 END - ${comparaison_result}= Compare Dictionaries Ignoring Keys ${expected_context_source_registrations_payload} ${response['body']} ${EMPTY} group_by=id + ${comparison_result}= Compare Dictionaries Ignoring Keys ${expected_context_source_registrations_payload} ${response['body']} ${EMPTY} group_by=id Should Be True ${comparison_result=={}} msg=${comparison_result.pretty()} Check Response Body Type When Using Session Request -- GitLab From 002e4695a4e820e5fb591b63836c18f78003070b Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sun, 27 Mar 2022 18:22:23 +0200 Subject: [PATCH 04/11] fix(026_01): conform expectations to clause 5.7.8 (details of available attributes) --- .../attribute-026-01-01-expectation.json | 16 ---------------- .../attribute-026-01-02-expectation.json | 16 ---------------- 2 files changed, 32 deletions(-) diff --git a/data/types/expectations/attribute-026-01-01-expectation.json b/data/types/expectations/attribute-026-01-01-expectation.json index 19b88b32..d5fe0f28 100644 --- a/data/types/expectations/attribute-026-01-01-expectation.json +++ b/data/types/expectations/attribute-026-01-01-expectation.json @@ -3,10 +3,6 @@ "id":"https://ngsi-ld-test-suite/context#name", "type":"Attribute", "attributeName":"name", - "attributeCount":1, - "attributeTypes":[ - "Property" - ], "typeNames":[ "https://ngsi-ld-test-suite/context#Building" ] @@ -15,10 +11,6 @@ "id":"https://ngsi-ld-test-suite/context#subCategory", "type":"Attribute", "attributeName":"https://ngsi-ld-test-suite/context#subCategory", - "attributeCount":1, - "attributeTypes":[ - "Property" - ], "typeNames":[ "https://ngsi-ld-test-suite/context#Building" ] @@ -27,10 +19,6 @@ "id":"https://ngsi-ld-test-suite/context#airQualityLevel", "type":"Attribute", "attributeName":"https://ngsi-ld-test-suite/context#airQualityLevel", - "attributeCount":1, - "attributeTypes":[ - "Property" - ], "typeNames":[ "https://ngsi-ld-test-suite/context#Building" ] @@ -39,10 +27,6 @@ "id":"https://ngsi-ld-test-suite/context#almostFull", "type":"Attribute", "attributeName":"https://ngsi-ld-test-suite/context#almostFull", - "attributeCount":1, - "attributeTypes":[ - "Property" - ], "typeNames":[ "https://ngsi-ld-test-suite/context#Building" ] diff --git a/data/types/expectations/attribute-026-01-02-expectation.json b/data/types/expectations/attribute-026-01-02-expectation.json index 076b9e4f..6997eaf6 100644 --- a/data/types/expectations/attribute-026-01-02-expectation.json +++ b/data/types/expectations/attribute-026-01-02-expectation.json @@ -3,10 +3,6 @@ "id":"https://ngsi-ld-test-suite/context#name", "type":"Attribute", "attributeName":"name", - "attributeCount":1, - "attributeTypes":[ - "Property" - ], "typeNames":[ "Building" ] @@ -15,10 +11,6 @@ "id":"https://ngsi-ld-test-suite/context#subCategory", "type":"Attribute", "attributeName":"subCategory", - "attributeCount":1, - "attributeTypes":[ - "Property" - ], "typeNames":[ "Building" ] @@ -27,10 +19,6 @@ "id":"https://ngsi-ld-test-suite/context#airQualityLevel", "type":"Attribute", "attributeName":"airQualityLevel", - "attributeCount":1, - "attributeTypes":[ - "Property" - ], "typeNames":[ "Building" ] @@ -39,10 +27,6 @@ "id":"https://ngsi-ld-test-suite/context#almostFull", "type":"Attribute", "attributeName":"almostFull", - "attributeCount":1, - "attributeTypes":[ - "Property" - ], "typeNames":[ "Building" ] -- GitLab From 0fd41cf4a63db2a815acdc646decf70f0c3c6e0e Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sun, 27 Mar 2022 18:27:24 +0200 Subject: [PATCH 05/11] fix(023_01_01): name is no longer part of core context (so can't be compacted) --- data/types/expectations/entity-type-023-01-01-expectation.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/types/expectations/entity-type-023-01-01-expectation.json b/data/types/expectations/entity-type-023-01-01-expectation.json index e938df4f..a1923831 100644 --- a/data/types/expectations/entity-type-023-01-01-expectation.json +++ b/data/types/expectations/entity-type-023-01-01-expectation.json @@ -4,7 +4,7 @@ "type":"EntityType", "typeName":"https://ngsi-ld-test-suite/context#Building", "attributeNames":[ - "name", + "https://ngsi-ld-test-suite/context#name", "https://ngsi-ld-test-suite/context#subCategory", "https://ngsi-ld-test-suite/context#airQualityLevel", "https://ngsi-ld-test-suite/context#almostFull" -- GitLab From 6e0ccf5d994165d1cb2f02a0a5775a9749ddae18 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sun, 27 Mar 2022 18:30:50 +0200 Subject: [PATCH 06/11] fix(019_01_05): set Accept header to JSON-LD as expected payload is JSON-LD --- .../Consumption/Entity/QueryEntities/019_01_05.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_05.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_05.robot index 364607e5..9a8d7ab3 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_05.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_01_05.robot @@ -24,7 +24,7 @@ Query several entities based on a list of properties @{entities_ids_to_be_compared}= Create List ${first_entity_id} ${second_entity_id} ${entities_ids_to_be_retrieved}= Catenate SEPARATOR=, ${first_entity_id} ${second_entity_id} ${entity_types_to_be_retrieved}= Catenate SEPARATOR=, ${entity_type} - ${response}= Query Entities entity_types=${entity_types_to_be_retrieved} geoproperty=${geometry_property} + ${response}= Query Entities entity_types=${entity_types_to_be_retrieved} geoproperty=${geometry_property} accept=${CONTENT_TYPE_LD_JSON} Check Response Status Code 200 ${response['status']} Check Response Body Containing List Containing Entity elements ${expectation_filename} ${entities_ids_to_be_compared} ${response['body']} [Teardown] Delete Entities ${first_entity_id} ${second_entity_id} -- GitLab From b40892c1d47578c57f0cf6c83d0a9dc29ed23609 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sun, 3 Apr 2022 18:30:53 +0200 Subject: [PATCH 07/11] fix(subscriptions): incorrect method calls or implementations and unused code --- .../CreateSubscription/031_02.robot | 2 +- .../Subscription/Notification/046_07.robot | 11 +++---- .../Subscription/Notification/046_08.robot | 2 +- .../Subscription/Notification/046_10.robot | 4 +-- .../Subscription/Notification/046_13.robot | 24 +++++---------- .../Subscription/Notification/046_14.robot | 24 +++++---------- resources/ApiUtils.resource | 3 +- resources/MockServerUtils.resource | 2 +- resources/MockSubscriberServer.resource | 30 ------------------- resources/NotificationUtils.resource | 25 ---------------- 10 files changed, 27 insertions(+), 100 deletions(-) delete mode 100644 resources/MockSubscriberServer.resource diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/031_02.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/031_02.robot index 46624211..2b13a473 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/031_02.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/031_02.robot @@ -17,6 +17,6 @@ Create Subscription With Invalid Request [Documentation] Check that you cannot create a subscription with an invalid request [Tags] sub-create 5_8_1 Create Subscription From File ${filename} - Check RL Response Status Code Set To Expected Code 400 + Check RL Response Status Code Set To 400 Check RL Response Body Containing ProblemDetails Element Containing Type Element set to ${response} ${ERROR_TYPE_BAD_REQUEST_DATA} Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_07.robot b/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_07.robot index f178fd22..65dad24b 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_07.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_07.robot @@ -1,14 +1,11 @@ *** Settings *** Documentation Check that a notification is only sent if and only if the status is active - - - Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/NotificationUtils.resource -Suite Setup Before Test +Suite Setup Before Test Suite Teardown After Test *** Variable *** @@ -56,7 +53,7 @@ Check notification structure Setup Initial Subscriptions Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} - ${notification} Wait for notification ${subscription_id} + ${notification} Wait for notification Should Be Equal ${notification}[type] Notification Should Be Equal ${notification}[subscriptionId] ${subscription_id} ${is_date}= Is Date ${notification}[notifiedAt] ${date_format} @@ -73,7 +70,7 @@ Check correct attributes are included Setup Initial Subscriptions ${subscription_payload_file_path_watchedAttributes} Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} - ${notification} Wait for notification ${subscription_id} + ${notification} Wait for notification Should Be Equal ${notification}[type] Notification Should Be Equal ${notification}[subscriptionId] ${subscription_id} ${is_date}= Is Date ${notification}[notifiedAt] ${date_format} @@ -91,7 +88,7 @@ Check URI expansion is observed Setup Initial Subscriptions Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} - ${notification} Wait for notification ${subscription_id} + ${notification} Wait for notification Should Be Equal ${notification}[type] Notification Should Be Equal ${notification}[subscriptionId] ${subscription_id} ${is_date}= Is Date ${notification}[notifiedAt] ${date_format} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_08.robot b/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_08.robot index a7dab753..e91b9ac8 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_08.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_08.robot @@ -83,7 +83,7 @@ Check that a notification is sent with all attributes in simplified format ${notification}= Wait for notification ${5} Output ${notification} - ${notification} Wait for notification ${subscription_id} + ${notification} Wait for notification ${list_count}= Count Values In List ${notification} Should Not Be Equal ${list_count} 0 Should Be Equal ${notification}[0][id] ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_10.robot b/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_10.robot index 46d790d1..907e3c0d 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_10.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_10.robot @@ -47,7 +47,7 @@ Delete Initial Entity *** Test Cases *** Check that a notification is JSON - [Documentation] The Notification content shall be JSON by defaul + [Documentation] The Notification content shall be JSON by default [Tags] sub-notification 5_11_7 046_10 Add Initial Entity @@ -55,7 +55,7 @@ Check that a notification is JSON Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} - Wait For Request ${timeout} + Wait For Request 10 Reply By 200 ${notification_payload}= Get Request Body diff --git a/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_13.robot b/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_13.robot index fec85f5c..75c3d71b 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_13.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_13.robot @@ -5,31 +5,24 @@ Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/NotificationUtils.resource +Resource ${EXECDIR}/resources/MockServerUtils.resource - -Suite Setup Setup Initial Subscriptions -Suite Teardown Delete Initial Subscriptions +Suite Setup Setup Initial Subscription +Suite Teardown Delete Initial Subscription *** Variable *** ${subscription_id_prefix}= urn:ngsi-ld:Subscription: ${subscription_payload_file_path}= subscriptions/subscription-building-entities-active.jsonld ${building_id_prefix}= urn:ngsi-ld:Building: +${fragment_filename}= airQualityLevel-fragment.jsonld - - - -*** Keywords *** +*** Test Case *** Check that a notification is only sent if statis is active - [Arguments] ${fragment_filename} [Documentation] The notification.lastNotification member shall be updated with a timestamp representing the current date and time. This test will check the format. - [Tags] sub-notification 5_11_7 - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Subscription Sample With Reachable Endpoint ${subscription_payload_file_path} ${subscription_id} + [Tags] sub-notification 5_11_7 046_13 ${entity_id}= Generate Random Entity Id ${building_id_prefix} @{expected_notification_data_entities}= Create List Building - Set Suite Variable ${subscription_id} - Create Subscription ${subscription_id} ${subscription_payload} Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} Wait for redirected request @@ -42,11 +35,10 @@ Check that a notification is only sent if statis is active Setup Initial Subscription Start Local Server ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} - Create Subscription ${subscription_id} ${subscription_payload} + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} Set Suite Variable ${subscription_id} -Delete Subscription +Delete Initial Subscription Stop Local Server Delete Subscription ${subscription_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_14.robot b/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_14.robot index 44e3ff20..81b2b8a7 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_14.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/Notification/046_14.robot @@ -4,46 +4,38 @@ Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Resource ${EXECDIR}/resources/NotificationUtils.resource -Suite Setup Setup Initial Subscriptions -Suite Teardown Delete Initial Subscriptions +Resource ${EXECDIR}/resources/MockServerUtils.resource +Suite Setup Setup Initial Subscription +Suite Teardown Delete Initial Subscription *** Variable *** ${subscription_id_prefix}= urn:ngsi-ld:Subscription: ${subscription_payload_file_path}= subscriptions/subscription-building-entities-active.jsonld ${building_id_prefix}= urn:ngsi-ld:Building: +${fragment_filename}= airQualityLevel-fragment.jsonld - - - -*** Keywords *** +*** Test Case *** Check that a notification is only sent if statis is active - [Arguments] ${fragment_filename} [Documentation] If the response to the notification request is different than 200 OK then implementations shall: Update notification.lastFailure with a timestamp representing the current date and time., Update notification.status to "failed - [Tags] sub-notification 5_11_7 - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Subscription Sample With Reachable Endpoint ${subscription_payload_file_path} ${subscription_id} + [Tags] sub-notification 5_11_7 046_14 ${entity_id}= Generate Random Entity Id ${building_id_prefix} @{expected_notification_data_entities}= Create List Building - Set Suite Variable ${subscription_id} - Create Subscription ${subscription_id} ${subscription_payload} Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} Wait for redirected failed request @{expected_notification_additional_members}= Create List lastNotification lastFailure Check NotificationParams ${notification_expectation_file_path} ${expected_notification_additional_members} - *** Keywords *** Setup Initial Subscription Start Local Server ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${subscription_payload}= Load Test Sample ${subscription_payload_file_path} ${subscription_id} - Create Subscription ${subscription_id} ${subscription_payload} + Create Subscription ${subscription_id} ${subscription_payload_file_path} ${CONTENT_TYPE_LD_JSON} Set Suite Variable ${subscription_id} -Delete Subscription +Delete Initial Subscription Stop Local Server Delete Subscription ${subscription_id} diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 8b417f57..84d99c23 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -705,7 +705,8 @@ Create Subscription From File [Arguments] ${filename} ${file_content}= Get File ${EXECDIR}/data/subscriptions/${filename} Create Session SubscriptionCreateRequest ${url} - ${response}= PATCH On Session SubscriptionCreateRequest ${SUBSCRIPTION_ENDPOINT_PATH} data=${file_content} expected_status=any + &{headers}= Create Dictionary Content-Type=application/ld+json + ${response}= POST On Session SubscriptionCreateRequest ${SUBSCRIPTION_ENDPOINT_PATH} data=${file_content} headers=${headers} expected_status=any Set Test Variable ${response} Update Subscription diff --git a/resources/MockServerUtils.resource b/resources/MockServerUtils.resource index e0d162f9..fa46cdd3 100644 --- a/resources/MockServerUtils.resource +++ b/resources/MockServerUtils.resource @@ -5,7 +5,7 @@ Library HttpCtrl.Server *** Keywords *** Start Context Source Mock Server #Initialize HTTP Client And Server - Start Server 0.0.0.0 8086 + Start Server ${context_source_host} ${context_source_port} Wait for redirected request [Arguments] ${timeout}=${5} diff --git a/resources/MockSubscriberServer.resource b/resources/MockSubscriberServer.resource deleted file mode 100644 index e4e3b856..00000000 --- a/resources/MockSubscriberServer.resource +++ /dev/null @@ -1,30 +0,0 @@ -*** Settings *** -Documentation Check Notification Behaviour -Library BuiltIn -Library Collections -Library HttpCtrl.Server -Library ${EXECDIR}/libraries/assertionUtils.py -Library ${EXECDIR}/libraries/dateTimeUtils.py - -*** Variable *** -${notification_type}= subscriber Notfication -${date_format}= %Y-%m-%dT%H:%M:%SZ - - -*** Keywords *** -Start Local Server - #Initialize HTTP Client And Server - Start Server 0.0.0.0 8085 - -Wait for redirected request - [Arguments] ${timeout}=${5} - #HTTP server receives it and checks incoming request for correctness - #.. "Wait For Request" - #.... This call is blocked until HTTP request arrives or timeout. - #.... Further detaills: https://annoviko.github.io/robotframework-httpctrl/server.html#Wait%20For%20Request - Wait For Request ${timeout} - Reply By 200 - -Stop Local Server - #Terminate HTTP Server - Stop Server diff --git a/resources/NotificationUtils.resource b/resources/NotificationUtils.resource index 20146267..8d0c0d92 100644 --- a/resources/NotificationUtils.resource +++ b/resources/NotificationUtils.resource @@ -64,7 +64,6 @@ Wait for notification and validate it Wait for subscription notification and validate it [Arguments] ${expected_subscription_id} ${expected_notification_data_entities}=${EMPTY} ${timeout}=${5} ${expected_notification_type}=${notification_type} - Wait for subscription notification ${expected_subscription_id} ${expected_notification_data_entities} ${timeout} ${expected_notification_type} #HTTP server receives it and checks incoming request for correctness #.. "Wait For Request" #.... This call is blocked until HTTP request arrives or timeout. @@ -89,8 +88,6 @@ Wait for subscription notification and validate it Run Keyword If ${expected_notification_data_entities_length}>0 Check Notification Data Entities ${notification}[data][0][information] ${expected_notification_data_entities} [return] ${notification} - - Wait for no notification [Arguments] ${timeout}=${5} #HTTP server receives it and checks incoming request for correctness @@ -110,28 +107,6 @@ Check Notification Data Entities Lists Should Be Equal ${expected_notification_data_entities} ${notification_data_entities} ignore_order=True - -Check Notification Date - [Arguments] ${expected_subscription_id} ${expected_notification_data_entities}=${EMPTY} ${timeout}=${5} - #HTTP server receives it and checks incoming request for correctness - #.. "Wait For Request" - #.... This call is blocked until HTTP request arrives or timeout. - #.... Further detaills: https://annoviko.github.io/robotframework-httpctrl/server.html#Wait%20For%20Request - Wait For Request ${timeout} - Reply By 200 - - ${notification_payload}= Get Request Body - ${notification} Evaluate json.loads('''${notification_payload}''') json - ${notification_data_length}= Get length ${notification}[data] - ${expected_notification_data_entities_length}= Get length ${expected_notification_data_entities} - - - log ${notification} - ${is_date}= Is Date ${notification}[notifiedAt] ${date_format} - Should Be True ${is_date} - - - Stop Local Server #Terminate HTTP Server Stop Server -- GitLab From e0b1da9478cba7960ab6fa5096d124b8b50d1db5 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Wed, 13 Jul 2022 11:18:06 +0200 Subject: [PATCH 08/11] fix: use a really invalid idPattern in 019_03_03 --- .../Consumption/Entity/QueryEntities/019_03_03.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_03.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_03.robot index 70b83b93..9c86bba1 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_03.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_03_03.robot @@ -8,7 +8,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource ${building_id_prefix}= urn:ngsi-ld:Building: ${filename}= building-minimal-sample.jsonld ${entity_type}= https://ngsi-ld-test-suite/context#Building -${invalid_entity_id_pattern}= invalid_entity_id_pattern* +${invalid_entity_id_pattern}= invalid_entity_id_pattern** *** Test Cases *** Query several entities based on incorrect id pattern -- GitLab From d01c7bafe8bf88bb55191ba4611f243984530a32 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Wed, 13 Jul 2022 11:18:47 +0200 Subject: [PATCH 09/11] fix: default compaction of almostFull attribute in 003_05 --- .../Provision/BatchEntities/CreateBatchOfEntities/003_05.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot index 5bc75782..292e09ad 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_05.robot @@ -21,6 +21,6 @@ Create a batch of one entity using the default context with JSON content type Check Response Body Containing an Attribute set to almostFull Retrieve Entity by Id ${entity_id} context=${ngsild_test_suite_context} # Attribute should not be compacted as we did not provide a context containing this term - Check Response Body Containing an Attribute set to https://uri.etsi.org/ngsi-ld/default-context/almostFull + Check Response Body Containing an Attribute set to ngsi-ld:default-context/almostFull @{entities_ids_to_be_deleted}= Create List ${entity_id} Batch Delete Entities @{entities_ids_to_be_deleted} -- GitLab From 9d2639e07002bce2173738a15162a6700107040f Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Wed, 13 Jul 2022 11:19:42 +0200 Subject: [PATCH 10/11] fix: setup / teardown instructions in 005_01 --- .../BatchEntities/UpdateBatchOfEntities/005_01.robot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot index a1f79182..8a745d8c 100644 --- a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot @@ -3,9 +3,9 @@ Documentation Check that you can update a batch of entities Resource ${EXECDIR}/resources/ApiUtils.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource -Suite Setup Setup Initial Entities +Test Setup Setup Initial Entities Test Template Batch Update Entity Scenarios -Suite Teardown Delete Initial Entities +Test Teardown Delete Initial Entities *** Variable *** ${building_id_prefix}= urn:ngsi-ld:Building: -- GitLab From 282f8a801a564c015ba911f2856330bd6a242297 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Wed, 13 Jul 2022 11:20:34 +0200 Subject: [PATCH 11/11] feat: add Content-Type support in Retrieve Subscription keyword --- resources/ApiUtils.resource | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/ApiUtils.resource b/resources/ApiUtils.resource index 84d99c23..d47c4d95 100755 --- a/resources/ApiUtils.resource +++ b/resources/ApiUtils.resource @@ -746,9 +746,9 @@ Query Subscriptions Set Test Variable ${response} Retrieve Subscription - [Arguments] ${id} ${accept}=${EMPTY} ${context}=${EMPTY} - &{headers}= Create Dictionary + [Arguments] ${id} ${accept}=${EMPTY} ${context}=${EMPTY} ${content_type}=${CONTENT_TYPE_LD_JSON} + &{headers}= Create Dictionary Content-Type=${content_type} Run Keyword If '${accept}'!='' Set To Dictionary ${headers} Accept ${accept} Run Keyword If '${context}'!='' Set To Dictionary ${headers} Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" -- GitLab