diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_17.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_17.robot new file mode 100644 index 0000000000000000000000000000000000000000..1f5ec61787936da4b5f7612121ec0f203d4d864e --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_17.robot @@ -0,0 +1,67 @@ +*** Settings *** +Documentation Check that one 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 Setup Initial Entities +Suite Teardown Delete Initial Entities +Test Template Retrieve the temporal evolution of an entity with the aggregated temporal representation + + +*** Variables *** +${vehicle_id_prefix}= urn:ngsi-ld:Vehicle: +${first_vehicle_payload_file}= 2020-08-vehicle-temporal-representation.jsonld +${second_vehicle_payload_file}= 2020-08-vehicle-temporal-representation.jsonld + + +*** Test Cases *** AGGRMETHODS AGGRPERIODDURATION ATTRS VEHICLE_EXPECTATION_FILE +021_17_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-aggregated-avg-PT1H.json +021_17_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-aggregated-avg-PT1H-fuelLevel.json +021_17_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-aggregated-avg-max-PT1H.json +021_17_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-aggregated-min-max-P1D.json + + +*** Keywords *** +Retrieve the temporal evolution of an entity with the aggregated temporal representation + [Documentation] Check that one can retrieve the temporal evolution of an entity with the aggregated temporal representation + [Arguments] ${aggrmethods} ${aggrperiodduration} ${attrs} ${vehicle_expectation_file} + @{options}= Create List aggregatedValues + @{types}= Create List Vehicle + + ${response}= Query Temporal Representation Of Entities + ... entity_types=${types} + ... attrs=${attrs} + ... options=${options} + ... aggrMethods=${aggrmethods} + ... aggrPeriodDuration=${aggrperiodduration} + ... context=${ngsild_test_suite_context} + ... timerel=after + ... timeAt=2020-01-01T12:03:00Z + Check Response Status Code 200 ${response.status_code} + + Check Response Body Containing EntityTemporal element + ... ${vehicle_expectation_file} + ... ${first_temporal_entity_representation_id} + ... ${response.json()[0]} + +Setup Initial Entities + ${first_temporal_entity_representation_id}= Generate Random Entity Id ${vehicle_id_prefix} + ${response}= Create Temporal Representation Of Entity + ... ${first_vehicle_payload_file} + ... ${first_temporal_entity_representation_id} + Check Response Status Code 201 ${response.status_code} + Set Suite Variable ${first_temporal_entity_representation_id} + +Delete Initial Entities + Delete Temporal Representation Of Entity ${first_temporal_entity_representation_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_11.robot b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_11.robot index e0a304e4525ad2c974dfcd798a732253b0bc0385..a28cbb56ae24675139ea9c9356f4207a718faf07 100644 --- a/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_11.robot +++ b/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/RetrieveTemporalEvolutionOfEntity/020_11.robot @@ -19,16 +19,16 @@ ${vehicle_payload_file}= 2020-08-vehicle-temporal-representation.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.json + avg PT1H ${EMPTY} vehicle-temporal-representation-aggregated-avg-PT1H.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.json + avg PT1H fuelLevel vehicle-temporal-representation-aggregated-avg-PT1H-fuelLevel.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.json + avg,max PT1H ${EMPTY} vehicle-temporal-representation-aggregated-avg-max-PT1H.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.json + min,max P1D ${EMPTY} vehicle-temporal-representation-aggregated-min-max-P1D.json *** Keywords *** diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-11-02.json b/data/temporalEntities/expectations/vehicle-temporal-representation-aggregated-avg-PT1H-fuelLevel.json similarity index 100% rename from data/temporalEntities/expectations/vehicle-temporal-representation-020-11-02.json rename to data/temporalEntities/expectations/vehicle-temporal-representation-aggregated-avg-PT1H-fuelLevel.json diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-11-01.json b/data/temporalEntities/expectations/vehicle-temporal-representation-aggregated-avg-PT1H.json similarity index 100% rename from data/temporalEntities/expectations/vehicle-temporal-representation-020-11-01.json rename to data/temporalEntities/expectations/vehicle-temporal-representation-aggregated-avg-PT1H.json diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-11-03.json b/data/temporalEntities/expectations/vehicle-temporal-representation-aggregated-avg-max-PT1H.json similarity index 100% rename from data/temporalEntities/expectations/vehicle-temporal-representation-020-11-03.json rename to data/temporalEntities/expectations/vehicle-temporal-representation-aggregated-avg-max-PT1H.json diff --git a/data/temporalEntities/expectations/vehicle-temporal-representation-020-11-04.json b/data/temporalEntities/expectations/vehicle-temporal-representation-aggregated-min-max-P1D.json similarity index 100% rename from data/temporalEntities/expectations/vehicle-temporal-representation-020-11-04.json rename to data/temporalEntities/expectations/vehicle-temporal-representation-aggregated-min-max-P1D.json diff --git a/doc/analysis/requests.py b/doc/analysis/requests.py index 3899e01e9b87867bff9effe4d78ee36d16b9e18b..7e45ab71c12b9dcea8295828556b90752dca2c94 100644 --- a/doc/analysis/requests.py +++ b/doc/analysis/requests.py @@ -62,7 +62,7 @@ class Requests: 'params': ['context', 'entity_types', 'entity_ids', 'entity_id_pattern', 'ngsild_query', 'csf', 'georel', 'geometry', 'coordinates', 'geoproperty', 'timerel', 'timeAt', 'endTimeAt', - 'attrs', 'limit', 'lastN', 'accept', 'options'] + 'attrs', 'limit', 'lastN', 'accept', 'options', 'aggrMethods', 'aggrPeriodDuration'] }, 'Query Temporal Representation Of Entities Via Post': { 'positions': [], @@ -1089,7 +1089,7 @@ class Requests: expected_parameters = ['context', 'entity_types', 'entity_ids', 'entity_id_pattern', 'ngsild_query', 'csf', 'georel', 'geometry', 'coordinates', 'geoproperty', 'timerel', 'timeAt','endTimeAt', - 'attrs', 'limit', 'lastN', 'accept', 'options'] + 'attrs', 'limit', 'lastN', 'accept', 'options','aggrMethods','aggrPeriodDuration'] result = [x for x in kwargs if x not in expected_parameters] response = "Query Temporal Representation of Entities" @@ -1133,7 +1133,10 @@ class Requests: response = f"{response} and\n Query Parameter: accept set to '{value}'" case 'options': response = f"{response} and\n Query Parameter: options set to '{value}'" - + case 'aggrMethods': + response = f"{response} and\n Query Parameter: aggrMethods set to '{value}'" + case 'aggrPeriodDuration': + response = f"{response} and\n Query Parameter: aggrPeriodDuration set to '{value}'" # If an exact match is not confirmed, this last case will be used if provided case _: raise Exception(f"ERROR, unexpected attribute '{result}', the attributes expected are " diff --git a/resources/ApiUtils/TemporalContextInformationConsumption.resource b/resources/ApiUtils/TemporalContextInformationConsumption.resource index cb32d18a8d6a12320c3f7b72c5ce552c9b934560..71ca1cfe5b61031867b79050bdc2851c82d2fbeb 100755 --- a/resources/ApiUtils/TemporalContextInformationConsumption.resource +++ b/resources/ApiUtils/TemporalContextInformationConsumption.resource @@ -39,13 +39,15 @@ Query Temporal Representation Of Entities ... ${lastN}=${EMPTY} ... ${accept}=${EMPTY} ... ${options}=${EMPTY} + ... ${aggrMethods}=${EMPTY} + ... ${aggrPeriodDuration}=${EMPTY} ${entity_types_length}= Get Length ${entity_types} ${entity_ids_length}= Get Length ${entity_ids} ${attrs_length}= Get Length ${attrs} &{headers}= Create Dictionary &{params}= Create Dictionary - IF '${accept}'!='' Set To Dictionary ${headers} Accept=${accept} - IF '${context}'!='' + IF $accept!='' Set To Dictionary ${headers} Accept=${accept} + IF $context!='' Set To Dictionary ... ${headers} ... Link=<${context}>; rel="http://www.w3.org/ns/json-ld#context";type="application/ld+json" @@ -56,35 +58,37 @@ Query Temporal Representation Of Entities IF ${entity_ids_length}>0 Set To Dictionary ${params} id=${entity_ids} END - IF '${timerel}'!='' - Set To Dictionary ${params} timerel=${timerel} - END - IF '${timeAt}'!='' Set To Dictionary ${params} timeAt=${timeAt} - IF '${endTimeAt}'!='' + IF $timerel!='' Set To Dictionary ${params} timerel=${timerel} + IF $timeAt!='' Set To Dictionary ${params} timeAt=${timeAt} + IF $endTimeAt!='' Set To Dictionary ${params} endTimeAt=${endTimeAt} END IF ${attrs_length}>0 Set To Dictionary ${params} attrs=${attrs} - IF '${lastN}'!='' Set To Dictionary ${params} lastN=${lastN} - IF '${entity_id_pattern}'!='' + IF $lastN!='' Set To Dictionary ${params} lastN=${lastN} + IF $entity_id_pattern!='' Set To Dictionary ${params} idPattern=${entity_id_pattern} END - IF '${ngsild_query}'!='' + IF $ngsild_query!='' Set To Dictionary ${params} q=${ngsild_query} END - IF '${csf}'!='' Set To Dictionary ${params} csf=${csf} - IF '${georel}'!='' Set To Dictionary ${params} georel=${georel} - IF '${geometry}'!='' + IF $csf!='' Set To Dictionary ${params} csf=${csf} + IF $georel!='' Set To Dictionary ${params} georel=${georel} + IF $geometry!='' Set To Dictionary ${params} geometry=${geometry} END - IF '${coordinates}'!='' + IF $coordinates!='' Set To Dictionary ${params} coordinates=${coordinates} END - IF '${geoproperty}'!='' + IF $geoproperty!='' Set To Dictionary ${params} geoproperty=${geoproperty} END - IF '${limit}'!='' Set To Dictionary ${params} limit=${limit} - IF '${options}'!='' - Set To Dictionary ${params} options=${options} + IF $limit!='' Set To Dictionary ${params} limit=${limit} + IF $options!='' Set To Dictionary ${params} options=${options} + IF $aggrMethods!='' + Set To Dictionary ${params} aggrMethods=${aggrMethods} + END + IF $aggrPeriodDuration!='' + Set To Dictionary ${params} aggrPeriodDuration=${aggrPeriodDuration} END ${response}= GET