diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/MergeBatchOfEntities/D016_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/MergeBatchOfEntities/D016_01_exc.robot index 905ebd5dee4099b789b4fe7035455e7fe2f53333..d25c51a629c3b47cd42bc7961c5445020f8b0c18 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/MergeBatchOfEntities/D016_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/MergeBatchOfEntities/D016_01_exc.robot @@ -17,7 +17,7 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour ${entity_payload_filename} vehicle-simple-attributes-second.jsonld ${entity_second_payload_filename} vehicle-simple-attributes-second-different.jsonld ${entity_pattern} urn:ngsi-ld:Vehicle:* -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld *** Test Cases *** D016_01_exc Merge Batch Entities On Both Context Broker And Context Source @@ -63,7 +63,8 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} - ... entity_id_pattern=${entity_pattern} + ... entity_id=${first_entity_id} + ... entity_id2=${second_entity_id} ... mode=exclusive ... endpoint=/broker1 ${response}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_01_exc.robot index e427a82942255c9a1fc9ca7c419fe5a92e2e52f3..f2049b11ad01d4dfba31b07b99a2cf118a8f1939 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_01_exc.robot @@ -14,10 +14,10 @@ Test Setup Setup Registration And Start Context Source Mock Server Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** -${entity_payload_filename} vehicle-simple-different-attributes.jsonld +${entity_payload_filename} vehicle-simple-attributes-second.jsonld ${update_payload_filename} expectations/vehicle-replace-isParked-attribute.jsonld ${entity_pattern} urn:ngsi-ld:Vehicle:* -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld *** Test Cases *** D014_01_exc Update Batch Entities without noOverwrite Option @@ -53,7 +53,8 @@ Setup Registration And Start Context Source Mock Server ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} - ... entity_id_pattern=${entity_pattern} + ... entity_id=${first_entity_id} + ... entity_id2=${second_entity_id} ... mode=exclusive ... endpoint=/broker1 ${response1}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_02_exc.robot index c41048db79dde92aa57bf4bb61398afa6ce385b4..cb09941b2342e8e92c437121370d220be97e03f8 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_02_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpdateBatchOfEntities/D014_02_exc.robot @@ -12,10 +12,10 @@ Test Setup Setup Registration And Start Context Source Mock Server Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** -${entity_payload_filename} vehicle-simple-different-attributes.jsonld +${entity_payload_filename} vehicle-simple-attributes-second.jsonld ${update_payload_filename} expectations/vehicle-replace-isParked-attribute.jsonld ${entity_pattern} urn:ngsi-ld:Vehicle:* -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld *** Test Cases *** D014_02_exc Update Batch Entities with noOverwrite Option @@ -54,7 +54,8 @@ Setup Registration And Start Context Source Mock Server ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} - ... entity_id_pattern=${entity_pattern} + ... entity_id=${first_entity_id} + ... entity_id2=${second_entity_id} ... mode=exclusive ... endpoint=/broker1 ${response1}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_exc.robot index e6650adf2e7c2cd18f126cbb946fac199ba6d9f8..985b6ff06d13d366acd2e345416059307dc39a4e 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_exc.robot @@ -17,7 +17,7 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour ${old_entity_payload_filename} vehicle-simple-attributes-second.jsonld ${new_entity_payload_filename} vehicle-simple-different-attributes.jsonld ${entity_pattern} urn:ngsi-ld:Vehicle:* -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld *** Test Cases *** D013_01_exc Batch Upsert Entities With Exclusive Registration Without Update Flag @@ -35,9 +35,9 @@ D013_01_exc Batch Upsert Entities With Exclusive Registration Without Update Fla Wait for redirected request ${request_payload}= Get Request Body - ${payload}= Evaluate json.loads('''${request_payload}''') json - Should Contain ${payload} ${new_first_entity} - Should Contain ${payload} ${new_second_entity} + Should Contain ${request_payload} ${first_entity_id} + Should Contain ${request_payload} ${second_entity_id} + Should Contain ${request_payload} speed ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entityOperations/upsert Should Be Equal ${stub_count} 1 @@ -57,7 +57,8 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} - ... entity_id_pattern=${entity_pattern} + ... entity_id=${first_entity_id} + ... entity_id2=${second_entity_id} ... mode=exclusive ... endpoint=/broker1 ${response}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_red.robot index 772417a92bb95602d192acf9af5aaf01ece9b53f..236b6b2dc0c5d39e38a9773b1df76df198f64c95 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_01_red.robot @@ -67,7 +67,7 @@ Setup Entity Id And Registration And Start Context Source Mock Server ${registration_id2}= Generate Random CSR Id Set Suite Variable ${registration_id2} ${registration_payload}= Prepare Context Source Registration From File - ... ${registration_id} + ... ${registration_id2} ... ${registration_payload_file_path} ... entity_id_pattern=${entity_pattern} ... mode=redirect diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_exc.robot index 9164cffe5f819302cb13f6015121d1589ce09a74..0905d7f51fc858bbc083cc77d7bada8725a05aae 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_exc.robot @@ -17,7 +17,7 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour ${old_entity_payload_filename} vehicle-simple-attributes-second.jsonld ${new_entity_payload_filename} vehicle-simple-different-attributes.jsonld ${entity_pattern} urn:ngsi-ld:Vehicle:* -${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops.jsonld +${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld *** Test Cases *** D013_02_exc Batch Upsert Entities With Exclusive Registration With Update Flag @@ -39,9 +39,9 @@ D013_02_exc Batch Upsert Entities With Exclusive Registration With Update Flag Wait for redirected request ${request_payload}= Get Request Body - ${payload}= Evaluate json.loads('''${request_payload}''') json - Should Contain ${payload} ${new_first_entity} - Should Contain ${payload} ${new_second_entity} + Should Contain ${request_payload} ${first_entity_id} + Should Contain ${request_payload} ${second_entity_id} + Should Contain ${request_payload} speed ${stub_count}= Get Stub Count POST /broker1/ngsi-ld/v1/entityOperations/upsert Should Be Equal ${stub_count} 1 @@ -61,7 +61,8 @@ Create Entity And Registration On The Context Broker And Start Context Source Mo ${registration_payload}= Prepare Context Source Registration From File ... ${registration_id} ... ${registration_payload_file_path} - ... entity_id_pattern=${entity_pattern} + ... entity_id=${first_entity_id} + ... entity_id2=${second_entity_id} ... mode=exclusive ... endpoint=/broker1 ${response}= Create Context Source Registration With Return ${registration_payload} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_red.robot index 2ef07cd73b08fc3ff561a2e189fce6bc6bf661d0..0eb1bd3b146c952d7691335f8c8d9ffd20267759 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/BatchEntities/UpsertBatchOfEntities/D013_02_red.robot @@ -70,7 +70,7 @@ Setup Entity Id And Registration And Start Context Source Mock Server ${registration_id2}= Generate Random CSR Id Set Suite Variable ${registration_id2} ${registration_payload}= Prepare Context Source Registration From File - ... ${registration_id} + ... ${registration_id2} ... ${registration_payload_file_path} ... entity_pattern=${entity_pattern} ... mode=redirect diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_01_red.robot index 5f29ce5296b0e68c6c43520e7015a2b2e269be05..46e0aed51bc031268af82635f4f7d50ea4e1e033 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_01_red.robot @@ -44,8 +44,6 @@ Setup Entity Id And Registration And Start Context Source Mock Server ${entity_id}= Generate Random Vehicle Entity Id Set Suite Variable ${entity_id} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} - Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random CSR Id Set Suite Variable ${registration_id} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_02_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_02_red.robot index 99a72a27e3b946d5ff82911693f4bb36f2626ce8..359284eaa71733bead30fc5a67ac79520d63718f 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_02_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/DeleteEntityAttributes/D006_02_red.robot @@ -44,8 +44,6 @@ Setup Entity Id And Registration And Start Context Source Mock Server ${entity_id}= Generate Random Vehicle Entity Id Set Suite Variable ${entity_id} - ${response}= Create Entity ${entity_payload_filename} ${entity_id} - Check Response Status Code 201 ${response.status_code} ${registration_id}= Generate Random CSR Id Set Suite Variable ${registration_id} diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot index 02645df3885c83d85706176f6cce5e8bca35cc4f..2d14ade7b18a385b6f185d0ce2c87b3c00854e6c 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/PartialAttributeUpdate/D005_01_exc.robot @@ -15,7 +15,7 @@ Test Teardown Delete Registration And Stop Context Source Mock Server *** Variables *** -${entity_payload_filename} vehicle-simple-different-attributes.jsonld +${entity_payload_filename} vehicle-simple-attributes-second.jsonld ${fragment_filename} vehicle-speed-two-datasetid-01-fragment.jsonld ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld ${attribute_id} speed diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_exc.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_exc.robot index 8ecd2e10d86b757a81d9234f9838abb25ad12470..4f03bcfc68ba87b255e72600c4cba996616eb49b 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_exc.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_exc.robot @@ -16,7 +16,7 @@ Test Teardown Delete Created Entity And Registration And Stop Context Sour *** Variables *** ${entity_id_prefix} urn:ngsi-ld:Vehicle: -${entity_payload_filename} vehicle-simple-different-attributes.jsonld +${entity_payload_filename} vehicle-simple-attributes-second.jsonld ${entity_attribute_filename} fragmentEntities/vehicle-speed-two-datasetid-01-fragment.json ${registration_id_prefix} urn:ngsi-ld:Registration: ${registration_payload_file_path} csourceRegistrations/context-source-registration-vehicle-speed-with-redirection-ops.jsonld diff --git a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_red.robot b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_red.robot index 607661c15f7f65736cd250fb99aa5d7fe4e6016f..b43e0a82dc6c1a45b3ecf73316d053529356b80a 100644 --- a/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_red.robot +++ b/TP/NGSI-LD/DistributedOperations/Provision/EntityAttributes/ReplaceEntityAttribute/D009_01_red.robot @@ -77,7 +77,7 @@ Setup Registration And Start Context Source Mock Server ${registration_id2}= Generate Random CSR Id Set Suite Variable ${registration_id2} ${registration_payload2}= Prepare Context Source Registration From File - ... ${registration_id} + ... ${registration_id2} ... ${registration_payload_file_path} ... entity_id=${entity_id} ... mode=redirect diff --git a/data/csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld b/data/csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld new file mode 100644 index 0000000000000000000000000000000000000000..5961a60538e7c465629356059fa2b48d1b5f8cc4 --- /dev/null +++ b/data/csourceRegistrations/context-source-registration-vehicle-speed-with-batch-ops-exclusive.jsonld @@ -0,0 +1,29 @@ +{ + "id": "urn:ngsi-ld:ContextSourceRegistration:randomUUID", + "type": "ContextSourceRegistration", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:randomUUID", + "type": "Vehicle" + } + ], + "propertyNames":["speed"] + }, + { + "entities": [ + { + "id": "urn:ngsi-ld:Vehicle:randomUUID2", + "type": "Vehicle" + } + ], + "propertyNames":["speed"] + } + ], + "operations": ["redirectionOps", "createBatch", "upsertBatch", "updateBatch", "deleteBatch", "mergeBatch"], + "endpoint": "http://my.csource.org:1026/", + "@context":[ + "https://forge.etsi.org/rep/cim/ngsi-ld-test-suite/-/raw/develop/resources/jsonld-contexts/ngsi-ld-test-suite-compound.jsonld" + ] +} diff --git a/resources/ApiUtils/ContextSourceRegistration.resource b/resources/ApiUtils/ContextSourceRegistration.resource index 5263add93348be2015d956f6ab1daca29b9eef09..6c334031edaa76c49c85527b2f555477c8413a16 100755 --- a/resources/ApiUtils/ContextSourceRegistration.resource +++ b/resources/ApiUtils/ContextSourceRegistration.resource @@ -33,6 +33,7 @@ Prepare Context Source Registration From File ... ${endpoint}=${EMPTY} ... ${broker_url}=${EMPTY} ... ${operations}=[] + ... ${entity_id2}=${EMPTY} ${payload}= Load JSON From File ${EXECDIR}/data/${registration_file} ${final_context_source_url}= Set Variable If '${broker_url}' != '' ${broker_url} ${context_source_url} @@ -51,6 +52,13 @@ Prepare Context Source Registration From File ... $..entities[*] ... ${dict} END + IF '${entity_id2}' != '' + ${dict}= Create Dictionary id=${entity_id2} + ${registration_payload}= Add Object To JSON + ... ${registration_payload} + ... $.information[1].entities[*] + ... ${dict} + END IF '${entity_id_pattern}' != '' ${dict}= Create Dictionary idPattern=${entity_id_pattern} ${registration_payload}= Add Object To JSON