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 / impl / events / lcm / LcmEventsCmHandleStateHandlerImplSpec.groovy
index f660be7..bfebc44 100644 (file)
@@ -39,7 +39,8 @@ class LcmEventsCmHandleStateHandlerImplSpec extends Specification {
     def mockLcmEventsCreator = Mock(LcmEventsCreator)
     def mockLcmEventsService = Mock(LcmEventsService)
 
-    def objectUnderTest = new LcmEventsCmHandleStateHandlerImpl(mockInventoryPersistence, mockLcmEventsCreator, mockLcmEventsService)
+    def lcmEventsCmHandleStateHandlerAsyncHelper = new LcmEventsCmHandleStateHandlerAsyncHelper(mockLcmEventsCreator, mockLcmEventsService)
+    def objectUnderTest = new LcmEventsCmHandleStateHandlerImpl(mockInventoryPersistence, lcmEventsCmHandleStateHandlerAsyncHelper)
 
     def cmHandleId = 'cmhandle-id-1'
     def compositeState
@@ -54,7 +55,7 @@ class LcmEventsCmHandleStateHandlerImplSpec extends Specification {
         then: 'state is saved using inventory persistence'
             expectedCallsToInventoryPersistence * mockInventoryPersistence.saveCmHandleState(cmHandleId, _)
         and: 'event service is called to publish event'
-            expectedCallsToEventService * mockLcmEventsService.publishLcmEvent(cmHandleId, _)
+            expectedCallsToEventService * mockLcmEventsService.publishLcmEvent(cmHandleId, _, _)
         where: 'state change parameters are provided'
             stateChange          | fromCmHandleState | toCmHandleState || expectedCallsToInventoryPersistence | expectedCallsToEventService
             'ADVISED to READY'   | ADVISED           | READY           || 1                                   | 1
@@ -73,7 +74,7 @@ class LcmEventsCmHandleStateHandlerImplSpec extends Specification {
         then: 'state is saved using inventory persistence'
             1 * mockInventoryPersistence.saveCmHandle(yangModelCmHandle)
         and: 'event service is called to publish event'
-            1 * mockLcmEventsService.publishLcmEvent(cmHandleId, _)
+            1 * mockLcmEventsService.publishLcmEvent(cmHandleId, _, _)
     }
 
     def 'Update and Publish Events on State Change from LOCKED to ADVISED'() {
@@ -90,7 +91,7 @@ class LcmEventsCmHandleStateHandlerImplSpec extends Specification {
                 }
             }
         and: 'event service is called to publish event'
-            1 * mockLcmEventsService.publishLcmEvent(cmHandleId, _)
+            1 * mockLcmEventsService.publishLcmEvent(cmHandleId, _, _)
     }
 
     def 'Update and Publish Events on State Change to READY'() {
@@ -111,7 +112,7 @@ class LcmEventsCmHandleStateHandlerImplSpec extends Specification {
                 }
             }
         and: 'event service is called to publish event'
-            1 * mockLcmEventsService.publishLcmEvent(cmHandleId, _)
+            1 * mockLcmEventsService.publishLcmEvent(cmHandleId, _, _)
     }
 
     def 'Update cmHandle state to "DELETING"' (){
@@ -125,7 +126,7 @@ class LcmEventsCmHandleStateHandlerImplSpec extends Specification {
         and: 'method to persist cm handle state is called once'
             1 * mockInventoryPersistence.saveCmHandleState(yangModelCmHandle.getId(), yangModelCmHandle.getCompositeState())
         and: 'the method to publish Lcm event is called once'
-            1 * mockLcmEventsService.publishLcmEvent(cmHandleId, _)
+            1 * mockLcmEventsService.publishLcmEvent(cmHandleId, _, _)
     }
 
     def 'Update cmHandle state to "DELETED"' (){
@@ -137,7 +138,7 @@ class LcmEventsCmHandleStateHandlerImplSpec extends Specification {
         then: 'the cm handle state is as expected'
             yangModelCmHandle.getCompositeState().getCmHandleState() == DELETED
         and: 'the method to publish Lcm event is called once'
-            1 * mockLcmEventsService.publishLcmEvent(cmHandleId, _)
+            1 * mockLcmEventsService.publishLcmEvent(cmHandleId, _, _)
     }
 
     def 'No state change and no event to be published'() {
@@ -167,7 +168,7 @@ class LcmEventsCmHandleStateHandlerImplSpec extends Specification {
                 }
             }
         and: 'event service is called to publish event'
-            2 * mockLcmEventsService.publishLcmEvent(_, _)
+            2 * mockLcmEventsService.publishLcmEvent(_, _, _)
 
     }
 
@@ -183,7 +184,7 @@ class LcmEventsCmHandleStateHandlerImplSpec extends Specification {
                 }
             }
         and: 'event service is called to publish event'
-            2 * mockLcmEventsService.publishLcmEvent(_, _)
+            2 * mockLcmEventsService.publishLcmEvent(_, _, _)
 
     }