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

dlmarion 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 e1a92f57e0 Removed ECAdmin, created 3 new KeywordExecutable commands 
(#6104)
e1a92f57e0 is described below

commit e1a92f57e08c9e24eaae23a5e46685d53d6d4c63
Author: Dave Marion <[email protected]>
AuthorDate: Wed Feb 4 17:47:06 2026 -0500

    Removed ECAdmin, created 3 new KeywordExecutable commands (#6104)
    
    Closes #6087
---
 .../util/compaction/ExternalCompactionUtil.java    |  22 +++
 .../accumulo/server/util/CancelCompaction.java     |  92 +++++++++++
 .../util/{ECAdmin.java => ListCompactions.java}    | 174 +++++----------------
 .../accumulo/server/util/ListCompactors.java       |  90 +++++++++++
 .../accumulo/start/spi/KeywordExecutable.java      |   2 +-
 .../{ECAdminIT.java => ListCompactionsIT.java}     |  67 ++------
 .../org/apache/accumulo/test/ListCompactorsIT.java |  91 +++++++++++
 .../apache/accumulo/test/start/KeywordStartIT.java |   9 +-
 8 files changed, 350 insertions(+), 197 deletions(-)

diff --git 
a/core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java
 
b/core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java
index 7b996d030e..aaf615cd05 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/util/compaction/ExternalCompactionUtil.java
@@ -36,6 +36,7 @@ import java.util.concurrent.Future;
 
 import org.apache.accumulo.core.clientImpl.ClientContext;
 import org.apache.accumulo.core.clientImpl.thrift.ThriftSecurityException;
+import org.apache.accumulo.core.compaction.thrift.CompactionCoordinatorService;
 import org.apache.accumulo.core.compaction.thrift.CompactorService;
 import org.apache.accumulo.core.data.ResourceGroupId;
 import org.apache.accumulo.core.lock.ServiceLock;
@@ -53,6 +54,7 @@ import org.apache.accumulo.core.util.Timer;
 import org.apache.accumulo.core.util.threads.ThreadPools;
 import org.apache.accumulo.core.zookeeper.ZcStat;
 import org.apache.thrift.TException;
+import org.apache.thrift.transport.TTransportException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -112,6 +114,26 @@ public class ExternalCompactionUtil {
         .map(sld -> sld.getAddress(ThriftService.COORDINATOR));
   }
 
+  /**
+   * @param context client context
+   * @return CompactionCoordinator Thrift client, user has the responsibility 
to call
+   *         {@code ThriftUtil.returnClient(coordinatorClient, context);}
+   */
+  public static CompactionCoordinatorService.Client 
getCoordinatorClient(ClientContext context) {
+    var coordinatorHost = 
ExternalCompactionUtil.findCompactionCoordinator(context);
+    if (coordinatorHost.isEmpty()) {
+      throw new IllegalStateException("Unable to find coordinator. Check that 
it is running.");
+    }
+    HostAndPort address = coordinatorHost.orElseThrow();
+    CompactionCoordinatorService.Client coordinatorClient;
+    try {
+      coordinatorClient = ThriftUtil.getClient(ThriftClientTypes.COORDINATOR, 
address, context);
+    } catch (TTransportException e) {
+      throw new IllegalStateException("Unable to get Compaction coordinator at 
" + address, e);
+    }
+    return coordinatorClient;
+  }
+
   /**
    * @return map of group names to compactor addresses
    */
diff --git 
a/server/base/src/main/java/org/apache/accumulo/server/util/CancelCompaction.java
 
b/server/base/src/main/java/org/apache/accumulo/server/util/CancelCompaction.java
new file mode 100644
index 0000000000..594e871de9
--- /dev/null
+++ 
b/server/base/src/main/java/org/apache/accumulo/server/util/CancelCompaction.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.server.util;
+
+import org.apache.accumulo.core.compaction.thrift.CompactionCoordinatorService;
+import org.apache.accumulo.core.metadata.schema.ExternalCompactionId;
+import org.apache.accumulo.core.rpc.ThriftUtil;
+import org.apache.accumulo.core.trace.TraceUtil;
+import org.apache.accumulo.core.util.compaction.ExternalCompactionUtil;
+import org.apache.accumulo.server.ServerContext;
+import org.apache.accumulo.server.cli.ServerUtilOpts;
+import org.apache.accumulo.start.spi.KeywordExecutable;
+
+import com.beust.jcommander.JCommander;
+import com.beust.jcommander.Parameter;
+import com.beust.jcommander.Parameters;
+import com.google.auto.service.AutoService;
+
+@AutoService(KeywordExecutable.class)
+public class CancelCompaction implements KeywordExecutable {
+
+  @Parameters(commandNames = "cancel",
+      commandDescription = "cancel the external compaction with given ECID")
+  static class CancelCommand {
+    @Parameter(names = "-ecid", description = "<ecid>", required = true)
+    String ecid;
+  }
+
+  @Override
+  public String keyword() {
+    return "cancel";
+  }
+
+  @Override
+  public String description() {
+    return "Cancels a compaction";
+  }
+
+  @Override
+  public UsageGroup usageGroup() {
+    return UsageGroup.COMPACTION;
+  }
+
+  protected void cancelCompaction(ServerContext context, String ecid) {
+    CompactionCoordinatorService.Client coordinatorClient = null;
+    ecid = ExternalCompactionId.from(ecid).canonical();
+    try {
+      coordinatorClient = ExternalCompactionUtil.getCoordinatorClient(context);
+      coordinatorClient.cancel(TraceUtil.traceInfo(), context.rpcCreds(), 
ecid);
+      System.out.println("Cancel sent to coordinator for " + ecid);
+    } catch (Exception e) {
+      throw new IllegalStateException("Exception calling cancel compaction for 
" + ecid, e);
+    } finally {
+      ThriftUtil.returnClient(coordinatorClient, context);
+    }
+  }
+
+  @Override
+  public void execute(String[] args) throws Exception {
+    ServerUtilOpts opts = new ServerUtilOpts();
+
+    JCommander cl = new JCommander(opts);
+    cl.setProgramName("accumulo " + usageGroup().name().toLowerCase() + " " + 
keyword());
+
+    CancelCommand cancelOps = new CancelCommand();
+    cl.addCommand(cancelOps);
+    cl.parse(args);
+
+    if (opts.help || cl.getParsedCommand() == null) {
+      cl.usage();
+      return;
+    }
+    cancelCompaction(opts.getServerContext(), cancelOps.ecid);
+  }
+
+}
diff --git 
a/server/base/src/main/java/org/apache/accumulo/server/util/ECAdmin.java 
b/server/base/src/main/java/org/apache/accumulo/server/util/ListCompactions.java
similarity index 58%
rename from 
server/base/src/main/java/org/apache/accumulo/server/util/ECAdmin.java
rename to 
server/base/src/main/java/org/apache/accumulo/server/util/ListCompactions.java
index 8e4afe6f91..9cb414a80e 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/ECAdmin.java
+++ 
b/server/base/src/main/java/org/apache/accumulo/server/util/ListCompactions.java
@@ -22,18 +22,13 @@ import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
-import java.util.TreeMap;
 
-import org.apache.accumulo.core.client.admin.servers.ServerId;
 import org.apache.accumulo.core.compaction.thrift.CompactionCoordinatorService;
 import org.apache.accumulo.core.compaction.thrift.TExternalCompaction;
 import org.apache.accumulo.core.compaction.thrift.TExternalCompactionMap;
 import org.apache.accumulo.core.data.ResourceGroupId;
 import org.apache.accumulo.core.dataImpl.KeyExtent;
-import org.apache.accumulo.core.metadata.schema.ExternalCompactionId;
 import org.apache.accumulo.core.rpc.ThriftUtil;
-import org.apache.accumulo.core.rpc.clients.ThriftClientTypes;
 import org.apache.accumulo.core.tabletserver.thrift.TCompactionKind;
 import org.apache.accumulo.core.trace.TraceUtil;
 import org.apache.accumulo.core.util.compaction.ExternalCompactionUtil;
@@ -42,24 +37,16 @@ import 
org.apache.accumulo.core.util.compaction.RunningCompactionInfo;
 import org.apache.accumulo.server.ServerContext;
 import org.apache.accumulo.server.cli.ServerUtilOpts;
 import org.apache.accumulo.start.spi.KeywordExecutable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 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.net.HostAndPort;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
-/**
- * Admin utility for external compactions
- */
 @AutoService(KeywordExecutable.class)
-public class ECAdmin implements KeywordExecutable {
+public class ListCompactions implements KeywordExecutable {
 
   public static class RunningCompactionSummary {
     private final String ecid;
@@ -165,15 +152,6 @@ public class ECAdmin implements KeywordExecutable {
     }
   }
 
-  private static final Logger log = LoggerFactory.getLogger(ECAdmin.class);
-
-  @Parameters(commandNames = "cancel",
-      commandDescription = "cancel the external compaction with given ECID")
-  static class CancelCommand {
-    @Parameter(names = "-ecid", description = "<ecid>", required = true)
-    String ecid;
-  }
-
   @Parameters(commandNames = "running", commandDescription = "list the running 
compactions")
   static class RunningCommand {
     @Parameter(names = {"-d", "--details"},
@@ -184,123 +162,26 @@ public class ECAdmin implements KeywordExecutable {
     boolean jsonOutput = false;
   }
 
-  @Parameters(commandNames = "listCompactors",
-      commandDescription = "list all compactors in zookeeper")
-  static class ListCompactorsCommand {}
-
-  public static void main(String[] args) {
-    new ECAdmin().execute(args);
-  }
-
   @Override
   public String keyword() {
-    return "ec-admin";
-  }
-
-  @Override
-  public UsageGroup usageGroup() {
-    return UsageGroup.CORE;
+    return "list";
   }
 
   @Override
   public String description() {
-    return "Executes administrative commands for external compactions";
+    return "List running compactions";
   }
 
-  @SuppressFBWarnings(value = "DM_EXIT", justification = "System.exit okay for 
CLI tool")
   @Override
-  public void execute(final String[] args) {
-    ServerUtilOpts opts = new ServerUtilOpts();
-    JCommander cl = new JCommander(opts);
-    cl.setProgramName("accumulo ec-admin");
-
-    CancelCommand cancelOps = new CancelCommand();
-    cl.addCommand(cancelOps);
-
-    ListCompactorsCommand listCompactorsOpts = new ListCompactorsCommand();
-    cl.addCommand(listCompactorsOpts);
-
-    RunningCommand runningOpts = new RunningCommand();
-    cl.addCommand(runningOpts);
-
-    cl.parse(args);
-
-    if (opts.help || cl.getParsedCommand() == null) {
-      cl.usage();
-      return;
-    }
-
-    ServerContext context = opts.getServerContext();
-    try {
-      if (cl.getParsedCommand().equals("listCompactors")) {
-        var map = listCompactorsByQueue(context);
-        if (map.isEmpty()) {
-          System.out.println("No Compactors found.");
-        } else {
-          map.forEach((q, c) -> {
-            System.out.println(q);
-            System.out.println("-".repeat(q.toString().length()));
-            c.forEach(s -> System.out.println("\t" + s.toHostPortString()));
-          });
-        }
-      } else if (cl.getParsedCommand().equals("cancel")) {
-        cancelCompaction(context, cancelOps.ecid);
-      } else if (cl.getParsedCommand().equals("running")) {
-        List<RunningCompactionSummary> compactions =
-            runningCompactions(context, runningOpts.details);
-        if (runningOpts.jsonOutput) {
-          try {
-            Gson gson = new GsonBuilder().setPrettyPrinting().create();
-            System.out.println(gson.toJson(compactions));
-          } catch (Exception e) {
-            log.error("Error generating JSON output", e);
-          }
-        } else {
-          compactions.forEach(c -> c.print(System.out));
-        }
-      } else {
-        log.error("Unknown command {}", cl.getParsedCommand());
-        cl.usage();
-        System.exit(1);
-      }
-    } catch (Exception e) {
-      log.error("{}", e.getMessage(), e);
-      System.exit(1);
-    }
-  }
-
-  protected void cancelCompaction(ServerContext context, String ecid) {
-    CompactionCoordinatorService.Client coordinatorClient = null;
-    ecid = ExternalCompactionId.from(ecid).canonical();
-    try {
-      coordinatorClient = getCoordinatorClient(context);
-      coordinatorClient.cancel(TraceUtil.traceInfo(), context.rpcCreds(), 
ecid);
-      System.out.println("Cancel sent to coordinator for " + ecid);
-    } catch (Exception e) {
-      throw new IllegalStateException("Exception calling cancel compaction for 
" + ecid, e);
-    } finally {
-      ThriftUtil.returnClient(coordinatorClient, context);
-    }
-  }
-
-  protected Map<ResourceGroupId,List<ServerId>> 
listCompactorsByQueue(ServerContext context) {
-    Set<ServerId> compactors = 
context.instanceOperations().getServers(ServerId.Type.COMPACTOR);
-    if (compactors.isEmpty()) {
-      return Map.of();
-    } else {
-      Map<ResourceGroupId,List<ServerId>> m = new TreeMap<>();
-      compactors.forEach(csi -> {
-        m.computeIfAbsent(csi.getResourceGroup(), (r) -> new 
ArrayList<>()).add(csi);
-      });
-      return m;
-    }
+  public UsageGroup usageGroup() {
+    return UsageGroup.COMPACTION;
   }
 
-  protected List<RunningCompactionSummary> runningCompactions(ServerContext 
context,
+  protected List<RunningCompactionSummary> getRunningCompactions(ServerContext 
context,
       boolean details) {
     CompactionCoordinatorService.Client coordinatorClient = null;
     try {
-      coordinatorClient = getCoordinatorClient(context);
+      coordinatorClient = ExternalCompactionUtil.getCoordinatorClient(context);
 
       // Fetch running compactions as a list and convert to a map
       TExternalCompactionMap running =
@@ -331,19 +212,36 @@ public class ECAdmin implements KeywordExecutable {
     }
   }
 
-  private CompactionCoordinatorService.Client 
getCoordinatorClient(ServerContext context) {
-    var coordinatorHost = 
ExternalCompactionUtil.findCompactionCoordinator(context);
-    if (coordinatorHost.isEmpty()) {
-      throw new IllegalStateException("Unable to find coordinator. Check that 
it is running.");
+  @Override
+  public void execute(String[] args) throws Exception {
+    ServerUtilOpts opts = new ServerUtilOpts();
+    JCommander cl = new JCommander(opts);
+    cl.setProgramName("accumulo " + usageGroup().name().toLowerCase() + " " + 
keyword());
+
+    RunningCommand runningOpts = new RunningCommand();
+    cl.addCommand(runningOpts);
+
+    cl.parse(args);
+
+    if (opts.help || cl.getParsedCommand() == null) {
+      cl.usage();
+      return;
     }
-    HostAndPort address = coordinatorHost.orElseThrow();
-    CompactionCoordinatorService.Client coordinatorClient;
-    try {
-      coordinatorClient = ThriftUtil.getClient(ThriftClientTypes.COORDINATOR, 
address, context);
-    } catch (Exception e) {
-      throw new IllegalStateException("Unable to get Compaction coordinator at 
" + address, e);
+
+    ServerContext context = opts.getServerContext();
+    List<RunningCompactionSummary> compactions =
+        getRunningCompactions(context, runningOpts.details);
+    if (runningOpts.jsonOutput) {
+      try {
+        Gson gson = new GsonBuilder().setPrettyPrinting().create();
+        System.out.println(gson.toJson(compactions));
+      } catch (Exception e) {
+        System.out.println("Error generating JSON output");
+        e.printStackTrace();
+      }
+    } else {
+      compactions.forEach(c -> c.print(System.out));
     }
-    System.out.println("Connected to coordinator at " + address);
-    return coordinatorClient;
   }
+
 }
diff --git 
a/server/base/src/main/java/org/apache/accumulo/server/util/ListCompactors.java 
b/server/base/src/main/java/org/apache/accumulo/server/util/ListCompactors.java
new file mode 100644
index 0000000000..ca8cb43cdb
--- /dev/null
+++ 
b/server/base/src/main/java/org/apache/accumulo/server/util/ListCompactors.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.server.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
+
+import org.apache.accumulo.core.client.admin.servers.ServerId;
+import org.apache.accumulo.core.data.ResourceGroupId;
+import org.apache.accumulo.server.ServerContext;
+import org.apache.accumulo.server.cli.ServerUtilOpts;
+import org.apache.accumulo.start.spi.KeywordExecutable;
+
+import com.beust.jcommander.JCommander;
+import com.google.auto.service.AutoService;
+
+@AutoService(KeywordExecutable.class)
+public class ListCompactors implements KeywordExecutable {
+
+  @Override
+  public String keyword() {
+    return "list-compactors";
+  }
+
+  @Override
+  public String description() {
+    return "Displays compactors grouped by resource group";
+  }
+
+  @Override
+  public UsageGroup usageGroup() {
+    return UsageGroup.PROCESS;
+  }
+
+  protected Map<ResourceGroupId,List<ServerId>> 
listCompactorsByQueue(ServerContext context) {
+    Set<ServerId> compactors = 
context.instanceOperations().getServers(ServerId.Type.COMPACTOR);
+    if (compactors.isEmpty()) {
+      return Map.of();
+    } else {
+      Map<ResourceGroupId,List<ServerId>> m = new TreeMap<>();
+      compactors.forEach(csi -> {
+        m.computeIfAbsent(csi.getResourceGroup(), (r) -> new 
ArrayList<>()).add(csi);
+      });
+      return m;
+    }
+  }
+
+  @Override
+  public void execute(String[] args) throws Exception {
+    ServerUtilOpts opts = new ServerUtilOpts();
+    JCommander cl = new JCommander(opts);
+    cl.setProgramName("accumulo " + usageGroup().name().toLowerCase() + " " + 
keyword());
+    cl.parse(args);
+
+    if (opts.help || cl.getParsedCommand() == null) {
+      cl.usage();
+      return;
+    }
+
+    var map = listCompactorsByQueue(opts.getServerContext());
+    if (map.isEmpty()) {
+      System.out.println("No Compactors found.");
+    } else {
+      map.forEach((q, c) -> {
+        System.out.println(q);
+        System.out.println("-".repeat(q.toString().length()));
+        c.forEach(s -> System.out.println("\t" + s.toHostPortString()));
+      });
+    }
+  }
+}
diff --git 
a/start/src/main/java/org/apache/accumulo/start/spi/KeywordExecutable.java 
b/start/src/main/java/org/apache/accumulo/start/spi/KeywordExecutable.java
index 4f67f5f3b4..3866149fd0 100644
--- a/start/src/main/java/org/apache/accumulo/start/spi/KeywordExecutable.java
+++ b/start/src/main/java/org/apache/accumulo/start/spi/KeywordExecutable.java
@@ -45,7 +45,7 @@ import java.util.ServiceLoader;
 public interface KeywordExecutable {
 
   enum UsageGroup {
-    CORE, PROCESS, OTHER
+    COMPACTION, CORE, PROCESS, OTHER
   }
 
   /**
diff --git a/test/src/main/java/org/apache/accumulo/test/ECAdminIT.java 
b/test/src/main/java/org/apache/accumulo/test/ListCompactionsIT.java
similarity index 66%
rename from test/src/main/java/org/apache/accumulo/test/ECAdminIT.java
rename to test/src/main/java/org/apache/accumulo/test/ListCompactionsIT.java
index 07c7de23f3..6c57190e5c 100644
--- a/test/src/main/java/org/apache/accumulo/test/ECAdminIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ListCompactionsIT.java
@@ -18,20 +18,12 @@
  */
 package org.apache.accumulo.test;
 
-import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP1;
-import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP2;
-import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP3;
-import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP4;
-import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP5;
-import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP6;
 import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP7;
-import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP8;
 import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.compact;
 import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.createTable;
 import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.writeData;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
-import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.lang.reflect.Type;
 import java.util.ArrayList;
@@ -44,17 +36,15 @@ import java.util.Optional;
 import org.apache.accumulo.core.client.Accumulo;
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.client.admin.servers.ServerId;
 import org.apache.accumulo.core.compaction.thrift.TExternalCompactionMap;
-import org.apache.accumulo.core.data.ResourceGroupId;
 import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
 import org.apache.accumulo.core.util.compaction.ExternalCompactionUtil;
 import org.apache.accumulo.harness.MiniClusterConfigurationCallback;
 import org.apache.accumulo.harness.SharedMiniClusterBase;
 import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
 import org.apache.accumulo.server.ServerContext;
-import org.apache.accumulo.server.util.ECAdmin;
-import org.apache.accumulo.server.util.ECAdmin.RunningCompactionSummary;
+import org.apache.accumulo.server.util.ListCompactions;
+import 
org.apache.accumulo.server.util.ListCompactions.RunningCompactionSummary;
 import org.apache.accumulo.test.compaction.ExternalCompactionTestUtils;
 import org.apache.accumulo.test.functional.SlowIterator;
 import org.apache.hadoop.conf.Configuration;
@@ -67,40 +57,26 @@ import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.reflect.TypeToken;
 
-public class ECAdminIT extends SharedMiniClusterBase {
-
-  // Class exists for access to protected methods
-  private static class TestECAdmin extends ECAdmin {
-
-    @Override
-    protected void cancelCompaction(ServerContext context, String ecid) {
-      super.cancelCompaction(context, ecid);
-    }
-
-    @Override
-    protected Map<ResourceGroupId,List<ServerId>> 
listCompactorsByQueue(ServerContext context) {
-      return super.listCompactorsByQueue(context);
-    }
+public class ListCompactionsIT extends SharedMiniClusterBase {
 
+  private static final class ListCompactionsITConfig implements 
MiniClusterConfigurationCallback {
     @Override
-    protected List<RunningCompactionSummary> runningCompactions(ServerContext 
context,
-        boolean details) {
-      return super.runningCompactions(context, details);
+    public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration 
coreSite) {
+      ExternalCompactionTestUtils.configureMiniCluster(cfg, coreSite);
     }
   }
 
-  private static final class ECAdminITConfig implements 
MiniClusterConfigurationCallback {
-
+  private static class ListCompactionsWrapper extends ListCompactions {
     @Override
-    public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration 
coreSite) {
-      ExternalCompactionTestUtils.configureMiniCluster(cfg, coreSite);
+    protected List<RunningCompactionSummary> 
getRunningCompactions(ServerContext context,
+        boolean details) {
+      return super.getRunningCompactions(context, details);
     }
-
   }
 
   @BeforeAll
   public static void beforeAll() throws Exception {
-    SharedMiniClusterBase.startMiniClusterWithConfig(new ECAdminITConfig());
+    SharedMiniClusterBase.startMiniClusterWithConfig(new 
ListCompactionsITConfig());
   }
 
   @AfterAll
@@ -108,25 +84,6 @@ public class ECAdminIT extends SharedMiniClusterBase {
     SharedMiniClusterBase.stopMiniCluster();
   }
 
-  private final TestECAdmin eca = new TestECAdmin();
-
-  @Test
-  public void testListCompactors() throws Exception {
-    final Map<ResourceGroupId,List<ServerId>> compactors =
-        eca.listCompactorsByQueue(getCluster().getServerContext());
-    System.out.println(compactors);
-    assertEquals(9, compactors.size());
-    assertTrue(compactors.containsKey(ResourceGroupId.DEFAULT));
-    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP1)));
-    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP2)));
-    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP3)));
-    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP4)));
-    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP5)));
-    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP6)));
-    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP7)));
-    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP8)));
-  }
-
   @Test
   public void testListRunningCompactions() throws Exception {
 
@@ -156,7 +113,7 @@ public class ECAdminIT extends SharedMiniClusterBase {
       }
 
       final List<RunningCompactionSummary> running =
-          eca.runningCompactions(getCluster().getServerContext(), true);
+          new 
ListCompactionsWrapper().getRunningCompactions(getCluster().getServerContext(), 
true);
       final Map<String,RunningCompactionSummary> compactionsByEcid = new 
HashMap<>();
       running.forEach(rcs -> compactionsByEcid.put(rcs.getEcid(), rcs));
 
diff --git a/test/src/main/java/org/apache/accumulo/test/ListCompactorsIT.java 
b/test/src/main/java/org/apache/accumulo/test/ListCompactorsIT.java
new file mode 100644
index 0000000000..d4bfab4ce6
--- /dev/null
+++ b/test/src/main/java/org/apache/accumulo/test/ListCompactorsIT.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.accumulo.test;
+
+import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP1;
+import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP2;
+import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP3;
+import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP4;
+import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP5;
+import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP6;
+import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP7;
+import static 
org.apache.accumulo.test.compaction.ExternalCompactionTestUtils.GROUP8;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.accumulo.core.client.admin.servers.ServerId;
+import org.apache.accumulo.core.data.ResourceGroupId;
+import org.apache.accumulo.harness.MiniClusterConfigurationCallback;
+import org.apache.accumulo.harness.SharedMiniClusterBase;
+import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
+import org.apache.accumulo.server.ServerContext;
+import org.apache.accumulo.server.util.ListCompactors;
+import org.apache.accumulo.test.compaction.ExternalCompactionTestUtils;
+import org.apache.hadoop.conf.Configuration;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+
+public class ListCompactorsIT extends SharedMiniClusterBase {
+
+  private static final class ListCompactorsITConfig implements 
MiniClusterConfigurationCallback {
+    @Override
+    public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration 
coreSite) {
+      ExternalCompactionTestUtils.configureMiniCluster(cfg, coreSite);
+    }
+  }
+
+  private static class ListCompactorsWrapper extends ListCompactors {
+    @Override
+    protected Map<ResourceGroupId,List<ServerId>> 
listCompactorsByQueue(ServerContext context) {
+      return super.listCompactorsByQueue(context);
+    }
+  }
+
+  @BeforeAll
+  public static void beforeAll() throws Exception {
+    SharedMiniClusterBase.startMiniClusterWithConfig(new 
ListCompactorsITConfig());
+  }
+
+  @AfterAll
+  public static void afterAll() throws Exception {
+    SharedMiniClusterBase.stopMiniCluster();
+  }
+
+  @Test
+  public void testListCompactors() throws Exception {
+    final Map<ResourceGroupId,List<ServerId>> compactors =
+        new 
ListCompactorsWrapper().listCompactorsByQueue(getCluster().getServerContext());
+    System.out.println(compactors);
+    assertEquals(9, compactors.size());
+    assertTrue(compactors.containsKey(ResourceGroupId.DEFAULT));
+    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP1)));
+    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP2)));
+    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP3)));
+    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP4)));
+    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP5)));
+    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP6)));
+    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP7)));
+    assertTrue(compactors.containsKey(ResourceGroupId.of(GROUP8)));
+  }
+
+}
diff --git 
a/test/src/main/java/org/apache/accumulo/test/start/KeywordStartIT.java 
b/test/src/main/java/org/apache/accumulo/test/start/KeywordStartIT.java
index 40b7d02e99..756e9c9e76 100644
--- a/test/src/main/java/org/apache/accumulo/test/start/KeywordStartIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/start/KeywordStartIT.java
@@ -59,9 +59,11 @@ import org.apache.accumulo.server.conf.util.ZooInfoViewer;
 import org.apache.accumulo.server.conf.util.ZooPropEditor;
 import org.apache.accumulo.server.init.Initialize;
 import org.apache.accumulo.server.util.Admin;
+import org.apache.accumulo.server.util.CancelCompaction;
 import org.apache.accumulo.server.util.DumpZookeeper;
-import org.apache.accumulo.server.util.ECAdmin;
 import org.apache.accumulo.server.util.Info;
+import org.apache.accumulo.server.util.ListCompactions;
+import org.apache.accumulo.server.util.ListCompactors;
 import org.apache.accumulo.server.util.LoginProperties;
 import org.apache.accumulo.server.util.UpgradeUtil;
 import org.apache.accumulo.server.util.ZooKeeperMain;
@@ -156,7 +158,6 @@ public class KeywordStartIT {
     expectSet.add(new CommandInfo(UsageGroup.OTHER, "create-empty", 
CreateEmpty.class));
     expectSet.add(new CommandInfo(UsageGroup.OTHER, "create-token", 
CreateToken.class));
     expectSet.add(new CommandInfo(UsageGroup.OTHER, "dump-zoo", 
DumpZookeeper.class));
-    expectSet.add(new CommandInfo(UsageGroup.CORE, "ec-admin", ECAdmin.class));
     expectSet.add(new CommandInfo(UsageGroup.PROCESS, "gc", 
GCExecutable.class));
     expectSet.add(new CommandInfo(UsageGroup.OTHER, "generate-splits", 
GenerateSplits.class));
     expectSet.add(new CommandInfo(UsageGroup.CORE, "help", Help.class));
@@ -178,6 +179,9 @@ public class KeywordStartIT {
     expectSet.add(new CommandInfo(UsageGroup.OTHER, "zoo-prop-editor", 
ZooPropEditor.class));
     expectSet.add(new CommandInfo(UsageGroup.OTHER, "zoo-zap", ZooZap.class));
     expectSet.add(new CommandInfo(UsageGroup.PROCESS, "zookeeper", 
ZooKeeperMain.class));
+    expectSet.add(new CommandInfo(UsageGroup.OTHER, "cancel-compaction", 
CancelCompaction.class));
+    expectSet.add(new CommandInfo(UsageGroup.OTHER, "list-compactors", 
ListCompactors.class));
+    expectSet.add(new CommandInfo(UsageGroup.OTHER, "list-compactions", 
ListCompactions.class));
 
     Map<UsageGroup,Map<String,KeywordExecutable>> actualExecutables =
         new TreeMap<>(getKeywordExecutables());
@@ -232,7 +236,6 @@ public class KeywordStartIT {
     expectSet.add(CreateEmpty.class);
     expectSet.add(CreateToken.class);
     expectSet.add(DumpZookeeper.class);
-    expectSet.add(ECAdmin.class);
     expectSet.add(GenerateSplits.class);
     expectSet.add(Info.class);
     expectSet.add(Initialize.class);

Reply via email to