use of com.alibaba.otter.node.etl.select.selector.canal.OtterDownStreamHandler in project otter by alibaba.
the class OtterDownStreamHandlerIntergration method testSimple.
@Test
public void testSimple() {
final OtterDownStreamHandler handler = new OtterDownStreamHandler();
handler.setPipelineId(388L);
handler.setDetectingIntervalInSeconds(1);
((AutowireCapableBeanFactory) TestedObject.getSpringBeanFactory()).autowireBeanProperties(handler, AutowireCapableBeanFactory.AUTOWIRE_BY_NAME, false);
final CountDownLatch count = new CountDownLatch(1);
ExecutorService executor = Executors.newFixedThreadPool(1);
executor.submit(new Runnable() {
public void run() {
int times = 50;
handler.before(Arrays.asList(buildEvent()));
while (--times > 0) {
try {
Thread.sleep(50000);
} catch (InterruptedException e) {
}
handler.before(Arrays.asList(buildEvent()));
}
count.countDown();
}
});
try {
count.await();
} catch (InterruptedException e) {
}
}
Aggregations