summaryrefslogtreecommitdiffstats
path: root/cps-service/src/test
diff options
context:
space:
mode:
authorRishi.Chail <rishi.chail@est.tech>2021-01-21 19:14:24 +0000
committerRishi Chail <rishi.chail@est.tech>2021-01-22 16:03:47 +0000
commita2f384de843c3c3f68d2d371d185c71a900e9810 (patch)
tree14039f68a57089a0be418bc6cb3a37c441ba6680 /cps-service/src/test
parent5fa9a9ebb6459755a4267066e23f9671b9fac5b9 (diff)
Retrieve an Anchor for a given dataspace by anchor name - Service layer
Part of story already done in CPS-135 Issue-ID: CPS-55 Signed-off-by: Rishi.Chail <rishi.chail@est.tech> Change-Id: I0c4ae551f5c85866ce543fbb27b18ffff7d80462
Diffstat (limited to 'cps-service/src/test')
-rwxr-xr-xcps-service/src/test/groovy/org/onap/cps/api/impl/CpsAdminServiceImplSpec.groovy16
1 files changed, 12 insertions, 4 deletions
diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAdminServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAdminServiceImplSpec.groovy
index 5aaa340271..7c0c6267a7 100755
--- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAdminServiceImplSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAdminServiceImplSpec.groovy
@@ -32,25 +32,33 @@ class CpsAdminServiceImplSpec extends Specification {
objectUnderTest.cpsAdminPersistenceService = mockCpsAdminPersistenceService
}
- def 'Create dataspace method invokes persistence service'() {
+ def 'Create dataspace method invokes persistence service.'() {
when: 'Create dataspace method is invoked'
objectUnderTest.createDataspace('someDataspace')
then: 'The persistence service method is invoked with same parameters'
1 * mockCpsAdminPersistenceService.createDataspace('someDataspace')
}
- def 'Create anchor method invokes persistence service'() {
+ def 'Create anchor method invokes persistence service.'() {
when: 'Create anchor method is invoked'
objectUnderTest.createAnchor('someDataspace', 'someSchemaSet', 'someAnchorName')
then: 'The persistence service method is invoked with same parameters'
1 * mockCpsAdminPersistenceService.createAnchor('someDataspace', 'someSchemaSet', 'someAnchorName')
}
- def 'Retrieve all anchors for dataspace'() {
+ def 'Retrieve all anchors for dataspace.'() {
given: 'that anchor is associated with the dataspace'
Collection<Anchor> anchorCollection = Arrays.asList(new Anchor())
mockCpsAdminPersistenceService.getAnchors('someDataspace') >> { anchorCollection }
expect: 'the collection provided by persistence service is returned as result'
objectUnderTest.getAnchors('someDataspace') == anchorCollection
}
-}
+
+ def 'Retrieve anchor for dataspace and provided anchor name.'() {
+ given: 'that anchor name is associated with the dataspace'
+ Anchor anchor = new Anchor()
+ mockCpsAdminPersistenceService.getAnchor('someDataspace','someAnchor') >> anchor
+ expect: 'the anchor provided by persistence service is returned as result'
+ objectUnderTest.getAnchor('someDataspace','someAnchor') == anchor
+ }
+} \ No newline at end of file