From d3a2b33cf99e1ae334c0690e7f5dc1a299f39fb7 Mon Sep 17 00:00:00 2001 From: ToineSiebelink Date: Thu, 4 May 2023 11:35:41 +0100 Subject: Fix for quickfind with descendants incl. list entries - add specialized regex - fixed legacy issues with absolute paths (added ^ in regex's) - split into 2 methods for normal queries and quickfind - fixed order of private methods Issue-ID: CPS-1671 Signed-off-by: ToineSiebelink Change-Id: I785a230cd0e3e0359e3cbb0fa754a21b6e2be7ff --- .../functional/CpsQueryServiceIntegrationSpec.groovy | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'integration-test/src') diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsQueryServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsQueryServiceIntegrationSpec.groovy index b723d7d99a..4e596da14d 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsQueryServiceIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/CpsQueryServiceIntegrationSpec.groovy @@ -298,4 +298,21 @@ class CpsQueryServiceIntegrationSpec extends FunctionalSpecBase { thrown(CpsPathException) } + def 'Cps Path querys with all descendants including descendants that are list entries: #scenario.'() { + when: 'a query is executed to get a data node by the given cps path' + def result = objectUnderTest.queryDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, cpsPath, INCLUDE_ALL_DESCENDANTS) + then: 'correct number of datanodes are returned' + assert countDataNodesInTree(result) == expectedNumberOfDataNodes + where: + scenario | cpsPath || expectedNumberOfDataNodes + 'absolute path all list entries' | '/bookstore/categories' || 13 + 'absolute path 1 list entry by key' | '/bookstore/categories[@code="3"]' || 5 + 'absolute path 1 list entry by name' | '/bookstore/categories[@name="Comedy"]' || 5 + 'relative path all list entries' | '//categories' || 13 + 'relative path 1 list entry by key' | '//categories[@code="3"]' || 5 + 'relative path 1 list entry by leaf' | '//categories[@name="Comedy"]' || 5 + 'incomplete absolute path' | '/categories' || 0 + 'incomplete absolute 1 list entry' | '/categories[@code="3"]' || 0 + } + } -- cgit 1.2.3-korg