aboutsummaryrefslogtreecommitdiffstats
path: root/cps-rest
diff options
context:
space:
mode:
authorDylanB95EST <dylan.byrne@est.tech>2022-03-08 17:26:34 +0000
committerDylanB95EST <dylan.byrne@est.tech>2022-03-30 12:01:00 +0100
commit1839f38e054a958793ec40f524d911253086c74e (patch)
tree67895018797e6a1ea28f8a99ceb50547c66100c7 /cps-rest
parenta0bbcfd8de94bb433e787b1a6ee400c988975850 (diff)
Additional validation for names/identifiers
Implementing additional regex validation for names/identifiers in CPS - Introduces a CpsValidator - Applies to relevent java public API's - Tests have been updated where necessary Issue-ID: CPS-322 Change-Id: I29ab8820bb1fe0eee247e425d6bb018bcd38f28e Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
Diffstat (limited to 'cps-rest')
-rw-r--r--cps-rest/docs/openapi/cpsAdmin.yml2
-rwxr-xr-xcps-rest/src/test/groovy/org/onap/cps/rest/controller/AdminRestControllerSpec.groovy7
2 files changed, 5 insertions, 4 deletions
diff --git a/cps-rest/docs/openapi/cpsAdmin.yml b/cps-rest/docs/openapi/cpsAdmin.yml
index a25f81eafc..5852c0cf16 100644
--- a/cps-rest/docs/openapi/cpsAdmin.yml
+++ b/cps-rest/docs/openapi/cpsAdmin.yml
@@ -29,6 +29,8 @@ dataspaces:
responses:
'201':
$ref: 'components.yml#/components/responses/Created'
+ '400':
+ $ref: 'components.yml#/components/responses/BadRequest'
'401':
$ref: 'components.yml#/components/responses/Unauthorized'
'403':
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 58a5ebf048..41ad9ca5b2 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
@@ -22,14 +22,13 @@
package org.onap.cps.rest.controller
-import org.mapstruct.factory.Mappers
-
import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_PROHIBITED
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.multipart
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post
+import org.mapstruct.factory.Mappers
import org.onap.cps.api.CpsAdminService
import org.onap.cps.api.CpsModuleService
import org.onap.cps.spi.exceptions.AlreadyDefinedException
@@ -73,7 +72,7 @@ class AdminRestControllerSpec extends Specification {
def 'Create new dataspace.'() {
given: 'an endpoint'
- def createDataspaceEndpoint = "$basePath/v1/dataspaces";
+ def createDataspaceEndpoint = "$basePath/v1/dataspaces"
when: 'post is invoked'
def response =
mvc.perform(
@@ -88,7 +87,7 @@ class AdminRestControllerSpec extends Specification {
def 'Create dataspace over existing with same name.'() {
given: 'an endpoint'
- def createDataspaceEndpoint = "$basePath/v1/dataspaces";
+ def createDataspaceEndpoint = "$basePath/v1/dataspaces"
and: 'the service method throws an exception indicating the dataspace is already defined'
def thrownException = new AlreadyDefinedException(dataspaceName, new RuntimeException())
mockCpsAdminService.createDataspace(dataspaceName) >> { throw thrownException }