assertEquals(11, (long) rpt.getLongMetric(BatchingDecorator.R_TRIGGERS));
}
@Test
public void testBatchingMetrics() throws IOException, InterruptedException {
EventSource src = MemorySinkSource.cannedData("this is a data", 200);
MemorySinkSource mem = new MemorySinkSource();
UnbatchingDecorator<EventSink> unbatch = new UnbatchingDecorator<EventSink>(
mem);
GunzipDecorator<EventSink> gunzip = new GunzipDecorator<EventSink>(unbatch);
int evts = 5;
int latency = 0; // 0 never triggers on time
GzipDecorator<EventSink> gzip = new GzipDecorator<EventSink>(gunzip);
BatchingDecorator<EventSink> batch = new BatchingDecorator<EventSink>(gzip,
evts, latency);
src.open();
batch.open();
EventUtil.dumpAll(src, batch);
src.close();
batch.close();
// check metrics.
ReportEvent ubRpt = unbatch.getMetrics();
assertEquals(40, (long) ubRpt