summaryrefslogtreecommitdiffstats
path: root/cps-service/src/test
diff options
context:
space:
mode:
authorRishi.Chail <rishi.chail@est.tech>2021-01-06 13:09:34 +0000
committerRishi.Chail <rishi.chail@est.tech>2021-01-15 14:32:35 +0000
commita16c3fb5f7f0bbe7bda9e4f21f71a3e958ed523f (patch)
treeb1e700f5c9915a38fc85af82df799072f3dd7035 /cps-service/src/test
parent4118d94f71a4e5f5a4aef038f51c66fd2c1b8b60 (diff)
Retrieve the SchemaSet resources for an Anchor
Issue-ID: CPS-135 Signed-off-by: Rishi.Chail <rishi.chail@est.tech> Change-Id: Ib7c17c5180212c7dd3b96cf27797c84166041cf9
Diffstat (limited to 'cps-service/src/test')
-rwxr-xr-x[-rw-r--r--]cps-service/src/test/groovy/org/onap/cps/api/impl/CpsAdminServiceImplSpec.groovy9
-rwxr-xr-x[-rw-r--r--]cps-service/src/test/groovy/org/onap/cps/spi/exceptions/CpsExceptionsSpec.groovy8
2 files changed, 11 insertions, 6 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 022282493..5aaa34027 100644..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
@@ -41,17 +41,16 @@ class CpsAdminServiceImplSpec extends Specification {
def 'Create anchor method invokes persistence service'() {
when: 'Create anchor method is invoked'
- objectUnderTest.createAnchor('dummyDataspace', 'dummySchemaSet', 'dummyAnchorName')
+ objectUnderTest.createAnchor('someDataspace', 'someSchemaSet', 'someAnchorName')
then: 'The persistence service method is invoked with same parameters'
- 1 * mockCpsAdminPersistenceService.createAnchor('dummyDataspace', 'dummySchemaSet', 'dummyAnchorName')
+ 1 * mockCpsAdminPersistenceService.createAnchor('someDataspace', 'someSchemaSet', 'someAnchorName')
}
def 'Retrieve all anchors for dataspace'() {
given: 'that anchor is associated with the dataspace'
Collection<Anchor> anchorCollection = Arrays.asList(new Anchor())
- mockCpsAdminPersistenceService.getAnchors('dummyDataspace') >> { anchorCollection }
+ mockCpsAdminPersistenceService.getAnchors('someDataspace') >> { anchorCollection }
expect: 'the collection provided by persistence service is returned as result'
- objectUnderTest.getAnchors('dummyDataspace') == anchorCollection
+ objectUnderTest.getAnchors('someDataspace') == anchorCollection
}
-
}
diff --git a/cps-service/src/test/groovy/org/onap/cps/spi/exceptions/CpsExceptionsSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/spi/exceptions/CpsExceptionsSpec.groovy
index 067556dd5..e00a640d4 100644..100755
--- a/cps-service/src/test/groovy/org/onap/cps/spi/exceptions/CpsExceptionsSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/spi/exceptions/CpsExceptionsSpec.groovy
@@ -104,4 +104,10 @@ class CpsExceptionsSpec extends Specification {
(new SchemaSetNotFoundException(dataspaceName,schemaSetName)).details
== "Schema Set with name ${schemaSetName} was not found for dataspace ${dataspaceName}."
}
-}
+
+ def 'Creating a exception that an anchor cannot be found.'() {
+ expect: 'the exception details contains the correct message with dataspace and anchor name'
+ (new AnchorNotFoundException(anchorName, dataspaceName)).details
+ == "Anchor with name ${anchorName} does not exist in dataspace ${dataspaceName}."
+ }
+} \ No newline at end of file