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

feat(021_14): add TC to query temporal evolution of entities with simplified representation

parent f5100041
Loading
Loading
Loading
Loading
+71 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that you can query the temporal evolution of entities with the simplified representation

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

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


*** Variables ***
${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
021_14_01 After
    [Tags]    te-query    5_7_4
    after    2020-08-01T12:04:00Z    vehicles-temporal-representation-021-14-01-expectation.json
021_14_02 Before
    [Tags]    te-query    5_7_4
    before    2020-09-01T13:06:00Z    vehicles-temporal-representation-021-14-02-expectation.json


*** Keywords ***
Query the temporal evolution of entities
    [Documentation]    Check that you can query the temporal evolution of entities with the simplified representation
    [Arguments]    ${timerel}    ${timeat}    ${expectation_file}
    ${entity_types_to_be_retrieved}=    Catenate    SEPARATOR=,    Vehicle
    ${response}=    Query Temporal Representation Of Entities
    ...    entity_types=${entity_types_to_be_retrieved}
    ...    timerel=${timerel}
    ...    timeAt=${timeat}
    ...    context=${ngsild_test_suite_context}
    ...    options=temporalValues
    @{temporal_entities_representation_ids}=    Create List
    ...    ${first_temporal_entity_representation_id}
    ...    ${second_temporal_entity_representation_id}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing List Containing EntityTemporal elements
    ...    ${expectation_file}
    ...    ${temporal_entities_representation_ids}
    ...    ${response.json()}

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 Test Variable    ${first_temporal_entity_representation_id}
    Set Test Variable    ${second_temporal_entity_representation_id}
    Set Test 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}
+70 −0
Original line number Diff line number Diff line
[
  {
    "id": "urn:ngsi-ld:Vehicle:randomUUID",
    "type": "Vehicle",
    "speed": {
      "type": "Property",
      "values": [
        [
          80.0,
          "2020-08-01T12:05:00Z"
        ],
        [
          100.0,
          "2020-08-01T12:07:00Z"
        ]
      ]
    },
    "fuelLevel": {
      "type": "Property",
      "values": [
        [
          53.0,
          "2020-08-01T13:05:00Z"
        ],
        [
          40.0,
          "2020-08-01T14:07:00Z"
        ]
      ]
    }
  },
  {
    "id": "urn:ngsi-ld:Vehicle:randomUUID",
    "type": "Vehicle",
    "speed": {
      "type": "Property",
      "values": [
        [
          120.0,
          "2020-09-01T12:03:00Z"
        ],
        [
          80.0,
          "2020-09-01T12:05:00Z"
        ],
        [
          100.0,
          "2020-09-01T12:07:00Z"
        ]
      ]
    },
    "fuelLevel": {
      "type": "Property",
      "values": [
        [
          67.0,
          "2020-09-01T12:03:00Z"
        ],
        [
          53.0,
          "2020-09-01T13:05:00Z"
        ],
        [
          40.0,
          "2020-09-01T14:07:00Z"
        ]
      ]
    }
  }
]
+74 −0
Original line number Diff line number Diff line
[
  {
    "id": "urn:ngsi-ld:Vehicle:randomUUID",
    "type": "Vehicle",
    "speed": {
      "type": "Property",
      "values": [
        [
          120.0,
          "2020-08-01T12:03:00Z"
        ],
        [
          80.0,
          "2020-08-01T12:05:00Z"
        ],
        [
          100.0,
          "2020-08-01T12:07:00Z"
        ]
      ]
    },
    "fuelLevel": {
      "type": "Property",
      "values": [
        [
          67.0,
          "2020-08-01T12:03:00Z"
        ],
        [
          53.0,
          "2020-08-01T13:05:00Z"
        ],
        [
          40.0,
          "2020-08-01T14:07:00Z"
        ]
      ]
    }
  },
  {
    "id": "urn:ngsi-ld:Vehicle:randomUUID",
    "type": "Vehicle",
    "speed": {
      "type": "Property",
      "values": [
        [
          120.0,
          "2020-09-01T12:03:00Z"
        ],
        [
          80.0,
          "2020-09-01T12:05:00Z"
        ],
        [
          100.0,
          "2020-09-01T12:07:00Z"
        ]
      ]
    },
    "fuelLevel": {
      "type": "Property",
      "values": [
        [
          67.0,
          "2020-09-01T12:03:00Z"
        ],
        [
          53.0,
          "2020-09-01T13:05:00Z"
        ]
      ]
    }
  }
]
 No newline at end of file
+4 −2
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ class Requests:
                'params': ['context', 'entity_types', 'entity_ids', 'entity_id_pattern',
                           'ngsild_query', 'csf', 'georel', 'geometry',
                           'coordinates', 'geoproperty', 'timerel', 'timeAt',
                           'attrs', 'limit', 'lastN', 'accept']
                           'attrs', 'limit', 'lastN', 'accept', 'options']
            },
            'Query Temporal Representation Of Entities Via Post': {
                'positions': [],
@@ -1025,7 +1025,7 @@ class Requests:
        expected_parameters = ['context', 'entity_types', 'entity_ids', 'entity_id_pattern',
                               'ngsild_query', 'csf', 'georel', 'geometry',
                               'coordinates', 'geoproperty', 'timerel', 'timeAt',
                               'attrs', 'limit', 'lastN', 'accept']
                               'attrs', 'limit', 'lastN', 'accept', 'options']

        result = [x for x in kwargs if x not in expected_parameters]
        response = "Query Temporal Representation of Entities"
@@ -1064,6 +1064,8 @@ class Requests:
                    response = f"{response} and\n    Query Parameter: lastN set to '{value}'"
                case 'accept':
                    response = f"{response} and\n    Query Parameter: accept set to '{value}'"
                case 'options':
                    response = f"{response} and\n    Query Parameter: options set to '{value}'"

            # If an exact match is not confirmed, this last case will be used if provided
                case _:
+51 −0
Original line number Diff line number Diff line
{
  "tp_id": "TP/NGSI-LD/CI/Cons/TE/021_14",
  "test_objective": "Check that you can query the temporal evolution of entities with the simplified representation",
  "reference": "ETSI GS CIM 009 V1.3.1 [], clause 5.7.4",
  "config_id": "",
  "parent_release": "v1.3.1",
  "pics_selection": "PICS_5_7_4",
  "keywords": [],
  "teardown": "None",
  "initial_condition": "with {\n    the SUT being in the \"initial state\" and\n    and containing a list of entities\n}",
  "test_cases": [
    {
      "name": "021_14_01 After",
      "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_14_01",
      "doc": "Check that you can query the temporal evolution of entities with the simplified representation",
      "tags": [
        "5_7_4",
        "te-query"
      ],
      "setup": "Setup Initial Entities",
      "teardown": "Delete Initial Entities",
      "template": "Query the temporal evolution of entities",
      "then": "then {\n    the SUT sends a valid Response for the operations:\n        Query Temporal Representation Of Entities with Response Status Code set to 200     and\n        Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n            compared with file 'vehicles-temporal-representation-021-14-01-expectation.json'\n            and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}",
      "when": "when {\n    the SUT receives a Request from the client containing:\n        URL set to '/ngsi-ld/v1/temporal/entities'\n        method set to 'GET'\n        Query Temporal Representation of Entities and\n    Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n    Query Parameter: timerel set to 'after' and\n    Query Parameter: timeAt set to '2020-08-01T12:04:00Z' and\n    Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n    Query Parameter: options set to 'temporalValues'\n}",
      "http_verb": "GET",
      "endpoint": "temporal/entities"
    },
    {
      "name": "021_14_02 Before",
      "permutation_tp_id": "TP/NGSI-LD/CI/Cons/TE/021_14_02",
      "doc": "Check that you can query the temporal evolution of entities with the simplified representation",
      "tags": [
        "5_7_4",
        "te-query"
      ],
      "setup": "Setup Initial Entities",
      "teardown": "Delete Initial Entities",
      "template": "Query the temporal evolution of entities",
      "then": "then {\n    the SUT sends a valid Response for the operations:\n        Query Temporal Representation Of Entities with Response Status Code set to 200     and\n        Query Temporal Representation Of Entities with Request response body containing a list that contains Entity Temporal Elements\n            compared with file 'vehicles-temporal-representation-021-14-02-expectation.json'\n            and using the list of entity ids define in '${temporal_entities_representation_ids}'\n}",
      "when": "when {\n    the SUT receives a Request from the client containing:\n        URL set to '/ngsi-ld/v1/temporal/entities'\n        method set to 'GET'\n        Query Temporal Representation of Entities and\n    Query Parameter: entity_types set to '${entity_types_to_be_retrieved}' and\n    Query Parameter: timerel set to 'before' and\n    Query Parameter: timeAt set to '2020-09-01T13:06:00Z' and\n    Query Parameter: context set to 'https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld' and\n    Query Parameter: options set to 'temporalValues'\n}",
      "http_verb": "GET",
      "endpoint": "temporal/entities"
    }
  ],
  "permutations": [
    "then",
    "when"
  ],
  "robotpath": "ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities",
  "robotfile": "021_14"
}
 No newline at end of file
Loading