use of org.apache.storm.spout.RawScheme in project kafka-spout by HolmesNL.
the class KafkaSpoutBufferBehaviourTest method setup.
@Before
public void setup() {
final Scheme scheme = spy(new RawScheme());
// main test subject
_subject = new KafkaSpout(scheme);
// assign the topic to be used for stream retrieval
_subject._topic = "test-topic";
// use a buffer size higher than the expected amount of messages available
_subject._bufSize = 4;
// assign the default FailHandler
_subject._failHandler = ConfigUtils.DEFAULT_FAIL_HANDLER;
// mocked consumer to avoid actually contacting zookeeper
_consumer = mock(ConsumerConnector.class);
// ... but make sure it will return a valid (empty) stream
when(_consumer.createMessageStreams(any(Map.class))).thenReturn(EMPTY_STREAM);
// assign the consumer to the test subject
_subject._consumer = _consumer;
// provide a mocked collector to be able to check for emitted values
_subject._collector = mock(SpoutOutputCollector.class);
}
Aggregations