use of com.yahoo.bullet.storm.testing.CustomCollector in project bullet-storm by yahoo.
the class FilterBoltTest method testNoConsumptionAfterDone.
@Test
public void testNoConsumptionAfterDone() {
Tuple query = makeIDTuple(TupleClassifier.Type.QUERY_TUPLE, "42", makeSimpleAggregationFilterQuery("field", singletonList("b235gf23b"), EQUALS, RAW, 5, Window.Unit.RECORD, 1, Window.Unit.RECORD, 1), METADATA);
bolt.execute(query);
BulletRecord record = RecordBox.get().add("field", "b235gf23b").getRecord();
Tuple matching = makeRecordTuple(record);
bolt.execute(matching);
bolt.execute(matching);
bolt.execute(matching);
Tuple expected = makeSlidingTuple(TupleClassifier.Type.DATA_TUPLE, "42", record);
Assert.assertTrue(wasRawRecordEmittedTo(TopologyConstants.DATA_STREAM, 3, expected));
collector = new CustomCollector();
// Will be done after 2 consumes (no ticks)
bolt = ComponentUtils.prepare(new DonableFilterBolt(2, 1, new BulletStormConfig()), collector);
bolt.execute(query);
bolt.execute(matching);
bolt.execute(matching);
// Now the query should be done, so it should not consume
bolt.execute(matching);
Assert.assertTrue(wasRawRecordEmittedTo(TopologyConstants.DATA_STREAM, 2, expected));
}
use of com.yahoo.bullet.storm.testing.CustomCollector in project bullet-storm by yahoo.
the class JoinBoltTest method setup.
public void setup(JoinBolt bolt) {
collector = new CustomCollector();
context = new CustomTopologyContext();
this.bolt = ComponentUtils.prepare(new HashMap<>(), bolt, context, collector);
}
use of com.yahoo.bullet.storm.testing.CustomCollector in project bullet-storm by yahoo.
the class LoopBoltTest method setup.
@BeforeMethod
public void setup() {
config = new BulletStormConfig("src/test/resources/test_config.yaml");
bolt = new LoopBolt(config);
collector = new CustomCollector();
ComponentUtils.prepare(bolt, collector);
publisher = (CustomPublisher) bolt.getPublisher();
}
use of com.yahoo.bullet.storm.testing.CustomCollector in project bullet-storm by yahoo.
the class QueryBoltTest method testNullMetaTupleIgnored.
@Test
public void testNullMetaTupleIgnored() {
CustomCollector collector = new CustomCollector();
TestQueryBolt bolt = new TestQueryBolt(new BulletStormConfig());
ComponentUtils.prepare(bolt, collector);
Map<String, Querier> queries = bolt.getQueries();
queries.put("foo", null);
Tuple meta = makeIDTuple(Type.METADATA_TUPLE, "foo", null);
bolt.execute(meta);
Assert.assertTrue(queries.containsKey("foo"));
}
use of com.yahoo.bullet.storm.testing.CustomCollector in project bullet-storm by yahoo.
the class QueryBoltTest method testMetricsUpdateOnMetricsDisabled.
@Test
public void testMetricsUpdateOnMetricsDisabled() {
CustomTopologyContext context = new CustomTopologyContext();
CustomCollector collector = new CustomCollector();
TestQueryBolt bolt = new TestQueryBolt(new BulletStormConfig());
ComponentUtils.prepare(new HashMap<>(), bolt, context, collector);
Assert.assertFalse(bolt.isMetricsEnabled());
bolt.execute(null);
IMetric averager = context.getRegisteredMetricByName("foo");
IMetric counter = context.getRegisteredMetricByName("bar");
Assert.assertNull(averager.getValueAndReset());
Assert.assertEquals(counter.getValueAndReset(), 0L);
}
Aggregations