use of org.apache.inlong.manager.service.mocks.MockStopSortListener in project incubator-inlong by apache.
the class WorkflowServiceImplTest method testSuspendProcess.
@Test
public void testSuspendProcess() {
InlongGroupInfo groupInfo = initGroupForm(Constant.MIDDLEWARE_PULSAR);
groupInfo.setStatus(GroupState.CONFIG_SUCCESSFUL.getCode());
groupService.update(groupInfo.genRequest(), OPERATOR);
UpdateGroupProcessForm form = new UpdateGroupProcessForm();
form.setGroupInfo(groupInfo);
form.setOperateType(OperateType.SUSPEND);
taskListenerFactory.acceptPlugin(new MockPlugin());
WorkflowContext context = workflowEngine.processService().start(ProcessName.SUSPEND_GROUP_PROCESS.name(), applicant, form);
WorkflowResult result = WorkflowBeanUtils.result(context);
ProcessResponse response = result.getProcessInfo();
Assert.assertSame(response.getStatus(), ProcessStatus.COMPLETED);
WorkflowProcess process = context.getProcess();
WorkflowTask stopSortTask = process.getTaskByName("stopSort");
Assert.assertTrue(stopSortTask instanceof ServiceTask);
List<TaskEventListener> listeners = Lists.newArrayList(stopSortTask.getNameToListenerMap().values());
Assert.assertTrue(listeners.get(0) instanceof MockStopSortListener);
WorkflowTask stopSourceTask = process.getTaskByName("stopSource");
Assert.assertTrue(stopSourceTask instanceof ServiceTask);
listeners = Lists.newArrayList(stopSourceTask.getNameToListenerMap().values());
}
Aggregations