From ccbbd20a59c82097b33358473f269cc41ba130f2 Mon Sep 17 00:00:00 2001 From: Benoit Orihuela Date: Mon, 10 Nov 2025 07:57:32 +0100 Subject: [PATCH] feat: add TCs for Linked Entity Retrieval - Retrieve Entity / Query Entities --- .../Entity/QueryEntities/019_13.robot | 94 +++++++++++++++ .../Entity/QueryEntities/019_14.robot | 79 ++++++++++++ .../Entity/QueryEntities/019_15.robot | 81 +++++++++++++ .../Entity/QueryEntities/019_16.robot | 114 ++++++++++++++++++ .../Entity/RetrieveEntity/018_10.robot | 69 +++++++++++ .../Entity/RetrieveEntity/018_11.robot | 53 ++++++++ .../Entity/RetrieveEntity/018_12.robot | 54 +++++++++ .../Entity/RetrieveEntity/018_13.robot | 81 +++++++++++++ .../Entity/RetrieveEntity/018_14.robot | 52 ++++++++ data/entities/city-minimal.jsonld | 7 ++ data/entities/city-relationship.jsonld | 11 ++ data/entities/country-minimal.jsonld | 7 ++ ...lding-non-existent-inline-flat-018-14.json | 8 ++ .../building-one-level-flat-018-10.json | 14 +++ ...ding-one-level-flat-simplified-018-10.json | 11 ++ .../building-one-level-inline-018-10.json | 12 ++ ...ng-one-level-inline-simplified-018-10.json | 8 ++ .../building-two-levels-flat-018-13.json | 22 ++++ ...ing-two-levels-flat-simplified-018-13.json | 16 +++ .../building-two-levels-inline-018-13.json | 20 +++ ...g-two-levels-inline-simplified-018-13.json | 12 ++ .../buildings-one-level-flat-019-13.json | 26 ++++ ...ings-one-level-flat-simplified-019-13.json | 20 +++ .../buildings-one-level-inline-019-13.json | 26 ++++ ...gs-one-level-inline-simplified-019-13.json | 18 +++ .../buildings-two-levels-flat-019-16.json | 42 +++++++ ...ngs-two-levels-flat-simplified-019-16.json | 30 +++++ .../buildings-two-levels-inline-019-16.json | 42 +++++++ ...s-two-levels-inline-simplified-019-16.json | 26 ++++ doc/analysis/initial_setup.py | 33 +++++ doc/analysis/requests.py | 22 +++- .../Consumption/018_10.json | 99 +++++++++++++++ .../Consumption/018_11.json | 41 +++++++ .../Consumption/018_12.json | 41 +++++++ .../Consumption/018_13.json | 99 +++++++++++++++ .../Consumption/018_14.json | 62 ++++++++++ .../Consumption/019_13.json | 100 +++++++++++++++ .../Consumption/019_14.json | 42 +++++++ .../Consumption/019_15.json | 42 +++++++ .../Consumption/019_16.json | 100 +++++++++++++++ .../test_ContextInformation_Consumption.py | 63 ++++++++++ .../ContextInformationConsumption.resource | 12 ++ .../ContextInformationProvision.resource | 11 ++ 43 files changed, 1818 insertions(+), 4 deletions(-) create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_13.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_14.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_15.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_16.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_10.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_11.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_12.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_13.robot create mode 100644 TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_14.robot create mode 100644 data/entities/city-minimal.jsonld create mode 100644 data/entities/city-relationship.jsonld create mode 100644 data/entities/country-minimal.jsonld create mode 100644 data/entities/expectations/linked-entity-retrieval/building-non-existent-inline-flat-018-14.json create mode 100644 data/entities/expectations/linked-entity-retrieval/building-one-level-flat-018-10.json create mode 100644 data/entities/expectations/linked-entity-retrieval/building-one-level-flat-simplified-018-10.json create mode 100644 data/entities/expectations/linked-entity-retrieval/building-one-level-inline-018-10.json create mode 100644 data/entities/expectations/linked-entity-retrieval/building-one-level-inline-simplified-018-10.json create mode 100644 data/entities/expectations/linked-entity-retrieval/building-two-levels-flat-018-13.json create mode 100644 data/entities/expectations/linked-entity-retrieval/building-two-levels-flat-simplified-018-13.json create mode 100644 data/entities/expectations/linked-entity-retrieval/building-two-levels-inline-018-13.json create mode 100644 data/entities/expectations/linked-entity-retrieval/building-two-levels-inline-simplified-018-13.json create mode 100644 data/entities/expectations/linked-entity-retrieval/buildings-one-level-flat-019-13.json create mode 100644 data/entities/expectations/linked-entity-retrieval/buildings-one-level-flat-simplified-019-13.json create mode 100644 data/entities/expectations/linked-entity-retrieval/buildings-one-level-inline-019-13.json create mode 100644 data/entities/expectations/linked-entity-retrieval/buildings-one-level-inline-simplified-019-13.json create mode 100644 data/entities/expectations/linked-entity-retrieval/buildings-two-levels-flat-019-16.json create mode 100644 data/entities/expectations/linked-entity-retrieval/buildings-two-levels-flat-simplified-019-16.json create mode 100644 data/entities/expectations/linked-entity-retrieval/buildings-two-levels-inline-019-16.json create mode 100644 data/entities/expectations/linked-entity-retrieval/buildings-two-levels-inline-simplified-019-16.json create mode 100644 doc/files/ContextInformation/Consumption/018_10.json create mode 100644 doc/files/ContextInformation/Consumption/018_11.json create mode 100644 doc/files/ContextInformation/Consumption/018_12.json create mode 100644 doc/files/ContextInformation/Consumption/018_13.json create mode 100644 doc/files/ContextInformation/Consumption/018_14.json create mode 100644 doc/files/ContextInformation/Consumption/019_13.json create mode 100644 doc/files/ContextInformation/Consumption/019_14.json create mode 100644 doc/files/ContextInformation/Consumption/019_15.json create mode 100644 doc/files/ContextInformation/Consumption/019_16.json diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_13.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_13.robot new file mode 100644 index 00000000..657b6831 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_13.robot @@ -0,0 +1,94 @@ +*** Settings *** +Documentation Check that entities can be queried with a linked entity in different join types and representations + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entities And Linked Entities +Test Teardown Delete Created Entities And Linked Entities +Test Template Query Entities With Joins And Representations + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${city_id_prefix}= urn:ngsi-ld:City: +${linking_entity_filename}= building-relationship.jsonld +${linked_entity_filename}= city-minimal.jsonld + + +*** Test Cases *** JOIN OPTIONS EXPECTATION_FILENAME +019_13_01 Query Inline Normalized + [Tags] e-query 5_7_2 4_5_23 since_v1.8.1 + inline ${EMPTY} linked-entity-retrieval/buildings-one-level-inline-019-13.json +019_13_02 Query Flat Normalized + [Tags] e-query 5_7_2 4_5_23 since_v1.8.1 + flat ${EMPTY} linked-entity-retrieval/buildings-one-level-flat-019-13.json +019_13_03 Query Inline Simplified + [Tags] e-query 5_7_2 4_5_23 since_v1.8.1 + inline keyValues linked-entity-retrieval/buildings-one-level-inline-simplified-019-13.json +019_13_04 Query Flat Simplified + [Tags] e-query 5_7_2 4_5_23 since_v1.8.1 + flat keyValues linked-entity-retrieval/buildings-one-level-flat-simplified-019-13.json + + +*** Keywords *** +Query Entities With Joins And Representations + [Documentation] Check that entities can be queried with a linked entity in different join types and representations + [Arguments] ${join} ${options} ${expectation_filename} + + ${response}= Query Entities + ... entity_types=Building + ... options=${options} + ... join=${join} + ... joinLevel=1 + ... context=${ngsild_test_suite_context} + + Check Response Status Code 200 ${response.status_code} + Check Response Body Content + ... expectation_filename=${expectation_filename} + ... response_body=${response.json()} + +Create Initial Entities And Linked Entities + ${first_entity_id}= Catenate ${building_id_prefix}019-13-1 + ${first_linked_entity_id}= Catenate ${city_id_prefix}019-13-1 + Set Suite Variable ${first_entity_id} + Set Suite Variable ${first_linked_entity_id} + ${create_response1}= Create Linking Entity + ... linking_entity_id=${first_entity_id} + ... linked_entity_id=${first_linked_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... filename=${linked_entity_filename} + ... entity_id=${first_linked_entity_id} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + + ${second_entity_id}= Catenate ${building_id_prefix}019-13-2 + ${second_linked_entity_id}= Catenate ${city_id_prefix}019-13-2 + Set Suite Variable ${second_entity_id} + Set Suite Variable ${second_linked_entity_id} + ${create_response3}= Create Linking Entity + ... linking_entity_id=${second_entity_id} + ... linked_entity_id=${second_linked_entity_id} + ${create_response4}= Create Entity Selecting Content Type + ... filename=${linked_entity_filename} + ... entity_id=${second_linked_entity_id} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response4.status_code} + +Delete Created Entities And Linked Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${first_linked_entity_id} + Delete Entity by Id ${second_entity_id} + Delete Entity by Id ${second_linked_entity_id} + +Create Linking Entity + [Arguments] ${linking_entity_id} ${linked_entity_id} + ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${linking_entity_filename} + ${entity}= Update Value To JSON ${entity_payload} $.id ${linking_entity_id} + ${entity}= Update Value To JSON ${entity} $.locatedAt.object ${linked_entity_id} + ${response}= Create Entity From JSON-LD Content + ... ${entity} + Check Response Status Code 201 ${response.status_code} + RETURN ${response} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_14.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_14.robot new file mode 100644 index 00000000..803a09f1 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_14.robot @@ -0,0 +1,79 @@ +*** Settings *** +Documentation Check that entities can be queried with an inline linked entity with sysAttrs + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entities And Linked Entities +Test Teardown Delete Created Entities And Linked Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${city_id_prefix}= urn:ngsi-ld:City: +${linking_entity_filename}= building-relationship.jsonld +${linked_entity_filename}= city-minimal.jsonld + + +*** Test Cases *** +019_14_01 Query Entities With Inline Linked Entities And SysAttrs + [Documentation] Check that entities can be queried with an inline linked entity with sysAttrs + [Tags] e-query 5_7_2 4_5_23 since_v1.8.1 + + ${response}= Query Entities + ... entity_types=Building + ... options=sysAttrs + ... join=inline + ... joinLevel=1 + ... context=${ngsild_test_suite_context} + + Check Response Status Code 200 ${response.status_code} + Dictionary Should Contain Key ${response.json()}[0][locatedAt][entity] createdAt + Dictionary Should Contain Key ${response.json()}[1][locatedAt][entity] createdAt + + +*** Keywords *** +Create Initial Entities And Linked Entities + ${first_entity_id}= Catenate ${building_id_prefix}019-12-1 + ${first_linked_entity_id}= Catenate ${city_id_prefix}019-12-1 + Set Suite Variable ${first_entity_id} + Set Suite Variable ${first_linked_entity_id} + ${create_response1}= Create Linking Entity + ... linking_entity_id=${first_entity_id} + ... linked_entity_id=${first_linked_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... filename=${linked_entity_filename} + ... entity_id=${first_linked_entity_id} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + + ${second_entity_id}= Catenate ${building_id_prefix}019-12-2 + ${second_linked_entity_id}= Catenate ${city_id_prefix}019-12-2 + Set Suite Variable ${second_entity_id} + Set Suite Variable ${second_linked_entity_id} + ${create_response3}= Create Linking Entity + ... linking_entity_id=${second_entity_id} + ... linked_entity_id=${second_linked_entity_id} + ${create_response4}= Create Entity Selecting Content Type + ... filename=${linked_entity_filename} + ... entity_id=${second_linked_entity_id} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response4.status_code} + +Delete Created Entities And Linked Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${first_linked_entity_id} + Delete Entity by Id ${second_entity_id} + Delete Entity by Id ${second_linked_entity_id} + +Create Linking Entity + [Arguments] ${linking_entity_id} ${linked_entity_id} + ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${linking_entity_filename} + ${entity}= Update Value To JSON ${entity_payload} $.id ${linking_entity_id} + ${entity}= Update Value To JSON ${entity} $.locatedAt.object ${linked_entity_id} + ${response}= Create Entity From JSON-LD Content + ... ${entity} + Check Response Status Code 201 ${response.status_code} + RETURN ${response} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_15.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_15.robot new file mode 100644 index 00000000..f36e4172 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_15.robot @@ -0,0 +1,81 @@ +*** Settings *** +Documentation Check that entities can be queried with a flat linked entity with sysAttrs + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entities And Linked Entities +Test Teardown Delete Created Entities And Linked Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${city_id_prefix}= urn:ngsi-ld:City: +${linking_entity_filename}= building-relationship.jsonld +${linked_entity_filename}= city-minimal.jsonld + + +*** Test Cases *** +019_15_01 Query Entities With Flat Linked Entities And SysAttrs + [Documentation] Check that entities can be queried with a flat linked entity with sysAttrs + [Tags] e-query 5_7_2 4_5_23 since_v1.8.1 + + ${response}= Query Entities + ... entity_types=Building + ... options=sysAttrs + ... join=flat + ... joinLevel=1 + ... context=${ngsild_test_suite_context} + + Check Response Status Code 200 ${response.status_code} + Dictionary Should Contain Key ${response.json()}[0] createdAt + Dictionary Should Contain Key ${response.json()}[1] createdAt + Dictionary Should Contain Key ${response.json()}[2] createdAt + Dictionary Should Contain Key ${response.json()}[3] createdAt + + +*** Keywords *** +Create Initial Entities And Linked Entities + ${first_entity_id}= Catenate ${building_id_prefix}019-12-1 + ${first_linked_entity_id}= Catenate ${city_id_prefix}019-12-1 + Set Suite Variable ${first_entity_id} + Set Suite Variable ${first_linked_entity_id} + ${create_response1}= Create Linking Entity + ... linking_entity_id=${first_entity_id} + ... linked_entity_id=${first_linked_entity_id} + ${create_response2}= Create Entity Selecting Content Type + ... filename=${linked_entity_filename} + ... entity_id=${first_linked_entity_id} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response2.status_code} + + ${second_entity_id}= Catenate ${building_id_prefix}019-12-2 + ${second_linked_entity_id}= Catenate ${city_id_prefix}019-12-2 + Set Suite Variable ${second_entity_id} + Set Suite Variable ${second_linked_entity_id} + ${create_response3}= Create Linking Entity + ... linking_entity_id=${second_entity_id} + ... linked_entity_id=${second_linked_entity_id} + ${create_response4}= Create Entity Selecting Content Type + ... filename=${linked_entity_filename} + ... entity_id=${second_linked_entity_id} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response4.status_code} + +Delete Created Entities And Linked Entities + Delete Entity by Id ${first_entity_id} + Delete Entity by Id ${first_linked_entity_id} + Delete Entity by Id ${second_entity_id} + Delete Entity by Id ${second_linked_entity_id} + +Create Linking Entity + [Arguments] ${linking_entity_id} ${linked_entity_id} + ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${linking_entity_filename} + ${entity}= Update Value To JSON ${entity_payload} $.id ${linking_entity_id} + ${entity}= Update Value To JSON ${entity} $.locatedAt.object ${linked_entity_id} + ${response}= Create Entity From JSON-LD Content + ... ${entity} + Check Response Status Code 201 ${response.status_code} + RETURN ${response} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_16.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_16.robot new file mode 100644 index 00000000..70c622d8 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_16.robot @@ -0,0 +1,114 @@ +*** Settings *** +Documentation Check that entities can be queried with two levels linked entities in different join types and representations + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entities And Linked Entities +Test Teardown Delete Created Entities And Linked Entities +Test Template Query Entities With Joins And Representations + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${city_id_prefix}= urn:ngsi-ld:City: +${country_id_prefix}= urn:ngsi-ld:Country: +${linking_entity_filename}= building-relationship.jsonld +${level_1_linked_entity_filename}= city-relationship.jsonld +${level_2_linked_entity_filename}= country-minimal.jsonld + + +*** Test Cases *** JOIN OPTIONS EXPECTATION_FILENAME +019_16_01 Query Inline Normalized + [Tags] e-query 5_7_2 4_5_23 since_v1.8.1 + inline ${EMPTY} linked-entity-retrieval/buildings-two-levels-inline-019-16.json +019_16_02 Query Flat Normalized + [Tags] e-query 5_7_2 4_5_23 since_v1.8.1 + flat ${EMPTY} linked-entity-retrieval/buildings-two-levels-flat-019-16.json +019_16_03 Query Inline Simplified + [Tags] e-query 5_7_2 4_5_23 since_v1.8.1 + inline keyValues linked-entity-retrieval/buildings-two-levels-inline-simplified-019-16.json +019_16_04 Query Flat Simplified + [Tags] e-query 5_7_2 4_5_23 since_v1.8.1 + flat keyValues linked-entity-retrieval/buildings-two-levels-flat-simplified-019-16.json + + +*** Keywords *** +Query Entities With Joins And Representations + [Documentation] Check that entities can be queried with two levels linked entities in different join types and representations + [Arguments] ${join} ${options} ${expectation_filename} + + ${response}= Query Entities + ... entity_types=Building + ... options=${options} + ... join=${join} + ... joinLevel=2 + ... context=${ngsild_test_suite_context} + + Check Response Status Code 200 ${response.status_code} + Check Response Body Content + ... expectation_filename=${expectation_filename} + ... response_body=${response.json()} + +Create Initial Entities And Linked Entities + ${entity_1_id}= Catenate ${building_id_prefix}019-16-1 + Set Suite Variable ${entity_1_id} + ${linked_entity_1_level_1_id}= Catenate ${city_id_prefix}019-16-1 + Set Suite Variable ${linked_entity_1_level_1_id} + ${create_response1}= Create Linking Entity + ... entity_filename=${linking_entity_filename} + ... entity_id=${entity_1_id} + ... linked_entity_id=${linked_entity_1_level_1_id} + ${linked_entity_1_level_2_id}= Catenate ${country_id_prefix}019-16-1 + Set Suite Variable ${linked_entity_1_level_2_id} + ${create_response2}= Create Linking Entity + ... entity_filename=${level_1_linked_entity_filename} + ... entity_id=${linked_entity_1_level_1_id} + ... linked_entity_id=${linked_entity_1_level_2_id} + Check Response Status Code 201 ${create_response2.status_code} + ${create_response3}= Create Entity Selecting Content Type + ... filename=${level_2_linked_entity_filename} + ... entity_id=${linked_entity_1_level_2_id} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response3.status_code} + + ${entity_2_id}= Catenate ${building_id_prefix}019-16-2 + Set Suite Variable ${entity_2_id} + ${linked_entity_2_level_1_id}= Catenate ${city_id_prefix}019-16-2 + Set Suite Variable ${linked_entity_2_level_1_id} + ${create_response4}= Create Linking Entity + ... entity_filename=${linking_entity_filename} + ... entity_id=${entity_2_id} + ... linked_entity_id=${linked_entity_2_level_1_id} + ${linked_entity_2_level_2_id}= Catenate ${country_id_prefix}019-16-2 + Set Suite Variable ${linked_entity_2_level_2_id} + ${create_response5}= Create Linking Entity + ... entity_filename=${level_1_linked_entity_filename} + ... entity_id=${linked_entity_2_level_1_id} + ... linked_entity_id=${linked_entity_2_level_2_id} + Check Response Status Code 201 ${create_response2.status_code} + ${create_response6}= Create Entity Selecting Content Type + ... filename=${level_2_linked_entity_filename} + ... entity_id=${linked_entity_2_level_2_id} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${create_response3.status_code} + +Delete Created Entities And Linked Entities + Delete Entity by Id ${entity_1_id} + Delete Entity by Id ${linked_entity_1_level_1_id} + Delete Entity by Id ${linked_entity_1_level_2_id} + Delete Entity by Id ${entity_2_id} + Delete Entity by Id ${linked_entity_2_level_1_id} + Delete Entity by Id ${linked_entity_2_level_2_id} + +Create Linking Entity + [Arguments] ${entity_filename} ${entity_id} ${linked_entity_id} + ${entity_payload}= Load JSON From File ${EXECDIR}/data/entities/${entity_filename} + ${entity}= Update Value To JSON ${entity_payload} $.id ${entity_id} + ${entity}= Update Value To JSON ${entity} $.locatedAt.object ${linked_entity_id} + ${response}= Create Entity From JSON-LD Content + ... ${entity} + Check Response Status Code 201 ${response.status_code} + RETURN ${response} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_10.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_10.robot new file mode 100644 index 00000000..e4cb0522 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_10.robot @@ -0,0 +1,69 @@ +*** Settings *** +Documentation Check that an entity can be retrieved with a linked entity in different join types and representations + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity And Linked Entity +Test Teardown Delete Created Entity And Linked Entity +Test Template Retrieve Entity With Linked Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${city_id_prefix}= urn:ngsi-ld:City: +${linking_entity_filename}= building-relationship.jsonld +${linked_entity_filename}= city-minimal.jsonld + + +*** Test Cases *** JOIN OPTIONS EXPECTATION_FILENAME +018_10_01 Inline Normalized + [Tags] e-retrieve 5_7_1 4_5_23 since_v1.8.1 + inline ${EMPTY} linked-entity-retrieval/building-one-level-inline-018-10.json +018_10_02 Flat Normalized + [Tags] e-retrieve 5_7_1 4_5_23 since_v1.8.1 + flat ${EMPTY} linked-entity-retrieval/building-one-level-flat-018-10.json +018_10_03 Inline Simplified + [Tags] e-retrieve 5_7_1 4_5_23 since_v1.8.1 + inline keyValues linked-entity-retrieval/building-one-level-inline-simplified-018-10.json +018_10_04 Flat Simplified + [Tags] e-retrieve 5_7_1 4_5_23 since_v1.8.1 + flat keyValues linked-entity-retrieval/building-one-level-flat-simplified-018-10.json + + +*** Keywords *** +Retrieve Entity With Linked Entity + [Documentation] Check that an entity can be retrieved with a linked entity in different join types and representations + [Arguments] ${join} ${options} ${expectation_filename} + ${response}= Query Entity + ... id=${linking_entity_id} + ... join=${join} + ... joinLevel=1 + ... options=${options} + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Content + ... expectation_filename=${expectation_filename} + ... response_body=${response.json()} + +Create Initial Entity And Linked Entity + ${linking_entity_id}= Catenate ${building_id_prefix}018-10 + Set Suite Variable ${linking_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${linking_entity_filename} + ... ${linking_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${linked_entity_id}= Catenate ${city_id_prefix}Paris + Set Suite Variable ${linked_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${linked_entity_filename} + ... ${linked_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Created Entity And Linked Entity + Delete Entity by Id ${linking_entity_id} + Delete Entity by Id ${linked_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_11.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_11.robot new file mode 100644 index 00000000..aba0207c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_11.robot @@ -0,0 +1,53 @@ +*** Settings *** +Documentation Check that an entity can be retrieved with an inline linked entity with sysAttrs + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity And Linked Entity +Test Teardown Delete Created Entity And Linked Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${city_id_prefix}= urn:ngsi-ld:City: +${linking_entity_filename}= building-relationship.jsonld +${linked_entity_filename}= city-minimal.jsonld + + +*** Test Cases *** +018_11_01 Retrieve Entity With Inline Linked Entity And SysAttrs + [Documentation] Check that an entity can be retrieved with an inline linked entity with sysAttrs + [Tags] e-retrieve 5_7_1 4_5_23 since_v1.8.1 + ${response}= Query Entity + ... id=${linking_entity_id} + ... join=inline + ... joinLevel=1 + ... options=sysAttrs + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Dictionary Should Contain Key ${response.json()}[locatedAt][entity] createdAt + + +*** Keywords *** +Create Initial Entity And Linked Entity + ${linking_entity_id}= Catenate ${building_id_prefix}018-11 + Set Suite Variable ${linking_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${linking_entity_filename} + ... ${linking_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${linked_entity_id}= Catenate ${city_id_prefix}Paris + Set Suite Variable ${linked_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${linked_entity_filename} + ... ${linked_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Created Entity And Linked Entity + Delete Entity by Id ${linking_entity_id} + Delete Entity by Id ${linked_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_12.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_12.robot new file mode 100644 index 00000000..36716b85 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_12.robot @@ -0,0 +1,54 @@ +*** Settings *** +Documentation Check that an entity can be retrieved with a flat linked entity with sysAttrs + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity And Linked Entity +Test Teardown Delete Created Entity And Linked Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${city_id_prefix}= urn:ngsi-ld:City: +${linking_entity_filename}= building-relationship.jsonld +${linked_entity_filename}= city-minimal.jsonld + + +*** Test Cases *** +018_12_01 Retrieve Entity With Flat Linked Entity And SysAttrs + [Documentation] Check that an entity can be retrieved with a flat linked entity with sysAttrs + [Tags] e-retrieve 5_7_1 4_5_23 since_v1.8.1 + ${response}= Query Entity + ... id=${linking_entity_id} + ... join=flat + ... joinLevel=1 + ... options=sysAttrs + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Dictionary Should Contain Key ${response.json()}[0] createdAt + Dictionary Should Contain Key ${response.json()}[1] createdAt + + +*** Keywords *** +Create Initial Entity And Linked Entity + ${linking_entity_id}= Catenate ${building_id_prefix}018-12 + Set Suite Variable ${linking_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${linking_entity_filename} + ... ${linking_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + ${linked_entity_id}= Catenate ${city_id_prefix}Paris + Set Suite Variable ${linked_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${linked_entity_filename} + ... ${linked_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Created Entity And Linked Entity + Delete Entity by Id ${linking_entity_id} + Delete Entity by Id ${linked_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_13.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_13.robot new file mode 100644 index 00000000..f6530d56 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_13.robot @@ -0,0 +1,81 @@ +*** Settings *** +Documentation Check that an entity can be retrieved with two levels linked entities in different join types and representations + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity And Linked Entities +Test Teardown Delete Created Entity And Linked Entities +Test Template Retrieve Entity With Linked Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${city_id_prefix}= urn:ngsi-ld:City: +${country_id_prefix}= urn:ngsi-ld:Country: +${linking_entity_filename}= building-relationship.jsonld +${level_1_linked_entity_filename}= city-relationship.jsonld +${level_2_linked_entity_filename}= country-minimal.jsonld + + +*** Test Cases *** JOIN OPTIONS EXPECTATION_FILENAME +018_13_01 Inline Normalized + [Tags] e-retrieve 5_7_1 4_5_23 since_v1.8.1 + inline ${EMPTY} linked-entity-retrieval/building-two-levels-inline-018-13.json +018_13_02 Flat Normalized + [Tags] e-retrieve 5_7_1 4_5_23 since_v1.8.1 + flat ${EMPTY} linked-entity-retrieval/building-two-levels-flat-018-13.json +018_13_03 Inline Simplified + [Tags] e-retrieve 5_7_1 4_5_23 since_v1.8.1 + inline keyValues linked-entity-retrieval/building-two-levels-inline-simplified-018-13.json +018_13_04 Flat Simplified + [Tags] e-retrieve 5_7_1 4_5_23 since_v1.8.1 + flat keyValues linked-entity-retrieval/building-two-levels-flat-simplified-018-13.json + + +*** Keywords *** +Retrieve Entity With Linked Entity + [Documentation] Check that an entity can be retrieved with two levels linked entities in different join types and representations + [Arguments] ${join} ${options} ${expectation_filename} + ${response}= Query Entity + ... id=${linking_entity_id} + ... join=${join} + ... joinLevel=2 + ... options=${options} + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Content + ... expectation_filename=${expectation_filename} + ... response_body=${response.json()} + +Create Initial Entity And Linked Entities + ${linking_entity_id}= Catenate ${building_id_prefix}018-13 + Set Suite Variable ${linking_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${linking_entity_filename} + ... ${linking_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + + ${level_1_linked_entity_id}= Catenate ${city_id_prefix}Paris + Set Suite Variable ${level_1_linked_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${level_1_linked_entity_filename} + ... ${level_1_linked_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + + ${level_2_linked_entity_id}= Catenate ${country_id_prefix}France + Set Suite Variable ${level_2_linked_entity_id} + ${response}= Create Entity Selecting Content Type + ... ${level_2_linked_entity_filename} + ... ${level_2_linked_entity_id} + ... ${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Created Entity And Linked Entities + Delete Entity by Id ${linking_entity_id} + Delete Entity by Id ${level_1_linked_entity_id} + Delete Entity by Id ${level_2_linked_entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_14.robot b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_14.robot new file mode 100644 index 00000000..f76b51a0 --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_14.robot @@ -0,0 +1,52 @@ +*** Settings *** +Documentation Check that an entity can be retrieved asking for a non-existent linked entity + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Setup Create Initial Entity +Test Teardown Delete Created Entity +Test Template Retrieve Entity With Non Existent Linked Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: +${linking_entity_filename}= building-relationship.jsonld + + +*** Test Cases *** JOIN EXPECTATION_FILENAME +018_14_01 Inline + [Tags] e-retrieve 5_7_1 4_5_23 since_v1.8.1 + inline linked-entity-retrieval/building-non-existent-inline-flat-018-14.json +018_14_02 Flat + [Tags] e-retrieve 5_7_1 4_5_23 since_v1.8.1 + flat linked-entity-retrieval/building-non-existent-inline-flat-018-14.json + + +*** Keywords *** +Retrieve Entity With Non Existent Linked Entity + [Documentation] Check that an entity can be retrieved asking for a non-existent linked entity + [Arguments] ${join} ${expectation_filename} + ${response}= Query Entity + ... id=${linking_entity_id} + ... join=${join} + ... joinLevel=1 + ... context=${ngsild_test_suite_context} + Check Response Status Code 200 ${response.status_code} + Check Response Body Content + ... expectation_filename=${expectation_filename} + ... response_body=${response.json()} + +Create Initial Entity + ${linking_entity_id}= Catenate ${building_id_prefix}018-14 + Set Suite Variable ${linking_entity_id} + ${response}= Create Entity Selecting Content Type + ... filename=${linking_entity_filename} + ... entity_id=${linking_entity_id} + ... content_type=${CONTENT_TYPE_LD_JSON} + Check Response Status Code 201 ${response.status_code} + +Delete Created Entity + Delete Entity by Id ${linking_entity_id} diff --git a/data/entities/city-minimal.jsonld b/data/entities/city-minimal.jsonld new file mode 100644 index 00000000..5880d2c0 --- /dev/null +++ b/data/entities/city-minimal.jsonld @@ -0,0 +1,7 @@ +{ + "id": "urn:ngsi-ld:City:randomUUID", + "type": "City", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/city-relationship.jsonld b/data/entities/city-relationship.jsonld new file mode 100644 index 00000000..10d69b5d --- /dev/null +++ b/data/entities/city-relationship.jsonld @@ -0,0 +1,11 @@ +{ + "id": "urn:ngsi-ld:City:randomUUID", + "type": "City", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:Country:France" + }, + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/country-minimal.jsonld b/data/entities/country-minimal.jsonld new file mode 100644 index 00000000..f72af7e4 --- /dev/null +++ b/data/entities/country-minimal.jsonld @@ -0,0 +1,7 @@ +{ + "id": "urn:ngsi-ld:Country:randomUUID", + "type": "Country", + "@context": [ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/building-non-existent-inline-flat-018-14.json b/data/entities/expectations/linked-entity-retrieval/building-non-existent-inline-flat-018-14.json new file mode 100644 index 00000000..f46137db --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/building-non-existent-inline-flat-018-14.json @@ -0,0 +1,8 @@ +{ + "id": "urn:ngsi-ld:Building:018-14", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris" + } +} \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/building-one-level-flat-018-10.json b/data/entities/expectations/linked-entity-retrieval/building-one-level-flat-018-10.json new file mode 100644 index 00000000..38577b56 --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/building-one-level-flat-018-10.json @@ -0,0 +1,14 @@ +[ + { + "id": "urn:ngsi-ld:Building:018-10", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris" + } + }, + { + "id": "urn:ngsi-ld:City:Paris", + "type": "City" + } +] \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/building-one-level-flat-simplified-018-10.json b/data/entities/expectations/linked-entity-retrieval/building-one-level-flat-simplified-018-10.json new file mode 100644 index 00000000..3b67e157 --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/building-one-level-flat-simplified-018-10.json @@ -0,0 +1,11 @@ +[ + { + "id": "urn:ngsi-ld:Building:018-10", + "type": "Building", + "locatedAt": "urn:ngsi-ld:City:Paris" + }, + { + "id": "urn:ngsi-ld:City:Paris", + "type": "City" + } +] \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/building-one-level-inline-018-10.json b/data/entities/expectations/linked-entity-retrieval/building-one-level-inline-018-10.json new file mode 100644 index 00000000..a63bf6a8 --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/building-one-level-inline-018-10.json @@ -0,0 +1,12 @@ +{ + "id": "urn:ngsi-ld:Building:018-10", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris", + "entity": { + "id": "urn:ngsi-ld:City:Paris", + "type": "City" + } + } +} \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/building-one-level-inline-simplified-018-10.json b/data/entities/expectations/linked-entity-retrieval/building-one-level-inline-simplified-018-10.json new file mode 100644 index 00000000..f1601cdd --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/building-one-level-inline-simplified-018-10.json @@ -0,0 +1,8 @@ +{ + "id": "urn:ngsi-ld:Building:018-10", + "type": "Building", + "locatedAt": { + "id": "urn:ngsi-ld:City:Paris", + "type": "City" + } +} \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/building-two-levels-flat-018-13.json b/data/entities/expectations/linked-entity-retrieval/building-two-levels-flat-018-13.json new file mode 100644 index 00000000..091654ae --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/building-two-levels-flat-018-13.json @@ -0,0 +1,22 @@ +[ + { + "id": "urn:ngsi-ld:Building:018-13", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris" + } + }, + { + "id": "urn:ngsi-ld:City:Paris", + "type": "City", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:Country:France" + } + }, + { + "id": "urn:ngsi-ld:Country:France", + "type": "Country" + } +] \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/building-two-levels-flat-simplified-018-13.json b/data/entities/expectations/linked-entity-retrieval/building-two-levels-flat-simplified-018-13.json new file mode 100644 index 00000000..17634666 --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/building-two-levels-flat-simplified-018-13.json @@ -0,0 +1,16 @@ +[ + { + "id": "urn:ngsi-ld:Building:018-13", + "type": "Building", + "locatedAt": "urn:ngsi-ld:City:Paris" + }, + { + "id": "urn:ngsi-ld:City:Paris", + "type": "City", + "locatedAt": "urn:ngsi-ld:Country:France" + }, + { + "id": "urn:ngsi-ld:Country:France", + "type": "Country" + } +] \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/building-two-levels-inline-018-13.json b/data/entities/expectations/linked-entity-retrieval/building-two-levels-inline-018-13.json new file mode 100644 index 00000000..5b933ea8 --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/building-two-levels-inline-018-13.json @@ -0,0 +1,20 @@ +{ + "id": "urn:ngsi-ld:Building:018-13", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:Paris", + "entity": { + "id": "urn:ngsi-ld:City:Paris", + "type": "City", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:Country:France", + "entity": { + "id": "urn:ngsi-ld:Country:France", + "type": "Country" + } + } + } + } +} \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/building-two-levels-inline-simplified-018-13.json b/data/entities/expectations/linked-entity-retrieval/building-two-levels-inline-simplified-018-13.json new file mode 100644 index 00000000..c6877368 --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/building-two-levels-inline-simplified-018-13.json @@ -0,0 +1,12 @@ +{ + "id": "urn:ngsi-ld:Building:018-13", + "type": "Building", + "locatedAt": { + "id": "urn:ngsi-ld:City:Paris", + "type": "City", + "locatedAt": { + "id": "urn:ngsi-ld:Country:France", + "type": "Country" + } + } +} \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/buildings-one-level-flat-019-13.json b/data/entities/expectations/linked-entity-retrieval/buildings-one-level-flat-019-13.json new file mode 100644 index 00000000..4dff4978 --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/buildings-one-level-flat-019-13.json @@ -0,0 +1,26 @@ +[ + { + "id": "urn:ngsi-ld:Building:019-13-1", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:019-13-1" + } + }, + { + "id": "urn:ngsi-ld:Building:019-13-2", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:019-13-2" + } + }, + { + "id": "urn:ngsi-ld:City:019-13-1", + "type": "City" + }, + { + "id": "urn:ngsi-ld:City:019-13-2", + "type": "City" + } +] \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/buildings-one-level-flat-simplified-019-13.json b/data/entities/expectations/linked-entity-retrieval/buildings-one-level-flat-simplified-019-13.json new file mode 100644 index 00000000..e3c3f40c --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/buildings-one-level-flat-simplified-019-13.json @@ -0,0 +1,20 @@ +[ + { + "id": "urn:ngsi-ld:Building:019-13-1", + "type": "Building", + "locatedAt": "urn:ngsi-ld:City:019-13-1" + }, + { + "id": "urn:ngsi-ld:Building:019-13-2", + "type": "Building", + "locatedAt": "urn:ngsi-ld:City:019-13-2" + }, + { + "id": "urn:ngsi-ld:City:019-13-1", + "type": "City" + }, + { + "id": "urn:ngsi-ld:City:019-13-2", + "type": "City" + } +] \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/buildings-one-level-inline-019-13.json b/data/entities/expectations/linked-entity-retrieval/buildings-one-level-inline-019-13.json new file mode 100644 index 00000000..57dfcb3e --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/buildings-one-level-inline-019-13.json @@ -0,0 +1,26 @@ +[ + { + "id": "urn:ngsi-ld:Building:019-13-1", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:019-13-1", + "entity": { + "id": "urn:ngsi-ld:City:019-13-1", + "type": "City" + } + } + }, + { + "id": "urn:ngsi-ld:Building:019-13-2", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:019-13-2", + "entity": { + "id": "urn:ngsi-ld:City:019-13-2", + "type": "City" + } + } + } +] \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/buildings-one-level-inline-simplified-019-13.json b/data/entities/expectations/linked-entity-retrieval/buildings-one-level-inline-simplified-019-13.json new file mode 100644 index 00000000..b6d0c532 --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/buildings-one-level-inline-simplified-019-13.json @@ -0,0 +1,18 @@ +[ + { + "id": "urn:ngsi-ld:Building:019-13-1", + "type": "Building", + "locatedAt": { + "id": "urn:ngsi-ld:City:019-13-1", + "type": "City" + } + }, + { + "id": "urn:ngsi-ld:Building:019-13-2", + "type": "Building", + "locatedAt": { + "id": "urn:ngsi-ld:City:019-13-2", + "type": "City" + } + } +] \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/buildings-two-levels-flat-019-16.json b/data/entities/expectations/linked-entity-retrieval/buildings-two-levels-flat-019-16.json new file mode 100644 index 00000000..ab297812 --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/buildings-two-levels-flat-019-16.json @@ -0,0 +1,42 @@ +[ + { + "id": "urn:ngsi-ld:Building:019-16-1", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:019-16-1" + } + }, + { + "id": "urn:ngsi-ld:Building:019-16-2", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:019-16-2" + } + }, + { + "id": "urn:ngsi-ld:City:019-16-1", + "type": "City", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:Country:019-16-1" + } + }, + { + "id": "urn:ngsi-ld:City:019-16-2", + "type": "City", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:Country:019-16-2" + } + }, + { + "id": "urn:ngsi-ld:Country:019-16-1", + "type": "Country" + }, + { + "id": "urn:ngsi-ld:Country:019-16-2", + "type": "Country" + } +] \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/buildings-two-levels-flat-simplified-019-16.json b/data/entities/expectations/linked-entity-retrieval/buildings-two-levels-flat-simplified-019-16.json new file mode 100644 index 00000000..f0e52185 --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/buildings-two-levels-flat-simplified-019-16.json @@ -0,0 +1,30 @@ +[ + { + "id": "urn:ngsi-ld:Building:019-16-1", + "type": "Building", + "locatedAt": "urn:ngsi-ld:City:019-16-1" + }, + { + "id": "urn:ngsi-ld:Building:019-16-2", + "type": "Building", + "locatedAt": "urn:ngsi-ld:City:019-16-2" + }, + { + "id": "urn:ngsi-ld:City:019-16-1", + "type": "City", + "locatedAt": "urn:ngsi-ld:Country:019-16-1" + }, + { + "id": "urn:ngsi-ld:City:019-16-2", + "type": "City", + "locatedAt": "urn:ngsi-ld:Country:019-16-2" + }, + { + "id": "urn:ngsi-ld:Country:019-16-1", + "type": "Country" + }, + { + "id": "urn:ngsi-ld:Country:019-16-2", + "type": "Country" + } +] \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/buildings-two-levels-inline-019-16.json b/data/entities/expectations/linked-entity-retrieval/buildings-two-levels-inline-019-16.json new file mode 100644 index 00000000..090ab05a --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/buildings-two-levels-inline-019-16.json @@ -0,0 +1,42 @@ +[ + { + "id": "urn:ngsi-ld:Building:019-16-1", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:019-16-1", + "entity": { + "id": "urn:ngsi-ld:City:019-16-1", + "type": "City", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:Country:019-16-1", + "entity": { + "id": "urn:ngsi-ld:Country:019-16-1", + "type": "Country" + } + } + } + } + }, + { + "id": "urn:ngsi-ld:Building:019-16-2", + "type": "Building", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:City:019-16-2", + "entity": { + "id": "urn:ngsi-ld:City:019-16-2", + "type": "City", + "locatedAt": { + "type": "Relationship", + "object": "urn:ngsi-ld:Country:019-16-2", + "entity": { + "id": "urn:ngsi-ld:Country:019-16-2", + "type": "Country" + } + } + } + } + } +] \ No newline at end of file diff --git a/data/entities/expectations/linked-entity-retrieval/buildings-two-levels-inline-simplified-019-16.json b/data/entities/expectations/linked-entity-retrieval/buildings-two-levels-inline-simplified-019-16.json new file mode 100644 index 00000000..7b139b84 --- /dev/null +++ b/data/entities/expectations/linked-entity-retrieval/buildings-two-levels-inline-simplified-019-16.json @@ -0,0 +1,26 @@ +[ + { + "id": "urn:ngsi-ld:Building:019-16-1", + "type": "Building", + "locatedAt": { + "id": "urn:ngsi-ld:City:019-16-1", + "type": "City", + "locatedAt": { + "id": "urn:ngsi-ld:Country:019-16-1", + "type": "Country" + } + } + }, + { + "id": "urn:ngsi-ld:Building:019-16-2", + "type": "Building", + "locatedAt": { + "id": "urn:ngsi-ld:City:019-16-2", + "type": "City", + "locatedAt": { + "id": "urn:ngsi-ld:Country:019-16-2", + "type": "Country" + } + } + } +] \ No newline at end of file diff --git a/doc/analysis/initial_setup.py b/doc/analysis/initial_setup.py index 9a4ed342..3867941e 100644 --- a/doc/analysis/initial_setup.py +++ b/doc/analysis/initial_setup.py @@ -14,6 +14,9 @@ class InitialSetup: 'Initiate Test Case': InitialSetup.init_entity(), 'Create Initial Entity': InitialSetup.init_entity2(), 'Setup Initial Entity': InitialSetup.init_entity2(), + 'Create Initial Entity And Linked Entity': InitialSetup.init_entity_with_linked_entity(), + 'Create Initial Entity And Linked Entities': InitialSetup.init_entity_with_linked_entities(), + 'Create Initial Entities And Linked Entities': InitialSetup.init_entities_with_linked_entities(), 'Initialize Environment': InitialSetup.init_entity2(), 'Initialize Test': InitialSetup.init_entity2(), 'Create Temporal Entity': InitialSetup.init_temporal_entity(), @@ -89,6 +92,36 @@ class InitialSetup: }''' return data + @staticmethod + def init_entity_with_linked_entity() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing an initial Entity ${entity} + with an id set to ${linking_entity_id} + and a linked entity with an id set to ${linked_entity_id} +}''' + return data + + @staticmethod + def init_entity_with_linked_entities() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing an initial Entity ${entity} + with an id set to ${linking_entity_id} + and a linked entity with an id set to ${level_1_linked_entity_id} + containing itself a linked entity with an id set to ${level_2_linked_entity_id} +}''' + return data + + @staticmethod + def init_entities_with_linked_entities() -> str: + data = '''with { + the SUT being in the "initial state" and + the SUT containing initial Entities ${first_entity_id} and ${second_entity_id} + each one having a linked entity with an id respectively set to ${first_linked_entity_id} and ${second_linked_entity_id} + }''' + return data + @staticmethod def init_temporal_entity() -> str: data = '''with { diff --git a/doc/analysis/requests.py b/doc/analysis/requests.py index d098ffa0..7283c6d9 100644 --- a/doc/analysis/requests.py +++ b/doc/analysis/requests.py @@ -20,6 +20,10 @@ class Requests: 'positions': [0], 'params': ['filename'] }, + 'Create Entity From JSON-LD Content': { + 'positions': [0], + 'params': ['content'] + }, 'Batch Create Entities': { 'positions': [1], 'params': ['content_type'] @@ -30,7 +34,7 @@ class Requests: }, 'Query Entity': { 'positions': [], - 'params': ['id', 'accept', 'attrs', 'context', 'geometryProperty', 'options', 'lang'] + 'params': ['id', 'accept', 'attrs', 'context', 'geometryProperty', 'options', 'lang', 'join', 'joinLevel'] }, 'Retrieve Subscription': { 'positions': [], @@ -86,7 +90,8 @@ class Requests: 'params': ['entity_ids', 'entity_types', 'accept', 'attrs', 'context', 'geoproperty', 'options', 'limit', 'entity_id_pattern', - 'scopeq', 'georel', 'coordinates', 'geometry', 'count', 'q', 'datasetId'] + 'scopeq', 'georel', 'coordinates', 'geometry', 'count', 'q', 'datasetId', + 'join', 'joinLevel'] }, 'Query Entities Via POST': { 'positions': [], @@ -781,7 +786,7 @@ class Requests: @staticmethod def query_entity(kwargs) -> str: - expected_parameters = ['id', 'accept', 'attrs', 'context', 'geometry_property', 'options', 'lang'] + expected_parameters = ['id', 'accept', 'attrs', 'context', 'geometry_property', 'options', 'lang', 'join', 'joinLevel'] result = [x for x in kwargs if x not in expected_parameters] response = "Get Entity Request:" @@ -802,6 +807,10 @@ class Requests: response = f"{response} and\n Query Parameter: options set to '{value}'" case 'lang': response = f"{response} and\n Query Parameter: lang set to '{value}'" + case 'join': + response = f"{response} and\n Query Parameter: join set to '{value}'" + case 'joinLevel': + response = f"{response} and\n Query Parameter: joinLevel set to '{value}'" case _: raise Exception(f"ERROR: unexpected attribute(s) {result}, the attributes expected are " f"{expected_parameters}, but received: {kwargs}") @@ -1257,7 +1266,8 @@ class Requests: expected_parameters = ['entity_ids', 'entity_types', 'accept', 'attrs', 'context', 'geoproperty', 'options', 'limit', 'entity_id_pattern', - 'scopeq', 'georel', 'coordinates', 'geometry', 'count' , 'q' , 'datasetId'] + 'scopeq', 'georel', 'coordinates', 'geometry', 'count' , 'q' , 'datasetId', + 'join', 'joinLevel'] result = [x for x in kwargs if x not in expected_parameters] response = "Get Entities Request:" @@ -1296,6 +1306,10 @@ class Requests: response = f"{response} and\n Query Parameter: q set to '{value}'" case 'datasetId': response = f"{response} and\n Query Parameter: datasetId set to '{value}'" + case 'join': + response = f"{response} and\n Query Parameter: join set to '{value}'" + case 'joinLevel': + response = f"{response} and\n Query Parameter: joinLevel set to '{value}'" case _: raise Exception(f"ERROR: unexpected attribute(s) {result}, the attributes expected are " f"{expected_parameters}, but received: {kwargs}") diff --git a/doc/files/ContextInformation/Consumption/018_10.json b/doc/files/ContextInformation/Consumption/018_10.json new file mode 100644 index 00000000..a19bf629 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/018_10.json @@ -0,0 +1,99 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/018_10", + "test_objective": "Check that an entity can be retrieved with a linked entity in different join types and representations", + "reference": "ETSI GS CIM 009 V1.8.1 [], clauses 4.5.23, 5.7.1", + "config_id": "", + "parent_release": "v1.8.1", + "clauses": [ + "4.5.23", + "5.7.1" + ], + "pics_selection": "", + "keywords": [ + "Retrieve Entity With Linked Entity", + "Create Initial Entity And Linked Entity", + "Delete Created Entity And Linked Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${linking_entity_id}\n and a linked entity with an id set to ${linked_entity_id}\n}", + "test_cases": [ + { + "name": "018_10_01 Inline Normalized", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_10_01", + "doc": "Check that an entity can be retrieved with a linked entity in different join types and representations", + "tags": [ + "4_5_23", + "5_7_1", + "e-retrieve", + "since_v1.8.1" + ], + "setup": "Create Initial Entity And Linked Entity", + "teardown": "Delete Created Entity And Linked Entity", + "template": "Retrieve Entity With Linked Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Entity with Response Status Code set to 200 and\n Retrieve Entity with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/building-one-level-inline-018-10.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Retrieve Entity Request: and\n Query Parameter: id set to '${linking_entity_id}' and\n Query Parameter: join set to 'inline' and\n Query Parameter: joinLevel set to '1' and\n Query Parameter: options set to '${EMPTY}' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + }, + { + "name": "018_10_02 Flat Normalized", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_10_02", + "doc": "Check that an entity can be retrieved with a linked entity in different join types and representations", + "tags": [ + "4_5_23", + "5_7_1", + "e-retrieve", + "since_v1.8.1" + ], + "setup": "Create Initial Entity And Linked Entity", + "teardown": "Delete Created Entity And Linked Entity", + "template": "Retrieve Entity With Linked Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Entity with Response Status Code set to 200 and\n Retrieve Entity with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/building-one-level-flat-018-10.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Retrieve Entity Request: and\n Query Parameter: id set to '${linking_entity_id}' and\n Query Parameter: join set to 'flat' and\n Query Parameter: joinLevel set to '1' and\n Query Parameter: options set to '${EMPTY}' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + }, + { + "name": "018_10_03 Inline Simplified", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_10_03", + "doc": "Check that an entity can be retrieved with a linked entity in different join types and representations", + "tags": [ + "4_5_23", + "5_7_1", + "e-retrieve", + "since_v1.8.1" + ], + "setup": "Create Initial Entity And Linked Entity", + "teardown": "Delete Created Entity And Linked Entity", + "template": "Retrieve Entity With Linked Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Entity with Response Status Code set to 200 and\n Retrieve Entity with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/building-one-level-inline-simplified-018-10.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Retrieve Entity Request: and\n Query Parameter: id set to '${linking_entity_id}' and\n Query Parameter: join set to 'inline' and\n Query Parameter: joinLevel set to '1' and\n Query Parameter: options set to 'keyValues' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + }, + { + "name": "018_10_04 Flat Simplified", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_10_04", + "doc": "Check that an entity can be retrieved with a linked entity in different join types and representations", + "tags": [ + "4_5_23", + "5_7_1", + "e-retrieve", + "since_v1.8.1" + ], + "setup": "Create Initial Entity And Linked Entity", + "teardown": "Delete Created Entity And Linked Entity", + "template": "Retrieve Entity With Linked Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Entity with Response Status Code set to 200 and\n Retrieve Entity with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/building-one-level-flat-simplified-018-10.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Retrieve Entity Request: and\n Query Parameter: id set to '${linking_entity_id}' and\n Query Parameter: join set to 'flat' and\n Query Parameter: joinLevel set to '1' and\n Query Parameter: options set to 'keyValues' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/Entity/RetrieveEntity", + "robotfile": "018_10" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/018_11.json b/doc/files/ContextInformation/Consumption/018_11.json new file mode 100644 index 00000000..6cbc63ce --- /dev/null +++ b/doc/files/ContextInformation/Consumption/018_11.json @@ -0,0 +1,41 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/018_11", + "test_objective": "Check that an entity can be retrieved with an inline linked entity with sysAttrs", + "reference": "ETSI GS CIM 009 V1.8.1 [], clauses 4.5.23, 5.7.1", + "config_id": "", + "parent_release": "v1.8.1", + "clauses": [ + "4.5.23", + "5.7.1" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Entity And Linked Entity", + "Delete Created Entity And Linked Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${linking_entity_id}\n and a linked entity with an id set to ${linked_entity_id}\n}", + "test_cases": [ + { + "name": "018_11_01 Retrieve Entity With Inline Linked Entity And SysAttrs", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_11_01", + "doc": "Check that an entity can be retrieved with an inline linked entity with sysAttrs", + "tags": [ + "4_5_23", + "5_7_1", + "e-retrieve", + "since_v1.8.1" + ], + "setup": "Create Initial Entity And Linked Entity", + "teardown": "Delete Created Entity And Linked Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Retrieve Entity with Response Status Code set to 200\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Retrieve Entity Request: and\n Query Parameter: id set to '${linking_entity_id}' and\n Query Parameter: join set to 'inline' and\n Query Parameter: joinLevel set to '1' and\n Query Parameter: options set to 'sysAttrs' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/RetrieveEntity", + "robotfile": "018_11" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/018_12.json b/doc/files/ContextInformation/Consumption/018_12.json new file mode 100644 index 00000000..75aab338 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/018_12.json @@ -0,0 +1,41 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/018_12", + "test_objective": "Check that an entity can be retrieved with a flat linked entity with sysAttrs", + "reference": "ETSI GS CIM 009 V1.8.1 [], clauses 4.5.23, 5.7.1", + "config_id": "", + "parent_release": "v1.8.1", + "clauses": [ + "4.5.23", + "5.7.1" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Entity And Linked Entity", + "Delete Created Entity And Linked Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${linking_entity_id}\n and a linked entity with an id set to ${linked_entity_id}\n}", + "test_cases": [ + { + "name": "018_12_01 Retrieve Entity With Flat Linked Entity And SysAttrs", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_12_01", + "doc": "Check that an entity can be retrieved with a flat linked entity with sysAttrs", + "tags": [ + "4_5_23", + "5_7_1", + "e-retrieve", + "since_v1.8.1" + ], + "setup": "Create Initial Entity And Linked Entity", + "teardown": "Delete Created Entity And Linked Entity", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Retrieve Entity with Response Status Code set to 200\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Retrieve Entity Request: and\n Query Parameter: id set to '${linking_entity_id}' and\n Query Parameter: join set to 'flat' and\n Query Parameter: joinLevel set to '1' and\n Query Parameter: options set to 'sysAttrs' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/RetrieveEntity", + "robotfile": "018_12" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/018_13.json b/doc/files/ContextInformation/Consumption/018_13.json new file mode 100644 index 00000000..065d59bb --- /dev/null +++ b/doc/files/ContextInformation/Consumption/018_13.json @@ -0,0 +1,99 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/018_13", + "test_objective": "Check that an entity can be retrieved with two levels linked entities in different join types and representations", + "reference": "ETSI GS CIM 009 V1.8.1 [], clauses 4.5.23, 5.7.1", + "config_id": "", + "parent_release": "v1.8.1", + "clauses": [ + "4.5.23", + "5.7.1" + ], + "pics_selection": "", + "keywords": [ + "Retrieve Entity With Linked Entity", + "Create Initial Entity And Linked Entities", + "Delete Created Entity And Linked Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${linking_entity_id}\n and a linked entity with an id set to ${level_1_linked_entity_id}\n containing itself a linked entity with an id set to ${level_2_linked_entity_id}\n}", + "test_cases": [ + { + "name": "018_13_01 Inline Normalized", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_13_01", + "doc": "Check that an entity can be retrieved with two levels linked entities in different join types and representations", + "tags": [ + "4_5_23", + "5_7_1", + "e-retrieve", + "since_v1.8.1" + ], + "setup": "Create Initial Entity And Linked Entities", + "teardown": "Delete Created Entity And Linked Entities", + "template": "Retrieve Entity With Linked Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Entity with Response Status Code set to 200 and\n Retrieve Entity with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/building-two-levels-inline-018-13.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Retrieve Entity Request: and\n Query Parameter: id set to '${linking_entity_id}' and\n Query Parameter: join set to 'inline' and\n Query Parameter: joinLevel set to '2' and\n Query Parameter: options set to '${EMPTY}' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + }, + { + "name": "018_13_02 Flat Normalized", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_13_02", + "doc": "Check that an entity can be retrieved with two levels linked entities in different join types and representations", + "tags": [ + "4_5_23", + "5_7_1", + "e-retrieve", + "since_v1.8.1" + ], + "setup": "Create Initial Entity And Linked Entities", + "teardown": "Delete Created Entity And Linked Entities", + "template": "Retrieve Entity With Linked Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Entity with Response Status Code set to 200 and\n Retrieve Entity with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/building-two-levels-flat-018-13.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Retrieve Entity Request: and\n Query Parameter: id set to '${linking_entity_id}' and\n Query Parameter: join set to 'flat' and\n Query Parameter: joinLevel set to '2' and\n Query Parameter: options set to '${EMPTY}' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + }, + { + "name": "018_13_03 Inline Simplified", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_13_03", + "doc": "Check that an entity can be retrieved with two levels linked entities in different join types and representations", + "tags": [ + "4_5_23", + "5_7_1", + "e-retrieve", + "since_v1.8.1" + ], + "setup": "Create Initial Entity And Linked Entities", + "teardown": "Delete Created Entity And Linked Entities", + "template": "Retrieve Entity With Linked Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Entity with Response Status Code set to 200 and\n Retrieve Entity with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/building-two-levels-inline-simplified-018-13.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Retrieve Entity Request: and\n Query Parameter: id set to '${linking_entity_id}' and\n Query Parameter: join set to 'inline' and\n Query Parameter: joinLevel set to '2' and\n Query Parameter: options set to 'keyValues' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + }, + { + "name": "018_13_04 Flat Simplified", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_13_04", + "doc": "Check that an entity can be retrieved with two levels linked entities in different join types and representations", + "tags": [ + "4_5_23", + "5_7_1", + "e-retrieve", + "since_v1.8.1" + ], + "setup": "Create Initial Entity And Linked Entities", + "teardown": "Delete Created Entity And Linked Entities", + "template": "Retrieve Entity With Linked Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Retrieve Entity with Response Status Code set to 200 and\n Retrieve Entity with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/building-two-levels-flat-simplified-018-13.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Retrieve Entity Request: and\n Query Parameter: id set to '${linking_entity_id}' and\n Query Parameter: join set to 'flat' and\n Query Parameter: joinLevel set to '2' and\n Query Parameter: options set to 'keyValues' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/Entity/RetrieveEntity", + "robotfile": "018_13" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/018_14.json b/doc/files/ContextInformation/Consumption/018_14.json new file mode 100644 index 00000000..c6fa962e --- /dev/null +++ b/doc/files/ContextInformation/Consumption/018_14.json @@ -0,0 +1,62 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/018_14", + "test_objective": "Check that an entity can be retrieved asking for a non-existent linked entity", + "reference": "ETSI GS CIM 009 V1.8.1 [], clauses 4.5.23, 5.7.1", + "config_id": "", + "parent_release": "v1.8.1", + "clauses": [ + "4.5.23", + "5.7.1" + ], + "pics_selection": "", + "keywords": [ + "Retrieve Entity With Non Existent Linked Entity", + "Create Initial Entity", + "Delete Created Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing an initial Entity ${entity} \n with an id set to ${entityId} \n}", + "test_cases": [ + { + "name": "018_14_01 Inline", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_14_01", + "doc": "Check that an entity can be retrieved asking for a non-existent linked entity", + "tags": [ + "4_5_23", + "5_7_1", + "e-retrieve", + "since_v1.8.1" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Created Entity", + "template": "Retrieve Entity With Non Existent Linked Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entity with Response Status Code set to 200 and\n Query Entity with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/building-non-existent-inline-flat-018-14.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to '${linking_entity_id}' and\n Query Parameter: join set to 'inline' and\n Query Parameter: joinLevel set to '1' and\n Query Parameter: Link set to '<$https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + }, + { + "name": "018_14_02 Flat", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/018_14_02", + "doc": "Check that an entity can be retrieved asking for a non-existent linked entity", + "tags": [ + "4_5_23", + "5_7_1", + "e-retrieve", + "since_v1.8.1" + ], + "setup": "Create Initial Entity", + "teardown": "Delete Created Entity", + "template": "Retrieve Entity With Non Existent Linked Entity", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entity with Response Status Code set to 200 and\n Query Entity with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/building-non-existent-inline-flat-018-14.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/{id}'\n method set to 'GET'\n Get Entity Request: and\n Query Parameter: id set to '${linking_entity_id}' and\n Query Parameter: join set to 'flat' and\n Query Parameter: joinLevel set to '1' and\n Query Parameter: Link set to '<$https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/{id}" + } + ], + "permutations": [ + "when" + ], + "robotpath": "ContextInformation/Consumption/Entity/RetrieveEntity", + "robotfile": "018_14" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_13.json b/doc/files/ContextInformation/Consumption/019_13.json new file mode 100644 index 00000000..372d1cca --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_13.json @@ -0,0 +1,100 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_13", + "test_objective": "Check that entities can be queried with a linked entity in different join types and representations", + "reference": "ETSI GS CIM 009 V1.8.1 [], clauses 4.5.23, 5.7.2", + "config_id": "", + "parent_release": "v1.8.1", + "clauses": [ + "4.5.23", + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Query Entities With Joins And Representations", + "Create Initial Entities And Linked Entities", + "Delete Created Entities And Linked Entities", + "Create Linking Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing initial Entities ${first_entity_id} and ${second_entity_id}\n each one having a linked entity with an id respectively set to ${first_linked_entity_id} and ${second_linked_entity_id}\n }", + "test_cases": [ + { + "name": "019_13_01 Query Inline Normalized", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_13_01", + "doc": "Check that entities can be queried with a linked entity in different join types and representations", + "tags": [ + "4_5_23", + "5_7_2", + "e-query", + "since_v1.8.1" + ], + "setup": "Create Initial Entities And Linked Entities", + "teardown": "Delete Created Entities And Linked Entities", + "template": "Query Entities With Joins And Representations", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/buildings-one-level-inline-019-13.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to 'Building' and\n Query Parameter: options set to '${EMPTY}' and\n Query Parameter: join set to 'inline' and\n Query Parameter: joinLevel set to '1' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/" + }, + { + "name": "019_13_02 Query Flat Normalized", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_13_02", + "doc": "Check that entities can be queried with a linked entity in different join types and representations", + "tags": [ + "4_5_23", + "5_7_2", + "e-query", + "since_v1.8.1" + ], + "setup": "Create Initial Entities And Linked Entities", + "teardown": "Delete Created Entities And Linked Entities", + "template": "Query Entities With Joins And Representations", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/buildings-one-level-flat-019-13.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to 'Building' and\n Query Parameter: options set to '${EMPTY}' and\n Query Parameter: join set to 'flat' and\n Query Parameter: joinLevel set to '1' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/" + }, + { + "name": "019_13_03 Query Inline Simplified", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_13_03", + "doc": "Check that entities can be queried with a linked entity in different join types and representations", + "tags": [ + "4_5_23", + "5_7_2", + "e-query", + "since_v1.8.1" + ], + "setup": "Create Initial Entities And Linked Entities", + "teardown": "Delete Created Entities And Linked Entities", + "template": "Query Entities With Joins And Representations", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/buildings-one-level-inline-simplified-019-13.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to 'Building' and\n Query Parameter: options set to 'keyValues' and\n Query Parameter: join set to 'inline' and\n Query Parameter: joinLevel set to '1' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/" + }, + { + "name": "019_13_04 Query Flat Simplified", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_13_04", + "doc": "Check that entities can be queried with a linked entity in different join types and representations", + "tags": [ + "4_5_23", + "5_7_2", + "e-query", + "since_v1.8.1" + ], + "setup": "Create Initial Entities And Linked Entities", + "teardown": "Delete Created Entities And Linked Entities", + "template": "Query Entities With Joins And Representations", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/buildings-one-level-flat-simplified-019-13.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to 'Building' and\n Query Parameter: options set to 'keyValues' and\n Query Parameter: join set to 'flat' and\n Query Parameter: joinLevel set to '1' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_13" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_14.json b/doc/files/ContextInformation/Consumption/019_14.json new file mode 100644 index 00000000..03ca59ac --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_14.json @@ -0,0 +1,42 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_14", + "test_objective": "Check that entities can be queried with an inline linked entity with sysAttrs", + "reference": "ETSI GS CIM 009 V1.8.1 [], clauses 4.5.23, 5.7.2", + "config_id": "", + "parent_release": "v1.8.1", + "clauses": [ + "4.5.23", + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Entities And Linked Entities", + "Delete Created Entities And Linked Entities", + "Create Linking Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing initial Entities ${first_entity_id} and ${second_entity_id}\n each one having a linked entity with an id respectively set to ${first_linked_entity_id} and ${second_linked_entity_id}\n }", + "test_cases": [ + { + "name": "019_14_01 Query Entities With Inline Linked Entities And SysAttrs", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_14_01", + "doc": "Check that entities can be queried with an inline linked entity with sysAttrs", + "tags": [ + "4_5_23", + "5_7_2", + "e-query", + "since_v1.8.1" + ], + "setup": "Create Initial Entities And Linked Entities", + "teardown": "Delete Created Entities And Linked Entities", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Query Entities with Response Status Code set to 200\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to 'Building' and\n Query Parameter: options set to 'sysAttrs' and\n Query Parameter: join set to 'inline' and\n Query Parameter: joinLevel set to '1' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_14" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_15.json b/doc/files/ContextInformation/Consumption/019_15.json new file mode 100644 index 00000000..faa9fbe1 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_15.json @@ -0,0 +1,42 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_15", + "test_objective": "Check that entities can be queried with a flat linked entity with sysAttrs", + "reference": "ETSI GS CIM 009 V1.8.1 [], clauses 4.5.23, 5.7.2", + "config_id": "", + "parent_release": "v1.8.1", + "clauses": [ + "4.5.23", + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Create Initial Entities And Linked Entities", + "Delete Created Entities And Linked Entities", + "Create Linking Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing initial Entities ${first_entity_id} and ${second_entity_id}\n each one having a linked entity with an id respectively set to ${first_linked_entity_id} and ${second_linked_entity_id}\n }", + "test_cases": [ + { + "name": "019_15_01 Query Entities With Flat Linked Entities And SysAttrs", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_15_01", + "doc": "Check that entities can be queried with a flat linked entity with sysAttrs", + "tags": [ + "4_5_23", + "5_7_2", + "e-query", + "since_v1.8.1" + ], + "setup": "Create Initial Entities And Linked Entities", + "teardown": "Delete Created Entities And Linked Entities", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operation:\n Query Entities with Response Status Code set to 200\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to 'Building' and\n Query Parameter: options set to 'sysAttrs' and\n Query Parameter: join set to 'flat' and\n Query Parameter: joinLevel set to '1' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_15" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Consumption/019_16.json b/doc/files/ContextInformation/Consumption/019_16.json new file mode 100644 index 00000000..93744ad2 --- /dev/null +++ b/doc/files/ContextInformation/Consumption/019_16.json @@ -0,0 +1,100 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Cons/E/019_16", + "test_objective": "Check that entities can be queried with two levels linked entities in different join types and representations", + "reference": "ETSI GS CIM 009 V1.8.1 [], clauses 4.5.23, 5.7.2", + "config_id": "", + "parent_release": "v1.8.1", + "clauses": [ + "4.5.23", + "5.7.2" + ], + "pics_selection": "", + "keywords": [ + "Query Entities With Joins And Representations", + "Create Initial Entities And Linked Entities", + "Delete Created Entities And Linked Entities", + "Create Linking Entity" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT being in the \"initial state\" and\n the SUT containing initial Entities ${first_entity_id} and ${second_entity_id}\n each one having a linked entity with an id respectively set to ${first_linked_entity_id} and ${second_linked_entity_id}\n }", + "test_cases": [ + { + "name": "019_16_01 Query Inline Normalized", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_16_01", + "doc": "Check that entities can be queried with two levels linked entities in different join types and representations", + "tags": [ + "4_5_23", + "5_7_2", + "e-query", + "since_v1.8.1" + ], + "setup": "Create Initial Entities And Linked Entities", + "teardown": "Delete Created Entities And Linked Entities", + "template": "Query Entities With Joins And Representations", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/buildings-two-levels-inline-019-16.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to 'Building' and\n Query Parameter: options set to '${EMPTY}' and\n Query Parameter: join set to 'inline' and\n Query Parameter: joinLevel set to '2' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/" + }, + { + "name": "019_16_02 Query Flat Normalized", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_16_02", + "doc": "Check that entities can be queried with two levels linked entities in different join types and representations", + "tags": [ + "4_5_23", + "5_7_2", + "e-query", + "since_v1.8.1" + ], + "setup": "Create Initial Entities And Linked Entities", + "teardown": "Delete Created Entities And Linked Entities", + "template": "Query Entities With Joins And Representations", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/buildings-two-levels-flat-019-16.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to 'Building' and\n Query Parameter: options set to '${EMPTY}' and\n Query Parameter: join set to 'flat' and\n Query Parameter: joinLevel set to '2' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/" + }, + { + "name": "019_16_03 Query Inline Simplified", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_16_03", + "doc": "Check that entities can be queried with two levels linked entities in different join types and representations", + "tags": [ + "4_5_23", + "5_7_2", + "e-query", + "since_v1.8.1" + ], + "setup": "Create Initial Entities And Linked Entities", + "teardown": "Delete Created Entities And Linked Entities", + "template": "Query Entities With Joins And Representations", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/buildings-two-levels-inline-simplified-019-16.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to 'Building' and\n Query Parameter: options set to 'keyValues' and\n Query Parameter: join set to 'inline' and\n Query Parameter: joinLevel set to '2' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/" + }, + { + "name": "019_16_04 Query Flat Simplified", + "permutation_tp_id": "TP/NGSI-LD/CI/Cons/E/019_16_04", + "doc": "Check that entities can be queried with two levels linked entities in different join types and representations", + "tags": [ + "4_5_23", + "5_7_2", + "e-query", + "since_v1.8.1" + ], + "setup": "Create Initial Entities And Linked Entities", + "teardown": "Delete Created Entities And Linked Entities", + "template": "Query Entities With Joins And Representations", + "then": "then {\n the SUT sends a valid Response for the operations:\n Query Entities with Response Status Code set to 200 and\n Query Entities with Check Response Body Content and\n Query Parameter: expectation_filename set to 'linked-entity-retrieval/buildings-two-levels-flat-simplified-019-16.json' and\n Query Parameter: response_body set to 'response.json()' and\n Query Parameter: additional_ignored_path set to '${EMPTY}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entities/'\n method set to 'GET'\n Get Entities Request: and\n Query Parameter: entity_types set to 'Building' and\n Query Parameter: options set to 'keyValues' and\n Query Parameter: join set to 'flat' and\n Query Parameter: joinLevel set to '2' and\n Query Parameter: Link set to '<$https://easy-global-market.github.io/ngsild-api-data-models/ngsildTestSuite/ngsildTestSuiteV1.8-compound.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\"'\n}", + "http_verb": "GET", + "endpoint": "entities/" + } + ], + "permutations": [ + "then", + "when" + ], + "robotpath": "ContextInformation/Consumption/Entity/QueryEntities", + "robotfile": "019_16" +} \ No newline at end of file diff --git a/doc/tests/test_ContextInformation_Consumption.py b/doc/tests/test_ContextInformation_Consumption.py index d4f0bc93..c57ae2dc 100644 --- a/doc/tests/test_ContextInformation_Consumption.py +++ b/doc/tests/test_ContextInformation_Consumption.py @@ -273,6 +273,34 @@ class TestCIConsumptions(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_019_13(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_13.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_13.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_13.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_14(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_14.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_14.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_14.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_15(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_15.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_15.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_15.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_019_16(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/QueryEntities/019_16.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/019_16.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_019_16.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_018_01_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_01_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_01_01.json' @@ -357,6 +385,41 @@ class TestCIConsumptions(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_018_10(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_10.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_10.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_018_10.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_018_11(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_11.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_11.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_018_11.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_018_12(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_12.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_12.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_018_12.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_018_13(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_13.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_13.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_018_13.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + + def test_018_14(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/Entity/RetrieveEntity/018_14.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/018_14.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_018_14.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_021_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Consumption/TemporalEntity/QueryTemporalEvolutionOfEntities/021_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Consumption/021_01.json' diff --git a/resources/ApiUtils/ContextInformationConsumption.resource b/resources/ApiUtils/ContextInformationConsumption.resource index 4d4a2e46..0ccb1737 100755 --- a/resources/ApiUtils/ContextInformationConsumption.resource +++ b/resources/ApiUtils/ContextInformationConsumption.resource @@ -44,6 +44,8 @@ Query Entities ... ${q}=${EMPTY} ... ${local}=${EMPTY} ... ${datasetId}=${EMPTY} + ... ${join}=${EMPTY} + ... ${joinLevel}=${EMPTY} ${attrs_length}= Get Length ${attrs} ${accept_length}= Get Length ${accept} ${options_length}= Get Length ${options} @@ -91,6 +93,10 @@ Query Entities IF '${datasetId}'!='' Set To Dictionary ${params} datasetId=${datasetId} END + IF '${join}'!='' Set To Dictionary ${params} join=${join} + IF '${join_level}'!='' + Set To Dictionary ${params} joinLevel=${joinLevel} + END ${response}= GET ... url=${url}/${ENTITIES_ENDPOINT_PATH} @@ -145,6 +151,8 @@ Query Entity ... ${geometryProperty}=${EMPTY} ... ${options}=${EMPTY} ... ${lang}=${EMPTY} + ... ${join}=${EMPTY} + ... ${joinLevel}=${EMPTY} ${attrs_length}= Get Length ${attrs} ${accept_length}= Get Length ${accept} ${options_length}= Get Length ${options} @@ -168,6 +176,10 @@ Query Entity Set To Dictionary ${params} options=${options} END IF ${lang_length}>0 Set To Dictionary ${params} lang=${lang} + IF '${join}'!='' Set To Dictionary ${params} join=${join} + IF '${join_level}'!='' + Set To Dictionary ${params} joinLevel=${joinLevel} + END ${response}= GET ... url=${url}/${ENTITIES_ENDPOINT_PATH}${id} diff --git a/resources/ApiUtils/ContextInformationProvision.resource b/resources/ApiUtils/ContextInformationProvision.resource index c8b7c6a0..a38e9d8b 100755 --- a/resources/ApiUtils/ContextInformationProvision.resource +++ b/resources/ApiUtils/ContextInformationProvision.resource @@ -218,6 +218,17 @@ Create Entity From File Output ${response} Create Entity From File RETURN ${response} +Create Entity From JSON-LD Content + [Arguments] ${content} + &{headers}= Create Dictionary Content-Type=application/ld+json + ${response}= POST + ... url=${url}/${ENTITIES_ENDPOINT_PATH} + ... json=${content} + ... headers=${headers} + ... expected_status=any + Output ${response} Create Entity From JSON-LD Content + RETURN ${response} + Delete Entity Attributes [Arguments] ${entityId} ${attributeId} ${datasetId} ${deleteAll} ${context}=${EMPTY} &{headers}= Create Dictionary Content-Type=${CONTENT_TYPE_JSON} -- GitLab