chirag-wadhwa5 commented on code in PR #16456:
URL: https://github.com/apache/kafka/pull/16456#discussion_r1669815168
##########
core/src/test/scala/unit/kafka/server/KafkaApisTest.scala:
##########
@@ -4390,6 +4401,2215 @@ class KafkaApisTest extends Logging {
assertEquals("broker2", node.host)
}
+ private def expectedAcquiredRecords(firstOffset : Long, lastOffset : Long,
deliveryCount : Int) : util.List[AcquiredRecords] = {
+ val acquiredRecordsList : util.List[AcquiredRecords] = new util.ArrayList()
+ acquiredRecordsList.add(new AcquiredRecords()
+ .setFirstOffset(firstOffset)
+ .setLastOffset(lastOffset)
+ .setDeliveryCount(deliveryCount.toShort))
+ acquiredRecordsList
+ }
+
+ private def memoryRecordsBuilder(numOfRecords : Int, startOffset : Long) :
MemoryRecordsBuilder = {
+
+ val buffer: ByteBuffer = ByteBuffer.allocate(1024)
+ val compression: Compression = Compression.of(CompressionType.NONE).build()
+ val timestampType: TimestampType = TimestampType.CREATE_TIME
+
+ val builder: MemoryRecordsBuilder = MemoryRecords.builder(buffer,
compression, timestampType, startOffset)
+ for (i <- 0 until numOfRecords) {
+ builder.appendWithOffset(startOffset + i, 0L, TestUtils.randomBytes(10),
TestUtils.randomBytes(10))
+ }
+ builder
+ }
Review Comment:
Yep, the true place for these methods should be in TestUtils file, but both
SharePartitionTest and KafkaApisTest import separate TestUtils files.
SharePartitionTest use the Java one and KafkaApisTest use the scala one. As far
as I know, java does not support aliasing and neither do the older versions of
scala.
--
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]