diff options
author | 2022-11-01 14:40:25 +0000 | |
---|---|---|
committer | 2022-11-08 13:31:04 +0000 | |
commit | 337c8d436186d87742caefc95aeee7ba2a36b687 (patch) | |
tree | 28e45ec083dac7b7e625b87189328b5082d2bc18 /cps-ri/src/test | |
parent | 375281167c3792a70eee0bafa21364f184aebd86 (diff) |
Node API - GET Method performance issue
- Modified toDataNode call based on fetch descendants option.
- Used fragment extract to build fragment entity.
- Modified data set to have correct parent id for descendants.
Reviewers : Toine, Priyank and Joe
Issue-ID: CPS-1171
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Change-Id: I27a537fe72dd396722e6cfde7d8c454ed2579ec0
Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'cps-ri/src/test')
-rw-r--r-- | cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceQueryDataNodeSpec.groovy | 21 | ||||
-rw-r--r-- | cps-ri/src/test/resources/data/cps-path-query.sql | 6 |
2 files changed, 14 insertions, 13 deletions
diff --git a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceQueryDataNodeSpec.groovy b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceQueryDataNodeSpec.groovy index be2f8febf..56e388335 100644 --- a/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceQueryDataNodeSpec.groovy +++ b/cps-ri/src/test/groovy/org/onap/cps/spi/impl/CpsDataPersistenceQueryDataNodeSpec.groovy @@ -149,18 +149,19 @@ class CpsDataPersistenceQueryDataNodeSpec extends CpsPersistenceSpecBase { result.size() == expectedXPaths.size() for (int i = 0; i < result.size(); i++) { assert result[i].getXpath() == expectedXPaths[i] + assert result[i].childDataNodes.size() == expectedNumberOfChildren[i] } where: 'the following data is used' - scenario | cpsPath || expectedXPaths - 'multiple list-ancestors' | '//book/ancestor::categories' || ["/shops/shop[@id='1']/categories[@code='1']", "/shops/shop[@id='1']/categories[@code='2']"] - 'one ancestor with list value' | '//book/ancestor::categories[@code=1]' || ["/shops/shop[@id='1']/categories[@code='1']"] - 'top ancestor' | '//shop[@id=1]/ancestor::shops' || ['/shops'] - 'list with index value in the xpath prefix' | '//categories[@code=1]/book/ancestor::shop[@id=1]' || ["/shops/shop[@id='1']"] - 'ancestor with parent list' | '//book/ancestor::shop[@id=1]/categories[@code=2]' || ["/shops/shop[@id='1']/categories[@code='2']"] - 'ancestor with parent' | '//phonenumbers[@type="mob"]/ancestor::info/contact' || ["/shops/shop[@id='3']/info/contact"] - 'ancestor combined with text condition' | '//book/title[text()="Dune"]/ancestor::shop' || ["/shops/shop[@id='1']"] - 'ancestor with parent that does not exist' | '//book/ancestor::parentDoesNoExist/categories' || [] - 'ancestor does not exist' | '//book/ancestor::ancestorDoesNotExist' || [] + scenario | cpsPath || expectedXPaths || expectedNumberOfChildren + 'multiple list-ancestors' | '//book/ancestor::categories' || ["/shops/shop[@id='1']/categories[@code='1']", "/shops/shop[@id='1']/categories[@code='2']"] || [1, 1] + 'one ancestor with list value' | '//book/ancestor::categories[@code=1]' || ["/shops/shop[@id='1']/categories[@code='1']"] || [1] + 'top ancestor' | '//shop[@id=1]/ancestor::shops' || ['/shops'] || [5] + 'list with index value in the xpath prefix' | '//categories[@code=1]/book/ancestor::shop[@id=1]' || ["/shops/shop[@id='1']"] || [3] + 'ancestor with parent list' | '//book/ancestor::shop[@id=1]/categories[@code=2]' || ["/shops/shop[@id='1']/categories[@code='2']"] || [1] + 'ancestor with parent' | '//phonenumbers[@type="mob"]/ancestor::info/contact' || ["/shops/shop[@id='3']/info/contact"] || [3] + 'ancestor combined with text condition' | '//book/title[text()="Dune"]/ancestor::shop' || ["/shops/shop[@id='1']"] || [3] + 'ancestor with parent that does not exist' | '//book/ancestor::parentDoesNoExist/categories' || [] || [] + 'ancestor does not exist' | '//book/ancestor::ancestorDoesNotExist' || [] || [] } def 'Cps Path query with syntax error throws a CPS Path Exception.'() { diff --git a/cps-ri/src/test/resources/data/cps-path-query.sql b/cps-ri/src/test/resources/data/cps-path-query.sql index fa711cbbf..18fd74a07 100644 --- a/cps-ri/src/test/resources/data/cps-path-query.sql +++ b/cps-ri/src/test/resources/data/cps-path-query.sql @@ -73,6 +73,6 @@ INSERT INTO FRAGMENT (ID, DATASPACE_ID, ANCHOR_ID, PARENT_ID, XPATH, ATTRIBUTES) (14, 1001, 1003, 12, '/shops/shop[@id=''3'']/categories[@code=''2'']', '{"id" : 2, "type" : "garden centre", "name": "outdoor plants"}'), (16, 1001, 1003, 1, '/shops/shop[@id=''3'']/info', null), (17, 1001, 1003, 1, '/shops/shop[@id=''3'']/info/contact', null), - (18, 1001, 1003, 1, '/shops/shop[@id=''3'']/info/contact/website', '{"address" : "myshop.ie"}'), - (19, 1001, 1003, 12, '/shops/shop[@id=''3'']/info/contact/phonenumbers[@type=''mob'']', '{"type" : "mob", "number" : "123123456"}'), - (20, 1001, 1003, 12, '/shops/shop[@id=''3'']/info/contact/phonenumbers[@type=''landline'']', '{"type" : "landline", "number" : "012123456"}'); + (18, 1001, 1003, 17, '/shops/shop[@id=''3'']/info/contact/website', '{"address" : "myshop.ie"}'), + (19, 1001, 1003, 17, '/shops/shop[@id=''3'']/info/contact/phonenumbers[@type=''mob'']', '{"type" : "mob", "number" : "123123456"}'), + (20, 1001, 1003, 17, '/shops/shop[@id=''3'']/info/contact/phonenumbers[@type=''landline'']', '{"type" : "landline", "number" : "012123456"}'); |