@BeforeMethod public void setup() { emitter = new CustomEmitter(); spout = ComponentUtils.open(new TickSpout(new BulletStormConfig()), emitter); }
@Test public void testEmittingAtTickIntervals() throws InterruptedException { long timeNow = System.currentTimeMillis(); int interval = 100000; BulletStormConfig config = new BulletStormConfig(); config.set(BulletStormConfig.TICK_SPOUT_INTERVAL, interval); spout = ComponentUtils.open(new TickSpout(config), emitter); spout.nextTuple(); Assert.assertEquals(spout.getTickInterval(), interval); Assert.assertEquals(emitter.getEmitted().size(), 0); forceTickByLastTickTime(timeNow - interval); Tuple expected = TupleUtils.makeTuple(TupleClassifier.Type.TICK_TUPLE, spout.getId(), 1L); Assert.assertTrue(emitter.wasTupleEmittedTo(expected, TopologyConstants.TICK_STREAM)); } }
.setCPULoad(querySpoutCPULoad).setMemoryLoad(querySpoutMemoryOnHeapLoad, querySpoutMemoryOffHeapLoad); builder.setSpout(TICK_COMPONENT, new TickSpout(config), tickSpoutParallelism) .setCPULoad(tickSpoutCPULoad).setMemoryLoad(tickSpoutMemoryOnheapLoad, tickSpoutMemoryOffHeapLoad);
.setCPULoad(querySpoutCPULoad).setMemoryLoad(querySpoutMemoryOnHeapLoad, querySpoutMemoryOffHeapLoad); builder.setSpout(TICK_COMPONENT, new TickSpout(config), tickSpoutParallelism) .setCPULoad(tickSpoutCPULoad).setMemoryLoad(tickSpoutMemoryOnheapLoad, tickSpoutMemoryOffHeapLoad);