From: Toine Siebelink Date: Thu, 4 Feb 2021 11:39:17 +0000 (+0000) Subject: Merge "Decouple configuration from application" X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=1540a5809fff8477bfdb6f43fd6c475cf13c6d71;p=cps.git Merge "Decouple configuration from application" --- 1540a5809fff8477bfdb6f43fd6c475cf13c6d71 diff --cc cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java index 0f8e041d0c,8f4bdb716f..d74e9b1cf8 mode 100755,100644..100755 --- a/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java diff --cc cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java index 07f555383a,61f9399e7e..9b31df5637 --- a/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java +++ b/cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java @@@ -28,9 -27,10 +28,9 @@@ import org.springframework.http.HttpSta import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; @RestController - @RequestMapping("${rest.api.base-path}") + @RequestMapping("${rest.api.cps-base-path}") public class DataRestController implements CpsDataApi { @Autowired diff --cc cps-rest/src/test/groovy/org/onap/cps/rest/controller/AdminRestControllerSpec.groovy index e0db106d5e,88adf10efa..926021e817 mode 100755,100644..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 @@@ -65,24 -61,22 +65,24 @@@ class AdminRestControllerSpec extends S @Autowired MockMvc mvc - @Value('${rest.api.base-path}') + @Value('${rest.api.cps-base-path}') def basePath - def anchorsEndpoint = '/v1/dataspaces/my_dataspace/anchors' - def schemaSetsEndpoint = '/v1/dataspaces/test-dataspace/schema-sets' - def schemaSetEndpoint = schemaSetsEndpoint + '/my_schema_set' - + def dataspaceName = 'my_dataspace' def anchor = new Anchor(name: 'my_anchor') def anchorList = [anchor] + def anchorName = 'my_anchor' + def schemaSetName = 'my_schema_set' - def 'Create new dataspace'() { - when: - def response = performCreateDataspaceRequest("new-dataspace") - then: 'Service method is invoked with expected parameters' - 1 * mockCpsAdminService.createDataspace("new-dataspace") - and: 'Dataspace is create successfully' + def 'Create new dataspace.'() { + given: 'an endpoint' + def createDataspaceEndpoint = "$basePath/v1/dataspaces"; + when: 'post is invoked' + def response = mvc.perform( + post(createDataspaceEndpoint).param('dataspace-name', dataspaceName)).andReturn().response + then: 'service method is invoked with expected parameters' + 1 * mockCpsAdminService.createDataspace(dataspaceName) + and: 'dataspace is create successfully' response.status == HttpStatus.CREATED.value() }