- def 'Create an anchor'() {
- given: 'that the persistence service returns the name of the anchor'
- def anchorName = 'some anchor name'
- mockCpsAdminPersistenceService.createAnchor(_) >> anchorName
- expect: 'the same anchor name is returned by CPS Admin service'
- objectUnderTest.createAnchor(anchor) == anchorName
+ 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.'() {
+ 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.'() {
+ given: 'that anchor is associated with the dataspace'
+ def anchors = [new Anchor()]
+ mockCpsAdminPersistenceService.getAnchors('someDataspace') >> anchors
+ expect: 'the collection provided by persistence service is returned as result'
+ objectUnderTest.getAnchors('someDataspace') == anchors
+ }
+
+ def 'Retrieve all anchors for schema-set.'() {
+ given: 'that anchor is associated with the dataspace and schemaset'
+ def anchors = [new Anchor()]
+ mockCpsAdminPersistenceService.getAnchors('someDataspace', 'someSchemaSet') >> anchors
+ expect: 'the collection provided by persistence service is returned as result'
+ objectUnderTest.getAnchors('someDataspace', 'someSchemaSet') == anchors