package Ġio . hol unda . camunda . task pool . view . mongo . service Ċ Ċ import Ġcom . t ng tech . j given . integration . spring . Spring Rule Scenario Test Ċ import Ġio . hol unda . camunda . task pool . api . business . Correlation Map Ċ import Ġio . hol unda . camunda . task pool . api . task .* Ċ import Ġio . hol unda . camunda . task pool . view . Data Entry Ċ import Ġio . hol unda . camunda . task pool . view . Task Ċ import Ġio . hol unda . camunda . task pool . view . Task WithData Entries Ċ import Ġio . hol unda . camunda . task pool . view . auth . User Ċ import Ġio . hol unda . camunda . task pool . view . mongo . Task pool Mongo Test Application Ċ import Ġio . hol unda . camunda . task pool . view . mongo . utils . Mongo Launcher Ċ import Ġio . hol unda . camunda . task pool . view . query . task . Application With Task Count Ċ import Ġio . hol unda . camunda . task pool . view . query . task . Task Count By Application Query Ċ import Ġio . hol unda . camunda . task pool . view . query . task . Task QueryResult Ċ import Ġio . hol unda . camunda . task pool . view . query . task . Tasks ForUser Query Ċ import Ġio . hol unda . camunda . task pool . view . query . task . Tasks WithData Entries ForUser Query Ċ import Ġorg . camunda . bpm . engine . variable . Variable Map Ċ import Ġorg . camunda . bpm . engine . variable . Variables Ċ import Ġorg . junit .* Ċ import Ġorg . springframework . boot . test . context . SpringBootTest Ċ import Ġorg . springframework . test . annotation . Dir ties Context Ċ import Ġorg . springframework . test . context . Active Profiles Ċ import Ġorg . springframework . test . context . Test Property Source Ċ import Ġjava . util .* Ċ Ċ @ SpringBootTest ( classes Ġ= Ġ[ Task pool Mongo Test Application :: class ]) Ċ @ Dir ties Context ( class Mode Ġ= ĠD irt ies Context . Class Mode . AFTER _ EACH _ TEST _ METHOD ) Ċ abstract Ġclass ĠTask Pool Mongo Service ITest Base Ġ: ĠSpring Rule Scenario Test < Task Pool Given Stage <* >, ĠTask Pool When Stage <* >, ĠTask Pool Then Stage <* >>() Ġ{ ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` a Ġtask Ġis Ġcreated Ġon Ġreceiving ĠTask Created Engine Event `() Ġ{ ĊĊĠĠĠ Ġval ĠtestData Ġ= ĠTest Task Data ( id Ġ= Ġ" some - id ", Ġassign ee Ġ= Ġ" ker mit ") ĊĠĠĠ Ġval Ġexpected Ġ= ĠtestData . as Task () ĊĊĠĠĠ Ġgiven () ĊĠĠĠĠĠ Ġ. no _ task _ exists () ĊĊĠĠĠ Ġ` when `() ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( testData . as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. time _ passes _ until _ query _ update _ is _ emit ted () ĊĊĠĠĠ Ġthen () ĊĠĠĠĠĠ Ġ. task _ is _ created ( expected ) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. tasks _ visible _ to _ assign ee _ or _ candidate _ user (" ker mit ", ĠlistOf ( expected )) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. tasks _ visible _ to _ assign ee _ or _ candidate _ user (" pig gy ", ĠlistOf ( expected )) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. tasks _ visible _ to _ candidate _ group (" m uppet show ", ĠlistOf ( expected )) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. query _ updates _ have _ been _ emit ted ( Tasks ForUser Query ( User (" ker mit ", Ġset Of (" m uppet show ")) ), Ġexpected ) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. query _ updates _ have _ been _ emit ted ( Tasks WithData Entries ForUser Query ( User (" ker mit ", Ġset Of (" m uppet show ")) ), Ġexpected . with Data Entries ()) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` a Ġtask Ġis Ġassigned Ġon Ġreceiving ĠTask Assigned Engine Event `() Ġ{ ĊĠĠĠ Ġgiven () ĊĠĠĠĠĠ Ġ. no _ task _ exists () ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id "). as Task Created Engine Event ()) ĊĊĠĠĠ Ġ` when `() ĊĠĠĠĠĠ Ġ. task _ assign _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id ", Ġassign ee Ġ= Ġ" ker mit "). as Task Assigned Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. time _ passes _ until _ query _ update _ is _ emit ted () ĊĊĠĠĠ Ġthen () ĊĠĠĠĠĠ Ġ. task _ is _ assigned _ to (" some - id ", Ġ" ker mit ") ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ is _ created ( Test Task Data ( id Ġ= Ġ" some - id ", Ġassign ee Ġ= Ġ" ker mit "). as Task ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. query _ updates _ have _ been _ emit ted ( Tasks ForUser Query ( User (" ker mit ", Ġset Of (" m uppet show ")) ), ĠTest Task Data ( id Ġ= Ġ" some - id ", Ġassign ee Ġ= Ġ" ker mit "). as Task ()) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` do Ġnot Ġlose Ġtask Ġdata Ġby Ġtask Ġassignment `() Ġ{ ĊĠĠĠ Ġgiven () ĊĠĠĠĠĠ Ġ. no _ task _ exists () ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id "). as Task Created Engine Event ()) ĊĊĠĠĠ Ġ` when `() ĊĠĠĠĠĠ Ġ. task _ assign _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id ", Ġassign ee Ġ= Ġ" ker mit "). as Task Assigned Engine Event ()) ĊĊĠĠĠ Ġthen () ĊĠĠĠĠĠ Ġ. task _ payload _ matches (" some - id ", ĠVariables . from Map ( map Of ( Pair (" variable Key ", Ġ" variable Value ")) )) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ corre lations _ match (" some - id ", ĠVariables . from Map ( map Of ( Pair (" correlation Key ", Ġ" correlation Value ")) )) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` do Ġnot Ġlose Ġassign ee Ġby Ġtask Ġattribute Ġupdate `() Ġ{ ĊĠĠĠ Ġgiven () ĊĠĠĠĠĠ Ġ. no _ task _ exists () ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id "). as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ assign _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id ", Ġassign ee Ġ= Ġ" ker mit "). as Task Assigned Engine Event ()) ĊĊĠĠĠ Ġ` when `() ĊĠĠĠĠĠ Ġ. task _ attributes _ update _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id ", Ġfollow Up Date Ġ= ĠDate ( 1 2 3 4 6 9 9 9 9 9 L )). as Task Attribute Updated Event ()) ĊĊĠĠĠ Ġthen () ĊĠĠĠĠĠ Ġ. task _ is _ assigned _ to (" some - id ", Ġ" ker mit ") ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` a Ġnon - existing Ġtask Ġis Ġnot Ġassigned `() Ġ{ ĊĠĠĠ Ġgiven () ĊĠĠĠĠĠ Ġ. no _ task _ exists () ĊĊĠĠĠ Ġ` when `() ĊĠĠĠĠĠ Ġ. task _ assign _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id ", Ġassign ee Ġ= Ġ" ker mit "). as Task Assigned Engine Event ()) ĊĊĠĠĠ Ġthen () ĊĠĠĠĠĠ Ġ. task _ is _ assigned _ to (" some - id ", Ġnull ) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. no _ query _ update _ has _ been _ emit ted () ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` candidate Ġgroups Ġare Ġupdated `() Ġ{ ĊĠĠĠ Ġval Ġtest Task Data Ġ= ĠTest Task Data ( id Ġ= Ġ" some - id ", Ġcandidate Groups Ġ= Ġset Of (" m uppet show ")) ĊĊĠĠĠ Ġgiven () ĊĠĠĠĠĠ Ġ. no _ task _ exists () ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( test Task Data . as Task Created Engine Event ()) ĊĊĠĠĠ Ġ` when `() ĊĠĠĠĠĠ Ġ. task _ candidate _ group _ changed _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id "). as Candidate Group Changed Event (" m uppet show ", ĠCam unda Task Event . C AND ID ATE _ GROUP _ DELETE )) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. time _ passes _ until _ query _ update _ is _ emit ted () ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ candidate _ group _ changed _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id "). as Candidate Group Changed Event (" simp son s ", ĠCam unda Task Event . C AND ID ATE _ GROUP _ ADD )) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. time _ passes _ until _ query _ update _ is _ emit ted () ĊĊĠĠĠ Ġthen () ĊĠĠĠĠĠ Ġ. task _ has _ candidate _ groups (" some - id ", Ġset Of (" simp son s ")) ĊĠĠĠĠĠ Ġ// ĠTODO : ĠHow Ġto Ġget Ġupdates Ġwhen Ġa Ġtask Ġ_ was _ Ġbut Ġis Ġno Ġlonger Ġrelevant Ġfor Ġa Ġquery ? Ċ // ĠĠĠĠĠ Ġ. and () Ċ // ĠĠĠĠĠ Ġ. query _ updates _ have _ been _ emit ted ( Tasks ForUser Query ( User (" gon zo ", Ġset Of (" m uppet show ")) ), Ġtest Task Data . as Task (). copy ( candidate Groups Ġ= Ġset Of (" simp son s "))) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. query _ updates _ have _ been _ emit ted ( Tasks ForUser Query ( User (" l isa ", Ġset Of (" simp son s ")) ), Ġtest Task Data . as Task (). copy ( candidate Groups Ġ= Ġset Of (" simp son s "))) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` candidate Ġusers Ġare Ġupdated `() Ġ{ ĊĠĠĠ Ġgiven () ĊĠĠĠĠĠ Ġ. no _ task _ exists () ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id ", Ġcandidate Users Ġ= Ġset Of (" ker mit ")). as Task Created Engine Event ()) ĊĊĠĠĠ Ġ` when `() ĊĠĠĠĠĠ Ġ. task _ candidate _ user _ changed _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id "). as Candidate User Changed Event (" ker mit ", ĠCam unda Task Event . C AND ID ATE _ USER _ DELETE )) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. time _ passes _ until _ query _ update _ is _ emit ted () ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ candidate _ user _ changed _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id "). as Candidate User Changed Event (" gon zo ", ĠCam unda Task Event . C AND ID ATE _ USER _ ADD )) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. time _ passes _ until _ query _ update _ is _ emit ted () ĊĊĠĠĠ Ġthen () ĊĠĠĠĠĠ Ġ. task _ has _ candidate _ users (" some - id ", Ġset Of (" gon zo ")) ĊĠĠĠĠĠ Ġ// ĠTODO : ĠHow Ġto Ġget Ġupdates Ġwhen Ġa Ġtask Ġ_ was _ Ġbut Ġis Ġno Ġlonger Ġrelevant Ġfor Ġa Ġquery ? Ċ // ĠĠĠĠĠ Ġ. and () Ċ // ĠĠĠĠĠ Ġ. query _ updates _ have _ been _ emit ted ( Tasks ForUser Query ( ker mit ), ĠTest Task Data ( id Ġ= Ġ" some - id ", Ġcandidate Users Ġ= Ġset Of (" gon zo ")). as Task ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. query _ updates _ have _ been _ emit ted ( Tasks ForUser Query ( User (" gon zo ", Ġset Of (" m uppe ts ")) ), ĠTest Task Data ( id Ġ= Ġ" some - id ", Ġcandidate Users Ġ= Ġset Of (" gon zo ")). as Task ()) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` task Ġis Ġdeleted `() Ġ{ ĊĠĠĠ Ġgiven () ĊĠĠĠĠĠ Ġ. no _ task _ exists () ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id "). as Task Created Engine Event ()) ĊĊĠĠĠ Ġ` when `() ĊĠĠĠĠĠ Ġ. task _ deleted _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id "). as Task Deleted Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. time _ passes _ until _ query _ update _ is _ emit ted () ĊĊĠĠĠ Ġthen () ĊĠĠĠĠĠ Ġ. task _ does _ not _ exist (" some - id ") ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. query _ updates _ have _ been _ emit ted ( Tasks ForUser Query ( User (" ker mit ", Ġset Of (" m uppet show ")) ), ĠTest Task Data ( id Ġ= Ġ" some - id ", Ġdeleted Ġ= Ġtrue ). as Task ()) ĊĠ Ġ} ĊĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` task Ġis Ġvisible Ġonly Ġfor Ġassigned Ġuser `() Ġ{ ĊĠĠĠ Ġgiven () ĊĠĠĠĠĠ Ġ. no _ task _ exists () ĊĊĠĠĠ Ġ` when `() ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id ", Ġassign ee Ġ= Ġ" ker mit ", Ġcandidate Users Ġ= Ġset Of ()). as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id - 2 ", Ġassign ee Ġ= Ġ" ker mit ", Ġcandidate Users Ġ= Ġset Of ()). as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - other - id ", Ġassign ee Ġ= Ġ" pig gy ", Ġcandidate Users Ġ= Ġset Of ()). as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - other - id - 2 ", Ġassign ee Ġ= Ġ" pig gy ", Ġcandidate Users Ġ= Ġset Of ()). as Task Created Engine Event ()) ĊĊĠĠĠ Ġthen () ĊĠĠĠĠĠ Ġ. tasks _ with _ payload _ are _ visible _ to ( User (" ker mit ", Ġset Of ()), Ġ" some - id ", Ġ" some - id - 2 ") ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. tasks _ with _ payload _ are _ visible _ to ( User (" pig gy ", Ġset Of ()), Ġ" some - other - id ", Ġ" some - other - id - 2 ") ĊĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` task Ġis Ġvisible Ġonly Ġfor Ġcandidate Ġuser `() Ġ{ ĊĠĠĠ Ġgiven () ĊĠĠĠĠĠ Ġ. no _ task _ exists () ĊĊĠĠĠ Ġ` when `() ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id ", Ġassign ee Ġ= Ġnull , Ġcandidate Users Ġ= Ġset Of (" ker mit ", Ġ" gon zo ")). as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id - 2 ", Ġassign ee Ġ= Ġnull , Ġcandidate Users Ġ= Ġset Of (" ker mit ")). as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - other - id ", Ġassign ee Ġ= Ġnull , Ġcandidate Users Ġ= Ġset Of (" pig gy ")). as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - other - id - 2 ", Ġassign ee Ġ= Ġnull , Ġcandidate Users Ġ= Ġset Of (" pig gy ")). as Task Created Engine Event ()) ĊĊĠĠĠ Ġthen () ĊĠĠĠĠĠ Ġ. tasks _ with _ payload _ are _ visible _ to ( User (" ker mit ", Ġset Of ()), Ġ" some - id ", Ġ" some - id - 2 ") ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. tasks _ with _ payload _ are _ visible _ to ( User (" pig gy ", Ġset Of ()), Ġ" some - other - id ", Ġ" some - other - id - 2 ") ĊĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` task Ġis Ġvisible Ġonly Ġfor Ġcandidate Ġgroup `() Ġ{ ĊĠĠĠ Ġgiven () ĊĠĠĠĠĠ Ġ. no _ task _ exists () ĊĊĠĠĠ Ġ` when `() ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id ", Ġassign ee Ġ= Ġnull , Ġcandidate Users Ġ= Ġset Of (), Ġcandidate Groups Ġ= Ġset Of (" one ")). as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - id - 2 ", Ġassign ee Ġ= Ġnull , Ġcandidate Users Ġ= Ġset Of (), Ġcandidate Groups Ġ= Ġset Of (" one ")). as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - other - id ", Ġassign ee Ġ= Ġnull , Ġcandidate Users Ġ= Ġset Of (), Ġcandidate Groups Ġ= Ġset Of (" two ")). as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" some - other - id - 2 ", Ġassign ee Ġ= Ġnull , Ġcandidate Users Ġ= Ġset Of (), Ġcandidate Groups Ġ= Ġset Of (" two ", Ġ" baz ")). as Task Created Engine Event ()) ĊĊĠĠĠ Ġthen () ĊĠĠĠĠĠ Ġ. tasks _ with _ payload _ are _ visible _ to ( User (" ker mit ", Ġset Of (" one ", Ġ" bar ")), Ġ" some - id ", Ġ" some - id - 2 ") ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. tasks _ with _ payload _ are _ visible _ to ( User (" pig gy ", Ġset Of (" two ", Ġ" zet ")), Ġ" some - other - id ", Ġ" some - other - id - 2 ") ĊĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` tasks Ġare Ġcounted Ġby Ġapplication Ġname `() Ġ{ ĊĠĠĠ Ġgiven () ĊĠĠĠĠĠ Ġ. no _ task _ exists () ĊĊĠĠĠ Ġ` when `() ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" task - 1 ", Ġsource Reference Ġ= Ġprocess Reference ( application Name Ġ= Ġ" app - 1 ")). as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. time _ passes _ until _ query _ update _ is _ emit ted ( Task Count By Application Query :: class . java ) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" task - 2 ", Ġsource Reference Ġ= Ġprocess Reference ( application Name Ġ= Ġ" app - 2 ")). as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. time _ passes _ until _ query _ update _ is _ emit ted ( Task Count By Application Query :: class . java ) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" task - 3 ", Ġsource Reference Ġ= Ġprocess Reference ( application Name Ġ= Ġ" app - 1 ")). as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. time _ passes _ until _ query _ update _ is _ emit ted ( Task Count By Application Query :: class . java ) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" task - 4 ", Ġsource Reference Ġ= Ġprocess Reference ( application Name Ġ= Ġ" app - 2 ")). as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. time _ passes _ until _ query _ update _ is _ emit ted ( Task Count By Application Query :: class . java ) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ deleted _ event _ is _ received ( Test Task Data ( id Ġ= Ġ" task - 4 ", Ġsource Reference Ġ= Ġprocess Reference ( application Name Ġ= Ġ" app - 2 ")). as Task Deleted Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. time _ passes _ until _ query _ update _ is _ emit ted ( Task Count By Application Query :: class . java ) ĊĊĠĠĠ Ġthen () ĊĠĠĠĠĠ Ġ. task _ counts _ per _ application _ are ( Application With Task Count (" app - 1 ", Ġ 2 ), ĠApplication With Task Count (" app - 2 ", Ġ 1 )) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. query _ updates _ have _ been _ emit ted ( ĊĠĠĠĠĠĠĠ ĠTask Count By Application Query (), ĊĠĠĠĠĠĠĠ ĠApplication With Task Count (" app - 1 ", Ġ 1 ), ĊĠĠĠĠĠĠĠ ĠApplication With Task Count (" app - 2 ", Ġ 1 ), ĊĠĠĠĠĠĠĠ ĠApplication With Task Count (" app - 1 ", Ġ 2 ), ĊĠĠĠĠĠĠĠ ĠApplication With Task Count (" app - 2 ", Ġ 2 ), ĊĠĠĠĠĠĠĠ ĠApplication With Task Count (" app - 2 ", Ġ 1 ) ĊĠĠĠĠĠ Ġ) ĊĠ Ġ} ĊĊĠ Ġ@ Test ĊĠ Ġfun Ġ` tasks Ġare Ġreturned Ġfor Ġapplication Ġname `() Ġ{ ĊĠĠĠ Ġval Ġtask 1 Ġ= ĠTest Task Data ( id Ġ= Ġ" task - 1 ", Ġsource Reference Ġ= Ġprocess Reference ( application Name Ġ= Ġ" app - 1 ")) ĊĠĠĠ Ġval Ġtask 2 Ġ= ĠTest Task Data ( id Ġ= Ġ" task - 2 ", Ġsource Reference Ġ= Ġprocess Reference ( application Name Ġ= Ġ" app - 2 ")) ĊĠĠĠ Ġval Ġtask 3 Ġ= ĠTest Task Data ( id Ġ= Ġ" task - 3 ", Ġsource Reference Ġ= Ġprocess Reference ( application Name Ġ= Ġ" app - 1 ")) ĊĊĠĠĠ Ġgiven () ĊĠĠĠĠĠ Ġ. no _ task _ exists () ĊĊĠĠĠ Ġ` when `() ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( task 1 . as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( task 2 . as Task Created Engine Event ()) ĊĠĠĠĠĠ Ġ. and () ĊĠĠĠĠĠ Ġ. task _ created _ event _ is _ received ( task 3 . as Task Created Engine Event ()) ĊĊĠĠĠ Ġthen () ĊĠĠĠĠĠ Ġ. tasks _ are _ returned _ for _ application (" app - 1 ", ĠTask QueryResult ( listOf ( task 1 . as Task (), Ġtask 3 . as Task ()))) ĊĠ Ġ} Ċ Ċ } Ċ Ċ @ Test Property Source ( properties Ġ= Ġ[ ĊĠ Ġ" camunda . task pool . view . mongo . change Tracking Mode = CHANGE _ STREAM ", ĊĠ Ġ" spring . data . mongodb . database = Task Pool Mongo Service Change Stream Change Tracking ITest " Ċ ]) Ċ @ Active Profiles (" it est - rep licated ") Ċ class ĠTask Pool Mongo Service Change Stream Change Tracking ITest Ġ: ĠTask Pool Mongo Service ITest Base () Ġ{ ĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġprivate Ġval Ġmongo Ġ= ĠMongo Launcher . Mongo Instance ( true , Ġ" Task Pool Mongo Service Change Stream Change Tracking ITest ") ĊĊĠĠĠ Ġ@ BeforeClass ĊĠĠĠ Ġ@ Jvm Static ĊĠĠĠ Ġfun Ġinit Mongo () Ġ{ ĊĠĠĠĠĠ Ġmongo . init () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After Class ĊĠĠĠ Ġ@ Jvm Static ĊĠĠĠ Ġfun Ġstop () Ġ{ ĊĠĠĠĠĠ Ġmongo . stop () ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ After ĊĠ Ġfun Ġclear Mongo () Ġ{ ĊĠĠĠ Ġmongo . clear () ĊĠ Ġ} Ċ } Ċ Ċ @ Test Property Source ( properties Ġ= Ġ[ ĊĠ Ġ" camunda . task pool . view . mongo . change Tracking Mode = EVENT _ HANDLER ", ĊĠ Ġ" spring . data . mongodb . database = Task Pool Mongo Service EventHandler Change Tracking ITest " Ċ ]) Ċ @ Active Profiles (" it est - standalone ") Ċ class ĠTask Pool Mongo Service EventHandler Change Tracking ITest Ġ: ĠTask Pool Mongo Service ITest Base () Ġ{ ĊĠ Ġcompanion Ġobject Ġ{ ĊĠĠĠ Ġprivate Ġval Ġmongo Ġ= ĠMongo Launcher . Mongo Instance ( false , Ġ" Task Pool Mongo Service EventHandler Change Tracking ITest ") ĊĊĠĠĠ Ġ@ BeforeClass ĊĠĠĠ Ġ@ Jvm Static ĊĠĠĠ Ġfun Ġinit Mongo () Ġ{ ĊĠĠĠĠĠ Ġmongo . init () ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ After Class ĊĠĠĠ Ġ@ Jvm Static ĊĠĠĠ Ġfun Ġstop () Ġ{ ĊĠĠĠĠĠ Ġmongo . stop () ĊĠĠĠ Ġ} ĊĠ Ġ} ĊĊĠ Ġ@ After ĊĠ Ġfun Ġclear Mongo () Ġ{ ĊĠĠĠ Ġmongo . clear () ĊĠ Ġ} Ċ } ĊĊ Ċ data Ġclass ĠTest Task Data ( ĊĠ Ġval Ġid : ĠString , ĊĠ Ġval Ġsource Reference : ĠSource Reference Ġ= Ġprocess Reference (), ĊĠ Ġval Ġtask Definition Key : ĠString Ġ= Ġ" task - definition - key - abc de ", ĊĠ Ġval Ġpayload : ĠVariable Map Ġ= ĠVariables . from Map ( map Of ( Pair (" variable Key ", Ġ" variable Value ")) ), ĊĠ Ġval Ġcorre lations : ĠCorre lation Map Ġ= ĠVariables . from Map ( map Of ( Pair (" correlation Key ", Ġ" correlation Value ")) ), ĊĠ Ġval Ġbusiness Key : ĠString ? Ġ= Ġ" business Key ", ĊĠ Ġval Ġname : ĠString ? Ġ= Ġ" task - name ", ĊĠ Ġval Ġdescription : ĠString ? Ġ= Ġ" some Ġtask Ġdescription ", ĊĠ Ġval Ġform Key : ĠString ? Ġ= Ġ" app : form - key ", ĊĠ Ġval Ġpriority : ĠInt ? Ġ= Ġ 0 , ĊĠ Ġval ĠcreateTime : ĠDate ? Ġ= ĠDate ( 1 2 3 4 5 6 7 8 9 0 L ), ĊĠ Ġval Ġcandidate Users : ĠSet < String > Ġ= Ġset Of (" ker mit ", Ġ" pig gy "), ĊĠ Ġval Ġcandidate Groups : ĠSet < String > Ġ= Ġset Of (" m uppet show "), ĊĠ Ġval Ġassign ee : ĠString ? Ġ= Ġnull , ĊĠ Ġval Ġowner : ĠString ? Ġ= Ġnull , ĊĠ Ġval Ġdue Date : ĠDate ? Ġ= ĠDate ( 1 2 3 4 5 9 9 9 9 9 L ), ĊĠ Ġval Ġfollow Up Date : ĠDate ? Ġ= Ġnull , ĊĠ Ġval Ġdeleted : ĠBoolean Ġ= Ġfalse ) Ġ{ ĊĊĠ Ġfun Ġas Task Created Engine Event () Ġ= ĠTask Created Engine Event ( ĊĠĠĠ Ġid Ġ= Ġid , ĊĠĠĠ Ġsource Reference Ġ= Ġsource Reference , ĊĠĠĠ Ġtask Definition Key Ġ= Ġtask Definition Key , ĊĠĠĠ Ġpayload Ġ= Ġpayload , ĊĠĠĠ Ġcorre lations Ġ= Ġcorre lations , ĊĠĠĠ Ġbusiness Key Ġ= Ġbusiness Key , ĊĠĠĠ Ġname Ġ= Ġname , ĊĠĠĠ Ġdescription Ġ= Ġdescription , ĊĠĠĠ Ġform Key Ġ= Ġform Key , ĊĠĠĠ Ġpriority Ġ= Ġpriority , ĊĠĠĠ ĠcreateTime Ġ= ĠcreateTime , ĊĠĠĠ Ġcandidate Users Ġ= Ġcandidate Users , ĊĠĠĠ Ġcandidate Groups Ġ= Ġcandidate Groups , ĊĠĠĠ Ġassign ee Ġ= Ġassign ee , ĊĠĠĠ Ġowner Ġ= Ġowner , ĊĠĠĠ Ġdue Date Ġ= Ġdue Date , ĊĠĠĠ Ġfollow Up Date Ġ= Ġfollow Up Date ĊĠ Ġ) ĊĊĠ Ġfun Ġas Task Assigned Engine Event () Ġ= ĠTask Assigned Engine Event ( ĊĠĠĠ Ġid Ġ= Ġid , ĊĠĠĠ Ġsource Reference Ġ= Ġsource Reference , ĊĠĠĠ Ġtask Definition Key Ġ= Ġtask Definition Key , ĊĠĠĠ Ġpayload Ġ= Ġpayload , ĊĠĠĠ Ġcorre lations Ġ= Ġcorre lations , ĊĠĠĠ Ġbusiness Key Ġ= Ġbusiness Key , ĊĠĠĠ Ġname Ġ= Ġname , ĊĠĠĠ Ġdescription Ġ= Ġdescription , ĊĠĠĠ Ġform Key Ġ= Ġform Key , ĊĠĠĠ Ġpriority Ġ= Ġpriority , ĊĠĠĠ ĠcreateTime Ġ= ĠcreateTime , ĊĠĠĠ Ġcandidate Users Ġ= Ġcandidate Users , ĊĠĠĠ Ġcandidate Groups Ġ= Ġcandidate Groups , ĊĠĠĠ Ġassign ee Ġ= Ġassign ee , ĊĠĠĠ Ġowner Ġ= Ġowner , ĊĠĠĠ Ġdue Date Ġ= Ġdue Date , ĊĠĠĠ Ġfollow Up Date Ġ= Ġfollow Up Date ĊĠ Ġ) ĊĊĠ Ġfun Ġas Task Attribute Updated Event () Ġ= ĠTask Attribute Updated Engine Event ( ĊĠĠĠ Ġid Ġ= Ġid , ĊĠĠĠ Ġsource Reference Ġ= Ġsource Reference , ĊĠĠĠ Ġtask Definition Key Ġ= Ġtask Definition Key , ĊĠĠĠ Ġname Ġ= Ġname , ĊĠĠĠ Ġdescription Ġ= Ġdescription , ĊĠĠĠ Ġpriority Ġ= Ġpriority , ĊĠĠĠ Ġowner Ġ= Ġowner , ĊĠĠĠ Ġdue Date Ġ= Ġdue Date , ĊĠĠĠ Ġfollow Up Date Ġ= Ġfollow Up Date ĊĠ Ġ) ĊĊĠ Ġfun Ġas Candidate Group Changed Event ( groupId : ĠString , Ġassignment Update Type : ĠString ) Ġ= ĠTask Candidate Group Changed ( ĊĠĠĠ Ġid Ġ= Ġid , ĊĠĠĠ Ġsource Reference Ġ= Ġsource Reference , ĊĠĠĠ Ġtask Definition Key Ġ= Ġtask Definition Key , ĊĠĠĠ ĠgroupId Ġ= ĠgroupId , ĊĠĠĠ Ġassignment Update Type Ġ= Ġassignment Update Type ĊĠ Ġ) ĊĊĠ Ġfun Ġas Candidate User Changed Event ( userId : ĠString , Ġassignment Update Type : ĠString ) Ġ= ĠTask Candidate User Changed ( ĊĠĠĠ Ġid Ġ= Ġid , ĊĠĠĠ Ġsource Reference Ġ= Ġsource Reference , ĊĠĠĠ Ġtask Definition Key Ġ= Ġtask Definition Key , ĊĠĠĠ ĠuserId Ġ= ĠuserId , ĊĠĠĠ Ġassignment Update Type Ġ= Ġassignment Update Type ĊĠ Ġ) ĊĊĠ Ġfun Ġas Task Deleted Engine Event () Ġ= ĠTask Deleted Engine Event ( ĊĠĠĠ Ġid Ġ= Ġid , ĊĠĠĠ Ġsource Reference Ġ= Ġsource Reference , ĊĠĠĠ Ġtask Definition Key Ġ= Ġtask Definition Key , ĊĠĠĠ Ġpayload Ġ= Ġpayload , ĊĠĠĠ Ġcorre lations Ġ= Ġcorre lations , ĊĠĠĠ Ġbusiness Key Ġ= Ġbusiness Key , ĊĠĠĠ Ġname Ġ= Ġname , ĊĠĠĠ Ġdescription Ġ= Ġdescription , ĊĠĠĠ Ġform Key Ġ= Ġform Key , ĊĠĠĠ Ġpriority Ġ= Ġpriority , ĊĠĠĠ ĠcreateTime Ġ= ĠcreateTime , ĊĠĠĠ Ġcandidate Users Ġ= Ġcandidate Users , ĊĠĠĠ Ġcandidate Groups Ġ= Ġcandidate Groups , ĊĠĠĠ Ġassign ee Ġ= Ġassign ee , ĊĠĠĠ Ġowner Ġ= Ġowner , ĊĠĠĠ Ġdue Date Ġ= Ġdue Date , ĊĠĠĠ Ġfollow Up Date Ġ= Ġfollow Up Date , ĊĠĠĠ Ġdelete Reason Ġ= Ġ" For Ġtesting Ġpurposes " ĊĠ Ġ) ĊĊĠ Ġfun Ġas Task () Ġ= ĠTask ( ĊĠĠĠ Ġid Ġ= Ġid , ĊĠĠĠ Ġsource Reference Ġ= Ġsource Reference , ĊĠĠĠ Ġtask Definition Key Ġ= Ġtask Definition Key , ĊĠĠĠ Ġpayload Ġ= Ġpayload , ĊĠĠĠ Ġcorre lations Ġ= Ġcorre lations , ĊĠĠĠ Ġbusiness Key Ġ= Ġbusiness Key , ĊĠĠĠ Ġname Ġ= Ġname , ĊĠĠĠ Ġdescription Ġ= Ġdescription , ĊĠĠĠ Ġform Key Ġ= Ġform Key , ĊĠĠĠ Ġpriority Ġ= Ġpriority , ĊĠĠĠ ĠcreateTime Ġ= ĠcreateTime , ĊĠĠĠ Ġcandidate Users Ġ= Ġcandidate Users , ĊĠĠĠ Ġcandidate Groups Ġ= Ġcandidate Groups , ĊĠĠĠ Ġassign ee Ġ= Ġassign ee , ĊĠĠĠ Ġowner Ġ= Ġowner , ĊĠĠĠ Ġdue Date Ġ= Ġdue Date , ĊĠĠĠ Ġfollow Up Date Ġ= Ġfollow Up Date , ĊĠĠĠ Ġdeleted Ġ= Ġdeleted ĊĠ Ġ) Ċ } Ċ Ċ private Ġfun Ġprocess Reference ( instanceId : ĠString Ġ= Ġ" instance - id - 1 2 3 4 5 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġexecution Id : ĠString Ġ= Ġ" execution - id - 1 2 3 4 5 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdefinition Id : ĠString Ġ= Ġ" definition - id - 1 2 3 4 5 ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġdefinition Key : ĠString Ġ= Ġ" definition - key - abc de ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġname : ĠString Ġ= Ġ" process - name ", ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġapplication Name : ĠString Ġ= Ġ" application - name "): ĠProcess Reference Ġ{ ĊĠ Ġreturn ĠProcess Reference ( ĊĠĠĠ Ġinstance Id , ĊĠĠĠ Ġexecution Id , ĊĠĠĠ Ġdefinition Id , ĊĠĠĠ Ġdefinition Key , ĊĠĠĠ Ġname , ĊĠĠĠ Ġapplication Name ĊĠ Ġ) Ċ } Ċ Ċ private Ġfun ĠTask . with Data Entries ( data Entries : ĠList < Data Entry > Ġ= ĠlistOf ()) Ġ= ĠTask WithData Entries ( this , Ġdata Entries ) Ċ