@@ -18,26 +18,30 @@ import com.netflix.conductor.common.metadata.tasks.Task
1818import com.netflix.conductor.common.metadata.tasks.TaskDef
1919import com.netflix.conductor.common.run.Workflow
2020import com.netflix.conductor.common.utils.TaskUtils
21+ import com.netflix.conductor.core.execution.tasks.Join
2122import com.netflix.conductor.core.execution.tasks.SubWorkflow
2223import com.netflix.conductor.test.base.AbstractSpecification
2324
2425import static com.netflix.conductor.test.util.WorkflowTestUtil.verifyPolledAndAcknowledgedTask
2526
2627class DoWhileSpec extends AbstractSpecification {
2728
29+ @Autowired
30+ Join joinTask
31+
2832 @Autowired
2933 SubWorkflow subWorkflowTask
3034
3135 def setup () {
32- workflowTestUtil. registerWorkflows(" do_while_integration_test.json" ,
33- " do_while_multiple_integration_test.json" ,
34- " do_while_as_subtask_integration_test.json" ,
36+ workflowTestUtil. registerWorkflows(' do_while_integration_test.json' ,
37+ ' do_while_multiple_integration_test.json' ,
38+ ' do_while_as_subtask_integration_test.json' ,
3539 ' simple_one_task_sub_workflow_integration_test.json' ,
3640 ' do_while_iteration_fix_test.json' ,
37- " do_while_sub_workflow_integration_test.json" ,
38- " do_while_five_loop_over_integration_test.json" ,
39- " do_while_system_tasks.json" ,
40- " do_while_set_variable_fix.json" )
41+ ' do_while_sub_workflow_integration_test.json' ,
42+ ' do_while_five_loop_over_integration_test.json' ,
43+ ' do_while_system_tasks.json' ,
44+ ' do_while_set_variable_fix.json' )
4145 }
4246
4347 def " Test workflow with 2 iterations of five tasks" () {
@@ -275,6 +279,7 @@ class DoWhileSpec extends AbstractSpecification {
275279 }
276280
277281 when : " Polling and completing second task"
282+ def joinId = workflowExecutionService. getExecutionStatus(workflowInstanceId, true ). getTaskByRefName(" join__1" ). taskId
278283 Tuple polledAndCompletedTask1 = workflowTestUtil. pollAndCompleteTask(' integration_task_1' , ' integration.test.worker' )
279284
280285 then : " Verify that the task was polled and acknowledged and workflow is in running state"
@@ -300,6 +305,9 @@ class DoWhileSpec extends AbstractSpecification {
300305 when : " Polling and completing third task"
301306 Tuple polledAndCompletedTask2 = workflowTestUtil. pollAndCompleteTask(' integration_task_2' , ' integration.test.worker' )
302307
308+ and : " JOIN task is executed"
309+ asyncSystemTaskExecutor. execute(joinTask, joinId)
310+
303311 then : " Verify that the task was polled and acknowledged and workflow is in completed state"
304312 verifyPolledAndAcknowledgedTask(polledAndCompletedTask2)
305313 verifyTaskIteration(polledAndCompletedTask2[0 ] as Task , 1 )
@@ -363,6 +371,7 @@ class DoWhileSpec extends AbstractSpecification {
363371 }
364372
365373 when : " Polling and completing second task"
374+ def joinId = workflowExecutionService. getExecutionStatus(workflowInstanceId, true ). getTaskByRefName(" join__1" ). taskId
366375 Tuple polledAndCompletedTask1 = workflowTestUtil. pollAndCompleteTask(' integration_task_1' , ' integration.test.worker' )
367376
368377 then : " Verify that the task was polled and acknowledged and workflow is in running state"
@@ -388,6 +397,9 @@ class DoWhileSpec extends AbstractSpecification {
388397 when : " Polling and completing third task"
389398 Tuple polledAndCompletedTask2 = workflowTestUtil. pollAndCompleteTask(' integration_task_2' , ' integration.test.worker' )
390399
400+ and : " JOIN task is executed"
401+ asyncSystemTaskExecutor. execute(joinTask, joinId)
402+
391403 then : " Verify that the task was polled and acknowledged and workflow is in completed state"
392404 verifyPolledAndAcknowledgedTask(polledAndCompletedTask2)
393405 verifyTaskIteration(polledAndCompletedTask2[0 ] as Task , 1 )
@@ -528,6 +540,7 @@ class DoWhileSpec extends AbstractSpecification {
528540 }
529541
530542 when : " Polling and completing second task"
543+ def join1Id = workflowExecutionService. getExecutionStatus(workflowInstanceId, true ). getTaskByRefName(" join__1" ). taskId
531544 Tuple polledAndCompletedTask1 = workflowTestUtil. pollAndCompleteTask(' integration_task_1' , ' integration.test.worker' )
532545
533546 then : " Verify that the task was polled and acknowledged and workflow is in running state"
@@ -553,6 +566,9 @@ class DoWhileSpec extends AbstractSpecification {
553566 when : " Polling and completing third task"
554567 Tuple polledAndCompletedTask2 = workflowTestUtil. pollAndCompleteTask(' integration_task_2' , ' integration.test.worker' )
555568
569+ and : " JOIN task is executed"
570+ asyncSystemTaskExecutor. execute(joinTask, join1Id)
571+
556572 then : " Verify that the task was polled and acknowledged and workflow is in running state"
557573 verifyPolledAndAcknowledgedTask(polledAndCompletedTask2)
558574 verifyTaskIteration(polledAndCompletedTask2[0 ] as Task , 1 )
@@ -609,6 +625,7 @@ class DoWhileSpec extends AbstractSpecification {
609625 }
610626
611627 when : " Polling and completing second iteration of second task"
628+ def join2Id = workflowExecutionService. getExecutionStatus(workflowInstanceId, true ). getTaskByRefName(" join__2" ). taskId
612629 Tuple polledAndCompletedSecondIterationTask1 = workflowTestUtil. pollAndCompleteTask(' integration_task_1' , ' integration.test.worker' )
613630
614631 then : " Verify that the task was polled and acknowledged and workflow is in running state"
@@ -644,6 +661,9 @@ class DoWhileSpec extends AbstractSpecification {
644661 when : " Polling and completing second iteration of third task"
645662 Tuple polledAndCompletedSecondIterationTask2 = workflowTestUtil. pollAndCompleteTask(' integration_task_2' , ' integration.test.worker' )
646663
664+ and : " JOIN task is executed"
665+ asyncSystemTaskExecutor. execute(joinTask, join2Id)
666+
647667 then : " Verify that the task was polled and acknowledged and workflow is in running state"
648668 verifyPolledAndAcknowledgedTask(polledAndCompletedSecondIterationTask2)
649669 verifyTaskIteration(polledAndCompletedSecondIterationTask2[0 ] as Task , 2 )
@@ -796,6 +816,7 @@ class DoWhileSpec extends AbstractSpecification {
796816 }
797817
798818 when : " Polling and completing second task"
819+ def joinId = workflowExecutionService. getExecutionStatus(workflowInstanceId, true ). getTaskByRefName(" join__1" ). taskId
799820 Tuple polledAndCompletedTask1 = workflowTestUtil. pollAndCompleteTask(' integration_task_1' , ' integration.test.worker' )
800821
801822 then : " Verify that the task was polled and acknowledged and workflow is in running state"
@@ -823,6 +844,9 @@ class DoWhileSpec extends AbstractSpecification {
823844 when : " Polling and completing third task"
824845 Tuple polledAndCompletedTask2 = workflowTestUtil. pollAndCompleteTask(' integration_task_2' , ' integration.test.worker' )
825846
847+ and : " JOIN task is executed"
848+ asyncSystemTaskExecutor. execute(joinTask, joinId)
849+
826850 then : " Verify that the task was polled and acknowledged and workflow is in completed state"
827851 verifyPolledAndAcknowledgedTask(polledAndCompletedTask2)
828852 verifyTaskIteration(polledAndCompletedTask2[0 ] as Task , 1 )
@@ -920,6 +944,7 @@ class DoWhileSpec extends AbstractSpecification {
920944 }
921945
922946 when : " Polling and completing second task"
947+ def joinId = workflowExecutionService. getExecutionStatus(workflowInstanceId, true ). getTaskByRefName(" join__1" ). taskId
923948 Tuple polledAndCompletedTask1 = workflowTestUtil. pollAndCompleteTask(' integration_task_1' , ' integration.test.worker' )
924949
925950 then : " Verify that the task was polled and acknowledged and workflow is in running state"
@@ -947,6 +972,9 @@ class DoWhileSpec extends AbstractSpecification {
947972 when : " Polling and completing third task"
948973 Tuple polledAndCompletedTask2 = workflowTestUtil. pollAndCompleteTask(' integration_task_2' , ' integration.test.worker' )
949974
975+ and : " JOIN task is executed"
976+ asyncSystemTaskExecutor. execute(joinTask, joinId)
977+
950978 then : " Verify that the task was polled and acknowledged and workflow is in completed state"
951979 verifyPolledAndAcknowledgedTask(polledAndCompletedTask2)
952980 verifyTaskIteration(polledAndCompletedTask2[0 ] as Task , 1 )
@@ -998,6 +1026,7 @@ class DoWhileSpec extends AbstractSpecification {
9981026 }
9991027
10001028 when : " Polling and completing first task in DO While"
1029+ def joinId = workflowExecutionService. getExecutionStatus(workflowInstanceId, true ). getTaskByRefName(" join" ). taskId
10011030 Tuple polledAndCompletedTask0 = workflowTestUtil. pollAndCompleteTask(' integration_task_0' , ' integration.test.worker' )
10021031
10031032 then : " Verify that the task was polled and acknowledged and workflow is in running state"
@@ -1049,6 +1078,9 @@ class DoWhileSpec extends AbstractSpecification {
10491078 and : " the workflow is evaluated"
10501079 sweep(workflowInstanceId)
10511080
1081+ and : " JOIN task is executed"
1082+ asyncSystemTaskExecutor. execute(joinTask, joinId)
1083+
10521084 then : " Verify that the task was polled and acknowledged and workflow is in completed state"
10531085 verifyPolledAndAcknowledgedTask(polledAndCompletedTask2)
10541086 with(workflowExecutionService. getExecutionStatus(workflowInstanceId, true )) {
0 commit comments