Commit a3d2e675 authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

Merge branch 'feature/add-tps-for-query-temporal-evolution-of-entities' into 'develop'

feature: add tps for query temporal evolution of entities

See merge request !7
parents 590f55a7 e842789e
Loading
Loading
Loading
Loading
+52 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can query the temporal evolution of entities
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup      Setup Initial Entities
Suite Teardown      Delete Initial Entities
Test Template  Query the temporal evolution of entities

*** Variable ***
${vehicule_id_prefix}=  urn:ngsi-ld:Vehicle:
${bus_id_prefix}=  urn:ngsi-ld:Bus:
${first_vehicle_payload_file}=  2020-08-vehicule-temporal-representation-sample.jsonld
${second_vehicle_payload_file}=  2020-09-vehicule-temporal-representation-sample.jsonld
${bus_payload_file}=  2020-08-bus-temporal-representation-sample.jsonld

*** Test Cases ***                        TIMEREL       TIMEAT                  EXPECTATION_FILE
After                                     after         2020-08-01T12:05:00Z    vehicles-temporal-representation-021-01-01-expectation.jsonld
Before                                    before        2020-09-01T13:05:00Z    vehicles-temporal-representation-021-01-02-expectation.jsonld


*** Keywords ***
Query the temporal evolution of entities
    [Arguments]  ${timerel}     ${timeAt}   ${expectation_file}
    [Documentation]  Check that you can query the temporal evolution of entities
    [Tags]  mandatory

    @{entity_types_to_be_retrieved}=  Create List   Vehicle

    Query Temporal Representation Of Entities   entity_types=${entity_types_to_be_retrieved}   timerel=${timerel}    timeAt=${timeAt}   context=${ngsild_test_suite_context}

    @{temporal_entities_representation_ids}=  Create List   ${first_temporal_entity_representation_id}  ${second_temporal_entity_representation_id}
    Check Response Status Code Set To  200
    Check Response Body Containing List Containing EntityTemporal elements      ${expectation_file}    ${temporal_entities_representation_ids}


Setup Initial Entities
    ${first_temporal_entity_representation_id}=     Generate Random Entity Id    ${vehicule_id_prefix}
    ${second_temporal_entity_representation_id}=     Generate Random Entity Id    ${vehicule_id_prefix}
    ${third_temporal_entity_representation_id}=     Generate Random Entity Id    ${bus_id_prefix}
    Create Temporal Representation Of Entity  ${first_vehicle_payload_file}     ${first_temporal_entity_representation_id}
    Create Temporal Representation Of Entity  ${second_vehicle_payload_file}     ${second_temporal_entity_representation_id}
    Create Temporal Representation Of Entity  ${bus_payload_file}     ${third_temporal_entity_representation_id}
    Set Suite Variable  ${first_temporal_entity_representation_id}
    Set Suite Variable  ${second_temporal_entity_representation_id}
    Set Suite Variable  ${third_temporal_entity_representation_id}

Delete Initial Entities
    Delete Temporal Representation Of Entity    ${first_temporal_entity_representation_id}
    Delete Temporal Representation Of Entity    ${second_temporal_entity_representation_id}
    Delete Temporal Representation Of Entity    ${third_temporal_entity_representation_id}
+41 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can query the temporal evolution of certain attributes of entities
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup      Setup Initial Entities
Suite Teardown      Delete Initial Entities

*** Variable ***
${vehicule_id_prefix}=  urn:ngsi-ld:Vehicle:
${first_vehicle_payload_file}=  2020-08-vehicule-temporal-representation-sample.jsonld
${second_vehicle_payload_file}=  2020-09-vehicule-temporal-representation-sample.jsonld
${expectation_file}=    vehicles-temporal-representation-021-02-expectation.jsonld

*** Test Case ***
Query the temporal evolution of certain attributes of entities
    [Documentation]  Check that you can query the temporal evolution of certain attributes of entities
    [Tags]  mandatory

    @{entity_types_to_be_retrieved}=  Create List   Vehicle
    @{temporal_attributes_to_be_retrieved}=  Create List   speed

    Query Temporal Representation Of Entities   entity_types=${entity_types_to_be_retrieved}   timerel=after    timeAt=2020-07-01T12:05:00Z   attrs=${temporal_attributes_to_be_retrieved}    context=${ngsild_test_suite_context}

    @{temporal_entities_representation_ids}=  Create List   ${first_temporal_entity_representation_id}  ${second_temporal_entity_representation_id}
    Check Response Status Code Set To  200
    Check Response Body Containing List Containing EntityTemporal elements      ${expectation_file}    ${temporal_entities_representation_ids}

*** Keywords ***
Setup Initial Entities
    ${first_temporal_entity_representation_id}=     Generate Random Entity Id    ${vehicule_id_prefix}
    ${second_temporal_entity_representation_id}=     Generate Random Entity Id    ${vehicule_id_prefix}
    Create Temporal Representation Of Entity  ${first_vehicle_payload_file}     ${first_temporal_entity_representation_id}
    Create Temporal Representation Of Entity  ${second_vehicle_payload_file}     ${second_temporal_entity_representation_id}
    Set Suite Variable  ${first_temporal_entity_representation_id}
    Set Suite Variable  ${second_temporal_entity_representation_id}

Delete Initial Entities
    Delete Temporal Representation Of Entity    ${first_temporal_entity_representation_id}
    Delete Temporal Representation Of Entity    ${second_temporal_entity_representation_id}
+40 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can query the temporal evolution of the last N instances of entities attributes
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup      Setup Initial Entities
Suite Teardown      Delete Initial Entities

*** Variable ***
${vehicule_id_prefix}=  urn:ngsi-ld:Vehicle:
${first_vehicle_payload_file}=  2020-08-vehicule-temporal-representation-multiple-instances-sample.jsonld
${second_vehicle_payload_file}=  2020-09-vehicule-temporal-representation-sample.jsonld
${expectation_file}=    vehicles-temporal-representation-021-03-expectation.jsonld

*** Test Case ***
Query the temporal evolution of the last N instances of entities attributes
    [Documentation]  Check that you can query the temporal evolution of the last N instances of entities attributes
    [Tags]  mandatory

    @{entity_types_to_be_retrieved}=  Create List   Vehicle

    Query Temporal Representation Of Entities   entity_types=${entity_types_to_be_retrieved}   timerel=after    timeAt=2020-07-01T12:05:00Z   lastN=${14}    context=${ngsild_test_suite_context}

    @{temporal_entities_representation_ids}=  Create List   ${first_temporal_entity_representation_id}  ${second_temporal_entity_representation_id}
    Check Response Status Code Set To  200
    Check Response Body Containing List Containing EntityTemporal elements      ${expectation_file}    ${temporal_entities_representation_ids}

*** Keywords ***
Setup Initial Entities
    ${first_temporal_entity_representation_id}=     Generate Random Entity Id    ${vehicule_id_prefix}
    ${second_temporal_entity_representation_id}=     Generate Random Entity Id    ${vehicule_id_prefix}
    Create Temporal Representation Of Entity  ${first_vehicle_payload_file}     ${first_temporal_entity_representation_id}
    Create Temporal Representation Of Entity  ${second_vehicle_payload_file}     ${second_temporal_entity_representation_id}
    Set Suite Variable  ${first_temporal_entity_representation_id}
    Set Suite Variable  ${second_temporal_entity_representation_id}

Delete Initial Entities
    Delete Temporal Representation Of Entity    ${first_temporal_entity_representation_id}
    Delete Temporal Representation Of Entity    ${second_temporal_entity_representation_id}
+40 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can query the temporal evolution of entities using a context
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup      Setup Initial Entities
Suite Teardown      Delete Initial Entities

*** Variable ***
${vehicule_id_prefix}=  urn:ngsi-ld:Vehicle:
${first_vehicle_payload_file}=  2020-08-vehicule-temporal-representation-sample.jsonld
${second_vehicle_payload_file}=  2020-09-vehicule-temporal-representation-sample.jsonld
${expectation_file}=    vehicles-temporal-representation-021-04-expectation.jsonld

*** Test Case ***
Query the temporal evolution of entities using a context
    [Documentation]  Check that you can query the temporal evolution of entities using a context
    [Tags]  mandatory

    @{entity_types_to_be_retrieved}=  Create List   Vehicle

    Query Temporal Representation Of Entities   entity_types=${entity_types_to_be_retrieved}   timerel=after    timeAt=2020-07-01T12:05:00Z    context=${ngsild_test_suite_context}

    @{temporal_entities_representation_ids}=  Create List   ${first_temporal_entity_representation_id}  ${second_temporal_entity_representation_id}
    Check Response Status Code Set To  200
    Check Response Body Containing List Containing EntityTemporal elements      ${expectation_file}    ${temporal_entities_representation_ids}

*** Keywords ***
Setup Initial Entities
    ${first_temporal_entity_representation_id}=     Generate Random Entity Id    ${vehicule_id_prefix}
    ${second_temporal_entity_representation_id}=     Generate Random Entity Id    ${vehicule_id_prefix}
    Create Temporal Representation Of Entity  ${first_vehicle_payload_file}     ${first_temporal_entity_representation_id}
    Create Temporal Representation Of Entity  ${second_vehicle_payload_file}     ${second_temporal_entity_representation_id}
    Set Suite Variable  ${first_temporal_entity_representation_id}
    Set Suite Variable  ${second_temporal_entity_representation_id}

Delete Initial Entities
    Delete Temporal Representation Of Entity    ${first_temporal_entity_representation_id}
    Delete Temporal Representation Of Entity    ${second_temporal_entity_representation_id}
+41 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can query the temporal evolution of entities matching the given type(s)
Resource    ${EXECDIR}/resources/ApiUtils.resource
Resource    ${EXECDIR}/resources/AssertionUtils.resource
Resource    ${EXECDIR}/resources/JsonUtils.resource

Suite Setup      Setup Initial Entities
Suite Teardown      Delete Initial Entities

*** Variable ***
${vehicule_id_prefix}=  urn:ngsi-ld:Vehicle:
${bus_id_prefix}=  urn:ngsi-ld:Bus:
${vehicle_payload_file}=  2020-08-vehicule-temporal-representation-sample.jsonld
${bus_payload_file}=  2020-08-bus-temporal-representation-sample.jsonld
${expectation_file}=    vehicles-temporal-representation-021-05-expectation.jsonld

*** Test Case ***
Query the temporal evolution of entities matching the given type(s)
    [Documentation]  Check that you can query the temporal evolution of entities matching the given type(s)
    [Tags]  mandatory

    @{entity_types_to_be_retrieved}=  Create List   Vehicle     Bus

    Query Temporal Representation Of Entities   entity_types=${entity_types_to_be_retrieved}   timerel=after    timeAt=2020-07-01T12:05:00Z    context=${ngsild_test_suite_context}

    @{temporal_entities_representation_ids}=  Create List   ${first_temporal_entity_representation_id}  ${second_temporal_entity_representation_id}
    Check Response Status Code Set To  200
    Check Response Body Containing List Containing EntityTemporal elements      ${expectation_file}    ${temporal_entities_representation_ids}

*** Keywords ***
Setup Initial Entities
    ${first_temporal_entity_representation_id}=     Generate Random Entity Id    ${vehicule_id_prefix}
    ${second_temporal_entity_representation_id}=     Generate Random Entity Id    ${bus_id_prefix}
    Create Temporal Representation Of Entity  ${vehicle_payload_file}     ${first_temporal_entity_representation_id}
    Create Temporal Representation Of Entity  ${bus_payload_file}     ${second_temporal_entity_representation_id}
    Set Suite Variable  ${first_temporal_entity_representation_id}
    Set Suite Variable  ${second_temporal_entity_representation_id}

Delete Initial Entities
    Delete Temporal Representation Of Entity    ${first_temporal_entity_representation_id}
    Delete Temporal Representation Of Entity    ${second_temporal_entity_representation_id}
Loading