From 105432686d7b840a0378fadcc32abb73976006bf Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Thu, 9 Feb 2023 15:52:33 +0000 Subject: Use getDataNodes (plural) in CmHandle deregistration Issue-ID: CPS-1426 Signed-off-by: danielhanrahan Change-Id: I0ad79bf36840cdecc13898e185dc618cedafd529 --- .../NetworkCmProxyDataServiceImplRegistrationSpec.groovy | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'cps-ncmp-service/src/test/groovy/org/onap') diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy index e8c53738b..cf3454991 100644 --- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy +++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy @@ -74,8 +74,8 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification { dmiRegistration.setCreatedCmHandles([new NcmpServiceCmHandle(cmHandleId: 'cmhandle-1', publicProperties: ['publicProp1': 'value'], dmiProperties: [:])]) dmiRegistration.setUpdatedCmHandles([new NcmpServiceCmHandle(cmHandleId: 'cmhandle-2', publicProperties: ['publicProp1': 'value'], dmiProperties: [:])]) dmiRegistration.setRemovedCmHandles(['cmhandle-2']) - and: 'any cm handle is persisted' - mockInventoryPersistence.getYangModelCmHandle(_) >> new YangModelCmHandle() + and: 'cm handles are persisted' + mockInventoryPersistence.getYangModelCmHandles(['cmhandle-2']) >> [new YangModelCmHandle()] when: 'registration is processed' objectUnderTest.updateDmiRegistrationAndSyncModule(dmiRegistration) then: 'cm-handles are removed first' @@ -245,7 +245,7 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification { def 'Remove CmHandle Successfully: #scenario'() { given: 'a registration' - mockInventoryPersistence.getYangModelCmHandle(_) >> new YangModelCmHandle() + addPersistedYangModelCmHandles(['cmhandle']) def dmiPluginRegistration = new DmiPluginRegistration(dmiPlugin: 'my-server', removedCmHandles: ['cmhandle']) and: '#scenario' @@ -319,7 +319,7 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification { def 'Remove CmHandle Error Handling: Schema Set Deletion failed'() { given: 'a registration' - mockInventoryPersistence.getYangModelCmHandle('cmhandle') >> new YangModelCmHandle() + addPersistedYangModelCmHandles(['cmhandle']) def dmiPluginRegistration = new DmiPluginRegistration(dmiPlugin: 'my-server', removedCmHandles: ['cmhandle']) and: 'schema set deletion failed with unknown error' @@ -344,7 +344,7 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification { def 'Remove CmHandle Error Handling: #scenario'() { given: 'a registration' - mockInventoryPersistence.getYangModelCmHandle('cmhandle') >> new YangModelCmHandle() + addPersistedYangModelCmHandles(['cmhandle']) def dmiPluginRegistration = new DmiPluginRegistration(dmiPlugin: 'my-server', removedCmHandles: ['cmhandle']) and: 'cm-handle deletion fails on batch' @@ -378,9 +378,7 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification { } def addPersistedYangModelCmHandles(ids) { - ids.each { - def yangModelCmHandle = new YangModelCmHandle(id:it) - mockInventoryPersistence.getYangModelCmHandle(it) >> yangModelCmHandle - } + def yangModelCmHandles = ids.collect { new YangModelCmHandle(id:it) } + mockInventoryPersistence.getYangModelCmHandles(ids) >> yangModelCmHandles } } -- cgit 1.2.3-korg