summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImplSpec.groovy16
1 files changed, 16 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 a114b61e9..02cfb152c 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
@@ -25,6 +25,7 @@ package org.onap.cps.ncmp.api.impl
import org.onap.cps.ncmp.api.NetworkCmProxyCmHandlerQueryService
import org.onap.cps.ncmp.api.impl.event.lcm.LcmEventsCmHandleStateHandler
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
import org.onap.cps.ncmp.api.inventory.CompositeState
import org.onap.cps.ncmp.api.inventory.InventoryPersistence
@@ -63,6 +64,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
def mockDmiDataOperations = Mock(DmiDataOperations)
def nullNetworkCmProxyDataServicePropertyHandler = null
def mockInventoryPersistence = Mock(InventoryPersistence)
+ def mockCmHandleQueries = Mock(CmHandleQueries)
def mockDmiPluginRegistration = Mock(DmiPluginRegistration)
def mockCpsCmHandlerQueryService = Mock(NetworkCmProxyCmHandlerQueryService)
def mockLcmEventsCmHandleStateHandler = Mock(LcmEventsCmHandleStateHandler)
@@ -79,6 +81,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
mockDmiDataOperations,
nullNetworkCmProxyDataServicePropertyHandler,
mockInventoryPersistence,
+ mockCmHandleQueries,
mockCpsCmHandlerQueryService,
mockLcmEventsCmHandleStateHandler,
mockCpsDataService)
@@ -370,6 +373,19 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
0 * mockInventoryPersistence.saveCmHandleState(_, _)
}
+ def 'Get all cm handle IDs by DMI plugin identifier.' () {
+ given: 'cm handle queries service returns cm handles'
+ 1 * mockCmHandleQueries.getCmHandlesByDmiPluginIdentifier('some-dmi-plugin-identifier')
+ >> [new NcmpServiceCmHandle(cmHandleId: 'cm-handle-1'),
+ new NcmpServiceCmHandle(cmHandleId: 'cm-handle-2')]
+ when: 'cm handle Ids are requested with dmi plugin identifier'
+ def result = objectUnderTest.getAllCmHandleIdsByDmiPluginIdentifier('some-dmi-plugin-identifier')
+ then: 'the result size is correct'
+ assert result.size() == 2
+ and: 'the result returns the correct details'
+ assert result.containsAll('cm-handle-1','cm-handle-2')
+ }
+
def dataStores() {
CompositeState.DataStores.builder()
.operationalDataStore(CompositeState.Operational.builder()