This is an automated email from the ASF dual-hosted git repository.

namelchev pushed a commit to branch ignite-2.16
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/ignite-2.16 by this push:
     new c29f6ec35fe IGNITE-19830 Added a description check if the command 
argument is enum type. (#10818)
c29f6ec35fe is described below

commit c29f6ec35fef15dfb9fe094cc140fa68e2c4db38
Author: Nikita Amelchev <nsamelc...@gmail.com>
AuthorDate: Wed Nov 8 13:37:38 2023 +0300

    IGNITE-19830 Added a description check if the command argument is enum 
type. (#10818)
    
    (cherry picked from commit bc73d09652b31f7447e8d51fa798b55cd9157f4c)
---
 .../internal/commandline/CommandHandler.java       | 32 +++++++----
 .../commandline/CommandHandlerParsingTest.java     | 59 ++++++++++++++++++++
 .../management/ShutdownPolicyCommandArg.java       | 11 ++++
 .../internal/management/api/CommandUtils.java      | 21 +++----
 .../baseline/BaselineAutoAdjustCommandArg.java     | 11 ++++
 .../cache/CacheIdleVerifyCommandArg.java           | 21 ++++++-
 .../management/cache/CacheMetricsCommandArg.java   | 13 +++++
 .../consistency/ConsistencyRepairCommandArg.java   | 17 ++++++
 .../TracingConfigurationGetAllCommandArg.java      | 19 ++++++-
 .../tracing/TracingConfigurationGetCommandArg.java | 19 ++++++-
 .../internal/management/tx/TxCommandArg.java       | 15 ++++-
 ...mandHandlerClusterByClassTest_cache_help.output | 29 ++++++++--
 ...ridCommandHandlerClusterByClassTest_help.output | 65 ++++++++++++++++++++++
 ...dlerClusterByClassWithSSLTest_cache_help.output | 29 ++++++++--
 ...andHandlerClusterByClassWithSSLTest_help.output | 65 ++++++++++++++++++++++
 15 files changed, 387 insertions(+), 39 deletions(-)

diff --git 
a/modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/CommandHandler.java
 
b/modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/CommandHandler.java
index 8a3257e3c5d..eb941fca538 100644
--- 
a/modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/CommandHandler.java
+++ 
b/modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/CommandHandler.java
@@ -89,6 +89,7 @@ import static 
org.apache.ignite.internal.management.api.CommandUtils.PARAM_WORDS
 import static 
org.apache.ignite.internal.management.api.CommandUtils.asOptional;
 import static org.apache.ignite.internal.management.api.CommandUtils.cmdText;
 import static 
org.apache.ignite.internal.management.api.CommandUtils.executable;
+import static 
org.apache.ignite.internal.management.api.CommandUtils.hasDescription;
 import static org.apache.ignite.internal.management.api.CommandUtils.join;
 import static 
org.apache.ignite.internal.management.api.CommandUtils.parameterExample;
 import static 
org.apache.ignite.internal.management.api.CommandUtils.toFormattedCommandName;
@@ -867,16 +868,15 @@ public class CommandHandler {
                         );
                     };
 
-                    if (!fld.isAnnotationPresent(EnumDescription.class)) {
-                        logParam.accept(
-                            parameterExample(fld, false),
-                            fld.getAnnotation(Argument.class).description()
-                        );
-                    }
-                    else {
+                    logParam.accept(
+                        parameterExample(fld, false),
+                        fld.getAnnotation(Argument.class).description()
+                    );
+
+                    if (fld.isAnnotationPresent(EnumDescription.class)) {
                         EnumDescription enumDesc = 
fld.getAnnotation(EnumDescription.class);
 
-                        String[] names = enumDesc.names();
+                        String[] names = formattedEnumNames(fld);
                         String[] descriptions = enumDesc.descriptions();
 
                         for (int i = 0; i < names.length; i++)
@@ -964,6 +964,15 @@ public class CommandHandler {
         logger.info(bldr.toString());
     }
 
+    /** */
+    private static String[] formattedEnumNames(Field fld) {
+        EnumDescription desc = fld.getAnnotation(EnumDescription.class);
+
+        String indent = fld.isAnnotationPresent(Positional.class) ? "" : 
INDENT;
+
+        return Arrays.stream(desc.names()).map(s -> indent + 
s).toArray(String[]::new);
+    }
+
     /** */
     private static class LengthCalculator implements Consumer<Field> {
         /** */
@@ -971,12 +980,13 @@ public class CommandHandler {
 
         /** {@inheritDoc} */
         @Override public void accept(Field fld) {
+            if (!hasDescription(fld))
+                return;
+
             length = Math.max(length, parameterExample(fld, false).length());
 
             if (fld.isAnnotationPresent(EnumDescription.class)) {
-                EnumDescription enumDesc = 
fld.getAnnotation(EnumDescription.class);
-
-                for (String name : enumDesc.names())
+                for (String name : formattedEnumNames(fld))
                     length = Math.max(length, name.length());
             }
         }
diff --git 
a/modules/control-utility/src/test/java/org/apache/ignite/internal/commandline/CommandHandlerParsingTest.java
 
b/modules/control-utility/src/test/java/org/apache/ignite/internal/commandline/CommandHandlerParsingTest.java
index bbb68b62e93..e8547e257d0 100644
--- 
a/modules/control-utility/src/test/java/org/apache/ignite/internal/commandline/CommandHandlerParsingTest.java
+++ 
b/modules/control-utility/src/test/java/org/apache/ignite/internal/commandline/CommandHandlerParsingTest.java
@@ -17,6 +17,7 @@
 
 package org.apache.ignite.internal.commandline;
 
+import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -27,6 +28,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 import java.util.UUID;
+import java.util.function.Consumer;
 import java.util.function.Predicate;
 import java.util.stream.Collectors;
 import org.apache.ignite.IgniteCheckedException;
@@ -44,11 +46,15 @@ import 
org.apache.ignite.internal.management.ShutdownPolicyCommand;
 import org.apache.ignite.internal.management.ShutdownPolicyCommandArg;
 import org.apache.ignite.internal.management.SystemViewCommand;
 import org.apache.ignite.internal.management.WarmUpCommand;
+import org.apache.ignite.internal.management.api.Argument;
 import org.apache.ignite.internal.management.api.BeforeNodeStartCommand;
 import org.apache.ignite.internal.management.api.Command;
+import org.apache.ignite.internal.management.api.CommandsRegistry;
 import org.apache.ignite.internal.management.api.ComputeCommand;
+import org.apache.ignite.internal.management.api.EnumDescription;
 import org.apache.ignite.internal.management.api.HelpCommand;
 import org.apache.ignite.internal.management.api.LocalCommand;
+import org.apache.ignite.internal.management.api.Positional;
 import org.apache.ignite.internal.management.baseline.BaselineAddCommand;
 import org.apache.ignite.internal.management.baseline.BaselineAddCommandArg;
 import org.apache.ignite.internal.management.baseline.BaselineCommand;
@@ -87,6 +93,7 @@ import org.junit.Test;
 import org.junit.rules.TestRule;
 
 import static java.util.Arrays.asList;
+import static java.util.Arrays.stream;
 import static java.util.Collections.emptySet;
 import static java.util.Collections.singletonList;
 import static 
org.apache.ignite.IgniteSystemProperties.IGNITE_ENABLE_EXPERIMENTAL_COMMAND;
@@ -95,6 +102,8 @@ import static 
org.apache.ignite.internal.commandline.ArgumentParser.CMD_VERBOSE;
 import static org.apache.ignite.internal.commandline.CommandHandler.DFLT_HOST;
 import static org.apache.ignite.internal.commandline.CommandHandler.DFLT_PORT;
 import static org.apache.ignite.internal.management.api.CommandUtils.cmdText;
+import static 
org.apache.ignite.internal.management.api.CommandUtils.executable;
+import static 
org.apache.ignite.internal.management.api.CommandUtils.visitCommandParams;
 import static org.apache.ignite.testframework.GridTestUtils.assertThrows;
 import static org.apache.ignite.util.CdcCommandTest.DELETE_LOST_SEGMENT_LINKS;
 import static 
org.apache.ignite.util.GridCommandHandlerIndexingCheckSizeTest.CACHE;
@@ -1283,6 +1292,56 @@ public class CommandHandlerParsingTest {
         assertNotNull(parseArgs(asList("--warm-up", "--stop")));
     }
 
+    /** Tests that enum {@link Argument} has enum constants description: 
{@link EnumDescription}. */
+    @Test
+    public void testEnumParameterDescription() {
+        new IgniteCommandRegistry().commands().forEachRemaining(e -> 
checkEnumDescription(e.getValue()));
+    }
+
+    /** */
+    private void checkEnumDescription(Command<?, ?> cmd) {
+        if (cmd instanceof CommandsRegistry)
+            ((CommandsRegistry<?, ?>)cmd).commands().forEachRemaining(e -> 
checkEnumDescription(e.getValue()));
+
+        if (!executable(cmd))
+            return;
+
+        Consumer<Field> fldCnsmr = fld -> {
+            if (!fld.getType().isEnum())
+                return;
+
+            EnumDescription descAnn = fld.getAnnotation(EnumDescription.class);
+
+            assertNotNull("Please, specify a description to the enum parameter 
using " +
+                "@" + EnumDescription.class.getSimpleName() + " annotation. " +
+                "Parameter: " + cmd.argClass().getSimpleName() + "#" + 
fld.getName(),
+                descAnn);
+
+            assertEquals("Please, specify a description to enum constants: " +
+                    stream(fld.getType().getEnumConstants())
+                        .filter(e -> stream(descAnn.names()).noneMatch(n -> 
n.equals(((Enum<?>)e).name())))
+                        .collect(Collectors.toSet()) +
+                    ". Parameter: " + cmd.argClass().getSimpleName() + "#" + 
fld.getName(),
+                fld.getType().getEnumConstants().length, 
descAnn.names().length);
+
+            Argument argAnn = fld.getAnnotation(Argument.class);
+            Positional posAnn = fld.getAnnotation(Positional.class);
+
+            if (posAnn == null) {
+                assertFalse("Please, set a description for the argument: " +
+                        cmd.argClass().getSimpleName() + "#" + fld.getName(),
+                    argAnn.description().isEmpty());
+            }
+            else {
+                assertTrue("Please, remove a description for the positional 
argument: " +
+                        cmd.argClass().getSimpleName() + "#" + fld.getName(),
+                    argAnn.description().isEmpty());
+            }
+        };
+
+        visitCommandParams(cmd.argClass(), fldCnsmr, fldCnsmr, (grp, flds) -> 
flds.forEach(fldCnsmr));
+    }
+
     /**
      * @param args Raw arg list.
      * @return Common parameters container object.
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/management/ShutdownPolicyCommandArg.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/management/ShutdownPolicyCommandArg.java
index 2142aba0be7..ced1738419b 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/management/ShutdownPolicyCommandArg.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/management/ShutdownPolicyCommandArg.java
@@ -23,6 +23,7 @@ import java.io.ObjectOutput;
 import org.apache.ignite.ShutdownPolicy;
 import org.apache.ignite.internal.dto.IgniteDataTransferObject;
 import org.apache.ignite.internal.management.api.Argument;
+import org.apache.ignite.internal.management.api.EnumDescription;
 import org.apache.ignite.internal.management.api.Positional;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
@@ -34,6 +35,16 @@ public class ShutdownPolicyCommandArg extends 
IgniteDataTransferObject {
     /** */
     @Positional
     @Argument(optional = true)
+    @EnumDescription(
+        names = {
+            "IMMEDIATE",
+            "GRACEFUL"
+        },
+        descriptions = {
+            "Stop immediately as soon as all components are ready",
+            "Node will stop if and only if it does not store any unique 
partitions, that don't have another copies in the cluster"
+        }
+    )
     private ShutdownPolicy shutdownPolicy;
 
     /** {@inheritDoc} */
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/management/api/CommandUtils.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/management/api/CommandUtils.java
index 93a8890d570..5d751f30db6 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/management/api/CommandUtils.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/management/api/CommandUtils.java
@@ -467,23 +467,20 @@ public class CommandUtils {
 
         visitCommandParams(
             cmd.argClass(),
-            fld -> res.compareAndSet(false,
-                !fld.getAnnotation(Argument.class).description().isEmpty() ||
-                    fld.isAnnotationPresent(EnumDescription.class)
-            ),
-            fld -> res.compareAndSet(false,
-                !fld.getAnnotation(Argument.class).description().isEmpty() ||
-                    fld.isAnnotationPresent(EnumDescription.class)
-            ),
-            (argGrp, flds) -> flds.forEach(fld -> res.compareAndSet(false,
-                !fld.getAnnotation(Argument.class).description().isEmpty() ||
-                    fld.isAnnotationPresent(EnumDescription.class)
-            ))
+            fld -> res.compareAndSet(false, hasDescription(fld)),
+            fld -> res.compareAndSet(false, hasDescription(fld)),
+            (argGrp, flds) -> flds.forEach(fld -> res.compareAndSet(false, 
hasDescription(fld)))
         );
 
         return res.get();
     }
 
+    /** @return {@code True} if argument has description. */
+    public static boolean hasDescription(Field fld) {
+        return !fld.getAnnotation(Argument.class).description().isEmpty() ||
+            fld.isAnnotationPresent(EnumDescription.class);
+    }
+
     /**
      * @param nodes Nodes.
      * @return Coordinator ID or null is {@code nodes} are empty.
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/management/baseline/BaselineAutoAdjustCommandArg.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/management/baseline/BaselineAutoAdjustCommandArg.java
index 50295e7c6aa..3029ae467f5 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/management/baseline/BaselineAutoAdjustCommandArg.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/management/baseline/BaselineAutoAdjustCommandArg.java
@@ -23,6 +23,7 @@ import java.io.ObjectOutput;
 import org.apache.ignite.internal.management.api.Argument;
 import org.apache.ignite.internal.management.api.ArgumentGroup;
 import org.apache.ignite.internal.management.api.CliConfirmArgument;
+import org.apache.ignite.internal.management.api.EnumDescription;
 import org.apache.ignite.internal.management.api.Positional;
 import 
org.apache.ignite.internal.management.baseline.BaselineCommand.BaselineTaskArg;
 import org.apache.ignite.internal.util.typedef.internal.U;
@@ -37,6 +38,16 @@ public class BaselineAutoAdjustCommandArg extends 
BaselineTaskArg {
     /** */
     @Positional
     @Argument(optional = true)
+    @EnumDescription(
+        names = {
+            "ENABLE",
+            "DISABLE"
+        },
+        descriptions = {
+            "Enable baseline auto adjust",
+            "Disable baseline auto adjust"
+        }
+    )
     private Enabled enabled;
 
     /** */
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/management/cache/CacheIdleVerifyCommandArg.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/management/cache/CacheIdleVerifyCommandArg.java
index 83add99b21b..3d3b0b2dc30 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/management/cache/CacheIdleVerifyCommandArg.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/management/cache/CacheIdleVerifyCommandArg.java
@@ -25,6 +25,7 @@ import java.util.regex.PatternSyntaxException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.internal.dto.IgniteDataTransferObject;
 import org.apache.ignite.internal.management.api.Argument;
+import org.apache.ignite.internal.management.api.EnumDescription;
 import org.apache.ignite.internal.management.api.Positional;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
@@ -54,7 +55,25 @@ public class CacheIdleVerifyCommandArg extends 
IgniteDataTransferObject {
     private String[] excludeCaches;
 
     /** */
-    @Argument(optional = true)
+    @Argument(optional = true, description = "Type of cache(s)")
+    @EnumDescription(
+        names = {
+            "DEFAULT",
+            "SYSTEM",
+            "PERSISTENT",
+            "NOT_PERSISTENT",
+            "USER",
+            "ALL"
+        },
+        descriptions = {
+            "Default - user only, or all caches specified by name",
+            "System",
+            "Persistent",
+            "Not persistent",
+            "User",
+            "All"
+        }
+    )
     private CacheFilterEnum cacheFilter = CacheFilterEnum.DEFAULT;
 
     /**
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/management/cache/CacheMetricsCommandArg.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/management/cache/CacheMetricsCommandArg.java
index 00691f5a488..b566402053a 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/management/cache/CacheMetricsCommandArg.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/management/cache/CacheMetricsCommandArg.java
@@ -23,6 +23,7 @@ import java.io.ObjectOutput;
 import org.apache.ignite.internal.dto.IgniteDataTransferObject;
 import org.apache.ignite.internal.management.api.Argument;
 import org.apache.ignite.internal.management.api.ArgumentGroup;
+import org.apache.ignite.internal.management.api.EnumDescription;
 import org.apache.ignite.internal.management.api.Positional;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
@@ -35,6 +36,18 @@ public class CacheMetricsCommandArg extends 
IgniteDataTransferObject {
     /** */
     @Positional
     @Argument
+    @EnumDescription(
+        names = {
+            "ENABLE",
+            "DISABLE",
+            "STATUS"
+        },
+        descriptions = {
+            "Enable metrics",
+            "Disable metrics",
+            "Status"
+        }
+    )
     private CacheMetricsOperation operation;
 
     /** */
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/management/consistency/ConsistencyRepairCommandArg.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/management/consistency/ConsistencyRepairCommandArg.java
index a3b2f021be1..e632c3381f1 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/management/consistency/ConsistencyRepairCommandArg.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/management/consistency/ConsistencyRepairCommandArg.java
@@ -23,6 +23,7 @@ import java.io.ObjectOutput;
 import org.apache.ignite.cache.ReadRepairStrategy;
 import org.apache.ignite.internal.dto.IgniteDataTransferObject;
 import org.apache.ignite.internal.management.api.Argument;
+import org.apache.ignite.internal.management.api.EnumDescription;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
 /** */
@@ -40,6 +41,22 @@ public class ConsistencyRepairCommandArg extends 
IgniteDataTransferObject {
 
     /** Strategy. */
     @Argument(description = "Repair strategy")
+    @EnumDescription(
+        names = {
+            "LWW",
+            "PRIMARY",
+            "RELATIVE_MAJORITY",
+            "REMOVE",
+            "CHECK_ONLY"
+        },
+        descriptions = {
+            "Last write (the newest entry) wins",
+            "Value from the primary node wins",
+            "The relative majority, any value found more times than any other 
wins",
+            "Inconsistent entries will be removed",
+            "Only check will be performed"
+        }
+    )
     ReadRepairStrategy strategy;
 
     /** */
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/management/tracing/TracingConfigurationGetAllCommandArg.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/management/tracing/TracingConfigurationGetAllCommandArg.java
index 72619bd9e77..91b35d9db77 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/management/tracing/TracingConfigurationGetAllCommandArg.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/management/tracing/TracingConfigurationGetAllCommandArg.java
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import org.apache.ignite.internal.management.api.Argument;
+import org.apache.ignite.internal.management.api.EnumDescription;
 import 
org.apache.ignite.internal.management.tracing.TracingConfigurationCommand.TracingConfigurationCommandArg;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.tracing.Scope;
@@ -31,7 +32,23 @@ public class TracingConfigurationGetAllCommandArg extends 
TracingConfigurationCo
     private static final long serialVersionUID = 0;
 
     /** */
-    @Argument(optional = true)
+    @Argument(optional = true, description = "Tracing span scope")
+    @EnumDescription(
+        names = {
+            "DISCOVERY",
+            "EXCHANGE",
+            "COMMUNICATION",
+            "TX",
+            "SQL"
+        },
+        descriptions = {
+            "Discovery scope",
+            "Exchange scope",
+            "Communication scope",
+            "Transactional scope",
+            "SQL scope"
+        }
+    )
     private Scope scope;
 
     /** {@inheritDoc} */
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/management/tracing/TracingConfigurationGetCommandArg.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/management/tracing/TracingConfigurationGetCommandArg.java
index 10be95be2e8..518da239e6c 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/management/tracing/TracingConfigurationGetCommandArg.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/management/tracing/TracingConfigurationGetCommandArg.java
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import org.apache.ignite.internal.management.api.Argument;
+import org.apache.ignite.internal.management.api.EnumDescription;
 import 
org.apache.ignite.internal.management.tracing.TracingConfigurationCommand.TracingConfigurationCommandArg;
 import org.apache.ignite.internal.util.typedef.internal.U;
 import org.apache.ignite.spi.tracing.Scope;
@@ -31,7 +32,23 @@ public class TracingConfigurationGetCommandArg extends 
TracingConfigurationComma
     private static final long serialVersionUID = 0;
 
     /** */
-    @Argument
+    @Argument(description = "Tracing span scope")
+    @EnumDescription(
+        names = {
+            "DISCOVERY",
+            "EXCHANGE",
+            "COMMUNICATION",
+            "TX",
+            "SQL"
+        },
+        descriptions = {
+            "Discovery scope",
+            "Exchange scope",
+            "Communication scope",
+            "Transactional scope",
+            "SQL scope"
+        }
+    )
     private Scope scope;
 
     /** */
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/management/tx/TxCommandArg.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/management/tx/TxCommandArg.java
index e617d022865..6f33f1d468a 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/management/tx/TxCommandArg.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/management/tx/TxCommandArg.java
@@ -25,6 +25,7 @@ import java.util.regex.PatternSyntaxException;
 import org.apache.ignite.internal.management.api.Argument;
 import org.apache.ignite.internal.management.api.ArgumentGroup;
 import org.apache.ignite.internal.management.api.CliConfirmArgument;
+import org.apache.ignite.internal.management.api.EnumDescription;
 import org.apache.ignite.internal.util.typedef.internal.A;
 import org.apache.ignite.internal.util.typedef.internal.U;
 
@@ -68,7 +69,19 @@ public class TxCommandArg extends 
TxCommand.AbstractTxCommandArg {
     private Integer limit;
 
     /** */
-    @Argument(optional = true)
+    @Argument(optional = true, description = "Output order")
+    @EnumDescription(
+        names = {
+            "DURATION",
+            "SIZE",
+            "START_TIME"
+        },
+        descriptions = {
+            "Sort by duration",
+            "Sort by size",
+            "Sort by start time"
+        }
+    )
     private TxSortOrder order;
 
     /** */
diff --git 
a/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassTest_cache_help.output
 
b/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassTest_cache_help.output
index 2fc51183618..6541838e748 100644
--- 
a/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassTest_cache_help.output
+++ 
b/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassTest_cache_help.output
@@ -21,13 +21,27 @@ Arguments: --cache help --yes
     control.(sh|bat) --cache idle_verify [cacheName1,...,cacheNameN] 
[--skip-zeros] [--check-crc] [--exclude-caches cacheName1,...,cacheNameN] 
[--cache-filter DEFAULT|SYSTEM|PERSISTENT|NOT_PERSISTENT|USER|ALL]
 
     Parameters:
-      --check-crc  - check the CRC-sum of pages stored on disk before 
verifying data consistency in partitions between primary and backup nodes.
+      --check-crc                                                       - 
check the CRC-sum of pages stored on disk before verifying data consistency in 
partitions between primary and backup nodes.
+      --cache-filter DEFAULT|SYSTEM|PERSISTENT|NOT_PERSISTENT|USER|ALL  - Type 
of cache(s).
+        DEFAULT                                                         - 
Default - user only, or all caches specified by name.
+        SYSTEM                                                          - 
System.
+        PERSISTENT                                                      - 
Persistent.
+        NOT_PERSISTENT                                                  - Not 
persistent.
+        USER                                                            - User.
+        ALL                                                             - All.
 
   Calculate partition hash and print into standard output:
     control.(sh|bat) --cache idle_verify --dump [cacheName1,...,cacheNameN] 
[--skip-zeros] [--check-crc] [--exclude-caches cacheName1,...,cacheNameN] 
[--cache-filter DEFAULT|SYSTEM|PERSISTENT|NOT_PERSISTENT|USER|ALL]
 
     Parameters:
-      --check-crc  - check the CRC-sum of pages stored on disk before 
verifying data consistency in partitions between primary and backup nodes.
+      --check-crc                                                       - 
check the CRC-sum of pages stored on disk before verifying data consistency in 
partitions between primary and backup nodes.
+      --cache-filter DEFAULT|SYSTEM|PERSISTENT|NOT_PERSISTENT|USER|ALL  - Type 
of cache(s).
+        DEFAULT                                                         - 
Default - user only, or all caches specified by name.
+        SYSTEM                                                          - 
System.
+        PERSISTENT                                                      - 
Persistent.
+        NOT_PERSISTENT                                                  - Not 
persistent.
+        USER                                                            - User.
+        ALL                                                             - All.
 
   Show information about caches, groups or sequences that match a regular 
expression. When executed without parameters, this subcommand prints the list 
of caches:
     control.(sh|bat) --cache list regexPattern [nodeId] [--config] 
[--output-format multi-line] [--groups|--seq]
@@ -61,10 +75,10 @@ Arguments: --cache help --yes
     control.(sh|bat) --cache validate_indexes [cacheName1,...,cacheNameN] 
[nodeId] [--check-first N] [--check-through K] [--check-crc] [--check-sizes]
 
     Parameters:
-      --check-first N            - validate only the first N keys.
-      --check-through K          - validate every Kth key.
-      --check-crc                - check the CRC-sum of pages stored on disk.
-      --check-sizes              - check that index size and cache size are 
the same.
+      --check-first N    - validate only the first N keys.
+      --check-through K  - validate every Kth key.
+      --check-crc        - check the CRC-sum of pages stored on disk.
+      --check-sizes      - check that index size and cache size are the same.
 
   Checks that secondary indexes inline size are same on the cluster nodes:
     control.(sh|bat) --cache check_index_inline_sizes
@@ -110,6 +124,9 @@ Arguments: --cache help --yes
     control.(sh|bat) --cache metrics ENABLE|DISABLE|STATUS --caches 
cache1[,...,cacheN]|--all-caches
 
     Parameters:
+      ENABLE                        - Enable metrics.
+      DISABLE                       - Disable metrics.
+      STATUS                        - Status.
       --caches cache1[,...,cacheN]  - specifies a comma-separated list of 
cache names to which operation should be applied.
       --all-caches                  - applies operation to all user caches.
 
diff --git 
a/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassTest_help.output
 
b/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassTest_help.output
index e4debe5b040..b58c36e67e7 100644
--- 
a/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassTest_help.output
+++ 
b/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassTest_help.output
@@ -62,10 +62,18 @@ This utility can do the following commands:
 
     Parameters:
       --verbose  - Show the full list of node ips.
+      ENABLE     - Enable baseline auto adjust.
+      DISABLE    - Disable baseline auto adjust.
 
   List or kill transactions:
     control.(sh|bat) --tx [--xid XID] [--min-duration SECONDS] [--min-size 
SIZE] [--label PATTERN_REGEX] [--limit NUMBER] [--order 
DURATION|SIZE|START_TIME] [--kill] [--servers|--clients|--nodes 
consistentId1[,consistentId2,....,consistentIdN]] [--yes]
 
+    Parameters:
+      --order DURATION|SIZE|START_TIME  - Output order.
+        DURATION                        - Sort by duration.
+        SIZE                            - Sort by size.
+        START_TIME                      - Sort by start time.
+
   Print detailed information (topology and key lock ownership) about specific 
transaction:
     control.(sh|bat) --tx --info <TX identifier as GridCacheVersion 
[topVer=..., order=..., nodeOrder=...] (can be found in logs)>|<TX identifier 
as UUID (can be retrieved via --tx command)>
 
@@ -248,30 +256,82 @@ If the file name isn't specified the output file name is: 
'<typeId>.bin':
   Set or display shutdown policy:
     control.(sh|bat) --shutdown-policy [IMMEDIATE|GRACEFUL]
 
+    Parameters:
+      IMMEDIATE        - Stop immediately as soon as all components are ready.
+      GRACEFUL         - Node will stop if and only if it does not store any 
unique partitions, that don't have another copies in the cluster.
+
   [EXPERIMENTAL]
   Print tracing configuration:
     control.(sh|bat) --tracing-configuration [--scope 
DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL]
 
+    Parameters:
+      --scope DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL  - Tracing span scope.
+        DISCOVERY                                      - Discovery scope.
+        EXCHANGE                                       - Exchange scope.
+        COMMUNICATION                                  - Communication scope.
+        TX                                             - Transactional scope.
+        SQL                                            - SQL scope.
+
   [EXPERIMENTAL]
   Print tracing configuration:
     control.(sh|bat) --tracing-configuration get_all [--scope 
DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL]
 
+    Parameters:
+      --scope DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL  - Tracing span scope.
+        DISCOVERY                                      - Discovery scope.
+        EXCHANGE                                       - Exchange scope.
+        COMMUNICATION                                  - Communication scope.
+        TX                                             - Transactional scope.
+        SQL                                            - SQL scope.
+
   [EXPERIMENTAL]
   Print specific tracing configuration based on specified --scope and --label:
     control.(sh|bat) --tracing-configuration get --scope 
DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL [--label label]
 
+    Parameters:
+      --scope DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL  - Tracing span scope.
+        DISCOVERY                                      - Discovery scope.
+        EXCHANGE                                       - Exchange scope.
+        COMMUNICATION                                  - Communication scope.
+        TX                                             - Transactional scope.
+        SQL                                            - SQL scope.
+
   [EXPERIMENTAL]
   Reset all specific tracing configuration the to default. If --scope is 
specified, then remove all label specific configuration for the given scope and 
reset given scope specific configuration to the default, if --scope is skipped 
then reset all tracing configurations to the default. Print tracing 
configuration:
     control.(sh|bat) --tracing-configuration reset_all [--scope 
DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL]
 
+    Parameters:
+      --scope DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL  - Tracing span scope.
+        DISCOVERY                                      - Discovery scope.
+        EXCHANGE                                       - Exchange scope.
+        COMMUNICATION                                  - Communication scope.
+        TX                                             - Transactional scope.
+        SQL                                            - SQL scope.
+
   [EXPERIMENTAL]
   Reset specific tracing configuration to the default. If both --scope and 
--label are specified then remove given configuration, if only --scope is 
specified then reset given configuration to the default. Print reseted 
configuration:
     control.(sh|bat) --tracing-configuration reset --scope 
DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL [--label label]
 
+    Parameters:
+      --scope DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL  - Tracing span scope.
+        DISCOVERY                                      - Discovery scope.
+        EXCHANGE                                       - Exchange scope.
+        COMMUNICATION                                  - Communication scope.
+        TX                                             - Transactional scope.
+        SQL                                            - SQL scope.
+
   [EXPERIMENTAL]
   Set new tracing configuration. If both --scope and --label are specified 
then add or override label specific configuration, if only --scope is 
specified, then override scope specific configuration. Print applied 
configuration:
     control.(sh|bat) --tracing-configuration set --scope 
DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL [--label label] [--sampling-rate 
Decimal value between 0 and 1, where 0 means never and 1 means always. More or 
less reflects the probability of sampling specific trace.] [--included-scopes 
Set of scopes with comma as separator  DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL]
 
+    Parameters:
+      --scope DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL  - Tracing span scope.
+        DISCOVERY                                      - Discovery scope.
+        EXCHANGE                                       - Exchange scope.
+        COMMUNICATION                                  - Communication scope.
+        TX                                             - Transactional scope.
+        SQL                                            - SQL scope.
+
   Stop warm-up:
     control.(sh|bat) --warm-up --stop
 
@@ -372,6 +432,11 @@ If the file name isn't specified the output file name is: 
'<typeId>.bin':
       --cache cache                                               - Cache to 
be checked/repaired.
       --partitions partition                                      - Cache's 
partition to be checked/repaired.
       --strategy LWW|PRIMARY|RELATIVE_MAJORITY|REMOVE|CHECK_ONLY  - Repair 
strategy.
+        LWW                                                       - Last write 
(the newest entry) wins.
+        PRIMARY                                                   - Value from 
the primary node wins.
+        RELATIVE_MAJORITY                                         - The 
relative majority, any value found more times than any other wins.
+        REMOVE                                                    - 
Inconsistent entries will be removed.
+        CHECK_ONLY                                                - Only check 
will be performed.
       --parallel                                                  - Run 
concurrently on each node.
 
   [EXPERIMENTAL]
diff --git 
a/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassWithSSLTest_cache_help.output
 
b/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassWithSSLTest_cache_help.output
index 2fc51183618..6541838e748 100644
--- 
a/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassWithSSLTest_cache_help.output
+++ 
b/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassWithSSLTest_cache_help.output
@@ -21,13 +21,27 @@ Arguments: --cache help --yes
     control.(sh|bat) --cache idle_verify [cacheName1,...,cacheNameN] 
[--skip-zeros] [--check-crc] [--exclude-caches cacheName1,...,cacheNameN] 
[--cache-filter DEFAULT|SYSTEM|PERSISTENT|NOT_PERSISTENT|USER|ALL]
 
     Parameters:
-      --check-crc  - check the CRC-sum of pages stored on disk before 
verifying data consistency in partitions between primary and backup nodes.
+      --check-crc                                                       - 
check the CRC-sum of pages stored on disk before verifying data consistency in 
partitions between primary and backup nodes.
+      --cache-filter DEFAULT|SYSTEM|PERSISTENT|NOT_PERSISTENT|USER|ALL  - Type 
of cache(s).
+        DEFAULT                                                         - 
Default - user only, or all caches specified by name.
+        SYSTEM                                                          - 
System.
+        PERSISTENT                                                      - 
Persistent.
+        NOT_PERSISTENT                                                  - Not 
persistent.
+        USER                                                            - User.
+        ALL                                                             - All.
 
   Calculate partition hash and print into standard output:
     control.(sh|bat) --cache idle_verify --dump [cacheName1,...,cacheNameN] 
[--skip-zeros] [--check-crc] [--exclude-caches cacheName1,...,cacheNameN] 
[--cache-filter DEFAULT|SYSTEM|PERSISTENT|NOT_PERSISTENT|USER|ALL]
 
     Parameters:
-      --check-crc  - check the CRC-sum of pages stored on disk before 
verifying data consistency in partitions between primary and backup nodes.
+      --check-crc                                                       - 
check the CRC-sum of pages stored on disk before verifying data consistency in 
partitions between primary and backup nodes.
+      --cache-filter DEFAULT|SYSTEM|PERSISTENT|NOT_PERSISTENT|USER|ALL  - Type 
of cache(s).
+        DEFAULT                                                         - 
Default - user only, or all caches specified by name.
+        SYSTEM                                                          - 
System.
+        PERSISTENT                                                      - 
Persistent.
+        NOT_PERSISTENT                                                  - Not 
persistent.
+        USER                                                            - User.
+        ALL                                                             - All.
 
   Show information about caches, groups or sequences that match a regular 
expression. When executed without parameters, this subcommand prints the list 
of caches:
     control.(sh|bat) --cache list regexPattern [nodeId] [--config] 
[--output-format multi-line] [--groups|--seq]
@@ -61,10 +75,10 @@ Arguments: --cache help --yes
     control.(sh|bat) --cache validate_indexes [cacheName1,...,cacheNameN] 
[nodeId] [--check-first N] [--check-through K] [--check-crc] [--check-sizes]
 
     Parameters:
-      --check-first N            - validate only the first N keys.
-      --check-through K          - validate every Kth key.
-      --check-crc                - check the CRC-sum of pages stored on disk.
-      --check-sizes              - check that index size and cache size are 
the same.
+      --check-first N    - validate only the first N keys.
+      --check-through K  - validate every Kth key.
+      --check-crc        - check the CRC-sum of pages stored on disk.
+      --check-sizes      - check that index size and cache size are the same.
 
   Checks that secondary indexes inline size are same on the cluster nodes:
     control.(sh|bat) --cache check_index_inline_sizes
@@ -110,6 +124,9 @@ Arguments: --cache help --yes
     control.(sh|bat) --cache metrics ENABLE|DISABLE|STATUS --caches 
cache1[,...,cacheN]|--all-caches
 
     Parameters:
+      ENABLE                        - Enable metrics.
+      DISABLE                       - Disable metrics.
+      STATUS                        - Status.
       --caches cache1[,...,cacheN]  - specifies a comma-separated list of 
cache names to which operation should be applied.
       --all-caches                  - applies operation to all user caches.
 
diff --git 
a/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassWithSSLTest_help.output
 
b/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassWithSSLTest_help.output
index e4debe5b040..b58c36e67e7 100644
--- 
a/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassWithSSLTest_help.output
+++ 
b/modules/core/src/test/resources/org.apache.ignite.util/GridCommandHandlerClusterByClassWithSSLTest_help.output
@@ -62,10 +62,18 @@ This utility can do the following commands:
 
     Parameters:
       --verbose  - Show the full list of node ips.
+      ENABLE     - Enable baseline auto adjust.
+      DISABLE    - Disable baseline auto adjust.
 
   List or kill transactions:
     control.(sh|bat) --tx [--xid XID] [--min-duration SECONDS] [--min-size 
SIZE] [--label PATTERN_REGEX] [--limit NUMBER] [--order 
DURATION|SIZE|START_TIME] [--kill] [--servers|--clients|--nodes 
consistentId1[,consistentId2,....,consistentIdN]] [--yes]
 
+    Parameters:
+      --order DURATION|SIZE|START_TIME  - Output order.
+        DURATION                        - Sort by duration.
+        SIZE                            - Sort by size.
+        START_TIME                      - Sort by start time.
+
   Print detailed information (topology and key lock ownership) about specific 
transaction:
     control.(sh|bat) --tx --info <TX identifier as GridCacheVersion 
[topVer=..., order=..., nodeOrder=...] (can be found in logs)>|<TX identifier 
as UUID (can be retrieved via --tx command)>
 
@@ -248,30 +256,82 @@ If the file name isn't specified the output file name is: 
'<typeId>.bin':
   Set or display shutdown policy:
     control.(sh|bat) --shutdown-policy [IMMEDIATE|GRACEFUL]
 
+    Parameters:
+      IMMEDIATE        - Stop immediately as soon as all components are ready.
+      GRACEFUL         - Node will stop if and only if it does not store any 
unique partitions, that don't have another copies in the cluster.
+
   [EXPERIMENTAL]
   Print tracing configuration:
     control.(sh|bat) --tracing-configuration [--scope 
DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL]
 
+    Parameters:
+      --scope DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL  - Tracing span scope.
+        DISCOVERY                                      - Discovery scope.
+        EXCHANGE                                       - Exchange scope.
+        COMMUNICATION                                  - Communication scope.
+        TX                                             - Transactional scope.
+        SQL                                            - SQL scope.
+
   [EXPERIMENTAL]
   Print tracing configuration:
     control.(sh|bat) --tracing-configuration get_all [--scope 
DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL]
 
+    Parameters:
+      --scope DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL  - Tracing span scope.
+        DISCOVERY                                      - Discovery scope.
+        EXCHANGE                                       - Exchange scope.
+        COMMUNICATION                                  - Communication scope.
+        TX                                             - Transactional scope.
+        SQL                                            - SQL scope.
+
   [EXPERIMENTAL]
   Print specific tracing configuration based on specified --scope and --label:
     control.(sh|bat) --tracing-configuration get --scope 
DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL [--label label]
 
+    Parameters:
+      --scope DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL  - Tracing span scope.
+        DISCOVERY                                      - Discovery scope.
+        EXCHANGE                                       - Exchange scope.
+        COMMUNICATION                                  - Communication scope.
+        TX                                             - Transactional scope.
+        SQL                                            - SQL scope.
+
   [EXPERIMENTAL]
   Reset all specific tracing configuration the to default. If --scope is 
specified, then remove all label specific configuration for the given scope and 
reset given scope specific configuration to the default, if --scope is skipped 
then reset all tracing configurations to the default. Print tracing 
configuration:
     control.(sh|bat) --tracing-configuration reset_all [--scope 
DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL]
 
+    Parameters:
+      --scope DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL  - Tracing span scope.
+        DISCOVERY                                      - Discovery scope.
+        EXCHANGE                                       - Exchange scope.
+        COMMUNICATION                                  - Communication scope.
+        TX                                             - Transactional scope.
+        SQL                                            - SQL scope.
+
   [EXPERIMENTAL]
   Reset specific tracing configuration to the default. If both --scope and 
--label are specified then remove given configuration, if only --scope is 
specified then reset given configuration to the default. Print reseted 
configuration:
     control.(sh|bat) --tracing-configuration reset --scope 
DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL [--label label]
 
+    Parameters:
+      --scope DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL  - Tracing span scope.
+        DISCOVERY                                      - Discovery scope.
+        EXCHANGE                                       - Exchange scope.
+        COMMUNICATION                                  - Communication scope.
+        TX                                             - Transactional scope.
+        SQL                                            - SQL scope.
+
   [EXPERIMENTAL]
   Set new tracing configuration. If both --scope and --label are specified 
then add or override label specific configuration, if only --scope is 
specified, then override scope specific configuration. Print applied 
configuration:
     control.(sh|bat) --tracing-configuration set --scope 
DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL [--label label] [--sampling-rate 
Decimal value between 0 and 1, where 0 means never and 1 means always. More or 
less reflects the probability of sampling specific trace.] [--included-scopes 
Set of scopes with comma as separator  DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL]
 
+    Parameters:
+      --scope DISCOVERY|EXCHANGE|COMMUNICATION|TX|SQL  - Tracing span scope.
+        DISCOVERY                                      - Discovery scope.
+        EXCHANGE                                       - Exchange scope.
+        COMMUNICATION                                  - Communication scope.
+        TX                                             - Transactional scope.
+        SQL                                            - SQL scope.
+
   Stop warm-up:
     control.(sh|bat) --warm-up --stop
 
@@ -372,6 +432,11 @@ If the file name isn't specified the output file name is: 
'<typeId>.bin':
       --cache cache                                               - Cache to 
be checked/repaired.
       --partitions partition                                      - Cache's 
partition to be checked/repaired.
       --strategy LWW|PRIMARY|RELATIVE_MAJORITY|REMOVE|CHECK_ONLY  - Repair 
strategy.
+        LWW                                                       - Last write 
(the newest entry) wins.
+        PRIMARY                                                   - Value from 
the primary node wins.
+        RELATIVE_MAJORITY                                         - The 
relative majority, any value found more times than any other wins.
+        REMOVE                                                    - 
Inconsistent entries will be removed.
+        CHECK_ONLY                                                - Only check 
will be performed.
       --parallel                                                  - Run 
concurrently on each node.
 
   [EXPERIMENTAL]

Reply via email to