summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test/groovy/org
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2023-02-09 15:52:33 +0000
committerDaniel Hanrahan <daniel.hanrahan@est.tech>2023-02-09 16:26:52 +0000
commit105432686d7b840a0378fadcc32abb73976006bf (patch)
tree4c96ecca571bf1bccad9aae04c6339b06d2e3c67 /cps-ncmp-service/src/test/groovy/org
parentdb90c8758d43b1daab09c760a3fe3102d772d7df (diff)
Use getDataNodes (plural) in CmHandle deregistration
Issue-ID: CPS-1426 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I0ad79bf36840cdecc13898e185dc618cedafd529
Diffstat (limited to 'cps-ncmp-service/src/test/groovy/org')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy16
1 files changed, 7 insertions, 9 deletions
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 e8c53738ba..cf3454991a 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
}
}