Phillippko commented on code in PR #4186:
URL: https://github.com/apache/ignite-3/pull/4186#discussion_r1705563291
##########
modules/cluster-management/src/main/java/org/apache/ignite/internal/cluster/management/ClusterTag.java:
##########
@@ -45,7 +45,22 @@ public interface ClusterTag extends NetworkMessage,
Serializable {
* @param name Cluster name.
* @return Cluster tag instance.
*/
- static ClusterTag clusterTag(CmgMessagesFactory msgFactory, String name) {
+ static ClusterTag randomClusterTag(CmgMessagesFactory msgFactory, String
name) {
+ return msgFactory.clusterTag()
+ .clusterName(name)
+ .clusterId(UUID.randomUUID())
+ .build();
+ }
+
+ /**
+ * Creates a new cluster tag instance. Acts like a constructor replacement.
+ *
+ * @param msgFactory Message factory to instantiate builder.
+ * @param name Cluster name.
+ * @param clusterId Cluster ID.
+ * @return Cluster tag instance.
+ */
+ static ClusterTag clusterTag(CmgMessagesFactory msgFactory, String name,
UUID clusterId) {
return msgFactory.clusterTag()
.clusterName(name)
.clusterId(UUID.randomUUID())
Review Comment:
clusterID is ignored. Strange, that IDEA doesn't grey out unused parameters
##########
modules/client-handler/src/integrationTest/java/org/apache/ignite/client/handler/TestServer.java:
##########
@@ -126,7 +127,7 @@ ClientHandlerModule start(TestInfo testInfo) {
mock(IgniteComputeInternal.class),
clusterService,
bootstrapFactory,
- () ->
CompletableFuture.completedFuture(ClusterTag.clusterTag(msgFactory, "Test
Server")),
+ () ->
CompletableFuture.completedFuture(ClusterTag.clusterTag(msgFactory, "Test
Server", UUID.randomUUID())),
Review Comment:
randomClusterTag?
##########
modules/cluster-management/src/main/java/org/apache/ignite/internal/cluster/management/ClusterTag.java:
##########
@@ -45,7 +45,22 @@ public interface ClusterTag extends NetworkMessage,
Serializable {
* @param name Cluster name.
* @return Cluster tag instance.
*/
- static ClusterTag clusterTag(CmgMessagesFactory msgFactory, String name) {
+ static ClusterTag randomClusterTag(CmgMessagesFactory msgFactory, String
name) {
Review Comment:
I assume random tag should be used only in tests, let's annotate it as
TestOnly?
If it's really only for tests, do we really need a separate method? Name is
changed, so we have to change all test classes in any case))
##########
modules/cluster-management/src/test/java/org/apache/ignite/internal/cluster/management/raft/AbstractClusterStateStorageManagerTest.java:
##########
@@ -74,7 +73,7 @@ void tearDown() {
*/
@Test
void testClusterState() {
- ClusterTag clusterTag1 = clusterTag(msgFactory, "cluster");
+ ClusterTag clusterTag1 = ClusterTag.randomClusterTag(msgFactory,
"cluster");
Review Comment:
static import?
--
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]