Repository: accumulo
Updated Branches:
  refs/heads/master abf78169d -> 68ba2ef11


ACCUMULO-4596 Improvements to standalone cluster testing

* Limited use of bash env variables in standalone cluster testing
* Fixed standalone cluster testing so that it works with Accumulo 2.0
  script changes
* Removed use of sudo in code but added client & server command prefix
  configuration for backwards compatibility.


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/68ba2ef1
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/68ba2ef1
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/68ba2ef1

Branch: refs/heads/master
Commit: 68ba2ef119ed9655b9489acc874d80d7df30d7de
Parents: abf7816
Author: Mike Walch <mwa...@apache.org>
Authored: Mon Mar 6 13:54:26 2017 -0500
Committer: Mike Walch <mwa...@apache.org>
Committed: Wed Mar 15 09:47:32 2017 -0400

----------------------------------------------------------------------
 TESTING.md                                      |  17 +--
 assemble/bin/accumulo                           |   2 +-
 assemble/bin/accumulo-cluster                   |   2 +-
 assemble/bin/accumulo-service                   |   2 +-
 assemble/bin/accumulo-util                      |   2 +-
 .../standalone/StandaloneAccumuloCluster.java   |  23 ++--
 .../standalone/StandaloneClusterControl.java    | 138 +++++++++----------
 .../StandaloneClusterControlTest.java           |  16 ++-
 .../harness/AccumuloClusterHarness.java         |   5 +-
 .../StandaloneAccumuloClusterConfiguration.java |  10 ++
 10 files changed, 113 insertions(+), 104 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/68ba2ef1/TESTING.md
----------------------------------------------------------------------
diff --git a/TESTING.md b/TESTING.md
index a9f5b3c..6b7e389 100644
--- a/TESTING.md
+++ b/TESTING.md
@@ -116,10 +116,12 @@ The following properties can be used to configure a 
standalone cluster:
 - `accumulo.it.cluster.standalone.admin.keytab`, Required: Keytab for the 
principal (only valid w/ Kerberos)
 - `accumulo.it.cluster.standalone.zookeepers`, Required: ZooKeeper quorum used 
by the standalone cluster
 - `accumulo.it.cluster.standalone.instance.name`, Required: Accumulo instance 
name for the cluster
-- `accumulo.it.cluster.standalone.hadoop.conf`, Required: `HADOOP_CONF_DIR`
-- `accumulo.it.cluster.standalone.home`, Optional: `ACCUMULO_HOME`
-- `accumulo.it.cluster.standalone.conf`, Optional: `ACCUMULO_CONF_DIR`
-- `accumulo.it.cluster.standalone.server.user`, Optional: The user Accumulo is 
running as (used to sudo when starting/stopping Accumulo). Default "accumulo"
+- `accumulo.it.cluster.standalone.hadoop.conf`, Required: Hadoop configuration 
directory
+- `accumulo.it.cluster.standalone.home`, Required: Accumulo installation 
directory on cluster
+- `accumulo.it.cluster.standalone.client.conf`, Required: Accumulo conf 
directory on client
+- `accumulo.it.cluster.standalone.server.conf`, Required: Accumulo conf 
directory on server
+- `accumulo.it.cluster.standalone.client.cmd.prefix`, Optional: Prefix that 
will be added to Accumulo client commands
+- `accumulo.it.cluster.standalone.server.cmd.prefix`, Optional: Prefix that 
will be added to Accumulo service commands
 
 Additionally, when running with Kerberos enabled, it is required that Kerberos 
principals already exist
 for the tests to use. As such, a number of properties exist to allow users to 
be passed down for tests
@@ -141,13 +143,6 @@ what is executed for a standalone cluster.
 
   `mvn verify -Daccumulo.it.properties=/home/user/my_cluster.properties`
 
-For the optional properties, each of them will be extracted from the 
environment if not explicitly provided.
-Specifically, `ACCUMULO_HOME` and `ACCUMULO_CONF_DIR` are used to ensure the 
correct version of the bundled
-Accumulo scripts are invoked and, in the event that multiple Accumulo 
processes exist on the same physical machine,
-but for different instances, the correct version is terminated. 
`HADOOP_CONF_DIR` is used to ensure that the necessary
-files to construct the FileSystem object for the cluster can be constructed 
(e.g. core-site.xml and hdfs-site.xml),
-which is typically required to interact with HDFS.
-
 ## MapReduce job for Integration tests
 
 [ACCUMULO-3871][6] (re)introduced the ability to parallelize the execution of 
the Integration Test suite by the use

http://git-wip-us.apache.org/repos/asf/accumulo/blob/68ba2ef1/assemble/bin/accumulo
----------------------------------------------------------------------
diff --git a/assemble/bin/accumulo b/assemble/bin/accumulo
index 2d70a43..bbd2b91 100755
--- a/assemble/bin/accumulo
+++ b/assemble/bin/accumulo
@@ -39,7 +39,7 @@ function main() {
   # Set up variables needed by accumulo-env.sh
   export bin="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
   export basedir=$( cd -P "${bin}"/.. && pwd )
-  export conf="${basedir}/conf"
+  export conf="${ACCUMULO_CONF_DIR:-${basedir}/conf}"
   export lib="${basedir}/lib"
   export cmd="$1"
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/68ba2ef1/assemble/bin/accumulo-cluster
----------------------------------------------------------------------
diff --git a/assemble/bin/accumulo-cluster b/assemble/bin/accumulo-cluster
index 4f457a5..c8a7b2b 100755
--- a/assemble/bin/accumulo-cluster
+++ b/assemble/bin/accumulo-cluster
@@ -297,7 +297,7 @@ function main() {
   done
   bin="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
   basedir=$( cd -P "${bin}"/.. && pwd )
-  conf="${basedir}/conf"
+  conf="${ACCUMULO_CONF_DIR:-${basedir}/conf}"
 
   accumulo_cmd="${bin}/accumulo"
   SSH='ssh -qnf -o ConnectTimeout=2'

http://git-wip-us.apache.org/repos/asf/accumulo/blob/68ba2ef1/assemble/bin/accumulo-service
----------------------------------------------------------------------
diff --git a/assemble/bin/accumulo-service b/assemble/bin/accumulo-service
index a08a0c0..a1b86b7 100755
--- a/assemble/bin/accumulo-service
+++ b/assemble/bin/accumulo-service
@@ -117,7 +117,7 @@ function main() {
   # Set up variables needed by accumulo-env.sh
   export bin="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
   export basedir=$( cd -P "${bin}"/.. && pwd )
-  export conf="${basedir}/conf"
+  export conf="${ACCUMULO_CONF_DIR:-${basedir}/conf}"
   export lib="${basedir}/lib"
 
   if [ -f "${conf}/accumulo-env.sh" ]; then

http://git-wip-us.apache.org/repos/asf/accumulo/blob/68ba2ef1/assemble/bin/accumulo-util
----------------------------------------------------------------------
diff --git a/assemble/bin/accumulo-util b/assemble/bin/accumulo-util
index e8abc4f..995b312 100755
--- a/assemble/bin/accumulo-util
+++ b/assemble/bin/accumulo-util
@@ -644,7 +644,7 @@ function main() {
   done
   bin="$( cd -P "$( dirname "${SOURCE}" )" && pwd )"
   basedir=$( cd -P "${bin}"/.. && pwd )
-  conf="${basedir}/conf"
+  conf="${ACCUMULO_CONF_DIR:-${basedir}/conf}"
   lib="${basedir}/lib"
 
   case "$1" in

http://git-wip-us.apache.org/repos/asf/accumulo/blob/68ba2ef1/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneAccumuloCluster.java
----------------------------------------------------------------------
diff --git 
a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneAccumuloCluster.java
 
b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneAccumuloCluster.java
index ad84f2f..3b19aeb 100644
--- 
a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneAccumuloCluster.java
+++ 
b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneAccumuloCluster.java
@@ -60,18 +60,18 @@ public class StandaloneAccumuloCluster implements 
AccumuloCluster {
   private String accumuloHome, clientAccumuloConfDir, serverAccumuloConfDir, 
hadoopConfDir;
   private Path tmp;
   private List<ClusterUser> users;
-  private String serverUser;
+  private String clientCmdPrefix;
+  private String serverCmdPrefix;
 
-  public StandaloneAccumuloCluster(ClientConfiguration clientConf, Path tmp, 
List<ClusterUser> users, String serverUser) {
-    this(new ZooKeeperInstance(clientConf), clientConf, tmp, users, 
serverUser);
+  public StandaloneAccumuloCluster(ClientConfiguration clientConf, Path tmp, 
List<ClusterUser> users) {
+    this(new ZooKeeperInstance(clientConf), clientConf, tmp, users);
   }
 
-  public StandaloneAccumuloCluster(Instance instance, ClientConfiguration 
clientConf, Path tmp, List<ClusterUser> users, String serverUser) {
+  public StandaloneAccumuloCluster(Instance instance, ClientConfiguration 
clientConf, Path tmp, List<ClusterUser> users) {
     this.instance = instance;
     this.clientConf = clientConf;
     this.tmp = tmp;
     this.users = users;
-    this.serverUser = serverUser;
   }
 
   public String getAccumuloHome() {
@@ -98,6 +98,14 @@ public class StandaloneAccumuloCluster implements 
AccumuloCluster {
     this.serverAccumuloConfDir = accumuloConfDir;
   }
 
+  public void setServerCmdPrefix(String serverCmdPrefix) {
+    this.serverCmdPrefix = serverCmdPrefix;
+  }
+
+  public void setClientCmdPrefix(String clientCmdPrefix) {
+    this.clientCmdPrefix = clientCmdPrefix;
+  }
+
   public String getHadoopConfDir() {
     if (null == hadoopConfDir) {
       hadoopConfDir = System.getenv("HADOOP_CONF_DIR");
@@ -134,9 +142,8 @@ public class StandaloneAccumuloCluster implements 
AccumuloCluster {
 
   @Override
   public StandaloneClusterControl getClusterControl() {
-    return new StandaloneClusterControl(serverUser, null == accumuloHome ? 
System.getenv("ACCUMULO_HOME") : accumuloHome,
-        null == clientAccumuloConfDir ? System.getenv("ACCUMULO_CONF_DIR") : 
clientAccumuloConfDir,
-        null == serverAccumuloConfDir ? System.getenv("ACCUMULO_CONF_DIR") : 
serverAccumuloConfDir);
+    return new StandaloneClusterControl(accumuloHome, clientAccumuloConfDir, 
serverAccumuloConfDir,
+                                        clientCmdPrefix, serverCmdPrefix);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/68ba2ef1/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
----------------------------------------------------------------------
diff --git 
a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
 
b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
index e0238f4..bf1ccc7 100644
--- 
a/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
+++ 
b/minicluster/src/main/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControl.java
@@ -50,37 +50,35 @@ import com.google.common.collect.Maps;
 public class StandaloneClusterControl implements ClusterControl {
   private static final Logger log = 
LoggerFactory.getLogger(StandaloneClusterControl.class);
 
-  private static final String SUDO_CMD = "sudo";
-  private static final String START_SERVER_SCRIPT = "start-server.sh", 
ACCUMULO_SCRIPT = "accumulo", TOOL_SCRIPT = "tool.sh";
+  private static final String ACCUMULO_SERVICE_SCRIPT = "accumulo-service", 
ACCUMULO_SCRIPT = "accumulo", ACCUMULO_UTIL_SCRIPT = "accumulo-util";
   private static final String MASTER_HOSTS_FILE = "masters", GC_HOSTS_FILE = 
"gc", TSERVER_HOSTS_FILE = "tservers", TRACER_HOSTS_FILE = "tracers",
       MONITOR_HOSTS_FILE = "monitor";
-  private static final String ACCUMULO_CONF_DIR = "ACCUMULO_CONF_DIR=";
 
-  protected String user;
-  protected String accumuloHome, clientAccumuloConfDir, serverAccumuloConfDir;
+  String accumuloHome;
+  String clientAccumuloConfDir;
+  String serverAccumuloConfDir;
+  private String clientCmdPrefix;
+  private String serverCmdPrefix;
   protected RemoteShellOptions options;
 
-  protected String startServerPath, accumuloPath, toolPath;
+  protected String accumuloServicePath, accumuloPath, accumuloUtilPath;
 
-  public StandaloneClusterControl(String user) {
-    this(user, System.getenv("ACCUMULO_HOME"), 
System.getenv("ACCUMULO_CONF_DIR"), System.getenv("ACCUMULO_CONF_DIR"));
-  }
-
-  public StandaloneClusterControl(String user, String accumuloHome, String 
clientAccumuloConfDir, String serverAccumuloConfDir) {
-    this.user = user;
+  public StandaloneClusterControl(String accumuloHome, String 
clientAccumuloConfDir, String serverAccumuloConfDir, String clientCmdPrefix, 
String serverCmdPrefix) {
     this.options = new RemoteShellOptions();
     this.accumuloHome = accumuloHome;
     this.clientAccumuloConfDir = clientAccumuloConfDir;
     this.serverAccumuloConfDir = serverAccumuloConfDir;
+    this.clientCmdPrefix = clientCmdPrefix;
+    this.serverCmdPrefix = serverCmdPrefix;
 
     File bin = new File(accumuloHome, "bin");
-    this.startServerPath = new File(bin, 
START_SERVER_SCRIPT).getAbsolutePath();
+    this.accumuloServicePath = new File(bin, 
ACCUMULO_SERVICE_SCRIPT).getAbsolutePath();
     this.accumuloPath = new File(bin, ACCUMULO_SCRIPT).getAbsolutePath();
-    this.toolPath = new File(bin, TOOL_SCRIPT).getAbsolutePath();
+    this.accumuloUtilPath = new File(bin, 
ACCUMULO_UTIL_SCRIPT).getAbsolutePath();
   }
 
-  String getToolPath() {
-    return this.toolPath;
+  String getAccumuloUtilPath() {
+    return this.accumuloUtilPath;
   }
 
   protected Entry<Integer,String> exec(String hostname, String[] command) 
throws IOException {
@@ -106,32 +104,31 @@ public class StandaloneClusterControl implements 
ClusterControl {
 
   @Override
   public Entry<Integer,String> execWithStdout(Class<?> clz, String[] args) 
throws IOException {
-    File confDir = getConfDir();
-    String master = getHosts(new File(confDir, "masters")).get(0);
-    String[] cmd = new String[3 + args.length];
-    // Make sure we always set the right ACCUMULO_CONF_DIR
-    cmd[0] = ACCUMULO_CONF_DIR + clientAccumuloConfDir;
-    cmd[1] = accumuloPath;
-    cmd[2] = clz.getName();
+    String master = getHosts(MASTER_HOSTS_FILE).get(0);
+    List<String> cmd = new ArrayList<>();
+    cmd.add(clientCmdPrefix);
+    cmd.add(accumuloPath);
+    cmd.add(clz.getName());
     // Quote the arguments to prevent shell expansion
-    for (int i = 0, j = 3; i < args.length; i++, j++) {
-      cmd[j] = "'" + args[i] + "'";
+    for (String arg : args) {
+      cmd.add("'" + arg + "'");
     }
     log.info("Running: '{}' on {}", StringUtils.join(cmd, " "), master);
-    return exec(master, cmd);
+    return exec(master, cmd.toArray(new String[cmd.size()]));
   }
 
   public Entry<Integer,String> execMapreduceWithStdout(Class<?> clz, String[] 
args) throws IOException {
     String host = "localhost";
-    String[] cmd = new String[3 + args.length];
-    cmd[0] = getToolPath();
-    cmd[1] = getJarFromClass(clz);
-    cmd[2] = clz.getName();
-    for (int i = 0, j = 3; i < args.length; i++, j++) {
-      cmd[j] = "'" + args[i] + "'";
+    List<String> cmd = new ArrayList<>();
+    cmd.add(getAccumuloUtilPath());
+    cmd.add("hadoop-jar");
+    cmd.add(getJarFromClass(clz));
+    cmd.add(clz.getName());
+    for (String arg : args) {
+      cmd.add("'" + arg + "'");
     }
     log.info("Running: '{}' on {}", StringUtils.join(cmd, " "), host);
-    return exec(host, cmd);
+    return exec(host, cmd.toArray(new String[cmd.size()]));
   }
 
   String getJarFromClass(Class<?> clz) {
@@ -149,9 +146,8 @@ public class StandaloneClusterControl implements 
ClusterControl {
 
   @Override
   public void adminStopAll() throws IOException {
-    File confDir = getConfDir();
-    String master = getHosts(new File(confDir, "masters")).get(0);
-    String[] cmd = new String[] {SUDO_CMD, "-u", user, ACCUMULO_CONF_DIR + 
serverAccumuloConfDir, accumuloPath, Admin.class.getName(), "stopAll"};
+    String master = getHosts(MASTER_HOSTS_FILE).get(0);
+    String[] cmd = new String[] {serverCmdPrefix, accumuloPath, 
Admin.class.getName(), "stopAll"};
     // Directly invoke the RemoteShell
     Entry<Integer,String> pair = exec(master, cmd);
     if (0 != pair.getKey().intValue()) {
@@ -160,7 +156,7 @@ public class StandaloneClusterControl implements 
ClusterControl {
   }
 
   /**
-   * Wrapper around SetGoalState using the "server" 
<code>ACCUMULO_CONF_DIR</code>
+   * Wrapper around SetGoalState
    *
    * @param goalState
    *          The goal state to set
@@ -170,9 +166,8 @@ public class StandaloneClusterControl implements 
ClusterControl {
   public void setGoalState(String goalState) throws IOException {
     requireNonNull(goalState, "Goal state must not be null");
     checkArgument(MasterGoalState.valueOf(goalState) != null, "Unknown goal 
state: " + goalState);
-    File confDir = getConfDir();
-    String master = getHosts(new File(confDir, "masters")).get(0);
-    String[] cmd = new String[] {SUDO_CMD, "-u", user, ACCUMULO_CONF_DIR + 
serverAccumuloConfDir, accumuloPath, SetGoalState.class.getName(), goalState};
+    String master = getHosts(MASTER_HOSTS_FILE).get(0);
+    String[] cmd = new String[] {serverCmdPrefix, accumuloPath, 
SetGoalState.class.getName(), goalState};
     Entry<Integer,String> pair = exec(master, cmd);
     if (0 != pair.getKey().intValue()) {
       throw new IOException("SetGoalState did not finish successfully, 
retcode=" + pair.getKey() + ", stdout=" + pair.getValue());
@@ -181,23 +176,21 @@ public class StandaloneClusterControl implements 
ClusterControl {
 
   @Override
   public void startAllServers(ServerType server) throws IOException {
-    File confDir = getConfDir();
-
     switch (server) {
       case TABLET_SERVER:
-        for (String tserver : getHosts(new File(confDir, TSERVER_HOSTS_FILE))) 
{
+        for (String tserver : getHosts(TSERVER_HOSTS_FILE)) {
           start(server, tserver);
         }
         break;
       case MASTER:
-        for (String master : getHosts(new File(confDir, MASTER_HOSTS_FILE))) {
+        for (String master : getHosts(MASTER_HOSTS_FILE)) {
           start(server, master);
         }
         break;
       case GARBAGE_COLLECTOR:
-        List<String> hosts = getHosts(new File(confDir, GC_HOSTS_FILE));
+        List<String> hosts = getHosts(GC_HOSTS_FILE);
         if (hosts.isEmpty()) {
-          hosts = getHosts(new File(confDir, MASTER_HOSTS_FILE));
+          hosts = getHosts(MASTER_HOSTS_FILE);
           if (hosts.isEmpty()) {
             throw new IOException("Found hosts to run garbage collector on");
           }
@@ -208,12 +201,12 @@ public class StandaloneClusterControl implements 
ClusterControl {
         }
         break;
       case TRACER:
-        for (String tracer : getHosts(new File(confDir, TRACER_HOSTS_FILE))) {
+        for (String tracer : getHosts(TRACER_HOSTS_FILE)) {
           start(server, tracer);
         }
         break;
       case MONITOR:
-        for (String monitor : getHosts(new File(confDir, MONITOR_HOSTS_FILE))) 
{
+        for (String monitor : getHosts(MONITOR_HOSTS_FILE)) {
           start(server, monitor);
         }
         break;
@@ -225,7 +218,7 @@ public class StandaloneClusterControl implements 
ClusterControl {
 
   @Override
   public void start(ServerType server, String hostname) throws IOException {
-    String[] cmd = new String[] {SUDO_CMD, "-u", user, ACCUMULO_CONF_DIR + 
serverAccumuloConfDir, startServerPath, hostname, getProcessString(server)};
+    String[] cmd = new String[] {serverCmdPrefix, accumuloServicePath, 
getProcessString(server), "start"};
     Entry<Integer,String> pair = exec(hostname, cmd);
     if (0 != pair.getKey()) {
       throw new IOException("Start " + server + " on " + hostname + " failed 
for execute successfully");
@@ -234,31 +227,29 @@ public class StandaloneClusterControl implements 
ClusterControl {
 
   @Override
   public void stopAllServers(ServerType server) throws IOException {
-    File confDir = getConfDir();
-
     switch (server) {
       case TABLET_SERVER:
-        for (String tserver : getHosts(new File(confDir, TSERVER_HOSTS_FILE))) 
{
+        for (String tserver : getHosts(TSERVER_HOSTS_FILE)) {
           stop(server, tserver);
         }
         break;
       case MASTER:
-        for (String master : getHosts(new File(confDir, MASTER_HOSTS_FILE))) {
+        for (String master : getHosts(MASTER_HOSTS_FILE)) {
           stop(server, master);
         }
         break;
       case GARBAGE_COLLECTOR:
-        for (String gc : getHosts(new File(confDir, GC_HOSTS_FILE))) {
+        for (String gc : getHosts(GC_HOSTS_FILE)) {
           stop(server, gc);
         }
         break;
       case TRACER:
-        for (String tracer : getHosts(new File(confDir, TRACER_HOSTS_FILE))) {
+        for (String tracer : getHosts(TRACER_HOSTS_FILE)) {
           stop(server, tracer);
         }
         break;
       case MONITOR:
-        for (String monitor : getHosts(new File(confDir, MONITOR_HOSTS_FILE))) 
{
+        for (String monitor : getHosts(MONITOR_HOSTS_FILE)) {
           stop(server, monitor);
         }
         break;
@@ -292,9 +283,9 @@ public class StandaloneClusterControl implements 
ClusterControl {
 
     String[] stopCmd;
     if (isSignalNumber) {
-      stopCmd = new String[] {SUDO_CMD, "-u", user, "kill", "-" + signal, pid};
+      stopCmd = new String[] {serverCmdPrefix, "kill", "-" + signal, pid};
     } else {
-      stopCmd = new String[] {SUDO_CMD, "-u", user, "kill", "-s", signal, pid};
+      stopCmd = new String[] {serverCmdPrefix, "kill", "-s", signal, pid};
     }
 
     Entry<Integer,String> pair = exec(hostname, stopCmd);
@@ -351,34 +342,37 @@ public class StandaloneClusterControl implements 
ClusterControl {
     }
   }
 
-  protected File getConfDir() {
-    String confPath = null == clientAccumuloConfDir ? 
System.getenv("ACCUMULO_CONF_DIR") : clientAccumuloConfDir;
-    File confDir;
-    if (null == confPath) {
-      String homePath = null == accumuloHome ? System.getenv("ACCUMULO_HOME") 
: accumuloHome;
-      if (null == homePath) {
-        throw new IllegalStateException("Cannot extrapolate an 
ACCUMULO_CONF_DIR");
-      }
-      confDir = new File(homePath, "conf");
-    } else {
-      confDir = new File(confPath);
+  protected File getClientConfDir() {
+    File confDir = new File(clientAccumuloConfDir);
+    if (!confDir.exists() || !confDir.isDirectory()) {
+      throw new IllegalStateException("Accumulo client conf dir does not exist 
or is not a directory: " + confDir);
     }
+    return confDir;
+  }
 
+  protected File getServerConfDir() {
+    File confDir = new File(serverAccumuloConfDir);
     if (!confDir.exists() || !confDir.isDirectory()) {
-      throw new IllegalStateException("ACCUMULO_CONF_DIR does not exist or is 
not a directory: " + confDir);
+      throw new IllegalStateException("Accumulo server conf dir does not exist 
or is not a directory: " + confDir);
     }
-
     return confDir;
   }
 
   /**
+   * Read hosts in file named by 'fn' in Accumulo conf dir
+   */
+  protected List<String> getHosts(String fn) throws IOException {
+    return getHosts(new File(getServerConfDir(), fn));
+  }
+
+  /**
    * Read the provided file and return all lines which don't start with a '#' 
character
    */
   protected List<String> getHosts(File f) throws IOException {
     BufferedReader reader = new BufferedReader(new FileReader(f));
     try {
       List<String> hosts = new ArrayList<>();
-      String line = null;
+      String line;
       while ((line = reader.readLine()) != null) {
         line = line.trim();
         if (!line.isEmpty() && !line.startsWith("#")) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/68ba2ef1/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
----------------------------------------------------------------------
diff --git 
a/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
 
b/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
index 1d8a4dc..f972f7d 100644
--- 
a/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
+++ 
b/minicluster/src/test/java/org/apache/accumulo/cluster/standalone/StandaloneClusterControlTest.java
@@ -35,36 +35,38 @@ public class StandaloneClusterControlTest {
   public void testPaths() {
     String accumuloHome = "/usr/lib/accumulo", accumuloConfDir = 
"/etc/accumulo/conf", accumuloServerConfDir = "/etc/accumulo/conf/server";
 
-    StandaloneClusterControl control = new 
StandaloneClusterControl("accumulo", accumuloHome, accumuloConfDir, 
accumuloServerConfDir);
+    StandaloneClusterControl control = new 
StandaloneClusterControl(accumuloHome, accumuloConfDir, accumuloServerConfDir, 
"", "");
 
     assertEquals(accumuloHome, control.accumuloHome);
     assertEquals(accumuloConfDir, control.clientAccumuloConfDir);
+    assertEquals(accumuloServerConfDir, control.serverAccumuloConfDir);
 
     assertEquals(accumuloHome + "/bin/accumulo", control.accumuloPath);
-    assertEquals(accumuloHome + "/bin/start-server.sh", 
control.startServerPath);
+    assertEquals(accumuloHome + "/bin/accumulo-service", 
control.accumuloServicePath);
   }
 
   @Test
   public void mapreduceLaunchesLocally() throws Exception {
-    final String toolPath = "/usr/lib/accumulo/contrib/tool.sh";
+    final String accumuloUtilPath = "/usr/lib/accumulo/bin/accumulo-util";
     final String jar = "/home/user/my_project.jar";
     final Class<?> clz = Object.class;
     final String myClass = clz.getName();
     StandaloneClusterControl control = 
EasyMock.createMockBuilder(StandaloneClusterControl.class).addMockedMethod("exec",
 String.class, String[].class)
-        .addMockedMethod("getToolPath").addMockedMethod("getJarFromClass", 
Class.class).createMock();
+        
.addMockedMethod("getAccumuloUtilPath").addMockedMethod("getJarFromClass", 
Class.class).createMock();
 
     final String[] toolArgs = new String[] {"-u", "user", "-p", "password"};
-    final String[] expectedCommands = new String[3 + toolArgs.length];
+    final String[] expectedCommands = new String[4 + toolArgs.length];
 
     int i = 0;
-    expectedCommands[i++] = toolPath;
+    expectedCommands[i++] = accumuloUtilPath;
+    expectedCommands[i++] = "hadoop-jar";
     expectedCommands[i++] = jar;
     expectedCommands[i++] = myClass;
     for (int j = 0; j < toolArgs.length; j++) {
       expectedCommands[i + j] = quote(toolArgs[j]);
     }
 
-    expect(control.getToolPath()).andReturn(toolPath);
+    expect(control.getAccumuloUtilPath()).andReturn(accumuloUtilPath);
     expect(control.getJarFromClass(anyObject(Class.class))).andReturn(jar);
     expect(control.exec(eq("localhost"), 
aryEq(expectedCommands))).andReturn(Maps.immutableEntry(0, ""));
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/68ba2ef1/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java
----------------------------------------------------------------------
diff --git 
a/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java 
b/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java
index 4cdaf60..9ce87f9 100644
--- a/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java
+++ b/test/src/main/java/org/apache/accumulo/harness/AccumuloClusterHarness.java
@@ -131,13 +131,14 @@ public abstract class AccumuloClusterHarness extends 
AccumuloITBase implements M
       case STANDALONE:
         StandaloneAccumuloClusterConfiguration conf = 
(StandaloneAccumuloClusterConfiguration) clusterConf;
         ClientConfiguration clientConf = conf.getClientConf();
-        StandaloneAccumuloCluster standaloneCluster = new 
StandaloneAccumuloCluster(conf.getInstance(), clientConf, 
conf.getTmpDirectory(), conf.getUsers(),
-            conf.getAccumuloServerUser());
+        StandaloneAccumuloCluster standaloneCluster = new 
StandaloneAccumuloCluster(conf.getInstance(), clientConf, 
conf.getTmpDirectory(), conf.getUsers());
         // If these are provided in the configuration, pass them into the 
cluster
         standaloneCluster.setAccumuloHome(conf.getAccumuloHome());
         
standaloneCluster.setClientAccumuloConfDir(conf.getClientAccumuloConfDir());
         
standaloneCluster.setServerAccumuloConfDir(conf.getServerAccumuloConfDir());
         standaloneCluster.setHadoopConfDir(conf.getHadoopConfDir());
+        standaloneCluster.setServerCmdPrefix(conf.getServerCmdPrefix());
+        standaloneCluster.setClientCmdPrefix(conf.getClientCmdPrefix());
 
         // For SASL, we need to get the Hadoop configuration files as well 
otherwise UGI will log in as SIMPLE instead of KERBEROS
         Configuration hadoopConfiguration = 
standaloneCluster.getHadoopConfiguration();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/68ba2ef1/test/src/main/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java
----------------------------------------------------------------------
diff --git 
a/test/src/main/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java
 
b/test/src/main/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java
index 99a1cdc..989b00a 100644
--- 
a/test/src/main/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java
+++ 
b/test/src/main/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java
@@ -71,6 +71,8 @@ public class StandaloneAccumuloClusterConfiguration extends 
AccumuloClusterPrope
   public static final String ACCUMULO_STANDALONE_HOME = 
ACCUMULO_STANDALONE_PREFIX + "home";
   public static final String ACCUMULO_STANDALONE_CLIENT_CONF = 
ACCUMULO_STANDALONE_PREFIX + "client.conf";
   public static final String ACCUMULO_STANDALONE_SERVER_CONF = 
ACCUMULO_STANDALONE_PREFIX + "server.conf";
+  public static final String ACCUMULO_STANDALONE_CLIENT_CMD_PREFIX = 
ACCUMULO_STANDALONE_PREFIX + "client.cmd.prefix";
+  public static final String ACCUMULO_STANDALONE_SERVER_CMD_PREFIX = 
ACCUMULO_STANDALONE_PREFIX + "server.cmd.prefix";
   public static final String ACCUMULO_STANDALONE_HADOOP_CONF = 
ACCUMULO_STANDALONE_PREFIX + "hadoop.conf";
 
   private Map<String,String> conf;
@@ -224,6 +226,14 @@ public class StandaloneAccumuloClusterConfiguration 
extends AccumuloClusterPrope
     return conf.get(ACCUMULO_STANDALONE_SERVER_CONF);
   }
 
+  public String getServerCmdPrefix() {
+    return conf.get(ACCUMULO_STANDALONE_SERVER_CMD_PREFIX);
+  }
+
+  public String getClientCmdPrefix() {
+    return conf.get(ACCUMULO_STANDALONE_CLIENT_CMD_PREFIX);
+  }
+
   @Override
   public ClientConfiguration getClientConf() {
     return clientConf;

Reply via email to