aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test
diff options
context:
space:
mode:
authorPriyank Maheshwari <priyank.maheshwari@est.tech>2023-09-25 08:44:26 +0000
committerGerrit Code Review <gerrit@onap.org>2023-09-25 08:44:26 +0000
commita071c9c77f9d5b83cff6c85a1c54d7938f547717 (patch)
tree4bc8f80d1611898f3e7914027a54d372c6537efe /cps-ncmp-service/src/test
parent0af82141cb75a04a16248e17d4e915a580e82300 (diff)
parent04b5d9ef9145baa7d60ef9d6f70cf3736d9464c5 (diff)
Merge "Add DMI to TrustLevel Cache During Registration"
Diffstat (limited to 'cps-ncmp-service/src/test')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplRegistrationSpec.groovy14
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy5
2 files changed, 13 insertions, 6 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 8942c42f1..654377c7c 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
@@ -29,6 +29,7 @@ import org.onap.cps.ncmp.api.NetworkCmProxyCmHandleQueryService
import org.onap.cps.ncmp.api.impl.events.lcm.LcmEventsCmHandleStateHandler
import org.onap.cps.ncmp.api.impl.exception.DmiRequestException
import org.onap.cps.ncmp.api.impl.operations.DmiDataOperations
+import org.onap.cps.ncmp.api.impl.trustlevel.TrustLevel
import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle
import org.onap.cps.ncmp.api.inventory.CmHandleQueries
import org.onap.cps.ncmp.api.inventory.CmHandleState
@@ -65,6 +66,7 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification {
def mockLcmEventsCmHandleStateHandler = Mock(LcmEventsCmHandleStateHandler)
def mockCpsDataService = Mock(CpsDataService)
def mockModuleSyncStartedOnCmHandles = Mock(IMap<String, Object>)
+ def mockTrustLevelPerDmiPlugin = Mock(IMap<String, TrustLevel>)
def objectUnderTest = getObjectUnderTest()
def 'DMI Registration: Create, Update & Delete operations are processed in the right order'() {
@@ -119,11 +121,13 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification {
objectUnderTest.updateDmiRegistrationAndSyncModule(dmiPluginRegistration)
then: 'create cm handles registration and sync modules is called with the correct plugin information'
1 * objectUnderTest.parseAndCreateCmHandlesInDmiRegistrationAndSyncModules(dmiPluginRegistration)
+ and: 'dmi is added to the trustLevel map'
+ 1 * mockTrustLevelPerDmiPlugin.put(dmiPluginRegisteredName, TrustLevel.COMPLETE)
where:
- scenario | dmiPlugin | dmiModelPlugin | dmiDataPlugin
- 'combined DMI plugin' | 'service1' | '' | ''
- 'data & model DMI plugins' | '' | 'service1' | 'service2'
- 'data & model using same service' | '' | 'service1' | 'service1'
+ scenario | dmiPlugin | dmiModelPlugin | dmiDataPlugin | dmiPluginRegisteredName
+ 'combined DMI plugin' | 'service1' | '' | '' | 'service1'
+ 'data & model DMI plugins' | '' | 'service1' | 'service2' | 'service2'
+ 'data & model using same service' | '' | 'service1' | 'service1' | 'service1'
}
def 'Create CM-handle Validation: Invalid DMI plugin service name with #scenario'() {
@@ -376,7 +380,7 @@ class NetworkCmProxyDataServiceImplRegistrationSpec extends Specification {
return Spy(new NetworkCmProxyDataServiceImpl(spiedJsonObjectMapper, mockDmiDataOperations,
mockNetworkCmProxyDataServicePropertyHandler, mockInventoryPersistence, mockCmhandleQueries,
stubbedNetworkCmProxyCmHandlerQueryService, mockLcmEventsCmHandleStateHandler, mockCpsDataService,
- mockModuleSyncStartedOnCmHandles))
+ mockModuleSyncStartedOnCmHandles, mockTrustLevelPerDmiPlugin))
}
def addPersistedYangModelCmHandles(ids) {
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 cf5aae181..50fc30f78 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
@@ -26,6 +26,7 @@ package org.onap.cps.ncmp.api.impl
import com.hazelcast.map.IMap
import org.onap.cps.ncmp.api.NetworkCmProxyCmHandleQueryService
import org.onap.cps.ncmp.api.impl.events.lcm.LcmEventsCmHandleStateHandler
+import org.onap.cps.ncmp.api.impl.trustlevel.TrustLevel
import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle
import org.onap.cps.ncmp.api.inventory.CmHandleQueries
import org.onap.cps.ncmp.api.inventory.CmHandleState
@@ -72,6 +73,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
def mockCpsCmHandlerQueryService = Mock(NetworkCmProxyCmHandleQueryService)
def mockLcmEventsCmHandleStateHandler = Mock(LcmEventsCmHandleStateHandler)
def stubModuleSyncStartedOnCmHandles = Stub(IMap<String, Object>)
+ def stubTrustLevelPerDmiPlugin = Stub(IMap<String, TrustLevel>)
def NO_TOPIC = null
def NO_REQUEST_ID = null
@@ -89,7 +91,8 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
mockCpsCmHandlerQueryService,
mockLcmEventsCmHandleStateHandler,
mockCpsDataService,
- stubModuleSyncStartedOnCmHandles)
+ stubModuleSyncStartedOnCmHandles,
+ stubTrustLevelPerDmiPlugin)
def cmHandleXPath = "/dmi-registry/cm-handles[@id='testCmHandle']"