github-advanced-security[bot] commented on code in PR #19467:
URL: https://github.com/apache/druid/pull/19467#discussion_r3251234921


##########
indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskRunnerTest.java:
##########
@@ -371,6 +265,125 @@
     }
   }
 
+  private TestSeekableStreamIndexTaskRunner createRunner()
+  {
+    return createRunner(createDataSchema(), null, null, null);
+  }
+
+  private TestSeekableStreamIndexTaskRunner createRunnerWithMessageTimeBounds(
+      Long refreshRejectionPeriodsInMinutes,
+      DateTime minMessageTime,
+      DateTime maxMessageTime
+  )
+  {
+    return createRunner(
+        createDataSchema(),
+        refreshRejectionPeriodsInMinutes,
+        minMessageTime,
+        maxMessageTime
+    );
+  }
+
+  private TestSeekableStreamIndexTaskRunner createRunner(
+      DataSchema schema,
+      @Nullable Long refreshRejectionPeriodsInMinutes,
+      @Nullable DateTime minMessageTime,
+      @Nullable DateTime maxMessageTime
+  )
+  {
+    final SeekableStreamIndexTaskTuningConfig tuningConfig = 
Mockito.mock(SeekableStreamIndexTaskTuningConfig.class);
+    final SeekableStreamIndexTaskIOConfig<String, String> ioConfig = 
Mockito.mock(SeekableStreamIndexTaskIOConfig.class);
+    final SeekableStreamStartSequenceNumbers<String, String> sequenceNumbers = 
new SeekableStreamStartSequenceNumbers<>(
+        "test",
+        ImmutableMap.of(),
+        ImmutableSet.of()
+    );
+    final SeekableStreamEndSequenceNumbers<String, String> endSequenceNumbers 
= new SeekableStreamEndSequenceNumbers<>(
+        "test",
+        ImmutableMap.of()
+    );
+
+    
Mockito.when(ioConfig.getRefreshRejectionPeriodsInMinutes()).thenReturn(refreshRejectionPeriodsInMinutes);
+    Mockito.when(ioConfig.getMaximumMessageTime()).thenReturn(maxMessageTime);
+    Mockito.when(ioConfig.getMinimumMessageTime()).thenReturn(minMessageTime);
+    Mockito.when(ioConfig.getInputFormat()).thenReturn(new 
JsonInputFormat(null, null, null, null, null));
+    
Mockito.when(ioConfig.getStartSequenceNumbers()).thenReturn(sequenceNumbers);
+    
Mockito.when(ioConfig.getEndSequenceNumbers()).thenReturn(endSequenceNumbers);
+
+    Mockito.when(task.getDataSchema()).thenReturn(schema);
+    Mockito.when(task.getIOConfig()).thenReturn(ioConfig);
+    Mockito.when(task.getTuningConfig()).thenReturn(tuningConfig);
+
+    return new TestSeekableStreamIndexTaskRunner(
+        task,
+        LockGranularity.TIME_CHUNK
+    );
+  }
+
+  private static DataSchema createDataSchema()
+  {
+    final DimensionsSpec dimensionsSpec = new DimensionsSpec(
+        Arrays.asList(
+            new StringDimensionSchema("d1"),
+            new StringDimensionSchema("d2")
+        )
+    );
+    return DataSchema.builder()
+                     .withDataSource(DATA_SOURCE)
+                     .withTimestamp(TimestampSpec.DEFAULT)
+                     .withDimensions(dimensionsSpec)
+                     .withGranularity(
+                         new UniformGranularitySpec(Granularities.MINUTE, 
Granularities.NONE, null)
+                     )
+                     .build();
+  }
+
+  private static void setSequences(
+      SeekableStreamIndexTaskRunner runner,
+      CopyOnWriteArrayList<? extends SequenceMetadata> sequences
+  ) throws NoSuchFieldException, IllegalAccessException
+  {
+    final Field sequencesField = 
SeekableStreamIndexTaskRunner.class.getDeclaredField("sequences");
+    sequencesField.setAccessible(true);
+    sequencesField.set(runner, sequences);
+  }
+
+  private static class ShrinkingCopyOnWriteArrayList<E> extends 
CopyOnWriteArrayList<E>
+  {

Review Comment:
   ## CodeQL / No clone method
   
   No clone method, yet implements Cloneable.
   
   [Show more 
details](https://github.com/apache/druid/security/code-scanning/11230)



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to