This is an automated email from the ASF dual-hosted git repository. ctubbsii pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push: new 99ca22d Change shell 'config' command to display sorted output (#2150) 99ca22d is described below commit 99ca22da9e9233e41954cf57c0c33809aca24783 Author: Luke Foster <84727868+foste...@users.noreply.github.com> AuthorDate: Tue Jun 8 13:22:32 2021 -0400 Change shell 'config' command to display sorted output (#2150) * Change shell config command to sorted * Change Admin.java to sorted map --- .../base/src/main/java/org/apache/accumulo/server/util/Admin.java | 7 ++++--- .../java/org/apache/accumulo/shell/commands/ConfigCommand.java | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java index a053b12..299b1d6 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java +++ b/server/base/src/main/java/org/apache/accumulo/server/util/Admin.java @@ -71,6 +71,7 @@ import com.beust.jcommander.JCommander; import com.beust.jcommander.Parameter; import com.beust.jcommander.Parameters; import com.google.auto.service.AutoService; +import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.Lists; import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; @@ -528,8 +529,8 @@ public class Admin implements KeywordExecutable { File namespaceScript = new File(outputDirectory, namespace + NS_FILE_SUFFIX); try (BufferedWriter nsWriter = new BufferedWriter(new FileWriter(namespaceScript, UTF_8))) { nsWriter.write(createNsFormat.format(new String[] {namespace})); - Map<String,String> props = - Map.copyOf(accumuloClient.namespaceOperations().getConfiguration(namespace)); + Map<String,String> props = ImmutableSortedMap + .copyOf(accumuloClient.namespaceOperations().getConfiguration(namespace)); for (Entry<String,String> entry : props.entrySet()) { String defaultValue = getDefaultConfigValue(entry.getKey()); if (defaultValue == null || !defaultValue.equals(entry.getValue())) { @@ -606,7 +607,7 @@ public class Admin implements KeywordExecutable { try (BufferedWriter writer = new BufferedWriter(new FileWriter(tableBackup, UTF_8))) { writer.write(createTableFormat.format(new String[] {tableName})); Map<String,String> props = - Map.copyOf(accumuloClient.tableOperations().getConfiguration(tableName)); + ImmutableSortedMap.copyOf(accumuloClient.tableOperations().getConfiguration(tableName)); for (Entry<String,String> prop : props.entrySet()) { if (prop.getKey().startsWith(Property.TABLE_PREFIX.getKey())) { String defaultValue = getDefaultConfigValue(prop.getKey()); diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java index 45d4f39..6ecc02b 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/ConfigCommand.java @@ -47,6 +47,8 @@ import org.apache.commons.cli.OptionGroup; import org.apache.commons.cli.Options; import org.jline.reader.LineReader; +import com.google.common.collect.ImmutableSortedMap; + public class ConfigCommand extends Command { private Option tableOpt, deleteOpt, setOpt, filterOpt, filterWithValuesOpt, disablePaginationOpt, outputFileOpt, namespaceOpt; @@ -183,7 +185,7 @@ public class ConfigCommand extends Command { } else if (namespace != null) { acuconf = shellState.getAccumuloClient().namespaceOperations().getConfiguration(namespace); } - final Map<String,String> sortedConf = Map.copyOf(acuconf); + final Map<String,String> sortedConf = ImmutableSortedMap.copyOf(acuconf); for (Entry<String,String> propEntry : acuconf.entrySet()) { final String key = propEntry.getKey();