Commit fc9a7135 authored by Giuseppe Tropea's avatar Giuseppe Tropea
Browse files

Merge remote-tracking branch 'origin/testsuitedata' into parsespec

parents 2a4c6a6c 42be4960
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ ${date_format_with_millis} %Y-%m-%dT%H:%M:%S.%f
*** Test Cases ***
046_07_01 Check notification structure
    [Documentation]    The structure of the notification message shall be as mandated by clause 5.3. Valid notification with attributes as stated above
    [Tags]    sub-notification    5_8_6    046_07_01
    [Tags]    sub-notification    5_8_6    046_07
    [Setup]    Setup Initial Subscriptions    ${subscription_payload_file_path}

    ${response}=    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
@@ -41,7 +41,7 @@ ${date_format_with_millis} %Y-%m-%dT%H:%M:%S.%f

046_07_02 Check correct attributes are included
    [Documentation]    The structure of the notification message shall be as mandated by clause 5.3.    The Entity Attributes included (Properties or Relationships) shall be those specified by the notification.attributes member in the Subscription data type (clause 5.2.12).
    [Tags]    sub-notification    5_8_6    046_07_02
    [Tags]    sub-notification    5_8_6    046_07
    [Setup]    Setup Initial Subscriptions    ${subscription_payload_file_path_notificationAttributes}

    ${response}=    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
@@ -56,7 +56,7 @@ ${date_format_with_millis} %Y-%m-%dT%H:%M:%S.%f

046_07_03 Check URI expansion is observed
    [Documentation]    The structure of the notification message shall be as mandated by clause 5.3.    URI expansion shall be observed (clause 5.5.7).
    [Tags]    sub-notification    5_8_6    046_07_03
    [Tags]    sub-notification    5_8_6    046_07
    [Setup]    Setup Initial Subscriptions    ${subscription_payload_file_path_default_context}

    ${response}=    Update Entity Attributes    ${entity_id}    ${fragment_filename}    ${CONTENT_TYPE_LD_JSON}
+3 −6
Original line number Diff line number Diff line
@@ -15,19 +15,16 @@ Test Template Query Context Source Registration With Query Params
${context_source_registration_id_prefix}=                   urn:ngsi-ld:ContextSourceRegistration:
${first_context_source_registration_payload_file_path}=     csourceRegistrations/context-source-registration-sample.jsonld
${second_context_source_registration_payload_file_path}=    csourceRegistrations/context-source-registration-detailed-information-sample.jsonld
${third_context_source_registration_payload_file_path}=     csourceRegistrations/context-source-registration-location-sample.jsonld
${third_context_source_registration_payload_file_path}=     csourceRegistrations/context-source-registration-csourceProperty-sample.jsonld


*** Test Cases ***    QUERY_PARAM_NAME    QUERY_PARAM_VALUE    EXPECTATION_FILE_PATH    EXPECTED_CONTEXT_SOURCE_REGISTRATION_IDS
037_10_01 With list of Entity Ids
    [Tags]    csr-query    5_10_2
    id    ${first_context_source_registration_id},${third_context_source_registration_id}    csourceRegistrations/expectations/context-source-registrations-037-10-01-expectation.json    ${first_context_source_registration_id}    ${third_context_source_registration_id}
    id    ${first_context_source_registration_id},${third_context_source_registration_id}    csourceRegistrations/expectations/context-source-registrations-037-10-01-expectation.json    ${first_context_source_registration_id},${third_context_source_registration_id}
037_10_02 With NGSI-LD Query
    [Tags]    csr-query    5_10_2
    q    location.type=="GeoProperty"    csourceRegistrations/expectations/context-source-registrations-037-10-02-expectation.json    ${third_context_source_registration_id}
037_10_03 With Context Source Filter
    [Tags]    csr-query    5_10_2
    csf    endpoint=="http://my.csource.org:1026"    csourceRegistrations/expectations/context-source-registrations-037-10-03-expectation.json    ${first_context_source_registration_id}    ${second_context_source_registration_id}    ${third_context_source_registration_id}
    q    csourceProperty1=="aValue"    csourceRegistrations/expectations/context-source-registrations-037-10-02-expectation.json    ${third_context_source_registration_id}


*** Keywords ***
+8 −8
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@ Resource ${EXECDIR}/resources/JsonUtils.resource

Test Setup          Setup Initial Context Source Registrations
Test Teardown       Delete Created Context Source Registrations
Test Template       Query Context Source Registration With Limit And Page Parameters
Test Template       Query Context Source Registration With Limit And Offset Parameters


*** Variables ***
@@ -18,27 +18,27 @@ ${second_context_source_registration_payload_file_path}= csourceRegistrations
${third_context_source_registration_payload_file_path}=     csourceRegistrations/context-source-registration-detailed-information-sample.jsonld


*** Test Cases ***    LIMIT    PAGE    EXPECTED_NUMBER    PREV_LINK    NEXT_LINK
*** Test Cases ***    LIMIT    OFFSET    EXPECTED_NUMBER    PREV_LINK    NEXT_LINK
037_11_01 Query Second Subscription
    [Tags]    csr-query    5_10_2
    ${1}    ${2}    ${1}    </ngsi-ld/v1/csourceRegistrations?type=Building&limit=1&page=1>;rel="prev";type="application/ld+json"    </ngsi-ld/v1/csourceSubscriptions?type=Building&limit=1&page=3>;rel="next";type="application/ld+json"
    ${1}    ${2}    ${1}    </ngsi-ld/v1/csourceRegistrations?type=Building&limit=1&offset=1>;rel="prev";type="application/ld+json"    </ngsi-ld/v1/csourceSubscriptions?type=Building&limit=1&offset=3>;rel="next";type="application/ld+json"
037_11_02 Query Last Subscription
    [Tags]    csr-query    5_10_2
    ${2}    ${2}    ${1}    </ngsi-ld/v1/csourceRegistrations?type=Building&limit=2&page=1>;rel="prev";type="application/ld+json"    ${EMPTY}
    ${2}    ${2}    ${1}    </ngsi-ld/v1/csourceRegistrations?type=Building&limit=2&offset=0>;rel="prev";type="application/ld+json"    ${EMPTY}
037_11_03 Query All Subscriptions
    [Tags]    csr-query    5_10_2
    ${15}    ${1}    ${3}    ${EMPTY}    ${EMPTY}
    ${15}    ${0}    ${2}    ${EMPTY}    ${EMPTY}


*** Keywords ***
Query Context Source Registration With Limit And Page Parameters
Query Context Source Registration With Limit And Offset Parameters
    [Documentation]    Check that you can query context source registrations with providing page and limit parameters, pagination logic shall be in place as mandated by clause 5.5.9.
    [Arguments]    ${limit}    ${page}    ${expected_number}    ${prev_link}    ${next_link}
    [Arguments]    ${limit}    ${offset}    ${expected_number}    ${prev_link}    ${next_link}
    ${response}=    Query Context Source Registrations
    ...    context=${ngsild_test_suite_context}
    ...    type=Building
    ...    limit=${limit}
    ...    page=${page}
    ...    offset=${offset}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing Number Of Entities
    ...    ContextSourceRegistration
+5 −8
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that you cannot retrieve a Context Source Registration, if the context source registration id is not present or it is not a valid URI
Documentation       Check that you cannot retrieve a Context Source Registration, if the context source registration id is not a valid URI

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

Test Template       Retrieve Context Source Registration With A Not Present Or Invalid Id
Test Template       Retrieve Context Source Registration With An Invalid Id


*** Test Cases ***    ID
036_01_01 Not Present Id
    [Tags]    csr-retrieve    5_10_1
    ${EMPTY}
036_01_02 Invalid Id
036_01_01 Invalid Id
    [Tags]    csr-retrieve    5_10_1
    invalidUri


*** Keywords ***
Retrieve Context Source Registration With A Not Present Or Invalid Id
    [Documentation]    Check that you cannot retrieve a Context Source Registration, if the context source registration id is not present or it is not a valid URI
Retrieve Context Source Registration With An Invalid Id
    [Documentation]    Check that you cannot retrieve a Context Source Registration, if the context source registration id is not a valid URI
    [Arguments]    ${id}
    ${response}=    Retrieve Context Source Registration
    ...    context_source_registration_id=${id}
+11 −6
Original line number Diff line number Diff line
@@ -15,22 +15,27 @@ ${registration_id_prefix}= urn:ngsi-ld:Registration:
${filename}=                    context-source-registration-sample.jsonld


*** Test Cases ***    INVALID_REGISTRATION_ID
*** Test Cases ***    INVALID_REGISTRATION_ID    EXPECTED_STATUS_CODE    PROBLEM_TYPE
035_02_01 Delete a Context Source Registration if the Id is not present
    [Tags]    csr-delete    5_9_4
    ${EMPTY}
    ${EMPTY}    405    ${EMPTY}
035_02_02 Delete a Context Source Registration if the Id is not a valid URI
    [Tags]    csr-delete    5_9_4
    invalidURI
    invalidURI    400    ${ERROR_TYPE_BAD_REQUEST_DATA}


*** Keywords ***
Delete A Context Source
    [Documentation]    Check that you cannot delete a context source registration under some conditions
    [Arguments]    ${invalid_registration_id}
    [Arguments]    ${invalid_registration_id}    ${expected_status_code}    ${problem_type}
    ${response}=    Delete Context Source Registration With Return    ${invalid_registration_id}
    Check Response Status Code    400    ${response.status_code}
    Check Response Status Code    ${expected_status_code}    ${response.status_code}
    IF    "${problem_type}"!="${EMPTY}"
        Check Response Body Containing ProblemDetails Element Containing Type Element set to
        ...    ${response.json()}
        ...    ${problem_type}
        Check Response Body Containing ProblemDetails Element Containing Title Element    ${response.json()}
    END

Delete Created Context Source Registrations
    Delete Context Source Registration    ${registration_id}
Loading