summaryrefslogtreecommitdiffstats
path: root/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy')
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy14
1 files changed, 14 insertions, 0 deletions
diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy
index 56c43d163..553027a4b 100644
--- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsQueryServiceImplSpec.groovy
@@ -48,4 +48,18 @@ class CpsQueryServiceImplSpec extends Specification {
FetchDescendantsOption.DIRECT_CHILDREN_ONLY, new FetchDescendantsOption(10)]
}
+ 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'
+ def cpsPath = '/cps-path'
+ when: 'queryDataNodes is invoked'
+ objectUnderTest.queryDataNodesAcrossAnchors(dataspaceName, cpsPath, fetchDescendantsOption)
+ then: 'the persistence service is called once with the correct parameters'
+ 1 * mockCpsDataPersistenceService.queryDataNodesAcrossAnchors(dataspaceName, cpsPath, fetchDescendantsOption)
+ and: 'the CpsValidator is called on the dataspaceName, schemaSetName and anchorName'
+ 1 * mockCpsValidator.validateNameCharacters(dataspaceName)
+ where: 'all fetch descendants options are supported'
+ fetchDescendantsOption << [FetchDescendantsOption.OMIT_DESCENDANTS, FetchDescendantsOption.INCLUDE_ALL_DESCENDANTS]
+ }
+
}