From 09c6b6e1fa2684c913d7b904f7c7ad6b26b04ef1 Mon Sep 17 00:00:00 2001 From: niamhcore Date: Mon, 22 Nov 2021 11:44:38 +0000 Subject: CPS-314: Delete Dataspace Issue-ID: CPS-314 Change-Id: I778e2b784c7b1ff3fecc1036425708dc4ec73227 Signed-off-by: niamhcore --- .../groovy/org/onap/cps/api/impl/CpsAdminServiceImplSpec.groovy | 8 ++++++++ .../groovy/org/onap/cps/spi/exceptions/CpsExceptionsSpec.groovy | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'cps-service/src/test/groovy') 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 95afeb4172..6d1f586295 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 @@ -78,4 +78,12 @@ class CpsAdminServiceImplSpec extends Specification { objectUnderTest.queryAnchorNames('some-dataspace-name', ['some-module-name']) == ['some-anchor-identifier'] } + + def 'Delete dataspace.'() { + when: 'delete dataspace is invoked' + objectUnderTest.deleteDataspace('someDataspace') + then: 'associated persistence service method is invoked with correct parameter' + 1 * mockCpsAdminPersistenceService.deleteDataspace('someDataspace') + } + } 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 4243c18c24..5bd3678346 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 @@ -170,4 +170,12 @@ class CpsExceptionsSpec extends Specification { expect: 'the exception has the provided details' exception.details == providedDetails } + + def 'Creating an exception that the dataspace is being used and cannot be deleted.'() { + given: 'a dataspace in use exception is created' + def exception = new DataspaceInUseException(dataspaceName,providedDetails) + expect: 'the exception has the correct message with dataspace name and provided details' + exception.message == "Dataspace with name ${dataspaceName} is being used." + exception.details == providedDetails + } } -- cgit 1.2.3-korg