use of org.apache.inlong.manager.workflow.WorkflowContext in project incubator-inlong by apache.
the class TaskEventNotifier method notify.
@Override
public void notify(TaskEvent event, WorkflowContext sourceContext) {
final WorkflowContext context = sourceContext.clone();
WorkflowTask task = (WorkflowTask) context.getCurrentElement();
eventListenerManager.syncListeners(event).forEach(syncLogableNotify(context));
task.syncListeners(event).forEach(syncLogableNotify(context));
eventListenerManager.asyncListeners(event).forEach(asyncLogableNotify(context));
task.asyncListeners(event).forEach(asyncLogableNotify(context));
}
use of org.apache.inlong.manager.workflow.WorkflowContext in project incubator-inlong by apache.
the class DataSourceListenerTest method testRestartSource.
@Test
public void testRestartSource() {
// testFrozenSource();
groupInfo = initGroupForm("PULSAR");
groupInfo.setStatus(GroupState.CONFIG_SUCCESSFUL.getCode());
groupService.update(groupInfo.genRequest(), OPERATOR);
groupInfo.setStatus(GroupState.SUSPENDED.getCode());
groupService.update(groupInfo.genRequest(), OPERATOR);
final int sourceId = createBinlogSource(groupInfo);
streamSourceService.updateStatus(groupInfo.getInlongGroupId(), null, SourceState.SOURCE_NORMAL.getCode(), OPERATOR);
form = new UpdateGroupProcessForm();
form.setGroupInfo(groupInfo);
form.setOperateType(OperateType.RESTART);
WorkflowContext context = workflowEngine.processService().start(ProcessName.RESTART_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 task = process.getTaskByName("restartSource");
Assert.assertTrue(task instanceof ServiceTask);
SourceResponse sourceResponse = streamSourceService.get(sourceId, SourceType.BINLOG.toString());
Assert.assertSame(SourceState.forCode(sourceResponse.getStatus()), SourceState.TO_BE_ISSUED_ACTIVE);
}
Aggregations