use of com.metamx.emitter.core.Event in project druid by druid-io.
the class MockMemcachedClient method testMonitor.
@Test
public void testMonitor() throws Exception {
final MemcachedCache cache = MemcachedCache.create(memcachedCacheConfig);
final Emitter emitter = EasyMock.createNiceMock(Emitter.class);
final Collection<Event> events = new ArrayList<>();
final ServiceEmitter serviceEmitter = new ServiceEmitter("service", "host", emitter) {
@Override
public void emit(Event event) {
events.add(event);
}
};
while (events.isEmpty()) {
Thread.sleep(memcachedCacheConfig.getTimeout());
cache.doMonitor(serviceEmitter);
}
Assert.assertFalse(events.isEmpty());
ObjectMapper mapper = new DefaultObjectMapper();
for (Event event : events) {
log.debug("Found event `%s`", mapper.writeValueAsString(event.toMap()));
}
}
use of com.metamx.emitter.core.Event in project druid by druid-io.
the class LookupCoordinatorManagerTest method setUpStatic.
@BeforeClass
public static void setUpStatic() {
LoggingEmitter loggingEmitter = EasyMock.createNiceMock(LoggingEmitter.class);
EasyMock.replay(loggingEmitter);
SERVICE_EMITTER = new ServiceEmitter("", "", loggingEmitter) {
@Override
public void emit(Event event) {
EVENT_EMITS.incrementAndGet();
super.emit(event);
}
};
com.metamx.emitter.EmittingLogger.registerEmitter(SERVICE_EMITTER);
}
Aggregations