accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [2/4] accumulo git commit: ACCUMULO-3599 Refactor tests to run over MAC using Kerberos
Date Tue, 03 Mar 2015 19:15:28 GMT
http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/CleanTmpIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/CleanTmpIT.java b/test/src/test/java/org/apache/accumulo/test/functional/CleanTmpIT.java
index 4e6799f..2114992 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/CleanTmpIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/CleanTmpIT.java
@@ -41,6 +41,7 @@ import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.fs.RawLocalFileSystem;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -54,7 +55,8 @@ public class CleanTmpIT extends AccumuloClusterIT {
   public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
     cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "3s");
     cfg.setNumTservers(1);
-    cfg.useMiniDFS(true);
+    // use raw local file system so walogs sync and flush will work
+    hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/CleanUpIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/CleanUpIT.java b/test/src/test/java/org/apache/accumulo/test/functional/CleanUpIT.java
index 0ba829a..0818e67 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/CleanUpIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/CleanUpIT.java
@@ -22,22 +22,15 @@ import java.util.Set;
 
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
-import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.util.CleanUp;
-import org.apache.accumulo.harness.AccumuloIT;
-import org.apache.accumulo.harness.MiniClusterHarness;
-import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl;
+import org.apache.accumulo.harness.AccumuloClusterIT;
 import org.apache.log4j.Logger;
-import org.junit.After;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
 
 /**
@@ -46,42 +39,14 @@ import org.junit.Test;
  * Because this is destructive across the current context classloader, the normal teardown methods will fail (because they attempt to create a Connector). Until
  * the ZooKeeperInstance and Connector are self-contained WRT resource management, we can't leverage the AccumuloClusterIT.
  */
-public class CleanUpIT extends AccumuloIT {
+public class CleanUpIT extends AccumuloClusterIT {
   private static final Logger log = Logger.getLogger(CleanUpIT.class);
 
-  private MiniAccumuloClusterImpl cluster;
-
   @Override
   protected int defaultTimeoutSeconds() {
     return 30;
   }
 
-  @Before
-  public void startMiniCluster() throws Exception {
-    MiniClusterHarness miniClusterHarness = new MiniClusterHarness();
-    cluster = miniClusterHarness.create(this, getToken());
-    cluster.start();
-  }
-
-  @After
-  public void stopMiniCluster() throws Exception {
-    if (null != cluster) {
-      cluster.stop();
-    }
-  }
-
-  private AuthenticationToken getToken() {
-    return new PasswordToken("rootPassword");
-  }
-
-  private Connector getConnector() {
-    try {
-      return cluster.getConnector("root", getToken());
-    } catch (Exception e) {
-      throw new RuntimeException(e);
-    }
-  }
-
   @Test
   public void run() throws Exception {
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java b/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java
index 80792f6..6acabc6 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/CompactionIT.java
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.test.functional;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
@@ -24,10 +25,14 @@ import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.accumulo.core.cli.ClientOpts.Password;
 import org.apache.accumulo.core.cli.ScannerOpts;
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.admin.InstanceOperations;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema;
@@ -106,13 +111,14 @@ public class CompactionIT extends AccumuloClusterIT {
     c.tableOperations().create(tableName);
     c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "1.0");
     FileSystem fs = getFileSystem();
-    String root = getUsableDir();
+    Path root = new Path(cluster.getTemporaryPath(), getClass().getName());
     Path testrf = new Path(root, "testrf");
     FunctionalTestUtils.createRFiles(c, fs, testrf.toString(), 500000, 59, 4);
     FunctionalTestUtils.bulkImport(c, fs, tableName, testrf.toString());
     int beforeCount = countFiles(c);
 
     final AtomicBoolean fail = new AtomicBoolean(false);
+    final ClientConfiguration clientConf = cluster.getClientConfig();
     for (int count = 0; count < 5; count++) {
       List<Thread> threads = new ArrayList<Thread>();
       final int span = 500000 / 59;
@@ -129,6 +135,13 @@ public class CompactionIT extends AccumuloClusterIT {
               opts.dataSize = 50;
               opts.cols = 1;
               opts.setTableName(tableName);
+              if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) {
+                opts.updateKerberosCredentials(clientConf);
+              } else {
+                opts.setPrincipal(getAdminPrincipal());
+                PasswordToken passwordToken = (PasswordToken) getAdminToken();
+                opts.setPassword(new Password(new String(passwordToken.getPassword(), UTF_8)));
+              }
               VerifyIngest.verifyIngest(c, opts, new ScannerOpts());
             } catch (Exception ex) {
               log.warn("Got exception verifying data", ex);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/ConcurrencyIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ConcurrencyIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ConcurrencyIT.java
index 82088ae..87374ca 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/ConcurrencyIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ConcurrencyIT.java
@@ -18,8 +18,8 @@ package org.apache.accumulo.test.functional;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 
-import java.util.Collections;
 import java.util.EnumSet;
+import java.util.Map;
 
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -66,7 +66,9 @@ public class ConcurrencyIT extends AccumuloClusterIT {
 
   @Override
   public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
-    cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "1"));
+    Map<String,String> siteConfig = cfg.getSiteConfig();
+    siteConfig.put(Property.TSERV_MAJC_DELAY.getKey(), "1");
+    cfg.setSiteConfig(siteConfig);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java b/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java
index b82dcb3..cf0f297 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/CredentialsIT.java
@@ -23,32 +23,33 @@ import static org.junit.Assert.fail;
 import java.util.Iterator;
 import java.util.Map.Entry;
 
-import javax.security.auth.DestroyFailedException;
-
+import org.apache.accumulo.cluster.ClusterUser;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.security.SecurityErrorCode;
+import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.Base64;
 import org.apache.accumulo.harness.AccumuloClusterIT;
+import org.apache.hadoop.security.UserGroupInformation;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-/**
- *
- */
 public class CredentialsIT extends AccumuloClusterIT {
 
-  private static final String username = CredentialsIT.class.getSimpleName();
-  private static final String password = Base64.encodeBase64String(username.getBytes());
+  private boolean saslEnabled;
+  private String username;
+  private String password;
+  private Instance inst;
 
   @Override
   public int defaultTimeoutSeconds() {
@@ -57,22 +58,38 @@ public class CredentialsIT extends AccumuloClusterIT {
 
   @Before
   public void createLocalUser() throws AccumuloException, AccumuloSecurityException {
-    getConnector().securityOperations().createLocalUser(username, new PasswordToken(password));
+    Connector conn = getConnector();
+    inst = conn.getInstance();
+
+    ClientConfiguration clientConf = cluster.getClientConfig();
+    ClusterUser user = getUser(0);
+    username = user.getPrincipal();
+    saslEnabled = clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false);
+    PasswordToken passwdToken = null;
+    if (!saslEnabled) {
+      password = user.getPassword();
+      passwdToken = new PasswordToken(password);
+    }
+    conn.securityOperations().createLocalUser(username, passwdToken);
   }
 
   @After
-  public void deleteLocalUser() throws AccumuloException, AccumuloSecurityException {
+  public void deleteLocalUser() throws Exception {
+    if (saslEnabled) {
+      ClusterUser root = getAdminUser();
+      UserGroupInformation.loginUserFromKeytab(root.getPrincipal(), root.getKeytab().getAbsolutePath());
+    }
     getConnector().securityOperations().dropLocalUser(username);
   }
 
   @Test
-  public void testConnectorWithDestroyedToken() throws DestroyFailedException, AccumuloException {
-    PasswordToken token = new PasswordToken(password);
+  public void testConnectorWithDestroyedToken() throws Exception {
+    AuthenticationToken token = getUser(0).getToken();
     assertFalse(token.isDestroyed());
     token.destroy();
     assertTrue(token.isDestroyed());
     try {
-      getConnector().getInstance().getConnector("localUser", token);
+      inst.getConnector("non_existent_user", token);
       fail();
     } catch (AccumuloSecurityException e) {
       assertTrue(e.getSecurityErrorCode().equals(SecurityErrorCode.TOKEN_EXPIRED));
@@ -80,9 +97,9 @@ public class CredentialsIT extends AccumuloClusterIT {
   }
 
   @Test
-  public void testDestroyTokenBeforeRPC() throws AccumuloException, DestroyFailedException, AccumuloSecurityException, TableNotFoundException {
-    PasswordToken token = new PasswordToken(password);
-    Connector userConnector = getConnector().getInstance().getConnector(username, token);
+  public void testDestroyTokenBeforeRPC() throws Exception {
+    AuthenticationToken token = getUser(0).getToken();
+    Connector userConnector = inst.getConnector(username, token);
     Scanner scanner = userConnector.createScanner(MetadataTable.NAME, Authorizations.EMPTY);
     assertFalse(token.isDestroyed());
     token.destroy();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java b/test/src/test/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java
index 2de5eda..961c09f 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/DeleteEverythingIT.java
@@ -19,7 +19,7 @@ package org.apache.accumulo.test.functional;
 import static java.nio.charset.StandardCharsets.UTF_8;
 import static org.junit.Assert.assertEquals;
 
-import java.util.Collections;
+import java.util.Map;
 
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
@@ -46,7 +46,9 @@ public class DeleteEverythingIT extends AccumuloClusterIT {
 
   @Override
   public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
-    cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "1s"));
+    Map<String,String> siteConfig = cfg.getSiteConfig();
+    siteConfig.put(Property.TSERV_MAJC_DELAY.getKey(), "1s");
+    cfg.setSiteConfig(siteConfig);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/DeleteIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/DeleteIT.java b/test/src/test/java/org/apache/accumulo/test/functional/DeleteIT.java
index db86d89..ec248f2 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/DeleteIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/DeleteIT.java
@@ -17,11 +17,17 @@
 package org.apache.accumulo.test.functional;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
 
 import org.apache.accumulo.cluster.AccumuloCluster;
 import org.apache.accumulo.core.cli.BatchWriterOpts;
+import org.apache.accumulo.core.cli.ClientOpts.Password;
 import org.apache.accumulo.core.cli.ScannerOpts;
+import org.apache.accumulo.core.client.ClientConfiguration;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
+import org.apache.accumulo.core.client.security.tokens.KerberosToken;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.harness.AccumuloClusterIT;
 import org.apache.accumulo.test.TestIngest;
@@ -43,8 +49,13 @@ public class DeleteIT extends AccumuloClusterIT {
     Connector c = getConnector();
     String tableName = getUniqueNames(1)[0];
     c.tableOperations().create(tableName);
-    PasswordToken token = (PasswordToken) getToken();
-    deleteTest(c, getCluster(), new String(token.getPassword(), Charsets.UTF_8), tableName);
+    AuthenticationToken token = getAdminToken();
+    if (token instanceof KerberosToken) {
+      deleteTest(c, getCluster(), getAdminPrincipal(), null, tableName, getAdminUser().getKeytab().getAbsolutePath());
+    } else if (token instanceof PasswordToken) {
+      PasswordToken passwdToken = (PasswordToken) token;
+      deleteTest(c, getCluster(), getAdminPrincipal(), new String(passwdToken.getPassword(), Charsets.UTF_8), tableName, null);
+    }
     try {
       getCluster().getClusterControl().adminStopAll();
     } finally {
@@ -52,7 +63,7 @@ public class DeleteIT extends AccumuloClusterIT {
     }
   }
 
-  public static void deleteTest(Connector c, AccumuloCluster cluster, String password, String tableName) throws Exception {
+  public static void deleteTest(Connector c, AccumuloCluster cluster, String user, String password, String tableName, String keytab) throws Exception {
     VerifyIngest.Opts vopts = new VerifyIngest.Opts();
     TestIngest.Opts opts = new TestIngest.Opts();
     vopts.setTableName(tableName);
@@ -60,12 +71,38 @@ public class DeleteIT extends AccumuloClusterIT {
     vopts.rows = opts.rows = 1000;
     vopts.cols = opts.cols = 1;
     vopts.random = opts.random = 56;
+
+    if (null != password) {
+      assertNull("Given password, expected null keytab", keytab);
+      Password passwd = new Password(password);
+      opts.setPassword(passwd);
+      opts.setPrincipal(user);
+      vopts.setPassword(passwd);
+      vopts.setPrincipal(user);
+    } else if (null != keytab) {
+      assertNull("Given keytab, expect null password", password);
+      ClientConfiguration clientConfig = cluster.getClientConfig();
+      opts.updateKerberosCredentials(clientConfig);
+      vopts.updateKerberosCredentials(clientConfig);
+    } else {
+      fail("Expected one of password or keytab");
+    }
+
     BatchWriterOpts BWOPTS = new BatchWriterOpts();
     TestIngest.ingest(c, opts, BWOPTS);
-    assertEquals(
-        0,
-        cluster.getClusterControl().exec(TestRandomDeletes.class,
-            new String[] {"-u", "root", "-p", password, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "--table", tableName}));
+
+    String[] args = null;
+    if (null != password) {
+      assertNull("Given password, expected null keytab", keytab);
+      args = new String[] {"-u", user, "-p", password, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "--table", tableName};
+    } else if (null != keytab) {
+      assertNull("Given keytab, expect null password", password);
+      args = new String[] {"-u", user, "-i", cluster.getInstanceName(), "-z", cluster.getZooKeepers(), "--table", tableName, "--keytab", keytab};
+    } else {
+      fail("Expected one of password or keytab");
+    }
+
+    assertEquals(0, cluster.getClusterControl().exec(TestRandomDeletes.class, args));
     TestIngest.ingest(c, opts, BWOPTS);
     VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java b/test/src/test/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java
index 90e0b59..d3d7439 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java
@@ -28,6 +28,7 @@ import java.util.TreeSet;
 
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
+import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -64,15 +65,16 @@ public class DeleteRowsSplitIT extends AccumuloClusterIT {
     // Delete ranges of rows, and verify the are removed
     // Do this while adding many splits
     final String tableName = getUniqueNames(1)[0];
+    final Connector conn = getConnector();
 
     // Eliminate whole tablets
     for (int test = 0; test < 10; test++) {
       // create a table
       log.info("Test " + test);
-      getConnector().tableOperations().create(tableName);
+      conn.tableOperations().create(tableName);
 
       // put some data in it
-      fillTable(tableName);
+      fillTable(conn, tableName);
 
       // generate a random delete range
       final Text start = new Text();
@@ -87,7 +89,7 @@ public class DeleteRowsSplitIT extends AccumuloClusterIT {
           try {
             // split the table
             final SortedSet<Text> afterEnd = SPLITS.tailSet(new Text(end.toString() + "\0"));
-            getConnector().tableOperations().addSplits(tableName, afterEnd);
+            conn.tableOperations().addSplits(tableName, afterEnd);
           } catch (Exception ex) {
             log.error(ex, ex);
             synchronized (fail) {
@@ -100,7 +102,7 @@ public class DeleteRowsSplitIT extends AccumuloClusterIT {
 
       UtilWaitThread.sleep(test * 2);
 
-      getConnector().tableOperations().deleteRows(tableName, start, end);
+      conn.tableOperations().deleteRows(tableName, start, end);
 
       t.join();
       synchronized (fail) {
@@ -108,14 +110,14 @@ public class DeleteRowsSplitIT extends AccumuloClusterIT {
       }
 
       // scan the table
-      Scanner scanner = getConnector().createScanner(tableName, Authorizations.EMPTY);
+      Scanner scanner = conn.createScanner(tableName, Authorizations.EMPTY);
       for (Entry<Key,Value> entry : scanner) {
         Text row = entry.getKey().getRow();
         assertTrue(row.compareTo(start) <= 0 || row.compareTo(end) > 0);
       }
 
       // delete the table
-      getConnector().tableOperations().delete(tableName);
+      conn.tableOperations().delete(tableName);
     }
   }
 
@@ -132,8 +134,8 @@ public class DeleteRowsSplitIT extends AccumuloClusterIT {
 
   }
 
-  private void fillTable(String table) throws Exception {
-    BatchWriter bw = getConnector().createBatchWriter(table, new BatchWriterConfig());
+  private void fillTable(Connector conn, String table) throws Exception {
+    BatchWriter bw = conn.createBatchWriter(table, new BatchWriterConfig());
     for (String row : ROWS) {
       Mutation m = new Mutation(row);
       m.put("cf", "cq", "value");

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java b/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
index 47f49ba..34493b2 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/DynamicThreadPoolsIT.java
@@ -18,9 +18,11 @@ package org.apache.accumulo.test.functional;
 
 import static org.junit.Assert.fail;
 
-import java.util.Collections;
+import java.util.Map;
 
 import org.apache.accumulo.core.cli.BatchWriterOpts;
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.MasterClient;
@@ -46,7 +48,9 @@ public class DynamicThreadPoolsIT extends AccumuloClusterIT {
   @Override
   public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
     cfg.setNumTservers(1);
-    cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "100ms"));
+    Map<String,String> siteConfig = cfg.getSiteConfig();
+    siteConfig.put(Property.TSERV_MAJC_DELAY.getKey(), "100ms");
+    cfg.setSiteConfig(siteConfig);
   }
 
   @Override
@@ -82,12 +86,18 @@ public class DynamicThreadPoolsIT extends AccumuloClusterIT {
     opts.rows = 500 * 1000;
     opts.createTable = true;
     opts.setTableName(firstTable);
+    ClientConfiguration clientConf = cluster.getClientConfig();
+    if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) {
+      opts.updateKerberosCredentials(clientConf);
+    } else {
+      opts.setPrincipal(getAdminPrincipal());
+    }
     TestIngest.ingest(c, opts, new BatchWriterOpts());
     c.tableOperations().flush(firstTable, null, null, true);
     for (int i = 1; i < tables.length; i++)
       c.tableOperations().clone(firstTable, tables[i], true, null, null);
     UtilWaitThread.sleep(11 * 1000); // time between checks of the thread pool sizes
-    Credentials creds = new Credentials(getPrincipal(), getToken());
+    Credentials creds = new Credentials(getAdminPrincipal(), getAdminToken());
     for (int i = 1; i < tables.length; i++)
       c.tableOperations().compact(tables[i], null, null, true, false);
     for (int i = 0; i < 30; i++) {
@@ -95,7 +105,7 @@ public class DynamicThreadPoolsIT extends AccumuloClusterIT {
       MasterClientService.Iface client = null;
       MasterMonitorInfo stats = null;
       try {
-        client = MasterClient.getConnectionWithRetry(new ClientContext(c.getInstance(), creds, getCluster().getClientConfig()));
+        client = MasterClient.getConnectionWithRetry(new ClientContext(c.getInstance(), creds, clientConf));
         stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance()));
       } finally {
         if (client != null)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java
index 6c81369..7e562b4 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ExamplesIT.java
@@ -39,6 +39,8 @@ import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.MutationsRejectedException;
+import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
+import org.apache.accumulo.core.client.security.tokens.KerberosToken;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Key;
@@ -108,11 +110,13 @@ public class ExamplesIT extends AccumuloClusterIT {
   String keepers;
   String user;
   String passwd;
+  String keytab;
   BatchWriter bw;
   IteratorSetting is;
   String dir;
   FileSystem fs;
   Authorizations origAuths;
+  boolean saslEnabled;
 
   @Override
   public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopConf) {
@@ -123,13 +127,21 @@ public class ExamplesIT extends AccumuloClusterIT {
   @Before
   public void getClusterInfo() throws Exception {
     c = getConnector();
-    user = getPrincipal();
-    Assume.assumeTrue(getToken() instanceof PasswordToken);
-    passwd = new String(((PasswordToken) getToken()).getPassword(), UTF_8);
+    user = getAdminPrincipal();
+    AuthenticationToken token = getAdminToken();
+    if (token instanceof KerberosToken) {
+      keytab = getAdminUser().getKeytab().getAbsolutePath();
+      saslEnabled = true;
+    } else if (token instanceof PasswordToken) {
+      passwd = new String(((PasswordToken) getAdminToken()).getPassword(), UTF_8);
+      saslEnabled = false;
+    } else {
+      Assert.fail("Unknown token type: " + token);
+    }
     fs = getCluster().getFileSystem();
     instance = c.getInstance().getInstanceName();
     keepers = c.getInstance().getZooKeepers();
-    dir = getUsableDir();
+    dir = new Path(cluster.getTemporaryPath(), getClass().getName()).toString();
 
     origAuths = c.securityOperations().getUserAuthorizations(user);
     c.securityOperations().changeUserAuthorizations(user, new Authorizations(auths.split(",")));
@@ -138,7 +150,7 @@ public class ExamplesIT extends AccumuloClusterIT {
   @After
   public void resetAuths() throws Exception {
     if (null != origAuths) {
-      getConnector().securityOperations().changeUserAuthorizations(getPrincipal(), origAuths);
+      getConnector().securityOperations().changeUserAuthorizations(getAdminPrincipal(), origAuths);
     }
   }
 
@@ -156,16 +168,25 @@ public class ExamplesIT extends AccumuloClusterIT {
       while (!c.tableOperations().exists("trace"))
         UtilWaitThread.sleep(500);
     }
-    Entry<Integer,String> pair = cluster.getClusterControl().execWithStdout(TracingExample.class,
-        new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-C", "-D", "-c"});
+    String[] args;
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-C", "-D", "-c"};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-C", "-D", "-c"};
+    }
+    Entry<Integer,String> pair = cluster.getClusterControl().execWithStdout(TracingExample.class, args);
     Assert.assertEquals("Expected return code of zero. STDOUT=" + pair.getValue(), 0, pair.getKey().intValue());
     String result = pair.getValue();
     Pattern pattern = Pattern.compile("TraceID: ([0-9a-f]+)");
     Matcher matcher = pattern.matcher(result);
     int count = 0;
     while (matcher.find()) {
-      pair = cluster.getClusterControl().execWithStdout(TraceDumpExample.class,
-          new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--traceid", matcher.group(1)});
+      if (saslEnabled) {
+        args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--traceid", matcher.group(1)};
+      } else {
+        args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--traceid", matcher.group(1)};
+      }
+      pair = cluster.getClusterControl().execWithStdout(TraceDumpExample.class, args);
       count++;
     }
     assertTrue(count > 0);
@@ -177,7 +198,6 @@ public class ExamplesIT extends AccumuloClusterIT {
 
   @Test
   public void testClasspath() throws Exception {
-    // Process p = cluster.exec(Main.class, Collections.singletonList(MapReduceIT.hadoopTmpDirArg), "classpath");
     Entry<Integer,String> entry = getCluster().getClusterControl().execWithStdout(Main.class, new String[] {"classpath"});
     assertEquals(0, entry.getKey().intValue());
     String result = entry.getValue();
@@ -198,13 +218,28 @@ public class ExamplesIT extends AccumuloClusterIT {
   public void testDirList() throws Exception {
     String[] names = getUniqueNames(3);
     String dirTable = names[0], indexTable = names[1], dataTable = names[2];
-    Entry<Integer,String> entry = getClusterControl().execWithStdout(
-        Ingest.class,
-        new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--dirTable", dirTable, "--indexTable", indexTable, "--dataTable", dataTable,
-            "--vis", visibility, "--chunkSize", Integer.toString(10000), getUsableDir()});
+    Path scratch = new Path(getUsableDir(), getClass().getName());
+    cluster.getFileSystem().delete(scratch, true);
+    cluster.getFileSystem().mkdirs(scratch);
+    String[] args;
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--dirTable", dirTable, "--indexTable", indexTable, "--dataTable",
+          dataTable, "--vis", visibility, "--chunkSize", Integer.toString(10000), scratch.toString()};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--dirTable", dirTable, "--indexTable", indexTable, "--dataTable",
+          dataTable, "--vis", visibility, "--chunkSize", Integer.toString(10000), scratch.toString()};
+    }
+    Entry<Integer,String> entry = getClusterControl().execWithStdout(Ingest.class, args);
     assertEquals("Got non-zero return code. Stdout=" + entry.getValue(), 0, entry.getKey().intValue());
-    entry = getClusterControl().execWithStdout(QueryUtil.class,
-        new String[] {"-i", instance, "-z", keepers, "-p", passwd, "-u", user, "-t", indexTable, "--auths", auths, "--search", "--path", "accumulo-site.xml"});
+
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "--keytab", keytab, "-u", user, "-t", indexTable, "--auths", auths, "--search", "--path",
+          "accumulo-site.xml"};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-p", passwd, "-u", user, "-t", indexTable, "--auths", auths, "--search", "--path",
+          "accumulo-site.xml"};
+    }
+    entry = getClusterControl().execWithStdout(QueryUtil.class, args);
     if (ClusterType.MINI == getClusterType()) {
       MiniAccumuloClusterImpl impl = (MiniAccumuloClusterImpl) cluster;
       for (LogWriter writer : impl.getLogWriters()) {
@@ -275,21 +310,38 @@ public class ExamplesIT extends AccumuloClusterIT {
     String tableName = getUniqueNames(1)[0];
     c.tableOperations().create(tableName);
     c.tableOperations().setProperty(tableName, Property.TABLE_BLOOM_ENABLED.getKey(), "true");
-    goodExec(RandomBatchWriter.class, "--seed", "7", "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--num", "100000", "--min", "0", "--max",
-        "1000000000", "--size", "50", "--batchMemory", "2M", "--batchLatency", "60s", "--batchThreads", "3", "-t", tableName);
+    String[] args;
+    if (saslEnabled) {
+      args = new String[] {"--seed", "7", "-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--num", "100000", "--min", "0", "--max",
+          "1000000000", "--size", "50", "--batchMemory", "2M", "--batchLatency", "60s", "--batchThreads", "3", "-t", tableName};
+    } else {
+      args = new String[] {"--seed", "7", "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--num", "100000", "--min", "0", "--max", "1000000000",
+          "--size", "50", "--batchMemory", "2M", "--batchLatency", "60s", "--batchThreads", "3", "-t", tableName};
+    }
+    goodExec(RandomBatchWriter.class, args);
     c.tableOperations().flush(tableName, null, null, true);
     long diff = 0, diff2 = 0;
     // try the speed test a couple times in case the system is loaded with other tests
     for (int i = 0; i < 2; i++) {
       long now = System.currentTimeMillis();
-      goodExec(RandomBatchScanner.class, "--seed", "7", "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--num", "10000", "--min", "0", "--max",
-          "1000000000", "--size", "50", "--scanThreads", "4", "-t", tableName);
+      if (saslEnabled) {
+        args = new String[] {"--seed", "7", "-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--num", "10000", "--min", "0", "--max",
+            "1000000000", "--size", "50", "--scanThreads", "4", "-t", tableName};
+      } else {
+        args = new String[] {"--seed", "7", "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--num", "10000", "--min", "0", "--max", "1000000000",
+            "--size", "50", "--scanThreads", "4", "-t", tableName};
+      }
+      goodExec(RandomBatchScanner.class, args);
       diff = System.currentTimeMillis() - now;
       now = System.currentTimeMillis();
-      int retCode = getClusterControl().exec(
-          RandomBatchScanner.class,
-          new String[] {"--seed", "8", "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--num", "10000", "--min", "0", "--max", "1000000000",
-              "--size", "50", "--scanThreads", "4", "-t", tableName});
+      if (saslEnabled) {
+        args = new String[] {"--seed", "8", "-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--num", "10000", "--min", "0", "--max",
+            "1000000000", "--size", "50", "--scanThreads", "4", "-t", tableName};
+      } else {
+        args = new String[] {"--seed", "8", "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--num", "10000", "--min", "0", "--max", "1000000000",
+            "--size", "50", "--scanThreads", "4", "-t", tableName};
+      }
+      int retCode = getClusterControl().exec(RandomBatchScanner.class, args);
       assertEquals(1, retCode);
       diff2 = System.currentTimeMillis() - now;
       if (diff2 < diff)
@@ -317,11 +369,25 @@ public class ExamplesIT extends AccumuloClusterIT {
         thisFile = true;
     }
     assertTrue(thisFile);
+
+    String[] args;
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "--shardTable", shard, "--doc2Term", index, "-u", user, "--keytab", keytab};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "--shardTable", shard, "--doc2Term", index, "-u", getAdminPrincipal(), "-p", passwd};
+    }
     // create a reverse index
-    goodExec(Reverse.class, "-i", instance, "-z", keepers, "--shardTable", shard, "--doc2Term", index, "-u", getPrincipal(), "-p", passwd);
+    goodExec(Reverse.class, args);
+
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "--shardTable", shard, "--doc2Term", index, "-u", user, "--keytab", keytab, "--terms", "5",
+          "--count", "1000"};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "--shardTable", shard, "--doc2Term", index, "-u", user, "-p", passwd, "--terms", "5", "--count",
+          "1000"};
+    }
     // run some queries
-    goodExec(ContinuousQuery.class, "-i", instance, "-z", keepers, "--shardTable", shard, "--doc2Term", index, "-u", "root", "-p", passwd, "--terms", "5",
-        "--count", "1000");
+    goodExec(ContinuousQuery.class, args);
   }
 
   @Test
@@ -333,6 +399,11 @@ public class ExamplesIT extends AccumuloClusterIT {
     opts.rows = 1;
     opts.cols = 1000;
     opts.setTableName(tableName);
+    if (saslEnabled) {
+      opts.updateKerberosCredentials(cluster.getClientConfig());
+    } else {
+      opts.setPrincipal(getAdminPrincipal());
+    }
     try {
       TestIngest.ingest(c, opts, bwOpts);
     } catch (MutationsRejectedException ex) {
@@ -342,6 +413,8 @@ public class ExamplesIT extends AccumuloClusterIT {
 
   @Test
   public void testBulkIngest() throws Exception {
+    // TODO Figure out a way to run M/R with Kerberos
+    Assume.assumeTrue(getAdminToken() instanceof PasswordToken);
     String tableName = getUniqueNames(1)[0];
     FileSystem fs = getFileSystem();
     Path p = new Path(dir, "tmp");
@@ -349,32 +422,70 @@ public class ExamplesIT extends AccumuloClusterIT {
       fs.delete(p, true);
     }
     goodExec(GenerateTestData.class, "--start-row", "0", "--count", "10000", "--output", dir + "/tmp/input/data");
-    goodExec(SetupTable.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", tableName);
-    goodExec(BulkIngestExample.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", tableName, "--inputDir", dir + "/tmp/input",
-        "--workDir", dir + "/tmp");
+    String[] args;
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--table", tableName};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", tableName};
+    }
+    goodExec(SetupTable.class, args);
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--table", tableName, "--inputDir", dir + "/tmp/input", "--workDir",
+          dir + "/tmp"};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", tableName, "--inputDir", dir + "/tmp/input", "--workDir",
+          dir + "/tmp"};
+    }
+    goodExec(BulkIngestExample.class, args);
   }
 
   @Test
   public void testTeraSortAndRead() throws Exception {
+    // TODO Figure out a way to run M/R with Kerberos
+    Assume.assumeTrue(getAdminToken() instanceof PasswordToken);
     String tableName = getUniqueNames(1)[0];
-    goodExec(TeraSortIngest.class, "--count", (1000 * 1000) + "", "-nk", "10", "-xk", "10", "-nv", "10", "-xv", "10", "-t", tableName, "-i", instance, "-z",
-        keepers, "-u", user, "-p", passwd, "--splits", "4");
+    String[] args;
+    if (saslEnabled) {
+      args = new String[] {"--count", (1000 * 1000) + "", "-nk", "10", "-xk", "10", "-nv", "10", "-xv", "10", "-t", tableName, "-i", instance, "-z", keepers,
+          "-u", user, "--keytab", keytab, "--splits", "4"};
+    } else {
+      args = new String[] {"--count", (1000 * 1000) + "", "-nk", "10", "-xk", "10", "-nv", "10", "-xv", "10", "-t", tableName, "-i", instance, "-z", keepers,
+          "-u", user, "-p", passwd, "--splits", "4"};
+    }
+    goodExec(TeraSortIngest.class, args);
     Path output = new Path(dir, "tmp/nines");
     if (fs.exists(output)) {
       fs.delete(output, true);
     }
-    goodExec(RegexExample.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName, "--rowRegex", ".*999.*", "--output",
-        output.toString());
-    goodExec(RowHash.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName, "--column", "c:");
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-t", tableName, "--rowRegex", ".*999.*", "--output",
+          output.toString()};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName, "--rowRegex", ".*999.*", "--output", output.toString()};
+    }
+    goodExec(RegexExample.class, args);
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-t", tableName, "--column", "c:"};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName, "--column", "c:"};
+    }
+    goodExec(RowHash.class, args);
     output = new Path(dir, "tmp/tableFile");
     if (fs.exists(output)) {
       fs.delete(output, true);
     }
-    goodExec(TableToFile.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName, "--output", output.toString());
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-t", tableName, "--output", output.toString()};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName, "--output", output.toString()};
+    }
+    goodExec(TableToFile.class, args);
   }
 
   @Test
   public void testWordCount() throws Exception {
+    // TODO Figure out a way to run M/R with Kerberos
+    Assume.assumeTrue(getAdminToken() instanceof PasswordToken);
     String tableName = getUniqueNames(1)[0];
     c.tableOperations().create(tableName);
     is = new IteratorSetting(10, SummingCombiner.class);
@@ -382,47 +493,94 @@ public class ExamplesIT extends AccumuloClusterIT {
     SummingCombiner.setEncodingType(is, SummingCombiner.Type.STRING);
     c.tableOperations().attachIterator(tableName, is);
     fs.copyFromLocalFile(new Path(new Path(System.getProperty("user.dir")).getParent(), "README.md"), new Path(dir + "/tmp/wc/README.md"));
-    goodExec(WordCount.class, "-i", instance, "-u", user, "-p", passwd, "-z", keepers, "--input", dir + "/tmp/wc", "-t", tableName);
+    String[] args;
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-u", user, "--keytab", keytab, "-z", keepers, "--input", dir + "/tmp/wc", "-t", tableName};
+    } else {
+      args = new String[] {"-i", instance, "-u", user, "-p", passwd, "-z", keepers, "--input", dir + "/tmp/wc", "-t", tableName};
+    }
+    goodExec(WordCount.class, args);
   }
 
   @Test
   public void testInsertWithBatchWriterAndReadData() throws Exception {
     String tableName = getUniqueNames(1)[0];
-    goodExec(InsertWithBatchWriter.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName);
-    goodExec(ReadData.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName);
+    String[] args;
+    if (saslEnabled) {
+      args = new String[]{"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-t", tableName};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName};
+    }
+    goodExec(InsertWithBatchWriter.class, args);
+    goodExec(ReadData.class, args);
   }
 
   @Test
   public void testIsolatedScansWithInterference() throws Exception {
-    goodExec(InterferenceTest.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", getUniqueNames(1)[0], "--iterations", "100000",
-        "--isolated");
+    String[] args;
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-t", getUniqueNames(1)[0], "--iterations", "100000", "--isolated"};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", getUniqueNames(1)[0], "--iterations", "100000", "--isolated"};
+    }
+    goodExec(InterferenceTest.class, args);
   }
 
   @Test
   public void testScansWithInterference() throws Exception {
-    goodExec(InterferenceTest.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", getUniqueNames(1)[0], "--iterations", "100000");
+    String[] args;
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-t", getUniqueNames(1)[0], "--iterations", "100000"};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", getUniqueNames(1)[0], "--iterations", "100000"};
+    }
+    goodExec(InterferenceTest.class, args);
   }
 
   @Test
   public void testRowOperations() throws Exception {
-    goodExec(RowOperations.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd);
+    String[] args;
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd};
+    }
+    goodExec(RowOperations.class, args);
   }
 
   @Test
   public void testBatchWriter() throws Exception {
     String tableName = getUniqueNames(1)[0];
     c.tableOperations().create(tableName);
-    goodExec(SequentialBatchWriter.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName, "--start", "0", "--num", "100000",
-        "--size", "50", "--batchMemory", "10000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility);
+    String[] args;
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-t", tableName, "--start", "0", "--num", "100000", "--size", "50",
+          "--batchMemory", "10000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName, "--start", "0", "--num", "100000", "--size", "50",
+          "--batchMemory", "10000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility};
+    }
+    goodExec(SequentialBatchWriter.class, args);
 
   }
 
   @Test
   public void testReadWriteAndDelete() throws Exception {
     String tableName = getUniqueNames(1)[0];
-    goodExec(ReadWriteExample.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--auths", auths, "--table", tableName, "--createtable", "-c",
-        "--debug");
-    goodExec(ReadWriteExample.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--auths", auths, "--table", tableName, "-d", "--debug");
+    String[] args;
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--auths", auths, "--table", tableName, "--createtable", "-c",
+          "--debug"};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--auths", auths, "--table", tableName, "--createtable", "-c", "--debug"};
+    }
+    goodExec(ReadWriteExample.class, args);
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--auths", auths, "--table", tableName, "-d", "--debug"};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--auths", auths, "--table", tableName, "-d", "--debug"};
+    }
+    goodExec(ReadWriteExample.class, args);
 
   }
 
@@ -430,11 +588,31 @@ public class ExamplesIT extends AccumuloClusterIT {
   public void testRandomBatchesAndFlush() throws Exception {
     String tableName = getUniqueNames(1)[0];
     c.tableOperations().create(tableName);
-    goodExec(RandomBatchWriter.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", tableName, "--num", "100000", "--min", "0", "--max",
-        "100000", "--size", "100", "--batchMemory", "1000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility);
-    goodExec(RandomBatchScanner.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", tableName, "--num", "10000", "--min", "0", "--max",
-        "100000", "--size", "100", "--scanThreads", "4", "--auths", auths);
-    goodExec(Flush.class, "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", tableName);
+    String[] args;
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--table", tableName, "--num", "100000", "--min", "0", "--max",
+          "100000", "--size", "100", "--batchMemory", "1000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", tableName, "--num", "100000", "--min", "0", "--max", "100000",
+          "--size", "100", "--batchMemory", "1000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility};
+    }
+    goodExec(RandomBatchWriter.class, args);
+
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--table", tableName, "--num", "10000", "--min", "0", "--max",
+          "100000", "--size", "100", "--scanThreads", "4", "--auths", auths};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", tableName, "--num", "10000", "--min", "0", "--max", "100000",
+          "--size", "100", "--scanThreads", "4", "--auths", auths};
+    }
+    goodExec(RandomBatchScanner.class, args);
+
+    if (saslEnabled) {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--table", tableName};
+    } else {
+      args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", tableName};
+    }
+    goodExec(Flush.class, args);
   }
 
   private void goodExec(Class<?> theClass, String... args) throws InterruptedException, IOException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/FateStarvationIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/FateStarvationIT.java b/test/src/test/java/org/apache/accumulo/test/functional/FateStarvationIT.java
index c822375..ebbef7c 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/FateStarvationIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/FateStarvationIT.java
@@ -21,6 +21,8 @@ import java.util.List;
 import java.util.Random;
 
 import org.apache.accumulo.core.cli.BatchWriterOpts;
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.harness.AccumuloClusterIT;
 import org.apache.accumulo.test.TestIngest;
@@ -52,6 +54,12 @@ public class FateStarvationIT extends AccumuloClusterIT {
     opts.rows = 100000;
     opts.cols = 1;
     opts.setTableName(tableName);
+    ClientConfiguration clientConf = cluster.getClientConfig();
+    if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) {
+      opts.updateKerberosCredentials(clientConf);
+    } else {
+      opts.setPrincipal(getAdminPrincipal());
+    }
     TestIngest.ingest(c, opts, new BatchWriterOpts());
 
     c.tableOperations().flush(tableName, null, null, true);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java b/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
index 2efde6f..9dc8eef 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
@@ -115,6 +115,8 @@ public class GarbageCollectorIT extends ConfigurableMacIT {
     VerifyIngest.Opts vopts = new VerifyIngest.Opts();
     vopts.rows = opts.rows = 10000;
     vopts.cols = opts.cols = 1;
+    opts.setPrincipal("root");
+    vopts.setPrincipal("root");
     TestIngest.ingest(c, opts, new BatchWriterOpts());
     c.tableOperations().compact("test_ingest", null, null, true, true);
     int before = countFiles();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java b/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
index ec0f760..270a44e 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/HalfDeadTServerIT.java
@@ -163,6 +163,7 @@ public class HalfDeadTServerIT extends ConfigurableMacIT {
         assertEquals(0, ingest.waitFor());
         VerifyIngest.Opts vopts = new VerifyIngest.Opts();
         vopts.rows = rows;
+        vopts.setPrincipal("root");
         VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
       } else {
         UtilWaitThread.sleep(5 * 1000);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/KerberosIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/KerberosIT.java b/test/src/test/java/org/apache/accumulo/test/functional/KerberosIT.java
index 75b1199..536ac7b 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/KerberosIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/KerberosIT.java
@@ -33,6 +33,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.concurrent.TimeUnit;
 
+import org.apache.accumulo.cluster.ClusterUser;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchScanner;
@@ -89,6 +90,7 @@ public class KerberosIT extends AccumuloIT {
 
   private static TestingKdc kdc;
   private static String krbEnabledForITs = null;
+  private static ClusterUser rootUser;
 
   @BeforeClass
   public static void startKdc() throws Exception {
@@ -98,6 +100,7 @@ public class KerberosIT extends AccumuloIT {
     if (null == krbEnabledForITs || !Boolean.parseBoolean(krbEnabledForITs)) {
       System.setProperty(MiniClusterHarness.USE_KERBEROS_FOR_IT_OPTION, "true");
     }
+    rootUser = kdc.getRootUser();
   }
 
   @AfterClass
@@ -149,9 +152,9 @@ public class KerberosIT extends AccumuloIT {
   @Test
   public void testAdminUser() throws Exception {
     // Login as the client (provided to `accumulo init` as the "root" user)
-    UserGroupInformation.loginUserFromKeytab(kdc.getClientPrincipal(), kdc.getClientKeytab().getAbsolutePath());
+    UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath());
 
-    final Connector conn = mac.getConnector(kdc.getClientPrincipal(), new KerberosToken());
+    final Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken());
 
     // The "root" user should have all system permissions
     for (SystemPermission perm : SystemPermission.values()) {
@@ -178,17 +181,17 @@ public class KerberosIT extends AccumuloIT {
     newUser = kdc.qualifyUser(newUser);
 
     // Login as the "root" user
-    UserGroupInformation.loginUserFromKeytab(kdc.getClientPrincipal(), kdc.getClientKeytab().getAbsolutePath());
-    log.info("Logged in as {}", kdc.getClientPrincipal());
+    UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath());
+    log.info("Logged in as {}", rootUser.getPrincipal());
 
-    Connector conn = mac.getConnector(kdc.getClientPrincipal(), new KerberosToken());
-    log.info("Created connector as {}", kdc.getClientPrincipal());
-    assertEquals(kdc.getClientPrincipal(), conn.whoami());
+    Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken());
+    log.info("Created connector as {}", rootUser.getPrincipal());
+    assertEquals(rootUser.getPrincipal(), conn.whoami());
 
     // Make sure the system user doesn't exist -- this will force some RPC to happen server-side
     createTableWithDataAndCompact(conn);
 
-    HashSet<String> users = Sets.newHashSet(kdc.getClientPrincipal());
+    HashSet<String> users = Sets.newHashSet(rootUser.getPrincipal());
     assertEquals(users, conn.securityOperations().listLocalUsers());
 
     // Switch to a new user
@@ -236,8 +239,8 @@ public class KerberosIT extends AccumuloIT {
       assertFalse(conn.securityOperations().hasSystemPermission(user1, perm));
     }
 
-    UserGroupInformation.loginUserFromKeytab(kdc.getClientPrincipal(), kdc.getClientKeytab().getAbsolutePath());
-    conn = mac.getConnector(kdc.getClientPrincipal(), new KerberosToken());
+    UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath());
+    conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken());
 
     conn.securityOperations().grantSystemPermission(user1, SystemPermission.CREATE_TABLE);
 
@@ -285,8 +288,8 @@ public class KerberosIT extends AccumuloIT {
       assertFalse(conn.securityOperations().hasSystemPermission(user1, perm));
     }
 
-    UserGroupInformation.loginUserFromKeytab(kdc.getClientPrincipal(), kdc.getClientKeytab().getAbsolutePath());
-    conn = mac.getConnector(kdc.getClientPrincipal(), new KerberosToken());
+    UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath());
+    conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken());
 
     final String table = testName.getMethodName() + "_user_table";
     conn.tableOperations().create(table);
@@ -335,8 +338,8 @@ public class KerberosIT extends AccumuloIT {
     final String tableName = getUniqueNames(1)[0];
 
     // Login as the "root" user
-    UserGroupInformation root = UserGroupInformation.loginUserFromKeytabAndReturnUGI(kdc.getClientPrincipal(), kdc.getClientKeytab().getAbsolutePath());
-    log.info("Logged in as {}", kdc.getClientPrincipal());
+    UserGroupInformation root = UserGroupInformation.loginUserFromKeytabAndReturnUGI(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath());
+    log.info("Logged in as {}", rootUser.getPrincipal());
 
     final int numRows = 100, numColumns = 10;
 
@@ -344,9 +347,9 @@ public class KerberosIT extends AccumuloIT {
     final DelegationToken delegationToken = root.doAs(new PrivilegedExceptionAction<DelegationToken>() {
       @Override
       public DelegationToken run() throws Exception {
-        Connector conn = mac.getConnector(kdc.getClientPrincipal(), new KerberosToken());
-        log.info("Created connector as {}", kdc.getClientPrincipal());
-        assertEquals(kdc.getClientPrincipal(), conn.whoami());
+        Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken());
+        log.info("Created connector as {}", rootUser.getPrincipal());
+        assertEquals(rootUser.getPrincipal(), conn.whoami());
 
         conn.tableOperations().create(tableName);
         BatchWriter bw = conn.createBatchWriter(tableName, new BatchWriterConfig());
@@ -369,7 +372,7 @@ public class KerberosIT extends AccumuloIT {
     int recordsSeen = userWithoutPrivs.doAs(new PrivilegedExceptionAction<Integer>() {
       @Override
       public Integer run() throws Exception {
-        Connector conn = mac.getConnector(kdc.getClientPrincipal(), delegationToken);
+        Connector conn = mac.getConnector(rootUser.getPrincipal(), delegationToken);
 
         BatchScanner bs = conn.createBatchScanner(tableName, Authorizations.EMPTY, 2);
         bs.setRanges(Collections.singleton(new Range()));
@@ -385,13 +388,13 @@ public class KerberosIT extends AccumuloIT {
   @Test
   public void testDelegationTokenAsDifferentUser() throws Exception {
     // Login as the "root" user
-    UserGroupInformation.loginUserFromKeytab(kdc.getClientPrincipal(), kdc.getClientKeytab().getAbsolutePath());
-    log.info("Logged in as {}", kdc.getClientPrincipal());
+    UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath());
+    log.info("Logged in as {}", rootUser.getPrincipal());
 
     // As the "root" user, open up the connection and get a delegation token
-    Connector conn = mac.getConnector(kdc.getClientPrincipal(), new KerberosToken());
-    log.info("Created connector as {}", kdc.getClientPrincipal());
-    assertEquals(kdc.getClientPrincipal(), conn.whoami());
+    Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken());
+    log.info("Created connector as {}", rootUser.getPrincipal());
+    assertEquals(rootUser.getPrincipal(), conn.whoami());
     final DelegationToken delegationToken = conn.securityOperations().getDelegationToken(new DelegationTokenConfig());
 
     // The above login with keytab doesn't have a way to logout, so make a fake user that won't have krb credentials
@@ -441,20 +444,20 @@ public class KerberosIT extends AccumuloIT {
   @Test
   public void testRestartedMasterReusesSecretKey() throws Exception {
     // Login as the "root" user
-    UserGroupInformation root = UserGroupInformation.loginUserFromKeytabAndReturnUGI(kdc.getClientPrincipal(), kdc.getClientKeytab().getAbsolutePath());
-    log.info("Logged in as {}", kdc.getClientPrincipal());
+    UserGroupInformation root = UserGroupInformation.loginUserFromKeytabAndReturnUGI(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath());
+    log.info("Logged in as {}", rootUser.getPrincipal());
 
     // As the "root" user, open up the connection and get a delegation token
     final DelegationToken delegationToken1 = root.doAs(new PrivilegedExceptionAction<DelegationToken>() {
       @Override
       public DelegationToken run() throws Exception {
-        Connector conn = mac.getConnector(kdc.getClientPrincipal(), new KerberosToken());
-        log.info("Created connector as {}", kdc.getClientPrincipal());
-        assertEquals(kdc.getClientPrincipal(), conn.whoami());
+        Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken());
+        log.info("Created connector as {}", rootUser.getPrincipal());
+        assertEquals(rootUser.getPrincipal(), conn.whoami());
 
         DelegationToken token = conn.securityOperations().getDelegationToken(new DelegationTokenConfig());
 
-        assertTrue("Could not get tables with delegation token", mac.getConnector(kdc.getClientPrincipal(), token).tableOperations().list().size() > 0);
+        assertTrue("Could not get tables with delegation token", mac.getConnector(rootUser.getPrincipal(), token).tableOperations().list().size() > 0);
 
         return token;
       }
@@ -470,7 +473,7 @@ public class KerberosIT extends AccumuloIT {
     root.doAs(new PrivilegedExceptionAction<Void>() {
       @Override
       public Void run() throws Exception {
-        Connector conn = mac.getConnector(kdc.getClientPrincipal(), delegationToken1);
+        Connector conn = mac.getConnector(rootUser.getPrincipal(), delegationToken1);
 
         assertTrue("Could not get tables with delegation token", conn.tableOperations().list().size() > 0);
 
@@ -482,13 +485,13 @@ public class KerberosIT extends AccumuloIT {
     final DelegationToken delegationToken2 = root.doAs(new PrivilegedExceptionAction<DelegationToken>() {
       @Override
       public DelegationToken run() throws Exception {
-        Connector conn = mac.getConnector(kdc.getClientPrincipal(), new KerberosToken());
-        log.info("Created connector as {}", kdc.getClientPrincipal());
-        assertEquals(kdc.getClientPrincipal(), conn.whoami());
+        Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken());
+        log.info("Created connector as {}", rootUser.getPrincipal());
+        assertEquals(rootUser.getPrincipal(), conn.whoami());
 
         DelegationToken token = conn.securityOperations().getDelegationToken(new DelegationTokenConfig());
 
-        assertTrue("Could not get tables with delegation token", mac.getConnector(kdc.getClientPrincipal(), token).tableOperations().list().size() > 0);
+        assertTrue("Could not get tables with delegation token", mac.getConnector(rootUser.getPrincipal(), token).tableOperations().list().size() > 0);
 
         return token;
       }
@@ -501,17 +504,17 @@ public class KerberosIT extends AccumuloIT {
   @Test(expected = AccumuloException.class)
   public void testDelegationTokenWithInvalidLifetime() throws Throwable {
     // Login as the "root" user
-    UserGroupInformation root = UserGroupInformation.loginUserFromKeytabAndReturnUGI(kdc.getClientPrincipal(), kdc.getClientKeytab().getAbsolutePath());
-    log.info("Logged in as {}", kdc.getClientPrincipal());
+    UserGroupInformation root = UserGroupInformation.loginUserFromKeytabAndReturnUGI(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath());
+    log.info("Logged in as {}", rootUser.getPrincipal());
 
     // As the "root" user, open up the connection and get a delegation token
     try {
       root.doAs(new PrivilegedExceptionAction<DelegationToken>() {
         @Override
         public DelegationToken run() throws Exception {
-          Connector conn = mac.getConnector(kdc.getClientPrincipal(), new KerberosToken());
-          log.info("Created connector as {}", kdc.getClientPrincipal());
-          assertEquals(kdc.getClientPrincipal(), conn.whoami());
+          Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken());
+          log.info("Created connector as {}", rootUser.getPrincipal());
+          assertEquals(rootUser.getPrincipal(), conn.whoami());
 
           // Should fail
           return conn.securityOperations().getDelegationToken(new DelegationTokenConfig().setTokenLifetime(Long.MAX_VALUE, TimeUnit.MILLISECONDS));
@@ -530,16 +533,16 @@ public class KerberosIT extends AccumuloIT {
   @Test
   public void testDelegationTokenWithReducedLifetime() throws Throwable {
     // Login as the "root" user
-    UserGroupInformation root = UserGroupInformation.loginUserFromKeytabAndReturnUGI(kdc.getClientPrincipal(), kdc.getClientKeytab().getAbsolutePath());
-    log.info("Logged in as {}", kdc.getClientPrincipal());
+    UserGroupInformation root = UserGroupInformation.loginUserFromKeytabAndReturnUGI(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath());
+    log.info("Logged in as {}", rootUser.getPrincipal());
 
     // As the "root" user, open up the connection and get a delegation token
     final DelegationToken dt = root.doAs(new PrivilegedExceptionAction<DelegationToken>() {
       @Override
       public DelegationToken run() throws Exception {
-        Connector conn = mac.getConnector(kdc.getClientPrincipal(), new KerberosToken());
-        log.info("Created connector as {}", kdc.getClientPrincipal());
-        assertEquals(kdc.getClientPrincipal(), conn.whoami());
+        Connector conn = mac.getConnector(rootUser.getPrincipal(), new KerberosToken());
+        log.info("Created connector as {}", rootUser.getPrincipal());
+        assertEquals(rootUser.getPrincipal(), conn.whoami());
 
         return conn.securityOperations().getDelegationToken(new DelegationTokenConfig().setTokenLifetime(5, TimeUnit.MINUTES));
       }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/KerberosProxyIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/KerberosProxyIT.java b/test/src/test/java/org/apache/accumulo/test/functional/KerberosProxyIT.java
index 4c8c6de..086c4c1 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/KerberosProxyIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/KerberosProxyIT.java
@@ -31,6 +31,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.accumulo.cluster.ClusterUser;
 import org.apache.accumulo.core.client.security.tokens.KerberosToken;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.Property;
@@ -137,7 +138,7 @@ public class KerberosProxyIT extends AccumuloIT {
         cfg.setNumTservers(1);
         Map<String,String> siteCfg = cfg.getSiteConfig();
         // Allow the proxy to impersonate the client user, but no one else
-        siteCfg.put(Property.INSTANCE_RPC_SASL_PROXYUSERS.getKey() + proxyPrincipal + ".users", kdc.getClientPrincipal());
+        siteCfg.put(Property.INSTANCE_RPC_SASL_PROXYUSERS.getKey() + proxyPrincipal + ".users", kdc.getRootUser().getPrincipal());
         siteCfg.put(Property.INSTANCE_RPC_SASL_PROXYUSERS.getKey() + proxyPrincipal + ".hosts", "*");
         cfg.setSiteConfig(siteCfg);
       }
@@ -176,7 +177,8 @@ public class KerberosProxyIT extends AccumuloIT {
     UserGroupInformation.setConfiguration(conf);
 
     boolean success = false;
-    UserGroupInformation.loginUserFromKeytab(kdc.getClientPrincipal(), kdc.getClientKeytab().getAbsolutePath());
+    ClusterUser rootUser = kdc.getRootUser();
+    UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath());
     UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
     for (int i = 0; i < 10 && !success; i++) {
       TSocket socket = new TSocket(hostname, proxyPort);
@@ -223,7 +225,8 @@ public class KerberosProxyIT extends AccumuloIT {
 
   @Test
   public void testProxyClient() throws Exception {
-    UserGroupInformation.loginUserFromKeytab(kdc.getClientPrincipal(), kdc.getClientKeytab().getAbsolutePath());
+    ClusterUser rootUser = kdc.getRootUser();
+    UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath());
     UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
 
     TSocket socket = new TSocket(hostname, proxyPort);
@@ -240,7 +243,7 @@ public class KerberosProxyIT extends AccumuloIT {
     Client client = factory.getClient(new TCompactProtocol(ugiTransport), new TCompactProtocol(ugiTransport));
 
     // Will fail if the proxy can impersonate the client
-    ByteBuffer login = client.login(kdc.getClientPrincipal(), Collections.<String,String> emptyMap());
+    ByteBuffer login = client.login(rootUser.getPrincipal(), Collections.<String,String> emptyMap());
 
     // For all of the below actions, the proxy user doesn't have permission to do any of them, but the client user does.
     // The fact that any of them actually run tells us that impersonation is working.
@@ -346,6 +349,7 @@ public class KerberosProxyIT extends AccumuloIT {
 
   @Test
   public void testMismatchPrincipals() throws Exception {
+    ClusterUser rootUser = kdc.getRootUser();
     // Should get an AccumuloSecurityException and the given message
     thrown.expect(AccumuloSecurityException.class);
     thrown.expect(new ThriftExceptionMatchesPattern(ProxyServer.RPC_ACCUMULO_PRINCIPAL_MISMATCH_MSG));
@@ -379,7 +383,7 @@ public class KerberosProxyIT extends AccumuloIT {
     // The proxy needs to recognize that the requested principal isn't the same as the SASL principal and fail
     // Accumulo should let this through -- we need to rely on the proxy to dump me before talking to accumulo
     try {
-      client.login(kdc.getClientPrincipal(), Collections.<String,String> emptyMap());
+      client.login(rootUser.getPrincipal(), Collections.<String,String> emptyMap());
     } finally {
       if (null != ugiTransport) {
         ugiTransport.close();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/LargeRowIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/LargeRowIT.java b/test/src/test/java/org/apache/accumulo/test/functional/LargeRowIT.java
index dfa6922..3bb7d75 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/LargeRowIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/LargeRowIT.java
@@ -18,7 +18,7 @@ package org.apache.accumulo.test.functional;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 
-import java.util.Collections;
+import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Random;
 import java.util.TreeSet;
@@ -53,7 +53,9 @@ public class LargeRowIT extends AccumuloClusterIT {
   @Override
   public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
     cfg.setMemory(ServerType.TABLET_SERVER, cfg.getMemory(ServerType.TABLET_SERVER) * 2, MemoryUnit.BYTE);
-    cfg.setSiteConfig(Collections.singletonMap(Property.TSERV_MAJC_DELAY.getKey(), "10ms"));
+    Map<String,String> siteConfig = cfg.getSiteConfig();
+    siteConfig.put(Property.TSERV_MAJC_DELAY.getKey(), "10ms");
+    cfg.setSiteConfig(siteConfig);
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java b/test/src/test/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java
index ab6fdbd..92c621c 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/MasterAssignmentIT.java
@@ -90,7 +90,7 @@ public class MasterAssignmentIT extends AccumuloClusterIT {
   }
 
   private TabletLocationState getTabletLocationState(Connector c, String tableId) throws FileNotFoundException, ConfigurationException {
-    Credentials creds = new Credentials(getPrincipal(), getToken());
+    Credentials creds = new Credentials(getAdminPrincipal(), getAdminToken());
     ClientContext context = new ClientContext(c.getInstance(), creds, getCluster().getClientConfig());
     MetaDataTableScanner s = new MetaDataTableScanner(context, new Range(KeyExtent.getMetadataEntry(new Text(tableId), null)));
     TabletLocationState tlState = s.next();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/MasterFailoverIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/MasterFailoverIT.java b/test/src/test/java/org/apache/accumulo/test/functional/MasterFailoverIT.java
index 2b44ccb..dd83574 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/MasterFailoverIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/MasterFailoverIT.java
@@ -16,11 +16,13 @@
  */
 package org.apache.accumulo.test.functional;
 
-import java.util.Collections;
+import java.util.Map;
 
 import org.apache.accumulo.cluster.ClusterControl;
 import org.apache.accumulo.core.cli.BatchWriterOpts;
 import org.apache.accumulo.core.cli.ScannerOpts;
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.harness.AccumuloClusterIT;
@@ -35,7 +37,9 @@ public class MasterFailoverIT extends AccumuloClusterIT {
 
   @Override
   public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
-    cfg.setSiteConfig(Collections.singletonMap(Property.INSTANCE_ZK_TIMEOUT.getKey(), "5s"));
+    Map<String,String> siteConfig = cfg.getSiteConfig();
+    siteConfig.put(Property.INSTANCE_ZK_TIMEOUT.getKey(), "5s");
+    cfg.setSiteConfig(siteConfig);
   }
 
   @Override
@@ -50,6 +54,12 @@ public class MasterFailoverIT extends AccumuloClusterIT {
     c.tableOperations().create(names[0]);
     TestIngest.Opts opts = new TestIngest.Opts();
     opts.setTableName(names[0]);
+    ClientConfiguration clientConf = cluster.getClientConfig();
+    if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) {
+      opts.updateKerberosCredentials(clientConf);
+    } else {
+      opts.setPrincipal(getAdminPrincipal());
+    }
     TestIngest.ingest(c, opts, new BatchWriterOpts());
 
     ClusterControl control = cluster.getClusterControl();
@@ -60,6 +70,11 @@ public class MasterFailoverIT extends AccumuloClusterIT {
     c.tableOperations().rename(names[0], names[1]);
     VerifyIngest.Opts vopts = new VerifyIngest.Opts();
     vopts.setTableName(names[1]);
+    if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) {
+      vopts.updateKerberosCredentials(clientConf);
+    } else {
+      vopts.setPrincipal(getAdminPrincipal());
+    }
     VerifyIngest.verifyIngest(c, vopts, new ScannerOpts());
   }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/1c5bef32/test/src/test/java/org/apache/accumulo/test/functional/MaxOpenIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/MaxOpenIT.java b/test/src/test/java/org/apache/accumulo/test/functional/MaxOpenIT.java
index 27c4010..2b05947 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/MaxOpenIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/MaxOpenIT.java
@@ -17,7 +17,6 @@
 package org.apache.accumulo.test.functional;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -25,6 +24,8 @@ import java.util.Random;
 
 import org.apache.accumulo.core.cli.BatchWriterOpts;
 import org.apache.accumulo.core.client.BatchScanner;
+import org.apache.accumulo.core.client.ClientConfiguration;
+import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.admin.InstanceOperations;
 import org.apache.accumulo.core.conf.Property;
@@ -48,7 +49,7 @@ public class MaxOpenIT extends AccumuloClusterIT {
 
   @Override
   public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
-    Map<String,String> conf = new HashMap<String,String>();
+    Map<String,String> conf = cfg.getSiteConfig();
     conf.put(Property.TSERV_SCAN_MAX_OPENFILES.getKey(), "4");
     conf.put(Property.TSERV_MAJC_MAXCONCURRENT.getKey(), "1");
     conf.put(Property.TSERV_MAJC_THREAD_MAXOPEN.getKey(), "2");
@@ -92,6 +93,7 @@ public class MaxOpenIT extends AccumuloClusterIT {
   public void run() throws Exception {
     final Connector c = getConnector();
     final String tableName = getUniqueNames(1)[0];
+    final ClientConfiguration clientConf = cluster.getClientConfig();
     c.tableOperations().create(tableName);
     c.tableOperations().setProperty(tableName, Property.TABLE_MAJC_RATIO.getKey(), "10");
     c.tableOperations().addSplits(tableName, TestIngest.getSplitPoints(0, NUM_TO_INGEST, NUM_TABLETS));
@@ -105,6 +107,11 @@ public class MaxOpenIT extends AccumuloClusterIT {
       opts.cols = 1;
       opts.random = i;
       opts.setTableName(tableName);
+      if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) {
+        opts.updateKerberosCredentials(clientConf);
+      } else {
+        opts.setPrincipal(getAdminPrincipal());
+      }
       TestIngest.ingest(c, opts, new BatchWriterOpts());
 
       c.tableOperations().flush(tableName, null, null, true);


Mime
View raw message