aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ri
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2024-06-21 11:12:45 +0100
committerDaniel Hanrahan <daniel.hanrahan@est.tech>2024-06-25 12:38:47 +0000
commit7915e994ac4eb403461b3a93165a2e3c72871ab6 (patch)
tree789a2d6e89333327e7ae044073d917e7b5cf542f /cps-ri
parent37d82d5d54ede4c05862fe648911c383d253cec3 (diff)
Fix incorrect use of getAnchors(dataspace, schemasets)
There is an issue in a method deleteDataNodes(dataspace, anchors) where it doesn't send data update events. This is because it fetches anchors using a method getAnchors(dataspace, schemaSetNames), when it needs to fetch anchors by name: getAnchors(dataspace, anchorNames) Changes: - Rename getAnchors method using schemasets to getAnchorsBySchemaSetNames - Add a method getAnchors(dataspace, anchorNames) - Update test of deleteDataNodes method using getAnchors so it checks that data update events are sent Issue-ID: CPS-2254 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I55fe853f0a9278a66a5724bf4cf2723b0e2fbc8b
Diffstat (limited to 'cps-ri')
-rwxr-xr-xcps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java23
1 files changed, 16 insertions, 7 deletions
diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java
index 56a046496e..13710dbec0 100755
--- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java
+++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsAdminPersistenceServiceImpl.java
@@ -107,6 +107,12 @@ public class CpsAdminPersistenceServiceImpl implements CpsAdminPersistenceServic
}
@Override
+ public Anchor getAnchor(final String dataspaceName, final String anchorName) {
+ final AnchorEntity anchorEntity = getAnchorEntity(dataspaceName, anchorName);
+ return toAnchor(anchorEntity);
+ }
+
+ @Override
public Collection<Anchor> getAnchors(final String dataspaceName) {
final var dataspaceEntity = dataspaceRepository.getByName(dataspaceName);
final Collection<AnchorEntity> anchorEntities = anchorRepository.findAllByDataspace(dataspaceEntity);
@@ -114,7 +120,14 @@ public class CpsAdminPersistenceServiceImpl implements CpsAdminPersistenceServic
}
@Override
- public Collection<Anchor> getAnchors(final String dataspaceName, final String schemaSetName) {
+ public Collection<Anchor> getAnchors(final String dataspaceName, final Collection<String> anchorNames) {
+ final DataspaceEntity dataspaceEntity = dataspaceRepository.getByName(dataspaceName);
+ return anchorRepository.findAllByDataspaceAndNameIn(dataspaceEntity, anchorNames)
+ .stream().map(CpsAdminPersistenceServiceImpl::toAnchor).collect(Collectors.toSet());
+ }
+
+ @Override
+ public Collection<Anchor> getAnchorsBySchemaSetName(final String dataspaceName, final String schemaSetName) {
final DataspaceEntity dataspaceEntity = dataspaceRepository.getByName(dataspaceName);
final SchemaSetEntity schemaSetEntity = schemaSetRepository.getByDataspaceAndName(
dataspaceEntity, schemaSetName);
@@ -124,7 +137,8 @@ public class CpsAdminPersistenceServiceImpl implements CpsAdminPersistenceServic
}
@Override
- public Collection<Anchor> getAnchors(final String dataspaceName, final Collection<String> schemaSetNames) {
+ public Collection<Anchor> getAnchorsBySchemaSetNames(final String dataspaceName,
+ final Collection<String> schemaSetNames) {
final DataspaceEntity dataspaceEntity = dataspaceRepository.getByName(dataspaceName);
return anchorRepository.findAllByDataspaceAndSchemaSetNameIn(dataspaceEntity, schemaSetNames)
.stream().map(CpsAdminPersistenceServiceImpl::toAnchor).collect(Collectors.toSet());
@@ -137,11 +151,6 @@ public class CpsAdminPersistenceServiceImpl implements CpsAdminPersistenceServic
inputModuleNames.size());
}
- @Override
- public Anchor getAnchor(final String dataspaceName, final String anchorName) {
- return toAnchor(getAnchorEntity(dataspaceName, anchorName));
- }
-
@Transactional
@Override
public void deleteAnchor(final String dataspaceName, final String anchorName) {