From b701e3090b90b4bb3aef93c9f89a6d642e6e084a Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Wed, 5 Mar 2025 17:28:07 +0000 Subject: Allow limiting results in queryDataLeaf This exposes queryResultLimit parameter in queryDataLeaf, same as was implemented for queryDataNodes API. Issue-ID: CPS-2680 Signed-off-by: danielhanrahan Change-Id: Ieb922ac1acc91dbfd67fb5ade7856213a2f93ce8 --- .../functional/cps/QueryServiceIntegrationSpec.groovy | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'integration-test') diff --git a/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/QueryServiceIntegrationSpec.groovy b/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/QueryServiceIntegrationSpec.groovy index 42fb964d52..6ae14dd11b 100644 --- a/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/QueryServiceIntegrationSpec.groovy +++ b/integration-test/src/test/groovy/org/onap/cps/integration/functional/cps/QueryServiceIntegrationSpec.groovy @@ -458,8 +458,8 @@ class QueryServiceIntegrationSpec extends FunctionalSpecBase { assert result.anchorName.toSet() == [BOOKSTORE_ANCHOR_1, BOOKSTORE_ANCHOR_2].toSet() } - def 'Query with a limit of #limit.' () { - when: + def 'Query data nodes with a limit of #limit.' () { + when: 'a query for data nodes is executed with a result limit' def result = objectUnderTest.queryDataNodes(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories', OMIT_DESCENDANTS, limit) then: 'the expected number of nodes is returned' assert countDataNodesInTree(result) == expectedNumberOfResults @@ -470,4 +470,17 @@ class QueryServiceIntegrationSpec extends FunctionalSpecBase { 0 || 5 -1 || 5 } + + def 'Query data leaf with a limit of #limit.' () { + when: 'a query for data leaf is executed with a result limit' + def result = objectUnderTest.queryDataLeaf(FUNCTIONAL_TEST_DATASPACE_1, BOOKSTORE_ANCHOR_1, '/bookstore/categories/@name', limit, String) + then: 'the expected number of leaf values is returned' + assert result.size() == expectedNumberOfResults + where: 'the following parameters are used' + limit || expectedNumberOfResults + 1 || 1 + 2 || 2 + 0 || 5 + -1 || 5 + } } -- cgit 1.2.3-korg