Commit 7984ca42 authored by Houcem Kacem's avatar Houcem Kacem
Browse files

feat: complete implementation of query temporal entities tps

parent a3d2e675
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 with a limit to the number of entities to be retrieved
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 with a limit to the number of entities to be retrieved

*** 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

${expectation_file}=    vehicles-temporal-representation-021-11-expectation.jsonld

*** Test Cases ***                        LIMIT         EXPECTATION_FILE                                                TEMPORAL_ENTITIES_REPRESENTATION_IDS
Query Some entities                       ${2}          vehicles-temporal-representation-021-11-01-expectation.jsonld   ${first_temporal_entity_representation_id}  ${second_temporal_entity_representation_id}
Query All entities                        ${20}         vehicles-temporal-representation-021-11-02-expectation.jsonld   ${first_temporal_entity_representation_id}  ${second_temporal_entity_representation_id}     ${third_temporal_entity_representation_id}

*** Keywords ***
Query the temporal evolution of entities with a limit to the number of entities to be retrieved
    [Arguments]  ${limit}     ${expectation_file}   @{temporal_entities_representation_ids}
    [Documentation]  Check that you can query the temporal evolution of entities with a limit to the number of entities to be retrieved
    [Tags]  mandatory

    @{entity_types_to_be_retrieved}=  Create List   Vehicle     Bus

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

    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}
+32 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you cannot query the temporal evolution of entities with an invalid request or invalid request content
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:
${vehicle_payload_file}=  2020-08-vehicule-temporal-representation-sample.jsonld

*** Test Case ***
Query the temporal evolution of entities with an invalid request
    [Documentation]  Check that you cannot query the temporal evolution of entities with an invalid request
    [Tags]  mandatory

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

    Check Response Status Code Set To  400
    Check Response Body Containing ProblemDetails Element Containing Type Element set to      ${response}     ${ERROR_TYPE_BAD_REQUEST_DATA}
    Check Response Body Containing ProblemDetails Element Containing Title Element    ${response}

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

Delete Initial Entities
    Delete Temporal Representation Of Entity    ${temporal_entity_representation_id}
+43 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation   Check that you can query the temporal evolution of entities using the entityOperations method
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 using the entityOperations method

*** 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

*** Test Cases ***      PAYLOAD_FILE                                     EXPECTATION_FILE
After                   entity-operations-after-query.jsonld             vehicles-temporal-representation-021-13-01-expectation.jsonld
Before                  entity-operations-before-query.jsonld            vehicles-temporal-representation-021-13-02-expectation.jsonld

*** Keywords ***
Query the temporal evolution of entities using the entityOperations method
    [Arguments]  ${payload_file}  ${expectation_file}
    [Documentation]  Check that you can query the temporal evolution of entities using the entityOperations method
    [Tags]  mandatory

    Query Temporal Representation Of Entities Via Post   ${payload_file}

    @{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}
    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}
+9 −0
Original line number Diff line number Diff line
{
   "type":"Vehicle",
   "timerel":"after",
   "timeAt":"2020-08-02T12:05:00Z",
   "@context":[
      "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld",
      "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
   ]
}
 No newline at end of file
+9 −0
Original line number Diff line number Diff line
{
   "type":"Vehicle",
   "timerel":"before",
   "timeAt":"2020-08-02T12:05:00Z",
   "@context":[
      "https://raw.githubusercontent.com/easy-global-market/ngsild-api-data-models/feature/add-json-ld-context-for-ngsi-ld-test-suite/ngsi-ld-test-suite/ngsi-ld-test-suite-context.jsonld",
      "https://uri.etsi.org/ngsi-ld/v1/ngsi-ld-core-context.jsonld"
   ]
}
 No newline at end of file
Loading