diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_10.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_10.robot new file mode 100644 index 0000000000000000000000000000000000000000..b719a9a3422f1614acb6b88a871e8ad2a7bcc81e --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_10.robot @@ -0,0 +1,43 @@ +*** Settings *** +Documentation Check that you can create a batch of entities where two have the same id + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +003_10_01 Create a batch of three valid entities where two have the same id + [Documentation] Check that you can create a batch of entities where two have the same id + [Tags] be-create 5_6_7 since_v1.5.1 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${first_entity_id} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + Set Suite Variable ${second_entity_id} + ${first_entity}= Load Entity building-minimal-sample.jsonld ${first_entity_id} + ${second_entity}= Load Entity building-minimal-sample.jsonld ${second_entity_id} + @{entities_to_be_created}= Create List ${first_entity} ${second_entity} ${first_entity} + + ${response}= Batch Create Entities @{entities_to_be_created} + + @{expected_successful_entities_ids}= Create List ${first_entity_id} ${second_entity_id} + Set Test Variable @{expected_successful_entities_ids} + @{expected_failed_entities_ids}= Create List ${first_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()} + + +*** Keywords *** +Delete Entities + ${response}= Batch Delete Entities + ... entities_ids_to_be_deleted=@{expected_successful_entities_ids} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_04.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_04.robot new file mode 100644 index 0000000000000000000000000000000000000000..2f550a039e473e477e6ec1145084fedcb64d6c2c --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_04.robot @@ -0,0 +1,38 @@ +*** Settings *** +Documentation Check that you can delete a batch of entities with the same id + +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 Entity + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +006_04_01 Delete a batch of existing entities with the same id + [Documentation] Check that you can delete a batch entities with the same id + [Tags] be-delete 5_6_10 since_v1.5.1 + ${new_entity_id}= Generate Random Entity Id ${building_id_prefix} + @{entities_ids_to_be_deleted}= Create List ${entity_id} ${entity_id} + + ${response}= Batch Delete Entities entities_ids_to_be_deleted=@{entities_ids_to_be_deleted} + + @{expected_successful_entities_ids}= Create List ${entity_id} + @{expected_failed_entities_ids}= Create List ${entity_id} + &{response1}= 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 ${response1} ${response.json()} + + +*** Keywords *** +Setup Initial Entity + ${entity_id}= Generate Random Entity Id ${building_id_prefix} + Create Entity building-simple-attributes-sample.jsonld ${entity_id} + Set Test Variable ${entity_id} diff --git a/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_07.robot b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_07.robot new file mode 100644 index 0000000000000000000000000000000000000000..16090b79cab429583f8b25953303da08fbb2ce6a --- /dev/null +++ b/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_07.robot @@ -0,0 +1,37 @@ +*** Settings *** +Documentation Check that you can upsert a batch of entities where two have the same id + +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationProvision.resource +Resource ${EXECDIR}/resources/ApiUtils/ContextInformationConsumption.resource +Resource ${EXECDIR}/resources/AssertionUtils.resource +Resource ${EXECDIR}/resources/JsonUtils.resource + +Test Teardown Delete Entities + + +*** Variables *** +${building_id_prefix}= urn:ngsi-ld:Building: + + +*** Test Cases *** +004_07_01 Upsert a batch of three valid entities where two have the same id + [Documentation] Check that you can upsert a batch of where two have the same id + [Tags] be-upsert 5_6_8 since_v1.5.1 + ${first_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${second_entity_id}= Generate Random Entity Id ${building_id_prefix} + ${first_entity}= Load Entity building-minimal-sample.jsonld ${first_entity_id} + ${second_entity}= Load Entity building-minimal-sample.jsonld ${second_entity_id} + @{entities_to_be_upserted}= Create List ${first_entity} ${second_entity} ${first_entity} + + ${response}= Batch Upsert Entities @{entities_to_be_upserted} + + @{expected_successful_entities_ids}= Create List ${first_entity_id} ${second_entity_id} + Set Test Variable @{expected_successful_entities_ids} + Check Response Status Code 201 ${response.status_code} + Check Response Body Containing Array Of URIs set to ${expected_successful_entities_ids} ${response.json()} + + +*** Keywords *** +Delete Entities + ${response}= Batch Delete Entities + ... entities_ids_to_be_deleted=@{expected_successful_entities_ids} diff --git a/doc/files/ContextInformation/Provision/003_10.json b/doc/files/ContextInformation/Provision/003_10.json new file mode 100644 index 0000000000000000000000000000000000000000..c1b98610383736f3206cf6e7bfd72f9be9d2ca27 --- /dev/null +++ b/doc/files/ContextInformation/Provision/003_10.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/003_10", + "test_objective": "Check that you can create a batch of entities where two have the same id", + "reference": "ETSI GS CIM 009 V1.5.1 [], clause 5.6.7", + "config_id": "", + "parent_release": "v1.5.1", + "clauses": [ + "5.6.7" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "003_10_01 Create a batch of three valid entities where two have the same id", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/003_10_01", + "doc": "Check that you can create a batch of entities where two have the same id", + "tags": [ + "5_6_7", + "be-create", + "since_v1.5.1" + ], + "setup": null, + "teardown": "Delete Entities", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Create Entities with Response Status Code set to 207 and\n Batch Create Entities with Response body containing batch operation result set to '${expected_batch_operation_result}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/create'\n method set to 'POST'\n Request Header['Content-Type'] set to '' and\n payload set to a list of entities to be created\n}", + "http_verb": "POST", + "endpoint": "entityOperations/create" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/CreateBatchOfEntities", + "robotfile": "003_10" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/004_07.json b/doc/files/ContextInformation/Provision/004_07.json new file mode 100644 index 0000000000000000000000000000000000000000..7aa231c053a7ddd08d99710fa045f36df8bcefac --- /dev/null +++ b/doc/files/ContextInformation/Provision/004_07.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/004_07", + "test_objective": "Check that you can upsert a batch of entities where two have the same id", + "reference": "ETSI GS CIM 009 V1.5.1 [], clause 5.6.8", + "config_id": "", + "parent_release": "v1.5.1", + "clauses": [ + "5.6.8" + ], + "pics_selection": "", + "keywords": [ + "Delete Entities" + ], + "teardown": "None", + "initial_condition": "with {\n the SUT containing an initial state\n}", + "test_cases": [ + { + "name": "004_07_01 Upsert a batch of three valid entities where two have the same id", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/004_07_01", + "doc": "Check that you can upsert a batch of where two have the same id", + "tags": [ + "5_6_8", + "be-upsert", + "since_v1.5.1" + ], + "setup": null, + "teardown": "Delete Entities", + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Upsert Entities with Response Status Code set to 201 and\n Batch Upsert Entities with Response Body set to an array of created entities ids\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/upsert?options=${update_option}'\n method set to 'POST'\n Request batch upsert operation over entity from filename '@{entities_to_be_upserted}' with update_option set to 'replace' and Content-Type set to 'application/ld+json'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/upsert?options=${update_option}" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities", + "robotfile": "004_07" +} \ No newline at end of file diff --git a/doc/files/ContextInformation/Provision/006_04.json b/doc/files/ContextInformation/Provision/006_04.json new file mode 100644 index 0000000000000000000000000000000000000000..c86a7e67080822572f800c7f3487e90818c272ea --- /dev/null +++ b/doc/files/ContextInformation/Provision/006_04.json @@ -0,0 +1,38 @@ +{ + "tp_id": "TP/NGSI-LD/CI/Prov/BE/006_04", + "test_objective": "Check that you can delete a batch of entities with the same id", + "reference": "ETSI GS CIM 009 V1.5.1 [], clause 5.6.10", + "config_id": "", + "parent_release": "v1.5.1", + "clauses": [ + "5.6.10" + ], + "pics_selection": "", + "keywords": [ + "Setup Initial 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": "006_04_01 Delete a batch of existing entities with the same id", + "permutation_tp_id": "TP/NGSI-LD/CI/Prov/BE/006_04_01", + "doc": "Check that you can delete a batch entities with the same id", + "tags": [ + "5_6_10", + "be-delete", + "since_v1.5.1" + ], + "setup": "Setup Initial Entity", + "teardown": null, + "template": null, + "then": "then {\n the SUT sends a valid Response for the operations:\n Batch Delete Entities with Response Status Code set to 207 and\n ${response.json()} with Response body containing batch operation result set to '${response1}'\n}", + "when": "when {\n the SUT receives a Request from the client containing:\n URL set to '/ngsi-ld/v1/entityOperations/delete'\n method set to 'POST'\n Batch Delete Entities: and\n Query Parameter: entities_ids_to_be_deleted set to '@{entities_ids_to_be_deleted}'\n}", + "http_verb": "POST", + "endpoint": "entityOperations/delete" + } + ], + "permutations": [], + "robotpath": "ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities", + "robotfile": "006_04" +} \ No newline at end of file diff --git a/doc/tests/test_ContextInformation_Provision.py b/doc/tests/test_ContextInformation_Provision.py index 36f34dba651f6e82fd2f281844d7b784e63e8f01..e9970bd6d22f0da6308771a226791f0cd0a8e93b 100644 --- a/doc/tests/test_ContextInformation_Provision.py +++ b/doc/tests/test_ContextInformation_Provision.py @@ -105,6 +105,13 @@ class TestCIProvision(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_003_10(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/CreateBatchOfEntities/003_10.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/003_10.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_003_10.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_006_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/006_01.json' @@ -126,6 +133,13 @@ class TestCIProvision(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_006_04(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/DeleteBatchOfEntities/006_04.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/006_04.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_006_04.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_005_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpdateBatchOfEntities/005_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/005_01.json' @@ -196,6 +210,13 @@ class TestCIProvision(TestCase): self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_004_07(self): + robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/BatchEntities/UpsertBatchOfEntities/004_07.robot' + expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/004_07.json' + difference_file = f'{self.folder_test_suites}/doc/results/out_004_07.json' + + self.common_function(robot_file=robot_file, expected_value=expected_value, difference_file=difference_file) + def test_001_01(self): robot_file = f'{self.folder_test_suites}/TP/NGSI-LD/ContextInformation/Provision/Entities/CreateEntity/001_01.robot' expected_value = f'{self.folder_test_suites}/doc/files/ContextInformation/Provision/001_01.json'