aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service/src/test
diff options
context:
space:
mode:
authorleventecsanyi <levente.csanyi@est.tech>2025-02-06 15:26:11 +0100
committerleventecsanyi <levente.csanyi@est.tech>2025-02-11 17:58:40 +0100
commit56d550a3513681b1b20d612a21072b9955b12b82 (patch)
treeaf725f47679a81dac54eb5bf551dcef62feb2ca9 /cps-service/src/test
parent2489064ffa94f76a5e49fed8e06d1299ec9cc671 (diff)
Query data nodes with limit
- added new methods to java interfaces - added integration test - removed unused methods Issue-ID: CPS-2394 Change-Id: Iac4094a5daedbf593d17f55928136a80391c6d23 Signed-off-by: leventecsanyi <levente.csanyi@est.tech>
Diffstat (limited to 'cps-service/src/test')
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/impl/CpsQueryServiceImplSpec.groovy19
1 files changed, 17 insertions, 2 deletions
diff --git a/cps-service/src/test/groovy/org/onap/cps/impl/CpsQueryServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/impl/CpsQueryServiceImplSpec.groovy
index b15ee72370..9db4aa4c3e 100644
--- a/cps-service/src/test/groovy/org/onap/cps/impl/CpsQueryServiceImplSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/impl/CpsQueryServiceImplSpec.groovy
@@ -21,7 +21,7 @@
package org.onap.cps.impl
-
+import org.onap.cps.api.CpsQueryService
import org.onap.cps.utils.CpsValidator
import org.onap.cps.spi.CpsDataPersistenceService
import org.onap.cps.api.parameters.FetchDescendantsOption
@@ -42,7 +42,7 @@ class CpsQueryServiceImplSpec extends Specification {
when: 'queryDataNodes is invoked'
objectUnderTest.queryDataNodes(dataspaceName, anchorName, cpsPath, fetchDescendantsOption)
then: 'the persistence service is called once with the correct parameters'
- 1 * mockCpsDataPersistenceService.queryDataNodes(dataspaceName, anchorName, cpsPath, fetchDescendantsOption)
+ 1 * mockCpsDataPersistenceService.queryDataNodes(dataspaceName, anchorName, cpsPath, fetchDescendantsOption, CpsQueryService.NO_LIMIT)
and: 'the CpsValidator is called on the dataspaceName, schemaSetName and anchorName'
1 * mockCpsValidator.validateNameCharacters(dataspaceName, anchorName)
where: 'all fetch descendants options are supported'
@@ -50,6 +50,21 @@ class CpsQueryServiceImplSpec extends Specification {
FetchDescendantsOption.DIRECT_CHILDREN_ONLY, new FetchDescendantsOption(10)]
}
+ def 'Query data nodes by cps path with limit.'() {
+ given: 'a dataspace name, an anchor name and a cps path'
+ def dataspaceName = 'some-dataspace'
+ def anchorName = 'some-anchor'
+ def cpsPath = '/cps-path'
+ def fetchDescendantsOption = FetchDescendantsOption.OMIT_DESCENDANTS
+ def myLimit = 123
+ when: 'queryDataNodes (with limit) is invoked'
+ objectUnderTest.queryDataNodes(dataspaceName, anchorName, cpsPath, fetchDescendantsOption, myLimit)
+ then: 'the persistence service is called once with the correct parameters'
+ 1 * mockCpsDataPersistenceService.queryDataNodes(dataspaceName, anchorName, cpsPath, fetchDescendantsOption, myLimit)
+ and: 'the CpsValidator is called on the dataspaceName, schemaSetName and anchorName'
+ 1 * mockCpsValidator.validateNameCharacters(dataspaceName, anchorName)
+ }
+
def 'Query data nodes across all anchors by cps path with #fetchDescendantsOption.'() {
given: 'a dataspace name, an anchor name and a cps path'
def dataspaceName = 'some-dataspace'