From 3b3f509d9fb044e78bb63e6a0ff5935a1243d238 Mon Sep 17 00:00:00 2001 From: niamhcore Date: Tue, 24 Aug 2021 16:07:51 +0100 Subject: Fix exception when registration has no additionProperties Issue-ID: CPS-587 Signed-off-by: niamhcore Change-Id: Ic65b274e66cc7b2967826045a5da43ef2ee888f5 --- .../api/impl/NetworkCmProxyDataServiceImplSpec.groovy | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'cps-ncmp-service/src/test/groovy') 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 f356ce66c..34c954175 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']" -- cgit 1.2.3-korg