use of com.yahoo.bullet.querying.RateLimitError in project bullet-storm by yahoo.
the class JoinBoltTest method testRateLimitingWithTicks.
@Test
public void testRateLimitingWithTicks() {
RateLimitError rateLimitError = new RateLimitError(42.0, config);
bolt = new RateLimitedJoinBolt(2, rateLimitError, config);
setup(bolt);
Tuple query = TupleUtils.makeIDTuple(TupleClassifier.Type.QUERY_TUPLE, "42", makeAggregationQuery(RAW, 10));
bolt.execute(query);
List<BulletRecord> sent = sendRawRecordTuplesTo(bolt, "42", 2);
Assert.assertEquals(collector.getEmittedCount(), 0);
Tuple tick = TupleUtils.makeTuple(TupleClassifier.Type.TICK_TUPLE);
bolt.execute(tick);
Assert.assertEquals(collector.getEmittedCount(), 2);
Tuple expected = TupleUtils.makeTuple(TupleClassifier.Type.RESULT_TUPLE, "42", Clip.of(sent).add(rateLimitError.makeMeta()).asJSON(), new Metadata(Metadata.Signal.FAIL, null));
Assert.assertTrue(wasResultEmittedTo(TopologyConstants.RESULT_STREAM, expected));
Tuple metadata = TupleUtils.makeTuple(TupleClassifier.Type.FEEDBACK_TUPLE, "42", new Metadata(Metadata.Signal.KILL, null));
Assert.assertTrue(wasMetadataEmittedTo(TopologyConstants.FEEDBACK_STREAM, metadata));
}
Aggregations