diff options
Diffstat (limited to 'cps-rest/src/test')
-rwxr-xr-x | cps-rest/src/test/groovy/org/onap/cps/rest/controller/AdminRestControllerSpec.groovy | 13 | ||||
-rw-r--r-- | cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy | 4 |
2 files changed, 16 insertions, 1 deletions
diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/AdminRestControllerSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/AdminRestControllerSpec.groovy index 84da2db5d7..e8cfcfb6f6 100755 --- a/cps-rest/src/test/groovy/org/onap/cps/rest/controller/AdminRestControllerSpec.groovy +++ b/cps-rest/src/test/groovy/org/onap/cps/rest/controller/AdminRestControllerSpec.groovy @@ -311,6 +311,18 @@ class AdminRestControllerSpec extends Specification { response.status == HttpStatus.NO_CONTENT.value() } + def 'Delete dataspace.'() { + given: 'an endpoint' + def dataspaceEndpoint = "$basePath/v1/dataspaces" + when: 'delete dataspace endpoint is invoked' + def response = mvc.perform(delete(dataspaceEndpoint) + .param('dataspace-name', dataspaceName)) + .andReturn().response + then: 'associated service method is invoked with expected parameter' + 1 * mockCpsAdminService.deleteDataspace(dataspaceName) + and: 'response code indicates success' + response.status == HttpStatus.NO_CONTENT.value() + } def createMultipartFile(filename, content) { return new MockMultipartFile("file", filename, "text/plain", content.getBytes()) @@ -333,4 +345,5 @@ class AdminRestControllerSpec extends Specification { multipartFile.getInputStream() >> { throw new IOException() } return multipartFile } + } diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy index 079a59c667..f5968442d7 100644 --- a/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy +++ b/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy @@ -37,6 +37,7 @@ import org.onap.cps.spi.exceptions.DataValidationException import org.onap.cps.spi.exceptions.ModelValidationException import org.onap.cps.spi.exceptions.NotFoundInDataspaceException import org.onap.cps.spi.exceptions.SchemaSetInUseException +import org.onap.cps.spi.exceptions.DataspaceInUseException import org.spockframework.spring.SpringBean import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Value @@ -145,7 +146,8 @@ class CpsRestExceptionHandlerSpec extends Specification { assertTestResponse(response, CONFLICT, exceptionThrown.getMessage(), exceptionThrown.getDetails()) where: 'the following exceptions are thrown' exceptionThrown << [new DataInUseException(dataspaceName, existingObjectName), - new SchemaSetInUseException(dataspaceName, existingObjectName)] + new SchemaSetInUseException(dataspaceName, existingObjectName), + new DataspaceInUseException(dataspaceName, errorDetails)] } /* |