From: Toine Siebelink Date: Thu, 8 Feb 2024 14:08:47 +0000 (+0000) Subject: Merge "Introduce Hazelcast for alternateId-cmHandle relation pt. 2 - error collection" X-Git-Tag: 3.4.4~34 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=cps.git;a=commitdiff_plain;h=814b882c6bf85a88c9135edb592e90d46af31f9a Merge "Introduce Hazelcast for alternateId-cmHandle relation pt. 2 - error collection" --- 814b882c6bf85a88c9135edb592e90d46af31f9a diff --cc cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/CmHandleIdMapperSpec.groovy index 55ccdf3be,a625e3e46..1b323a216 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/CmHandleIdMapperSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/utils/CmHandleIdMapperSpec.groovy @@@ -71,27 -71,18 +71,27 @@@ class CmHandleIdMapperSpec extends Spec def 'Remove an entry from the cache.'() { when: 'removing an entry' - objectUnderTest.removeMapping('my cmhandle id') + objectUnderTest.removeMapping('cached cmhandle id') then: 'converting alternate id returns null' - assert objectUnderTest.alternateIdToCmHandleId('my alternate id') == null + assert objectUnderTest.alternateIdToCmHandleId('cached alternate id') == null and: 'converting cmhandle id returns null' - assert objectUnderTest.cmHandleIdToAlternateId('my cmhandle id') == null + assert objectUnderTest.cmHandleIdToAlternateId('cached cmhandle id') == null } + def 'Attempt to remove a non-existing entry from the cache.'() { + when: 'removing an entry that is not cached' + objectUnderTest.removeMapping('non-cached cmhandle id') + then: 'deleting from the cmhandle cache returns null' + assert alternateIdPerCmHandle.remove('non-cached cmhandle id') == null + and: 'removal from the alternate id cache is skipped' + 0 * cmHandlePerAlternateId.remove(_) + } + def 'Cannot update existing alternate id.'() { given: 'attempt to update an existing alternate id' - objectUnderTest.addMapping('my cmhandle id', 'other id') + objectUnderTest.addMapping('cached cmhandle id', 'other id') expect: 'still returns the original alternate id' - assert objectUnderTest.cmHandleIdToAlternateId('my cmhandle id') == 'my alternate id' + assert objectUnderTest.cmHandleIdToAlternateId('cached cmhandle id') == 'cached alternate id' and: 'converting other alternate id returns null' assert objectUnderTest.alternateIdToCmHandleId('other id') == null and: 'a warning is logged with the original alternate id'