use of com.yahoo.bullet.storm.testing.TupleUtils.makeRawTuple in project bullet-storm by yahoo.
the class FilterBoltTest method testTuplesCustomSource.
@Test
public void testTuplesCustomSource() {
bolt = ComponentUtils.prepare(new FilterBolt("CustomSource", oneRecordConfig()), collector);
Tuple query = makeIDTuple(TupleClassifier.Type.QUERY_TUPLE, "42", makeFieldFilterQuery("b235gf23b"), METADATA);
bolt.execute(query);
BulletRecord record = RecordBox.get().add("field", "b235gf23b").getRecord();
Tuple matching = TupleUtils.makeRawTuple("CustomSource", TopologyConstants.RECORD_STREAM, record);
bolt.execute(matching);
Tuple tick = TupleUtils.makeTuple(TupleClassifier.Type.TICK_TUPLE);
bolt.execute(tick);
BulletRecord anotherRecord = RecordBox.get().add("field", "wontmatch").getRecord();
Tuple nonMatching = TupleUtils.makeRawTuple("CustomSource", TopologyConstants.RECORD_STREAM, anotherRecord);
bolt.execute(nonMatching);
Tuple expected = makeDataTuple(TupleClassifier.Type.DATA_TUPLE, "42", record);
Assert.assertTrue(wasRawRecordEmittedTo(TopologyConstants.DATA_STREAM, 1, expected));
Tuple notExpected = makeDataTuple(TupleClassifier.Type.DATA_TUPLE, "42", anotherRecord);
Assert.assertFalse(wasRawRecordEmitted(notExpected));
}
Aggregations