diff options
author | Toine Siebelink <toine.siebelink@est.tech> | 2024-12-20 09:49:39 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2024-12-20 09:49:39 +0000 |
commit | 04198cba517ebe487f1c2a9791ee97d0c802dd8e (patch) | |
tree | c1dc30f6871d25566a21f0af45f46dfceacb3ca1 | |
parent | c7c642eac70ae3f226ceeb250f8d4b8e170e78ca (diff) | |
parent | d685629338dedb4d3333c20e04b933aaeca2bcfb (diff) |
Merge "Remove check before removing from hazelcast cache"
4 files changed, 5 insertions, 24 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleRegistrationService.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleRegistrationService.java index fed8cc7baa..ed5e703eef 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleRegistrationService.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/CmHandleRegistrationService.java @@ -319,10 +319,8 @@ public class CmHandleRegistrationService { // CPS-1239 Robustness cleaning of in progress cache private void removeDeletedCmHandleFromModuleSyncMap(final String cmHandleId) { - if (moduleSyncStartedOnCmHandles.containsKey(cmHandleId)) { - moduleSyncStartedOnCmHandles.removeAsync(cmHandleId); - log.debug("{} will be removed asynchronously from in progress map", cmHandleId); - } + moduleSyncStartedOnCmHandles.removeAsync(cmHandleId); + log.debug("{} will be removed asynchronously from in progress map", cmHandleId); } private List<CmHandleRegistrationResponse> upgradeCmHandles(final Map<YangModelCmHandle, CmHandleState> diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/ModuleSyncTasks.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/ModuleSyncTasks.java index fd8a9943ab..9450805eaf 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/ModuleSyncTasks.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/ModuleSyncTasks.java @@ -125,10 +125,8 @@ public class ModuleSyncTasks { } private void removeResetCmHandleFromModuleSyncMap(final String resetCmHandleId) { - if (moduleSyncStartedOnCmHandles.containsKey(resetCmHandleId)) { - moduleSyncStartedOnCmHandles.removeAsync(resetCmHandleId); - log.info("{} will be removed asynchronously from in progress map", resetCmHandleId); - } + moduleSyncStartedOnCmHandles.removeAsync(resetCmHandleId); + log.info("{} will be removed asynchronously from in progress map", resetCmHandleId); } private static boolean isCmHandleInAdvisedState(final YangModelCmHandle yangModelCmHandle) { diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/trustlevel/TrustLevelManager.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/trustlevel/TrustLevelManager.java index 6e896620c6..f68bb3b543 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/trustlevel/TrustLevelManager.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/trustlevel/TrustLevelManager.java @@ -172,10 +172,7 @@ public class TrustLevelManager { * @param cmHandleIds cm handle ids to be removed from the cache */ public void removeCmHandles(final Collection<String> cmHandleIds) { - final Set<String> cmHandlesToRemove = trustLevelPerCmHandleId.keySet().stream() - .filter(cmHandleIds::contains) - .collect(Collectors.toSet()); - for (final String cmHandleId : cmHandlesToRemove) { + for (final String cmHandleId : cmHandleIds) { trustLevelPerCmHandleId.removeAsync(cmHandleId); } } diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/sync/ModuleSyncTasksSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/sync/ModuleSyncTasksSpec.groovy index 02d50c2cf0..c7fe45db90 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/sync/ModuleSyncTasksSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/impl/inventory/sync/ModuleSyncTasksSpec.groovy @@ -214,18 +214,6 @@ class ModuleSyncTasksSpec extends Specification { 'module upgrade failed' | MODULE_UPGRADE_FAILED } - - def 'Remove non-existing cm handle id from hazelcast map'() { - given: 'hazelcast map does not contains cm handle id' - def result = moduleSyncStartedOnCmHandles.get('non-existing-cm-handle') - assert result == null - when: 'remove cm handle entry from hazelcast map' - objectUnderTest.removeResetCmHandleFromModuleSyncMap('non-existing-cm-handle') - then: 'no event is logged' - def loggingEvent = getLoggingEvent() - assert loggingEvent == null - } - def cmHandleByIdAndState(cmHandleId, cmHandleState) { return new YangModelCmHandle(id: cmHandleId, compositeState: new CompositeState(cmHandleState: cmHandleState)) } |