use of org.apache.rocketmq.connect.redis.processor.RedisEventProcessor in project rocketmq-externals by apache.
the class RedisSourceTaskTest method testException.
@Test
public void testException() {
RedisEventProcessor processor = mock(DefaultRedisEventProcessor.class);
try {
when(processor.poll()).thenThrow(new InterruptedException());
} catch (Exception e) {
e.printStackTrace();
}
RedisSourceTask redisSourceTask = new RedisSourceTask();
redisSourceTask.setEventProcessor(processor);
redisSourceTask.poll();
RedisEventProcessor processor2 = mock(DefaultRedisEventProcessor.class);
try {
when(processor2.poll()).thenThrow(new Exception());
} catch (Exception e) {
e.printStackTrace();
}
RedisSourceTask redisSourceTask2 = new RedisSourceTask();
redisSourceTask2.setEventProcessor(processor2);
redisSourceTask2.poll();
}
use of org.apache.rocketmq.connect.redis.processor.RedisEventProcessor in project rocketmq-externals by apache.
the class ListenerTest method testEventListenerRetry2.
@Test
public void testEventListenerRetry2() {
Config config = getConfig();
RedisEventProcessor processor = getExceptionProcessor(config);
EventListener eventListener = new RedisEventListener(config, processor);
KeyValuePair pair = new KeyStringValueString();
eventListener.onEvent(null, pair);
}
use of org.apache.rocketmq.connect.redis.processor.RedisEventProcessor in project rocketmq-externals by apache.
the class ListenerTest method getProcessor.
private RedisEventProcessor getProcessor() {
Config config = getConfig();
RedisEventHandler eventHandler = new DefaultRedisEventHandler(config);
RedisEventProcessor processor = new DefaultRedisEventProcessor(config);
processor.registEventHandler(eventHandler);
return processor;
}
use of org.apache.rocketmq.connect.redis.processor.RedisEventProcessor in project rocketmq-externals by apache.
the class ListenerTest method testEventListenerRetry1.
@Test
public void testEventListenerRetry1() {
Config config = getConfig();
RedisEventProcessor processor = getFailedProcessor(config);
EventListener eventListener = new RedisEventListener(config, processor);
KeyValuePair pair = new KeyStringValueString();
eventListener.onEvent(null, pair);
}
use of org.apache.rocketmq.connect.redis.processor.RedisEventProcessor in project rocketmq-externals by apache.
the class ListenerTest method getFailedProcessor.
private RedisEventProcessor getFailedProcessor(Config config) {
RedisEventHandler eventHandler = new DefaultRedisEventHandler(config);
RedisEventProcessor processor = mock(DefaultRedisEventProcessor.class);
processor.registEventHandler(eventHandler);
try {
when(processor.commit(any())).thenReturn(false);
} catch (Exception e) {
e.printStackTrace();
}
return processor;
}
Aggregations