srdo commented on a change in pull request #2911: STORM-2720 : Add TIMESTAMP 
option for FirstPollOffset for Kafka Trident spout
URL: https://github.com/apache/storm/pull/2911#discussion_r282131071
 
 

 ##########
 File path: 
external/storm-kafka-client/src/test/java/org/apache/storm/kafka/spout/trident/KafkaTridentSpoutEmitterEmitTest.java
 ##########
 @@ -303,4 +315,38 @@ public void testLatestStrategyWhenTopologyIsRedeployed() {
         verify(collectorMock, never()).emit(anyList());
     }
 
+    @Test
+    public void testTimeStampStrategyWhenTopologyIsRedeployed() {
+        /**
+         * TIMESTAMP strategy should be applied if the emitter is new and the 
topology has been redeployed (storm id has changed)
+         * Offset should be reset according to the offset corresponding to 
startTimeStamp
+         */
+        long preRestartEmittedOffset = 20;
+        int preRestartEmittedRecords = 10;
+        long timeStampStartOffset = 2L;
+        long pollTimeout = 1L;
+        KafkaTridentSpoutBatchMetadata preExecutorRestartLastMeta = new 
KafkaTridentSpoutBatchMetadata(preRestartEmittedOffset, preRestartEmittedOffset 
+ preRestartEmittedRecords - 1, "Some older topology");
+
+        Consumer kafkaConsumer = Mockito.mock(Consumer.class);
 
 Review comment:
   This is a nitpick, but consider using partial mocking for this instead 
(https://static.javadoc.io/org.mockito/mockito-core/2.27.0/org/mockito/Mockito.html#partial_mocks),
 and wrap a real KafkaConsumer. That way you won't have to specify as much 
behavior for the consumer, and the test will be easier to maintain.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to