use of org.apache.storm.task.TopologyContext in project kafka-spout by HolmesNL.
the class KafkaSpoutConstructorTest method testOpenWithDefaultConstructor.
/**
* Using the default constructor, a topic name must be in the storm config
*/
@Test
public void testOpenWithDefaultConstructor() {
KafkaSpout spout = spy(new KafkaSpout());
TopologyContext topology = mock(TopologyContext.class);
SpoutOutputCollector collector = mock(SpoutOutputCollector.class);
Map<String, Object> config = new HashMap<String, Object>();
config.put(ConfigUtils.CONFIG_TOPIC, "topic");
doNothing().when(spout).createConsumer(config);
spout.open(config, topology, collector);
assertEquals("Wrong Topic Name", spout._topic, "topic");
}
use of org.apache.storm.task.TopologyContext in project heron by twitter.
the class CustomStreamGroupingDelegate method prepare.
@Override
public void prepare(org.apache.heron.api.topology.TopologyContext context, String component, String streamId, List<Integer> targetTasks) {
TopologyContext c = new TopologyContext(context);
GlobalStreamId g = new GlobalStreamId(component, streamId);
delegate.prepare(c, g, targetTasks);
}
Aggregations