github-advanced-security[bot] commented on code in PR #15817:
URL: https://github.com/apache/druid/pull/15817#discussion_r1490585861
##########
indexing-service/src/test/java/org/apache/druid/indexing/seekablestream/SequenceMetadataTest.java:
##########
@@ -110,11 +122,55 @@
ImmutableMap.of(),
ImmutableMap.of(),
true,
- ImmutableSet.of(),
+ ImmutableSet.of(0),
null
);
TransactionalSegmentPublisher transactionalSegmentPublisher =
sequenceMetadata.createPublisher(mockSeekableStreamIndexTaskRunner,
mockTaskToolbox, false);
- transactionalSegmentPublisher.publishAnnotatedSegments(null,
notNullNotEmptySegment, ImmutableMap.of());
+ transactionalSegmentPublisher.publishAnnotatedSegments(null,
notNullNotEmptySegment, ImmutableMap.of(), null);
+
+ transactionalSegmentPublisher =
sequenceMetadata.createPublisher(mockSeekableStreamIndexTaskRunner,
mockTaskToolbox, true);
+
+ transactionalSegmentPublisher.publishAnnotatedSegments(null,
notNullNotEmptySegment, ImmutableMap.of(), null);
+ }
+
+ @Test
+ public void testCanHandle()
+ {
+ SequenceMetadata<Integer, Integer> sequenceMetadata = new
SequenceMetadata<>(
+ 1,
+ "test",
+ ImmutableMap.of(0, 0),
+ ImmutableMap.of(),
+ true,
+ ImmutableSet.of(0),
+ null
+ );
+
+ OrderedPartitionableRecord<Integer, Integer, ?> record = new
OrderedPartitionableRecord<>(
+ "stream",
+ 0,
+ 0,
+ Collections.singletonList(new
ByteEntity(StringUtils.toUtf8("unparseable")))
+ );
+
+
Mockito.when(mockSeekableStreamIndexTaskRunner.createSequenceNumber(ArgumentMatchers.any())).thenReturn(makeSequenceNumber("1",
false));
+
Mockito.when(mockSeekableStreamIndexTaskRunner.isEndOffsetExclusive()).thenReturn(true);
+
Assert.assertFalse(sequenceMetadata.canHandle(mockSeekableStreamIndexTaskRunner,
record));
+
+
Mockito.when(mockSeekableStreamIndexTaskRunner.isEndOffsetExclusive()).thenReturn(false);
+
Assert.assertFalse(sequenceMetadata.canHandle(mockSeekableStreamIndexTaskRunner,
record));
+ }
+
+ private OrderedSequenceNumber<String> makeSequenceNumber(String seq, boolean
isExclusive)
+ {
+ return new OrderedSequenceNumber<String>(seq, isExclusive)
Review Comment:
## Inconsistent compareTo
This class declares [compareTo](1) but inherits equals; the two could be
inconsistent.
[Show more
details](https://github.com/apache/druid/security/code-scanning/6574)
--
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]