diff options
author | JosephKeenan <joseph.keenan@est.tech> | 2021-11-23 12:18:28 +0000 |
---|---|---|
committer | JosephKeenan <joseph.keenan@est.tech> | 2021-11-25 15:40:10 +0000 |
commit | 20b4f9cf0b662de4a7665b2a82593ef0205f5e06 (patch) | |
tree | ab849ff17b861f246c328e421e8dcfc8ceb9e851 /cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy | |
parent | bc742a1dbe39a3269abab9e62a9d489f460144b0 (diff) |
Allow separate registration of DMIDataPlugin and DmiModelPugin
Moved relevant code from NetworkCmProxyDataServiceImp to DmiOperations
Split DmiOperations into DMiData... and DMIModelOperations
Merged update-operation changes
Added tests for error message validation in NetworkCmProxyDataServiceImplSpec
Removede @Service from DMIOperations and added @component to
DmiDataOperations & DmiModelOperations
Verify sync robot test is now hardened
Added exitonfailure so robot tests stop after first encountered failed
test
Issue-ID: CPS-736
Change-Id: I0b40931cc8cd4fc0452328a0a7e0f60e6fc38d0a
Signed-off-by: JosephKeenan <joseph.keenan@est.tech>
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
Signed-off-by: DylanB95EST <dylan.byrne@est.tech>
Diffstat (limited to 'cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy')
-rw-r--r-- | cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy index e558ac45b..4addf7bdf 100644 --- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy +++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/controller/NetworkCmProxyInventoryControllerSpec.groovy @@ -22,6 +22,10 @@ package org.onap.cps.ncmp.rest.controller import com.fasterxml.jackson.databind.ObjectMapper import org.onap.cps.TestUtils import org.onap.cps.ncmp.api.NetworkCmProxyDataService +import org.onap.cps.ncmp.api.impl.NetworkCmProxyDataServiceImpl +import org.onap.cps.ncmp.api.models.CmHandle +import org.onap.cps.ncmp.api.models.DmiPluginRegistration +import org.onap.cps.ncmp.api.models.PersistenceCmHandle import org.spockframework.spring.SpringBean import org.springframework.beans.factory.annotation.Autowired import org.springframework.beans.factory.annotation.Value @@ -61,5 +65,28 @@ class NetworkCmProxyInventoryControllerSpec extends Specification { response.status == HttpStatus.CREATED.value() } + def 'Dmi plugin registration with #scenario' () { + given: 'jsonData, cmHandle, & DmiPluginRegistration' + def jsonData = TestUtils.getResourceFileContent('dmi_registration_combined_valid.json' ) + def cmHandle = new CmHandle(cmHandleID : 'example-name') + def expectedDmiPluginRegistration = new DmiPluginRegistration( + dmiPlugin: 'service1', + dmiDataPlugin: '', + dmiModelPlugin: '', + createdCmHandles: [cmHandle]) + when: 'post request is performed & registration is called with correct DMI plugin information' + def response = mvc.perform( + post("$ncmpBasePathV1/ch") + .contentType(MediaType.APPLICATION_JSON) + .content(jsonData) + ).andReturn().response + then: 'no NcmpException is thrown & updateDmiRegistrationAndSyncModule is called with correct parameters' + 1 * mockNetworkCmProxyDataService.updateDmiRegistrationAndSyncModule({ + it.getDmiPlugin() == expectedDmiPluginRegistration.getDmiPlugin() + it.getDmiDataPlugin() == expectedDmiPluginRegistration.getDmiDataPlugin() + it.getDmiModelPlugin() == expectedDmiPluginRegistration.getDmiModelPlugin() + it.getCreatedCmHandles().get(0).getCmHandleID() == expectedDmiPluginRegistration.getCreatedCmHandles().get(0).getCmHandleID() + }) + } } |