use of org.apache.inlong.manager.common.pojo.workflow.ProcessResponse in project incubator-inlong by apache.
the class WorkflowServiceImplTest method testStartCreateTubeWorkflow.
@Test
public void testStartCreateTubeWorkflow() {
initGroupForm(Constant.MIDDLEWARE_TUBE);
mockTaskListenerFactory();
WorkflowContext context = workflowEngine.processService().start(processName.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("initMQ");
Assert.assertTrue(task instanceof ServiceTask);
Assert.assertEquals(2, task.getNameToListenerMap().size());
List<TaskEventListener> listeners = Lists.newArrayList(task.getNameToListenerMap().values());
Assert.assertTrue(listeners.get(0) instanceof CreateTubeTopicTaskListener);
Assert.assertTrue(listeners.get(1) instanceof CreateTubeGroupTaskListener);
}
use of org.apache.inlong.manager.common.pojo.workflow.ProcessResponse in project incubator-inlong by apache.
the class InlongGroupProcessOperationTest method testStartProcess.
@Test
public void testStartProcess() {
before(GroupState.TO_BE_SUBMIT.getCode());
WorkflowResult result = groupProcessOperation.startProcess(GROUP_ID, OPERATOR);
ProcessResponse response = result.getProcessInfo();
Assert.assertSame(response.getStatus(), ProcessStatus.PROCESSING);
InlongGroupInfo groupInfo = groupService.get(GROUP_ID);
Assert.assertEquals(groupInfo.getStatus(), GroupState.TO_BE_APPROVAL.getCode());
}
use of org.apache.inlong.manager.common.pojo.workflow.ProcessResponse in project incubator-inlong by apache.
the class InlongGroupProcessOperationTest method testSuspendProcess.
@Test
public void testSuspendProcess() {
testStartProcess();
InlongGroupInfo groupInfo = groupService.get(GROUP_ID);
groupInfo.setStatus(GroupState.APPROVE_PASSED.getCode());
groupService.update(groupInfo.genRequest(), OPERATOR);
groupInfo.setStatus(GroupState.CONFIG_ING.getCode());
groupService.update(groupInfo.genRequest(), OPERATOR);
groupInfo.setStatus(GroupState.CONFIG_SUCCESSFUL.getCode());
groupService.update(groupInfo.genRequest(), OPERATOR);
WorkflowResult result = groupProcessOperation.suspendProcess(GROUP_ID, OPERATOR);
ProcessResponse response = result.getProcessInfo();
Assert.assertSame(response.getStatus(), ProcessStatus.COMPLETED);
groupInfo = groupService.get(GROUP_ID);
Assert.assertEquals(groupInfo.getStatus(), GroupState.SUSPENDED.getCode());
}
use of org.apache.inlong.manager.common.pojo.workflow.ProcessResponse 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