Commit 61e39c53 authored by Benedetta Arena's avatar Benedetta Arena
Browse files

Merge branch 'develop' into 86-add-interoperability-test-cases

parents b9cc1bed 01a8b81f
Loading
Loading
Loading
Loading
+9 −10
Original line number Diff line number Diff line
*** Settings ***
Documentation       Three brokers are set up A, B and C. A has two registrations, one inclusive for the entities created in B and one exclusive for the entity created in C. 
...                 Check that the same entity created in B and C can be returned from A.
Documentation       Three brokers are set up A, B and C. A has two registrations, one inclusive for the entities created in B and one exclusive for the entity created in C. Check that the same entity created in B and C can be returned from A.

Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
@@ -22,26 +21,27 @@ ${b2_url}
${b3_url}

*** Test Cases ***
IOP_CNF_01_01 Retrieve Entities In Three Different Brokers
    [Documentation]    Check that the entity created in A only some attributes of the entity. The agent should also check that the entity in B is the full entity.
IOP_CNF_01_01 Retrieve OffStreetParking:1
    [Documentation]    Pre-conditions: no user context. Data only on leaves. B contains OffStreetParking1 and OffStreetParking2. C contains OffStreetParking2.
    ...                Registrations established: Inclusive in A to B. Exclusive in A to C.
    [Tags]    since_v1.6.1    iop    4_3_3    cf_06    additive-inclusive    proxy-exclusive    4_3_6    5_7_1

    #Client retrieves OffStreetParking:1 in A and checks for a successful response. 
    ${response}=    Retrieve Entity    ${entity_id1}    broker_url=${b1_url}
    Check Response Status Code    200    ${response.status_code}
    Should Contain   ${response.json()}    availableSpotsNumber
    Should Contain   ${response.json()}    totalSpotsNumber

    #Client retrieves OffStreetParking:1 in B.
    ${expected_payload}=    Load Entity    ${first_entity_payload_filename}    ${entity_id1}
    ${response}=    Retrieve Entity    ${entity_id1}   broker_url=${b2_url}
    Check Response Status Code    200    ${response.status_code}

    #Client checks that the entity returned is the full entity.
    Should Be Equal    ${response.json()}    ${expected_payload}

*** Keywords ***
Setup Initial Context Source Registrations
    [Documentation]    Pre-conditions: no user context. Data only on leaves.
    ...                Broker B contains OffStreetParking1 and OffStreetParking2.
    ...                Broker C contains OffStreetParking2.
    ...                CSR in A to B and in A to C.
    ${entity_id1}=    Generate Random Parking Entity Id
    Set Suite Variable    ${entity_id1}
    ${response}=    Create Entity    ${first_entity_payload_filename}    ${entity_id1}    broker_url=${b2_url}
@@ -77,7 +77,6 @@ Setup Initial Context Source Registrations
    Check Response Status Code    201    ${response.status_code}

Delete Entities And Delete Registrations
    [Documentation]    Post-conditions: no user context. no data in any broker. no registrations in any broker.
    Delete Context Source Registration    ${registration_id1}    broker_url=${b1_url}
    Delete Context Source Registration    ${registration_id2}    broker_url=${b1_url}
    Delete Entity    ${entity_id1}    broker_url=${b2_url}
+10 −14
Original line number Diff line number Diff line
*** Settings ***
Documentation       Three brokers are set up A, B and C. A has two registrations, one inclusive for the the entity created in B and one exclusive for the entity created in C. 
...                 Check that the entity returned from A has attributes from both entities in B and C.
Documentation       Three brokers are set up A, B and C. A has two registrations, one inclusive for the the entity created in B and one exclusive for the entity created in C. Check that the entity returned from A has attributes from both entities in B and C.

Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
@@ -22,31 +21,29 @@ ${b2_url}
${b3_url}

*** Test Cases ***
IOP_CNF_01_02 Retrieve Entities In Three Different Brokers
    [Documentation]    The entity returned from A should have attributes from both entities in B and C.
IOP_CNF_01_02 Retrieve OffStreetParking:2
    [Documentation]    Pre-conditions: no user context. Data only on leaves. B contains OffStreetParking2 without location. C contains OffStreetParking2.
    ...                Registrations established: Inclusive in A to B. Exclusive in A to C.
    [Tags]    since_v1.6.1    iop    4_3_3    cf_06    additive-inclusive    proxy-exclusive    4_3_6    5_7_1

    #Client retrieves OffStreetParking:2 in A and checks for a successful response.
    ${response}=    Retrieve Entity    ${entity_id}    broker_url=${b1_url}
    Check Response Status Code    200    ${response.status_code}
    ${payload}=    Set To Dictionary    ${response.json()}

    #Client retrieves OffStreetParking:2 in B and C.
    ${response}=    Retrieve Entity    ${entity_id}   broker_url=${b2_url}
    ${first_expected_payload}=    Set To Dictionary    ${response.json()}
    ${response}=    Retrieve Entity    ${entity_id}   broker_url=${b3_url}
    ${second_expected_payload}=    Set To Dictionary    ${response.json()}

    ${response}=    Retrieve Entity    ${entity_id}   broker_url=${b2_url}
    Check Response Status Code    200    ${response.status_code}
    ${payload}=    Set To Dictionary    ${response.json()}
    #Client checks that the entity returned from A has attributes from both entities in B and C.
    Should Be Equal    ${payload}[availableSpotNumbers][value]    ${first_expected_payload}[availableSpotNumbers][value]
    Should Be Equal    ${payload}[totalSpotsNumber][value]    ${first_expected_payload}[totalSpotsNumber][value]
    Should Be Equal    ${payload}[location][value]    ${second_expected_payload}[location][value]

*** Keywords ***
Setup Initial Context Source Registrations
    [Documentation]    Pre-conditions: no user context. Data only on leaves.
    ...                Broker B contains OffStreetParking2 without location.
    ...                Broker C contains OffStreetParking2.
    ...                CSR in A to B and in A to C.
    ${entity_id}=    Generate Random Parking Entity Id
    Set Suite Variable    ${entity_id}
    ${response}=    Create Entity    ${entity_payload_filename}    ${entity_id}    broker_url=${b2_url}
@@ -77,7 +74,6 @@ Setup Initial Context Source Registrations
    Check Response Status Code    201    ${response.status_code}

Delete Entities And Delete Registrations
    [Documentation]    Post-conditions: no user context. no data in any broker. no registrations in any broker.
    Delete Context Source Registration    ${registration_id1}    broker_url=${b1_url}
    Delete Context Source Registration    ${registration_id2}    broker_url=${b1_url}
    Delete Entity    ${entity_id}    broker_url=${b2_url}
+7 −10
Original line number Diff line number Diff line
*** Settings ***
Documentation       Four brokers are set up A, B, C and D. A has three registrations, one inclusive for the entity created in B, one redirect for the entity created in C and one redirect for the entity created in D.
...                 Check that the entity returned from A has attributes from the entities in B and C.
Documentation       Four brokers are set up A, B, C and D. A has three registrations, one inclusive for the entity created in B, one redirect for the entity created in C and one redirect for the entity created in D. Check that the entity returned from A has attributes from the entities in B and C.

Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
@@ -24,32 +23,31 @@ ${b3_url}
${b4_url}

*** Test Cases ***
IOP_CNF_02_01 Retrieve Entities In Four Different Brokers
    [Documentation]    Check that entities returned from A has attributes from both entities in B and C.
IOP_CNF_02_01 Retrieve OffStreetParking:1
    [Documentation]    Pre-conditions: no user context. Data only on leaves. B contains OffStreetParking1 without location. C contains OffStreetParking1. D contains OffStreetParking2.
    ...                Registrations established: Inclusive in A to B. Redirect in A to C. Redirect in A to D.
    [Tags]    since_v1.6.1    iop    4_3_3    cf_06    additive-inclusive    proxy-redirect    4_3_6    5_7_1

    #Client retrieves OffStreetParking:1 in A and checks for a partial successful. The entity returned should be the whole entity.
    ${response}=    Retrieve Entity    ${entity_id}    broker_url=${b1_url}
    Check Response Status Code    207    ${response.status_code}
    ${payload}=    Set To Dictionary    ${response.json()}
    Should Be Equal    ${payload}    ${first_full_entity_payload_filename}

    #Client retrieves OffStreetParking:1 in B and C.
    ${response}=    Retrieve Entity    ${entity_id}    broker_url=${b2_url}
    ${first_expected_payload}=    Set To Dictionary    ${response.json()}

    ${response}=    Retrieve Entity    ${entity_id}    broker_url=${b3_url}
    ${second_expected_payload}=    Set To Dictionary    ${response.json()}

    #Client checks that the entity returned from A has attributes from the entities in B and C.
    Should Be Equal    ${payload}[availableSpotNumbers][value]    ${first_expected_payload}[availableSpotNumbers][value]
    Should Be Equal    ${payload}[totalSpotsNumber][value]    ${first_expected_payload}[totalSpotsNumber][value]
    Should Be Equal    ${payload}[location][value]    ${second_expected_payload}[location][value]

*** Keywords ***
Setup Initial Context Source Registrations
    [Documentation]    Pre-conditions: no user context. Data only on leaves.
    ...                Broker B contains OffStreetParking1 without location.
    ...                Broker C contains OffStreetParking1.
    ...                Broker D contains OffStreetParking2.
    ...                CSR in A to B, in A to C and in A to D.
    ${entity_id}=    Generate Random Parking Entity Id
    Set Suite Variable    ${entity_id}
    ${response}=    Create Entity    ${entity_payload_filename}    ${entity_id}    broker_url=${b2_url}
@@ -93,7 +91,6 @@ Setup Initial Context Source Registrations
    Check Response Status Code    201    ${response.status_code}

Delete Entities And Delete Registrations
    [Documentation]    Post-conditions: no user context. no data in any broker. no registrations in any broker.
    Delete Context Source Registration    ${registration_id1}    broker_url=${b1_url}
    Delete Context Source Registration    ${registration_id2}    broker_url=${b1_url}
    Delete Context Source Registration    ${registration_id3}    broker_url=${b1_url}
+7 −10
Original line number Diff line number Diff line
*** Settings ***
Documentation       Four brokers are set up A, B, C and D. A has three registrations, one inclusive for the entity created in B, one redirect for the entity created in C and one redirect for the entity created in D. 
...                 Check that the entity returned from C has the same location attribute found in A.
Documentation       Four brokers are set up A, B, C and D. A has three registrations, one inclusive for the entity created in B, one redirect for the entity created in C and one redirect for the entity created in D. Check that the entity returned from C has the same location attribute found in A.

Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
@@ -24,27 +23,26 @@ ${b3_url}
${b4_url}

*** Test Cases ***
IOP_CNF_02_02 Retrieve Entities In Four Different Brokers
    [Documentation]    Check that the entity returned from C has the same location attribute found in A.
IOP_CNF_02_02 Retrieve OffStreetParking:1 Location Attribute
    [Documentation]    Pre-conditions: no user context. Data only on leaves. B contains OffStreetParking1. C contains OffStreetParking1 with location and name only. D contains OffStreetParking2.
    ...                Registrations established: Inclusive in A to B. Redirect in A to C. Redirect in A to D.
    [Tags]    since_v1.6.1    iop    4_3_3    cf_06    additive-inclusive    proxy-redirect    4_3_6    5_7_1

    #Client retrieves OffStreetParking:1 in A and checks for a partial successful. The entity returned should contain the location attribute.
    ${response}=    Retrieve Entity    ${entity_id}    broker_url=${b1_url}
    Check Response Status Code    207    ${response.status_code}
    ${payload}=    Set To Dictionary    ${response.json()}
    Should Contain    ${payload}    location

    #Client retrieves OffStreetParking:1 in C with local=true.
    ${response}=    Retrieve Entity    ${entity_id}    broker_url=${b3_url}    local=true
    ${expected_payload}=    Set To Dictionary    ${response.json()}

    #Client checks that the location attribute in C is the same as the one in A.
    Should Be Equal    ${payload}[location][value]    ${expected_payload}[location][value]

*** Keywords ***
Setup Initial Context Source Registrations
    [Documentation]    Pre-conditions: no user context. Data only on leaves.
    ...                Broker B contains OffStreetParking1.
    ...                Broker C contains OffStreetParking1 with location and name only.
    ...                Broker D contains OffStreetParking2.
    ...                CSR in A to B, in A to C and in A to D.
    ${entity_id}=    Generate Random Parking Entity Id
    Set Suite Variable    ${entity_id}
    ${response}=    Create Entity    ${first_full_entity_payload_filename}    ${entity_id}    broker_url=${b2_url}
@@ -88,7 +86,6 @@ Setup Initial Context Source Registrations
    Check Response Status Code    201    ${response.status_code}

Delete Entities And Delete Registrations
    [Documentation]    Post-conditions: no user context. no data in any broker. no registrations in any broker.
    Delete Context Source Registration    ${registration_id1}    broker_url=${b1_url}
    Delete Context Source Registration    ${registration_id2}    broker_url=${b1_url}
    Delete Context Source Registration    ${registration_id3}    broker_url=${b1_url}
+7 −11
Original line number Diff line number Diff line
*** Settings ***
Documentation       Four brokers are set up A, B, C and D. A has three registrations, one auxiliary for the entity created in B, one inclusive for the entity created in C and one inclusive for the entity created in D. 
...                 Check that a partial response was returned from A and that the entity matches the one in B and it does not contain the attribute location found in C.
Documentation       Four brokers are set up A, B, C and D. A has three registrations, one auxiliary for the entity created in B, one inclusive for the entity created in C and one inclusive for the entity created in D. Check that a partial response was returned from A and that the entity matches the one in B and it does not contain the attribute location found in C.

Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource
Resource            ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource
@@ -25,15 +24,18 @@ ${b3_url}
${b4_url}

*** Test Cases ***
IOP_CNF_03_01 Retrieve Entities In Four Different Brokers
    [Documentation]    Check the retrieval of entities in different brokers. The entity returned from A should have some attributes that match the entity in B and should not contain the location attribute found in C.
IOP_CNF_03_01 Retrieve OffStreetParking:1
    [Documentation]    Pre-conditions: no user context. Data on every broker. A contains OffStreetParking1 without location. B contains OffStreetParking1. C contains OffStreetParking1 without location. D contains OffStreetParking2.
    ...                Registrations established: Auxiliary in A to B. Inclusive in A to C. Inclusive in A to D.
    [Tags]    since_v1.6.1    iop    4_3_3    cf_06    additive-inclusive    additive-auxiliary    4_3_6    5_7_1

    #Client retrieves OffStreetParking:1 in A and checks for a partial successful. The entity returned should not contain the location attribute.
    ${response}=    Retrieve Entity    ${entity_id}    broker_url=${b1_url}
    Check Response Status Code    207    ${response.status_code}
    ${payload}=    Set To Dictionary    ${response.json()}
    Should Not Contain    ${payload}    location

    #Client retrieves OffStreetParking:1 in B, C and D with the local=true flag.
    ${response}=    Retrieve Entity    ${entity_id}    broker_url=${b1_url}    local=true
    ${first_payload}=    Set To Dictionary    ${response.json()}
    ${response}=    Retrieve Entity    ${entity_id}    broker_url=${b2_url}    local=true
@@ -41,17 +43,12 @@ IOP_CNF_03_01 Retrieve Entities In Four Different Brokers
    ${response}=    Retrieve Entity    ${entity_id}    broker_url=${b3_url}    local=true
    ${third_payload}=    Set To Dictionary    ${response.json()}

    #Client checks that the entity returned from A should have the same attributes as the one in B and it should not contain the attribute location found in C.
    Should Be Equal    ${payload}    ${first_payload}
    Should Not Contain    ${payload}[location]    ${second_payload}[location]

*** Keywords ***
Setup Initial Context Source Registrations
    [Documentation]    Pre-conditions: no user context. Data on every broker.
    ...                Broker A contains OffStreetParking1 without location.
    ...                Broker B contains OffStreetParking1.
    ...                Broker C contains OffStreetParking1 without location.
    ...                Broker D contains OffStreetParking2.
    ...                CSR in A to B, in A to C and in A to D.
    ${entity_id}=    Generate Random Parking Entity Id
    Set Suite Variable    ${entity_id}
    ${response}=    Create Entity    ${entity_payload_filename}    ${entity_id}    broker_url=${b1_url}
@@ -97,7 +94,6 @@ Setup Initial Context Source Registrations
    Check Response Status Code    201    ${response.status_code}

Delete Entities And Delete Registrations
    [Documentation]    Post-conditions: no user context. no data in any broker. no registrations in any broker.
    Delete Context Source Registration    ${registration_id1}    broker_url=${b1_url}
    Delete Context Source Registration    ${registration_id2}    broker_url=${b1_url}
    Delete Context Source Registration    ${registration_id3}    broker_url=${b1_url}
Loading