shishkovilja commented on code in PR #13835:
URL: https://github.com/apache/ignite/pull/13835#discussion_r4613534400


##########
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java:
##########
@@ -699,9 +699,19 @@ private void 
deactivateActiveOrNotClusterWithCheckClusterNameInConfirmation(
     ) {
         deactivateWithCheckClusterNameInConfirmation(igniteEx, clusterName);
 
-        igniteEx.cluster().state(ACTIVE);
+        injectTestSystemIn(CONFIRM_MSG);
+
+        assertEquals(EXIT_CODE_OK, execute("--set-state", "ACTIVE"));

Review Comment:
   "ACTIVE" does not match with "Deactivate" in metod name.



##########
modules/core/src/main/java/org/apache/ignite/internal/management/SetStateCommand.java:
##########
@@ -70,4 +78,29 @@ public class SetStateCommand implements 
NativeCommand<SetStateCommandArg, Boolea
         return "Warning: the command will change state of cluster " +
             "with name \"" + arg.clusterName() + "\" to " + arg.state() + ".";
     }
+
+    /** {@inheritDoc} */
+    @Override public boolean prepare(
+        @Nullable IgniteClient client,
+        @Nullable Ignite ignite,
+        SetStateCommandArg arg,
+        Consumer<String> printer
+    ) throws Exception {
+        arg.clusterName(clusterName(client, ignite));
+
+        return true;
+    }
+
+    /** */
+    static String clusterName(@Nullable IgniteClient client, @Nullable Ignite 
ignite) throws Exception {
+        if (ignite != null)
+            return ((IgniteEx)ignite).context().cluster().clusterName();
+
+        ClusterNode node = F.first(CommandUtils.nodes(client, ignite));

Review Comment:
   Not critical: `nodes` return also client node. Should we add filter here?



-- 
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]

Reply via email to