Commit bd8da9c3 authored by lopezaguilar's avatar lopezaguilar
Browse files

Adding ImplicitlyCreated context and Core Context management with documentation

parent 22b0c4d1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ server to listen to notifications (the address must be accessible by the context
Default value: `0.0.0.0` and `8085`.
- `context_source_host` and `context_source_port` : The address and port used for the context source. 
Default value: `0.0.0.0` and `8086`.
- `core_context`: The core context used by the Context Broker.

When you execute locally the tests, you can leave the default values as they are. NGSI-LD Test Suite provides
a mockup services to provide the notification functionality and therefore the notification_server_host can be
+5 −5
Original line number Diff line number Diff line
@@ -13,19 +13,19 @@ ${reason_204}= No Content


*** Test Cases ***    DETAILS    KIND
052_04_01 List @contexts with no details and kind equal to other and not previously created @context
052_04_01 List @contexts with no details and kind set to other and not previously created @context
    [Tags]    ctx-list    5_13_3
    ${EMPTY}    other
052_04_02 List @contexts with details equal to false and kind equal to implicitlycreated and not previously created @context
052_04_02 List @contexts with details set to other and no kind and not previously created @context
    [Tags]    ctx-list    5_13_3
    other    ${EMPTY}
052_04_03 List @contexts with details equal to false and kind equal to other and not previously created @context
052_04_03 List @contexts with details set to other and kind set to other and not previously created @context
    [Tags]    ctx-list    5_13_3
    other    other
052_04_04 List @contexts with no details and kind equal to other and not previously created @context
052_04_04 List @contexts with details set to true and kind set to other and not previously created @context
    [Tags]    ctx-list    5_13_3
    true    other
052_04_05 List @contexts with details equal to false and kind equal to implicitlycreated and not previously created @context
052_04_05 List @contexts with details set to other and kind set to Hosted and not previously created @context
    [Tags]    ctx-list    5_13_3
    other    Hosted

+4 −4
Original line number Diff line number Diff line
@@ -18,16 +18,16 @@ ${reason_204}= No Content


*** Test Cases ***    DETAILS    KIND    COUNT
052_05_01 List @contexts with details equal to false and no kind and with previously several add @context
052_05_01 List @contexts with details set to true and no kind and with previously several add @contexts
    [Tags]    ctx-list    5_13_3
    true    ${EMPTY}    4
052_05_02 List @contexts with details equal to false and kind equal to hosted and with previously several add @context
052_05_02 List @contexts with details set to true and kind set to hosted and with previously several add @contexts
    [Tags]    ctx-list    5_13_3
    true    Hosted    3
052_05_03 List @contexts with details equal to false and kind equal to cached abd with previously several add @context
052_05_03 List @contexts with details set to true and kind set to cached abd with previously several add @contexts
    [Tags]    ctx-list    5_13_3
    true    Cached    1
052_05_04 List @contexts with details equal to false and kind equal to implicitlycreated and with previously several add @context
052_05_04 List @contexts with details set to true and kind set to implicitlycreated and with previously several add @contexts
    [Tags]    ctx-list    5_13_3
    true    ImplicitlyCreated    0

+90 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that you can list all the @context available in the broker with no previous add @context

Resource            ${EXECDIR}/resources/ApiUtils/jsonldContext.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationSubscription.resource

Test Setup          Create initial ImplicitlyCreated @context
Test Template       List @contexts with no previous created @context
Test Teardown       Delete Initial @context Data

*** Variables ***
${subscription_payload_file_path}=      jsonldContext/subscription-with-implicitlycreated-contexts.jsonld
${filename}=        @context-minimal-valid.json
${reason_200}=      OK
${reason_204}=      No Content


*** Test Cases ***    DETAILS    KIND    COUNT
052_06_01 List @contexts with neither details or kind and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3
    ${EMPTY}    ${EMPTY}    4
052_06_02 List @contexts with no details and kind set to hosted and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3
    ${EMPTY}    Hosted    0
052_06_03 List @contexts with no details and kind set to cached and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3
    ${EMPTY}    Cached    3
052_06_04 List @contexts with no details and kind set to implicitlycreated and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3
    ${EMPTY}    ImplicitlyCreated    1
052_06_05 List @contexts with details set to false and no kind and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3
    false    ${EMPTY}    4
052_06_06 List @contexts with details set to false and kind equal to hosted and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3
    false    Hosted    0
052_06_07 List @contexts with details set to false and kind equal to cached and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3
    false    Cached    3
052_06_08 List @contexts with details set to false and kind equal to implicitlycreated and a created ImplicitlyCreated @context
    [Tags]    ctx-list    5_13_3
    false    ImplicitlyCreated    1

*** Keywords ***
List @contexts with no previous created @context
    [Documentation]    Check that you can list @contexts
    [Arguments]    ${details}    ${kind}    ${count}
    ${response}=    List @contexts    ${details}    ${kind}

    Check Response Status Code    200    ${response.status_code}
    Check Response Reason set to    ${response.reason}    ${reason_200}
    Check Context Response Body Containing a list of identifiers
    ...    response_body=${response.json()}
    ...    expected_length=${count}
    ...    list_contexts=${list_contexts}

Create initial ImplicitlyCreated @context
    ${subscription_payload}=    Load JSON From File    ${EXECDIR}/data/${subscription_payload_file_path}

    ${subscription_id}=    Get Value From JSON    ${subscription_payload}    $..id
    ${subscription_id}=    Get From List    ${subscription_id}    0

    ${list_contexts}=    Get Value From JSON    ${subscription_payload}    $..@context
    ${list_contexts}=    Get From List    ${list_contexts}    0

    ${response}=    Create Subscription
    ...    ${subscription_id}
    ...    ${subscription_payload_file_path}
    ...    ${CONTENT_TYPE_LD_JSON}

    ${response}=    List @contexts    true    ImplicitlyCreated

    Check Response Status Code    200    ${response.status_code}

    ${data}=    Get From List    ${response.json()}    0
    ${implicit_id}=    Get From Dictionary    ${data}    URL
    Append To List    ${list_contexts}    ${implicit_id}

    Check Context Response Body Containing numberOfHits value    ${data}    1

    Set Global Variable    ${implicit_id}
    Set Suite Variable    ${subscription_id}
    Set Suite Variable    ${list_contexts}

Delete Initial @context Data
    Delete Subscription    ${subscription_id}
    FOR    ${uri}    IN    @{list_contexts}
        Log    URI: ${uri}
        Delete a @context    ${uri}
    END
+1 −1
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ ${reason_204}= No Content


*** Test Cases ***    DETAILS    CONTEXT_TYPE
053_02_01 Serve a @context with details equal to True
053_02_01 Serve a @context with details set to True
    [Tags]    ctx-serve    5_13_4
    true    Hosted

Loading