From 0f2adf4b1e266d4c1299cbdbba5857336f1cf2a2 Mon Sep 17 00:00:00 2001 From: Ken Zangelin Date: Thu, 22 Aug 2024 13:30:49 +0200 Subject: [PATCH] Adding PATCH of regs modifying/adding reg properties to an existing functest --- .../0000_ngsild/ngsild_issue_1652-csf.test | 115 +++++++++++++++++- 1 file changed, 114 insertions(+), 1 deletion(-) diff --git a/test/functionalTest/cases/0000_ngsild/ngsild_issue_1652-csf.test b/test/functionalTest/cases/0000_ngsild/ngsild_issue_1652-csf.test index 34961180d1..00ed11f1e2 100644 --- a/test/functionalTest/cases/0000_ngsild/ngsild_issue_1652-csf.test +++ b/test/functionalTest/cases/0000_ngsild/ngsild_issue_1652-csf.test @@ -38,6 +38,10 @@ orionldStart CB -experimental # 06. Query registrations with csf=Type2~=urn:aeros:federation:.* - see R1 and R2 # 07. Query registrations with csf=Type2~=urn:aeros:o.* - see R3 # 08. Query registrations with csf=Type2~=urn:hairos:.* - see [] +# 09. PATCH R1 setting Type2 to urn:hairos:09 +# 10. Query registrations with csf=Type2~=urn:hairos:.* - see R1 +# 11. PATCH R2, adding a reg property Type3=urn:aeros:federation2:R2 +# 12. Query registrations with csf=Type3~=urn:aeros:federation2.* - see R2 # echo "01. Create a registration R1 with a property Type2 = urn:aeros:federation:r1" @@ -144,6 +148,40 @@ echo echo +echo "09. PATCH R1 setting Type2 to urn:hairos:09" +echo "===========================================" +payload='{ + "Type2": "urn:hairos:09" +}' +orionCurl --url /ngsi-ld/v1/csourceRegistrations/urn:ngsi-ld:R1 --payload "$payload" -H 'Link: ' -X PATCH +echo +echo + + +echo "10. Query registrations with csf=Type2~=urn:hairos:.* - see R1" +echo "==============================================================" +orionCurl --url /ngsi-ld/v1/csourceRegistrations?csf=Type2~=urn:hairos.* -H 'Link: ' +echo +echo + + +echo "11. PATCH R2, adding a reg property Type3=urn:aeros:federation2:R2" +echo "==================================================================" +payload='{ + "Type3": "urn:aeros:federation2:R2" +}' +orionCurl --url /ngsi-ld/v1/csourceRegistrations/urn:ngsi-ld:R2 --payload "$payload" -H 'Link: ' -X PATCH +echo +echo + + +echo "12. Query registrations with csf=Type3~=urn:aeros:federation2.* - see R2" +echo "========================================================================" +orionCurl --url /ngsi-ld/v1/csourceRegistrations?csf=Type3~=urn:aeros:federation2.* -H 'Link: ' +echo +echo + + --REGEXPECT-- 01. Create a registration R1 with a property Type2 = urn:aeros:federation:r1 ============================================================================ @@ -316,6 +354,81 @@ Date: REGEX(.*) [] +09. PATCH R1 setting Type2 to urn:hairos:09 +=========================================== +HTTP/1.1 204 No Content +Date: REGEX(.*) + + + +10. Query registrations with csf=Type2~=urn:hairos:.* - see R1 +============================================================== +HTTP/1.1 200 OK +Content-Length: 233 +Content-Type: application/json +Date: REGEX(.*) +Link: REGEX(.*) + +[ + { + "Type2": "urn:hairos:09", + "endpoint": "http://my.csource.org:1026", + "id": "urn:ngsi-ld:R1", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Car1", + "type": "Vehicle" + } + ] + } + ], + "origin": "cache", + "status": "active", + "type": "ContextSourceRegistration" + } +] + + +11. PATCH R2, adding a reg property Type3=urn:aeros:federation2:R2 +================================================================== +HTTP/1.1 204 No Content +Date: REGEX(.*) + + + +12. Query registrations with csf=Type3~=urn:aeros:federation2.* - see R2 +======================================================================== +HTTP/1.1 200 OK +Content-Length: 278 +Content-Type: application/json +Date: REGEX(.*) +Link: REGEX(.*) + +[ + { + "Type2": "urn:aeros:federation:r2", + "Type3": "urn:aeros:federation2:R2", + "endpoint": "http://my.csource.org:1026", + "id": "urn:ngsi-ld:R2", + "information": [ + { + "entities": [ + { + "id": "urn:ngsi-ld:Car1", + "type": "Vehicle" + } + ] + } + ], + "origin": "cache", + "status": "active", + "type": "ContextSourceRegistration" + } +] + + --TEARDOWN-- brokerStop CB -#dbDrop CB +dbDrop CB