diff options
author | JosephKeenan <joseph.keenan@est.tech> | 2021-08-03 18:24:32 +0100 |
---|---|---|
committer | Renu Kumari <renu.kumari@bell.ca> | 2021-08-10 10:44:24 -0400 |
commit | be21595d53636e2c9b912bfbe8dfdefb81edc70f (patch) | |
tree | c40add4ce147e0ab6da7814384dd42d82e316079 /cps-rest/src/main | |
parent | dce1d58005d90950e00b22078d82559748dcb255 (diff) |
Upgrade Swager Codegen-maven-plugin
- Removed swagger annotations dependency as latest plugin generates
code using v3 annotations.
- updated the method signature as per the new generated code
- removed unnecessary mock springbeans from the WebMvcTest
Issue-ID: CPS-205
Change-Id: Ie7911d7389dca587bde945d913f458de46027e0f
Signed-off-by: JosephKeenan <joseph.keenan@est.tech>
Diffstat (limited to 'cps-rest/src/main')
-rwxr-xr-x | cps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java | 12 | ||||
-rwxr-xr-x | cps-rest/src/main/java/org/onap/cps/rest/controller/DataRestController.java | 22 |
2 files changed, 19 insertions, 15 deletions
diff --git 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 index 879d5dc6e0..a1287b2bd6 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 @@ -28,6 +28,8 @@ import static org.onap.cps.spi.CascadeDeleteAllowed.CASCADE_DELETE_PROHIBITED; import java.util.Collection; import java.util.List; import java.util.stream.Collectors; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; import org.modelmapper.ModelMapper; import org.onap.cps.api.CpsAdminService; import org.onap.cps.api.CpsModuleService; @@ -63,7 +65,7 @@ public class AdminRestController implements CpsAdminApi { * @return a {@Link ResponseEntity} of created dataspace name & {@link HttpStatus} CREATED */ @Override - public ResponseEntity<String> createDataspace(final String dataspaceName) { + public ResponseEntity<String> createDataspace(@NotNull @Valid final String dataspaceName) { cpsAdminService.createDataspace(dataspaceName); return new ResponseEntity<>(dataspaceName, HttpStatus.CREATED); } @@ -88,8 +90,8 @@ public class AdminRestController implements CpsAdminApi { * @return a {@Link ResponseEntity} of created schemaset name & {@link HttpStatus} CREATED */ @Override - public ResponseEntity<String> createSchemaSet(final MultipartFile multipartFile, - final String schemaSetName, final String dataspaceName) { + public ResponseEntity<String> createSchemaSet(@NotNull @Valid final String schemaSetName, + final String dataspaceName, @Valid final MultipartFile multipartFile) { cpsModuleService.createSchemaSet(dataspaceName, schemaSetName, extractYangResourcesMap(multipartFile)); return new ResponseEntity<>(schemaSetName, HttpStatus.CREATED); } @@ -130,8 +132,8 @@ public class AdminRestController implements CpsAdminApi { * @return a ResponseEntity with the anchor name & {@link HttpStatus} CREATED */ @Override - public ResponseEntity<String> createAnchor(final String dataspaceName, final String schemaSetName, - final String anchorName) { + public ResponseEntity<String> createAnchor(final String dataspaceName, @NotNull @Valid final String schemaSetName, + @NotNull @Valid final String anchorName) { cpsAdminService.createAnchor(dataspaceName, schemaSetName, anchorName); return new ResponseEntity<>(anchorName, HttpStatus.CREATED); } diff --git 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 index 64b441829d..bad66dd4e8 100755 --- 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 @@ -21,6 +21,8 @@ package org.onap.cps.rest.controller; +import javax.validation.Valid; +import javax.validation.constraints.NotNull; import org.onap.cps.api.CpsDataService; import org.onap.cps.rest.api.CpsDataApi; import org.onap.cps.spi.FetchDescendantsOption; @@ -41,8 +43,8 @@ public class DataRestController implements CpsDataApi { private CpsDataService cpsDataService; @Override - public ResponseEntity<String> createNode(final String jsonData, final String dataspaceName, final String anchorName, - final String parentNodeXpath) { + public ResponseEntity<String> createNode(final String dataspaceName, final String anchorName, + final String jsonData, final String parentNodeXpath) { if (isRootXpath(parentNodeXpath)) { cpsDataService.saveData(dataspaceName, anchorName, jsonData); } else { @@ -52,8 +54,8 @@ public class DataRestController implements CpsDataApi { } @Override - public ResponseEntity<String> addListNodeElements(final String jsonData, final String parentNodeXpath, - final String dataspaceName, final String anchorName) { + public ResponseEntity<String> addListNodeElements(final String parentNodeXpath, + final String dataspaceName, final String anchorName, final String jsonData) { cpsDataService.saveListNodeData(dataspaceName, anchorName, parentNodeXpath, jsonData); return new ResponseEntity<>(HttpStatus.CREATED); } @@ -74,22 +76,22 @@ public class DataRestController implements CpsDataApi { } @Override - public ResponseEntity<Object> updateNodeLeaves(final String jsonData, final String dataspaceName, - final String anchorName, final String parentNodeXpath) { + public ResponseEntity<Object> updateNodeLeaves(final String dataspaceName, + final String anchorName, final String jsonData, final String parentNodeXpath) { cpsDataService.updateNodeLeaves(dataspaceName, anchorName, parentNodeXpath, jsonData); return new ResponseEntity<>(HttpStatus.OK); } @Override - public ResponseEntity<Object> replaceNode(final String jsonData, final String dataspaceName, - final String anchorName, final String parentNodeXpath) { + public ResponseEntity<Object> replaceNode(final String dataspaceName, + final String anchorName, @Valid final String jsonData, @Valid final String parentNodeXpath) { cpsDataService.replaceNodeTree(dataspaceName, anchorName, parentNodeXpath, jsonData); return new ResponseEntity<>(HttpStatus.OK); } @Override - public ResponseEntity<String> replaceListNodeElements(final String jsonData, final String parentNodeXpath, - final String dataspaceName, final String anchorName) { + public ResponseEntity<String> replaceListNodeElements(@NotNull @Valid final String parentNodeXpath, + final String dataspaceName, final String anchorName, @Valid final String jsonData) { cpsDataService.replaceListNodeData(dataspaceName, anchorName, parentNodeXpath, jsonData); return new ResponseEntity<>(HttpStatus.OK); } |