Simplified 'External' lock reason Mapping
[cps.git] / cps-ncmp-service / src / test / groovy / org / onap / cps / ncmp / api / impl / NetworkCmProxyDataServiceImplSpec.groovy
index 48c28a8..0871a89 100644 (file)
@@ -28,7 +28,7 @@ import org.onap.cps.ncmp.api.inventory.CmHandleState
 import org.onap.cps.ncmp.api.inventory.CompositeState
 import org.onap.cps.ncmp.api.inventory.InventoryPersistence
 import org.onap.cps.ncmp.api.inventory.LockReasonCategory
-import org.onap.cps.ncmp.api.inventory.SyncState
+import org.onap.cps.ncmp.api.inventory.DataStoreSyncState
 import org.onap.cps.ncmp.api.models.CmHandleQueryApiParameters
 import org.onap.cps.ncmp.api.models.ConditionApiProperties
 import org.onap.cps.ncmp.api.models.DmiPluginRegistration
@@ -168,7 +168,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
         given: 'the system returns a yang modelled cm handle'
             def dmiServiceName = 'some service name'
             def compositeState = new CompositeState(cmHandleState: CmHandleState.ADVISED,
-                lockReason: CompositeState.LockReason.builder().lockReasonCategory(LockReasonCategory.LOCKED_MISBEHAVING).details("lock misbehaving details").build(),
+                lockReason: CompositeState.LockReason.builder().lockReasonCategory(LockReasonCategory.LOCKED_MODULE_SYNC_FAILED).details("lock details").build(),
                 lastUpdateTime: 'some-timestamp',
                 dataSyncEnabled: false,
                 dataStores: dataStores())
@@ -226,7 +226,7 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
     def 'Get cm handle composite state'() {
         given: 'a yang modelled cm handle'
             def compositeState = new CompositeState(cmHandleState: CmHandleState.ADVISED,
-                lockReason: CompositeState.LockReason.builder().lockReasonCategory(LockReasonCategory.LOCKED_MISBEHAVING).details("lock misbehaving details").build(),
+                lockReason: CompositeState.LockReason.builder().lockReasonCategory(LockReasonCategory.LOCKED_MODULE_SYNC_FAILED).details("lock details").build(),
                 lastUpdateTime: 'some-timestamp',
                 dataSyncEnabled: false,
                 dataStores: dataStores())
@@ -297,10 +297,18 @@ class NetworkCmProxyDataServiceImplSpec extends Specification {
             assert result == ['cm-handle-id-1'] as Set
     }
 
+    def 'Getting module definitions.'() {
+        when: 'get module definitions method is called with a valid cm handle ID'
+            objectUnderTest.getModuleDefinitionsByCmHandleId('some-cm-handle')
+        then: 'CPS module services is invoked once'
+            1 * mockInventoryPersistence.getModuleDefinitionsByCmHandleId('some-cm-handle')
+    }
+
+
     def dataStores() {
         CompositeState.DataStores.builder()
                 .operationalDataStore(CompositeState.Operational.builder()
-                        .syncState(SyncState.NONE_REQUESTED)
+                        .dataStoreSyncState(DataStoreSyncState.NONE_REQUESTED)
                         .lastSyncTime('some-timestamp').build()).build()
     }