From 5e075314527c282460078f89cfd559a2ee824433 Mon Sep 17 00:00:00 2001 From: ranim-n Date: Mon, 19 Feb 2024 12:06:38 +0100 Subject: [PATCH 01/20] tc for throttling in subscription : can't create a sub with throttling and timeInterval --- .../CreateSubscription/028_05.robot | 29 +++++++++++++++++++ ...tion-throttling-timeInterval-sample.jsonld | 21 ++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot create mode 100644 data/subscriptions/subscription-throttling-timeInterval-sample.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot new file mode 100644 index 00000000..9f22216b --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot @@ -0,0 +1,29 @@ +*** Settings *** +Documentation Check that you cannot create a subscription with timeInterval and throttling + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Create Subscription With TimeInterval And Throttling + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-throttling-timeInterval-sample.jsonld + + +*** Test Cases *** FILENAME EXPECTED_STATUS +028_05_01 InvalidJson + subscription-throttling-timeInterval-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Create Subscription With TimeInterval And Throttling + [Documentation] Check that you cannot create a subscription with timeInterval and throttling + [Tags] sub-create 5_8_1 + [Arguments] ${subscription_payload_file_path} ${expected_status} + ${response}= Create Subscription From File ${subscription_payload_file_path} + Check Response Status Code 400 ${response.status_code} + Check RL Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${expected_status} + Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/data/subscriptions/subscription-throttling-timeInterval-sample.jsonld b/data/subscriptions/subscription-throttling-timeInterval-sample.jsonld new file mode 100644 index 00000000..58e13c25 --- /dev/null +++ b/data/subscriptions/subscription-throttling-timeInterval-sample.jsonld @@ -0,0 +1,21 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "timeInterval": 10, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "throttling" : 30, + "@context":[ + "https://easy-global-market.github.io/ngsild-api-data-models/ngsi-ld-test-suite/ngsi-ld-test-suite-compound-v1.7.jsonld" + ] +} \ No newline at end of file -- GitLab From dd832b2485009184f745b8e88a2719e3e7dcb227 Mon Sep 17 00:00:00 2001 From: ranim-n Date: Mon, 19 Feb 2024 17:39:40 +0100 Subject: [PATCH 02/20] two tcs : throttling conjuction with timeInterval and negative throttling --- .../CreateSubscription/028_05.robot | 22 +++++++++---------- ...cription-negative-throttling-sample.jsonld | 20 +++++++++++++++++ ...ttling-timeInterval-invalid-sample.jsonld} | 0 3 files changed, 30 insertions(+), 12 deletions(-) create mode 100644 data/subscriptions/subscription-negative-throttling-sample.jsonld rename data/subscriptions/{subscription-throttling-timeInterval-sample.jsonld => subscription-throttling-timeInterval-invalid-sample.jsonld} (100%) diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot index 9f22216b..d7f5871a 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot @@ -1,27 +1,25 @@ *** Settings *** -Documentation Check that you cannot create a subscription with timeInterval and throttling +Documentation Check that you cannot create a subscription with negative/in conjunction with timeInterval throttling Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource Resource ${EXECDIR}/resources/AssertionUtils.resource -Test Template Create Subscription With TimeInterval And Throttling - - -*** Variables *** -${subscription_payload_file_path}= subscriptions/subscription-throttling-timeInterval-sample.jsonld +Test Template Create Subscription With Different Requests *** Test Cases *** FILENAME EXPECTED_STATUS -028_05_01 InvalidJson - subscription-throttling-timeInterval-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} +028_05_01 ThrottlingAndTimeIntervalConjunction + subscription-throttling-timeInterval-invalid-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} +028_05_02 NegativeThrottling + subscription-negative-throttling-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} *** Keywords *** -Create Subscription With TimeInterval And Throttling - [Documentation] Check that you cannot create a subscription with timeInterval and throttling +Create Subscription With Different Requests + [Documentation] Check that you cannot create a subscription with negative/in conjunction with timeInterval throttling [Tags] sub-create 5_8_1 - [Arguments] ${subscription_payload_file_path} ${expected_status} - ${response}= Create Subscription From File ${subscription_payload_file_path} + [Arguments] ${filename} ${expected_status} + ${response}= Create Subscription From File ${filename} Check Response Status Code 400 ${response.status_code} Check RL Response Body Containing ProblemDetails Element Containing Type Element set to ... ${response.json()} diff --git a/data/subscriptions/subscription-negative-throttling-sample.jsonld b/data/subscriptions/subscription-negative-throttling-sample.jsonld new file mode 100644 index 00000000..cf7b01c7 --- /dev/null +++ b/data/subscriptions/subscription-negative-throttling-sample.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "throttling" : -30, + "@context":[ + "https://easy-global-market.github.io/ngsild-api-data-models/ngsi-ld-test-suite/ngsi-ld-test-suite-compound-v1.7.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-throttling-timeInterval-sample.jsonld b/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld similarity index 100% rename from data/subscriptions/subscription-throttling-timeInterval-sample.jsonld rename to data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld -- GitLab From 593df5f90f5e981498f551ee556cdca72ac43eff Mon Sep 17 00:00:00 2001 From: ranim-n Date: Thu, 22 Feb 2024 10:35:16 +0100 Subject: [PATCH 03/20] check notification's behaviour when a subscription defines a throttling member --- .../CreateSubscription/028_05.robot | 14 ++-- .../046_15.robot | 72 +++++++++++++++++++ .../046_16.robot | 67 +++++++++++++++++ ...-invalid-negative-throttling-sample.jsonld | 17 +++++ ...ottling-timeInterval-invalid-sample.jsonld | 5 +- ...ption-with-valid-throttling-sample.jsonld} | 4 +- 6 files changed, 164 insertions(+), 15 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot create mode 100644 data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld rename data/subscriptions/{subscription-negative-throttling-sample.jsonld => subscription-with-valid-throttling-sample.jsonld} (91%) diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot index d7f5871a..c3bd7df5 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot @@ -1,27 +1,23 @@ *** Settings *** -Documentation Check that you cannot create a subscription with negative/in conjunction with timeInterval throttling +Documentation Check that you cannot create a subscription with invalid throttling (a negative throttling or in conjunction with timeInterval throttling) Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource Resource ${EXECDIR}/resources/AssertionUtils.resource -Test Template Create Subscription With Different Requests +Test Template Create Subscription With Invalid Throttling *** Test Cases *** FILENAME EXPECTED_STATUS 028_05_01 ThrottlingAndTimeIntervalConjunction subscription-throttling-timeInterval-invalid-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} 028_05_02 NegativeThrottling - subscription-negative-throttling-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} + subscription-invalid-negative-throttling-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} *** Keywords *** -Create Subscription With Different Requests - [Documentation] Check that you cannot create a subscription with negative/in conjunction with timeInterval throttling +Create Subscription With Invalid Throttling + [Documentation] Check that you cannot create a subscription with invalid throttling (a negative throttling or in conjunction with timeInterval throttling) [Tags] sub-create 5_8_1 [Arguments] ${filename} ${expected_status} ${response}= Create Subscription From File ${filename} Check Response Status Code 400 ${response.status_code} - Check RL Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()} - ... ${expected_status} - Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot new file mode 100644 index 00000000..bd8895cc --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot @@ -0,0 +1,72 @@ +*** Settings *** +Documentation If a Subscription defines a throttling member, a Notification shall be sent after the throttling specified (in seconds) has elapsed. + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-with-valid-throttling-sample.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify +${entity_building_filepath}= building-simple-attributes-sample.jsonld +${fragment_filename}= airQualityLevel-fragment.jsonld + + +*** Test Cases *** +046_15_01 Check that a notification is sent after the throttling has elapsed + [Documentation] If a Subscription defines a throttling member, a Notification shall be sent after the throttling specified (in seconds) has elapsed. + [Tags] sub-notification 5_8_6 046_15 + Setup Initial Subscriptions + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification timeout=${15} + Sleep 2 + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Dictionary Should Contain Key ${notification} data + Should Not Be Empty ${notification}[data] Notification data should not be empty + Should be Equal ${entity_id} ${notification}[data][0][id] + + +*** Keywords *** +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Set Suite Variable ${entity_id} + Set Suite Variable ${subscription_id} + + Create Entity ${entity_building_filepath} ${entity_id} + Sleep 1s + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Sleep 1s + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot new file mode 100644 index 00000000..91546025 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot @@ -0,0 +1,67 @@ +*** Settings *** +Documentation If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-with-valid-throttling-sample.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify +${entity_building_filepath}= building-simple-attributes-sample.jsonld +${fragment_filename}= airQualityLevel-fragment.jsonld + + +*** Test Cases *** +046_16_01 Check that a notification is not sent if the throttling has not elapsed yet + [Documentation] If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. + [Tags] sub-notification 5_8_6 046_16 + Setup Initial Subscriptions + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification timeout=${10} + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + Wait for no notification + + +*** Keywords *** +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Set Suite Variable ${entity_id} + Set Suite Variable ${subscription_id} + + Create Entity ${entity_building_filepath} ${entity_id} + Sleep 1s + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Sleep 1s + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld b/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld new file mode 100644 index 00000000..19201f3a --- /dev/null +++ b/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld @@ -0,0 +1,17 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "throttling" : -30 +} \ No newline at end of file diff --git a/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld b/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld index 58e13c25..f3e34866 100644 --- a/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld +++ b/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld @@ -14,8 +14,5 @@ "accept":"application/json" } }, - "throttling" : 30, - "@context":[ - "https://easy-global-market.github.io/ngsild-api-data-models/ngsi-ld-test-suite/ngsi-ld-test-suite-compound-v1.7.jsonld" - ] + "throttling" : 30 } \ No newline at end of file diff --git a/data/subscriptions/subscription-negative-throttling-sample.jsonld b/data/subscriptions/subscription-with-valid-throttling-sample.jsonld similarity index 91% rename from data/subscriptions/subscription-negative-throttling-sample.jsonld rename to data/subscriptions/subscription-with-valid-throttling-sample.jsonld index cf7b01c7..cb68473a 100644 --- a/data/subscriptions/subscription-negative-throttling-sample.jsonld +++ b/data/subscriptions/subscription-with-valid-throttling-sample.jsonld @@ -13,8 +13,8 @@ "accept":"application/json" } }, - "throttling" : -30, - "@context":[ + "throttling" : 1, + "@context":[ "https://easy-global-market.github.io/ngsild-api-data-models/ngsi-ld-test-suite/ngsi-ld-test-suite-compound-v1.7.jsonld" ] } \ No newline at end of file -- GitLab From f7532fb0ff23c94e4c03675fcc77f1fd6513654a Mon Sep 17 00:00:00 2001 From: ranim-n Date: Thu, 22 Feb 2024 14:27:42 +0100 Subject: [PATCH 04/20] check that no notification is sent if the throttling member defined in the subscription has not elapsed yet --- .../046_15.robot | 19 ++---- .../046_16.robot | 67 ------------------- ...-invalid-negative-throttling-sample.jsonld | 17 ----- ...ottling-timeInterval-invalid-sample.jsonld | 18 ----- 4 files changed, 7 insertions(+), 114 deletions(-) delete mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot delete mode 100644 data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld delete mode 100644 data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot index bd8895cc..cb893dbc 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation If a Subscription defines a throttling member, a Notification shall be sent after the throttling specified (in seconds) has elapsed. +Documentation If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource @@ -21,23 +21,18 @@ ${fragment_filename}= airQualityLevel-fragment.jsonld *** Test Cases *** -046_15_01 Check that a notification is sent after the throttling has elapsed - [Documentation] If a Subscription defines a throttling member, a Notification shall be sent after the throttling specified (in seconds) has elapsed. - [Tags] sub-notification 5_8_6 046_15 +046_15_01 Check that a notification is not sent if the throttling has not elapsed yet + [Documentation] If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. + [Tags] sub-notification 5_8_6 046_16 Setup Initial Subscriptions ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} - ${notification} ${headers}= Wait for notification timeout=${15} - Sleep 2 - ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} - ${notification} ${headers}= Wait for notification timeout=${10} - Should be Equal ${subscription_id} ${notification}[subscriptionId] - Dictionary Should Contain Key ${notification} data - Should Not Be Empty ${notification}[data] Notification data should not be empty - Should be Equal ${entity_id} ${notification}[data][0][id] + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + Wait for no notification *** Keywords *** diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot deleted file mode 100644 index 91546025..00000000 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot +++ /dev/null @@ -1,67 +0,0 @@ -*** Settings *** -Documentation If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. - -Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource -Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource -Resource ${EXECDIR}/resources/NotificationUtils.resource - -Suite Setup Before Test -Suite Teardown After Test - - -*** Variables *** -${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${subscription_payload_file_path}= subscriptions/subscription-with-valid-throttling-sample.jsonld -${building_id_prefix}= urn:ngsi-ld:Building: -${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify -${entity_building_filepath}= building-simple-attributes-sample.jsonld -${fragment_filename}= airQualityLevel-fragment.jsonld - - -*** Test Cases *** -046_16_01 Check that a notification is not sent if the throttling has not elapsed yet - [Documentation] If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. - [Tags] sub-notification 5_8_6 046_16 - Setup Initial Subscriptions - - ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} - - ${notification} ${headers}= Wait for notification timeout=${10} - - ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} - - Wait for no notification - - -*** Keywords *** -Before Test - Start Local Server ${notification_server_host} ${notification_server_port} - -Setup Initial Subscriptions - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${subscription_payload}= Load Subscription Sample With Reachable Endpoint - ... ${subscription_payload_file_path} - ... ${subscription_id} - ... ${notification_server_send_url} - ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} - Set Suite Variable ${entity_id} - Set Suite Variable ${subscription_id} - - Create Entity ${entity_building_filepath} ${entity_id} - Sleep 1s - Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} - Sleep 1s - -After Test - Delete Initial Subscriptions - Delete Initial Entity - Stop Local Server - -Delete Initial Subscriptions - Delete Subscription ${subscription_id} - -Delete Initial Entity - Delete Entity by Id ${entity_id} diff --git a/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld b/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld deleted file mode 100644 index 19201f3a..00000000 --- a/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld +++ /dev/null @@ -1,17 +0,0 @@ -{ - "id":"urn:ngsi-ld:Subscription:randomUUID", - "type":"Subscription", - "entities":[ - { - "type":"Building" - } - ], - "notification":{ - "format":"keyValues", - "endpoint":{ - "uri":"http://my.endpoint.org/notify", - "accept":"application/json" - } - }, - "throttling" : -30 -} \ No newline at end of file diff --git a/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld b/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld deleted file mode 100644 index f3e34866..00000000 --- a/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld +++ /dev/null @@ -1,18 +0,0 @@ -{ - "id":"urn:ngsi-ld:Subscription:randomUUID", - "type":"Subscription", - "timeInterval": 10, - "entities":[ - { - "type":"Building" - } - ], - "notification":{ - "format":"keyValues", - "endpoint":{ - "uri":"http://my.endpoint.org/notify", - "accept":"application/json" - } - }, - "throttling" : 30 -} \ No newline at end of file -- GitLab From 50188e4856b369c74aa055105f76783c87639aec Mon Sep 17 00:00:00 2001 From: ranim-n Date: Thu, 22 Feb 2024 15:15:52 +0100 Subject: [PATCH 05/20] added jsonld sample files for the create a subscription with throttling test cases --- ...n-invalid-negative-throttling-sample.jsonld | 17 +++++++++++++++++ ...rottling-timeInterval-invalid-sample.jsonld | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld create mode 100644 data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld diff --git a/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld b/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld new file mode 100644 index 00000000..19201f3a --- /dev/null +++ b/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld @@ -0,0 +1,17 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "throttling" : -30 +} \ No newline at end of file diff --git a/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld b/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld new file mode 100644 index 00000000..f3e34866 --- /dev/null +++ b/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld @@ -0,0 +1,18 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "timeInterval": 10, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "throttling" : 30 +} \ No newline at end of file -- GitLab From 96af767db070b1f2796f0b19db66bafc486d947f Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Thu, 22 Feb 2024 16:49:28 +0000 Subject: [PATCH 06/20] Apply 1 suggestion(s) to 1 file(s) --- .../Subscription/CreateSubscription/028_05.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot index c3bd7df5..f5662d6e 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot @@ -16,7 +16,7 @@ Test Template Create Subscription With Invalid Throttling *** Keywords *** Create Subscription With Invalid Throttling - [Documentation] Check that you cannot create a subscription with invalid throttling (a negative throttling or in conjunction with timeInterval throttling) + [Documentation] Check that you cannot create a subscription with invalid throttling [Tags] sub-create 5_8_1 [Arguments] ${filename} ${expected_status} ${response}= Create Subscription From File ${filename} -- GitLab From 0f4b51439853a0d9e2fcbf2a461f7eab3c5aa219 Mon Sep 17 00:00:00 2001 From: ranim-n Date: Fri, 23 Feb 2024 10:08:31 +0100 Subject: [PATCH 07/20] sample file fixes and adding the new test cases to the documentation --- .../Subscription/CreateSubscription/028_05.robot | 4 ++-- ...ubscription-with-valid-throttling-sample.jsonld | 4 ++-- doc/tests/test_ContextInformation_Subscription.py | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot index c3bd7df5..cd040a88 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that you cannot create a subscription with invalid throttling (a negative throttling or in conjunction with timeInterval throttling) +Documentation Check that you cannot create a subscription with invalid throttling Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource Resource ${EXECDIR}/resources/AssertionUtils.resource @@ -16,7 +16,7 @@ Test Template Create Subscription With Invalid Throttling *** Keywords *** Create Subscription With Invalid Throttling - [Documentation] Check that you cannot create a subscription with invalid throttling (a negative throttling or in conjunction with timeInterval throttling) + [Documentation] Check that you cannot create a subscription with invalid throttling [Tags] sub-create 5_8_1 [Arguments] ${filename} ${expected_status} ${response}= Create Subscription From File ${filename} diff --git a/data/subscriptions/subscription-with-valid-throttling-sample.jsonld b/data/subscriptions/subscription-with-valid-throttling-sample.jsonld index cb68473a..36b4750e 100644 --- a/data/subscriptions/subscription-with-valid-throttling-sample.jsonld +++ b/data/subscriptions/subscription-with-valid-throttling-sample.jsonld @@ -13,8 +13,8 @@ "accept":"application/json" } }, - "throttling" : 1, + "throttling" : 15, "@context":[ - "https://easy-global-market.github.io/ngsild-api-data-models/ngsi-ld-test-suite/ngsi-ld-test-suite-compound-v1.7.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/doc/tests/test_ContextInformation_Subscription.py b/doc/tests/test_ContextInformation_Subscription.py index 215414ca..c0fceb84 100644 --- a/doc/tests/test_ContextInformation_Subscription.py +++ b/doc/tests/test_ContextInformation_Subscription.py @@ -70,6 +70,13 @@ class TestCISubscription(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_028_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/028_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_028_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_032_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/032_01.json' @@ -189,6 +196,13 @@ class TestCISubscription(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_046_15(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_15.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_15.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_031_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/QuerySubscriptions/031_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/031_01.json' -- GitLab From 5fbc4b2b6932ead4ee7547b9d0b21746fe59d5cd Mon Sep 17 00:00:00 2001 From: ranim-n Date: Fri, 23 Feb 2024 16:10:24 +0100 Subject: [PATCH 08/20] fixed indentation in the file to generate the documentation --- .../test_ContextInformation_Subscription.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/tests/test_ContextInformation_Subscription.py b/doc/tests/test_ContextInformation_Subscription.py index c0fceb84..097a4a0a 100644 --- a/doc/tests/test_ContextInformation_Subscription.py +++ b/doc/tests/test_ContextInformation_Subscription.py @@ -70,12 +70,12 @@ class TestCISubscription(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) - def test_028_05(self): - robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot' - expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/028_05.json' - difference_file = f'{self.folder_test_suites}/doc/results/out_028_05.json' + def test_028_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/028_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_028_05.json' - self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) def test_032_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_01.robot' @@ -196,12 +196,12 @@ class TestCISubscription(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) - def test_046_15(self): - robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot' - expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_15.json' - difference_file = f'{self.folder_test_suites}/doc/results/out_046_15.json' + def test_046_15(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_15.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_15.json' - self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) def test_031_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/QuerySubscriptions/031_01.robot' -- GitLab From 109580d29d2283650defe818ddff78882f1912ae Mon Sep 17 00:00:00 2001 From: ranim-n Date: Mon, 26 Feb 2024 14:55:46 +0100 Subject: [PATCH 09/20] renamed sample files --- .../Subscription/CreateSubscription/028_05.robot | 2 +- .../Subscription/SubscriptionNotificationBehaviour/046_15.robot | 2 +- ... subscription-invalid-throttling-timeInterval-sample.jsonld} | 0 ...ample.jsonld => subscription-valid-throttling-sample.jsonld} | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename data/subscriptions/{subscription-throttling-timeInterval-invalid-sample.jsonld => subscription-invalid-throttling-timeInterval-sample.jsonld} (100%) rename data/subscriptions/{subscription-with-valid-throttling-sample.jsonld => subscription-valid-throttling-sample.jsonld} (100%) diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot index cd040a88..e04ebdb3 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot @@ -9,7 +9,7 @@ Test Template Create Subscription With Invalid Throttling *** Test Cases *** FILENAME EXPECTED_STATUS 028_05_01 ThrottlingAndTimeIntervalConjunction - subscription-throttling-timeInterval-invalid-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} + subscription-invalid-throttling-timeInterval-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} 028_05_02 NegativeThrottling subscription-invalid-negative-throttling-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot index cb893dbc..573324d6 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot @@ -13,7 +13,7 @@ Suite Teardown After Test *** Variables *** ${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${subscription_payload_file_path}= subscriptions/subscription-with-valid-throttling-sample.jsonld +${subscription_payload_file_path}= subscriptions/subscription-valid-throttling-sample.jsonld ${building_id_prefix}= urn:ngsi-ld:Building: ${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify ${entity_building_filepath}= building-simple-attributes-sample.jsonld diff --git a/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld b/data/subscriptions/subscription-invalid-throttling-timeInterval-sample.jsonld similarity index 100% rename from data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld rename to data/subscriptions/subscription-invalid-throttling-timeInterval-sample.jsonld diff --git a/data/subscriptions/subscription-with-valid-throttling-sample.jsonld b/data/subscriptions/subscription-valid-throttling-sample.jsonld similarity index 100% rename from data/subscriptions/subscription-with-valid-throttling-sample.jsonld rename to data/subscriptions/subscription-valid-throttling-sample.jsonld -- GitLab From d67da146ecad814421e84f751cb3ceabe64219eb Mon Sep 17 00:00:00 2001 From: ranim-n Date: Mon, 19 Feb 2024 12:06:38 +0100 Subject: [PATCH 10/20] tc for throttling in subscription : can't create a sub with throttling and timeInterval --- .../CreateSubscription/028_05.robot | 29 +++++++++++++++++++ ...tion-throttling-timeInterval-sample.jsonld | 21 ++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot create mode 100644 data/subscriptions/subscription-throttling-timeInterval-sample.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot new file mode 100644 index 00000000..9f22216b --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot @@ -0,0 +1,29 @@ +*** Settings *** +Documentation Check that you cannot create a subscription with timeInterval and throttling + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource + +Test Template Create Subscription With TimeInterval And Throttling + + +*** Variables *** +${subscription_payload_file_path}= subscriptions/subscription-throttling-timeInterval-sample.jsonld + + +*** Test Cases *** FILENAME EXPECTED_STATUS +028_05_01 InvalidJson + subscription-throttling-timeInterval-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} + + +*** Keywords *** +Create Subscription With TimeInterval And Throttling + [Documentation] Check that you cannot create a subscription with timeInterval and throttling + [Tags] sub-create 5_8_1 + [Arguments] ${subscription_payload_file_path} ${expected_status} + ${response}= Create Subscription From File ${subscription_payload_file_path} + Check Response Status Code 400 ${response.status_code} + Check RL Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${expected_status} + Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/data/subscriptions/subscription-throttling-timeInterval-sample.jsonld b/data/subscriptions/subscription-throttling-timeInterval-sample.jsonld new file mode 100644 index 00000000..58e13c25 --- /dev/null +++ b/data/subscriptions/subscription-throttling-timeInterval-sample.jsonld @@ -0,0 +1,21 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "timeInterval": 10, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "throttling" : 30, + "@context":[ + "https://easy-global-market.github.io/ngsild-api-data-models/ngsi-ld-test-suite/ngsi-ld-test-suite-compound-v1.7.jsonld" + ] +} \ No newline at end of file -- GitLab From c4c4a6b5c399f926ecd351d5a5dc9dc605c3f319 Mon Sep 17 00:00:00 2001 From: ranim-n Date: Mon, 19 Feb 2024 17:39:40 +0100 Subject: [PATCH 11/20] two tcs : throttling conjuction with timeInterval and negative throttling --- .../CreateSubscription/028_05.robot | 22 +++++++++---------- ...cription-negative-throttling-sample.jsonld | 20 +++++++++++++++++ ...ttling-timeInterval-invalid-sample.jsonld} | 0 3 files changed, 30 insertions(+), 12 deletions(-) create mode 100644 data/subscriptions/subscription-negative-throttling-sample.jsonld rename data/subscriptions/{subscription-throttling-timeInterval-sample.jsonld => subscription-throttling-timeInterval-invalid-sample.jsonld} (100%) diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot index 9f22216b..d7f5871a 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot @@ -1,27 +1,25 @@ *** Settings *** -Documentation Check that you cannot create a subscription with timeInterval and throttling +Documentation Check that you cannot create a subscription with negative/in conjunction with timeInterval throttling Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource Resource ${EXECDIR}/resources/AssertionUtils.resource -Test Template Create Subscription With TimeInterval And Throttling - - -*** Variables *** -${subscription_payload_file_path}= subscriptions/subscription-throttling-timeInterval-sample.jsonld +Test Template Create Subscription With Different Requests *** Test Cases *** FILENAME EXPECTED_STATUS -028_05_01 InvalidJson - subscription-throttling-timeInterval-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} +028_05_01 ThrottlingAndTimeIntervalConjunction + subscription-throttling-timeInterval-invalid-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} +028_05_02 NegativeThrottling + subscription-negative-throttling-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} *** Keywords *** -Create Subscription With TimeInterval And Throttling - [Documentation] Check that you cannot create a subscription with timeInterval and throttling +Create Subscription With Different Requests + [Documentation] Check that you cannot create a subscription with negative/in conjunction with timeInterval throttling [Tags] sub-create 5_8_1 - [Arguments] ${subscription_payload_file_path} ${expected_status} - ${response}= Create Subscription From File ${subscription_payload_file_path} + [Arguments] ${filename} ${expected_status} + ${response}= Create Subscription From File ${filename} Check Response Status Code 400 ${response.status_code} Check RL Response Body Containing ProblemDetails Element Containing Type Element set to ... ${response.json()} diff --git a/data/subscriptions/subscription-negative-throttling-sample.jsonld b/data/subscriptions/subscription-negative-throttling-sample.jsonld new file mode 100644 index 00000000..cf7b01c7 --- /dev/null +++ b/data/subscriptions/subscription-negative-throttling-sample.jsonld @@ -0,0 +1,20 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "throttling" : -30, + "@context":[ + "https://easy-global-market.github.io/ngsild-api-data-models/ngsi-ld-test-suite/ngsi-ld-test-suite-compound-v1.7.jsonld" + ] +} \ No newline at end of file diff --git a/data/subscriptions/subscription-throttling-timeInterval-sample.jsonld b/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld similarity index 100% rename from data/subscriptions/subscription-throttling-timeInterval-sample.jsonld rename to data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld -- GitLab From e15480da7d9a69c98ee3f721f7cc3c6099210aba Mon Sep 17 00:00:00 2001 From: ranim-n Date: Thu, 22 Feb 2024 10:35:16 +0100 Subject: [PATCH 12/20] check notification's behaviour when a subscription defines a throttling member --- .../CreateSubscription/028_05.robot | 14 ++-- .../046_15.robot | 72 +++++++++++++++++++ .../046_16.robot | 67 +++++++++++++++++ ...-invalid-negative-throttling-sample.jsonld | 17 +++++ ...ottling-timeInterval-invalid-sample.jsonld | 5 +- ...ption-with-valid-throttling-sample.jsonld} | 4 +- 6 files changed, 164 insertions(+), 15 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot create mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot create mode 100644 data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld rename data/subscriptions/{subscription-negative-throttling-sample.jsonld => subscription-with-valid-throttling-sample.jsonld} (91%) diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot index d7f5871a..c3bd7df5 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot @@ -1,27 +1,23 @@ *** Settings *** -Documentation Check that you cannot create a subscription with negative/in conjunction with timeInterval throttling +Documentation Check that you cannot create a subscription with invalid throttling (a negative throttling or in conjunction with timeInterval throttling) Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource Resource ${EXECDIR}/resources/AssertionUtils.resource -Test Template Create Subscription With Different Requests +Test Template Create Subscription With Invalid Throttling *** Test Cases *** FILENAME EXPECTED_STATUS 028_05_01 ThrottlingAndTimeIntervalConjunction subscription-throttling-timeInterval-invalid-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} 028_05_02 NegativeThrottling - subscription-negative-throttling-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} + subscription-invalid-negative-throttling-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} *** Keywords *** -Create Subscription With Different Requests - [Documentation] Check that you cannot create a subscription with negative/in conjunction with timeInterval throttling +Create Subscription With Invalid Throttling + [Documentation] Check that you cannot create a subscription with invalid throttling (a negative throttling or in conjunction with timeInterval throttling) [Tags] sub-create 5_8_1 [Arguments] ${filename} ${expected_status} ${response}= Create Subscription From File ${filename} Check Response Status Code 400 ${response.status_code} - Check RL Response Body Containing ProblemDetails Element Containing Type Element set to - ... ${response.json()} - ... ${expected_status} - Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot new file mode 100644 index 00000000..bd8895cc --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot @@ -0,0 +1,72 @@ +*** Settings *** +Documentation If a Subscription defines a throttling member, a Notification shall be sent after the throttling specified (in seconds) has elapsed. + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-with-valid-throttling-sample.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify +${entity_building_filepath}= building-simple-attributes-sample.jsonld +${fragment_filename}= airQualityLevel-fragment.jsonld + + +*** Test Cases *** +046_15_01 Check that a notification is sent after the throttling has elapsed + [Documentation] If a Subscription defines a throttling member, a Notification shall be sent after the throttling specified (in seconds) has elapsed. + [Tags] sub-notification 5_8_6 046_15 + Setup Initial Subscriptions + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification timeout=${15} + Sleep 2 + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification timeout=${10} + + Should be Equal ${subscription_id} ${notification}[subscriptionId] + Dictionary Should Contain Key ${notification} data + Should Not Be Empty ${notification}[data] Notification data should not be empty + Should be Equal ${entity_id} ${notification}[data][0][id] + + +*** Keywords *** +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Set Suite Variable ${entity_id} + Set Suite Variable ${subscription_id} + + Create Entity ${entity_building_filepath} ${entity_id} + Sleep 1s + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Sleep 1s + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot new file mode 100644 index 00000000..91546025 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot @@ -0,0 +1,67 @@ +*** Settings *** +Documentation If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource +Resource ${EXECDIR}/resources/NotificationUtils.resource + +Suite Setup Before Test +Suite Teardown After Test + + +*** Variables *** +${subscription_id_prefix}= urn:ngsi-ld:Subscription: +${subscription_payload_file_path}= subscriptions/subscription-with-valid-throttling-sample.jsonld +${building_id_prefix}= urn:ngsi-ld:Building: +${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify +${entity_building_filepath}= building-simple-attributes-sample.jsonld +${fragment_filename}= airQualityLevel-fragment.jsonld + + +*** Test Cases *** +046_16_01 Check that a notification is not sent if the throttling has not elapsed yet + [Documentation] If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. + [Tags] sub-notification 5_8_6 046_16 + Setup Initial Subscriptions + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + ${notification} ${headers}= Wait for notification timeout=${10} + + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + Wait for no notification + + +*** Keywords *** +Before Test + Start Local Server ${notification_server_host} ${notification_server_port} + +Setup Initial Subscriptions + ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + ${subscription_payload}= Load Subscription Sample With Reachable Endpoint + ... ${subscription_payload_file_path} + ... ${subscription_id} + ... ${notification_server_send_url} + ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} + Set Suite Variable ${entity_id} + Set Suite Variable ${subscription_id} + + Create Entity ${entity_building_filepath} ${entity_id} + Sleep 1s + Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} + Sleep 1s + +After Test + Delete Initial Subscriptions + Delete Initial Entity + Stop Local Server + +Delete Initial Subscriptions + Delete Subscription ${subscription_id} + +Delete Initial Entity + Delete Entity by Id ${entity_id} diff --git a/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld b/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld new file mode 100644 index 00000000..19201f3a --- /dev/null +++ b/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld @@ -0,0 +1,17 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "throttling" : -30 +} \ No newline at end of file diff --git a/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld b/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld index 58e13c25..f3e34866 100644 --- a/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld +++ b/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld @@ -14,8 +14,5 @@ "accept":"application/json" } }, - "throttling" : 30, - "@context":[ - "https://easy-global-market.github.io/ngsild-api-data-models/ngsi-ld-test-suite/ngsi-ld-test-suite-compound-v1.7.jsonld" - ] + "throttling" : 30 } \ No newline at end of file diff --git a/data/subscriptions/subscription-negative-throttling-sample.jsonld b/data/subscriptions/subscription-with-valid-throttling-sample.jsonld similarity index 91% rename from data/subscriptions/subscription-negative-throttling-sample.jsonld rename to data/subscriptions/subscription-with-valid-throttling-sample.jsonld index cf7b01c7..cb68473a 100644 --- a/data/subscriptions/subscription-negative-throttling-sample.jsonld +++ b/data/subscriptions/subscription-with-valid-throttling-sample.jsonld @@ -13,8 +13,8 @@ "accept":"application/json" } }, - "throttling" : -30, - "@context":[ + "throttling" : 1, + "@context":[ "https://easy-global-market.github.io/ngsild-api-data-models/ngsi-ld-test-suite/ngsi-ld-test-suite-compound-v1.7.jsonld" ] } \ No newline at end of file -- GitLab From b013c7c0c026b409573cd4e5c8d352626b8cfe62 Mon Sep 17 00:00:00 2001 From: ranim-n Date: Thu, 22 Feb 2024 14:27:42 +0100 Subject: [PATCH 13/20] check that no notification is sent if the throttling member defined in the subscription has not elapsed yet --- .../046_15.robot | 19 ++---- .../046_16.robot | 67 ------------------- ...-invalid-negative-throttling-sample.jsonld | 17 ----- ...ottling-timeInterval-invalid-sample.jsonld | 18 ----- 4 files changed, 7 insertions(+), 114 deletions(-) delete mode 100644 TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot delete mode 100644 data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld delete mode 100644 data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot index bd8895cc..cb893dbc 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation If a Subscription defines a throttling member, a Notification shall be sent after the throttling specified (in seconds) has elapsed. +Documentation If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource @@ -21,23 +21,18 @@ ${fragment_filename}= airQualityLevel-fragment.jsonld *** Test Cases *** -046_15_01 Check that a notification is sent after the throttling has elapsed - [Documentation] If a Subscription defines a throttling member, a Notification shall be sent after the throttling specified (in seconds) has elapsed. - [Tags] sub-notification 5_8_6 046_15 +046_15_01 Check that a notification is not sent if the throttling has not elapsed yet + [Documentation] If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. + [Tags] sub-notification 5_8_6 046_16 Setup Initial Subscriptions ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} - ${notification} ${headers}= Wait for notification timeout=${15} - Sleep 2 - ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} - ${notification} ${headers}= Wait for notification timeout=${10} - Should be Equal ${subscription_id} ${notification}[subscriptionId] - Dictionary Should Contain Key ${notification} data - Should Not Be Empty ${notification}[data] Notification data should not be empty - Should be Equal ${entity_id} ${notification}[data][0][id] + ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} + + Wait for no notification *** Keywords *** diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot deleted file mode 100644 index 91546025..00000000 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_16.robot +++ /dev/null @@ -1,67 +0,0 @@ -*** Settings *** -Documentation If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. - -Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource -Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource -Resource ${EXECDIR}/resources/AssertionUtils.resource -Resource ${EXECDIR}/resources/JsonUtils.resource -Resource ${EXECDIR}/resources/NotificationUtils.resource - -Suite Setup Before Test -Suite Teardown After Test - - -*** Variables *** -${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${subscription_payload_file_path}= subscriptions/subscription-with-valid-throttling-sample.jsonld -${building_id_prefix}= urn:ngsi-ld:Building: -${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify -${entity_building_filepath}= building-simple-attributes-sample.jsonld -${fragment_filename}= airQualityLevel-fragment.jsonld - - -*** Test Cases *** -046_16_01 Check that a notification is not sent if the throttling has not elapsed yet - [Documentation] If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. - [Tags] sub-notification 5_8_6 046_16 - Setup Initial Subscriptions - - ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} - - ${notification} ${headers}= Wait for notification timeout=${10} - - ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} - - Wait for no notification - - -*** Keywords *** -Before Test - Start Local Server ${notification_server_host} ${notification_server_port} - -Setup Initial Subscriptions - ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} - ${entity_id}= Generate Random Entity Id ${building_id_prefix} - ${subscription_payload}= Load Subscription Sample With Reachable Endpoint - ... ${subscription_payload_file_path} - ... ${subscription_id} - ... ${notification_server_send_url} - ${subscription_payload}= Set Entity Id In Subscription ${subscription_payload} ${entity_id} - Set Suite Variable ${entity_id} - Set Suite Variable ${subscription_id} - - Create Entity ${entity_building_filepath} ${entity_id} - Sleep 1s - Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} - Sleep 1s - -After Test - Delete Initial Subscriptions - Delete Initial Entity - Stop Local Server - -Delete Initial Subscriptions - Delete Subscription ${subscription_id} - -Delete Initial Entity - Delete Entity by Id ${entity_id} diff --git a/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld b/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld deleted file mode 100644 index 19201f3a..00000000 --- a/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld +++ /dev/null @@ -1,17 +0,0 @@ -{ - "id":"urn:ngsi-ld:Subscription:randomUUID", - "type":"Subscription", - "entities":[ - { - "type":"Building" - } - ], - "notification":{ - "format":"keyValues", - "endpoint":{ - "uri":"http://my.endpoint.org/notify", - "accept":"application/json" - } - }, - "throttling" : -30 -} \ No newline at end of file diff --git a/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld b/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld deleted file mode 100644 index f3e34866..00000000 --- a/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld +++ /dev/null @@ -1,18 +0,0 @@ -{ - "id":"urn:ngsi-ld:Subscription:randomUUID", - "type":"Subscription", - "timeInterval": 10, - "entities":[ - { - "type":"Building" - } - ], - "notification":{ - "format":"keyValues", - "endpoint":{ - "uri":"http://my.endpoint.org/notify", - "accept":"application/json" - } - }, - "throttling" : 30 -} \ No newline at end of file -- GitLab From 86fb3e4dc11ed8f6ac559b3e7c9bb551224bf353 Mon Sep 17 00:00:00 2001 From: ranim-n Date: Thu, 22 Feb 2024 15:15:52 +0100 Subject: [PATCH 14/20] added jsonld sample files for the create a subscription with throttling test cases --- ...n-invalid-negative-throttling-sample.jsonld | 17 +++++++++++++++++ ...rottling-timeInterval-invalid-sample.jsonld | 18 ++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld create mode 100644 data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld diff --git a/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld b/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld new file mode 100644 index 00000000..19201f3a --- /dev/null +++ b/data/subscriptions/subscription-invalid-negative-throttling-sample.jsonld @@ -0,0 +1,17 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "throttling" : -30 +} \ No newline at end of file diff --git a/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld b/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld new file mode 100644 index 00000000..f3e34866 --- /dev/null +++ b/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld @@ -0,0 +1,18 @@ +{ + "id":"urn:ngsi-ld:Subscription:randomUUID", + "type":"Subscription", + "timeInterval": 10, + "entities":[ + { + "type":"Building" + } + ], + "notification":{ + "format":"keyValues", + "endpoint":{ + "uri":"http://my.endpoint.org/notify", + "accept":"application/json" + } + }, + "throttling" : 30 +} \ No newline at end of file -- GitLab From 0fa575252b87aa1a9294de99619eecd55ceaf0c6 Mon Sep 17 00:00:00 2001 From: ranim-n Date: Fri, 23 Feb 2024 10:08:31 +0100 Subject: [PATCH 15/20] sample file fixes and adding the new test cases to the documentation --- .../Subscription/CreateSubscription/028_05.robot | 4 ++-- ...ubscription-with-valid-throttling-sample.jsonld | 4 ++-- doc/tests/test_ContextInformation_Subscription.py | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot index c3bd7df5..cd040a88 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot @@ -1,5 +1,5 @@ *** Settings *** -Documentation Check that you cannot create a subscription with invalid throttling (a negative throttling or in conjunction with timeInterval throttling) +Documentation Check that you cannot create a subscription with invalid throttling Resource ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource Resource ${EXECDIR}/resources/AssertionUtils.resource @@ -16,7 +16,7 @@ Test Template Create Subscription With Invalid Throttling *** Keywords *** Create Subscription With Invalid Throttling - [Documentation] Check that you cannot create a subscription with invalid throttling (a negative throttling or in conjunction with timeInterval throttling) + [Documentation] Check that you cannot create a subscription with invalid throttling [Tags] sub-create 5_8_1 [Arguments] ${filename} ${expected_status} ${response}= Create Subscription From File ${filename} diff --git a/data/subscriptions/subscription-with-valid-throttling-sample.jsonld b/data/subscriptions/subscription-with-valid-throttling-sample.jsonld index cb68473a..36b4750e 100644 --- a/data/subscriptions/subscription-with-valid-throttling-sample.jsonld +++ b/data/subscriptions/subscription-with-valid-throttling-sample.jsonld @@ -13,8 +13,8 @@ "accept":"application/json" } }, - "throttling" : 1, + "throttling" : 15, "@context":[ - "https://easy-global-market.github.io/ngsild-api-data-models/ngsi-ld-test-suite/ngsi-ld-test-suite-compound-v1.7.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/doc/tests/test_ContextInformation_Subscription.py b/doc/tests/test_ContextInformation_Subscription.py index 215414ca..c0fceb84 100644 --- a/doc/tests/test_ContextInformation_Subscription.py +++ b/doc/tests/test_ContextInformation_Subscription.py @@ -70,6 +70,13 @@ class TestCISubscription(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_028_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/028_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_028_05.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_032_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/032_01.json' @@ -189,6 +196,13 @@ class TestCISubscription(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_046_15(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_15.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_15.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_031_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/QuerySubscriptions/031_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/031_01.json' -- GitLab From 2023431ba5d41d0f004642dbbcb822a24b350e26 Mon Sep 17 00:00:00 2001 From: ranim-n Date: Fri, 23 Feb 2024 16:10:24 +0100 Subject: [PATCH 16/20] fixed indentation in the file to generate the documentation --- .../test_ContextInformation_Subscription.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/tests/test_ContextInformation_Subscription.py b/doc/tests/test_ContextInformation_Subscription.py index c0fceb84..097a4a0a 100644 --- a/doc/tests/test_ContextInformation_Subscription.py +++ b/doc/tests/test_ContextInformation_Subscription.py @@ -70,12 +70,12 @@ class TestCISubscription(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) - def test_028_05(self): - robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot' - expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/028_05.json' - difference_file = f'{self.folder_test_suites}/doc/results/out_028_05.json' + def test_028_05(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/028_05.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_028_05.json' - self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) def test_032_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/DeleteSubscription/032_01.robot' @@ -196,12 +196,12 @@ class TestCISubscription(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) - def test_046_15(self): - robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot' - expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_15.json' - difference_file = f'{self.folder_test_suites}/doc/results/out_046_15.json' + def test_046_15(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Subscription/046_15.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_046_15.json' - self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) def test_031_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Subscription/QuerySubscriptions/031_01.robot' -- GitLab From 0bd0813abc0ae7c6bc8b59928029b9c8d017cc0e Mon Sep 17 00:00:00 2001 From: ranim-n Date: Mon, 26 Feb 2024 14:55:46 +0100 Subject: [PATCH 17/20] renamed sample files --- .../Subscription/CreateSubscription/028_05.robot | 2 +- .../Subscription/SubscriptionNotificationBehaviour/046_15.robot | 2 +- ... subscription-invalid-throttling-timeInterval-sample.jsonld} | 0 ...ample.jsonld => subscription-valid-throttling-sample.jsonld} | 0 4 files changed, 2 insertions(+), 2 deletions(-) rename data/subscriptions/{subscription-throttling-timeInterval-invalid-sample.jsonld => subscription-invalid-throttling-timeInterval-sample.jsonld} (100%) rename data/subscriptions/{subscription-with-valid-throttling-sample.jsonld => subscription-valid-throttling-sample.jsonld} (100%) diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot index cd040a88..e04ebdb3 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot @@ -9,7 +9,7 @@ Test Template Create Subscription With Invalid Throttling *** Test Cases *** FILENAME EXPECTED_STATUS 028_05_01 ThrottlingAndTimeIntervalConjunction - subscription-throttling-timeInterval-invalid-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} + subscription-invalid-throttling-timeInterval-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} 028_05_02 NegativeThrottling subscription-invalid-negative-throttling-sample.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot index cb893dbc..573324d6 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot @@ -13,7 +13,7 @@ Suite Teardown After Test *** Variables *** ${subscription_id_prefix}= urn:ngsi-ld:Subscription: -${subscription_payload_file_path}= subscriptions/subscription-with-valid-throttling-sample.jsonld +${subscription_payload_file_path}= subscriptions/subscription-valid-throttling-sample.jsonld ${building_id_prefix}= urn:ngsi-ld:Building: ${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify ${entity_building_filepath}= building-simple-attributes-sample.jsonld diff --git a/data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld b/data/subscriptions/subscription-invalid-throttling-timeInterval-sample.jsonld similarity index 100% rename from data/subscriptions/subscription-throttling-timeInterval-invalid-sample.jsonld rename to data/subscriptions/subscription-invalid-throttling-timeInterval-sample.jsonld diff --git a/data/subscriptions/subscription-with-valid-throttling-sample.jsonld b/data/subscriptions/subscription-valid-throttling-sample.jsonld similarity index 100% rename from data/subscriptions/subscription-with-valid-throttling-sample.jsonld rename to data/subscriptions/subscription-valid-throttling-sample.jsonld -- GitLab From 356436d5ca582b708fa1ecbbcb41186beaf8e687 Mon Sep 17 00:00:00 2001 From: ranim-n Date: Thu, 29 Feb 2024 11:22:39 +0100 Subject: [PATCH 18/20] removed tag in test file --- .../SubscriptionNotificationBehaviour/046_15.robot | 2 +- .../subscriptions/subscription-valid-throttling-sample.jsonld | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot index 573324d6..c1661f98 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot @@ -23,7 +23,7 @@ ${fragment_filename}= airQualityLevel-fragment.jsonld *** Test Cases *** 046_15_01 Check that a notification is not sent if the throttling has not elapsed yet [Documentation] If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet. - [Tags] sub-notification 5_8_6 046_16 + [Tags] sub-notification 5_8_6 Setup Initial Subscriptions ${response}= Update Entity Attributes ${entity_id} ${fragment_filename} ${CONTENT_TYPE_LD_JSON} diff --git a/data/subscriptions/subscription-valid-throttling-sample.jsonld b/data/subscriptions/subscription-valid-throttling-sample.jsonld index 36b4750e..94b95eae 100644 --- a/data/subscriptions/subscription-valid-throttling-sample.jsonld +++ b/data/subscriptions/subscription-valid-throttling-sample.jsonld @@ -14,7 +14,7 @@ } }, "throttling" : 15, - "@context":[ - "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" ] } \ No newline at end of file -- GitLab From aa6996395b747a92664c93ea78aba13ec572283b Mon Sep 17 00:00:00 2001 From: ranim-n Date: Thu, 29 Feb 2024 15:58:28 +0100 Subject: [PATCH 19/20] added the checks for the response body --- .../Subscription/CreateSubscription/028_05.robot | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot index e04ebdb3..9602eff7 100644 --- a/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot +++ b/TP/NGSI-LD/ContextInformation/Subscription/CreateSubscription/028_05.robot @@ -21,3 +21,7 @@ Create Subscription With Invalid Throttling [Arguments] ${filename} ${expected_status} ${response}= Create Subscription From File ${filename} Check Response Status Code 400 ${response.status_code} + Check Response Body Containing ProblemDetails Element Containing Type Element set to + ... ${response.json()} + ... ${expected_status} + Check Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} -- GitLab From 90484e567ac84a39a8a9d126bc16312858acdebf Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Sun, 17 Mar 2024 18:58:28 +0100 Subject: [PATCH 20/20] doc: add missing generated JSON files --- .../Subscription/028_05.json | 50 +++++++++++++++++++ .../Subscription/046_15.json | 35 +++++++++++++ 2 files changed, 85 insertions(+) create mode 100644 doc/files/ContextInformation/Subscription/028_05.json create mode 100644 doc/files/ContextInformation/Subscription/046_15.json diff --git a/doc/files/ContextInformation/Subscription/028_05.json b/doc/files/ContextInformation/Subscription/028_05.json new file mode 100644 index 00000000..0d044943 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/028_05.json @@ -0,0 +1,50 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/028_05", + "test_objective": "Check that you cannot create a subscription with invalid throttling", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.1", + "config_id": "", + "parent_release": "v1.3.1", + "pics_selection": "PICS_5_8_1", + "keywords": [], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "028_05_01 ThrottlingAndTimeIntervalConjunction", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/028_05_01", + "doc": "Check that you cannot create a subscription with invalid throttling", + "tags": [ + "sub-create", + "5_8_1" + ], + "setup": null, + "teardown": null, + "template": "Create Subscription With Invalid Throttling", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Subscription From File with Response Status Code set to 400 and\n Create Subscription From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Subscription From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'POST'\n Create Subscription Request with Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'subscription-invalid-throttling-timeInterval-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "subscriptions/" + }, + { + "name": "028_05_02 NegativeThrottling", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/028_05_02", + "doc": "Check that you cannot create a subscription with invalid throttling", + "tags": [ + "sub-create", + "5_8_1" + ], + "setup": null, + "teardown": null, + "template": "Create Subscription With Invalid Throttling", + "then": "then {\n the SUT sends a valid Response for the operations:\n Create Subscription From File with Response Status Code set to 400 and\n Create Subscription From File with Response Body containing the type 'https://uri.etsi.org/ngsi-ld/errors/BadRequestData' and\n Create Subscription From File with Response body containing 'title' element\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/subscriptions/'\n method set to 'POST'\n Create Subscription Request with Header['Content-Type'] set to 'application/ld+json' and\n payload defined in file: 'subscription-invalid-negative-throttling-sample.jsonld'\n}", + "http_verb": "POST", + "endpoint": "subscriptions/" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Subscription/CreateSubscription", + "robotfile": "028_05" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Subscription/046_15.json b/doc/files/ContextInformation/Subscription/046_15.json new file mode 100644 index 00000000..bd6277b8 --- /dev/null +++ b/doc/files/ContextInformation/Subscription/046_15.json @@ -0,0 +1,35 @@ +{ + "tp_id": "TP/NGSI-LD/CI/SUB/046_15", + "test_objective": "If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet.", + "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.8.6", + "config_id": "", + "parent_release": "v1.3.1", + "pics_selection": "PICS_5_8_6", + "keywords": [ + "Before Test", + "After Test" + ], + "teardown": "After Test", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "046_15_01 Check that a notification is not sent if the throttling has not elapsed yet", + "permutation_tp_id": "TP/NGSI-LD/CI/SUB/046_15_01", + "doc": "If a Subscription defines a throttling member, a Notification shall not be sent if the throttling specified (in seconds) has not elapsed yet.", + "tags": [ + "5_8_6", + "sub-notification" + ], + "setup": null, + "teardown": null, + "template": null, + "then": "then {\n the client at '${endpoint}' receives a valid Notification containing:\n Notification received After waiting '10' seconds and\n Notification received Waiting for no Notification data and\n Query Parameter: timeout set to '5'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{entityId}/attrs/{attributeId}'\n method set to 'PATCH'\n Update Entity Attributes and\n Query Parameter: id set to '${entity_id}' and\n Query Parameter: fragment_filename set to 'airQualityLevel-fragment.jsonld' and\n Query Parameter: content_type set to 'application/ld+json'\n}", + "http_verb": "PATCH", + "endpoint": "entities/{entityId}/attrs/{attributeId}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Subscription/SubscriptionNotificationBehaviour", + "robotfile": "046_15" +} \ No newline at end of file -- GitLab