|
|
@ -87,12 +87,50 @@ public class WorkflowStartTestCase extends AbstractMasterIntegrationTestCase { |
|
|
|
Assertions |
|
|
|
Assertions |
|
|
|
.assertThat(repository.queryWorkflowInstance(workflowInstanceId)) |
|
|
|
.assertThat(repository.queryWorkflowInstance(workflowInstanceId)) |
|
|
|
.matches( |
|
|
|
.matches( |
|
|
|
workflowInstance -> workflowInstance.getState() == WorkflowExecutionStatus.SUCCESS); |
|
|
|
workflowInstance -> workflowInstance.getState() == WorkflowExecutionStatus.SUCCESS) |
|
|
|
|
|
|
|
.matches( |
|
|
|
|
|
|
|
workflowInstance -> workflowInstance.getDryRun() == Flag.NO.getCode()); |
|
|
|
|
|
|
|
Assertions |
|
|
|
|
|
|
|
.assertThat(repository.queryTaskInstance(workflow)) |
|
|
|
|
|
|
|
.satisfiesExactly(taskInstance -> { |
|
|
|
|
|
|
|
assertThat(taskInstance.getName()).isEqualTo("A"); |
|
|
|
|
|
|
|
assertThat(taskInstance.getState()).isEqualTo(TaskExecutionStatus.SUCCESS); |
|
|
|
|
|
|
|
assertThat(taskInstance.getDryRun()).isEqualTo(Flag.NO.getCode()); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThat(workflowRepository.getAll()).isEmpty(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
@DisplayName("Test start a workflow with one fake task(A) dry run success") |
|
|
|
|
|
|
|
public void testStartWorkflow_with_oneSuccessTaskDryRun() { |
|
|
|
|
|
|
|
final String yaml = "/it/start/workflow_with_one_fake_task_success.yaml"; |
|
|
|
|
|
|
|
final WorkflowTestCaseContext context = workflowTestCaseContextFactory.initializeContextFromYaml(yaml); |
|
|
|
|
|
|
|
final WorkflowDefinition workflow = context.getWorkflows().get(0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final WorkflowOperator.WorkflowTriggerDTO workflowTriggerDTO = WorkflowOperator.WorkflowTriggerDTO.builder() |
|
|
|
|
|
|
|
.workflowDefinition(workflow) |
|
|
|
|
|
|
|
.runWorkflowCommandParam(new RunWorkflowCommandParam()) |
|
|
|
|
|
|
|
.dryRun(Flag.YES) |
|
|
|
|
|
|
|
.build(); |
|
|
|
|
|
|
|
final Integer workflowInstanceId = workflowOperator.manualTriggerWorkflow(workflowTriggerDTO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await() |
|
|
|
|
|
|
|
.atMost(Duration.ofMinutes(1)) |
|
|
|
|
|
|
|
.untilAsserted(() -> { |
|
|
|
|
|
|
|
Assertions |
|
|
|
|
|
|
|
.assertThat(repository.queryWorkflowInstance(workflowInstanceId)) |
|
|
|
|
|
|
|
.matches( |
|
|
|
|
|
|
|
workflowInstance -> workflowInstance.getState() == WorkflowExecutionStatus.SUCCESS) |
|
|
|
|
|
|
|
.matches( |
|
|
|
|
|
|
|
workflowInstance -> workflowInstance.getDryRun() == Flag.YES.getCode()); |
|
|
|
Assertions |
|
|
|
Assertions |
|
|
|
.assertThat(repository.queryTaskInstance(workflow)) |
|
|
|
.assertThat(repository.queryTaskInstance(workflow)) |
|
|
|
.satisfiesExactly(taskInstance -> { |
|
|
|
.satisfiesExactly(taskInstance -> { |
|
|
|
assertThat(taskInstance.getName()).isEqualTo("A"); |
|
|
|
assertThat(taskInstance.getName()).isEqualTo("A"); |
|
|
|
assertThat(taskInstance.getState()).isEqualTo(TaskExecutionStatus.SUCCESS); |
|
|
|
assertThat(taskInstance.getState()).isEqualTo(TaskExecutionStatus.SUCCESS); |
|
|
|
|
|
|
|
assertThat(taskInstance.getDryRun()).isEqualTo(Flag.YES.getCode()); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -121,7 +159,9 @@ public class WorkflowStartTestCase extends AbstractMasterIntegrationTestCase { |
|
|
|
.matches( |
|
|
|
.matches( |
|
|
|
workflowInstance -> workflowInstance.getState() == WorkflowExecutionStatus.SUCCESS) |
|
|
|
workflowInstance -> workflowInstance.getState() == WorkflowExecutionStatus.SUCCESS) |
|
|
|
.matches( |
|
|
|
.matches( |
|
|
|
workflowInstance -> workflowInstance.getIsSubWorkflow() == Flag.NO); |
|
|
|
workflowInstance -> workflowInstance.getIsSubWorkflow() == Flag.NO) |
|
|
|
|
|
|
|
.matches( |
|
|
|
|
|
|
|
workflowInstance -> workflowInstance.getDryRun() == Flag.NO.getCode()); |
|
|
|
|
|
|
|
|
|
|
|
final List<WorkflowInstance> subWorkflowInstance = |
|
|
|
final List<WorkflowInstance> subWorkflowInstance = |
|
|
|
repository.queryWorkflowInstance(context.getWorkflows().get(1)); |
|
|
|
repository.queryWorkflowInstance(context.getWorkflows().get(1)); |
|
|
@ -131,6 +171,7 @@ public class WorkflowStartTestCase extends AbstractMasterIntegrationTestCase { |
|
|
|
.satisfiesExactly(workflowInstance -> { |
|
|
|
.satisfiesExactly(workflowInstance -> { |
|
|
|
assertThat(workflowInstance.getState()).isEqualTo(WorkflowExecutionStatus.SUCCESS); |
|
|
|
assertThat(workflowInstance.getState()).isEqualTo(WorkflowExecutionStatus.SUCCESS); |
|
|
|
assertThat(workflowInstance.getIsSubWorkflow()).isEqualTo(Flag.YES); |
|
|
|
assertThat(workflowInstance.getIsSubWorkflow()).isEqualTo(Flag.YES); |
|
|
|
|
|
|
|
assertThat(workflowInstance.getDryRun()).isEqualTo(Flag.NO.getCode()); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
Assertions |
|
|
|
Assertions |
|
|
@ -151,6 +192,51 @@ public class WorkflowStartTestCase extends AbstractMasterIntegrationTestCase { |
|
|
|
assertThat(workflowRepository.getAll()).isEmpty(); |
|
|
|
assertThat(workflowRepository.getAll()).isEmpty(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
@DisplayName("Test start a workflow with one sub workflow task(A) dry run, will not execute") |
|
|
|
|
|
|
|
public void testStartWorkflow_with_subWorkflowTask_dryRunSuccess() { |
|
|
|
|
|
|
|
final String yaml = "/it/start/workflow_with_sub_workflow_task_success.yaml"; |
|
|
|
|
|
|
|
final WorkflowTestCaseContext context = workflowTestCaseContextFactory.initializeContextFromYaml(yaml); |
|
|
|
|
|
|
|
final WorkflowDefinition parentWorkflow = context.getWorkflows().get(0); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final WorkflowOperator.WorkflowTriggerDTO workflowTriggerDTO = WorkflowOperator.WorkflowTriggerDTO.builder() |
|
|
|
|
|
|
|
.workflowDefinition(parentWorkflow) |
|
|
|
|
|
|
|
.runWorkflowCommandParam(new RunWorkflowCommandParam()) |
|
|
|
|
|
|
|
.dryRun(Flag.YES) |
|
|
|
|
|
|
|
.build(); |
|
|
|
|
|
|
|
final Integer workflowInstanceId = workflowOperator.manualTriggerWorkflow(workflowTriggerDTO); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await() |
|
|
|
|
|
|
|
.atMost(Duration.ofMinutes(1)) |
|
|
|
|
|
|
|
.untilAsserted(() -> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assertions |
|
|
|
|
|
|
|
.assertThat(repository.queryWorkflowInstance(workflowInstanceId)) |
|
|
|
|
|
|
|
.matches( |
|
|
|
|
|
|
|
workflowInstance -> workflowInstance.getState() == WorkflowExecutionStatus.SUCCESS) |
|
|
|
|
|
|
|
.matches( |
|
|
|
|
|
|
|
workflowInstance -> workflowInstance.getIsSubWorkflow() == Flag.NO) |
|
|
|
|
|
|
|
.matches( |
|
|
|
|
|
|
|
workflowInstance -> workflowInstance.getDryRun() == Flag.YES.getCode()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final List<WorkflowInstance> subWorkflowInstance = |
|
|
|
|
|
|
|
repository.queryWorkflowInstance(context.getWorkflows().get(1)); |
|
|
|
|
|
|
|
Assertions |
|
|
|
|
|
|
|
.assertThat(subWorkflowInstance) |
|
|
|
|
|
|
|
.isEmpty(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Assertions |
|
|
|
|
|
|
|
.assertThat(repository.queryTaskInstance(workflowInstanceId)) |
|
|
|
|
|
|
|
.satisfiesExactly(taskInstance -> { |
|
|
|
|
|
|
|
assertThat(taskInstance.getName()).isEqualTo("sub_logic_task"); |
|
|
|
|
|
|
|
assertThat(taskInstance.getState()).isEqualTo(TaskExecutionStatus.SUCCESS); |
|
|
|
|
|
|
|
assertThat(taskInstance.getDryRun()).isEqualTo(Flag.YES.getCode()); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThat(workflowRepository.getAll()).isEmpty(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
@DisplayName("Test start a workflow with one sub workflow task(A) failed") |
|
|
|
@DisplayName("Test start a workflow with one sub workflow task(A) failed") |
|
|
|
public void testStartWorkflow_with_subWorkflowTask_failed() { |
|
|
|
public void testStartWorkflow_with_subWorkflowTask_failed() { |
|
|
|