summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncSpec.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncSpec.groovy')
-rw-r--r--cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncSpec.groovy24
1 files changed, 17 insertions, 7 deletions
diff --git a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncSpec.groovy b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncSpec.groovy
index bcc6bb467..0a06fbaa8 100644
--- a/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncSpec.groovy
+++ b/cps-ncmp-service/src/test/groovy/org/onap/cps/ncmp/api/inventory/sync/ModuleSyncSpec.groovy
@@ -22,25 +22,35 @@ package org.onap.cps.ncmp.api.inventory.sync
import org.onap.cps.ncmp.api.impl.yangmodels.YangModelCmHandle
+import org.onap.cps.ncmp.api.inventory.CmHandleState
import spock.lang.Specification
class ModuleSyncSpec extends Specification {
def mockSyncUtils = Mock(SyncUtils)
- def objectUnderTest = new ModuleSyncWatchdog(mockSyncUtils)
+ def mockModuleSyncService = Mock(ModuleSyncService)
+
+ def cmHandleState = CmHandleState.ADVISED
+
+ def objectUnderTest = new ModuleSyncWatchdog(mockSyncUtils, mockModuleSyncService)
def 'Schedule a Cm-Handle Sync for ADVISED Cm-Handles'() {
- given: 'a cm handle'
- def yangModelCmHandle1 = new YangModelCmHandle()
- def yangModelCmHandle2 = new YangModelCmHandle()
+ given: 'cm handles in an advised state'
+ def yangModelCmHandle1 = new YangModelCmHandle(cmHandleState: cmHandleState)
+ def yangModelCmHandle2 = new YangModelCmHandle(cmHandleState: cmHandleState)
and: 'sync utilities return a cm handle twice'
mockSyncUtils.getAnAdvisedCmHandle() >>> [yangModelCmHandle1, yangModelCmHandle2, null]
when: 'module sync poll is executed'
objectUnderTest.executeAdvisedCmHandlePoll()
- then: 'each cm handle is updated to state "READY"'
- 1 * mockSyncUtils.updateCmHandleState(yangModelCmHandle1, 'READY')
- 1 * mockSyncUtils.updateCmHandleState(yangModelCmHandle2, 'READY')
+ then: 'module sync service syncs the first cm handle and creates a schema set'
+ 1 * mockModuleSyncService.syncAndCreateSchemaSet(yangModelCmHandle1)
+ and: 'the first cm handle is updated to state "READY" from "ADVISED"'
+ 1 * mockSyncUtils.updateCmHandleState(yangModelCmHandle1, CmHandleState.READY)
+ then: 'module sync service syncs the second cm handle and creates a schema set'
+ 1 * mockModuleSyncService.syncAndCreateSchemaSet(yangModelCmHandle2)
+ then: 'the second cm handle is updated to state "READY" from "ADVISED"'
+ 1 * mockSyncUtils.updateCmHandleState(yangModelCmHandle2, CmHandleState.READY)
}
}