kamalcph commented on code in PR #16173:
URL: https://github.com/apache/kafka/pull/16173#discussion_r1624832048
##########
storage/src/test/java/org/apache/kafka/server/log/remote/storage/RemoteLogManagerConfigTest.java:
##########
@@ -105,4 +140,59 @@ private Map<String, Object>
extractProps(RemoteLogManagerConfig remoteLogManager
remoteLogManagerConfig.remoteLogMetadataManagerPrefix());
return props;
}
+
+ @Test
+ public void testHashCodeAndEquals_ForAllAndTwoFields() {
+ String rsmPrefix = "__custom.rsm.";
+ String rlmmPrefix = "__custom.rlmm.";
+ Map<String, Object> rsmProps = Collections.singletonMap("rsm.prop",
"val");
+ Map<String, Object> rlmmProps = Collections.singletonMap("rlmm.prop",
"val");
+ RemoteLogManagerConfig config1 = getRemoteLogManagerConfig(false,
+ rsmPrefix,
+ rlmmPrefix,
+ rsmProps,
+ rlmmProps);
+ RemoteLogManagerConfig config2 = getRemoteLogManagerConfig(false,
+ rsmPrefix,
+ rlmmPrefix,
+ rsmProps,
+ rlmmProps);
+
+ // Initially, hash codes should be equal for default objects
+ assertEquals(config1.hashCode(), config2.hashCode());
+
+ // Initially, objects should be equal
+ assertEquals(config1, config2);
+
+ // Test for specific field remoteLogManagerCopierThreadPoolSize
+ RemoteLogManagerConfig config3 = new RemoteLogManagerConfig(true,
"dummy.remote.storage.class",
+ "dummy.remote.storage.class.path",
+ "dummy.remote.log.metadata.class",
"dummy.remote.log.metadata.class.path",
+ "listener.name",
+ 1024 * 1024L,
+ 1,
+ 2, // Change here
+ 2, // Change here
+ 60000L,
+ 100L,
+ 60000L,
+ 0.3,
+ 10,
+ 100,
+ 100,
+ rsmPrefix,
+ rsmProps,
+ rlmmPrefix,
+ rlmmProps,
+ Long.MAX_VALUE,
+ 11,
+ 1,
+ Long.MAX_VALUE,
+ 11,
+ 1);
+
+
Review Comment:
nit: remove two extra empty lines.
--
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]