Commit 3ed7fbe4 authored by Arnaud Van der Poorten's avatar Arnaud Van der Poorten
Browse files

046_10

parent c1255cca
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -47,7 +47,7 @@ Delete Initial Entity


*** Test Cases ***
*** Test Cases ***
Check that a notification is sent to the endpoint
Check that a notification is sent to the endpoint
    [Documentation]     Check that a notification is only sent if and only if the status is active
    [Documentation]     A Notification shall be sent (as mandated by each concrete binding and including any optional endpoint.info defined by clause 5.2.22) to the endpoint specified by the endpoint.uri member of the notification structure defined by clause 5.2.1
    [Tags]    sub-notification    5_11_7    046_09
    [Tags]    sub-notification    5_11_7    046_09


    Add Initial Entity
    Add Initial Entity
+38 −28
Original line number Original line Diff line number Diff line
*** Settings ***
*** Settings ***
Documentation     The Notification content shall be JSON by default.
Documentation     A Notification shall be sent (as mandated by each concrete binding and including any optional endpoint.info defined by clause 5.2.22) to the endpoint specified by the endpoint.uri member of the notification structure defined by clause 5.2.14



Resource          ${EXECDIR}/resources/ApiUtils.resource
Resource          ${EXECDIR}/resources/ApiUtils.resource
Resource          ${EXECDIR}/resources/AssertionUtils.resource
Resource          ${EXECDIR}/resources/AssertionUtils.resource
Resource          ${EXECDIR}/resources/JsonUtils.resource
Resource          ${EXECDIR}/resources/JsonUtils.resource
Resource          ${EXECDIR}/resources/NotificationUtils.resource
Resource          ${EXECDIR}/resources/NotificationUtils.resource


Suite Setup       Setup Initial Subscriptions
Suite Setup    Before Test
Suite Teardown    Delete Initial Subscriptions
Suite Teardown    After Test


*** Variable ***
*** Variable ***
${subscription_id_prefix}=    urn:ngsi-ld:Subscription:
${subscription_id_prefix}=    urn:ngsi-ld:Subscription:
${subscription_payload_file_path}=    subscriptions/subscription-building-entities-active.jsonld
${subscription_payload_file_path}=    subscriptions/subscription-building-entities-active.jsonld
${building_id_prefix}=    urn:ngsi-ld:Building:
${building_id_prefix}=    urn:ngsi-ld:Building:
${entity_building_filepath}=    building-no-attributes.jsonld
${fragment_filename}=    airQualityLevel-fragment.jsonld
${notification_server_send_url}=     http://${send_notification_server_host}:${send_notification_server_port}/notify


*** Keywords ***
Setup Initial Subscriptions
    ${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}
    ${subscription_payload}=    Set Entity Id In Subscription    ${subscription_payload}    ${entity_id}
    Create Subscription From Subscription Payload    ${subscription_payload}    ${CONTENT_TYPE_LD_JSON}
    Set Suite Variable    ${subscription_id}


Delete Initial Subscriptions
    Delete Subscription    ${subscription_id}


Before Test
    NotificationUtils.Start Local Server    ${notification_server_host}    ${notification_server_port}


*** Keywords ***
After Test
Check that a notification is only sent if statis is active
    Delete Initial Subscriptions
    [Arguments]      ${fragment_filename}    
    Delete Initial Entity
    [Documentation]     The Notification content shall be JSON by default.
    Stop Local Server
    [Tags]    sub-notification    5_11_7
    ${subscription_id}=    Generate Random Entity Id    ${subscription_id_prefix}
    ${subscription_payload}=    Load Subscription Sample With Reachable Endpoint   ${subscription_payload_file_path}    ${subscription_id}
    ${entity_id}=    Generate Random Entity Id    ${building_id_prefix}


    @{expected_notification_data_entities}=    Create List    Building
Add Initial Entity
    Set Suite Variable    ${subscription_id}
    ${entity_id}=    Generate Random Entity Id    ${building_id_prefix} 
    Create Subscription  ${subscription_id}  ${subscription_payload}  
    Create Entity    ${entity_building_filepath}    ${entity_id}
    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
    Set Suite Variable    ${entity_id}


    Wait for redirected request
Delete Initial Entity
    Delete Entity by Id    ${entity_id}


    Check JSON Value In Response Body    ['information']['entities'][0]['type']    https://ngsi-ld-test-suite/context#Building
*** Test Cases ***
Check that a notification is JSON
    [Documentation]     The Notification content shall be JSON by defaul
    [Tags]    sub-notification    5_11_7    046_10


    Add Initial Entity
    Setup Initial Subscriptions


*** Keywords ***
    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
Setup Initial Subscription
    Start Local Server
    ${subscription_id}=    Generate Random Entity Id    ${subscription_id_prefix}
    ${subscription_payload}=    Load Test Sample    ${subscription_payload_file_path}    ${subscription_id}
    Create Subscription  ${subscription_id}  ${subscription_payload}  
    Set Suite Variable    ${subscription_id}


Delete Subscription
    # Wait for notification parses the json of the request by default
    Stop Local Server
    ${notification}=    Wait for notification    timeout=${10}
    Delete Subscription      ${subscription_id}