Search in sources :

Example 1 with TransientStoreEvent

use of org.apache.drill.exec.coord.store.TransientStoreEvent in project drill by apache.

the class TestEventDispatcher method testDispatcherPropagatesEvents.

@Test
public void testDispatcherPropagatesEvents() throws Exception {
    final PathChildrenCacheEvent.Type[] types = new PathChildrenCacheEvent.Type[] { PathChildrenCacheEvent.Type.CHILD_ADDED, PathChildrenCacheEvent.Type.CHILD_REMOVED, PathChildrenCacheEvent.Type.CHILD_UPDATED };
    for (final PathChildrenCacheEvent.Type type : types) {
        dispatcher.childEvent(null, new PathChildrenCacheEvent(type, child));
        final TransientStoreEvent event = TransientStoreEvent.of(EventDispatcher.MAPPINGS.get(type), key, value);
        Mockito.verify(store).fireListeners(event);
    }
    Assert.assertEquals("Number of event types that dispatcher can handle is different", types.length, EventDispatcher.MAPPINGS.size());
}
Also used : TransientStoreEvent(org.apache.drill.exec.coord.store.TransientStoreEvent) PathChildrenCacheEvent(org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent) Test(org.junit.Test)

Aggregations

PathChildrenCacheEvent (org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent)1 TransientStoreEvent (org.apache.drill.exec.coord.store.TransientStoreEvent)1 Test (org.junit.Test)1