Commit 83cad53d authored by Benoit Orihuela's avatar Benoit Orihuela
Browse files

feat(020_11): add TC for aggregated temporal representation of an entity

parent 5cbd5e66
Loading
Loading
Loading
Loading
+58 −0
Original line number Diff line number Diff line
*** Settings ***
Documentation       Check that you can retrieve the temporal evolution of an entity with the aggregated temporal representation

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 the temporal evolution of an entity with the aggregated temporal representation


*** Variables ***
${vehicule_id_prefix}=      urn:ngsi-ld:Vehicle:
${vehicle_payload_file}=    2020-08-vehicule-temporal-representation-sample.jsonld


*** Test Cases ***    AGGRMETHODS    AGGRPERIODDURATION    ATTRS    VEHICLE_EXPECTATION_FILE
020_11_01 One aggregate method aggregated by one hour duration
    [Tags]    te-retrieve    5_7_3    4_5_19    since_v1.4.1
    avg    PT1H    ${EMPTY}    vehicle-temporal-representation-020-11-01-expectation.json
020_11_02 One aggregate method aggregated by one hour duration asking for one attribute
    [Tags]    te-retrieve    5_7_3    4_5_19    since_v1.4.1
    avg    PT1H    fuelLevel    vehicle-temporal-representation-020-11-02-expectation.json
020_11_03 Multiple aggregate methods aggregated by one hour duration
    [Tags]    te-retrieve    5_7_3    4_5_19    since_v1.4.1
    avg,max    PT1H    ${EMPTY}    vehicle-temporal-representation-020-11-03-expectation.json
020_11_04 Multiple aggregate methods aggregated by one day duration
    [Tags]    te-retrieve    5_7_3    4_5_19    since_v1.4.1
    min,max    P1D    ${EMPTY}    vehicle-temporal-representation-020-11-04-expectation.json


*** Keywords ***
Retrieve the temporal evolution of an entity with the aggregated temporal representation
    [Documentation]    Check that you can retrieve the temporal evolution of an entity with the aggregated temporal representation
    [Arguments]    ${aggrmethods}    ${aggrperiodduration}    ${attrs}    ${vehicle_expectation_file}
    @{options}=    Create List    aggregatedValues
    ${response}=    Retrieve Temporal Representation Of Entity
    ...    temporal_entity_representation_id=${temporal_entity_representation_id}
    ...    attrs=${attrs}
    ...    options=${options}
    ...    aggrMethods=${aggrmethods}
    ...    aggrPeriodDuration=${aggrperiodduration}
    ...    context=${ngsild_test_suite_context}
    Check Response Status Code    200    ${response.status_code}
    Check Response Body Containing EntityTemporal element
    ...    ${vehicle_expectation_file}
    ...    ${temporal_entity_representation_id}
    ...    ${response.json()}

Create Temporal Entity
    ${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 Temporal Entity
    Delete Temporal Representation Of Entity    ${temporal_entity_representation_id}
+34 −0
Original line number Diff line number Diff line
{
  "id": "urn:ngsi-ld:Vehicle:4656271219750725",
  "type": "Vehicle",
  "speed": {
    "type": "Property",
    "avg": [
      [
        100.0,
        "2020-08-01T12:03:00Z",
        "2020-08-01T13:03:00Z"
      ]
    ]
  },
  "fuelLevel": {
    "type": "Property",
    "avg": [
      [
        67.0,
        "2020-08-01T12:03:00Z",
        "2020-08-01T13:03:00Z"
      ],
      [
        53.0,
        "2020-08-01T13:03:00Z",
        "2020-08-01T14:03:00Z"
      ],
      [
        40.0,
        "2020-08-01T14:03:00Z",
        "2020-08-01T15:03:00Z"
      ]
    ]
  }
}
 No newline at end of file
+24 −0
Original line number Diff line number Diff line
{
  "id": "urn:ngsi-ld:Vehicle:4656271219750725",
  "type": "Vehicle",
  "fuelLevel": {
    "type": "Property",
    "avg": [
      [
        67.0,
        "2020-08-01T12:03:00Z",
        "2020-08-01T13:03:00Z"
      ],
      [
        53.0,
        "2020-08-01T13:03:00Z",
        "2020-08-01T14:03:00Z"
      ],
      [
        40.0,
        "2020-08-01T14:03:00Z",
        "2020-08-01T15:03:00Z"
      ]
    ]
  }
}
 No newline at end of file
+58 −0
Original line number Diff line number Diff line
{
  "id": "urn:ngsi-ld:Vehicle:4656271219750725",
  "type": "Vehicle",
  "speed": {
    "type": "Property",
    "avg": [
      [
        100.0,
        "2020-08-01T12:03:00Z",
        "2020-08-01T13:03:00Z"
      ]
    ],
    "max": [
      [
        120.0,
        "2020-08-01T12:03:00Z",
        "2020-08-01T13:03:00Z"
      ]
    ]
  },
  "fuelLevel": {
    "type": "Property",
    "avg": [
      [
        67.0,
        "2020-08-01T12:03:00Z",
        "2020-08-01T13:03:00Z"
      ],
      [
        53.0,
        "2020-08-01T13:03:00Z",
        "2020-08-01T14:03:00Z"
      ],
      [
        40.0,
        "2020-08-01T14:03:00Z",
        "2020-08-01T15:03:00Z"
      ]
    ],
    "max": [
      [
        67.0,
        "2020-08-01T12:03:00Z",
        "2020-08-01T13:03:00Z"
      ],
      [
        53.0,
        "2020-08-01T13:03:00Z",
        "2020-08-01T14:03:00Z"
      ],
      [
        40.0,
        "2020-08-01T14:03:00Z",
        "2020-08-01T15:03:00Z"
      ]
    ]
  }
}
 No newline at end of file
+38 −0
Original line number Diff line number Diff line
{
  "id": "urn:ngsi-ld:Vehicle:7599642734962554",
  "type": "Vehicle",
  "speed": {
    "type": "Property",
    "min": [
      [
        80.0,
        "2020-08-01T12:03:00Z",
        "2020-08-02T12:03:00Z"
      ]
    ],
    "max": [
      [
        120.0,
        "2020-08-01T12:03:00Z",
        "2020-08-02T12:03:00Z"
      ]
    ]
  },
  "fuelLevel": {
    "type": "Property",
    "min": [
      [
        40.0,
        "2020-08-01T12:03:00Z",
        "2020-08-02T12:03:00Z"
      ]
    ],
    "max": [
      [
        67.0,
        "2020-08-01T12:03:00Z",
        "2020-08-02T12:03:00Z"
      ]
    ]
  }
}
 No newline at end of file
Loading