Loading TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot 0 → 100644 +69 −0 Original line number Diff line number Diff line *** Settings *** Documentation If a subscription defines an entity type selection query, a notification shall be sent whenever an entity matches the query. 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-building-entities-type-selection.jsonld ${building_id_prefix}= urn:ngsi-ld:Building: ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: ${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify ${entity_building_filepath}= building-simple-attributes-sample.jsonld ${entity_vehicle_filepath}= vehicle-simple-attributes-sample.jsonld *** Test Cases *** 046_15_01 Check that a notification is sent with entity matching the entity type selection [Documentation] If a subscription defines an entity type selection query, a notification shall be sent whenever an entity matches the query. [Tags] sub-notification 5_8_6 ${entity_id}= Generate Random Entity Id ${building_id_prefix} Create Entity ${entity_building_filepath} ${entity_id} Set Suite Variable ${entity_id} ${notification} ${headers}= Wait for notification ${5} 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] 046_15_02 Check that a notification is not sent if the entity type does not match the entity type selection [Documentation] If a subscription defines an entity type selection query, a notification shall not be sent if the entity type does not match the query [Tags] sub-notification 5_8_6 ${vehicle_id}= Generate Random Entity Id ${vehicle_id_prefix} Create Entity ${entity_vehicle_filepath} ${vehicle_id} Set Suite Variable ${vehicle_id} Wait for no notification *** Keywords *** Setup Initial Subscription ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} ${subscription_payload}= Load Subscription Sample With Reachable Endpoint ... ${subscription_payload_file_path} ... ${subscription_id} ... ${notification_server_send_url} Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} Set Suite Variable ${subscription_id} Before Test Start Local Server ${notification_server_host} ${notification_server_port} Sleep 1s Setup Initial Subscription After Test Delete Subscription ${subscription_id} Delete Entity by Id ${entity_id} Delete Entity by Id ${vehicle_id} Stop Local Server data/subscriptions/subscription-building-entities-type-selection.jsonld 0 → 100644 +18 −0 Original line number Diff line number Diff line { "id":"urn:ngsi-ld:Subscription:randomUUID", "type":"Subscription", "entities":[ { "type":"(Building|Tower)" } ], "notificationTrigger": ["entityCreated"], "notification":{ "endpoint":{ "uri":"http://my.endpoint.org/notify" } }, "@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 doc/tests/test_ContextInformation_Subscription.py +7 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,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' Loading Loading
TP/NGSI-LD/ContextInformation/Subscription/SubscriptionNotificationBehaviour/046_15.robot 0 → 100644 +69 −0 Original line number Diff line number Diff line *** Settings *** Documentation If a subscription defines an entity type selection query, a notification shall be sent whenever an entity matches the query. 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-building-entities-type-selection.jsonld ${building_id_prefix}= urn:ngsi-ld:Building: ${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: ${notification_server_send_url}= http://${notification_server_host}:${notification_server_port}/notify ${entity_building_filepath}= building-simple-attributes-sample.jsonld ${entity_vehicle_filepath}= vehicle-simple-attributes-sample.jsonld *** Test Cases *** 046_15_01 Check that a notification is sent with entity matching the entity type selection [Documentation] If a subscription defines an entity type selection query, a notification shall be sent whenever an entity matches the query. [Tags] sub-notification 5_8_6 ${entity_id}= Generate Random Entity Id ${building_id_prefix} Create Entity ${entity_building_filepath} ${entity_id} Set Suite Variable ${entity_id} ${notification} ${headers}= Wait for notification ${5} 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] 046_15_02 Check that a notification is not sent if the entity type does not match the entity type selection [Documentation] If a subscription defines an entity type selection query, a notification shall not be sent if the entity type does not match the query [Tags] sub-notification 5_8_6 ${vehicle_id}= Generate Random Entity Id ${vehicle_id_prefix} Create Entity ${entity_vehicle_filepath} ${vehicle_id} Set Suite Variable ${vehicle_id} Wait for no notification *** Keywords *** Setup Initial Subscription ${subscription_id}= Generate Random Entity Id ${subscription_id_prefix} ${subscription_payload}= Load Subscription Sample With Reachable Endpoint ... ${subscription_payload_file_path} ... ${subscription_id} ... ${notification_server_send_url} Create Subscription From Subscription Payload ${subscription_payload} ${CONTENT_TYPE_LD_JSON} Set Suite Variable ${subscription_id} Before Test Start Local Server ${notification_server_host} ${notification_server_port} Sleep 1s Setup Initial Subscription After Test Delete Subscription ${subscription_id} Delete Entity by Id ${entity_id} Delete Entity by Id ${vehicle_id} Stop Local Server
data/subscriptions/subscription-building-entities-type-selection.jsonld 0 → 100644 +18 −0 Original line number Diff line number Diff line { "id":"urn:ngsi-ld:Subscription:randomUUID", "type":"Subscription", "entities":[ { "type":"(Building|Tower)" } ], "notificationTrigger": ["entityCreated"], "notification":{ "endpoint":{ "uri":"http://my.endpoint.org/notify" } }, "@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
doc/tests/test_ContextInformation_Subscription.py +7 −0 Original line number Diff line number Diff line Loading @@ -189,6 +189,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' Loading