Loading README.md +1 −1 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ execution of the following command in MacOS or Ubuntu: In case of Windows, you need to execute the following command: ```> .\.venv\scripts\activate.bat ``` ```> .\venv\Scripts\activate.bat ``` Now, you can launch the tests with the following command in MacOS or Linux: Loading TP/NGSI-LD/ContextInformation/Provision/BatchEntities/MergeBatchOfEntities/057_01.robot 0 → 100644 +67 −0 Original line number Diff line number Diff line *** Settings *** Documentation Check that you can merge a batch of entities Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Test Setup Setup Initial Entities Test Teardown Delete Initial Entities Test Template Batch Merge Entity Scenarios *** Variables *** ${building_id_prefix}= urn:ngsi-ld:Building: ${entity_payload_filename}= merge/building-merge-data.jsonld *** Test Cases *** FILENAME MERGE_FRAGMENT_FILENAME 057_01_01 MergeAnEmptyEntity [Tags] be-merge 5_6_17 since_v1.6.1 building-minimal.jsonld batch-merge/two-buildings-non-edited.jsonld 057_01_02 MergeSimpleProperties [Tags] be-merge 5_6_17 since_v1.6.1 building-simple-attributes-second.jsonld batch-merge/two-buildings-attributes-edited.jsonld 057_01_03 MergeSimpleRelationship [Tags] be-merge 5_6_17 since_v1.6.1 building-relationship.jsonld batch-merge/two-buildings-with-relationship.jsonld 057_01_04 MergePropertyWithPartialData [Tags] be-merge 5_6_17 since_v1.6.1 merge/building-only-airQualityLevel-value.jsonld batch-merge/two-buildings-with-changed-airQualityLevel.jsonld *** Keywords *** Batch Merge Entity Scenarios [Documentation] Check that you can merge a batch of entities [Arguments] ${filename} ${expectation_filename} ${first_entity}= Load Entity ${filename} ${first_entity_id} ${second_entity}= Load Entity ${filename} ${second_entity_id} @{entities_ids_to_be_merged}= Create List ${first_entity_id} ${second_entity_id} @{entities_to_be_merged}= Create List ${first_entity} ${second_entity} ${response}= Batch Merge Entities @{entities_to_be_merged} Check Response Status Code 204 ${response.status_code} ${expected_entities_ids}= Catenate SEPARATOR=, @{entities_ids_to_be_merged} ${response1}= Query Entities ... entity_ids=${expected_entities_ids} ... entity_types=Building ... context=${ngsild_test_suite_context} ... accept=${CONTENT_TYPE_LD_JSON} Check Response Body Containing List Containing Entity Elements With Different Types ... filename=${expectation_filename} ... entities_representation_ids=${entities_ids_to_be_merged} ... response_body=${response1.json()} ... ignore_core_context_version=${True} Setup Initial Entities ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} Create Entity ${entity_payload_filename} ${first_entity_id} Create Entity ${entity_payload_filename} ${second_entity_id} Set Test Variable ${first_entity_id} Set Test Variable ${second_entity_id} Delete Initial Entities @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} TP/NGSI-LD/ContextInformation/Provision/BatchEntities/MergeBatchOfEntities/057_02.robot 0 → 100644 +72 −0 Original line number Diff line number Diff line *** Settings *** Documentation Check that you can merge a batch of entities where some will succeed and others will fail Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities Suite Teardown Delete Initial Entities *** Variables *** ${building_id_prefix}= urn:ngsi-ld:Building: ${entity_payload_filename}= building-simple-attributes.jsonld ${merge_fragment_filename}= fragmentEntities/simple-attributes-relationship-of-property-fragment.json ${entity_filename}= building-relationship-of-property.jsonld *** Test Cases *** 057_02_01 Merge a batch should succeed for existing entities and fail for non existing one by returning 207 status [Documentation] Check that you can merge a batch of non-existing and existing entities [Tags] be-merge 5_6_17 since_v1.6.1 ${first_existing_entity}= Load Entity ... ${entity_filename} ... ${first_existing_entity_id} ${second_existing_entity}= Load Entity ... ${entity_filename} ... ${second_existing_entity_id} ${new_entity_id}= Generate Random Entity Id ${building_id_prefix} ${new_entity}= Load Entity ${entity_filename} ${new_entity_id} @{entities_to_be_merged}= Create List ${first_existing_entity} ${second_existing_entity} ${new_entity} ${response}= Batch Merge Entities @{entities_to_be_merged} @{expected_successful_entities_ids}= Create List ${first_existing_entity_id} ${second_existing_entity_id} Set Suite Variable @{expected_successful_entities_ids} @{expected_failed_entities_ids}= Create List ${new_entity_id} &{expected_batch_operation_result}= Create Batch Operation Result ... ${expected_successful_entities_ids} ... ${expected_failed_entities_ids} Check Response Status Code 207 ${response.status_code} Check Response Body Containing Batch Operation Result ${expected_batch_operation_result} ${response.json()} ${first_created_entity}= Load Test Sample entities/${entity_payload_filename} ${first_existing_entity_id} ${second_created_entity}= Load Test Sample ... entities/${entity_payload_filename} ... ${second_existing_entity_id} ${merge_fragment}= Load Test Sample entities/${merge_fragment_filename} ${first_merged_entity}= Upsert Element In Entity ${first_created_entity} ${merge_fragment} ${second_merged_entity}= Upsert Element In Entity ${second_created_entity} ${merge_fragment} @{merged_entities}= Create List ${first_merged_entity} ${second_merged_entity} ${expected_entities_ids}= Catenate SEPARATOR=, @{expected_successful_entities_ids} ${response1}= Query Entities ... entity_ids=${expected_entities_ids} ... entity_types=Building ... context=${ngsild_test_suite_context} ... accept=${CONTENT_TYPE_LD_JSON} Check Updated Resources Set To ${merged_entities} ${response1.json()} *** Keywords *** Setup Initial Entities ${first_existing_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_existing_entity_id}= Generate Random Entity Id ${building_id_prefix} Create Entity ${entity_payload_filename} ${first_existing_entity_id} Create Entity ${entity_payload_filename} ${second_existing_entity_id} Set Suite Variable ${first_existing_entity_id} Set Suite Variable ${second_existing_entity_id} Delete Initial Entities Batch Delete Entities entities_ids_to_be_deleted=@{expected_successful_entities_ids} TP/NGSI-LD/ContextInformation/Provision/BatchEntities/MergeBatchOfEntities/057_03.robot 0 → 100644 +26 −0 Original line number Diff line number Diff line *** Settings *** Documentation Check that you cannot merge a batch of entities with an invalid request Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Test Template Batch Merge Entity With Invalid Request Scenarios *** Test Cases *** FILENAME PROBLEM_TYPE 057_03_01 InvalidJson [Tags] be-merge 5_6_17 since_v1.6.1 batch/invalid-json.jsonld ${ERROR_TYPE_INVALID_REQUEST} 057_03_02 InvalidJsonLd [Tags] be-merge 5_6_17 since_v1.6.1 batch/invalid-json-ld.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} *** Keywords *** Batch Merge Entity With Invalid Request Scenarios [Documentation] Check that you cannot merge a batch of entities with an invalid request [Arguments] ${filename} ${problem_type} ${response}= Batch Request Entities From File merge filename=${filename} Check Response Status Code 400 ${response.status_code} Check RL Response Body Containing ProblemDetails Element Containing Type Element set to ... ${response.json()} ... ${problem_type} Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response.json()} data/entities/expectations/batch-merge/two-buildings-attributes-edited.jsonld 0 → 100644 +48 −0 Original line number Diff line number Diff line [{ "id": "urn:ngsi-ld:Building:randomUUID", "type": "Building", "name": { "type": "Property", "value": "Pisa Tower" }, "subCategory": { "type": "Property", "value": "tourism" }, "airQualityLevel": { "type": "Property", "value": 6, "unitCode": "C62", "observedAt": "2020-10-10T16:40:00.000Z" }, "almostFull": { "type": "Property", "value": true }, "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" } ,{ "id": "urn:ngsi-ld:Building:randomUUID", "type": "Building", "name": { "type": "Property", "value": "Pisa Tower" }, "subCategory": { "type": "Property", "value": "tourism" }, "airQualityLevel": { "type": "Property", "value": 6, "unitCode": "C62", "observedAt": "2020-10-10T16:40:00.000Z" }, "almostFull": { "type": "Property", "value": true }, "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" } ] Loading
README.md +1 −1 Original line number Diff line number Diff line Loading @@ -114,7 +114,7 @@ execution of the following command in MacOS or Ubuntu: In case of Windows, you need to execute the following command: ```> .\.venv\scripts\activate.bat ``` ```> .\venv\Scripts\activate.bat ``` Now, you can launch the tests with the following command in MacOS or Linux: Loading
TP/NGSI-LD/ContextInformation/Provision/BatchEntities/MergeBatchOfEntities/057_01.robot 0 → 100644 +67 −0 Original line number Diff line number Diff line *** Settings *** Documentation Check that you can merge a batch of entities Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Test Setup Setup Initial Entities Test Teardown Delete Initial Entities Test Template Batch Merge Entity Scenarios *** Variables *** ${building_id_prefix}= urn:ngsi-ld:Building: ${entity_payload_filename}= merge/building-merge-data.jsonld *** Test Cases *** FILENAME MERGE_FRAGMENT_FILENAME 057_01_01 MergeAnEmptyEntity [Tags] be-merge 5_6_17 since_v1.6.1 building-minimal.jsonld batch-merge/two-buildings-non-edited.jsonld 057_01_02 MergeSimpleProperties [Tags] be-merge 5_6_17 since_v1.6.1 building-simple-attributes-second.jsonld batch-merge/two-buildings-attributes-edited.jsonld 057_01_03 MergeSimpleRelationship [Tags] be-merge 5_6_17 since_v1.6.1 building-relationship.jsonld batch-merge/two-buildings-with-relationship.jsonld 057_01_04 MergePropertyWithPartialData [Tags] be-merge 5_6_17 since_v1.6.1 merge/building-only-airQualityLevel-value.jsonld batch-merge/two-buildings-with-changed-airQualityLevel.jsonld *** Keywords *** Batch Merge Entity Scenarios [Documentation] Check that you can merge a batch of entities [Arguments] ${filename} ${expectation_filename} ${first_entity}= Load Entity ${filename} ${first_entity_id} ${second_entity}= Load Entity ${filename} ${second_entity_id} @{entities_ids_to_be_merged}= Create List ${first_entity_id} ${second_entity_id} @{entities_to_be_merged}= Create List ${first_entity} ${second_entity} ${response}= Batch Merge Entities @{entities_to_be_merged} Check Response Status Code 204 ${response.status_code} ${expected_entities_ids}= Catenate SEPARATOR=, @{entities_ids_to_be_merged} ${response1}= Query Entities ... entity_ids=${expected_entities_ids} ... entity_types=Building ... context=${ngsild_test_suite_context} ... accept=${CONTENT_TYPE_LD_JSON} Check Response Body Containing List Containing Entity Elements With Different Types ... filename=${expectation_filename} ... entities_representation_ids=${entities_ids_to_be_merged} ... response_body=${response1.json()} ... ignore_core_context_version=${True} Setup Initial Entities ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} Create Entity ${entity_payload_filename} ${first_entity_id} Create Entity ${entity_payload_filename} ${second_entity_id} Set Test Variable ${first_entity_id} Set Test Variable ${second_entity_id} Delete Initial Entities @{entities_ids_to_be_deleted}= Create List ${first_entity_id} ${second_entity_id} Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted}
TP/NGSI-LD/ContextInformation/Provision/BatchEntities/MergeBatchOfEntities/057_02.robot 0 → 100644 +72 −0 Original line number Diff line number Diff line *** Settings *** Documentation Check that you can merge a batch of entities where some will succeed and others will fail Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Resource ${EXECDIR}/resources/JsonUtils.resource Suite Setup Setup Initial Entities Suite Teardown Delete Initial Entities *** Variables *** ${building_id_prefix}= urn:ngsi-ld:Building: ${entity_payload_filename}= building-simple-attributes.jsonld ${merge_fragment_filename}= fragmentEntities/simple-attributes-relationship-of-property-fragment.json ${entity_filename}= building-relationship-of-property.jsonld *** Test Cases *** 057_02_01 Merge a batch should succeed for existing entities and fail for non existing one by returning 207 status [Documentation] Check that you can merge a batch of non-existing and existing entities [Tags] be-merge 5_6_17 since_v1.6.1 ${first_existing_entity}= Load Entity ... ${entity_filename} ... ${first_existing_entity_id} ${second_existing_entity}= Load Entity ... ${entity_filename} ... ${second_existing_entity_id} ${new_entity_id}= Generate Random Entity Id ${building_id_prefix} ${new_entity}= Load Entity ${entity_filename} ${new_entity_id} @{entities_to_be_merged}= Create List ${first_existing_entity} ${second_existing_entity} ${new_entity} ${response}= Batch Merge Entities @{entities_to_be_merged} @{expected_successful_entities_ids}= Create List ${first_existing_entity_id} ${second_existing_entity_id} Set Suite Variable @{expected_successful_entities_ids} @{expected_failed_entities_ids}= Create List ${new_entity_id} &{expected_batch_operation_result}= Create Batch Operation Result ... ${expected_successful_entities_ids} ... ${expected_failed_entities_ids} Check Response Status Code 207 ${response.status_code} Check Response Body Containing Batch Operation Result ${expected_batch_operation_result} ${response.json()} ${first_created_entity}= Load Test Sample entities/${entity_payload_filename} ${first_existing_entity_id} ${second_created_entity}= Load Test Sample ... entities/${entity_payload_filename} ... ${second_existing_entity_id} ${merge_fragment}= Load Test Sample entities/${merge_fragment_filename} ${first_merged_entity}= Upsert Element In Entity ${first_created_entity} ${merge_fragment} ${second_merged_entity}= Upsert Element In Entity ${second_created_entity} ${merge_fragment} @{merged_entities}= Create List ${first_merged_entity} ${second_merged_entity} ${expected_entities_ids}= Catenate SEPARATOR=, @{expected_successful_entities_ids} ${response1}= Query Entities ... entity_ids=${expected_entities_ids} ... entity_types=Building ... context=${ngsild_test_suite_context} ... accept=${CONTENT_TYPE_LD_JSON} Check Updated Resources Set To ${merged_entities} ${response1.json()} *** Keywords *** Setup Initial Entities ${first_existing_entity_id}= Generate Random Entity Id ${building_id_prefix} ${second_existing_entity_id}= Generate Random Entity Id ${building_id_prefix} Create Entity ${entity_payload_filename} ${first_existing_entity_id} Create Entity ${entity_payload_filename} ${second_existing_entity_id} Set Suite Variable ${first_existing_entity_id} Set Suite Variable ${second_existing_entity_id} Delete Initial Entities Batch Delete Entities entities_ids_to_be_deleted=@{expected_successful_entities_ids}
TP/NGSI-LD/ContextInformation/Provision/BatchEntities/MergeBatchOfEntities/057_03.robot 0 → 100644 +26 −0 Original line number Diff line number Diff line *** Settings *** Documentation Check that you cannot merge a batch of entities with an invalid request Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource Resource ${EXECDIR}/resources/AssertionUtils.resource Test Template Batch Merge Entity With Invalid Request Scenarios *** Test Cases *** FILENAME PROBLEM_TYPE 057_03_01 InvalidJson [Tags] be-merge 5_6_17 since_v1.6.1 batch/invalid-json.jsonld ${ERROR_TYPE_INVALID_REQUEST} 057_03_02 InvalidJsonLd [Tags] be-merge 5_6_17 since_v1.6.1 batch/invalid-json-ld.jsonld ${ERROR_TYPE_BAD_REQUEST_DATA} *** Keywords *** Batch Merge Entity With Invalid Request Scenarios [Documentation] Check that you cannot merge a batch of entities with an invalid request [Arguments] ${filename} ${problem_type} ${response}= Batch Request Entities From File merge filename=${filename} Check Response Status Code 400 ${response.status_code} Check RL Response Body Containing ProblemDetails Element Containing Type Element set to ... ${response.json()} ... ${problem_type} Check RL Response Body Containing ProblemDetails Element Containing Title Element ${response.json()}
data/entities/expectations/batch-merge/two-buildings-attributes-edited.jsonld 0 → 100644 +48 −0 Original line number Diff line number Diff line [{ "id": "urn:ngsi-ld:Building:randomUUID", "type": "Building", "name": { "type": "Property", "value": "Pisa Tower" }, "subCategory": { "type": "Property", "value": "tourism" }, "airQualityLevel": { "type": "Property", "value": 6, "unitCode": "C62", "observedAt": "2020-10-10T16:40:00.000Z" }, "almostFull": { "type": "Property", "value": true }, "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" } ,{ "id": "urn:ngsi-ld:Building:randomUUID", "type": "Building", "name": { "type": "Property", "value": "Pisa Tower" }, "subCategory": { "type": "Property", "value": "tourism" }, "airQualityLevel": { "type": "Property", "value": 6, "unitCode": "C62", "observedAt": "2020-10-10T16:40:00.000Z" }, "almostFull": { "type": "Property", "value": true }, "@context": "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" } ]