frankvicky commented on code in PR #19805:
URL: https://github.com/apache/kafka/pull/19805#discussion_r2113308547
##########
core/src/test/scala/unit/kafka/log/LogCleanerManagerTest.scala:
##########
@@ -396,7 +396,7 @@ class LogCleanerManagerTest extends Logging {
assertEquals(0, deletableLog2.size, "should have 0 logs ready to be
deleted")
Review Comment:
Could we change `cleanerCheckpoints` to `java.util.HashMap` ? (L63)
##########
core/src/test/scala/unit/kafka/log/LogConfigTest.scala:
##########
@@ -142,7 +142,7 @@ class LogConfigTest {
/* Sanity check that toHtml produces one of the expected configs */
@Test
def testToHtml(): Unit = {
- val html = LogConfig.configDefCopy.toHtml(4, (key: String) => "prefix_" +
key, Collections.emptyMap())
+ val html = LogConfig.configDefCopy.toHtml(4, (key: String) => "prefix_" +
key, java.util.Map.of)
Review Comment:
import `java.util`
##########
core/src/test/scala/unit/kafka/network/SocketServerTest.scala:
##########
@@ -85,7 +85,7 @@ class SocketServerTest {
TestUtils.clearYammerMetrics()
Review Comment:
Could we change `mutable.Map` to `java.util.Map` in L2162?
##########
core/src/test/scala/unit/kafka/security/authorizer/AuthorizerTest.scala:
##########
@@ -567,7 +567,7 @@ class AuthorizerTest extends QuorumTestHarness with
BaseAuthorizerTest {
val acl3 = new AclBinding(resource2, new
AccessControlEntry(principal.toString, WILDCARD_HOST, DESCRIBE, ALLOW))
val acl4 = new AclBinding(prefixedResource, new
AccessControlEntry(wildcardPrincipal.toString, WILDCARD_HOST, READ, ALLOW))
- authorizer1.createAcls(requestContext, List(acl1, acl2, acl3, acl4).asJava)
+ authorizer1.createAcls(requestContext, util.List.of(acl1, acl2, acl3,
acl4))
assertEquals(Set(acl1, acl2, acl3, acl4),
authorizer1.acls(AclBindingFilter.ANY).asScala.toSet)
Review Comment:
Could we change it to `java.util.Set`?
##########
core/src/test/scala/unit/kafka/log/LogLoaderTest.scala:
##########
@@ -392,12 +392,12 @@ class LogLoaderTest {
codec: Compression =
Compression.NONE,
timestamp: Long =
RecordBatch.NO_TIMESTAMP,
magicValue: Byte =
RecordBatch.CURRENT_MAGIC_VALUE): MemoryRecords = {
- val records = Seq(new SimpleRecord(timestamp, key, value))
+ val records = java.util.List.of(new SimpleRecord(timestamp, key, value))
Review Comment:
ditto
##########
core/src/test/scala/unit/kafka/log/UnifiedLogTest.scala:
##########
@@ -231,7 +231,7 @@ class UnifiedLogTest {
reopened.truncateFullyAndStartAt(2L, Optional.of(1L))
assertEquals(Optional.empty, reopened.firstUnstableOffset)
- assertEquals(java.util.Collections.emptyMap(),
reopened.producerStateManager.activeProducers)
+ assertEquals(java.util.Map.of,
reopened.producerStateManager.activeProducers)
Review Comment:
ditto
##########
core/src/test/scala/unit/kafka/network/ProcessorTest.scala:
##########
@@ -41,7 +41,7 @@ class ProcessorTest {
val requestHeader = RequestTestUtils.serializeRequestHeader(
new RequestHeader(ApiKeys.INIT_PRODUCER_ID, 0, "clientid", 0))
val apiVersionManager = new
SimpleApiVersionManager(ListenerType.CONTROLLER, true,
- () => new FinalizedFeatures(MetadataVersion.latestTesting(),
Collections.emptyMap[String, java.lang.Short], 0))
+ () => new FinalizedFeatures(MetadataVersion.latestTesting(),
java.util.Map.of[String, java.lang.Short], 0))
Review Comment:
ditto
##########
core/src/test/scala/unit/kafka/network/RequestChannelTest.scala:
##########
@@ -64,9 +62,9 @@ class RequestChannelTest {
def testAlterRequests(): Unit = {
val sensitiveValue = "secret"
- def verifyConfig(resource: ConfigResource, entries: Seq[ConfigEntry],
expectedValues: Map[String, String]): Unit = {
+ def verifyConfig(resource: ConfigResource, entries:
java.util.List[ConfigEntry], expectedValues: Map[String, String]): Unit = {
Review Comment:
ditto
##########
core/src/test/scala/unit/kafka/log/LogCleanerManagerTest.scala:
##########
@@ -501,7 +501,7 @@ class LogCleanerManagerTest extends Logging {
val pausedPartitions =
cleanerManager.pauseCleaningForNonCompactedPartitions()
// Log truncation happens due to unclean leader election
cleanerManager.abortAndPauseCleaning(log.topicPartition)
- cleanerManager.resumeCleaning(Set(log.topicPartition).asJava)
+ cleanerManager.resumeCleaning(util.Set.of(log.topicPartition))
// log cleanup finishes and pausedPartitions are resumed
cleanerManager.resumeCleaning(pausedPartitions.asScala.map(_.getKey).toSet.asJava)
Review Comment:
Could we eliminate the conversion?
Additionally, there are some similar patterns in this test; please clean
them up.
--
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]