Unverified Commit e70e4008 authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

feat: add TCs for multivalued relationships

parent 196d184e
Loading
Loading
Loading
Loading
+88 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that entities can be queried with a multivalued relationship

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

Suite Setup         Create Initial Entity
Suite Teardown      Delete Created Entity
Test Template       Query Entities With Multivalued Relationship


*** Variables ***
${entity_with_multivalued_relationship_filename}=     building-multivalued-relationship.jsonld
${linked_entity_filename}=      city-minimal.jsonld


*** Test Cases ***    JOIN    OPTIONS    EXPECTATION_FILENAME
019_30_01 Query Normalized
    [Documentation]    Check that entities with a multivalued relationship can be queried
    [Tags]    e-query    5_7_2    since_v1.8.1
    ${EMPTY}    ${EMPTY}    buildings-multivalued-relationship-normalized-019-30-01.json
019_30_02 Query Simplified
    [Documentation]    Check that entities with a multivalued relationship can be queried in simplified representation
    [Tags]    e-query    5_7_2    since_v1.8.1
    ${EMPTY}    keyValues    buildings-multivalued-relationship-simplified-019-30-02.json
019_30_03 Query Inline Normalized
    [Documentation]    Check that entities with a multivalued relationship can be queried with inline linked entities
    [Tags]    e-query    5_7_2    4_5_23    since_v1.8.1
    inline    ${EMPTY}    linked-entity-retrieval/buildings-multivalued-relationship-inline-019-30-03.json
019_30_04 Query Flat Normalized
    [Documentation]    Check that entities with a multivalued relationship can be queried with flat linked entities
    [Tags]    e-query    5_7_2    4_5_23    since_v1.8.1
    flat    ${EMPTY}    linked-entity-retrieval/buildings-multivalued-relationship-flat-019-30-04.json
019_30_05 Query Inline Simplified
    [Documentation]    Check that entities with a multivalued relationship can be queried with inline linked entities in simplified representation
    [Tags]    e-query    5_7_2    4_5_23    since_v1.8.1
    inline    keyValues    linked-entity-retrieval/buildings-multivalued-relationship-inline-simplified-019-30-05.json

*** Keywords ***
Query Entities With Multivalued Relationship
    [Documentation]    Check that entities can be queried with a multivalued relationship and linked entities
    [Arguments]    ${join}    ${options}    ${expectation_filename}
    ${join_level}=    Set Variable If    '${join}' == '${EMPTY}'    ${EMPTY}    1

    ${response}=    Query Entities
    ...    entity_ids=${initial_entity_id}
    ...    entity_types=Building
    ...    options=${options}
    ...    join=${join}
    ...    joinLevel=${join_level}
    ...    context=${ngsild_test_suite_context}

    Check Response Status Code    200    ${response.status_code}
    Check Response Body Content
    ...    expectation_filename=${expectation_filename}
    ...    response_body=${response.json()}

Create Initial Entity
    ${initial_entity_id}=    Catenate    ${BUILDING_ID_PREFIX}019-30
    Set Suite Variable    ${initial_entity_id}
    ${response}=    Create Entity Selecting Content Type
    ...    ${entity_with_multivalued_relationship_filename}
    ...    ${initial_entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${response.status_code}

    ${first_linked_entity_id}=    Catenate    ${CITY_ID_PREFIX}Paris
    Set Suite Variable    ${first_linked_entity_id}
    ${response}=    Create Entity Selecting Content Type
    ...    ${linked_entity_filename}
    ...    ${first_linked_entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${response.status_code}

    ${second_linked_entity_id}=    Catenate    ${CITY_ID_PREFIX}Lyon
    Set Suite Variable    ${second_linked_entity_id}
    ${response}=    Create Entity Selecting Content Type
    ...    ${linked_entity_filename}
    ...    ${second_linked_entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${response.status_code}

Delete Created Entity
    Delete Entity    ${initial_entity_id}
    Delete Entity    ${first_linked_entity_id}
    Delete Entity    ${second_linked_entity_id}
+88 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that an entity can be retrieved with a multivalued relationship

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

Suite Setup         Create Initial Entity
Suite Teardown      Delete Created Entity
Test Template       Retrieve Entity With Multivalued Relationship


*** Variables ***
${linking_entity_filename}=     building-multivalued-relationship.jsonld
${linked_entity_filename}=      city-minimal.jsonld


*** Test Cases ***    JOIN    OPTIONS    EXPECTATION_FILENAME
018_22_01 Retrieve Normalized
    [Documentation]    Check that an entity with a multivalued relationship can be retrieved
    [Tags]    e-retrieve    5_7_1    since_v1.8.1
    ${EMPTY}    ${EMPTY}    building-multivalued-relationship-normalized-018-22-01.json
018_22_02 Retrieve Simplified
    [Documentation]    Check that an entity with a multivalued relationship can be retrieved in simplified representation
    [Tags]    e-retrieve    5_7_1    since_v1.8.1
    ${EMPTY}    keyValues    building-multivalued-relationship-simplified-018-22-02.json
018_22_03 Retrieve Normalized With Inline Linked Entity Retrieval
    [Documentation]    Check that an entity with a multivalued relationship can be retrieved with inline linked entities
    [Tags]    e-retrieve    5_7_1    4_5_23    since_v1.8.1
    inline    ${EMPTY}    linked-entity-retrieval/building-multivalued-relationship-inline-018-22-03.json
018_22_04 Retrieve Normalized With Flat Linked Entity Retrieval
    [Documentation]    Check that an entity with a multivalued relationship can be retrieved with flat linked entities
    [Tags]    e-retrieve    5_7_1    4_5_23    since_v1.8.1
    flat    ${EMPTY}    linked-entity-retrieval/building-multivalued-relationship-flat-018-22-04.json
018_22_05 Retrieve Simplified With Inline Linked Entity Retrieval
    [Documentation]    Check that an entity with a multivalued relationship can be retrieved with inline linked entities in simplified representation
    [Tags]    e-retrieve    5_7_1    4_5_23    since_v1.8.1
    inline    keyValues    linked-entity-retrieval/building-multivalued-relationship-inline-simplified-018-22-05.json


*** Keywords ***
Retrieve Entity With Multivalued Relationship
    [Documentation]    Check that an entity can be retrieved with a multivalued relationship
    [Arguments]    ${join}    ${options}    ${expectation_filename}
    ${join_level}=    Set Variable If    '${join}' == '${EMPTY}'    ${EMPTY}    1

    ${response}=    Retrieve Entity
    ...    id=${linking_entity_id}
    ...    join=${join}
    ...    joinLevel=${join_level}
    ...    options=${options}
    ...    context=${ngsild_test_suite_context}

    Check Response Status Code    200    ${response.status_code}
    Check Response Body Content
    ...    expectation_filename=${expectation_filename}
    ...    response_body=${response.json()}

Create Initial Entity
    ${linking_entity_id}=    Catenate    ${BUILDING_ID_PREFIX}018-22
    Set Suite Variable    ${linking_entity_id}
    ${response}=    Create Entity Selecting Content Type
    ...    ${linking_entity_filename}
    ...    ${linking_entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${response.status_code}

    ${first_linked_entity_id}=    Catenate    ${CITY_ID_PREFIX}Paris
    Set Suite Variable    ${first_linked_entity_id}
    ${response}=    Create Entity Selecting Content Type
    ...    ${linked_entity_filename}
    ...    ${first_linked_entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${response.status_code}

    ${second_linked_entity_id}=    Catenate    ${CITY_ID_PREFIX}Lyon
    Set Suite Variable    ${second_linked_entity_id}
    ${response}=    Create Entity Selecting Content Type
    ...    ${linked_entity_filename}
    ...    ${second_linked_entity_id}
    ...    ${CONTENT_TYPE_LD_JSON}
    Check Response Status Code    201    ${response.status_code}

Delete Created Entity
    Delete Entity    ${linking_entity_id}
    Delete Entity    ${first_linked_entity_id}
    Delete Entity    ${second_linked_entity_id}
+55 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that one can query the temporal evolution of entities with a multivalued relationship

Resource            ${EXECDIR}/resources/ApiUtils/Common.resource
Resource            ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource
Resource            ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource

Suite Setup         Create Temporal Entity
Suite Teardown      Delete Initial Temporal Entity
Test Template       Query Temporal Entities With Multivalued Relationship


*** Variables ***
${vehicle_payload_file}=    vehicle-temporal-representation-multivalued-relationship.jsonld


*** Test Cases ***    REPRESENTATION    EXPECTATION_FILENAME
021_26_01 Query The Temporal Evolution Of Entities With A Multivalued Relationship
    [Tags]    te-query    5_7_4    since_v1.8.1
    ${EMPTY}    vehicle-temporal-representation-multivalued-relationship.json
021_26_02 Query The Simplified Temporal Evolution Of Entities With A Multivalued Relationship
    [Tags]    te-query    5_7_4    4_5_9    since_v1.8.1
    temporalValues    vehicle-temporal-representation-multivalued-relationship-simplified.json


*** Keywords ***
Query Temporal Entities With Multivalued Relationship
    [Documentation]    Check that one can query the temporal evolution of entities with a multivalued relationship
    [Arguments]    ${representation}    ${expectation_filename}
    ${response}=    Query Temporal Representation Of Entities
    ...    entity_ids=${temporal_entity_representation_id}
    ...    entity_types=Vehicle
    ...    timerel=after
    ...    timeAt=2020-07-01T12:05:00Z
    ...    options=${representation}
    ...    context=${ngsild_test_suite_context}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing EntityTemporal element
    ...    ${expectation_filename}
    ...    ${temporal_entity_representation_id}
    ...    ${response.json()[0]}


Create Temporal Entity
    ${temporal_entity_representation_id}=    Catenate    ${VEHICLE_ID_PREFIX}021-26
    ${create_response}=    Create Temporal Representation Of Entity
    ...    ${vehicle_payload_file}
    ...    ${temporal_entity_representation_id}
    Check Response Status Code    201    ${create_response.status_code}
    Set Suite Variable    ${temporal_entity_representation_id}

Delete Initial Temporal Entity
    Delete Temporal Representation Of Entity    ${temporal_entity_representation_id}
+52 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that one can retrieve the temporal evolution of an entity with a multivalued relationship

Resource            ${EXECDIR}/resources/ApiUtils/Common.resource
Resource            ${EXECDIR}/resources/ApiUtils/TemporalContextInformationConsumption.resource
Resource            ${EXECDIR}/resources/ApiUtils/TemporalContextInformationProvision.resource
Resource            ${EXECDIR}/resources/AssertionUtils.resource
Resource            ${EXECDIR}/resources/JsonUtils.resource

Suite Setup         Create Temporal Entity
Suite Teardown      Delete Initial Temporal Entity
Test Template       Retrieve Temporal Entity With Multivalued Relationship


*** Variables ***
${vehicle_payload_file}=    vehicle-temporal-representation-multivalued-relationship.jsonld


*** Test Cases ***    REPRESENTATION    EXPECTATION_FILENAME
020_24_01 Retrieve The Temporal Evolution Of An Entity With A Multivalued Relationship
    [Tags]    te-retrieve    5_7_3    since_v1.8.1
    ${EMPTY}    vehicle-temporal-representation-multivalued-relationship.json
020_24_02 Retrieve The Simplified Temporal Evolution Of An Entity With A Multivalued Relationship
    [Tags]    te-retrieve    5_7_3    4_5_9    since_v1.8.1
    temporalValues    vehicle-temporal-representation-multivalued-relationship-simplified.json


*** Keywords ***
Retrieve Temporal Entity With Multivalued Relationship
    [Documentation]    Check that one can retrieve the temporal evolution of an entity with a multivalued relationship
    [Arguments]    ${representation}    ${expectation_filename}
    ${response}=    Retrieve Temporal Representation Of Entity
    ...    temporal_entity_representation_id=${temporal_entity_representation_id}
    ...    options=${representation}
    ...    context=${ngsild_test_suite_context}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing EntityTemporal element
    ...    ${expectation_filename}
    ...    ${temporal_entity_representation_id}
    ...    ${response.json()}


Create Temporal Entity
    ${temporal_entity_representation_id}=    Generate Random Vehicle Entity Id
    ${create_response}=    Create Temporal Representation Of Entity
    ...    ${vehicle_payload_file}
    ...    ${temporal_entity_representation_id}
    Check Response Status Code    201    ${create_response.status_code}
    Set Suite Variable    ${temporal_entity_representation_id}

Delete Initial Temporal Entity
    Delete Temporal Representation Of Entity    ${temporal_entity_representation_id}
+3 −0
Original line number Diff line number Diff line
@@ -27,6 +27,9 @@ Test Template Create Entity Scenarios
001_01_05 EntityWithNonCoreGeoProperty
    [Tags]    e-create    5_6_1
    building-non-core-geoproperty-attribute.jsonld    application/ld+json
001_01_06 EntityWithMultivaluedRelationship
    [Tags]    e-create    5_6_1    since_v1.8.1
    building-multivalued-relationship.jsonld    application/ld+json


*** Keywords ***
Loading