korlov42 commented on a change in pull request #8208:
URL: https://github.com/apache/ignite/pull/8208#discussion_r490807238



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedEnumProperty.java
##########
@@ -40,36 +40,26 @@
     /** Function converts an enumeration value to an integer for stored in 
meta storage. */
     private final IgniteClosure<T, Integer> toOredinalFunc;
 
-    /**
-     * Property constructor.
-     *
-     * @param name Name of property.
-     * @param fromOrdinalFunc Function reflects an integer to an enumiration 
value.
-     */
-    public DistributedEnumProperty(
-        String name,
-        IgniteClosure<Integer, T> fromOrdinalFunc
-    ) {
-        this(name, fromOrdinalFunc, (T value) -> {
-            return value == null ? null : value.ordinal();
-        });
-    }
+    /** Property value parser. */
+    private final T[] values;
 
     /**
      * Property constructor.
      *
      * @param name Name of property.
      * @param fromOrdinalFunc Function reflects an integer to an enumiration 
value.
-     * @param toOredinalFunc Function converts an enumeration value to an 
integer.
+     * @param toOrdinalFunc Function converts an enumeration value to an 
integer.
      */
     public DistributedEnumProperty(
         String name,
         IgniteClosure<Integer, T> fromOrdinalFunc,
-        IgniteClosure<T, Integer> toOredinalFunc
+        IgniteClosure<T, Integer> toOrdinalFunc,
+        T[] values
     ) {
-        this.internal = new SimpleDistributedProperty<>(name);
+        this.internal = new SimpleDistributedProperty<>(name, null);
         this.fromOrdinalFunc = fromOrdinalFunc;
-        this.toOredinalFunc = toOredinalFunc;
+        this.toOredinalFunc = toOrdinalFunc;
+        this.values = values;

Review comment:
       it's better to have a mapping name to value here than just an array

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/processors/configuration/distributed/DistributedEnumProperty.java
##########
@@ -40,36 +40,26 @@
     /** Function converts an enumeration value to an integer for stored in 
meta storage. */
     private final IgniteClosure<T, Integer> toOredinalFunc;
 
-    /**
-     * Property constructor.
-     *
-     * @param name Name of property.
-     * @param fromOrdinalFunc Function reflects an integer to an enumiration 
value.
-     */
-    public DistributedEnumProperty(
-        String name,
-        IgniteClosure<Integer, T> fromOrdinalFunc
-    ) {
-        this(name, fromOrdinalFunc, (T value) -> {
-            return value == null ? null : value.ordinal();
-        });
-    }
+    /** Property value parser. */

Review comment:
       wrong javadoc

##########
File path: 
modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/property/subcommands/PropertyHelpCommand.java
##########
@@ -0,0 +1,54 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.commandline.property.subcommands;
+
+import java.util.logging.Logger;
+import org.apache.ignite.internal.client.GridClientConfiguration;
+import org.apache.ignite.internal.commandline.Command;
+import org.apache.ignite.internal.commandline.meta.MetadataCommand;
+import org.apache.ignite.internal.commandline.meta.MetadataSubCommandsList;
+
+/** */
+public class PropertyHelpCommand implements Command<Void> {
+    /** {@inheritDoc} */
+    @Override public void printUsage(Logger log) {
+        throw new UnsupportedOperationException("printUsage");
+    }
+
+    /** {@inheritDoc} */
+    @Override public Object execute(GridClientConfiguration clientCfg, Logger 
log) throws Exception {
+        new MetadataCommand().printUsage(log);

Review comment:
       copy-pasted code

##########
File path: 
modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/property/subcommands/PropertySetCommand.java
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.commandline.property.subcommands;
+
+import java.util.logging.Logger;
+import org.apache.ignite.internal.commandline.CommandArgIterator;
+import org.apache.ignite.internal.commandline.property.PropertyArgs;
+import org.apache.ignite.internal.commandline.property.PropertySubCommandsList;
+import 
org.apache.ignite.internal.commandline.property.tasks.PropertyOperationResult;
+import org.apache.ignite.internal.commandline.property.tasks.PropertyTask;
+
+/** */
+public class PropertySetCommand extends 
PropertyAbstractSubCommand<PropertyArgs, PropertyOperationResult>
+{

Review comment:
       and this one 

##########
File path: 
modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/property/subcommands/PropertySetCommand.java
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.commandline.property.subcommands;
+
+import java.util.logging.Logger;
+import org.apache.ignite.internal.commandline.CommandArgIterator;
+import org.apache.ignite.internal.commandline.property.PropertyArgs;
+import org.apache.ignite.internal.commandline.property.PropertySubCommandsList;
+import 
org.apache.ignite.internal.commandline.property.tasks.PropertyOperationResult;
+import org.apache.ignite.internal.commandline.property.tasks.PropertyTask;
+
+/** */
+public class PropertySetCommand extends 
PropertyAbstractSubCommand<PropertyArgs, PropertyOperationResult>
+{
+    /** {@inheritDoc} */
+    @Override protected String taskName() {
+        return PropertyTask.class.getName();
+    }
+
+    /** {@inheritDoc} */
+    @Override public PropertyArgs parseArguments0(CommandArgIterator argIter) {
+        String name = null;
+        String val = null;
+
+        while (argIter.hasNextSubArg() && (name == null || val == null)) {
+            String optName = argIter.nextArg("Expecting " + (name == null ? 
PropertyArgs.NAME : PropertyArgs.VAL));
+
+            if (PropertyArgs.NAME.equals(optName))
+                name = argIter.nextArg("property name");
+
+            if (PropertyArgs.VAL.equals(optName))
+                val = argIter.nextArg("property value");
+        }
+
+        if (name == null) {
+            throw new IllegalArgumentException("Property name is not 
specified. " +
+                "Please the option: --name <property_name>");
+        }
+
+        if (val == null) {
+            throw new IllegalArgumentException("Property name is not 
specified. " +

Review comment:
       did you mean "Property _val_"?

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/commandline/property/PropertyArgs.java
##########
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.commandline.property;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.dto.IgniteDataTransferObject;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class PropertyArgs extends IgniteDataTransferObject {
+    /** Serial version uid. */
+    private static final long serialVersionUID = 0L;
+
+    /** Type name argument. */
+    public static final String NAME = "--name";
+
+    /** Type ID argument. */

Review comment:
       and here

##########
File path: 
modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/property/PropertyCommand.java
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.commandline.property;
+
+import java.util.logging.Logger;
+import org.apache.ignite.internal.client.GridClientConfiguration;
+import org.apache.ignite.internal.commandline.Command;
+import org.apache.ignite.internal.commandline.CommandArgIterator;
+
+import static org.apache.ignite.internal.commandline.Command.usage;
+import static org.apache.ignite.internal.commandline.CommandList.PROPERTY;
+import static 
org.apache.ignite.internal.commandline.property.PropertySubCommandsList.GET;
+import static 
org.apache.ignite.internal.commandline.property.PropertySubCommandsList.HELP;
+import static 
org.apache.ignite.internal.commandline.property.PropertySubCommandsList.LIST;
+import static 
org.apache.ignite.internal.commandline.property.PropertySubCommandsList.SET;
+
+/**
+ *

Review comment:
       it would be nice to give a few words about what this command is supposed 
to do

##########
File path: 
modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/property/PropertyCommand.java
##########
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.commandline.property;
+
+import java.util.logging.Logger;
+import org.apache.ignite.internal.client.GridClientConfiguration;
+import org.apache.ignite.internal.commandline.Command;
+import org.apache.ignite.internal.commandline.CommandArgIterator;
+
+import static org.apache.ignite.internal.commandline.Command.usage;
+import static org.apache.ignite.internal.commandline.CommandList.PROPERTY;
+import static 
org.apache.ignite.internal.commandline.property.PropertySubCommandsList.GET;
+import static 
org.apache.ignite.internal.commandline.property.PropertySubCommandsList.HELP;
+import static 
org.apache.ignite.internal.commandline.property.PropertySubCommandsList.LIST;
+import static 
org.apache.ignite.internal.commandline.property.PropertySubCommandsList.SET;
+
+/**
+ *
+ */
+public class PropertyCommand implements Command<Object> {
+    /**
+     *
+     */
+    private Command<?> delegate;
+
+    /** {@inheritDoc} */
+    @Override public void printUsage(Logger log) {
+        usage(log, "Print property command help:",
+            PROPERTY,
+            HELP.toString()
+        );
+
+        usage(log, "Print list of available properties:",
+            PROPERTY,
+            LIST.toString()
+        );
+
+        usage(log, "Get the property value",
+            PROPERTY,
+            GET.toString(),
+            PropertyArgs.NAME,
+            "<property_name>");
+
+        usage(log, "Set the property value",
+            PROPERTY,
+            SET.toString(),
+            PropertyArgs.NAME,
+            "<property_name>",
+            PropertyArgs.VAL,
+            "<property_value>");
+    }
+
+    /** {@inheritDoc} */
+    @Override public String name() {
+        return PROPERTY.toCommandName();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void parseArguments(CommandArgIterator argIter) {
+        PropertySubCommandsList subcommand = 
PropertySubCommandsList.parse(argIter.nextArg("Expected property action."));
+
+        if (subcommand == null)
+            throw new IllegalArgumentException("Expected correct metadata 
action.");

Review comment:
       misleading exception message

##########
File path: 
modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/property/subcommands/PropertyListCommand.java
##########
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.commandline.property.subcommands;
+
+import java.util.logging.Logger;
+import org.apache.ignite.internal.commandline.CommandArgIterator;
+import org.apache.ignite.internal.commandline.meta.subcommands.VoidDto;
+import org.apache.ignite.internal.commandline.property.PropertySubCommandsList;
+import 
org.apache.ignite.internal.commandline.property.tasks.PropertiesListResult;
+import 
org.apache.ignite.internal.commandline.property.tasks.PropertiesListTask;
+
+/** */
+public class PropertyListCommand extends PropertyAbstractSubCommand<VoidDto, 
PropertiesListResult>
+{

Review comment:
       move it to the previous line

##########
File path: 
modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/property/subcommands/PropertyGetCommand.java
##########
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.commandline.property.subcommands;
+
+import java.util.logging.Logger;
+import org.apache.ignite.internal.commandline.CommandArgIterator;
+import org.apache.ignite.internal.commandline.property.PropertyArgs;
+import org.apache.ignite.internal.commandline.property.PropertySubCommandsList;
+import 
org.apache.ignite.internal.commandline.property.tasks.PropertyOperationResult;
+import org.apache.ignite.internal.commandline.property.tasks.PropertyTask;
+
+/** */
+public class PropertyGetCommand extends 
PropertyAbstractSubCommand<PropertyArgs, PropertyOperationResult>
+{
+    /** {@inheritDoc} */
+    @Override protected String taskName() {
+        return PropertyTask.class.getName();
+    }
+
+    /** {@inheritDoc} */
+    @Override public PropertyArgs parseArguments0(CommandArgIterator argIter) {
+        String name = null;
+
+        while (argIter.hasNextSubArg() && name == null) {
+            String optName = argIter.nextArg("Expecting " + PropertyArgs.NAME);
+
+            if (PropertyArgs.NAME.equals(optName))
+                name = argIter.nextArg("property name");
+        }
+
+        if (name == null) {
+            throw new IllegalArgumentException("Property name is not 
specified. " +
+                "Please the option: --name <property_name>");

Review comment:
       "Please the option" <- soul strange to me

##########
File path: 
modules/control-utility/src/main/java/org/apache/ignite/internal/commandline/property/subcommands/PropertySetCommand.java
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.commandline.property.subcommands;
+
+import java.util.logging.Logger;
+import org.apache.ignite.internal.commandline.CommandArgIterator;
+import org.apache.ignite.internal.commandline.property.PropertyArgs;
+import org.apache.ignite.internal.commandline.property.PropertySubCommandsList;
+import 
org.apache.ignite.internal.commandline.property.tasks.PropertyOperationResult;
+import org.apache.ignite.internal.commandline.property.tasks.PropertyTask;
+
+/** */
+public class PropertySetCommand extends 
PropertyAbstractSubCommand<PropertyArgs, PropertyOperationResult>
+{
+    /** {@inheritDoc} */
+    @Override protected String taskName() {
+        return PropertyTask.class.getName();
+    }
+
+    /** {@inheritDoc} */
+    @Override public PropertyArgs parseArguments0(CommandArgIterator argIter) {
+        String name = null;
+        String val = null;
+
+        while (argIter.hasNextSubArg() && (name == null || val == null)) {
+            String optName = argIter.nextArg("Expecting " + (name == null ? 
PropertyArgs.NAME : PropertyArgs.VAL));
+
+            if (PropertyArgs.NAME.equals(optName))
+                name = argIter.nextArg("property name");
+
+            if (PropertyArgs.VAL.equals(optName))
+                val = argIter.nextArg("property value");
+        }
+
+        if (name == null) {
+            throw new IllegalArgumentException("Property name is not 
specified. " +
+                "Please the option: --name <property_name>");

Review comment:
       this should be fixed as well 

##########
File path: 
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerPropertiesTest.java
##########
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.util;
+
+import java.io.Serializable;
+import java.util.Set;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.internal.IgniteEx;
+import 
org.apache.ignite.internal.processors.configuration.distributed.DistributedChangeableProperty;
+import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
+import org.apache.ignite.internal.util.typedef.G;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static 
org.apache.ignite.internal.commandline.CommandHandler.EXIT_CODE_INVALID_ARGUMENTS;
+import static 
org.apache.ignite.internal.commandline.CommandHandler.EXIT_CODE_OK;
+import static org.apache.ignite.testframework.GridTestUtils.assertContains;
+
+/**
+ * Checks command line property commands.
+ */
+public class GridCommandHandlerPropertiesTest extends 
GridCommandHandlerClusterByClassAbstractTest {
+    /** */
+    @Before
+    public void init() {
+        injectTestSystemOut();
+    }
+
+    /** */
+    @After
+    public void clear() {

Review comment:
       it could be omitted 

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/commandline/property/PropertyArgs.java
##########
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.commandline.property;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.dto.IgniteDataTransferObject;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class PropertyArgs extends IgniteDataTransferObject {
+    /** Serial version uid. */
+    private static final long serialVersionUID = 0L;
+
+    /** Type name argument. */
+    public static final String NAME = "--name";
+
+    /** Type ID argument. */
+    public static final String VAL = "--val";
+
+    /** Config. */

Review comment:
       and here

##########
File path: 
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerPropertiesTest.java
##########
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.util;
+
+import java.io.Serializable;
+import java.util.Set;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.internal.IgniteEx;
+import 
org.apache.ignite.internal.processors.configuration.distributed.DistributedChangeableProperty;
+import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
+import org.apache.ignite.internal.util.typedef.G;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static 
org.apache.ignite.internal.commandline.CommandHandler.EXIT_CODE_INVALID_ARGUMENTS;
+import static 
org.apache.ignite.internal.commandline.CommandHandler.EXIT_CODE_OK;
+import static org.apache.ignite.testframework.GridTestUtils.assertContains;
+
+/**
+ * Checks command line property commands.
+ */
+public class GridCommandHandlerPropertiesTest extends 
GridCommandHandlerClusterByClassAbstractTest {
+    /** */
+    @Before
+    public void init() {
+        injectTestSystemOut();
+    }
+
+    /** */
+    @After
+    public void clear() {
+    }
+
+    /**
+     * Check the command '--property list'.
+     * Steps:

Review comment:
       please fill the steps

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/commandline/property/PropertyArgs.java
##########
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.commandline.property;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.dto.IgniteDataTransferObject;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class PropertyArgs extends IgniteDataTransferObject {
+    /** Serial version uid. */
+    private static final long serialVersionUID = 0L;
+
+    /** Type name argument. */
+    public static final String NAME = "--name";
+
+    /** Type ID argument. */
+    public static final String VAL = "--val";
+
+    /** Config. */
+    private String name;
+
+    /** Metrics. */

Review comment:
       and here

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/commandline/property/PropertyArgs.java
##########
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.commandline.property;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.dto.IgniteDataTransferObject;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.Nullable;
+
+/** */
+public class PropertyArgs extends IgniteDataTransferObject {
+    /** Serial version uid. */
+    private static final long serialVersionUID = 0L;
+
+    /** Type name argument. */

Review comment:
       copy-pasted docs 

##########
File path: 
modules/control-utility/src/test/java/org/apache/ignite/util/GridCommandHandlerPropertiesTest.java
##########
@@ -0,0 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.util;
+
+import java.io.Serializable;
+import java.util.Set;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.internal.IgniteEx;
+import 
org.apache.ignite.internal.processors.configuration.distributed.DistributedChangeableProperty;
+import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
+import org.apache.ignite.internal.util.typedef.G;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import static 
org.apache.ignite.internal.commandline.CommandHandler.EXIT_CODE_INVALID_ARGUMENTS;
+import static 
org.apache.ignite.internal.commandline.CommandHandler.EXIT_CODE_OK;
+import static org.apache.ignite.testframework.GridTestUtils.assertContains;
+
+/**
+ * Checks command line property commands.
+ */
+public class GridCommandHandlerPropertiesTest extends 
GridCommandHandlerClusterByClassAbstractTest {
+    /** */
+    @Before
+    public void init() {
+        injectTestSystemOut();
+    }
+
+    /** */
+    @After
+    public void clear() {
+    }
+
+    /**
+     * Check the command '--property list'.
+     * Steps:
+     */
+    @Test
+    public void testList() {
+        assertEquals(EXIT_CODE_OK, execute("--property", "list"));
+
+        String out = testOut.toString();
+
+        for (DistributedChangeableProperty<Serializable> pd : crd.context()
+            .distributedConfiguration().properties())
+            assertContains(log, out, pd.getName());
+    }
+
+    /**
+     * Check the command '--property get'.
+     * Steps:
+     */
+    @Test
+    public void testGet() {
+        for (DistributedChangeableProperty<Serializable> pd : crd.context()
+            .distributedConfiguration().properties()) {
+            assertEquals(EXIT_CODE_OK, execute("--property", "get", "--name", 
pd.getName()));
+            String out = testOut.toString();
+
+            assertContains(log, out, pd.getName() + " = " + pd.get());
+        }
+    }
+
+    /**
+     * Check the set command fro property 'sql.disabledFunctions'.

Review comment:
       ```suggestion
        * Check the set command for property 'sql.disabledFunctions'.
   ```

##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/commandline/property/tasks/PropertiesListTask.java
##########
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.commandline.property.tasks;
+
+import java.util.List;
+import java.util.stream.Collectors;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.internal.commandline.meta.subcommands.VoidDto;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorMultiNodeTask;
+import org.jetbrains.annotations.Nullable;
+
+import static 
org.apache.ignite.plugin.security.SecurityPermission.ADMIN_READ_DISTRIBUTED_PROPERTY;
+
+/**
+ * Task for property operations.
+ */
+@GridInternal
+public class PropertiesListTask extends VisorMultiNodeTask<VoidDto, 
PropertiesListResult, PropertiesListResult> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** {@inheritDoc} */
+    @Override protected VisorJob<VoidDto, PropertiesListResult> job(VoidDto 
arg) {
+        return new PropertiesListJob(debug);
+    }
+
+    /** {@inheritDoc} */
+    @Nullable @Override protected PropertiesListResult 
reduce0(List<ComputeJobResult> results) {
+        if (results.isEmpty())
+            throw new IgniteException("Empty job results");
+
+        if (results.size() > 1)
+            throw new IgniteException("Invalid job results: " + results);
+
+        if (results.get(0).getException() != null)
+            throw results.get(0).getException();
+        else
+            return results.get(0).getData();
+    }
+
+    /**
+     * Job for getting binary metadata.

Review comment:
       wrong comment




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to