summaryrefslogtreecommitdiffstats
path: root/cps-rest/src/main/java
diff options
context:
space:
mode:
authorToineSiebelink <toine.siebelink@est.tech>2023-12-18 12:25:41 +0000
committerToineSiebelink <toine.siebelink@est.tech>2023-12-18 16:58:16 +0000
commita966bab93a17fcba4e7fc28354c01b3f0878fbbe (patch)
tree0e267217d3871727c1440569faaf52b25bbea4dc /cps-rest/src/main/java
parent597d4ef72e5388092cc80ae662af6711f735369f (diff)
Remove the dependency-cycle between beans
- Splitting admin service into AnchorService and DataspaceService (this resolves the cyclic dependency) - Improved Delete dataspace integration error tests (were depending on execution order, now independent) Issue-ID: CPS-871 Change-Id: I47efedb6eb4bd2900f72d689616b7b7b62df2938 Signed-off-by: halil.cakal <halil.cakal@est.tech> Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
Diffstat (limited to 'cps-rest/src/main/java')
-rwxr-xr-xcps-rest/src/main/java/org/onap/cps/rest/controller/AdminRestController.java26
1 files changed, 14 insertions, 12 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 993dad58c3..9b78f85201 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
@@ -33,7 +33,8 @@ import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor;
-import org.onap.cps.api.CpsAdminService;
+import org.onap.cps.api.CpsAnchorService;
+import org.onap.cps.api.CpsDataspaceService;
import org.onap.cps.api.CpsModuleService;
import org.onap.cps.rest.api.CpsAdminApi;
import org.onap.cps.rest.model.AnchorDetails;
@@ -53,9 +54,10 @@ import org.springframework.web.multipart.MultipartFile;
@RequiredArgsConstructor
public class AdminRestController implements CpsAdminApi {
- private final CpsAdminService cpsAdminService;
+ private final CpsDataspaceService cpsDataspaceService;
private final CpsModuleService cpsModuleService;
private final CpsRestInputMapper cpsRestInputMapper;
+ private final CpsAnchorService cpsAnchorService;
/**
* Create a dataspace.
@@ -65,7 +67,7 @@ public class AdminRestController implements CpsAdminApi {
*/
@Override
public ResponseEntity<String> createDataspace(@NotNull @Valid final String dataspaceName) {
- cpsAdminService.createDataspace(dataspaceName);
+ cpsDataspaceService.createDataspace(dataspaceName);
return new ResponseEntity<>(dataspaceName, HttpStatus.CREATED);
}
@@ -77,7 +79,7 @@ public class AdminRestController implements CpsAdminApi {
*/
@Override
public ResponseEntity<Void> createDataspaceV2(@NotNull @Valid final String dataspaceName) {
- cpsAdminService.createDataspace(dataspaceName);
+ cpsDataspaceService.createDataspace(dataspaceName);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@@ -89,7 +91,7 @@ public class AdminRestController implements CpsAdminApi {
*/
@Override
public ResponseEntity<Void> deleteDataspace(final String apiVersion, final String dataspaceName) {
- cpsAdminService.deleteDataspace(dataspaceName);
+ cpsDataspaceService.deleteDataspace(dataspaceName);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@@ -184,7 +186,7 @@ public class AdminRestController implements CpsAdminApi {
@Override
public ResponseEntity<String> createAnchor(final String dataspaceName, @NotNull @Valid final String schemaSetName,
@NotNull @Valid final String anchorName) {
- cpsAdminService.createAnchor(dataspaceName, schemaSetName, anchorName);
+ cpsAnchorService.createAnchor(dataspaceName, schemaSetName, anchorName);
return new ResponseEntity<>(anchorName, HttpStatus.CREATED);
}
@@ -199,7 +201,7 @@ public class AdminRestController implements CpsAdminApi {
@Override
public ResponseEntity<Void> createAnchorV2(final String dataspaceName, @NotNull @Valid final String schemaSetName,
@NotNull @Valid final String anchorName) {
- cpsAdminService.createAnchor(dataspaceName, schemaSetName, anchorName);
+ cpsAnchorService.createAnchor(dataspaceName, schemaSetName, anchorName);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@@ -214,7 +216,7 @@ public class AdminRestController implements CpsAdminApi {
@Override
public ResponseEntity<Void> deleteAnchor(final String apiVersion,
final String dataspaceName, final String anchorName) {
- cpsAdminService.deleteAnchor(dataspaceName, anchorName);
+ cpsAnchorService.deleteAnchor(dataspaceName, anchorName);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@@ -229,7 +231,7 @@ public class AdminRestController implements CpsAdminApi {
@Override
public ResponseEntity<AnchorDetails> getAnchor(final String apiVersion,
final String dataspaceName, final String anchorName) {
- final var anchor = cpsAdminService.getAnchor(dataspaceName, anchorName);
+ final var anchor = cpsAnchorService.getAnchor(dataspaceName, anchorName);
final var anchorDetails = cpsRestInputMapper.toAnchorDetails(anchor);
return new ResponseEntity<>(anchorDetails, HttpStatus.OK);
}
@@ -244,7 +246,7 @@ public class AdminRestController implements CpsAdminApi {
@Override
public ResponseEntity<List<AnchorDetails>> getAnchors(final String apiVersion,
final String dataspaceName) {
- final Collection<Anchor> anchors = cpsAdminService.getAnchors(dataspaceName);
+ final Collection<Anchor> anchors = cpsAnchorService.getAnchors(dataspaceName);
final List<AnchorDetails> anchorDetails = anchors.stream().map(cpsRestInputMapper::toAnchorDetails)
.collect(Collectors.toList());
return new ResponseEntity<>(anchorDetails, HttpStatus.OK);
@@ -252,7 +254,7 @@ public class AdminRestController implements CpsAdminApi {
@Override
public ResponseEntity<List<DataspaceDetails>> getAllDataspaces(final String apiVersion) {
- final Collection<Dataspace> dataspaces = cpsAdminService.getAllDataspaces();
+ final Collection<Dataspace> dataspaces = cpsDataspaceService.getAllDataspaces();
final List<DataspaceDetails> dataspaceDetails = dataspaces.stream().map(cpsRestInputMapper::toDataspaceDetails)
.collect(Collectors.toList());
return new ResponseEntity<>(dataspaceDetails, HttpStatus.OK);
@@ -260,7 +262,7 @@ public class AdminRestController implements CpsAdminApi {
@Override
public ResponseEntity<DataspaceDetails> getDataspace(final String apiVersion, final String dataspaceName) {
- final Dataspace dataspace = cpsAdminService.getDataspace(dataspaceName);
+ final Dataspace dataspace = cpsDataspaceService.getDataspace(dataspaceName);
final DataspaceDetails dataspaceDetails = cpsRestInputMapper.toDataspaceDetails(dataspace);
return new ResponseEntity<>(dataspaceDetails, HttpStatus.OK);
}