use of org.apache.inlong.manager.service.thirdparty.hive.CreateHiveTableListener in project incubator-inlong by apache.
the class WorkflowServiceImplTest method mockTaskListenerFactory.
/**
* Mock the task listener factory
*/
public void mockTaskListenerFactory() {
CreateTubeGroupTaskListener createTubeGroupTaskListener = mock(CreateTubeGroupTaskListener.class);
when(createTubeGroupTaskListener.listen(any(WorkflowContext.class))).thenReturn(ListenerResult.success());
when(createTubeGroupTaskListener.name()).thenReturn(CreateHiveTableListener.class.getSimpleName());
when(createTubeGroupTaskListener.event()).thenReturn(TaskEvent.COMPLETE);
taskListenerFactory.setCreateTubeGroupTaskListener(createTubeGroupTaskListener);
CreateTubeTopicTaskListener createTubeTopicTaskListener = mock(CreateTubeTopicTaskListener.class);
when(createTubeTopicTaskListener.listen(any(WorkflowContext.class))).thenReturn(ListenerResult.success());
when(createTubeTopicTaskListener.name()).thenReturn(CreateTubeTopicTaskListener.class.getSimpleName());
when(createTubeTopicTaskListener.event()).thenReturn(TaskEvent.COMPLETE);
taskListenerFactory.setCreateTubeTopicTaskListener(createTubeTopicTaskListener);
CreatePulsarResourceTaskListener createPulsarResourceTaskListener = mock(CreatePulsarResourceTaskListener.class);
when(createPulsarResourceTaskListener.listen(any(WorkflowContext.class))).thenReturn(ListenerResult.success());
when(createPulsarResourceTaskListener.name()).thenReturn(CreatePulsarResourceTaskListener.class.getSimpleName());
when(createPulsarResourceTaskListener.event()).thenReturn(TaskEvent.COMPLETE);
taskListenerFactory.setCreatePulsarResourceTaskListener(createPulsarResourceTaskListener);
CreatePulsarGroupTaskListener createPulsarGroupTaskListener = mock(CreatePulsarGroupTaskListener.class);
when(createPulsarGroupTaskListener.listen(any(WorkflowContext.class))).thenReturn(ListenerResult.success());
when(createPulsarGroupTaskListener.name()).thenReturn(CreatePulsarGroupTaskListener.class.getSimpleName());
when(createPulsarGroupTaskListener.event()).thenReturn(TaskEvent.COMPLETE);
taskListenerFactory.setCreatePulsarGroupTaskListener(createPulsarGroupTaskListener);
CreateHiveTableListener createHiveTableListener = mock(CreateHiveTableListener.class);
when(createHiveTableListener.listen(any(WorkflowContext.class))).thenReturn(ListenerResult.success());
when(createHiveTableListener.name()).thenReturn(CreateHiveTableListener.class.getSimpleName());
when(createHiveTableListener.event()).thenReturn(TaskEvent.COMPLETE);
taskListenerFactory.setCreateHiveTableListener(createHiveTableListener);
PushSortConfigListener pushSortConfigListener = mock(PushSortConfigListener.class);
when(pushSortConfigListener.listen(any(WorkflowContext.class))).thenReturn(ListenerResult.success());
when(pushSortConfigListener.name()).thenReturn(PushSortConfigListener.class.getSimpleName());
when(pushSortConfigListener.event()).thenReturn(TaskEvent.COMPLETE);
taskListenerFactory.setPushSortConfigListener(pushSortConfigListener);
taskListenerFactory.clearListeners();
taskListenerFactory.init();
}
Aggregations