use of org.apache.inlong.manager.workflow.event.task.QueueOperateListener in project incubator-inlong by apache.
the class ServiceTaskListenerFactoryTest method testGetQueueOperateListener.
@Test
public void testGetQueueOperateListener() {
WorkflowContext context = new WorkflowContext();
GroupResourceProcessForm processForm = new GroupResourceProcessForm();
InlongGroupInfo groupInfo = new InlongGroupInfo();
// check pulsar listener
groupInfo.setMiddlewareType(Constant.MIDDLEWARE_PULSAR);
processForm.setGroupInfo(groupInfo);
context.setProcessForm(processForm);
List<QueueOperateListener> queueOperateListeners = serviceTaskListenerFactory.getQueueOperateListener(context);
Assert.assertEquals(2, queueOperateListeners.size());
Assert.assertTrue(queueOperateListeners.get(0) instanceof CreatePulsarResourceTaskListener);
Assert.assertTrue(queueOperateListeners.get(1) instanceof CreatePulsarGroupTaskListener);
// check tube listener
groupInfo.setMiddlewareType(Constant.MIDDLEWARE_TUBE);
queueOperateListeners = serviceTaskListenerFactory.getQueueOperateListener(context);
Assert.assertEquals(2, queueOperateListeners.size());
Assert.assertTrue(queueOperateListeners.get(0) instanceof CreateTubeTopicTaskListener);
Assert.assertTrue(queueOperateListeners.get(1) instanceof CreateTubeGroupTaskListener);
}
use of org.apache.inlong.manager.workflow.event.task.QueueOperateListener in project incubator-inlong by apache.
the class ServiceTaskListenerFactory method acceptPlugin.
@Override
public void acceptPlugin(Plugin plugin) {
if (!(plugin instanceof ProcessPlugin)) {
return;
}
ProcessPlugin processPlugin = (ProcessPlugin) plugin;
Map<DataSourceOperateListener, EventSelector> pluginDsOperateListeners = processPlugin.createSourceOperateListeners();
if (MapUtils.isNotEmpty(pluginDsOperateListeners)) {
sourceOperateListeners.putAll(processPlugin.createSourceOperateListeners());
}
Map<SinkOperateListener, EventSelector> pluginSinkOperateListeners = processPlugin.createSinkOperateListeners();
if (MapUtils.isNotEmpty(pluginSinkOperateListeners)) {
sinkOperateListeners.putAll(pluginSinkOperateListeners);
}
Map<QueueOperateListener, EventSelector> pluginQueueOperateListeners = processPlugin.createQueueOperateListeners();
if (MapUtils.isNotEmpty(pluginQueueOperateListeners)) {
queueOperateListeners.putAll(pluginQueueOperateListeners);
}
Map<SortOperateListener, EventSelector> pluginSortOperateListeners = processPlugin.createSortOperateListeners();
if (MapUtils.isNotEmpty(pluginSortOperateListeners)) {
sortOperateListeners.putAll(pluginSortOperateListeners);
}
}
Aggregations