From 5fb15c2cb3a6c8a87b13269e914df9aab4943b14 Mon Sep 17 00:00:00 2001 From: Aleksandr Pakhomov Date: Wed, 22 May 2024 12:09:29 +0300 Subject: [PATCH] IGNITE-22108 Rename options in CLI (#3750) Some options were reviewed. For example, cluster-name -> name. Also, short options that clash with each other are dropped. --- DEVNOTES.md | 4 +- README.md | 4 +- assembly/README.md | 2 +- .../config/memory-quotas.adoc | 6 +- docs/_docs/ignite-cli-tool.adoc | 60 ++++----- .../quick-start/getting-started-guide.adoc | 8 +- .../example/sql/jdbc/SqlJdbcExample.java | 2 +- .../PersistentPageMemoryStorageExample.java | 2 +- .../storage/RocksDbStorageExample.java | 2 +- .../VolatilePageMemoryStorageExample.java | 2 +- .../example/table/KeyValueViewExample.java | 2 +- .../table/KeyValueViewPojoExample.java | 2 +- .../example/table/RecordViewExample.java | 2 +- .../example/table/RecordViewPojoExample.java | 2 +- .../example/tx/TransactionsExample.java | 2 +- modules/cli/README.md | 8 +- .../internal/cli/commands/ItNodeNameTest.java | 6 +- ...lusterConfigCommandNotInitializedTest.java | 2 +- .../cluster/init/ItClusterInitTest.java | 4 +- ...ItClusterStatusCommandInitializedTest.java | 2 +- ...lusterStatusCommandNotInitializedTest.java | 2 +- ...TopologyCommandInitializedClusterTest.java | 4 +- ...ologyCommandNotInitializedClusterTest.java | 4 +- .../configuration/ItConfigCommandTest.java | 34 ++--- .../ItEnabledNodeMetricCommandTest.java | 4 +- .../metric/ItNodeMetricCommandTest.java | 6 +- .../commands/node/NodeVersionCommandTest.java | 2 +- .../cli/commands/sql/ItSqlCommandTest.java | 4 +- .../commands/sql/ItSqlReplCommandTest.java | 4 +- .../commands/unit/ItDeploymentUnitTest.java | 8 +- .../executor/ItIgnitePicocliCommandsTest.java | 60 ++++----- .../ignite/internal/cli/commands/Options.java | 125 +++++++----------- .../internal/cli/commands/ProfileMixin.java | 3 +- .../CliConfigProfileCreateCommand.java | 6 +- .../cli/commands/cluster/ClusterUrlMixin.java | 3 +- .../cluster/init/ClusterInitOptions.java | 17 +-- .../unit/ClusterUnitUndeployCommand.java | 5 +- .../unit/ClusterUnitUndeployReplCommand.java | 5 +- .../cluster/unit/UnitDeployOptionsMixin.java | 14 +- .../cli/commands/node/NodeUrlMixin.java | 3 +- .../commands/node/NodeUrlProfileMixin.java | 3 +- .../internal/cli/commands/sql/SqlCommand.java | 7 +- .../cli/commands/sql/SqlReplCommand.java | 9 +- .../core/repl/completer/CompleterConf.java | 2 +- .../ClusterUrlDynamicCompleterFactory.java | 2 +- .../filter/DynamicCompleterFilter.java | 5 +- .../node/NodeNameDynamicCompleterFactory.java | 2 +- .../cli/commands/ProfileMixinTest.java | 12 +- .../cli/commands/UrlOptionsNegativeTest.java | 39 +++--- .../cli/commands/cluster/ClusterInitTest.java | 38 +++--- .../cluster/config/ClusterConfigTest.java | 12 +- .../commands/node/config/NodeConfigTest.java | 12 +- .../commands/node/metric/NodeMetricTest.java | 8 +- .../cli/commands/sql/SqlCommandTest.java | 10 +- .../repl/SessionDefaultValueProviderTest.java | 3 +- .../completer/HoconDynamicCompleterTest.java | 8 +- .../filter/DynamicCompleterFilterTest.java | 14 +- .../NonRepeatableOptionsFilterTest.java | 6 +- 58 files changed, 278 insertions(+), 351 deletions(-) diff --git a/DEVNOTES.md b/DEVNOTES.md index 572c4fba008..bdfcb0c979e 100644 --- a/DEVNOTES.md +++ b/DEVNOTES.md @@ -275,7 +275,7 @@ the docker image using `cli` parameter and connect to nodes using their names fr docker compose -f packaging/docker/docker-compose.yml up -d docker run -it --rm --net ignite3_default apacheignite/ignite3 cli > connect http://node1:10300 -> cluster init --cluster-name cluster --meta-storage-node node1 --meta-storage-node node2 --meta-storage-node node3 +> cluster init --name cluster --meta-storage-node node1 --meta-storage-node node2 --meta-storage-node node3 ``` ### How to launch multiple nodes on the same machine @@ -388,7 +388,7 @@ To initialize a cluster run the following command inside Ignite CLI: ```shell cluster init - --cluster-name myClusterOfThreeNodes + --name myClusterOfThreeNodes --cmg-node node1 --cmg-node node2 --cmg-node node3 --meta-storage-node node1 --meta-storage-node node2 --meta-storage-node node3 ``` diff --git a/README.md b/README.md index 8d26ff866a7..2351a260dc8 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ cd ../ignite3-cli-3.0.0-beta1 In CLI you need to initialize simple cluster via the following command: ``` -cluster init --cluster-name myCluster --cmg-node defaultNode --meta-storage-node defaultNode +cluster init --name myCluster --cmg-node defaultNode --meta-storage-node defaultNode ``` Now CLI can be switched into SQL interactive mode with command: @@ -113,7 +113,7 @@ docker run -it --rm --net ignite3_default apacheignite/ignite3 cli ``` > connect http://node1:10300 -> cluster init --cluster-name cluster --meta-storage-node node1 --meta-storage-node node2 --meta-storage-node node3 +> cluster init --name cluster --meta-storage-node node1 --meta-storage-node node2 --meta-storage-node node3 ``` For more information, you can check the [Developer notes](./DEVNOTES.md) diff --git a/assembly/README.md b/assembly/README.md index c199032ea8d..7331cbf9ce2 100644 --- a/assembly/README.md +++ b/assembly/README.md @@ -70,7 +70,7 @@ To run any other example, do the following: ``` 4. (optional) If the cluster is not initialized then initialize the cluster: ``` - ignite3 cluster init --cluster-name=ignite-cluster --cluster-endpoint-url=http://localhost:10300 --meta-storage-node=defauldNode + ignite3 cluster init --name=ignite-cluster --url=http://localhost:10300 --meta-storage-node=defauldNode ``` 5. Run the preferred example in the IDE. diff --git a/docs/_docs/administrators-guide/config/memory-quotas.adoc b/docs/_docs/administrators-guide/config/memory-quotas.adoc index 8d1b59a492d..11e8c77a80f 100644 --- a/docs/_docs/administrators-guide/config/memory-quotas.adoc +++ b/docs/_docs/administrators-guide/config/memory-quotas.adoc @@ -32,7 +32,7 @@ By default, a quota for SQL queries is set to 60% of the heap memory available t [source, bash] ---- -node config update --node-url http://localhost:10300 {sql.nodeMemoryQuota:"1000M"} +node config update --url http://localhost:10300 {sql.nodeMemoryQuota:"1000M"} ---- If the node memory quota is exceeded, the query is interrupted and the `SQL query ran out of memory: Node quota was exceeded` error is returned. @@ -43,7 +43,7 @@ By default, each individual query can use the entire memory quota. This may be u [source, bash] ---- -cluster config update --cluster-endpoint-url http://localhost:10300 {sql.statementMemoryQuota:"10M"} +cluster config update --url http://localhost:10300 {sql.statementMemoryQuota:"10M"} ---- -If the statement memory quota is exceeded, the query is interrupted and the `SQL query ran out of memory: Statement quota was exceeded` error is returned. \ No newline at end of file +If the statement memory quota is exceeded, the query is interrupted and the `SQL query ran out of memory: Statement quota was exceeded` error is returned. diff --git a/docs/_docs/ignite-cli-tool.adoc b/docs/_docs/ignite-cli-tool.adoc index e585e200136..fb80cc49aa1 100644 --- a/docs/_docs/ignite-cli-tool.adoc +++ b/docs/_docs/ignite-cli-tool.adoc @@ -52,7 +52,7 @@ These commands help you configure your CLI tool and cluster. | `cli config profile show` | | Gets the current profile details. | `cli config get` | `` | Gets the value for the specified configuration key. | `cli config set` | `` | Sets configuration parameters using comma-separated input key-value pair(s). -| `cli config show` | `[--cluster-endpoint-url] [--selector]` | Shows the cluster configuration. +| `cli config show` | `[--url] [--selector]` | Shows the cluster configuration. | `cli config remove` | `` | Removes a configuration key. |=== @@ -63,14 +63,14 @@ These commands let you manage your cluster. [cols="1,1,3",opts="header", stripes=none] |=== | Command| Parameters | Description -| `cluster init` | `[--cmg-node] [--meta-storage-node] or < --cluster-endpoint-url> or < --cluster-config-file>`| Initializes a cluster. -| `cluster status` | `[--cluster-endpoint-url]` | Displays the detailed status of the specified cluster. -| `cluster topology physical` | `[--plain] [--cluster-endpoint-url]` | Shows physical topology of the specified cluster. -| `cluster topology logical` | `[--plain] [--cluster-endpoint-url]` | Shows logical topology of the specified cluster. +| `cluster init` | `[--cmg-node] [--meta-storage-node] or < --url> or < --config-file>`| Initializes a cluster. +| `cluster status` | `[--url]` | Displays the detailed status of the specified cluster. +| `cluster topology physical` | `[--plain] [--url]` | Shows physical topology of the specified cluster. +| `cluster topology logical` | `[--plain] [--url]` | Shows logical topology of the specified cluster. | `cluster unit deploy` | `[clusterUrl] [--nodes] ` | Deploys a unit for the cluster. | `cluster unit undeploy` | `[clusterUrl] ` | Undeploys a cluster's unit. | `cluster unit list` | `[--plain] [clusterUrl] [--status] [[--version]]` | Lists cluster's deployed units. -| `connect` | `[--username] [--password] --node-url[--node-name]` | Connects to the specified cluster, or to `localhost:3000` if no cluster is specified. All subsequent commands use the specified cluster URL. +| `connect` | `[--username] [--password] --url[--node]` | Connects to the specified cluster, or to `localhost:3000` if no cluster is specified. All subsequent commands use the specified cluster URL. | `disconnect` || Disconnects from the current cluster. |=== @@ -91,15 +91,15 @@ These commands address specific node(s) in a cluster. [cols="1,1,3",opts="header", stripes=none] |=== | Command| Parameters | Description -| `node config show` | `[--node-url]/[--node-name] [--selector]` | Gets the specified node configuration. -|`node config update` | `[--node-url]/[--node-name] [...]` | Updates the local node configuration with the arguments in the HOCON format. -| `node status` | `[--node-url]/[--node-name]` |Shows the status of the default node, or a different one if specified. -| `node version` | `[--node-url]/[--node-name]` |Shows the node's build version. -| `node metric list` | `[--node-url]/[--node-name][--plain]` |Lists node's metrics. -| `node metric source enable` | `[--node-url]/[--node-name]` |Enables a metric source for the node. -| `node metric source disable` | `[--node-url]/[--node-name]` |Disables a metric source for the node. -| `node metric source list` | `[--node-url]/[--node-name][--plain]` |Lists node metrics' sources. -| `node unit list` | `[--plain] [--status] [ [--version]] [--node-url]/[--node-name]]` |Lists node's deployment units. +| `node config show` | `[--url]/[--node] [--selector]` | Gets the specified node configuration. +|`node config update` | `[--url]/[--node] [...]` | Updates the local node configuration with the arguments in the HOCON format. +| `node status` | `[--url]/[--node]` |Shows the status of the default node, or a different one if specified. +| `node version` | `[--url]/[--node]` |Shows the node's build version. +| `node metric list` | `[--url]/[--node][--plain]` |Lists node's metrics. +| `node metric source enable` | `[--url]/[--node]` |Enables a metric source for the node. +| `node metric source disable` | `[--url]/[--node]` |Disables a metric source for the node. +| `node metric source list` | `[--url]/[--node][--plain]` |Lists node metrics' sources. +| `node unit list` | `[--plain] [--status] [ [--version]] [--url]/[--node]]` |Lists node's deployment units. |=== === User and Role Commands @@ -109,19 +109,19 @@ These commands help you manage access to the system - users and and roles. [cols="1,1,3",opts="header", stripes=none] |=== | Command| Parameters | Description -|`role create`|`[--cluster-endpoint-url] `| Creates a new role. New roles do not have any privileges. -|`role delete`|`[--cluster-endpoint-url] `| Deletes the specified role. Role with assigned privileges cannot be deleted. -|`role list`|`[--plain] [--cluster-endpoint-url] [--user]`| Lists roles for the specified cluster, optionally filtered by user(s). -|`role show`|`[--with-privileges] [--with-users] [--cluster-endpoint-url] `| Shows the role information, optionally including privileges assigned to the role and/or the users who have that role. -|`role privilege grant`|`[--on] [--cluster-endpoint-url] [--action] --to`| Grants to the specified role a privilege (permission to perform the specified action on an the specified object). For more information, see link:security/permissions[User Permissions and Roles]. -|`role privilege revoke`|`[--action] [--from] [--cluster-endpoint-url] --to`|Revoke privilege(s) (permissions)(s) to perform the specified action on the specified object) from the role. For more information, see link:security/permissions[User Permissions and Roles]. +|`role create`|`[--url] `| Creates a new role. New roles do not have any privileges. +|`role delete`|`[--url] `| Deletes the specified role. Role with assigned privileges cannot be deleted. +|`role list`|`[--plain] [--url] [--user]`| Lists roles for the specified cluster, optionally filtered by user(s). +|`role show`|`[--with-privileges] [--with-users] [--url] `| Shows the role information, optionally including privileges assigned to the role and/or the users who have that role. +|`role privilege grant`|`[--on] [--url] [--action] --to`| Grants to the specified role a privilege (permission to perform the specified action on an the specified object). For more information, see link:security/permissions[User Permissions and Roles]. +|`role privilege revoke`|`[--action] [--from] [--url] --to`|Revoke privilege(s) (permissions)(s) to perform the specified action on the specified object) from the role. For more information, see link:security/permissions[User Permissions and Roles]. | `user create` |`[--password] [cluster-endpoint-url] ` | Creates a new user. -| `user delete` |`[--cluster-endpoint-url] [--with-revoke] `| Deletes the user. -| `user edit` |`[--password] [--cluster-endpoint-url] ` | Edits user configuration. -| `user list` |`[--plain] [--cluster-endpoint-url] [--role]`| Provides a list of users on the server, optionally filtered by role(s). -| `user show` |`[--with-roles] [--cluster-endpoint-url] `| Provides extended information about the specific user, optionally with information about roles assigned to the user. -| `user role assign` | `[--profile] [--cluster-endpoint-url] [--role] [--to]`| Assigns role(s) to the specified user. -| `user role revoke` | `[--profile] [--cluster-endpoint-url] [--from] [--role]`| Revokes role(s) from the specified user. +| `user delete` |`[--url] [--with-revoke] `| Deletes the user. +| `user edit` |`[--password] [--url] ` | Edits user configuration. +| `user list` |`[--plain] [--url] [--role]`| Provides a list of users on the server, optionally filtered by role(s). +| `user show` |`[--with-roles] [--url] `| Provides extended information about the specific user, optionally with information about roles assigned to the user. +| `user role assign` | `[--profile] [--url] [--role] [--to]`| Assigns role(s) to the specified user. +| `user role revoke` | `[--profile] [--url] [--from] [--role]`| Revokes role(s) from the specified user. |=== === Miscellaneous Commands @@ -134,7 +134,7 @@ These are general-purpose commands. | `cls` || Clears the terminal. | `exit` || Stops the current interactive session. | `help` | `` | Provides information on available command groups, commands in the specified group, or for the specified command. -| `sql` | `[--plain] [jdbc-url] [--script-file] `| Executes the specified SQL query (command) or teh queries included in the specified file, on the specified cluster. -|`token revoke`|`[--cluster-endpoint-url] [--profile] [--token\|--username]`| Revokes the link:security/jwt[JWT token]. Can revoke a specific token, or all tokens from the user. +| `sql` | `[--plain] [jdbc-url] [--file] `| Executes the specified SQL query (command) or teh queries included in the specified file, on the specified cluster. +|`token revoke`|`[--url] [--profile] [--token\|--username]`| Revokes the link:security/jwt[JWT token]. Can revoke a specific token, or all tokens from the user. | `version` || Displays the current CLI tool version. -|=== \ No newline at end of file +|=== diff --git a/docs/_docs/quick-start/getting-started-guide.adoc b/docs/_docs/quick-start/getting-started-guide.adoc index 72186470e6f..f307eaeabd8 100644 --- a/docs/_docs/quick-start/getting-started-guide.adoc +++ b/docs/_docs/quick-start/getting-started-guide.adoc @@ -143,7 +143,7 @@ You can change your cluster or node configuration by using the Ignite CLI. . To see the current configuration, run the following command: + ---- -node config show --node-url http://localhost:10300 +node config show --url http://localhost:10300 ---- + This command prints the configuration file in the HOCON format. Note the `maxSize` value under `aimen.regions`. @@ -151,13 +151,13 @@ This command prints the configuration file in the HOCON format. Note the `maxSiz . Request an increase of the `maxSize` value: + ---- -node config update --node-url http://localhost:10300 {aimem.regions:[{name:btree_volatile_region,maxSize:412000000}]} +node config update --url http://localhost:10300 {aimem.regions:[{name:btree_volatile_region,maxSize:412000000}]} ---- + . To verify the result, run the `show` command again: + ---- -node config show --node-url http://localhost:10300 +node config show --url http://localhost:10300 ---- + Note that `maxSize` has increased to the value you had requested. @@ -187,4 +187,4 @@ bash bin\ignite3db stop From here, you may want to: * Check out the link:ignite-cli-tool[Ignite CLI Tool] page for more detail on supported commands -* Try out our link:https://github.com/apache/ignite-3/tree/main/examples[examples] \ No newline at end of file +* Try out our link:https://github.com/apache/ignite-3/tree/main/examples[examples] diff --git a/examples/src/main/java/org/apache/ignite/example/sql/jdbc/SqlJdbcExample.java b/examples/src/main/java/org/apache/ignite/example/sql/jdbc/SqlJdbcExample.java index 51db41fdbae..bb7bec9bbec 100644 --- a/examples/src/main/java/org/apache/ignite/example/sql/jdbc/SqlJdbcExample.java +++ b/examples/src/main/java/org/apache/ignite/example/sql/jdbc/SqlJdbcExample.java @@ -39,7 +39,7 @@ * *
  • * Cluster initialization using the CLI tool (if not done yet):
    - * {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} + * {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} *
  • *
  • Run the example in the IDE.
  • *
  • diff --git a/examples/src/main/java/org/apache/ignite/example/storage/PersistentPageMemoryStorageExample.java b/examples/src/main/java/org/apache/ignite/example/storage/PersistentPageMemoryStorageExample.java index 7d982bda371..3de2a5c7aa4 100644 --- a/examples/src/main/java/org/apache/ignite/example/storage/PersistentPageMemoryStorageExample.java +++ b/examples/src/main/java/org/apache/ignite/example/storage/PersistentPageMemoryStorageExample.java @@ -33,7 +33,7 @@ *
  • *
  • * Cluster initialization using the CLI tool (if not done yet):
    - * {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} + * {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} *
  • *
  • * Add configuration for a persistent data region of the PageMemory storage engine using the CLI tool (if not done yet):
    diff --git a/examples/src/main/java/org/apache/ignite/example/storage/RocksDbStorageExample.java b/examples/src/main/java/org/apache/ignite/example/storage/RocksDbStorageExample.java index 6f1b9a0edd8..a7fbf9514f3 100644 --- a/examples/src/main/java/org/apache/ignite/example/storage/RocksDbStorageExample.java +++ b/examples/src/main/java/org/apache/ignite/example/storage/RocksDbStorageExample.java @@ -33,7 +33,7 @@ *
  • *
  • * Cluster initialization using the CLI tool (if not done yet):
    - * {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} + * {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} *
  • *
  • * Add configuration for a data region of the RocksDB storage engine using the CLI tool (if not done yet):
    diff --git a/examples/src/main/java/org/apache/ignite/example/storage/VolatilePageMemoryStorageExample.java b/examples/src/main/java/org/apache/ignite/example/storage/VolatilePageMemoryStorageExample.java index 7556e4e52bd..c720efdb344 100644 --- a/examples/src/main/java/org/apache/ignite/example/storage/VolatilePageMemoryStorageExample.java +++ b/examples/src/main/java/org/apache/ignite/example/storage/VolatilePageMemoryStorageExample.java @@ -33,7 +33,7 @@ *
  • *
  • * Cluster initialization using the CLI tool (if not done yet):
    - * {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} + * {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} *
  • *
  • * Add configuration for an in-memory data region of the PageMemory storage engine using the CLI tool (if not done yet):
    diff --git a/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewExample.java b/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewExample.java index 014820f1a4c..4ba1d62e27a 100644 --- a/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewExample.java +++ b/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewExample.java @@ -40,7 +40,7 @@ *
  • *
  • * Cluster initialization using the CLI tool (if not done yet):
    - * {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} + * {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} *
  • *
  • Run the example in the IDE.
  • *
  • diff --git a/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewPojoExample.java b/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewPojoExample.java index 7c7873b0f6a..501291182f2 100644 --- a/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewPojoExample.java +++ b/examples/src/main/java/org/apache/ignite/example/table/KeyValueViewPojoExample.java @@ -39,7 +39,7 @@ *
  • *
  • * Cluster initialization using the CLI tool (if not done yet):
    - * {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} + * {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} *
  • *
  • Run the example in the IDE.
  • *
  • diff --git a/examples/src/main/java/org/apache/ignite/example/table/RecordViewExample.java b/examples/src/main/java/org/apache/ignite/example/table/RecordViewExample.java index 4a37492bfdf..81113cdfee8 100644 --- a/examples/src/main/java/org/apache/ignite/example/table/RecordViewExample.java +++ b/examples/src/main/java/org/apache/ignite/example/table/RecordViewExample.java @@ -40,7 +40,7 @@ *
  • *
  • * Cluster initialization using the CLI tool (if not done yet):
    - * {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} + * {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} *
  • *
  • Run the example in the IDE.
  • *
  • diff --git a/examples/src/main/java/org/apache/ignite/example/table/RecordViewPojoExample.java b/examples/src/main/java/org/apache/ignite/example/table/RecordViewPojoExample.java index dd2c21ba0c1..e810fbc4ec3 100644 --- a/examples/src/main/java/org/apache/ignite/example/table/RecordViewPojoExample.java +++ b/examples/src/main/java/org/apache/ignite/example/table/RecordViewPojoExample.java @@ -39,7 +39,7 @@ *
  • *
  • * Cluster initialization using the CLI tool (if not done yet):
    - * {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} + * {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} *
  • *
  • Run the example in the IDE.
  • *
  • diff --git a/examples/src/main/java/org/apache/ignite/example/tx/TransactionsExample.java b/examples/src/main/java/org/apache/ignite/example/tx/TransactionsExample.java index d39af4a278b..87150ce4d03 100644 --- a/examples/src/main/java/org/apache/ignite/example/tx/TransactionsExample.java +++ b/examples/src/main/java/org/apache/ignite/example/tx/TransactionsExample.java @@ -41,7 +41,7 @@ *
  • *
  • * Cluster initialization using the CLI tool (if not done yet):
    - * {@code ignite cluster init --cluster-name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} + * {@code ignite cluster init --name=ignite-cluster --node-endpoint=localhost:10300 --meta-storage-node=my-first-node} *
  • *
  • Run the example in the IDE.
  • *
  • diff --git a/modules/cli/README.md b/modules/cli/README.md index b2d7041cb7b..345a7672d09 100644 --- a/modules/cli/README.md +++ b/modules/cli/README.md @@ -7,7 +7,7 @@ Non-interactive (or non-REPL) command is a command that executes under `ignite` top command. Example of non-interactive command: ```bash -> ignite node status --node-url http://localhost:10300 +> ignite node status --url http://localhost:10300 ``` The non-REPL fronted is responsible for: @@ -22,7 +22,7 @@ Interactive (or REPL, Read-Eval-Print-Loop) mode can be activated by `ignite` co ```bash > ignite -[diconnected]> node status --node-url http://localhost:10300 +[diconnected]> node status --url http://localhost:10300 ``` The REPL frontend is responsible for: @@ -57,9 +57,9 @@ Example [`SqlExceptionHandler`](src/main/java/org/apache/ignite/internal/cli/cor ### Flow For the interactive mode there is a common situation when a user is not connected to any node and executes some command. -The user might forget to connect to the node and always type `--node-url` option instead of connecting to the node once and type only +The user might forget to connect to the node and always type `--url` option instead of connecting to the node once and type only commands. -So, it is useful to ask the user if he/she wants to connect to the node with the last `--node-url` value. +So, it is useful to ask the user if he/she wants to connect to the node with the last `--url` value. It might be implemented as several checks and read-line operations in every interactive command. To avoid code duplication the [`Flow`](src/main/java/org/apache/ignite/internal/cli/core/flow/Flow.java) was introduced. diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/ItNodeNameTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/ItNodeNameTest.java index 7838d3074f5..f1dc6459e2b 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/ItNodeNameTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/ItNodeNameTest.java @@ -59,7 +59,7 @@ void nodeUrls() { @DisplayName("Should display node version with provided node name") void nodeVersion() { // When - execute("node", "version", "--node-name", nodeName()); + execute("node", "version", "--node", nodeName()); // Then assertAll( @@ -73,7 +73,7 @@ void nodeVersion() { @DisplayName("Should display node config with provided node name") void nodeConfig() { // When - execute("node", "config", "show", "--node-name", nodeName()); + execute("node", "config", "show", "--node", nodeName()); // Then assertAll( @@ -88,7 +88,7 @@ void nodeConfig() { void nodeStatus() { // When String nodeName = nodeName(); - execute("node", "status", "--node-name", nodeName); + execute("node", "status", "--node", nodeName); // Then assertAll( diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/config/ItClusterConfigCommandNotInitializedTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/config/ItClusterConfigCommandNotInitializedTest.java index 132666134dc..bff92f6ddc3 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/config/ItClusterConfigCommandNotInitializedTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/config/ItClusterConfigCommandNotInitializedTest.java @@ -30,7 +30,7 @@ class ItClusterConfigCommandNotInitializedTest extends CliCommandTestNotInitiali @Test @DisplayName("Should print error message when run cluster config show on not initialized cluster") void printStatus() { - execute("cluster", "config", "show", "--cluster-endpoint-url", NODE_URL); + execute("cluster", "config", "show", "--url", NODE_URL); assertAll( this::assertOutputIsEmpty, diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/init/ItClusterInitTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/init/ItClusterInitTest.java index 938ae3f7c65..31801a88397 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/init/ItClusterInitTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/init/ItClusterInitTest.java @@ -53,8 +53,8 @@ void initClusterWithBasicAuthentication() throws InterruptedException { "cluster", "init", "--meta-storage-node", testNodeName(TEST_INFO, 1), "--cmg-node", testNodeName(TEST_INFO, 2), - "--cluster-name", "cluster", - "--cluster-config-file", clusterConfigurationFile.getAbsolutePath() + "--name", "cluster", + "--config-file", clusterConfigurationFile.getAbsolutePath() ); assertAll( diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/status/ItClusterStatusCommandInitializedTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/status/ItClusterStatusCommandInitializedTest.java index 3af8b4d932b..b391b69035a 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/status/ItClusterStatusCommandInitializedTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/status/ItClusterStatusCommandInitializedTest.java @@ -38,7 +38,7 @@ void printStatus() { .map(IgniteImpl::name) .collect(joining(", ", "[", "]")); - execute("cluster", "status", "--cluster-endpoint-url", NODE_URL); + execute("cluster", "status", "--url", NODE_URL); assertAll( this::assertExitCodeIsZero, diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/status/ItClusterStatusCommandNotInitializedTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/status/ItClusterStatusCommandNotInitializedTest.java index 413b57f4b56..0cfb4f087f3 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/status/ItClusterStatusCommandNotInitializedTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/status/ItClusterStatusCommandNotInitializedTest.java @@ -31,7 +31,7 @@ class ItClusterStatusCommandNotInitializedTest extends CliCommandTestNotInitiali @Test @DisplayName("Should print status when valid cluster url is given but cluster is not initialized") void printStatus() { - execute("cluster", "status", "--cluster-endpoint-url", NODE_URL); + execute("cluster", "status", "--url", NODE_URL); assertAll( this::assertExitCodeIsZero, diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/topology/ItTopologyCommandInitializedClusterTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/topology/ItTopologyCommandInitializedClusterTest.java index 81661e0240e..0e7b9b376db 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/topology/ItTopologyCommandInitializedClusterTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/topology/ItTopologyCommandInitializedClusterTest.java @@ -32,7 +32,7 @@ class ItTopologyCommandInitializedClusterTest extends CliIntegrationTest { @DisplayName("Should print physical topology when valid cluster url is provided") void printPhysicalTopology() { // When - execute("cluster", "topology", "physical", "--cluster-endpoint-url", NODE_URL); + execute("cluster", "topology", "physical", "--url", NODE_URL); // Then assertAll( @@ -46,7 +46,7 @@ void printPhysicalTopology() { @DisplayName("Should print logical topology when valid cluster url is provided but cluster") void printLogicalTopology() { // When - execute("cluster", "topology", "logical", "--cluster-endpoint-url", NODE_URL); + execute("cluster", "topology", "logical", "--url", NODE_URL); // Then assertAll( diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/topology/ItTopologyCommandNotInitializedClusterTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/topology/ItTopologyCommandNotInitializedClusterTest.java index c03ff780d7b..1ea37fe92f3 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/topology/ItTopologyCommandNotInitializedClusterTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/cluster/topology/ItTopologyCommandNotInitializedClusterTest.java @@ -32,7 +32,7 @@ class ItTopologyCommandNotInitializedClusterTest extends CliCommandTestNotInitia @DisplayName("Should print physical topology when valid cluster url is provided") void printPhysicalTopology() { // When - execute("cluster", "topology", "physical", "--cluster-endpoint-url", NODE_URL); + execute("cluster", "topology", "physical", "--url", NODE_URL); // Then assertAll( @@ -46,7 +46,7 @@ void printPhysicalTopology() { @DisplayName("Should not print logical topology when valid cluster url is provided but cluster is not initialized") void printLogicalTopology() { // When - execute("cluster", "topology", "logical", "--cluster-endpoint-url", NODE_URL); + execute("cluster", "topology", "logical", "--url", NODE_URL); // Then prints nothing assertAll( diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/configuration/ItConfigCommandTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/configuration/ItConfigCommandTest.java index ed82c0760e4..6f0fdf1c3a0 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/configuration/ItConfigCommandTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/configuration/ItConfigCommandTest.java @@ -34,7 +34,7 @@ class ItConfigCommandTest extends CliIntegrationTest { @DisplayName("Should read config when valid cluster-endpoint-url is given") void readDefaultConfig() { // When read cluster config with valid url - execute("cluster", "config", "show", "--cluster-endpoint-url", NODE_URL); + execute("cluster", "config", "show", "--url", NODE_URL); // Then assertAll( @@ -48,7 +48,7 @@ void readDefaultConfig() { @DisplayName("Should update config with hocon format when valid cluster-endpoint-url is given") void addConfigKeyValue() { // When update default data storage to rocksdb - execute("cluster", "config", "update", "--cluster-endpoint-url", NODE_URL, "{metaStorage: {idleSyncTimeInterval: 1000}}"); + execute("cluster", "config", "update", "--url", NODE_URL, "{metaStorage: {idleSyncTimeInterval: 1000}}"); // Then assertAll( @@ -58,7 +58,7 @@ void addConfigKeyValue() { ); // When read the updated cluster configuration - execute("cluster", "config", "show", "--cluster-endpoint-url", NODE_URL); + execute("cluster", "config", "show", "--url", NODE_URL); // Then assertAll( @@ -72,7 +72,7 @@ void addConfigKeyValue() { @DisplayName("Should update config with hocon format when valid cluster-endpoint-url is given") void addNodeConfigKeyValue() { // When update default data storage to rocksdb - execute("node", "config", "update", "--node-url", NODE_URL, + execute("node", "config", "update", "--url", NODE_URL, "network.nodeFinder.netClusterNodes : [ \"localhost:3344\", \"localhost:3345\" ]"); // Then @@ -84,7 +84,7 @@ void addNodeConfigKeyValue() { ); // When read the updated cluster configuration - execute("node", "config", "show", "--node-url", NODE_URL); + execute("node", "config", "show", "--url", NODE_URL); // Then assertAll( @@ -98,7 +98,7 @@ void addNodeConfigKeyValue() { @DisplayName("Should update config with key-value format when valid cluster-endpoint-url is given") void updateConfigWithSpecifiedPath() { // When update default data storage to rocksdb - execute("cluster", "config", "update", "--cluster-endpoint-url", NODE_URL, "metaStorage.idleSyncTimeInterval=2000"); + execute("cluster", "config", "update", "--url", NODE_URL, "metaStorage.idleSyncTimeInterval=2000"); // Then assertAll( @@ -108,7 +108,7 @@ void updateConfigWithSpecifiedPath() { ); // When read the updated cluster configuration - execute("cluster", "config", "show", "--cluster-endpoint-url", NODE_URL); + execute("cluster", "config", "show", "--url", NODE_URL); // Then assertAll( @@ -121,7 +121,7 @@ void updateConfigWithSpecifiedPath() { @Test @DisplayName("Should update config with key-value format when valid cluster-endpoint-url is given") void updateClusterConfigWithoutQuoting() { - execute("cluster", "config", "update", "--cluster-endpoint-url", NODE_URL, + execute("cluster", "config", "update", "--url", NODE_URL, "security.authentication.providers.default={type=basic,users=[{username=asd,password=pass1}]}"); assertAll( @@ -132,7 +132,7 @@ void updateClusterConfigWithoutQuoting() { // Emulate config with spaces - execute("cluster", "config", "update", "--cluster-endpoint-url", NODE_URL, + execute("cluster", "config", "update", "--url", NODE_URL, "security.authentication.providers.default", "=", "{", "type=basic,", "users=[{", "username=asd,", "password=pass2}]}"); assertAll( @@ -146,7 +146,7 @@ void updateClusterConfigWithoutQuoting() { @DisplayName("Test different types of quoted parameters") void updateClusterWithQuotedArgs() { // Emulate quoting config - execute("cluster", "config", "update", "--cluster-endpoint-url", NODE_URL, + execute("cluster", "config", "update", "--url", NODE_URL, "\"security.authentication.providers.default={type=basic,users=[{username=asd,password=pass3}]}\""); assertAll( @@ -156,7 +156,7 @@ void updateClusterWithQuotedArgs() { ); // Emulate quoting config - execute("cluster", "config", "update", "--cluster-endpoint-url", NODE_URL, + execute("cluster", "config", "update", "--url", NODE_URL, "\"security.authentication.providers.default\"", "\"={type=basic,users=[{username=asd,password=pass4}]}\""); assertAll( @@ -166,7 +166,7 @@ void updateClusterWithQuotedArgs() { ); // Emulate quoting config - execute("cluster", "config", "update", "--cluster-endpoint-url", NODE_URL, + execute("cluster", "config", "update", "--url", NODE_URL, "security.authentication.providers.default", "\"={type=basic,users=[{username=asd,password=pass5}]}\""); assertAll( @@ -179,7 +179,7 @@ void updateClusterWithQuotedArgs() { @Test @DisplayName("Test using arguments in parameters") void useOptionsInArguments() { - execute("cluster", "config", "update", "--cluster-endpoint-url", NODE_URL, + execute("cluster", "config", "update", "--url", NODE_URL, "security.authentication.providers.default={type=basic,users=[{username:", "--verbose,", "password=--verbose}]}"); assertAll( @@ -188,7 +188,7 @@ void useOptionsInArguments() { this::assertOutputIsEmpty ); - execute("cluster", "config", "update", "--cluster-endpoint-url", NODE_URL, + execute("cluster", "config", "update", "--url", NODE_URL, "\"security.authentication.providers.default={type=basic,users=[{username: --verbose, password=--verbose}]}\""); assertAll( @@ -200,7 +200,7 @@ void useOptionsInArguments() { @Test void updateWithWrongData() { - execute("node", "config", "update", "--node-url", NODE_URL, "network.foo=\"bar\""); + execute("node", "config", "update", "--url", NODE_URL, "network.foo=\"bar\""); assertAll( () -> assertExitCodeIs(1), @@ -208,7 +208,7 @@ void updateWithWrongData() { this::assertOutputIsEmpty ); - execute("node", "config", "update", "--node-url", NODE_URL, "network.shutdownQuietPeriod=asd"); + execute("node", "config", "update", "--url", NODE_URL, "network.shutdownQuietPeriod=asd"); assertAll( () -> assertExitCodeIs(1), @@ -219,7 +219,7 @@ void updateWithWrongData() { @Test public void partialGet() { - execute("node", "config", "show", "--node-url", NODE_URL, "network"); + execute("node", "config", "show", "--url", NODE_URL, "network"); assertAll( this::assertExitCodeIsZero, this::assertErrOutputIsEmpty, diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/metric/ItEnabledNodeMetricCommandTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/metric/ItEnabledNodeMetricCommandTest.java index 0674e3121cf..1084124654b 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/metric/ItEnabledNodeMetricCommandTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/metric/ItEnabledNodeMetricCommandTest.java @@ -50,7 +50,7 @@ void beforeAll() { @DisplayName("Should display enabled jvm metric source when valid node-url is given") void nodeMetricSourcesList() { // When list node metric sources with valid url - execute("node", "metric", "source", "list", "--plain", "--node-url", NODE_URL); + execute("node", "metric", "source", "list", "--plain", "--url", NODE_URL); // Then assertAll( @@ -68,7 +68,7 @@ void nodeMetricSourcesList() { @DisplayName("Should display node metrics list when valid node-url is given") void nodeMetricEnableNonexistent() { // When list node metric with valid url - execute("node", "metric", "list", "--plain", "--node-url", NODE_URL); + execute("node", "metric", "list", "--plain", "--url", NODE_URL); // Then assertAll( diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/metric/ItNodeMetricCommandTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/metric/ItNodeMetricCommandTest.java index 9d6e6e81c2b..ae7352a2095 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/metric/ItNodeMetricCommandTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/metric/ItNodeMetricCommandTest.java @@ -31,7 +31,7 @@ class ItNodeMetricCommandTest extends CliIntegrationTest { @DisplayName("Should display disabled jvm metric source when valid node-url is given") void nodeMetricList() { // When list node metric with valid url - execute("node", "metric", "source", "list", "--plain", "--node-url", NODE_URL); + execute("node", "metric", "source", "list", "--plain", "--url", NODE_URL); // Then assertAll( @@ -49,7 +49,7 @@ void nodeMetricList() { @DisplayName("Should display error message when enabling nonexistent metric source and valid node-url is given") void nodeMetricEnableNonexistent() { // When list node metric with valid url - execute("node", "metric", "source", "enable", "no.such.metric", "--node-url", NODE_URL); + execute("node", "metric", "source", "enable", "no.such.metric", "--url", NODE_URL); // Then assertAll( @@ -63,7 +63,7 @@ void nodeMetricEnableNonexistent() { @DisplayName("Should display error message when disabling nonexistent metric source and valid node-url is given") void nodeMetricDisableNonexistent() { // When list node metric with valid url - execute("node", "metric", "source", "disable", "no.such.metric", "--node-url", NODE_URL); + execute("node", "metric", "source", "disable", "no.such.metric", "--url", NODE_URL); // Then assertAll( diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/node/NodeVersionCommandTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/node/NodeVersionCommandTest.java index a11f3b4085f..6f092dae920 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/node/NodeVersionCommandTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/node/NodeVersionCommandTest.java @@ -29,7 +29,7 @@ public class NodeVersionCommandTest extends CliCommandTestNotInitializedIntegrat @DisplayName("Should display node version with provided cluster url") void nodeVersion() { // When - execute("node", "version", "--node-url", NODE_URL); + execute("node", "version", "--url", NODE_URL); // Then assertAll( diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/sql/ItSqlCommandTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/sql/ItSqlCommandTest.java index c8dc9a5a15b..416319d22db 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/sql/ItSqlCommandTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/sql/ItSqlCommandTest.java @@ -31,7 +31,7 @@ class ItSqlCommandTest extends CliSqlCommandTestBase { @Test @DisplayName("Should throw error if executed with non-existing file") void nonExistingFile() { - execute("sql", "-f", "nonexisting", "--jdbc-url", JDBC_URL); + execute("sql", "--file", "nonexisting", "--jdbc-url", JDBC_URL); assertAll( () -> assertExitCodeIs(1), @@ -128,7 +128,7 @@ void createTableWithoutPk() { @DisplayName("Should execute multiline sql script from file") void multilineScript() { String filePath = getClass().getResource("/multiline.sql").getPath(); - execute("sql", "-f", filePath, "--jdbc-url", JDBC_URL); + execute("sql", "--file", filePath, "--jdbc-url", JDBC_URL); assertAll( this::assertExitCodeIsZero, diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/sql/ItSqlReplCommandTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/sql/ItSqlReplCommandTest.java index 8901e999a19..ce4f938c516 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/sql/ItSqlReplCommandTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/sql/ItSqlReplCommandTest.java @@ -36,7 +36,7 @@ protected Class getCommandClass() { @Test @DisplayName("Should throw error if executed with non-existing file") void nonExistingFile() { - execute("-f", "nonexisting", "--jdbc-url", JDBC_URL); + execute("--file", "nonexisting", "--jdbc-url", JDBC_URL); assertAll( this::assertOutputIsEmpty, @@ -82,7 +82,7 @@ void multilineCommand() { @Test void secondInvocationFile() { - execute("-f", "nonexisting", "--jdbc-url", JDBC_URL); + execute("--file", "nonexisting", "--jdbc-url", JDBC_URL); assertAll( this::assertOutputIsEmpty, diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/unit/ItDeploymentUnitTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/unit/ItDeploymentUnitTest.java index 967a14484be..1fc6a0af1ef 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/unit/ItDeploymentUnitTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/commands/unit/ItDeploymentUnitTest.java @@ -173,17 +173,17 @@ void deployToNodesAndStatusCheck() { // Unit is deployed on all requested nodes assertDeployed(id); - execute("node", "unit", "list", "--plain", "--node-url", "http://localhost:10300", id); + execute("node", "unit", "list", "--plain", "--url", "http://localhost:10300", id); // Unit is deployed on the CMG node assertDeployed(id); - execute("node", "unit", "list", "--plain", "--node-url", "http://localhost:10301", id); + execute("node", "unit", "list", "--plain", "--url", "http://localhost:10301", id); // Unit is deployed on the requested node assertDeployed(id); - execute("node", "unit", "list", "--plain", "--node-url", "http://localhost:10302", id); + execute("node", "unit", "list", "--plain", "--url", "http://localhost:10302", id); // Unit is not deployed on the other node assertAll( @@ -216,7 +216,7 @@ void deployToAllAndStatusCheck() { CLUSTER.runningNodes().forEach(ignite -> { String nodeUrl = "http://" + ignite.restHttpAddress().toString(); - execute("node", "unit", "list", "--plain", "--node-url", nodeUrl, id); + execute("node", "unit", "list", "--plain", "--url", nodeUrl, id); // Unit is deployed on the node assertDeployed(id); diff --git a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java index ec10396fead..f0990a8752c 100644 --- a/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java +++ b/modules/cli/src/integrationTest/java/org/apache/ignite/internal/cli/core/repl/executor/ItIgnitePicocliCommandsTest.java @@ -151,8 +151,8 @@ private Stream helpAndVerboseAreNotCompletedSource() { words("node", "config", ""), words("node", "config", "show"), words("node", "config", "show", ""), - words("node", "config", "show", "--node-name", "name"), - words("node", "config", "show", "--node-name", "name", "") + words("node", "config", "show", "--node", "name"), + words("node", "config", "show", "--node", "name", "") ).map(this::named).map(Arguments::of); } @@ -177,7 +177,7 @@ private Stream helpAndVerboseCompletedSource() { words("node", "config", "show", "--"), words("node", "status", "-"), words("node", "status", "--"), - words("node", "config", "show", "--node-name", "name", "-") + words("node", "config", "show", "--node", "name", "-") ).map(this::named).map(Arguments::of); } @@ -224,7 +224,7 @@ void helpSuggested(ParsedLine givenParsedLine) { private Stream nodeConfigShowSuggestedSource() { return Stream.of( words("node", "config", "show", ""), - words("node", "config", "show", " --node-name", "nodeName", ""), + words("node", "config", "show", " --node", "nodeName", ""), words("node", "config", "show", " --verbose", ""), words("node", "config", "show", " -v", "") ).map(this::named).map(Arguments::of); @@ -251,7 +251,7 @@ private void connected() { private Stream nodeConfigUpdateSuggestedSource() { return Stream.of( words("node", "config", "update", ""), - words("node", "config", "update", " --node-name", "nodeName", ""), + words("node", "config", "update", " --node", "nodeName", ""), words("node", "config", "update", " --verbose", ""), words("node", "config", "update", " -v", "") ).map(this::named).map(Arguments::of); @@ -284,7 +284,7 @@ void nodeConfigUpdateSuggested(ParsedLine givenParsedLine) { private Stream clusterConfigShowSuggestedSource() { return Stream.of( words("cluster", "config", "show", ""), - words("cluster", "config", "show", " --node-name", "nodeName", ""), + words("cluster", "config", "show", " --node", "nodeName", ""), words("cluster", "config", "show", " --verbose", ""), words("cluster", "config", "show", " -v", "") ).map(this::named).map(Arguments::of); @@ -307,7 +307,7 @@ void clusterConfigShowSuggested(ParsedLine givenParsedLine) { private Stream clusterConfigUpdateSuggestedSource() { return Stream.of( words("cluster", "config", "update", ""), - words("cluster", "config", "update", " --node-name", "nodeName", ""), + words("cluster", "config", "update", " --node", "nodeName", ""), words("cluster", "config", "update", " --verbose", ""), words("cluster", "config", "update", " -v", "") ).map(this::named).map(Arguments::of); @@ -330,24 +330,24 @@ void clusterConfigUpdateSuggested(ParsedLine givenParsedLine) { private Stream nodeNamesSource() { return Stream.of( - words("cluster", "config", "show", "--node-name", ""), - words("cluster", "config", "update", "--node-name", ""), - words("cluster", "status", "--node-name", ""), - words("cluster", "init", "--node-name", ""), + words("cluster", "config", "show", "--node", ""), + words("cluster", "config", "update", "--node", ""), + words("cluster", "status", "--node", ""), + words("cluster", "init", "--node", ""), words("cluster", "init", "--cmg-node", ""), words("cluster", "init", "--meta-storage-node", ""), - words("node", "config", "show", "--node-name", ""), - words("node", "config", "show", "--verbose", "--node-name", ""), - words("node", "config", "update", "--node-name", ""), - words("node", "status", "--node-name", ""), - words("node", "version", "--node-name", ""), - words("node", "metric", "list", "--node-name", "") + words("node", "config", "show", "--node", ""), + words("node", "config", "show", "--verbose", "--node", ""), + words("node", "config", "update", "--node", ""), + words("node", "status", "--node", ""), + words("node", "version", "--node", ""), + words("node", "metric", "list", "--node", "") ).map(this::named).map(Arguments::of); } @ParameterizedTest @MethodSource("nodeNamesSource") - @DisplayName("node names suggested after --node-name option") + @DisplayName("node names suggested after --node option") void nodeNameSuggested(ParsedLine givenParsedLine) { // Given connected(); @@ -363,13 +363,13 @@ void nodeNameSuggested(ParsedLine givenParsedLine) { } @Test - @DisplayName("start/stop node affects --node-name suggestions") + @DisplayName("start/stop node affects --node suggestions") void startStopNodeWhenCompleteNodeName() { // Given int nodeIndex = 1; var igniteNodeName = allNodeNames().get(nodeIndex); // And - var givenParsedLine = words("node", "status", "--node-name", ""); + var givenParsedLine = words("node", "status", "--node", ""); // And assertThat(nodeNameRegistry.names(), empty()); @@ -417,16 +417,16 @@ void suggestedJdbcUrl() { private Stream clusterUrlSource() { return Stream.of( - words("cluster", "config", "show", "--cluster-endpoint-url", ""), - words("cluster", "config", "update", "--cluster-endpoint-url", ""), - words("cluster", "status", "--cluster-endpoint-url", ""), - words("cluster", "init", "--cluster-endpoint-url", "") + words("cluster", "config", "show", "--url", ""), + words("cluster", "config", "update", "--url", ""), + words("cluster", "status", "--url", ""), + words("cluster", "init", "--url", "") ).map(this::named).map(Arguments::of); } @ParameterizedTest @MethodSource("clusterUrlSource") - @DisplayName("cluster url suggested after --cluster-endpoint-url option") + @DisplayName("cluster url suggested after --url option") void suggestedClusterUrl(ParsedLine parsedLine) { // Given connected(); @@ -462,17 +462,17 @@ void suggestedScriptFile() { String someFile = scriptsFolder.getPath() + File.separator + "someFile.sql"; Files.newFile(someFile).deleteOnExit(); - // When complete --script-file with folder typed - List completions1 = complete(words("sql", "--script-file", rootFolder.getPath())); + // When complete --file with folder typed + List completions1 = complete(words("sql", "--file", rootFolder.getPath())); // Then completions contain emptyFolder and scriptsFolder assertThat(completions1, containsInAnyOrder(emptyFolder.getPath(), scriptsFolder.getPath())); - List completions2 = complete(words("sql", "--script-file", scriptsFolder.getPath())); + List completions2 = complete(words("sql", "--file", scriptsFolder.getPath())); // Then completions contain all given files assertThat(completions2, containsInAnyOrder(script1, script2, someFile)); - // When complete --script-file with partial path to script - List completions3 = complete(words("sql", "--script-file", scriptsFolder.getPath() + File.separator + "script")); + // When complete --file with partial path to script + List completions3 = complete(words("sql", "--file", scriptsFolder.getPath() + File.separator + "script")); // Then completions contain script1 and script2 files assertThat(completions3, containsInAnyOrder(script1, script2)); } diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/Options.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/Options.java index 6db9a0d7446..9d0c0d75730 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/Options.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/Options.java @@ -27,32 +27,30 @@ * Constants to use in {@code Option} annotations for commands. */ public enum Options { - CLUSTER_URL(Constants.CLUSTER_URL_OPTION, Constants.URL_OPTION_SHORT, Constants.CLUSTER_URL_OPTION_DESC), - NODE_URL(Constants.NODE_URL_OPTION, Constants.URL_OPTION_SHORT, Constants.NODE_URL_OPTION_DESC), + CLUSTER_URL(Constants.CLUSTER_URL_OPTION, Constants.CLUSTER_URL_OPTION_DESC), + NODE_URL(Constants.NODE_URL_OPTION, Constants.NODE_URL_OPTION_DESC), - CLUSTER_NAME(Constants.CLUSTER_NAME_OPTION, Constants.CLUSTER_NAME_OPTION_SHORT, Constants.CLUSTER_NAME_OPTION_DESC), + CLUSTER_NAME(Constants.CLUSTER_NAME_OPTION, Constants.CLUSTER_NAME_OPTION_DESC), NODE_NAME(Constants.NODE_NAME_OPTION, Constants.NODE_NAME_OPTION_SHORT, Constants.NODE_NAME_OPTION_DESC), - CMG_NODE_NAME(Constants.CMG_NODE_NAME_OPTION, Constants.CMG_NODE_NAME_OPTION_SHORT, Constants.CMG_NODE_NAME_OPTION_DESC), + CMG_NODE_NAME(Constants.CMG_NODE_NAME_OPTION, Constants.CMG_NODE_NAME_OPTION_DESC), META_STORAGE_NODE_NAME( Constants.META_STORAGE_NODE_NAME_OPTION, - Constants.META_STORAGE_NODE_NAME_OPTION_SHORT, Constants.META_STORAGE_NODE_NAME_OPTION_DESC ), - PROFILE(Constants.PROFILE_OPTION, Constants.PROFILE_OPTION_SHORT, Constants.PROFILE_OPTION_DESC), + PROFILE(Constants.PROFILE_OPTION, Constants.PROFILE_OPTION_DESC), PROFILE_COPY_FROM( Constants.PROFILE_COPY_FROM_OPTION, - Constants.PROFILE_COPY_FROM_OPTION_SHORT, Constants.PROFILE_COPY_FROM_OPTION_DESC ), - PROFILE_ACTIVATE(Constants.PROFILE_ACTIVATE_OPTION, Constants.PROFILE_ACTIVATE_OPTION_SHORT, Constants.PROFILE_ACTIVATE_OPTION_DESC), + PROFILE_ACTIVATE(Constants.PROFILE_ACTIVATE_OPTION, Constants.PROFILE_ACTIVATE_OPTION_DESC), - SCRIPT_FILE(Constants.SCRIPT_FILE_OPTION, Constants.SCRIPT_FILE_OPTION_SHORT, Constants.SCRIPT_FILE_OPTION_DESC), - JDBC_URL(Constants.JDBC_URL_OPTION, Constants.JDBC_URL_OPTION_SHORT, Constants.JDBC_URL_OPTION_DESC), + SCRIPT_FILE(Constants.SCRIPT_FILE_OPTION, Constants.SCRIPT_FILE_OPTION_DESC), + JDBC_URL(Constants.JDBC_URL_OPTION, Constants.JDBC_URL_OPTION_DESC), - UNIT_PATH(Constants.UNIT_PATH_OPTION, Constants.UNIT_PATH_OPTION_SHORT, Constants.UNIT_PATH_OPTION_DESC), - UNIT_VERSION(Constants.VERSION_OPTION, Constants.UNIT_VERSION_OPTION_SHORT, Constants.UNIT_VERSION_OPTION_DESC), + UNIT_PATH(Constants.UNIT_PATH_OPTION, Constants.UNIT_PATH_OPTION_DESC), + UNIT_VERSION(Constants.VERSION_OPTION, Constants.UNIT_VERSION_OPTION_DESC), UNIT_NODES(Constants.UNIT_NODES_OPTION, Constants.UNIT_NODES_OPTION, Constants.UNIT_NODES_OPTION_DESC), PLAIN(Constants.PLAIN_OPTION, Constants.PLAIN_OPTION, Constants.PLAIN_OPTION_DESC), @@ -60,10 +58,9 @@ public enum Options { HELP(Constants.HELP_OPTION, Constants.HELP_OPTION_SHORT, Constants.HELP_OPTION_DESC), VERSION(Constants.VERSION_OPTION, Constants.VERSION_OPTION, Constants.VERSION_OPTION_DESC), - CLUSTER_CONFIG(Constants.CLUSTER_CONFIG_OPTION, Constants.CLUSTER_CONFIG_OPTION_SHORT, Constants.CLUSTER_CONFIG_OPTION_DESC), + CLUSTER_CONFIG(Constants.CLUSTER_CONFIG_OPTION, Constants.CLUSTER_CONFIG_OPTION_DESC), CLUSTER_CONFIG_FILE( Constants.CLUSTER_CONFIG_FILE_OPTION, - Constants.CLUSTER_CONFIG_FILE_OPTION_SHORT, Constants.CLUSTER_CONFIG_FILE_OPTION_DESC ); @@ -77,6 +74,12 @@ public enum Options { this.description = description; } + Options(String fullName, String description) { + this.fullName = fullName; + this.shortName = fullName; + this.description = description; + } + public String fullName() { return fullName; } @@ -96,43 +99,38 @@ public String description() { /** Constants for all options. */ public static final class Constants { /** Cluster endpoint URL option long name. */ - public static final String CLUSTER_URL_OPTION = "--cluster-endpoint-url"; + public static final String CLUSTER_URL_OPTION = "--url"; /** Cluster endpoint URL option description. */ - public static final String CLUSTER_URL_OPTION_DESC = "URL of cluster endpoint"; + public static final String CLUSTER_URL_OPTION_DESC = "URL of cluster endpoint. It can be any node URL." + + "If not set, then the default URL from the profile settings will be used"; /** Cluster endpoint URL option description key. */ public static final String CLUSTER_URL_KEY = CliConfigKeys.Constants.CLUSTER_URL; /** Node URL option long name. */ - public static final String NODE_URL_OPTION = "--node-url"; + public static final String NODE_URL_OPTION = "--url"; /** Node URL option description. */ - public static final String NODE_URL_OPTION_DESC = "URL of an Ignite node"; - - /** Node URL or name option description. */ - public static final String NODE_URL_OR_NAME_DESC = "URL or name of an Ignite node"; + public static final String NODE_URL_OPTION_DESC = "URL of a node that will be used as a communication endpoint. " + + "It can be any node URL. If not set, then the default URL from the profile settings will be used"; /** Profile name option long name. */ public static final String PROFILE_OPTION = "--profile"; - /** Profile name option short name. */ - public static final String PROFILE_OPTION_SHORT = "-p"; - /** Profile name option description. */ - public static final String PROFILE_OPTION_DESC = "Profile name"; - - /** URL option short name. */ - public static final String URL_OPTION_SHORT = "-u"; + public static final String PROFILE_OPTION_DESC = "Local CLI profile name. " + + "Profile stores useful settings like default cluster URL, jdbc URL, etc"; /** Node name option long name. */ - public static final String NODE_NAME_OPTION = "--node-name"; + public static final String NODE_NAME_OPTION = "--node"; /** Node name option short name. */ public static final String NODE_NAME_OPTION_SHORT = "-n"; /** Node name option description. */ - public static final String NODE_NAME_OPTION_DESC = "Name of an Ignite node"; + public static final String NODE_NAME_OPTION_DESC = "The name of the node to perform the operation on. " + + "Node names can be seen in the output of the 'cluster topology' command"; /** Verbose option long name. */ public static final String VERBOSE_OPTION = "--verbose"; @@ -141,7 +139,8 @@ public static final class Constants { public static final String VERBOSE_OPTION_SHORT = "-v"; /** Verbose option description. */ - public static final String VERBOSE_OPTION_DESC = "Show additional information: logs, REST calls"; + public static final String VERBOSE_OPTION_DESC = "Show additional information: logs, REST calls." + + "This flag is useful for debugging"; /** Help option long name. */ public static final String HELP_OPTION = "--help"; @@ -155,48 +154,34 @@ public static final class Constants { /** Profile copy from option long name. */ public static final String PROFILE_COPY_FROM_OPTION = "--copy-from"; - /** Profile copy from option short name. */ - public static final String PROFILE_COPY_FROM_OPTION_SHORT = "-c"; - /** Profile copy from option description. */ public static final String PROFILE_COPY_FROM_OPTION_DESC = "Profile whose content will be copied to new one"; /** Profile activate option long name. */ public static final String PROFILE_ACTIVATE_OPTION = "--activate"; - /** Profile activate option short name. */ - public static final String PROFILE_ACTIVATE_OPTION_SHORT = "-a"; - /** Profile activate option description. */ - public static final String PROFILE_ACTIVATE_OPTION_DESC = "Activate new profile as current or not"; + public static final String PROFILE_ACTIVATE_OPTION_DESC = "Activate new profile as current or not. " + + "By activating a profile, you set profile settings for the current session"; /** Cluster management node name option long name. */ public static final String CMG_NODE_NAME_OPTION = "--cmg-node"; - /** Cluster management node name option short name. */ - public static final String CMG_NODE_NAME_OPTION_SHORT = "-c"; - /** Cluster management node name option description. */ public static final String CMG_NODE_NAME_OPTION_DESC = "Name of the node (repeat like '--cmg-node node1 --cmg-node node2' " + "to specify more than one node) that will host the Cluster Management Group." - + "If omitted, then --meta-storage-node values will also supply the nodes for the Cluster Management Group."; + + "If omitted, then --meta-store-node values will also supply the nodes for the Cluster Management Group."; /** Meta storage management node name option long name. */ public static final String META_STORAGE_NODE_NAME_OPTION = "--meta-storage-node"; - /** Meta storage node name option short name. */ - public static final String META_STORAGE_NODE_NAME_OPTION_SHORT = "-m"; - /** Meta storage node name option description. */ - public static final String META_STORAGE_NODE_NAME_OPTION_DESC = "Name of the node (repeat like '--meta-storage-node node1 " - + "--meta-storage-node node2' to specify more than one node) that will host the Meta Storage." + public static final String META_STORAGE_NODE_NAME_OPTION_DESC = "Name of the node (repeat like '--meta-store-node node1 " + + "--meta-store-node node2' to specify more than one node) that will host the Meta Storage." + "If the --cmg-node parameter is omitted, the same nodes will also host the Cluster Management Group."; /** Cluster name option long name. */ - public static final String CLUSTER_NAME_OPTION = "--cluster-name"; - - /** Cluster name option short name. */ - public static final String CLUSTER_NAME_OPTION_SHORT = "-n"; + public static final String CLUSTER_NAME_OPTION = "--name"; /** Cluster name option description. */ public static final String CLUSTER_NAME_OPTION_DESC = "Human-readable name of the cluster"; @@ -205,25 +190,20 @@ public static final class Constants { public static final String PLAIN_OPTION = "--plain"; /** Plain option description. */ - public static final String PLAIN_OPTION_DESC = "Display output with plain formatting"; + public static final String PLAIN_OPTION_DESC = "Display output with plain formatting. " + + "Might be useful if you want to pipe the output to another command"; /** JDBC URL option long name. */ public static final String JDBC_URL_OPTION = "--jdbc-url"; - /** JDBC URL option short name. */ - public static final String JDBC_URL_OPTION_SHORT = "-u"; - /** JDBC URL option description. */ - public static final String JDBC_URL_OPTION_DESC = "JDBC url to ignite cluster"; + public static final String JDBC_URL_OPTION_DESC = "JDBC url to ignite cluster. For example, 'jdbc:ignite:thin://127.0.0.1:10800'"; /** JDBC URL option description key. */ public static final String JDBC_URL_KEY = CliConfigKeys.Constants.JDBC_URL; /** SQL script file option long name. */ - public static final String SCRIPT_FILE_OPTION = "--script-file"; - - /** SQL script file option short name. */ - public static final String SCRIPT_FILE_OPTION_SHORT = "-f"; + public static final String SCRIPT_FILE_OPTION = "--file"; /** SQL script file option description. */ public static final String SCRIPT_FILE_OPTION_DESC = "Path to file with SQL commands to execute"; @@ -232,10 +212,7 @@ public static final class Constants { public static final String VERSION_OPTION = "--version"; /** Version option description. */ - public static final String VERSION_OPTION_DESC = "Print version information and exit"; - - /** Version option short name. */ - public static final String UNIT_VERSION_OPTION_SHORT = "-uv"; + public static final String VERSION_OPTION_DESC = "Print version information"; /** Unit version option description. */ public static final String UNIT_VERSION_OPTION_DESC = "Unit version (x.y.z)"; @@ -243,9 +220,6 @@ public static final class Constants { /** Unit path option long name. */ public static final String UNIT_PATH_OPTION = "--path"; - /** Unit path option short name. */ - public static final String UNIT_PATH_OPTION_SHORT = "-up"; - /** Unit path option description. */ public static final String UNIT_PATH_OPTION_DESC = "Path to deployment unit file or directory"; @@ -253,17 +227,14 @@ public static final class Constants { public static final String UNIT_NODES_OPTION = "--nodes"; /** Unit nodes option description. */ - public static final String UNIT_NODES_OPTION_DESC = "Initial set of nodes to deploy to"; - - public static final String CLUSTER_CONFIG_OPTION = "--cluster-config"; - - public static final String CLUSTER_CONFIG_OPTION_SHORT = "-cfg"; + public static final String UNIT_NODES_OPTION_DESC = "Initial set of nodes where the unit will be deployed"; - public static final String CLUSTER_CONFIG_OPTION_DESC = "Cluster configuration"; + public static final String CLUSTER_CONFIG_OPTION = "--config"; - public static final String CLUSTER_CONFIG_FILE_OPTION = "--cluster-config-file"; + public static final String CLUSTER_CONFIG_OPTION_DESC = "Cluster configuration that " + + "will be applied during the cluster initialization"; - public static final String CLUSTER_CONFIG_FILE_OPTION_SHORT = "-cfgf"; + public static final String CLUSTER_CONFIG_FILE_OPTION = "--config-file"; public static final String CLUSTER_CONFIG_FILE_OPTION_DESC = "Path to cluster configuration file"; @@ -279,10 +250,6 @@ public static final class Constants { public static final String USERNAME_OPTION_DESC = "Username to connect to cluster"; - public static final String USERNAME_KEY = CliConfigKeys.Constants.BASIC_AUTHENTICATION_USERNAME; - - public static final String PASSWORD_KEY = CliConfigKeys.Constants.BASIC_AUTHENTICATION_PASSWORD; - public static final String RECOVERY_PARTITION_GLOBAL_OPTION = "--global"; public static final String RECOVERY_PARTITION_GLOBAL_OPTION_DESC = "Get global partitions states"; diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/ProfileMixin.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/ProfileMixin.java index f82a6f0ccae..d73e0ffe15e 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/ProfileMixin.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/ProfileMixin.java @@ -19,7 +19,6 @@ import static org.apache.ignite.internal.cli.commands.Options.Constants.PROFILE_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.PROFILE_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.PROFILE_OPTION_SHORT; import picocli.CommandLine.Option; @@ -27,7 +26,7 @@ * Mixin for profile option. */ public class ProfileMixin { - @Option(names = {PROFILE_OPTION_SHORT, PROFILE_OPTION}, description = PROFILE_OPTION_DESC) + @Option(names = PROFILE_OPTION, description = PROFILE_OPTION_DESC) private String profileName; /** diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cliconfig/profile/CliConfigProfileCreateCommand.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cliconfig/profile/CliConfigProfileCreateCommand.java index cd87262fdc2..7223090d420 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cliconfig/profile/CliConfigProfileCreateCommand.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cliconfig/profile/CliConfigProfileCreateCommand.java @@ -19,10 +19,8 @@ import static org.apache.ignite.internal.cli.commands.Options.Constants.PROFILE_ACTIVATE_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.PROFILE_ACTIVATE_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.PROFILE_ACTIVATE_OPTION_SHORT; import static org.apache.ignite.internal.cli.commands.Options.Constants.PROFILE_COPY_FROM_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.PROFILE_COPY_FROM_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.PROFILE_COPY_FROM_OPTION_SHORT; import jakarta.inject.Inject; import java.util.concurrent.Callable; @@ -42,10 +40,10 @@ public class CliConfigProfileCreateCommand extends BaseCommand implements Callab @Parameters(arity = "1", description = "Name of new profile") private String profileName; - @Option(names = {PROFILE_COPY_FROM_OPTION, PROFILE_COPY_FROM_OPTION_SHORT}, description = PROFILE_COPY_FROM_OPTION_DESC) + @Option(names = PROFILE_COPY_FROM_OPTION, description = PROFILE_COPY_FROM_OPTION_DESC) private String copyFrom; - @Option(names = {PROFILE_ACTIVATE_OPTION, PROFILE_ACTIVATE_OPTION_SHORT}, description = PROFILE_ACTIVATE_OPTION_DESC) + @Option(names = PROFILE_ACTIVATE_OPTION, description = PROFILE_ACTIVATE_OPTION_DESC) private boolean activate; @Inject diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/ClusterUrlMixin.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/ClusterUrlMixin.java index bbe1a3dcaaa..6fa62c6460b 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/ClusterUrlMixin.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/ClusterUrlMixin.java @@ -19,7 +19,6 @@ import static org.apache.ignite.internal.cli.commands.Options.Constants.CLUSTER_URL_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.CLUSTER_URL_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.URL_OPTION_SHORT; import java.net.URL; import org.apache.ignite.internal.cli.core.converters.UrlConverter; @@ -30,7 +29,7 @@ */ public class ClusterUrlMixin { /** Cluster endpoint URL option. */ - @Option(names = {URL_OPTION_SHORT, CLUSTER_URL_OPTION}, description = CLUSTER_URL_OPTION_DESC, converter = UrlConverter.class) + @Option(names = CLUSTER_URL_OPTION, description = CLUSTER_URL_OPTION_DESC, converter = UrlConverter.class) private URL clusterUrl; public String getClusterUrl() { diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/init/ClusterInitOptions.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/init/ClusterInitOptions.java index 4a8166d626e..91db15564ef 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/init/ClusterInitOptions.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/init/ClusterInitOptions.java @@ -19,19 +19,14 @@ import static org.apache.ignite.internal.cli.commands.Options.Constants.CLUSTER_CONFIG_FILE_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.CLUSTER_CONFIG_FILE_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.CLUSTER_CONFIG_FILE_OPTION_SHORT; import static org.apache.ignite.internal.cli.commands.Options.Constants.CLUSTER_CONFIG_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.CLUSTER_CONFIG_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.CLUSTER_CONFIG_OPTION_SHORT; import static org.apache.ignite.internal.cli.commands.Options.Constants.CLUSTER_NAME_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.CLUSTER_NAME_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.CLUSTER_NAME_OPTION_SHORT; import static org.apache.ignite.internal.cli.commands.Options.Constants.CMG_NODE_NAME_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.CMG_NODE_NAME_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.CMG_NODE_NAME_OPTION_SHORT; import static org.apache.ignite.internal.cli.commands.Options.Constants.META_STORAGE_NODE_NAME_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.META_STORAGE_NODE_NAME_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.META_STORAGE_NODE_NAME_OPTION_SHORT; import java.io.File; import java.io.IOException; @@ -51,29 +46,27 @@ public class ClusterInitOptions { * List of names of the nodes (each represented by a separate command line argument) that will host the Meta Storage. If the * "--cmg-nodes" parameter is omitted, the same nodes will also host the Cluster Management Group. */ - @Option(names = {META_STORAGE_NODE_NAME_OPTION, META_STORAGE_NODE_NAME_OPTION_SHORT}, - required = true, - description = META_STORAGE_NODE_NAME_OPTION_DESC) + @Option(names = META_STORAGE_NODE_NAME_OPTION, required = true, description = META_STORAGE_NODE_NAME_OPTION_DESC) private List metaStorageNodes; /** * List of names of the nodes (each represented by a separate command line argument) that will host the Cluster Management Group. */ - @Option(names = {CMG_NODE_NAME_OPTION, CMG_NODE_NAME_OPTION_SHORT}, description = CMG_NODE_NAME_OPTION_DESC) + @Option(names = CMG_NODE_NAME_OPTION, description = CMG_NODE_NAME_OPTION_DESC) private List cmgNodes = new ArrayList<>(); /** Name of the cluster. */ - @Option(names = {CLUSTER_NAME_OPTION, CLUSTER_NAME_OPTION_SHORT}, required = true, description = CLUSTER_NAME_OPTION_DESC) + @Option(names = CLUSTER_NAME_OPTION, required = true, description = CLUSTER_NAME_OPTION_DESC) private String clusterName; @ArgGroup private ClusterConfigOptions clusterConfigOptions; private static class ClusterConfigOptions { - @Option(names = {CLUSTER_CONFIG_OPTION, CLUSTER_CONFIG_OPTION_SHORT}, description = CLUSTER_CONFIG_OPTION_DESC) + @Option(names = CLUSTER_CONFIG_OPTION, description = CLUSTER_CONFIG_OPTION_DESC) private String config; - @Option(names = {CLUSTER_CONFIG_FILE_OPTION, CLUSTER_CONFIG_FILE_OPTION_SHORT}, description = CLUSTER_CONFIG_FILE_OPTION_DESC) + @Option(names = CLUSTER_CONFIG_FILE_OPTION, description = CLUSTER_CONFIG_FILE_OPTION_DESC) private File file; } diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/unit/ClusterUnitUndeployCommand.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/unit/ClusterUnitUndeployCommand.java index 07ecb0b592e..b435bb991dc 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/unit/ClusterUnitUndeployCommand.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/unit/ClusterUnitUndeployCommand.java @@ -19,7 +19,6 @@ import static org.apache.ignite.internal.cli.commands.Options.Constants.UNIT_VERSION_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.UNIT_VERSION_OPTION_SHORT; import static org.apache.ignite.internal.cli.commands.Options.Constants.VERSION_OPTION; import jakarta.inject.Inject; @@ -47,9 +46,7 @@ public class ClusterUnitUndeployCommand extends BaseCommand implements Callable< private String id; /** Unit version. */ - @Option(names = {VERSION_OPTION, UNIT_VERSION_OPTION_SHORT}, - description = UNIT_VERSION_OPTION_DESC, - required = true) + @Option(names = VERSION_OPTION, description = UNIT_VERSION_OPTION_DESC, required = true) private String version; @Inject diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/unit/ClusterUnitUndeployReplCommand.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/unit/ClusterUnitUndeployReplCommand.java index 658ffee1fef..df8fdc493a1 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/unit/ClusterUnitUndeployReplCommand.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/unit/ClusterUnitUndeployReplCommand.java @@ -19,7 +19,6 @@ import static org.apache.ignite.internal.cli.commands.Options.Constants.UNIT_VERSION_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.UNIT_VERSION_OPTION_SHORT; import static org.apache.ignite.internal.cli.commands.Options.Constants.VERSION_OPTION; import jakarta.inject.Inject; @@ -47,9 +46,7 @@ public class ClusterUnitUndeployReplCommand extends BaseCommand implements Runna private String id; /** Unit version. */ - @Option(names = {VERSION_OPTION, UNIT_VERSION_OPTION_SHORT}, - description = UNIT_VERSION_OPTION_DESC, - required = true) + @Option(names = VERSION_OPTION, description = UNIT_VERSION_OPTION_DESC, required = true) private String version; @Inject diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/unit/UnitDeployOptionsMixin.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/unit/UnitDeployOptionsMixin.java index b98e8ba93cb..79198f01fb9 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/unit/UnitDeployOptionsMixin.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/cluster/unit/UnitDeployOptionsMixin.java @@ -21,17 +21,13 @@ import static org.apache.ignite.internal.cli.commands.Options.Constants.UNIT_NODES_OPTION_DESC; import static org.apache.ignite.internal.cli.commands.Options.Constants.UNIT_PATH_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.UNIT_PATH_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.UNIT_PATH_OPTION_SHORT; import static org.apache.ignite.internal.cli.commands.Options.Constants.UNIT_VERSION_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.UNIT_VERSION_OPTION_SHORT; import static org.apache.ignite.internal.cli.commands.Options.Constants.VERSION_OPTION; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import java.util.stream.Collectors; import org.apache.ignite.internal.cli.call.cluster.unit.DeployUnitCallInput; import picocli.CommandLine.Model.CommandSpec; import picocli.CommandLine.Option; @@ -45,7 +41,7 @@ class UnitDeployOptionsMixin { private String id; /** Unit version. */ - @Option(names = {VERSION_OPTION, UNIT_VERSION_OPTION_SHORT}, description = UNIT_VERSION_OPTION_DESC, required = true) + @Option(names = VERSION_OPTION, description = UNIT_VERSION_OPTION_DESC, required = true) private String version; @Spec @@ -54,7 +50,7 @@ class UnitDeployOptionsMixin { /** Unit path. */ private Path path; - @Option(names = {UNIT_PATH_OPTION, UNIT_PATH_OPTION_SHORT}, description = UNIT_PATH_OPTION_DESC, required = true) + @Option(names = UNIT_PATH_OPTION, description = UNIT_PATH_OPTION_DESC, required = true) private void setPath(Path value) { if (Files.notExists(value)) { throw new ParameterException(spec.commandLine(), "No such file or directory: " + value); @@ -96,12 +92,6 @@ private void setNodes(List values) { nodes = values; } - static class UnitNodesCompletionCandidates extends ArrayList { - UnitNodesCompletionCandidates() { - super(Arrays.stream(NodesAlias.values()).map(NodesAlias::name).collect(Collectors.toList())); - } - } - DeployUnitCallInput toDeployUnitCallInput(String url) { return DeployUnitCallInput.builder() .id(id) diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/node/NodeUrlMixin.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/node/NodeUrlMixin.java index 12804054229..51691bbef05 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/node/NodeUrlMixin.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/node/NodeUrlMixin.java @@ -22,7 +22,6 @@ import static org.apache.ignite.internal.cli.commands.Options.Constants.NODE_NAME_OPTION_SHORT; import static org.apache.ignite.internal.cli.commands.Options.Constants.NODE_URL_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.NODE_URL_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.URL_OPTION_SHORT; import jakarta.inject.Inject; import java.net.URL; @@ -49,7 +48,7 @@ private static class Options { /** * Node URL option. */ - @Option(names = {URL_OPTION_SHORT, NODE_URL_OPTION}, description = NODE_URL_OPTION_DESC, converter = UrlConverter.class) + @Option(names = NODE_URL_OPTION, description = NODE_URL_OPTION_DESC, converter = UrlConverter.class) private URL nodeUrl; /** diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/node/NodeUrlProfileMixin.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/node/NodeUrlProfileMixin.java index 7564de8708c..0fd54d48888 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/node/NodeUrlProfileMixin.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/node/NodeUrlProfileMixin.java @@ -19,7 +19,6 @@ import static org.apache.ignite.internal.cli.commands.Options.Constants.NODE_URL_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.NODE_URL_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.URL_OPTION_SHORT; import jakarta.inject.Inject; import java.net.URL; @@ -36,7 +35,7 @@ */ public class NodeUrlProfileMixin { /** Node URL option. */ - @Option(names = {URL_OPTION_SHORT, NODE_URL_OPTION}, description = NODE_URL_OPTION_DESC, converter = UrlConverter.class) + @Option(names = NODE_URL_OPTION, description = NODE_URL_OPTION_DESC, converter = UrlConverter.class) private URL nodeUrl; /** Profile to get default values from. */ diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/sql/SqlCommand.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/sql/SqlCommand.java index f267eb2231e..7e8ab191e4f 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/sql/SqlCommand.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/sql/SqlCommand.java @@ -20,12 +20,10 @@ import static org.apache.ignite.internal.cli.commands.Options.Constants.JDBC_URL_KEY; import static org.apache.ignite.internal.cli.commands.Options.Constants.JDBC_URL_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.JDBC_URL_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.JDBC_URL_OPTION_SHORT; import static org.apache.ignite.internal.cli.commands.Options.Constants.PLAIN_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.PLAIN_OPTION_DESC; import static org.apache.ignite.internal.cli.commands.Options.Constants.SCRIPT_FILE_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.SCRIPT_FILE_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.SCRIPT_FILE_OPTION_SHORT; import java.io.File; import java.io.IOException; @@ -52,8 +50,7 @@ */ @Command(name = "sql", description = "Executes SQL query") public class SqlCommand extends BaseCommand implements Callable { - @Option(names = {JDBC_URL_OPTION, JDBC_URL_OPTION_SHORT}, required = true, - descriptionKey = JDBC_URL_KEY, description = JDBC_URL_OPTION_DESC) + @Option(names = JDBC_URL_OPTION, required = true, descriptionKey = JDBC_URL_KEY, description = JDBC_URL_OPTION_DESC) private String jdbc; @Option(names = PLAIN_OPTION, description = PLAIN_OPTION_DESC) @@ -66,7 +63,7 @@ private static class ExecOptions { @Parameters(index = "0", description = "SQL query to execute") private String command; - @Option(names = {SCRIPT_FILE_OPTION, SCRIPT_FILE_OPTION_SHORT}, description = SCRIPT_FILE_OPTION_DESC) + @Option(names = SCRIPT_FILE_OPTION, description = SCRIPT_FILE_OPTION_DESC) private File file; } diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/sql/SqlReplCommand.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/sql/SqlReplCommand.java index 0c31f0ecfc0..d64cd8b73aa 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/sql/SqlReplCommand.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/commands/sql/SqlReplCommand.java @@ -20,11 +20,10 @@ import static org.apache.ignite.internal.cli.commands.Options.Constants.JDBC_URL_KEY; import static org.apache.ignite.internal.cli.commands.Options.Constants.JDBC_URL_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.JDBC_URL_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.JDBC_URL_OPTION_SHORT; import static org.apache.ignite.internal.cli.commands.Options.Constants.PLAIN_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.PLAIN_OPTION_DESC; import static org.apache.ignite.internal.cli.commands.Options.Constants.SCRIPT_FILE_OPTION; -import static org.apache.ignite.internal.cli.commands.Options.Constants.SCRIPT_FILE_OPTION_SHORT; +import static org.apache.ignite.internal.cli.commands.Options.Constants.SCRIPT_FILE_OPTION_DESC; import static org.apache.ignite.internal.cli.core.style.AnsiStringSupport.ansi; import static org.apache.ignite.internal.cli.core.style.AnsiStringSupport.fg; @@ -77,8 +76,7 @@ */ @Command(name = "sql", description = "Executes SQL query") public class SqlReplCommand extends BaseCommand implements Runnable { - @Option(names = {JDBC_URL_OPTION, JDBC_URL_OPTION_SHORT}, required = true, - descriptionKey = JDBC_URL_KEY, description = JDBC_URL_OPTION_DESC) + @Option(names = JDBC_URL_OPTION, required = true, descriptionKey = JDBC_URL_KEY, description = JDBC_URL_OPTION_DESC) private String jdbc; @Option(names = PLAIN_OPTION, description = PLAIN_OPTION_DESC) @@ -91,8 +89,7 @@ private static class ExecOptions { @Parameters(index = "0", description = "SQL query to execute", defaultValue = Option.NULL_VALUE) private String command; - @Option(names = {SCRIPT_FILE_OPTION, SCRIPT_FILE_OPTION_SHORT}, description = SCRIPT_FILE_OPTION_SHORT, - defaultValue = Option.NULL_VALUE) + @Option(names = SCRIPT_FILE_OPTION, description = SCRIPT_FILE_OPTION_DESC, defaultValue = Option.NULL_VALUE) private File file; } diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/CompleterConf.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/CompleterConf.java index 9daf234926e..f82e1508dca 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/CompleterConf.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/CompleterConf.java @@ -171,7 +171,7 @@ public CompleterConfBuilder filter(CompleterFilter filter) { /** * If called than all enable options of current configuration will become disable options for all other completers. For example, - * --node-name should be completed by only one completer. + * --name should be completed by only one completer. */ public CompleterConfBuilder exclusiveEnableOptions() { this.exclusiveEnableOptions = true; diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/cluster/ClusterUrlDynamicCompleterFactory.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/cluster/ClusterUrlDynamicCompleterFactory.java index 59405ac824a..e465f5b1bfa 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/cluster/ClusterUrlDynamicCompleterFactory.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/cluster/ClusterUrlDynamicCompleterFactory.java @@ -25,7 +25,7 @@ import org.apache.ignite.internal.cli.core.repl.completer.StringDynamicCompleter; import org.apache.ignite.internal.cli.core.repl.registry.NodeNameRegistry; -/** Factory for --cluster-endpoint-url option completer. */ +/** Factory for --url option completer for cluster commands. */ @Singleton public class ClusterUrlDynamicCompleterFactory implements DynamicCompleterFactory { diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/filter/DynamicCompleterFilter.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/filter/DynamicCompleterFilter.java index f770b0b6403..1abcd3929ac 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/filter/DynamicCompleterFilter.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/filter/DynamicCompleterFilter.java @@ -17,12 +17,10 @@ package org.apache.ignite.internal.cli.core.repl.completer.filter; -import static org.apache.ignite.internal.cli.commands.Options.Constants.CLUSTER_URL_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.HELP_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.HELP_OPTION_SHORT; import static org.apache.ignite.internal.cli.commands.Options.Constants.NODE_URL_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.PROFILE_OPTION; -import static org.apache.ignite.internal.cli.commands.Options.Constants.PROFILE_OPTION_SHORT; import static org.apache.ignite.internal.cli.commands.Options.Constants.VERBOSE_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.VERBOSE_OPTION_SHORT; @@ -73,7 +71,6 @@ private boolean filterCommonOptions(String candidate) { return !(HELP_OPTION.equals(candidate) || HELP_OPTION_SHORT.equals(candidate) || PROFILE_OPTION.equals(candidate) - || PROFILE_OPTION_SHORT.equals(candidate) || VERBOSE_OPTION_SHORT.equals(candidate) || VERBOSE_OPTION.equals(candidate)); } @@ -81,6 +78,6 @@ private boolean filterCommonOptions(String candidate) { private boolean filterClusterUrl(String[] words, String candidate) { return optionTyped(words) || session.info() == null - || (!candidate.equals(CLUSTER_URL_OPTION) && !candidate.equals(NODE_URL_OPTION)); + || (!candidate.equals(NODE_URL_OPTION)); } } diff --git a/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/node/NodeNameDynamicCompleterFactory.java b/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/node/NodeNameDynamicCompleterFactory.java index 75e5b21577d..7cf470f96a6 100644 --- a/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/node/NodeNameDynamicCompleterFactory.java +++ b/modules/cli/src/main/java/org/apache/ignite/internal/cli/core/repl/completer/node/NodeNameDynamicCompleterFactory.java @@ -23,7 +23,7 @@ import org.apache.ignite.internal.cli.core.repl.completer.StringDynamicCompleter; import org.apache.ignite.internal.cli.core.repl.registry.NodeNameRegistry; -/** Factory for --node-name option completer. */ +/** Factory for --node option completer. */ @Singleton public class NodeNameDynamicCompleterFactory implements DynamicCompleterFactory { diff --git a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/ProfileMixinTest.java b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/ProfileMixinTest.java index 0e50d921399..0e3620ffdcd 100644 --- a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/ProfileMixinTest.java +++ b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/ProfileMixinTest.java @@ -44,7 +44,7 @@ import org.junit.jupiter.params.provider.MethodSource; /** - * Test for --profile override for --node-url and --cluster-endpoint-url options. + * Test for --profile override for --url options. */ public class ProfileMixinTest extends CliCommandTestBase { /** @@ -99,7 +99,7 @@ > void commandNodeUrl( Class callInputClass, Function urlSupplier) { T call = registerMockCall(callClass); - execute(command + " --node-url " + URL_FROM_CMD); + execute(command + " --url " + URL_FROM_CMD); IT callInput = verifyCallInput(call, callInputClass); assertEquals(URL_FROM_CMD, urlSupplier.apply(callInput)); } @@ -113,7 +113,7 @@ > void commandClusterUrl( Class callInputClass, Function urlSupplier) { T call = registerMockCall(callClass); - execute(command + " --cluster-endpoint-url " + URL_FROM_CMD); + execute(command + " --url " + URL_FROM_CMD); IT callInput = verifyCallInput(call, callInputClass); assertEquals(URL_FROM_CMD, urlSupplier.apply(callInput)); } @@ -127,7 +127,7 @@ > void commandNodeUrlOverridesP Class callInputClass, Function urlSupplier) { T call = registerMockCall(callClass); - execute(command + " --profile test --node-url " + URL_FROM_CMD); + execute(command + " --profile test --url " + URL_FROM_CMD); IT callInput = verifyCallInput(call, callInputClass); assertEquals(URL_FROM_CMD, urlSupplier.apply(callInput)); } @@ -141,7 +141,7 @@ > void commandClusterUrlOverrid Class callInputClass, Function urlSupplier) { T call = registerMockCall(callClass); - execute(command + " --profile test --cluster-endpoint-url " + URL_FROM_CMD); + execute(command + " --profile test --url " + URL_FROM_CMD); IT callInput = verifyCallInput(call, callInputClass); assertEquals(URL_FROM_CMD, urlSupplier.apply(callInput)); } @@ -184,7 +184,7 @@ private static Stream clusterCallsProvider() { (Function) ClusterConfigUpdateCallInput::getClusterUrl ), arguments( - "cluster init --cluster-name cluster --meta-storage-node node", + "cluster init --name cluster --meta-storage-node node", ClusterInitCall.class, ClusterInitCallInput.class, (Function) ClusterInitCallInput::getClusterUrl diff --git a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/UrlOptionsNegativeTest.java b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/UrlOptionsNegativeTest.java index 3cac6b330a9..0a2a5f25a55 100644 --- a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/UrlOptionsNegativeTest.java +++ b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/UrlOptionsNegativeTest.java @@ -91,8 +91,7 @@ public class UrlOptionsNegativeTest { private static final String NODE_URL = "http://localhost:10300"; - private static final String CLUSTER_URL_OPTION = "--cluster-endpoint-url="; - private static final String NODE_URL_OPTION = "--node-url="; + private static final String NODE_URL_OPTION = "--url="; @Inject private ApplicationContext context; @@ -145,21 +144,21 @@ static List cmdClassAndOptionsProvider() { arguments(NodeConfigShowCommand.class, NODE_URL_OPTION, List.of()), arguments(NodeConfigUpdateCommand.class, NODE_URL_OPTION, List.of("{key: value}")), arguments(NodeStatusCommand.class, NODE_URL_OPTION, List.of()), - arguments(ClusterConfigShowCommand.class, CLUSTER_URL_OPTION, List.of()), - arguments(ClusterConfigUpdateCommand.class, CLUSTER_URL_OPTION, List.of("{key: value}")), - arguments(ClusterStatusCommand.class, CLUSTER_URL_OPTION, List.of()), + arguments(ClusterConfigShowCommand.class, NODE_URL_OPTION, List.of()), + arguments(ClusterConfigUpdateCommand.class, NODE_URL_OPTION, List.of("{key: value}")), + arguments(ClusterStatusCommand.class, NODE_URL_OPTION, List.of()), arguments(NodeMetricSourceEnableCommand.class, NODE_URL_OPTION, List.of("srcName")), arguments(NodeMetricSourceDisableCommand.class, NODE_URL_OPTION, List.of("srcName")), arguments(NodeMetricSourceListCommand.class, NODE_URL_OPTION, List.of()), arguments(NodeMetricSetListCommand.class, NODE_URL_OPTION, List.of()), - arguments(LogicalTopologyCommand.class, CLUSTER_URL_OPTION, List.of()), - arguments(PhysicalTopologyCommand.class, CLUSTER_URL_OPTION, List.of()), - arguments(ClusterUnitDeployCommand.class, CLUSTER_URL_OPTION, + arguments(LogicalTopologyCommand.class, NODE_URL_OPTION, List.of()), + arguments(PhysicalTopologyCommand.class, NODE_URL_OPTION, List.of()), + arguments(ClusterUnitDeployCommand.class, NODE_URL_OPTION, List.of("--path=" + TEMP_FILE_PATH, "id", "--version=1.0.0")), - arguments(ClusterUnitUndeployCommand.class, CLUSTER_URL_OPTION, List.of("id", "--version=1.0.0")), - arguments(ClusterUnitListCommand.class, CLUSTER_URL_OPTION, List.of()), + arguments(ClusterUnitUndeployCommand.class, NODE_URL_OPTION, List.of("id", "--version=1.0.0")), + arguments(ClusterUnitListCommand.class, NODE_URL_OPTION, List.of()), arguments(NodeUnitListCommand.class, NODE_URL_OPTION, List.of()), - arguments(ClusterInitCommand.class, CLUSTER_URL_OPTION, List.of("--cluster-name=cluster", "--meta-storage-node=test")), + arguments(ClusterInitCommand.class, NODE_URL_OPTION, List.of("--name=cluster", "--meta-storage-node=test")), arguments(ConnectCommand.class, "", List.of()) // TODO https://issues.apache.org/jira/browse/IGNITE-18378 // Arguments.arguments(ClusterShowCommand.class, CLUSTER_URL_OPTION, List.of()), @@ -171,21 +170,21 @@ static List cmdReplClassAndOptionsProvider() { arguments(NodeConfigShowReplCommand.class, NODE_URL_OPTION, List.of()), arguments(NodeConfigUpdateReplCommand.class, NODE_URL_OPTION, List.of("{key: value}")), arguments(NodeStatusReplCommand.class, NODE_URL_OPTION, List.of()), - arguments(ClusterConfigShowReplCommand.class, CLUSTER_URL_OPTION, List.of()), - arguments(ClusterConfigUpdateReplCommand.class, CLUSTER_URL_OPTION, List.of("{key: value}")), - arguments(ClusterStatusReplCommand.class, CLUSTER_URL_OPTION, List.of()), + arguments(ClusterConfigShowReplCommand.class, NODE_URL_OPTION, List.of()), + arguments(ClusterConfigUpdateReplCommand.class, NODE_URL_OPTION, List.of("{key: value}")), + arguments(ClusterStatusReplCommand.class, NODE_URL_OPTION, List.of()), arguments(NodeMetricSourceEnableReplCommand.class, NODE_URL_OPTION, List.of("srcName")), arguments(NodeMetricSourceDisableReplCommand.class, NODE_URL_OPTION, List.of("srcName")), arguments(NodeMetricSourceListReplCommand.class, NODE_URL_OPTION, List.of()), arguments(NodeMetricSetListReplCommand.class, NODE_URL_OPTION, List.of()), - arguments(LogicalTopologyReplCommand.class, CLUSTER_URL_OPTION, List.of()), - arguments(PhysicalTopologyReplCommand.class, CLUSTER_URL_OPTION, List.of()), - arguments(ClusterUnitDeployReplCommand.class, CLUSTER_URL_OPTION, + arguments(LogicalTopologyReplCommand.class, NODE_URL_OPTION, List.of()), + arguments(PhysicalTopologyReplCommand.class, NODE_URL_OPTION, List.of()), + arguments(ClusterUnitDeployReplCommand.class, NODE_URL_OPTION, List.of("--path=" + TEMP_FILE_PATH, "id", "--version=1.0.0")), - arguments(ClusterUnitUndeployReplCommand.class, CLUSTER_URL_OPTION, List.of("id", "--version=1.0.0")), - arguments(ClusterUnitListReplCommand.class, CLUSTER_URL_OPTION, List.of()), + arguments(ClusterUnitUndeployReplCommand.class, NODE_URL_OPTION, List.of("id", "--version=1.0.0")), + arguments(ClusterUnitListReplCommand.class, NODE_URL_OPTION, List.of()), arguments(NodeUnitListReplCommand.class, NODE_URL_OPTION, List.of()), - arguments(ClusterInitReplCommand.class, CLUSTER_URL_OPTION, List.of("--cluster-name=cluster", "--meta-storage-node=test")), + arguments(ClusterInitReplCommand.class, NODE_URL_OPTION, List.of("--name=cluster", "--meta-storage-node=test")), arguments(ConnectReplCommand.class, "", List.of()) // TODO https://issues.apache.org/jira/browse/IGNITE-18378 // Arguments.arguments(ClusterShowReplCommand.class, CLUSTER_URL_OPTION, List.of()), diff --git a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/cluster/ClusterInitTest.java b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/cluster/ClusterInitTest.java index 32e01395322..8b23f1b8136 100644 --- a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/cluster/ClusterInitTest.java +++ b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/cluster/ClusterInitTest.java @@ -38,7 +38,7 @@ @DisplayName("cluster init") class ClusterInitTest extends IgniteCliInterfaceTestBase { @Test - @DisplayName("--cluster-endpoint-url http://localhost:10300 --meta-storage-node node1ConsistentId" + @DisplayName("--url http://localhost:10300 --meta-storage-node node1ConsistentId" + " --meta-storage-node node2ConsistentId --cmg-node node2ConsistentId --cmg-node node3ConsistentId --cluster-name cluster") void initSuccess() { var expectedSentContent = "{\"metaStorageNodes\":[\"node1ConsistentId\",\"node2ConsistentId\"]," @@ -56,20 +56,20 @@ void initSuccess() { execute( "cluster", "init", - "--cluster-endpoint-url", mockUrl, + "--url", mockUrl, "--meta-storage-node", "node1ConsistentId", "--meta-storage-node", "node2ConsistentId", "--cmg-node", "node2ConsistentId", "--cmg-node", "node3ConsistentId", - "--cluster-name", "cluster" + "--name", "cluster" ); assertSuccessfulOutputIs("Cluster was initialized successfully"); } @Test - @DisplayName("--cluster-endpoint-url http://localhost:10300 --meta-storage-node node1ConsistentId --meta-storage-node node2ConsistentId" - + " --cmg-node node2ConsistentId --cmg-node node3ConsistentId --cluster-name cluster" + @DisplayName("--url http://localhost:10300 --meta-storage-node node1ConsistentId --meta-storage-node node2ConsistentId" + + " --cmg-node node2ConsistentId --cmg-node node3ConsistentId --name cluster" + " --auth-enabled --basic-auth-username admin --basic-auth-password password") void initWithAuthenticationSuccess() throws IOException { @@ -100,13 +100,13 @@ void initWithAuthenticationSuccess() throws IOException { execute( "cluster", "init", - "--cluster-endpoint-url", mockUrl, + "--url", mockUrl, "--meta-storage-node", "node1ConsistentId", "--meta-storage-node", "node2ConsistentId", "--cmg-node", "node2ConsistentId", "--cmg-node", "node3ConsistentId", - "--cluster-name", "cluster", - "--cluster-config-file", clusterConfigurationFile.toString() + "--name", "cluster", + "--config-file", clusterConfigurationFile.toString() ); assertSuccessfulOutputIs("Cluster was initialized successfully"); @@ -126,12 +126,12 @@ void initError() { execute( "cluster", "init", - "--cluster-endpoint-url", mockUrl, + "--url", mockUrl, "--meta-storage-node", "node1ConsistentId", "--meta-storage-node", "node2ConsistentId", "--cmg-node", "node2ConsistentId", "--cmg-node", "node3ConsistentId", - "--cluster-name", "cluster" + "--name", "cluster" ); assertAll( @@ -142,14 +142,14 @@ void initError() { } @Test - @DisplayName("--cluster-endpoint-url http://localhost:10300 --cmg-node node2ConsistentId --cmg-node node3ConsistentId") + @DisplayName("--url http://localhost:10300 --cmg-node node2ConsistentId --cmg-node node3ConsistentId") void metastorageNodesAreMandatoryForInit() { execute( "cluster", "init", - "--cluster-endpoint-url", mockUrl, + "--url", mockUrl, "--cmg-node", "node2ConsistentId", "--cmg-node", "node3ConsistentId", - "--cluster-name", "cluster" + "--name", "cluster" ); assertAll( @@ -160,7 +160,7 @@ void metastorageNodesAreMandatoryForInit() { } @Test - @DisplayName("--cluster-endpoint-url http://localhost:10300 --meta-storage-node node2ConsistentId --meta-storage-node node3ConsistentId") + @DisplayName("--url http://localhost:10300 --meta-storage-node node2ConsistentId --meta-storage-node node3ConsistentId") void cmgNodesAreNotMandatoryForInit() { clientAndServer .when(request() @@ -171,21 +171,21 @@ void cmgNodesAreNotMandatoryForInit() { execute( "cluster", "init", - "--cluster-endpoint-url", mockUrl, + "--url", mockUrl, "--meta-storage-node", "node1ConsistentId", "--meta-storage-node", "node2ConsistentId", - "--cluster-name", "cluster" + "--name", "cluster" ); assertSuccessfulOutputIs("Cluster was initialized successfully"); } @Test - @DisplayName("--cluster-endpoint-url http://localhost:10300 --meta-storage-node node1ConsistentId --cmg-node node2ConsistentId") + @DisplayName("--url http://localhost:10300 --meta-storage-node node1ConsistentId --cmg-node node2ConsistentId") void clusterNameIsMandatoryForInit() { execute( "cluster", "init", - "--cluster-endpoint-url", mockUrl, + "--url", mockUrl, "--meta-storage-node", "node1ConsistentId", "--cmg-node", "node2ConsistentId" ); @@ -193,7 +193,7 @@ void clusterNameIsMandatoryForInit() { assertAll( () -> assertExitCodeIs(2), this::assertOutputIsEmpty, - () -> assertErrOutputContains("Missing required option: '--cluster-name='") + () -> assertErrOutputContains("Missing required option: '--name='") ); } } diff --git a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/cluster/config/ClusterConfigTest.java b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/cluster/config/ClusterConfigTest.java index 5d6283d8ede..74febcefba2 100644 --- a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/cluster/config/ClusterConfigTest.java +++ b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/cluster/config/ClusterConfigTest.java @@ -28,7 +28,7 @@ @DisplayName("cluster config") class ClusterConfigTest extends IgniteCliInterfaceTestBase { @Test - @DisplayName("show --cluster-endpoint-url http://localhost:10300") + @DisplayName("show --url http://localhost:10300") void show() { clientAndServer .when(request() @@ -37,7 +37,7 @@ void show() { ) .respond(response("{\"autoAdjust\":{\"enabled\":true}}")); - execute("cluster config show --cluster-endpoint-url " + mockUrl); + execute("cluster config show --url " + mockUrl); assertSuccessfulOutputIs("{\n" + " \"autoAdjust\" : {\n" @@ -47,7 +47,7 @@ void show() { } @Test - @DisplayName("show --cluster-endpoint-url http://localhost:10300 local.baseline") + @DisplayName("show --url http://localhost:10300 local.baseline") void showSubtree() { clientAndServer .when(request() @@ -56,7 +56,7 @@ void showSubtree() { ) .respond(response("{\"autoAdjust\":{\"enabled\":true}}")); - execute("cluster config show --cluster-endpoint-url " + mockUrl + " local.baseline"); + execute("cluster config show --url " + mockUrl + " local.baseline"); assertSuccessfulOutputIs("{\n" + " \"autoAdjust\" : {\n" @@ -66,7 +66,7 @@ void showSubtree() { } @Test - @DisplayName("update --cluster-endpoint-url http://localhost:10300 local.baseline.autoAdjust.enabled=true") + @DisplayName("update --url http://localhost:10300 local.baseline.autoAdjust.enabled=true") void updateHocon() { clientAndServer .when(request() @@ -76,7 +76,7 @@ void updateHocon() { ) .respond(response(null)); - execute("cluster config update --cluster-endpoint-url " + execute("cluster config update --url " + mockUrl + " local.baseline.autoAdjust.enabled=true"); assertSuccessfulOutputIs("Cluster configuration was updated successfully"); diff --git a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/node/config/NodeConfigTest.java b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/node/config/NodeConfigTest.java index f25e0984cd9..733bf27f96e 100644 --- a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/node/config/NodeConfigTest.java +++ b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/node/config/NodeConfigTest.java @@ -30,7 +30,7 @@ @DisplayName("node config") public class NodeConfigTest extends IgniteCliInterfaceTestBase { @Test - @DisplayName("show --node-url http://localhost:10300") + @DisplayName("show --url http://localhost:10300") void show() { clientAndServer .when(request() @@ -39,7 +39,7 @@ void show() { ) .respond(response("{\"autoAdjust\":{\"enabled\":true}}")); - execute("node config show --node-url " + mockUrl); + execute("node config show --url " + mockUrl); assertSuccessfulOutputIs("{\n" + " \"autoAdjust\" : {\n" @@ -49,7 +49,7 @@ void show() { } @Test - @DisplayName("show --node-url http://localhost:10300 local.baseline") + @DisplayName("show --url http://localhost:10300 local.baseline") void showSubtree() { clientAndServer .when(request() @@ -58,7 +58,7 @@ void showSubtree() { ) .respond(response("{\"autoAdjust\":{\"enabled\":true}}")); - execute("node config show --node-url " + mockUrl + " local.baseline"); + execute("node config show --url " + mockUrl + " local.baseline"); assertSuccessfulOutputIs("{\n" + " \"autoAdjust\" : {\n" @@ -68,7 +68,7 @@ void showSubtree() { } @Test - @DisplayName("update --node-url http://localhost:10300 local.baseline.autoAdjust.enabled=true") + @DisplayName("update --url http://localhost:10300 local.baseline.autoAdjust.enabled=true") void updateHocon() { clientAndServer .when(request() @@ -78,7 +78,7 @@ void updateHocon() { ) .respond(response(null)); - execute("node config update --node-url " + mockUrl + " local.baseline.autoAdjust.enabled=true"); + execute("node config update --url " + mockUrl + " local.baseline.autoAdjust.enabled=true"); assertSuccessfulOutputIs("Node configuration updated. " + fg(Color.YELLOW).mark("Restart the node to apply changes.")); diff --git a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/node/metric/NodeMetricTest.java b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/node/metric/NodeMetricTest.java index 65fe0ba0b67..5c95df424e6 100644 --- a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/node/metric/NodeMetricTest.java +++ b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/node/metric/NodeMetricTest.java @@ -38,7 +38,7 @@ void enable() { ) .respond(response(null)); - execute("node metric source enable --node-url " + mockUrl + " srcName"); + execute("node metric source enable --url " + mockUrl + " srcName"); assertSuccessfulOutputIs("Metric source was enabled successfully"); } @@ -54,7 +54,7 @@ void disable() { ) .respond(response(null)); - execute("node metric source disable --node-url " + mockUrl + " srcName"); + execute("node metric source disable --url " + mockUrl + " srcName"); assertSuccessfulOutputIs("Metric source was disabled successfully"); } @@ -70,7 +70,7 @@ void listSources() { ) .respond(response(responseBody)); - execute("node metric source list --plain --node-url " + mockUrl); + execute("node metric source list --plain --url " + mockUrl); assertSuccessfulOutputIs("Set name\tEnabled\nenabledMetric\tenabled\ndisabledMetric\tdisabled\n"); } @@ -86,7 +86,7 @@ void listSets() { ) .respond(response(responseBody)); - execute("node metric list --plain --node-url " + mockUrl); + execute("node metric list --plain --url " + mockUrl); assertSuccessfulOutputIs("Set name\tMetric name\tDescription\nmetricSet\t\t\n\tmetric\tdescription"); } diff --git a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/sql/SqlCommandTest.java b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/sql/SqlCommandTest.java index db7faab800e..8cbd62d91b9 100644 --- a/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/sql/SqlCommandTest.java +++ b/modules/cli/src/test/java/org/apache/ignite/internal/cli/commands/sql/SqlCommandTest.java @@ -31,26 +31,26 @@ protected Class getCommandClass() { } @Test - @DisplayName("Should throw error if executed without --execute or --script-file options") + @DisplayName("Should throw error if executed without --execute or --file options") void withoutOptions() { execute("--jdbc-url="); assertAll( () -> assertExitCodeIs(2), this::assertOutputIsEmpty, - () -> assertErrOutputContains("Missing required argument (specify one of these): ( | -f=)") + () -> assertErrOutputContains("Missing required argument (specify one of these): ( | --file=)") ); } @Test - @DisplayName("Should throw error if both --execute or --script-file options are present") + @DisplayName("Should throw error if both --execute or --file options are present") void mutuallyExclusiveOptions() { - execute("--jdbc-url=", "select", "--script-file="); + execute("--jdbc-url=", "select", "--file="); assertAll( () -> assertExitCodeIs(2), this::assertOutputIsEmpty, - () -> assertErrOutputContains(", --script-file= are mutually exclusive (specify only one)") + () -> assertErrOutputContains(", --file= are mutually exclusive (specify only one)") ); } } diff --git a/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/SessionDefaultValueProviderTest.java b/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/SessionDefaultValueProviderTest.java index 82462722cc8..b03ed332c57 100644 --- a/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/SessionDefaultValueProviderTest.java +++ b/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/SessionDefaultValueProviderTest.java @@ -20,7 +20,6 @@ import static org.apache.ignite.internal.cli.commands.Options.Constants.JDBC_URL_KEY; import static org.apache.ignite.internal.cli.commands.Options.Constants.JDBC_URL_OPTION; import static org.apache.ignite.internal.cli.commands.Options.Constants.JDBC_URL_OPTION_DESC; -import static org.apache.ignite.internal.cli.commands.Options.Constants.JDBC_URL_OPTION_SHORT; import static org.junit.jupiter.api.Assertions.assertEquals; import org.apache.ignite.internal.cli.commands.cliconfig.TestConfigManagerProvider; @@ -54,7 +53,7 @@ void jdbcUrl() throws Exception { } private static OptionSpec createJdbcUrlSpec() { - return OptionSpec.builder(JDBC_URL_OPTION, JDBC_URL_OPTION_SHORT) + return OptionSpec.builder(JDBC_URL_OPTION) .required(true) .descriptionKey(JDBC_URL_KEY) .description(JDBC_URL_OPTION_DESC) diff --git a/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/HoconDynamicCompleterTest.java b/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/HoconDynamicCompleterTest.java index 6fa99a0496c..1c62ce0f304 100644 --- a/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/HoconDynamicCompleterTest.java +++ b/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/HoconDynamicCompleterTest.java @@ -129,8 +129,8 @@ void completesEmptyConfig() { void doesNotCompletesIfLastWordIsClusterUrl() { // Given completer = completerFrom("root: { subRoot: value }"); - // And --cluster-endpoint-url is the last typed word - String[] typedWords = {"cluster", "config", "show", "--cluster-endpoint-url"}; + // And --url is the last typed word + String[] typedWords = {"cluster", "config", "show", "--url"}; // When List completions = completer.complete(typedWords); @@ -144,8 +144,8 @@ void doesNotCompletesIfLastWordIsClusterUrl() { void doesNotCompletesIfLastWordIsClusterUrlAndEmptyString() { // Given completer = completerFrom("root: { subRoot: value }"); - // And --cluster-endpoint-url is the last typed word - String[] typedWords = {"cluster", "config", "show", "--cluster-endpoint-url", ""}; + // And --url is the last typed word + String[] typedWords = {"cluster", "config", "show", "--url", ""}; // When List completions = completer.complete(typedWords); diff --git a/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/filter/DynamicCompleterFilterTest.java b/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/filter/DynamicCompleterFilterTest.java index a61add85ead..3c0363aeae8 100644 --- a/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/filter/DynamicCompleterFilterTest.java +++ b/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/filter/DynamicCompleterFilterTest.java @@ -34,7 +34,7 @@ void filtersHelp() { // Given String[] words = {"cluster", "config", "show", ""}; // And completion candidates - String[] candidates = {"--cluster-endpoint-url", "--help", "-h"}; + String[] candidates = {"--url", "--help", "-h"}; // And user is not connected to the cluster Session session = notConnected(); @@ -42,7 +42,7 @@ void filtersHelp() { String[] filtered = new DynamicCompleterFilter(session).filter(words, candidates); // Then help is filtered out - assertThat(asList(filtered), containsInAnyOrder("--cluster-endpoint-url")); + assertThat(asList(filtered), containsInAnyOrder("--url")); } private static Session notConnected() { @@ -62,7 +62,7 @@ void doesNotFilterHelpIfOptionIsTyped() { // Given typed words that end with "-" String[] words = {"cluster", "config", "show", "-"}; // And completion candidates - String[] candidates = {"--cluster-endpoint-url", "--help", "-h"}; + String[] candidates = {"--url", "--help", "-h"}; // And user is not connected to the cluster Session session = notConnected(); @@ -70,7 +70,7 @@ void doesNotFilterHelpIfOptionIsTyped() { String[] filtered = new DynamicCompleterFilter(session).filter(words, candidates); // Then help is NOT filtered out - assertThat(asList(filtered), containsInAnyOrder("--cluster-endpoint-url", "--help", "-h")); + assertThat(asList(filtered), containsInAnyOrder("--url", "--help", "-h")); } @Test @@ -78,7 +78,7 @@ void filtersClusterUrlWhenConnected() { // Given typed words that end with "-" String[] words = {"cluster", "config", "show", ""}; // And completion candidates - String[] candidates = {"--cluster-endpoint-url", "--help", "-h"}; + String[] candidates = {"--url", "--help", "-h"}; // And Session session = connected(); @@ -94,7 +94,7 @@ void doesNotFilterHelpIfOptionIsTypedAndConnected() { // Given typed words that end with "-" String[] words = {"cluster", "config", "show", "-"}; // And completion candidates - String[] candidates = {"--cluster-endpoint-url", "--help", "-h"}; + String[] candidates = {"--url", "--help", "-h"}; // And Session session = connected(); @@ -102,7 +102,7 @@ void doesNotFilterHelpIfOptionIsTypedAndConnected() { String[] filtered = new DynamicCompleterFilter(session).filter(words, candidates); // Then help is NOT filtered out - assertThat(asList(filtered), containsInAnyOrder("--cluster-endpoint-url", "--help", "-h")); + assertThat(asList(filtered), containsInAnyOrder("--url", "--help", "-h")); } @Test diff --git a/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/filter/NonRepeatableOptionsFilterTest.java b/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/filter/NonRepeatableOptionsFilterTest.java index 89c0b311c98..687e132c0ef 100644 --- a/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/filter/NonRepeatableOptionsFilterTest.java +++ b/modules/cli/src/test/java/org/apache/ignite/internal/cli/core/repl/completer/filter/NonRepeatableOptionsFilterTest.java @@ -48,10 +48,10 @@ void setUp() { @Test void filterNonRepeatableOptions() { NonRepeatableOptionsFilter filter = new NonRepeatableOptionsFilter(cmd.getCommandSpec()); - String[] words = {"cluster", "init", "--cluster-name", "name", "--cmg-node", "node"}; - String[] candidates = {"--cluster-name", "--cmg-node", "--cluster-endpoint-url", "--meta-storage-node"}; + String[] words = {"cluster", "init", "--name", "name", "--cmg-node", "node"}; + String[] candidates = {"--name", "--cmg-node", "--url", "--meta-storage-node"}; List filteredCandidates = Arrays.asList(filter.filter(words, candidates)); assertThat(filteredCandidates, hasSize(3)); - assertThat(filteredCandidates, containsInAnyOrder("--cmg-node", "--cluster-endpoint-url", "--meta-storage-node")); + assertThat(filteredCandidates, containsInAnyOrder("--cmg-node", "--url", "--meta-storage-node")); } }