Github user askprasanna commented on a diff in the pull request:
https://github.com/apache/storm/pull/2156#discussion_r121341911
--- Diff:
external/storm-kafka-client/src/test/java/org/apache/storm/kafka/spout/KafkaSpoutEmitTest.java
---
@@ -134,110 +130,86 @@ public void
testNextTupleEmitsFailedMessagesEvenWhenMaxUncommittedOffsetsIsExcee
Time.advanceTime(50);
//No backoff for test retry service, just check that messages
will retry immediately
- for (int i = 0; i < recordsForPartition.size(); i++) {
+ for (int i = 0; i < numRecords; i++) {
spout.nextTuple();
}
ArgumentCaptor<KafkaSpoutMessageId> retryMessageIds =
ArgumentCaptor.forClass(KafkaSpoutMessageId.class);
- verify(collectorMock,
times(recordsForPartition.size())).emit(anyObject(), anyObject(),
retryMessageIds.capture());
+ verify(collectorMock, times(numRecords)).emit(anyObject(),
anyObject(), retryMessageIds.capture());
//Verify that the poll started at the earliest retriable tuple
offset
List<Long> failedOffsets = new ArrayList<>();
- for(KafkaSpoutMessageId msgId : messageIds.getAllValues()) {
+ for (KafkaSpoutMessageId msgId : messageIds.getAllValues()) {
failedOffsets.add(msgId.offset());
}
InOrder inOrder = inOrder(consumerMock);
inOrder.verify(consumerMock).seek(partition,
failedOffsets.get(0));
inOrder.verify(consumerMock).poll(anyLong());
}
}
-
+
+ private List<ConsumerRecord<String, String>>
createRecords(TopicPartition topic, long startingOffset, int numRecords) {
+ List<ConsumerRecord<String, String>> recordsForPartition = new
ArrayList<>();
+ for (int i = 0; i < numRecords; i++) {
+ recordsForPartition.add(new ConsumerRecord(topic.topic(),
topic.partition(), startingOffset + i, "key", "value"));
--- End diff --
Nit: return generic ConsumerRecords to avoid warning around raw type
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---