Merge "Patch # 3: Data operation response event (NCMP → Client App) to comply with...
[cps.git] / cps-ncmp-service / src / test / groovy / org / onap / cps / ncmp / api / inventory / CompositeStateSpec.groovy
index 0a6f8c3..7bdf335 100644 (file)
@@ -22,13 +22,12 @@ package org.onap.cps.ncmp.api.inventory
 
 import com.fasterxml.jackson.databind.ObjectMapper
 import spock.lang.Specification
-
 import java.time.OffsetDateTime
 import java.time.ZoneOffset
 import java.time.format.DateTimeFormatter
 
-import static CompositeState.DataStores
-import static CompositeState.Operational
+import static org.onap.cps.ncmp.api.inventory.CompositeState.DataStores
+import static org.onap.cps.ncmp.api.inventory.CompositeState.Operational
 import static org.onap.cps.ncmp.utils.TestUtils.getResourceFileContent
 import static org.springframework.util.StringUtils.trimAllWhitespace
 
@@ -41,20 +40,20 @@ class CompositeStateSpec extends Specification {
     def "Composite State Specification"() {
         given: "a Composite State"
             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: formattedDateAndTime.toString(),
                 dataSyncEnabled: false,
                 dataStores: dataStores())
         when: 'it is represented as JSON'
-            def jsonStateModelAsString = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(compositeState)
+            def resultJson = objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(compositeState)
         then: 'it matches expected state model as JSON'
-            def expectedStateModelAsjson = getResourceFileContent('expectedStateModel.json')
-            assert trimAllWhitespace(expectedStateModelAsjson) == trimAllWhitespace(jsonStateModelAsString)
+            def expectedJson = getResourceFileContent('expectedStateModel.json')
+            assert trimAllWhitespace(expectedJson) == trimAllWhitespace(resultJson)
     }
 
     def dataStores() {
         DataStores.builder().operationalDataStore(Operational.builder()
-            .syncState(SyncState.NONE_REQUESTED)
+            .dataStoreSyncState(DataStoreSyncState.NONE_REQUESTED)
             .lastSyncTime(formattedDateAndTime.toString()).build())
             .build()
     }