summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test/groovy/org/onap
diff options
context:
space:
mode:
authorniamhcore <niamh.core@est.tech>2021-08-24 16:07:51 +0100
committerniamhcore <niamh.core@est.tech>2021-08-25 13:10:55 +0100
commit3b3f509d9fb044e78bb63e6a0ff5935a1243d238 (patch)
tree225e6533a058baf23263431ff56b5372b858b7b6 /cps-ncmp-service/src/test/groovy/org/onap
parent5aba6667d330835fa3661ffba0d88f88029da446 (diff)
Fix exception when registration has no additionProperties
Issue-ID: CPS-587 Signed-off-by: niamhcore <niamh.core@est.tech> Change-Id: Ic65b274e66cc7b2967826045a5da43ef2ee888f5
Diffstat (limited to 'cps-ncmp-service/src/test/groovy/org/onap')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy15
1 files changed, 15 insertions, 0 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
index f356ce66c1..34c9541759 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
@@ -131,6 +131,21 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
'create and update' | [persistenceCmHandle ] | [persistenceCmHandle ] || 1 | 1
}
+
+ def 'Register a DMI Plugin for the given cmHandle without additional properties.'() {
+ given: 'a registration without cmHandle properties '
+ def dmiPluginRegistration = new DmiPluginRegistration()
+ dmiPluginRegistration.dmiPlugin = 'my-server'
+ persistenceCmHandle.cmHandleID = '123'
+ persistenceCmHandle.cmHandleProperties = null
+ dmiPluginRegistration.createdCmHandles = [persistenceCmHandle ]
+ def expectedJsonData = '{"cm-handles":[{"id":"123","dmi-service-name":"my-server","additional-properties":[]}]}'
+ when: 'registration is updated'
+ objectUnderTest.updateDmiPluginRegistration(dmiPluginRegistration)
+ then: 'the CPS save list node data is invoked with the expected parameters'
+ 1 * mockCpsDataService.saveListNodeData('NCMP-Admin', 'ncmp-dmi-registry', '/dmi-registry', expectedJsonData)
+ }
+
def 'Get resource data for pass-through operational from dmi.'() {
given: 'xpath'
def xpath = "/dmi-registry/cm-handles[@id='testCmHandle']"