use of com.yahoo.bullet.storm.testing.CustomCollector in project bullet-storm by yahoo.
the class FilterBoltTest method testFilteringLatency.
@Test
public void testFilteringLatency() {
config = new BulletStormConfig();
// Don't use the overridden aggregation default size but turn on built in metrics
config.set(BulletStormConfig.TOPOLOGY_METRICS_BUILT_IN_ENABLE, true);
collector = new CustomCollector();
CustomTopologyContext context = new CustomTopologyContext();
bolt = new FilterBolt(TopologyConstants.RECORD_COMPONENT, config);
ComponentUtils.prepare(new HashMap<>(), bolt, context, collector);
Tuple query = makeIDTuple(TupleClassifier.Type.QUERY_TUPLE, "42", makeFieldFilterQuery("bar"), METADATA);
bolt.execute(query);
BulletRecord record = RecordBox.get().add("field", "foo").getRecord();
long start = System.currentTimeMillis();
IntStream.range(0, 10).mapToObj(i -> makeRecordTuple(record, System.currentTimeMillis())).forEach(bolt::execute);
long end = System.currentTimeMillis();
double actualLatecy = context.getDoubleMetric(TopologyConstants.LATENCY_METRIC);
Assert.assertTrue(actualLatecy <= end - start);
}
use of com.yahoo.bullet.storm.testing.CustomCollector in project bullet-storm by yahoo.
the class FilterBoltTest method setup.
@BeforeMethod
public void setup() {
collector = new CustomCollector();
config = oneRecordConfig();
bolt = ComponentUtils.prepare(new FilterBolt(TopologyConstants.RECORD_COMPONENT, config), collector);
}
Aggregations