use of org.apache.inlong.manager.service.mocks.MockPlugin in project incubator-inlong by apache.
the class InlongGroupProcessOperationTest method before.
public void before(int status) {
MockPlugin mockPlugin = new MockPlugin();
serviceTaskListenerFactory.acceptPlugin(mockPlugin);
InlongGroupRequest groupInfo = new InlongGroupRequest();
groupInfo.setInlongGroupId(GROUP_ID);
groupInfo.setName(GROUP_NAME);
groupInfo.setInCharges(OPERATOR);
groupInfo.setMiddlewareType(Constant.MIDDLEWARE_PULSAR);
InlongGroupPulsarInfo pulsarInfo = new InlongGroupPulsarInfo();
pulsarInfo.setInlongGroupId(GROUP_ID);
groupInfo.setMqExtInfo(pulsarInfo);
groupService.save(groupInfo, OPERATOR);
groupService.update(groupInfo, OPERATOR);
}
use of org.apache.inlong.manager.service.mocks.MockPlugin in project incubator-inlong by apache.
the class DisableZkForSortTest method testCreateSortConfigInUpdateWorkflow.
@Test
public void testCreateSortConfigInUpdateWorkflow() {
InlongGroupInfo groupInfo = initGroupForm("PULSAR");
groupInfo.setZookeeperEnabled(0);
groupInfo.setStatus(GroupState.CONFIG_SUCCESSFUL.getCode());
groupService.update(groupInfo.genRequest(), OPERATOR);
InlongStreamInfo streamInfo = createStreamInfo(groupInfo);
createHiveSink(streamInfo);
createKafkaSource(streamInfo);
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 task = process.getTaskByName("stopSort");
Assert.assertTrue(task instanceof ServiceTask);
Assert.assertEquals(2, task.getNameToListenerMap().size());
List<TaskEventListener> listeners = Lists.newArrayList(task.getNameToListenerMap().values());
Assert.assertTrue(listeners.get(1) instanceof CreateSortConfigListener);
ProcessForm currentProcessForm = context.getProcessForm();
InlongGroupInfo curGroupRequest = ((UpdateGroupProcessForm) currentProcessForm).getGroupInfo();
Assert.assertTrue(curGroupRequest.getExtList().size() == 1);
}
use of org.apache.inlong.manager.service.mocks.MockPlugin in project incubator-inlong by apache.
the class WorkflowServiceImplTest method testRestartProcess.
@Test
public void testRestartProcess() {
InlongGroupInfo groupInfo = initGroupForm(Constant.MIDDLEWARE_PULSAR);
groupInfo.setStatus(GroupState.CONFIG_SUCCESSFUL.getCode());
groupService.update(groupInfo.genRequest(), OPERATOR);
groupInfo.setStatus(GroupState.SUSPENDED.getCode());
groupService.update(groupInfo.genRequest(), OPERATOR);
UpdateGroupProcessForm form = new UpdateGroupProcessForm();
form.setGroupInfo(groupInfo);
form.setOperateType(OperateType.RESTART);
taskListenerFactory.acceptPlugin(new MockPlugin());
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 restartSort = process.getTaskByName("restartSort");
Assert.assertTrue(restartSort instanceof ServiceTask);
List<TaskEventListener> listeners = Lists.newArrayList(restartSort.getNameToListenerMap().values());
Assert.assertEquals(1, listeners.size());
Assert.assertTrue(listeners.get(0) instanceof MockRestartSortListener);
WorkflowTask restartSourceTask = process.getTaskByName("restartSource");
Assert.assertTrue(restartSourceTask instanceof ServiceTask);
listeners = Lists.newArrayList(restartSourceTask.getNameToListenerMap().values());
Assert.assertEquals(2, listeners.size());
}
use of org.apache.inlong.manager.service.mocks.MockPlugin 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());
}
use of org.apache.inlong.manager.service.mocks.MockPlugin in project incubator-inlong by apache.
the class WorkflowServiceImplTest method testStopProcess.
@Test
public void testStopProcess() {
InlongGroupInfo groupInfo = initGroupForm(Constant.MIDDLEWARE_PULSAR);
groupInfo.setStatus(GroupState.CONFIG_SUCCESSFUL.getCode());
groupService.update(groupInfo.genRequest(), OPERATOR);
groupInfo.setStatus(GroupState.SUSPENDED.getCode());
groupService.update(groupInfo.genRequest(), OPERATOR);
UpdateGroupProcessForm form = new UpdateGroupProcessForm();
form.setGroupInfo(groupInfo);
form.setOperateType(OperateType.DELETE);
taskListenerFactory.acceptPlugin(new MockPlugin());
WorkflowContext context = workflowEngine.processService().start(ProcessName.DELETE_GROUP_PROCESS.name(), applicant, form);
WorkflowResult result = WorkflowBeanUtils.result(context);
ProcessResponse view = result.getProcessInfo();
Assert.assertSame(view.getStatus(), ProcessStatus.COMPLETED);
WorkflowProcess process = context.getProcess();
WorkflowTask deleteSort = process.getTaskByName("deleteSort");
Assert.assertTrue(deleteSort instanceof ServiceTask);
List<TaskEventListener> listeners = Lists.newArrayList(deleteSort.getNameToListenerMap().values());
Assert.assertEquals(1, listeners.size());
Assert.assertTrue(listeners.get(0) instanceof MockDeleteSortListener);
WorkflowTask deleteSourceTask = process.getTaskByName("deleteSource");
Assert.assertTrue(deleteSourceTask instanceof ServiceTask);
listeners = Lists.newArrayList(deleteSourceTask.getNameToListenerMap().values());
Assert.assertEquals(2, listeners.size());
}
Aggregations