accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [01/10] accumulo git commit: ACCUMULO-3199 Internal refactor to add ClientContext
Date Tue, 25 Nov 2014 22:36:45 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master bfcb0edb6 -> 42c25faa7


http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java b/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java
index 26ec264..2a85825 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java
@@ -26,7 +26,10 @@ import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.DefaultConfiguration;
 import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.accumulo.server.conf.NamespaceConfiguration;
+import org.apache.accumulo.server.conf.ServerConfiguration;
 import org.apache.accumulo.server.conf.ServerConfigurationFactory;
+import org.apache.accumulo.server.conf.TableConfiguration;
 import org.apache.hadoop.io.Text;
 import org.junit.Test;
 
@@ -42,12 +45,33 @@ public class LargestFirstMemoryManagerTest {
   @Test
   public void test() throws Exception {
     LargestFirstMemoryManagerUnderTest mgr = new LargestFirstMemoryManagerUnderTest();
-    Instance instance = new MockInstance();
-    ServerConfigurationFactory config = new ServerConfigurationFactory(instance) {
+    ServerConfiguration config = new ServerConfiguration() {
+      ServerConfigurationFactory delegate = new ServerConfigurationFactory(new MockInstance());
+
       @Override
       public AccumuloConfiguration getConfiguration() {
         return DefaultConfiguration.getInstance();
       }
+
+      @Override
+      public TableConfiguration getTableConfiguration(String tableId) {
+        return delegate.getTableConfiguration(tableId);
+      }
+
+      @Override
+      public TableConfiguration getTableConfiguration(KeyExtent extent) {
+        return delegate.getTableConfiguration(extent);
+      }
+
+      @Override
+      public NamespaceConfiguration getNamespaceConfiguration(String namespaceId) {
+        return delegate.getNamespaceConfiguration(namespaceId);
+      }
+
+      @Override
+      public Instance getInstance() {
+        return delegate.getInstance();
+      }
     };
     mgr.init(config);
     MemoryManagementActions result;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/BatchWriterReplicationReplayerTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/BatchWriterReplicationReplayerTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/BatchWriterReplicationReplayerTest.java
index fee5dcd..aba0b1c 100644
--- a/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/BatchWriterReplicationReplayerTest.java
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/replication/BatchWriterReplicationReplayerTest.java
@@ -26,9 +26,12 @@ import java.io.ByteArrayOutputStream;
 import java.io.DataOutputStream;
 import java.nio.ByteBuffer;
 
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
 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.impl.ClientContext;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Mutation;
@@ -37,6 +40,8 @@ import org.apache.accumulo.core.replication.thrift.WalEdits;
 import org.apache.accumulo.server.data.ServerMutation;
 import org.apache.accumulo.tserver.logger.LogEvents;
 import org.apache.accumulo.tserver.logger.LogFileKey;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
 import com.google.common.collect.Lists;
@@ -46,6 +51,27 @@ import com.google.common.collect.Lists;
  */
 public class BatchWriterReplicationReplayerTest {
 
+  private ClientContext context;
+  private Connector conn;
+  private AccumuloConfiguration conf;
+  private BatchWriter bw;
+
+  @Before
+  public void setUpContext() throws AccumuloException, AccumuloSecurityException {
+    conn = createMock(Connector.class);
+    conf = createMock(AccumuloConfiguration.class);
+    bw = createMock(BatchWriter.class);
+    context = createMock(ClientContext.class);
+    expect(context.getConfiguration()).andReturn(conf).anyTimes();
+    expect(context.getConnector()).andReturn(conn).anyTimes();
+    replay(context);
+  }
+
+  @After
+  public void verifyMock() {
+    verify(context, conn, conf, bw);
+  }
+
   @Test
   public void systemTimestampsAreSetOnUpdates() throws Exception {
     final BatchWriterReplicationReplayer replayer = new BatchWriterReplicationReplayer();
@@ -54,9 +80,6 @@ public class BatchWriterReplicationReplayerTest {
     final BatchWriterConfig bwCfg = new BatchWriterConfig();
     bwCfg.setMaxMemory(1l);
 
-    Connector conn = createMock(Connector.class);
-    AccumuloConfiguration conf = createMock(AccumuloConfiguration.class);
-    BatchWriter bw = createMock(BatchWriter.class);
 
     LogFileKey key = new LogFileKey();
     key.event = LogEvents.MANY_MUTATIONS;
@@ -111,9 +134,7 @@ public class BatchWriterReplicationReplayerTest {
 
     replay(conn, conf, bw);
     
-    replayer.replicateLog(conn, conf, tableName, edits);
-
-    verify(conn, conf, bw);
+    replayer.replicateLog(context, tableName, edits);
   }
 
   @Test
@@ -125,10 +146,6 @@ public class BatchWriterReplicationReplayerTest {
     final BatchWriterConfig bwCfg = new BatchWriterConfig();
     bwCfg.setMaxMemory(1l);
 
-    Connector conn = createMock(Connector.class);
-    AccumuloConfiguration conf = createMock(AccumuloConfiguration.class);
-    BatchWriter bw = createMock(BatchWriter.class);
-
     LogFileKey key = new LogFileKey();
     key.event = LogEvents.MANY_MUTATIONS;
     key.seq = 1;
@@ -188,8 +205,6 @@ public class BatchWriterReplicationReplayerTest {
 
     replay(conn, conf, bw);
 
-    replayer.replicateLog(conn, conf, tableName, edits);
-
-    verify(conn, conf, bw);
+    replayer.replicateLog(context, tableName, edits);
   }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/shell/src/main/java/org/apache/accumulo/shell/Shell.java
----------------------------------------------------------------------
diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
index 996b2af..8927ee0 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@ -16,8 +16,8 @@
  */
 package org.apache.accumulo.shell;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
 import static java.nio.charset.StandardCharsets.ISO_8859_1;
+import static java.nio.charset.StandardCharsets.UTF_8;
 
 import java.io.BufferedWriter;
 import java.io.File;
@@ -57,13 +57,12 @@ import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.NamespaceNotFoundException;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.ZooKeeperInstance;
-import org.apache.accumulo.core.client.impl.ClientConfigurationHelper;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.conf.DefaultConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.conf.SiteConfiguration;
 import org.apache.accumulo.core.data.Key;
@@ -78,8 +77,6 @@ import org.apache.accumulo.core.util.format.Formatter;
 import org.apache.accumulo.core.util.format.FormatterFactory;
 import org.apache.accumulo.core.volume.VolumeConfiguration;
 import org.apache.accumulo.core.zookeeper.ZooUtil;
-import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
-import org.apache.accumulo.start.classloader.vfs.ContextManager;
 import org.apache.accumulo.shell.commands.AboutCommand;
 import org.apache.accumulo.shell.commands.AddAuthsCommand;
 import org.apache.accumulo.shell.commands.AddSplitsCommand;
@@ -166,6 +163,8 @@ import org.apache.accumulo.shell.commands.UserCommand;
 import org.apache.accumulo.shell.commands.UserPermissionsCommand;
 import org.apache.accumulo.shell.commands.UsersCommand;
 import org.apache.accumulo.shell.commands.WhoAmICommand;
+import org.apache.accumulo.start.classloader.vfs.AccumuloVFSClassLoader;
+import org.apache.accumulo.start.classloader.vfs.ContextManager;
 import org.apache.commons.cli.BasicParser;
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.HelpFormatter;
@@ -399,7 +398,7 @@ public class Shell extends ShellOptions {
 
   /**
    * Sets the instance used by the shell based on the given options.
-   * 
+   *
    * @param options
    *          shell options
    */
@@ -438,7 +437,7 @@ public class Shell extends ShellOptions {
       instanceName = clientConfig.get(ClientProperty.INSTANCE_NAME);
     }
     if (instanceName == null || keepers == null) {
-      AccumuloConfiguration conf = SiteConfiguration.getInstance(ClientConfigurationHelper.convertClientConfig(DefaultConfiguration.getInstance(), clientConfig));
+      AccumuloConfiguration conf = SiteConfiguration.getInstance(ClientContext.convertClientConfig(clientConfig));
       if (instanceName == null) {
         Path instanceDir = new Path(VolumeConfiguration.getVolumeUris(conf)[0], "instance_id");
         instanceId = UUID.fromString(ZooUtil.getInstanceIDFromHdfs(instanceDir, conf));
@@ -1169,7 +1168,7 @@ public class Shell extends ShellOptions {
 
   /**
    * Return the formatter for the current table.
-   * 
+   *
    * @return the formatter class for the current table
    */
   public Class<? extends Formatter> getFormatter() {
@@ -1178,7 +1177,7 @@ public class Shell extends ShellOptions {
 
   /**
    * Return the formatter for the given table.
-   * 
+   *
    * @param tableName
    *          the table name
    * @return the formatter class for the given table

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/main/java/org/apache/accumulo/test/GetMasterStats.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/GetMasterStats.java b/test/src/main/java/org/apache/accumulo/test/GetMasterStats.java
index 00f8f74..5f9ea51 100644
--- a/test/src/main/java/org/apache/accumulo/test/GetMasterStats.java
+++ b/test/src/main/java/org/apache/accumulo/test/GetMasterStats.java
@@ -20,7 +20,6 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Map.Entry;
 
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.impl.MasterClient;
 import org.apache.accumulo.core.master.thrift.DeadServer;
 import org.apache.accumulo.core.master.thrift.MasterClientService;
@@ -29,8 +28,9 @@ import org.apache.accumulo.core.master.thrift.RecoveryStatus;
 import org.apache.accumulo.core.master.thrift.TableInfo;
 import org.apache.accumulo.core.master.thrift.TabletServerStatus;
 import org.apache.accumulo.core.trace.Tracer;
+import org.apache.accumulo.server.AccumuloServerContext;
 import org.apache.accumulo.server.client.HdfsZooInstance;
-import org.apache.accumulo.server.security.SystemCredentials;
+import org.apache.accumulo.server.conf.ServerConfigurationFactory;
 import org.apache.accumulo.server.util.TableInfoUtil;
 
 public class GetMasterStats {
@@ -38,9 +38,9 @@ public class GetMasterStats {
     MasterClientService.Iface client = null;
     MasterMonitorInfo stats = null;
     try {
-      Instance instance = HdfsZooInstance.getInstance();
-      client = MasterClient.getConnectionWithRetry(instance);
-      stats = client.getMasterStats(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance));
+      AccumuloServerContext context = new AccumuloServerContext(new ServerConfigurationFactory(HdfsZooInstance.getInstance()));
+      client = MasterClient.getConnectionWithRetry(context);
+      stats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds());
     } finally {
       if (client != null)
         MasterClient.close(client);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java b/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java
index 9089b60..3cf4098 100644
--- a/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/WrongTabletTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.accumulo.test;
 
+import org.apache.accumulo.core.client.Instance;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.security.Credentials;
@@ -23,6 +25,7 @@ import org.apache.accumulo.core.tabletserver.thrift.TDurability;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
 import org.apache.accumulo.core.trace.Tracer;
 import org.apache.accumulo.core.util.ThriftUtil;
+import org.apache.accumulo.server.AccumuloServerContext;
 import org.apache.accumulo.server.cli.ClientOpts;
 import org.apache.accumulo.server.conf.ServerConfigurationFactory;
 import org.apache.hadoop.io.Text;
@@ -37,16 +40,23 @@ public class WrongTabletTest {
   }
 
   public static void main(String[] args) {
-    Opts opts = new Opts();
+    final Opts opts = new Opts();
     opts.parseArgs(WrongTabletTest.class.getName(), args);
 
-    ServerConfigurationFactory conf = new ServerConfigurationFactory(opts.getInstance());
+    Instance inst = opts.getInstance();
+    ServerConfigurationFactory conf = new ServerConfigurationFactory(inst);
+    ClientContext context = new AccumuloServerContext(conf) {
+      @Override
+      public synchronized Credentials getCredentials() {
+        return new Credentials(opts.principal, opts.getToken());
+      }
+    };
     try {
-      TabletClientService.Iface client = ThriftUtil.getTServerClient(opts.location, conf.getConfiguration());
+      TabletClientService.Iface client = ThriftUtil.getTServerClient(opts.location, context);
 
       Mutation mutation = new Mutation(new Text("row_0003750001"));
       mutation.putDelete(new Text("colf"), new Text("colq"));
-      client.update(Tracer.traceInfo(), new Credentials(opts.principal, opts.getToken()).toThrift(opts.getInstance()), new KeyExtent(new Text("!!"), null,
+      client.update(Tracer.traceInfo(), context.rpcCreds(), new KeyExtent(new Text("!!"), null,
           new Text("row_0003750000")).toThrift(), mutation.toThrift(), TDurability.DEFAULT);
     } catch (Exception e) {
       throw new RuntimeException(e);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java
index 6ead9a6..1e3b636 100644
--- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java
+++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousStatsCollector.java
@@ -26,6 +26,7 @@ import org.apache.accumulo.core.cli.ScannerOpts;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.MasterClient;
 import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.data.Key;
@@ -38,14 +39,15 @@ import org.apache.accumulo.core.master.thrift.TableInfo;
 import org.apache.accumulo.core.master.thrift.TabletServerStatus;
 import org.apache.accumulo.core.metadata.MetadataTable;
 import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.DataFileColumnFamily;
+import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.trace.Tracer;
 import org.apache.accumulo.core.util.CachedConfiguration;
 import org.apache.accumulo.core.util.Stat;
 import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.cli.ClientOnRequiredTable;
+import org.apache.accumulo.server.conf.ServerConfigurationFactory;
 import org.apache.accumulo.server.fs.VolumeManager;
 import org.apache.accumulo.server.fs.VolumeManagerImpl;
-import org.apache.accumulo.server.security.SystemCredentials;
 import org.apache.accumulo.server.util.TableInfoUtil;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.ContentSummary;
@@ -135,8 +137,10 @@ public class ContinuousStatsCollector {
       
       MasterClientService.Iface client = null;
       try {
-        client = MasterClient.getConnectionWithRetry(opts.getInstance());
-        MasterMonitorInfo stats = client.getMasterStats(Tracer.traceInfo(), SystemCredentials.get().toThrift(opts.getInstance()));
+        ClientContext context = new ClientContext(opts.getInstance(), new Credentials(opts.principal, opts.getToken()), new ServerConfigurationFactory(
+            opts.getInstance()).getConfiguration());
+        client = MasterClient.getConnectionWithRetry(context);
+        MasterMonitorInfo stats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds());
         
         TableInfo all = new TableInfo();
         Map<String,TableInfo> tableSummaries = new HashMap<String,TableInfo>();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/main/java/org/apache/accumulo/test/functional/ZombieTServer.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ZombieTServer.java b/test/src/main/java/org/apache/accumulo/test/functional/ZombieTServer.java
index 592e177..ef18efd 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ZombieTServer.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ZombieTServer.java
@@ -22,7 +22,6 @@ import java.util.HashMap;
 import java.util.Random;
 
 import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException;
 import org.apache.accumulo.core.master.thrift.TableInfo;
 import org.apache.accumulo.core.master.thrift.TabletServerStatus;
@@ -38,7 +37,9 @@ import org.apache.accumulo.core.zookeeper.ZooUtil;
 import org.apache.accumulo.fate.zookeeper.ZooLock.LockLossReason;
 import org.apache.accumulo.fate.zookeeper.ZooLock.LockWatcher;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
+import org.apache.accumulo.server.AccumuloServerContext;
 import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.conf.ServerConfigurationFactory;
 import org.apache.accumulo.server.util.TServerUtils;
 import org.apache.accumulo.server.util.TServerUtils.ServerAddress;
 import org.apache.accumulo.server.zookeeper.TransactionWatcher;
@@ -60,8 +61,8 @@ public class ZombieTServer {
     
     boolean halted = false;
 
-    ThriftClientHandler(Instance instance, TransactionWatcher watcher) {
-      super(instance, watcher);
+    ThriftClientHandler(AccumuloServerContext context, TransactionWatcher watcher) {
+      super(context, watcher);
     }
     
     @Override
@@ -90,21 +91,22 @@ public class ZombieTServer {
     }
     
   }
+
   private static final Logger log = Logger.getLogger(ZombieTServer.class);
   
   public static void main(String[] args) throws Exception {
     Random random = new Random(System.currentTimeMillis() % 1000);
     int port = random.nextInt(30000) + 2000;
-    Instance instance = HdfsZooInstance.getInstance();
+    AccumuloServerContext context = new AccumuloServerContext(new ServerConfigurationFactory(HdfsZooInstance.getInstance()));
     
     TransactionWatcher watcher = new TransactionWatcher();
-    final ThriftClientHandler tch = new ThriftClientHandler(instance, watcher);
+    final ThriftClientHandler tch = new ThriftClientHandler(context, watcher);
     Processor<Iface> processor = new Processor<Iface>(tch);
     ServerAddress serverPort = TServerUtils.startTServer(HostAndPort.fromParts("0.0.0.0", port), processor, "ZombieTServer", "walking dead", 2, 1, 1000,
         10 * 1024 * 1024, null, -1);
     
     String addressString = serverPort.address.toString();
-    String zPath = ZooUtil.getRoot(instance) + Constants.ZTSERVERS + "/" + addressString;
+    String zPath = ZooUtil.getRoot(context.getInstance()) + Constants.ZTSERVERS + "/" + addressString;
     ZooReaderWriter zoo = ZooReaderWriter.getInstance();
     zoo.putPersistentData(zPath, new byte[] {}, NodeExistsPolicy.SKIP);
     

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
index 96eb214..a8b219c 100644
--- a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
+++ b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java
@@ -26,11 +26,13 @@ import java.util.Random;
 import java.util.TreeSet;
 import java.util.UUID;
 
+import org.apache.accumulo.core.cli.ClientOpts;
 import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.ClientConfiguration;
 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.ZooKeeperInstance;
 import org.apache.accumulo.core.data.Key;
@@ -44,11 +46,10 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema.TabletsSection.Da
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.util.Stat;
 import org.apache.accumulo.server.master.state.TServerInstance;
-import org.apache.accumulo.server.security.SystemCredentials;
 import org.apache.hadoop.io.Text;
+import org.apache.log4j.Logger;
 
 import com.google.common.net.HostAndPort;
-import org.apache.log4j.Logger;
 
 /**
  * This little program can be used to write a lot of metadata entries and measure the performance of varying numbers of threads doing metadata
@@ -63,8 +64,10 @@ public class MetadataBatchScanTest {
   
   public static void main(String[] args) throws Exception {
     
-    final Connector connector = new ZooKeeperInstance(new ClientConfiguration().withInstance("acu14").withZkHosts("localhost")).getConnector(SystemCredentials.get().getPrincipal(), SystemCredentials.get()
-        .getToken());
+    ClientOpts opts = new ClientOpts();
+    opts.parseArgs(MetadataBatchScanTest.class.getName(), args);
+    Instance inst = new ZooKeeperInstance(new ClientConfiguration().withInstance("acu14").withZkHosts("localhost"));
+    final Connector connector = inst.getConnector(opts.principal, opts.getToken());
     
     TreeSet<Long> splits = new TreeSet<Long>();
     Random r = new Random(42);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
index bf21818..15c9861 100644
--- a/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
+++ b/test/src/main/java/org/apache/accumulo/test/performance/scan/CollectTabletStats.java
@@ -37,6 +37,7 @@ import org.apache.accumulo.core.cli.ScannerOpts;
 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.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.data.ArrayByteSequence;
@@ -108,6 +109,8 @@ public class CollectTabletStats {
     
     Instance instance = opts.getInstance();
     final ServerConfigurationFactory sconf = new ServerConfigurationFactory(instance);
+    Credentials creds = new Credentials(opts.principal, opts.getToken());
+    ClientContext context = new ClientContext(instance, creds, sconf.getConfiguration());
     
     String tableId = Tables.getNameToIdMap(instance).get(opts.getTableName());
     if (tableId == null) {
@@ -116,8 +119,7 @@ public class CollectTabletStats {
     }
     
     TreeMap<KeyExtent,String> tabletLocations = new TreeMap<KeyExtent,String>();
-    List<KeyExtent> candidates = findTablets(!opts.selectFarTablets, new Credentials(opts.principal, opts.getToken()), opts.getTableName(), instance,
-        tabletLocations);
+    List<KeyExtent> candidates = findTablets(context, !opts.selectFarTablets, opts.getTableName(), tabletLocations);
     
     if (candidates.size() < opts.numThreads) {
       System.err.println("ERROR : Unable to find " + opts.numThreads + " " + (opts.selectFarTablets ? "far" : "local") + " tablets");
@@ -129,7 +131,7 @@ public class CollectTabletStats {
     Map<KeyExtent,List<FileRef>> tabletFiles = new HashMap<KeyExtent,List<FileRef>>();
     
     for (KeyExtent ke : tabletsToTest) {
-      List<FileRef> files = getTabletFiles(new Credentials(opts.principal, opts.getToken()), opts.getInstance(), tableId, ke);
+      List<FileRef> files = getTabletFiles(context, tableId, ke);
       tabletFiles.put(ke, files);
     }
     
@@ -343,11 +345,11 @@ public class CollectTabletStats {
     
   }
   
-  private static List<KeyExtent> findTablets(boolean selectLocalTablets, Credentials credentials, String tableName, Instance zki,
+  private static List<KeyExtent> findTablets(ClientContext context, boolean selectLocalTablets, String tableName,
       SortedMap<KeyExtent,String> tabletLocations) throws Exception {
     
-    String tableId = Tables.getNameToIdMap(zki).get(tableName);
-    MetadataServicer.forTableId(zki, credentials, tableId).getTabletLocations(tabletLocations);
+    String tableId = Tables.getNameToIdMap(context.getInstance()).get(tableName);
+    MetadataServicer.forTableId(context, tableId).getTabletLocations(tabletLocations);
     
     InetAddress localaddress = InetAddress.getLocalHost();
     
@@ -381,8 +383,8 @@ public class CollectTabletStats {
     return tabletsToTest;
   }
   
-  private static List<FileRef> getTabletFiles(Credentials credentials, Instance zki, String tableId, KeyExtent ke) throws IOException {
-    return new ArrayList<FileRef>(MetadataTableUtil.getDataFileSizes(ke, credentials).keySet());
+  private static List<FileRef> getTabletFiles(ClientContext context, String tableId, KeyExtent ke) throws IOException {
+    return new ArrayList<FileRef>(MetadataTableUtil.getDataFileSizes(ke, context).keySet());
   }
 
   //TODO Remove deprecation warning suppression when Hadoop1 support is dropped

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
index 438b83e..ae07925 100644
--- a/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
+++ b/test/src/main/java/org/apache/accumulo/test/performance/thrift/NullTserver.java
@@ -25,7 +25,6 @@ import java.util.Map;
 
 import org.apache.accumulo.core.cli.Help;
 import org.apache.accumulo.core.client.ClientConfiguration;
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.ZooKeeperInstance;
 import org.apache.accumulo.core.client.impl.Tables;
 import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode;
@@ -61,14 +60,15 @@ import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Processo
 import org.apache.accumulo.core.tabletserver.thrift.TabletStats;
 import org.apache.accumulo.core.trace.thrift.TInfo;
 import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.server.AccumuloServerContext;
 import org.apache.accumulo.server.client.ClientServiceHandler;
 import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.conf.ServerConfigurationFactory;
 import org.apache.accumulo.server.master.state.Assignment;
 import org.apache.accumulo.server.master.state.MetaDataStateStore;
 import org.apache.accumulo.server.master.state.MetaDataTableScanner;
 import org.apache.accumulo.server.master.state.TServerInstance;
 import org.apache.accumulo.server.master.state.TabletLocationState;
-import org.apache.accumulo.server.security.SystemCredentials;
 import org.apache.accumulo.server.util.TServerUtils;
 import org.apache.accumulo.server.zookeeper.TransactionWatcher;
 import org.apache.hadoop.io.Text;
@@ -89,8 +89,8 @@ public class NullTserver {
 
     private long updateSession = 1;
 
-    public ThriftClientHandler(Instance instance, TransactionWatcher watcher) {
-      super(instance, watcher, null);
+    public ThriftClientHandler(AccumuloServerContext context, TransactionWatcher watcher) {
+      super(context, watcher, null);
     }
 
     @Override
@@ -140,7 +140,8 @@ public class NullTserver {
 
     @Override
     public InitialScan startScan(TInfo tinfo, TCredentials credentials, TKeyExtent extent, TRange range, List<TColumn> columns, int batchSize,
-        List<IterInfo> ssiList, Map<String,Map<String,String>> ssio, List<ByteBuffer> authorizations, boolean waitForWrites, boolean isolated, long readaheadThreshold) {
+        List<IterInfo> ssiList, Map<String,Map<String,String>> ssio, List<ByteBuffer> authorizations, boolean waitForWrites, boolean isolated,
+        long readaheadThreshold) {
       return null;
     }
 
@@ -208,8 +209,8 @@ public class NullTserver {
     }
 
     @Override
-    public TConditionalSession startConditionalUpdate(TInfo tinfo, TCredentials credentials, List<ByteBuffer> authorizations, String tableID, TDurability durability)
-        throws ThriftSecurityException, TException {
+    public TConditionalSession startConditionalUpdate(TInfo tinfo, TCredentials credentials, List<ByteBuffer> authorizations, String tableID,
+        TDurability durability) throws ThriftSecurityException, TException {
       return null;
     }
 
@@ -247,7 +248,7 @@ public class NullTserver {
     opts.parseArgs(NullTserver.class.getName(), args);
 
     TransactionWatcher watcher = new TransactionWatcher();
-    ThriftClientHandler tch = new ThriftClientHandler(HdfsZooInstance.getInstance(), watcher);
+    ThriftClientHandler tch = new ThriftClientHandler(new AccumuloServerContext(new ServerConfigurationFactory(HdfsZooInstance.getInstance())), watcher);
     Processor<Iface> processor = new Processor<Iface>(tch);
     TServerUtils.startTServer(HostAndPort.fromParts("0.0.0.0", opts.port), processor, "NullTServer", "null tserver", 2, 1, 1000, 10 * 1024 * 1024, null, -1);
 
@@ -255,11 +256,13 @@ public class NullTserver {
 
     // modify metadata
     ZooKeeperInstance zki = new ZooKeeperInstance(new ClientConfiguration().withInstance(opts.iname).withZkHosts(opts.keepers));
+    AccumuloServerContext context = new AccumuloServerContext(new ServerConfigurationFactory(zki));
+
     String tableId = Tables.getTableId(zki, opts.tableName);
 
     // read the locations for the table
     Range tableRange = new KeyExtent(new Text(tableId), null, null).toMetadataRange();
-    MetaDataTableScanner s = new MetaDataTableScanner(zki, SystemCredentials.get(), tableRange);
+    MetaDataTableScanner s = new MetaDataTableScanner(context, tableRange);
     long randomSessionID = opts.port;
     TServerInstance instance = new TServerInstance(addr, randomSessionID);
     List<Assignment> assignments = new ArrayList<Assignment>();
@@ -269,7 +272,7 @@ public class NullTserver {
     }
     s.close();
     // point them to this server
-    MetaDataStateStore store = new MetaDataStateStore();
+    MetaDataStateStore store = new MetaDataStateStore(context);
     store.setLocations(assignments);
 
     while (true) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Shutdown.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Shutdown.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Shutdown.java
index 69d54a9..6715edb 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Shutdown.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/Shutdown.java
@@ -18,15 +18,15 @@ package org.apache.accumulo.test.randomwalk.concurrent;
 
 import java.util.Properties;
 
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.impl.MasterClient;
 import org.apache.accumulo.core.master.thrift.MasterClientService.Client;
 import org.apache.accumulo.core.master.thrift.MasterGoalState;
 import org.apache.accumulo.core.trace.Tracer;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.master.state.SetGoalState;
+import org.apache.accumulo.server.AccumuloServerContext;
 import org.apache.accumulo.server.client.HdfsZooInstance;
-import org.apache.accumulo.server.security.SystemCredentials;
+import org.apache.accumulo.server.conf.ServerConfigurationFactory;
 import org.apache.accumulo.test.randomwalk.Environment;
 import org.apache.accumulo.test.randomwalk.State;
 import org.apache.accumulo.test.randomwalk.Test;
@@ -44,9 +44,9 @@ public class Shutdown extends Test {
     
     while (true) {
       try {
-        Instance instance = HdfsZooInstance.getInstance();
-        Client client = MasterClient.getConnection(instance);
-        client.getMasterStats(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance));
+        AccumuloServerContext context = new AccumuloServerContext(new ServerConfigurationFactory(HdfsZooInstance.getInstance()));
+        Client client = MasterClient.getConnection(context);
+        client.getMasterStats(Tracer.traceInfo(), context.rpcCreds());
       } catch (Exception e) {
         // assume this is due to server shutdown
         break;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StartAll.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StartAll.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StartAll.java
index 6b8c43c..d164695 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StartAll.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/StartAll.java
@@ -18,7 +18,6 @@ package org.apache.accumulo.test.randomwalk.concurrent;
 
 import java.util.Properties;
 
-import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.impl.MasterClient;
 import org.apache.accumulo.core.master.thrift.MasterClientService.Client;
 import org.apache.accumulo.core.master.thrift.MasterGoalState;
@@ -26,8 +25,9 @@ import org.apache.accumulo.core.master.thrift.MasterMonitorInfo;
 import org.apache.accumulo.core.trace.Tracer;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.master.state.SetGoalState;
+import org.apache.accumulo.server.AccumuloServerContext;
 import org.apache.accumulo.server.client.HdfsZooInstance;
-import org.apache.accumulo.server.security.SystemCredentials;
+import org.apache.accumulo.server.conf.ServerConfigurationFactory;
 import org.apache.accumulo.test.randomwalk.Environment;
 import org.apache.accumulo.test.randomwalk.State;
 import org.apache.accumulo.test.randomwalk.Test;
@@ -42,9 +42,9 @@ public class StartAll extends Test {
     exec.waitFor();
     while (true) {
       try {
-        Instance instance = HdfsZooInstance.getInstance();
-        Client client = MasterClient.getConnection(instance);
-        MasterMonitorInfo masterStats = client.getMasterStats(Tracer.traceInfo(), SystemCredentials.get().toThrift(instance));
+        AccumuloServerContext context = new AccumuloServerContext(new ServerConfigurationFactory(HdfsZooInstance.getInstance()));
+        Client client = MasterClient.getConnection(context);
+        MasterMonitorInfo masterStats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds());
         if (!masterStats.tServerInfo.isEmpty())
           break;
       } catch (Exception ex) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
index 8a66951..0fb3a82 100644
--- a/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
+++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/security/WalkingSecurity.java
@@ -40,6 +40,9 @@ import org.apache.accumulo.core.security.SystemPermission;
 import org.apache.accumulo.core.security.TablePermission;
 import org.apache.accumulo.core.security.thrift.TCredentials;
 import org.apache.accumulo.core.util.CachedConfiguration;
+import org.apache.accumulo.server.AccumuloServerContext;
+import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.conf.ServerConfigurationFactory;
 import org.apache.accumulo.server.security.SecurityOperation;
 import org.apache.accumulo.server.security.handler.Authenticator;
 import org.apache.accumulo.server.security.handler.Authorizor;
@@ -74,12 +77,12 @@ public class WalkingSecurity extends SecurityOperation implements Authorizor, Au
 
   private static WalkingSecurity instance = null;
 
-  public WalkingSecurity(Authorizor author, Authenticator authent, PermissionHandler pm, String instanceId) {
-    super(author, authent, pm, instanceId);
+  public WalkingSecurity(AccumuloServerContext context, Authorizor author, Authenticator authent, PermissionHandler pm) {
+    super(context, author, authent, pm);
   }
 
   public WalkingSecurity(State state2, Environment env2) {
-    super(env2.getInstance().getInstanceID());
+    super(new AccumuloServerContext(new ServerConfigurationFactory(HdfsZooInstance.getInstance())));
     this.state = state2;
     this.env = env2;
     authorizor = this;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java b/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java
index 7524943..fb71f5f 100644
--- a/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java
+++ b/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java
@@ -116,7 +116,7 @@ public class SystemCredentialsIT extends ConfigurableMacIT {
 
       });
     } else if (args[0].equals("good")) {
-      creds = SystemCredentials.get();
+      creds = SystemCredentials.get(HdfsZooInstance.getInstance());
     }
     Instance instance = HdfsZooInstance.getInstance();
     Connector conn = instance.getConnector(creds.getPrincipal(), creds.getToken());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java b/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
index da2d20f..fb5b4a0 100644
--- a/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MasterRepairsDualAssignmentIT.java
@@ -27,6 +27,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.impl.ClientContext;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.KeyExtent;
@@ -69,7 +70,7 @@ public class MasterRepairsDualAssignmentIT extends ConfigurableMacIT {
   public void test() throws Exception {
     // make some tablets, spread 'em around
     Connector c = getConnector();
-    Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
+    ClientContext context = new ClientContext(c.getInstance(), new Credentials("root", new PasswordToken(ROOT_PASSWORD)), getClientConfig());
     String table = this.getUniqueNames(1)[0];
     c.securityOperations().grantTablePermission("root", MetadataTable.NAME, TablePermission.WRITE);
     c.securityOperations().grantTablePermission("root", RootTable.NAME, TablePermission.WRITE);
@@ -82,7 +83,7 @@ public class MasterRepairsDualAssignmentIT extends ConfigurableMacIT {
     // scan the metadata table and get the two table location states
     Set<TServerInstance> states = new HashSet<TServerInstance>();
     Set<TabletLocationState> oldLocations = new HashSet<TabletLocationState>();
-    MetaDataStateStore store = new MetaDataStateStore(c.getInstance(), creds, null);
+    MetaDataStateStore store = new MetaDataStateStore(context, null);
     while (states.size() < 2) {
       UtilWaitThread.sleep(250);
       oldLocations.clear();
@@ -140,7 +141,7 @@ public class MasterRepairsDualAssignmentIT extends ConfigurableMacIT {
     moved.current.putLocation(assignment);
     bw.addMutation(assignment);
     bw.close();
-    waitForCleanStore(new RootTabletStateStore(c.getInstance(), creds, null));
+    waitForCleanStore(new RootTabletStateStore(context, null));
   }
 
   private void waitForCleanStore(MetaDataStateStore store) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java b/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
index 5dc75d0..7d1c318 100644
--- a/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MetaConstraintRetryIT.java
@@ -17,6 +17,7 @@
 
 package org.apache.accumulo.test;
 
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.Writer;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.KeyExtent;
@@ -44,7 +45,8 @@ public class MetaConstraintRetryIT extends SimpleMacIT {
     getConnector().securityOperations().grantTablePermission("root", MetadataTable.NAME, TablePermission.WRITE);
 
     Credentials credentials = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
-    Writer w = new Writer(super.getConnector().getInstance(), credentials, MetadataTable.ID);
+    ClientContext context = new ClientContext(getConnector().getInstance(), credentials, getClientConfig());
+    Writer w = new Writer(context, MetadataTable.ID);
     KeyExtent extent = new KeyExtent(new Text("5"), null, null);
 
     Mutation m = new Mutation(extent.getMetadataEntry());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java b/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
index 484c048..f5e1469 100644
--- a/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/MultiTableBatchWriterIT.java
@@ -16,6 +16,7 @@
  */
 package org.apache.accumulo.test;
 
+import java.io.FileNotFoundException;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
@@ -33,6 +34,7 @@ import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.TableOfflineException;
 import org.apache.accumulo.core.client.admin.TableOperations;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.MultiTableBatchWriterImpl;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Key;
@@ -42,6 +44,7 @@ import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.test.functional.SimpleMacIT;
+import org.apache.commons.configuration.ConfigurationException;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -65,8 +68,13 @@ public class MultiTableBatchWriterIT extends SimpleMacIT {
   }
 
   public MultiTableBatchWriter getMultiTableBatchWriter(long cacheTimeoutInSeconds) {
-    return new MultiTableBatchWriterImpl(connector.getInstance(), new Credentials("root", new PasswordToken(ROOT_PASSWORD)),
-        new BatchWriterConfig(), cacheTimeoutInSeconds, TimeUnit.SECONDS);
+    try {
+      ClientContext context = new ClientContext(connector.getInstance(), new Credentials("root", new PasswordToken(ROOT_PASSWORD)), getClientConfig());
+      return new MultiTableBatchWriterImpl(context, new BatchWriterConfig(), cacheTimeoutInSeconds, TimeUnit.SECONDS);
+    } catch (FileNotFoundException | ConfigurationException e) {
+      Assert.fail(e.getMessage());
+      return null;
+    }
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java b/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
index 0d9a211..537e88a 100644
--- a/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java
@@ -61,7 +61,7 @@ public class TableConfigurationUpdateIT extends SimpleMacIT {
     int numThreads = 2;
     // Number of iterations per thread
     int iterations = 100000;
-    AccumuloConfiguration tableConf = new TableConfiguration(inst.getInstanceID(), inst, table, defaultConf);
+    AccumuloConfiguration tableConf = new TableConfiguration(inst, table, defaultConf);
 
     long start = System.currentTimeMillis();
     ExecutorService svc = Executors.newFixedThreadPool(numThreads);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/test/TotalQueuedIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/TotalQueuedIT.java b/test/src/test/java/org/apache/accumulo/test/TotalQueuedIT.java
index a794088..8cb0290 100644
--- a/test/src/test/java/org/apache/accumulo/test/TotalQueuedIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/TotalQueuedIT.java
@@ -24,17 +24,16 @@ import java.util.concurrent.TimeUnit;
 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.security.tokens.PasswordToken;
-import org.apache.accumulo.core.conf.DefaultConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.master.thrift.TabletServerStatus;
-import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService;
 import org.apache.accumulo.core.util.ThriftUtil;
 import org.apache.accumulo.core.util.UtilWaitThread;
 import org.apache.accumulo.minicluster.MemoryUnit;
 import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
+import org.apache.accumulo.server.AccumuloServerContext;
+import org.apache.accumulo.server.conf.ServerConfigurationFactory;
 import org.apache.accumulo.test.functional.ConfigurableMacIT;
 import org.apache.hadoop.conf.Configuration;
 import org.junit.Test;
@@ -117,10 +116,11 @@ public class TotalQueuedIT extends ConfigurableMacIT {
 
   private long getSyncs() throws Exception {
     Connector c = getConnector();
-    Credentials credentials = new Credentials("root", new PasswordToken(ROOT_PASSWORD.getBytes()));
+    ServerConfigurationFactory confFactory = new ServerConfigurationFactory(c.getInstance());
+    AccumuloServerContext context = new AccumuloServerContext(confFactory);
     for (String address : c.instanceOperations().getTabletServers()) {
-      TabletClientService.Client client = ThriftUtil.getTServerClient(address, DefaultConfiguration.getDefaultConfiguration());
-      TabletServerStatus status = client.getTabletServerStatus(null, credentials.toThrift(c.getInstance()));
+      TabletClientService.Client client = ThriftUtil.getTServerClient(address, context);
+      TabletServerStatus status = client.getTabletServerStatus(null, context.rpcCreds());
       return status.syncs;
     }
     return 0;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java b/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java
index 644b05e..3c4cc2a 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java
@@ -24,6 +24,7 @@ import org.apache.accumulo.core.cli.BatchWriterOpts;
 import org.apache.accumulo.core.cli.ScannerOpts;
 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.Connector;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl;
@@ -157,4 +158,7 @@ public abstract class AbstractMacIT {
   public abstract Connector getConnector() throws AccumuloException, AccumuloSecurityException;
 
   public abstract String rootPath();
+
+  protected abstract ClientConfiguration getClientConfig() throws Exception;
+
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java b/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java
index c32375b..aabacc6 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/BalanceAfterCommsFailureIT.java
@@ -28,6 +28,7 @@ import java.util.SortedSet;
 import java.util.TreeSet;
 
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.MasterClient;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.Property;
@@ -98,14 +99,15 @@ public class BalanceAfterCommsFailureIT extends ConfigurableMacIT {
 
   private void checkBalance(Connector c) throws Exception {
     Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
+    ClientContext context = new ClientContext(c.getInstance(), creds, getClientConfig());
 
     MasterMonitorInfo stats = null;
     int unassignedTablets = 1;
     for (int i = 0; unassignedTablets > 0 && i < 10; i++) {
       MasterClientService.Iface client = null;
       try {
-        client = MasterClient.getConnectionWithRetry(c.getInstance());
-        stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance()));
+        client = MasterClient.getConnectionWithRetry(context);
+        stats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds());
       } finally {
         if (client != null)
           MasterClient.close(client);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java
index d828675..56396b3 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/ConfigurableMacIT.java
@@ -24,6 +24,7 @@ import java.io.OutputStream;
 
 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.Connector;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.ZooKeeperInstance;
@@ -32,6 +33,7 @@ import org.apache.accumulo.core.util.MonitorUtil;
 import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl;
 import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
 import org.apache.accumulo.minicluster.impl.ZooKeeperBindException;
+import org.apache.commons.configuration.PropertiesConfiguration;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.log4j.Logger;
 import org.apache.zookeeper.KeeperException;
@@ -115,4 +117,9 @@ public class ConfigurableMacIT extends AbstractMacIT {
     return MonitorUtil.getLocation(instance);
   }
 
+  @Override
+  protected ClientConfiguration getClientConfig() throws Exception {
+    return new ClientConfiguration(new PropertiesConfiguration(getCluster().getConfig().getClientConfFile()));
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/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 3ec3ccf..ea71c48 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
@@ -21,6 +21,7 @@ import static org.junit.Assert.fail;
 import java.util.Collections;
 
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.MasterClient;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.Property;
@@ -70,7 +71,7 @@ public class DynamicThreadPoolsIT extends ConfigurableMacIT {
       MasterClientService.Iface client = null;
       MasterMonitorInfo stats = null;
       try {
-        client = MasterClient.getConnectionWithRetry(c.getInstance());
+        client = MasterClient.getConnectionWithRetry(new ClientContext(c.getInstance(), creds, getClientConfig()));
         stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance()));
       } finally {
         if (client != null)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/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 46f6b23..1160916 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
@@ -20,9 +20,12 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 
+import java.io.FileNotFoundException;
+
 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.impl.ClientContext;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.KeyExtent;
 import org.apache.accumulo.core.data.Mutation;
@@ -31,6 +34,7 @@ import org.apache.accumulo.core.security.Credentials;
 import org.apache.accumulo.fate.util.UtilWaitThread;
 import org.apache.accumulo.server.master.state.MetaDataTableScanner;
 import org.apache.accumulo.server.master.state.TabletLocationState;
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.hadoop.io.Text;
 import org.junit.Test;
 
@@ -85,9 +89,10 @@ public class MasterAssignmentIT extends SimpleMacIT {
     assertEquals(online.current, online.last);
   }
 
-  private TabletLocationState getTabletLocationState(Connector c, String tableId) {
+  private TabletLocationState getTabletLocationState(Connector c, String tableId) throws FileNotFoundException, ConfigurationException {
     Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
-    MetaDataTableScanner s = new MetaDataTableScanner(c.getInstance(), creds, new Range(KeyExtent.getMetadataEntry(new Text(tableId), null)));
+    ClientContext context = new ClientContext(c.getInstance(), creds, getClientConfig());
+    MetaDataTableScanner s = new MetaDataTableScanner(context, new Range(KeyExtent.getMetadataEntry(new Text(tableId), null)));
     TabletLocationState tlState = s.next();
     s.close();
     return tlState;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java b/test/src/test/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java
index 1ea5652..b2adc89 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/MetadataMaxFilesIT.java
@@ -25,6 +25,7 @@ import java.util.SortedSet;
 import java.util.TreeSet;
 
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.MasterClient;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.Property;
@@ -90,8 +91,9 @@ public class MetadataMaxFilesIT extends ConfigurableMacIT {
       Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
       Client client = null;
       try {
-        client = MasterClient.getConnectionWithRetry(c.getInstance());
-        stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance()));
+        ClientContext context = new ClientContext(c.getInstance(), creds, getClientConfig());
+        client = MasterClient.getConnectionWithRetry(context);
+        stats = client.getMasterStats(Tracer.traceInfo(), context.rpcCreds());
       } finally {
         if (client != null)
           MasterClient.close(client);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java
index 33dfa15..a458ec2 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/SimpleBalancerFairnessIT.java
@@ -27,6 +27,7 @@ import java.util.TreeSet;
 
 import org.apache.accumulo.core.cli.BatchWriterOpts;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.MasterClient;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.Property;
@@ -77,13 +78,14 @@ public class SimpleBalancerFairnessIT extends ConfigurableMacIT {
     c.tableOperations().flush("test_ingest", null, null, false);
     UtilWaitThread.sleep(45 * 1000);
     Credentials creds = new Credentials("root", new PasswordToken(ROOT_PASSWORD));
+    ClientContext context = new ClientContext(c.getInstance(), creds, getClientConfig());
 
     MasterMonitorInfo stats = null;
     int unassignedTablets = 1;
     for (int i = 0; unassignedTablets > 0 && i < 10; i++) {
       MasterClientService.Iface client = null;
       try {
-        client = MasterClient.getConnectionWithRetry(c.getInstance());
+        client = MasterClient.getConnectionWithRetry(context);
         stats = client.getMasterStats(Tracer.traceInfo(), creds.toThrift(c.getInstance()));
       } finally {
         if (client != null)

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java
index 3f04b94..e6c0ff1 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/SimpleMacIT.java
@@ -140,13 +140,14 @@ public class SimpleMacIT extends AbstractMacIT {
     return new File(System.getProperty("user.dir") + "/accumulo-maven-plugin/instance1");
   }
 
-  protected static ClientConfiguration getClientConfig() throws FileNotFoundException, ConfigurationException {
+  @Override
+  protected ClientConfiguration getClientConfig() throws FileNotFoundException, ConfigurationException {
     if (getInstanceOneConnector() == null) {
       return new ClientConfiguration(new PropertiesConfiguration(cluster.getConfig().getClientConfFile()));
     } else {
       File directory = getInstanceOnePath();
-      return new ClientConfiguration(MiniAccumuloInstance.getConfigProperties(directory)).withInstance(INSTANCE_NAME)
-          .withZkHosts(MiniAccumuloInstance.getZooKeepersFromDir(directory));
+      return new ClientConfiguration(MiniAccumuloInstance.getConfigProperties(directory)).withInstance(INSTANCE_NAME).withZkHosts(
+          MiniAccumuloInstance.getZooKeepersFromDir(directory));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java b/test/src/test/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java
index 5223439..d639090 100644
--- a/test/src/test/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/functional/SplitRecoveryIT.java
@@ -30,6 +30,7 @@ import java.util.SortedMap;
 import java.util.TreeMap;
 
 import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.impl.ScannerImpl;
 import org.apache.accumulo.core.client.impl.Writer;
@@ -49,12 +50,13 @@ import org.apache.accumulo.fate.zookeeper.IZooReaderWriter;
 import org.apache.accumulo.fate.zookeeper.ZooLock.LockLossReason;
 import org.apache.accumulo.fate.zookeeper.ZooLock.LockWatcher;
 import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy;
+import org.apache.accumulo.server.AccumuloServerContext;
 import org.apache.accumulo.server.ServerConstants;
 import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.conf.ServerConfigurationFactory;
 import org.apache.accumulo.server.fs.FileRef;
 import org.apache.accumulo.server.master.state.Assignment;
 import org.apache.accumulo.server.master.state.TServerInstance;
-import org.apache.accumulo.server.security.SystemCredentials;
 import org.apache.accumulo.server.tablets.TabletTime;
 import org.apache.accumulo.server.util.FileUtil;
 import org.apache.accumulo.server.util.MasterMetadataUtil;
@@ -78,7 +80,9 @@ public class SplitRecoveryIT extends ConfigurableMacIT {
   }
   
   private void run() throws Exception {
-    String zPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + "/testLock";
+    Instance inst = HdfsZooInstance.getInstance();
+    AccumuloServerContext c = new AccumuloServerContext(new ServerConfigurationFactory(inst));
+    String zPath = ZooUtil.getRoot(inst) + "/testLock";
     IZooReaderWriter zoo = ZooReaderWriter.getInstance();
     zoo.putPersistentData(zPath, new byte[0], NodeExistsPolicy.OVERWRITE);
     ZooLock zl = new ZooLock(zPath);
@@ -101,29 +105,30 @@ public class SplitRecoveryIT extends ConfigurableMacIT {
     }
     
     // run test for a table with one tablet
-    runSplitRecoveryTest(0, "sp", 0, zl, nke("foo0", null, null));
-    runSplitRecoveryTest(1, "sp", 0, zl, nke("foo1", null, null));
+    runSplitRecoveryTest(c, 0, "sp", 0, zl, nke("foo0", null, null));
+    runSplitRecoveryTest(c, 1, "sp", 0, zl, nke("foo1", null, null));
     
     // run test for tables with two tablets, run test on first and last tablet
-    runSplitRecoveryTest(0, "k", 0, zl, nke("foo2", "m", null), nke("foo2", null, "m"));
-    runSplitRecoveryTest(1, "k", 0, zl, nke("foo3", "m", null), nke("foo3", null, "m"));
-    runSplitRecoveryTest(0, "o", 1, zl, nke("foo4", "m", null), nke("foo4", null, "m"));
-    runSplitRecoveryTest(1, "o", 1, zl, nke("foo5", "m", null), nke("foo5", null, "m"));
+    runSplitRecoveryTest(c, 0, "k", 0, zl, nke("foo2", "m", null), nke("foo2", null, "m"));
+    runSplitRecoveryTest(c, 1, "k", 0, zl, nke("foo3", "m", null), nke("foo3", null, "m"));
+    runSplitRecoveryTest(c, 0, "o", 1, zl, nke("foo4", "m", null), nke("foo4", null, "m"));
+    runSplitRecoveryTest(c, 1, "o", 1, zl, nke("foo5", "m", null), nke("foo5", null, "m"));
     
     // run test for table w/ three tablets, run test on middle tablet
-    runSplitRecoveryTest(0, "o", 1, zl, nke("foo6", "m", null), nke("foo6", "r", "m"), nke("foo6", null, "r"));
-    runSplitRecoveryTest(1, "o", 1, zl, nke("foo7", "m", null), nke("foo7", "r", "m"), nke("foo7", null, "r"));
+    runSplitRecoveryTest(c, 0, "o", 1, zl, nke("foo6", "m", null), nke("foo6", "r", "m"), nke("foo6", null, "r"));
+    runSplitRecoveryTest(c, 1, "o", 1, zl, nke("foo7", "m", null), nke("foo7", "r", "m"), nke("foo7", null, "r"));
     
     // run test for table w/ three tablets, run test on first
-    runSplitRecoveryTest(0, "g", 0, zl, nke("foo8", "m", null), nke("foo8", "r", "m"), nke("foo8", null, "r"));
-    runSplitRecoveryTest(1, "g", 0, zl, nke("foo9", "m", null), nke("foo9", "r", "m"), nke("foo9", null, "r"));
+    runSplitRecoveryTest(c, 0, "g", 0, zl, nke("foo8", "m", null), nke("foo8", "r", "m"), nke("foo8", null, "r"));
+    runSplitRecoveryTest(c, 1, "g", 0, zl, nke("foo9", "m", null), nke("foo9", "r", "m"), nke("foo9", null, "r"));
     
     // run test for table w/ three tablets, run test on last tablet
-    runSplitRecoveryTest(0, "w", 2, zl, nke("fooa", "m", null), nke("fooa", "r", "m"), nke("fooa", null, "r"));
-    runSplitRecoveryTest(1, "w", 2, zl, nke("foob", "m", null), nke("foob", "r", "m"), nke("foob", null, "r"));
+    runSplitRecoveryTest(c, 0, "w", 2, zl, nke("fooa", "m", null), nke("fooa", "r", "m"), nke("fooa", null, "r"));
+    runSplitRecoveryTest(c, 1, "w", 2, zl, nke("foob", "m", null), nke("foob", "r", "m"), nke("foob", null, "r"));
   }
   
-  private void runSplitRecoveryTest(int failPoint, String mr, int extentToSplit, ZooLock zl, KeyExtent... extents) throws Exception {
+  private void runSplitRecoveryTest(AccumuloServerContext context, int failPoint, String mr, int extentToSplit, ZooLock zl, KeyExtent... extents)
+      throws Exception {
     
     Text midRow = new Text(mr);
     
@@ -133,7 +138,7 @@ public class SplitRecoveryIT extends ConfigurableMacIT {
       KeyExtent extent = extents[i];
       
       String tdir = ServerConstants.getTablesDirs()[0] + "/" + extent.getTableId().toString() + "/dir_" + i;
-      MetadataTableUtil.addTablet(extent, tdir, SystemCredentials.get(), TabletTime.LOGICAL_TIME_ID, zl);
+      MetadataTableUtil.addTablet(extent, tdir, context, TabletTime.LOGICAL_TIME_ID, zl);
       SortedMap<FileRef,DataFileValue> mapFiles = new TreeMap<FileRef,DataFileValue>();
       mapFiles.put(new FileRef(tdir + "/" + RFile.EXTENSION + "_000_000"), new DataFileValue(1000017 + i, 10000 + i));
       
@@ -142,7 +147,7 @@ public class SplitRecoveryIT extends ConfigurableMacIT {
       }
       int tid = 0;
       TransactionWatcher.ZooArbitrator.start(Constants.BULK_ARBITRATOR_TYPE, tid);
-      MetadataTableUtil.updateTabletDataFile(tid, extent, mapFiles, "L0", SystemCredentials.get(), zl);
+      MetadataTableUtil.updateTabletDataFile(tid, extent, mapFiles, "L0", context, zl);
     }
     
     KeyExtent extent = extents[extentToSplit];
@@ -150,11 +155,11 @@ public class SplitRecoveryIT extends ConfigurableMacIT {
     KeyExtent high = new KeyExtent(extent.getTableId(), extent.getEndRow(), midRow);
     KeyExtent low = new KeyExtent(extent.getTableId(), midRow, extent.getPrevEndRow());
     
-    splitPartiallyAndRecover(extent, high, low, .4, splitMapFiles, midRow, "localhost:1234", failPoint, zl);
+    splitPartiallyAndRecover(context, extent, high, low, .4, splitMapFiles, midRow, "localhost:1234", failPoint, zl);
   }
   
-  private void splitPartiallyAndRecover(KeyExtent extent, KeyExtent high, KeyExtent low, double splitRatio, SortedMap<FileRef,DataFileValue> mapFiles,
-      Text midRow, String location, int steps, ZooLock zl) throws Exception {
+  private void splitPartiallyAndRecover(AccumuloServerContext context, KeyExtent extent, KeyExtent high, KeyExtent low, double splitRatio,
+      SortedMap<FileRef,DataFileValue> mapFiles, Text midRow, String location, int steps, ZooLock zl) throws Exception {
     
     SortedMap<FileRef,DataFileValue> lowDatafileSizes = new TreeMap<FileRef,DataFileValue>();
     SortedMap<FileRef,DataFileValue> highDatafileSizes = new TreeMap<FileRef,DataFileValue>();
@@ -163,30 +168,29 @@ public class SplitRecoveryIT extends ConfigurableMacIT {
     MetadataTableUtil.splitDatafiles(extent.getTableId(), midRow, splitRatio, new HashMap<FileRef,FileUtil.FileInfo>(), mapFiles, lowDatafileSizes,
         highDatafileSizes, highDatafilesToRemove);
     
-    MetadataTableUtil.splitTablet(high, extent.getPrevEndRow(), splitRatio, SystemCredentials.get(), zl);
+    MetadataTableUtil.splitTablet(high, extent.getPrevEndRow(), splitRatio, context, zl);
     TServerInstance instance = new TServerInstance(location, zl.getSessionId());
-    Writer writer = new Writer(HdfsZooInstance.getInstance(), SystemCredentials.get(), MetadataTable.ID);
+    Writer writer = MetadataTableUtil.getMetadataTable(context);
     Assignment assignment = new Assignment(high, instance);
     Mutation m = new Mutation(assignment.tablet.getMetadataEntry());
     assignment.server.putFutureLocation(m);
     writer.update(m);
     
     if (steps >= 1) {
-      Map<FileRef,Long> bulkFiles = MetadataTableUtil.getBulkFilesLoaded(SystemCredentials.get(), extent);
-      MasterMetadataUtil.addNewTablet(low, "/lowDir", instance, lowDatafileSizes, bulkFiles, SystemCredentials.get(), TabletTime.LOGICAL_TIME_ID + "0", -1l,
-          -1l, zl);
+      Map<FileRef,Long> bulkFiles = MetadataTableUtil.getBulkFilesLoaded(context, extent);
+      MasterMetadataUtil.addNewTablet(context, low, "/lowDir", instance, lowDatafileSizes, bulkFiles, TabletTime.LOGICAL_TIME_ID + "0", -1l, -1l, zl);
     }
     if (steps >= 2)
-      MetadataTableUtil.finishSplit(high, highDatafileSizes, highDatafilesToRemove, SystemCredentials.get(), zl);
+      MetadataTableUtil.finishSplit(high, highDatafileSizes, highDatafilesToRemove, context, zl);
     
-    TabletServer.verifyTabletInformation(high, instance, null, "127.0.0.1:0", zl);
+    TabletServer.verifyTabletInformation(context, high, instance, null, "127.0.0.1:0", zl);
     
     if (steps >= 1) {
-      ensureTabletHasNoUnexpectedMetadataEntries(low, lowDatafileSizes);
-      ensureTabletHasNoUnexpectedMetadataEntries(high, highDatafileSizes);
+      ensureTabletHasNoUnexpectedMetadataEntries(context, low, lowDatafileSizes);
+      ensureTabletHasNoUnexpectedMetadataEntries(context, high, highDatafileSizes);
       
-      Map<FileRef,Long> lowBulkFiles = MetadataTableUtil.getBulkFilesLoaded(SystemCredentials.get(), low);
-      Map<FileRef,Long> highBulkFiles = MetadataTableUtil.getBulkFilesLoaded(SystemCredentials.get(), high);
+      Map<FileRef,Long> lowBulkFiles = MetadataTableUtil.getBulkFilesLoaded(context, low);
+      Map<FileRef,Long> highBulkFiles = MetadataTableUtil.getBulkFilesLoaded(context, high);
       
       if (!lowBulkFiles.equals(highBulkFiles)) {
         throw new Exception(" " + lowBulkFiles + " != " + highBulkFiles + " " + low + " " + high);
@@ -196,12 +200,13 @@ public class SplitRecoveryIT extends ConfigurableMacIT {
         throw new Exception(" no bulk files " + low);
       }
     } else {
-      ensureTabletHasNoUnexpectedMetadataEntries(extent, mapFiles);
+      ensureTabletHasNoUnexpectedMetadataEntries(context, extent, mapFiles);
     }
   }
   
-  private void ensureTabletHasNoUnexpectedMetadataEntries(KeyExtent extent, SortedMap<FileRef,DataFileValue> expectedMapFiles) throws Exception {
-    Scanner scanner = new ScannerImpl(HdfsZooInstance.getInstance(), SystemCredentials.get(), MetadataTable.ID, Authorizations.EMPTY);
+  private void ensureTabletHasNoUnexpectedMetadataEntries(AccumuloServerContext context, KeyExtent extent, SortedMap<FileRef,DataFileValue> expectedMapFiles)
+      throws Exception {
+    Scanner scanner = new ScannerImpl(context, MetadataTable.ID, Authorizations.EMPTY);
     scanner.setRange(extent.toMetadataRange());
     
     HashSet<ColumnFQ> expectedColumns = new HashSet<ColumnFQ>();
@@ -240,7 +245,7 @@ public class SplitRecoveryIT extends ConfigurableMacIT {
       throw new Exception("Not all expected columns seen " + extent + " " + expectedColumns);
     }
     
-    SortedMap<FileRef,DataFileValue> fixedMapFiles = MetadataTableUtil.getDataFileSizes(extent, SystemCredentials.get());
+    SortedMap<FileRef,DataFileValue> fixedMapFiles = MetadataTableUtil.getDataFileSizes(extent, context);
     verifySame(expectedMapFiles, fixedMapFiles);
   }
   
@@ -260,7 +265,6 @@ public class SplitRecoveryIT extends ConfigurableMacIT {
     }
   }
 
-  
   public static void main(String[] args) throws Exception {
     new SplitRecoveryIT().run();
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java b/test/src/test/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
index 1044677..f2733ce 100644
--- a/test/src/test/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/replication/GarbageCollectorCommunicatesWithTServersIT.java
@@ -26,11 +26,10 @@ import java.util.Set;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.impl.ClientConfigurationHelper;
 import org.apache.accumulo.core.client.impl.ClientExecReturn;
+import org.apache.accumulo.core.client.impl.ClientContext;
 import org.apache.accumulo.core.client.impl.MasterClient;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -44,7 +43,6 @@ import org.apache.accumulo.core.replication.ReplicationTable;
 import org.apache.accumulo.core.replication.proto.Replication.Status;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.accumulo.core.security.Credentials;
-import org.apache.accumulo.core.security.thrift.TCredentials;
 import org.apache.accumulo.core.tabletserver.thrift.TabletClientService.Client;
 import org.apache.accumulo.core.trace.Tracer;
 import org.apache.accumulo.core.util.ThriftUtil;
@@ -394,26 +392,25 @@ public class GarbageCollectorCommunicatesWithTServersIT extends ConfigurableMacI
 
     conn.tableOperations().flush(otherTable, null, null, true);
 
-    final TCredentials tcreds = new Credentials("root", new PasswordToken(AbstractMacIT.ROOT_PASSWORD)).toThrift(conn.getInstance());
-
     // Get the tservers which the master deems as active
-    List<String> tservers = MasterClient.execute(conn.getInstance(), new ClientExecReturn<List<String>,MasterClientService.Client>() {
+    final ClientContext context = new ClientContext(conn.getInstance(), new Credentials("root", new PasswordToken(AbstractMacIT.ROOT_PASSWORD)),
+        getClientConfig());
+    List<String> tservers = MasterClient.execute(context, new ClientExecReturn<List<String>,MasterClientService.Client>() {
       @Override
       public List<String> execute(MasterClientService.Client client) throws Exception {
-        return client.getActiveTservers(Tracer.traceInfo(), tcreds);
+        return client.getActiveTservers(Tracer.traceInfo(), context.rpcCreds());
       }
     });
 
     Assert.assertEquals("Expected only one active tservers", 1, tservers.size());
 
     String tserver = tservers.get(0);
-    AccumuloConfiguration rpcConfig = ClientConfigurationHelper.getClientRpcConfiguration(conn.getInstance());
 
     // Get the active WALs from that server
     log.info("Fetching active WALs from {}", tserver);
 
-    Client client = ThriftUtil.getTServerClient(tserver, rpcConfig);
-    List<String> activeWalsForTserver = client.getActiveLogs(Tracer.traceInfo(), tcreds);
+    Client client = ThriftUtil.getTServerClient(tserver, context);
+    List<String> activeWalsForTserver = client.getActiveLogs(Tracer.traceInfo(), context.rpcCreds());
 
     log.info("Active wals: {}", activeWalsForTserver);
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/42c25faa/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java b/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java
index ad9c9fc..a903a61 100644
--- a/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java
+++ b/test/src/test/java/org/apache/accumulo/test/replication/UnorderedWorkAssignerReplicationIT.java
@@ -532,6 +532,9 @@ public class UnorderedWorkAssignerReplicationIT extends ConfigurableMacIT {
     log.info("Wrote all data to master cluster");
 
     Set<String> files = connMaster.replicationOperations().referencedFiles(masterTable);
+    for (String s : files) {
+      log.info("Found referenced file for " + masterTable + ": " + s);
+    }
 
     for (ProcessReference proc : cluster.getProcesses().get(ServerType.TABLET_SERVER)) {
       cluster.killProcess(ServerType.TABLET_SERVER, proc);
@@ -550,6 +553,8 @@ public class UnorderedWorkAssignerReplicationIT extends ConfigurableMacIT {
 
     Scanner master = connMaster.createScanner(masterTable, Authorizations.EMPTY), peer = connPeer.createScanner(peerTable, Authorizations.EMPTY);
     Iterator<Entry<Key,Value>> masterIter = master.iterator(), peerIter = peer.iterator();
+    Assert.assertTrue("No data in master table", masterIter.hasNext());
+    Assert.assertTrue("No data in peer table", peerIter.hasNext());
     while (masterIter.hasNext() && peerIter.hasNext()) {
       Entry<Key,Value> masterEntry = masterIter.next(), peerEntry = peerIter.next();
       Assert.assertEquals(peerEntry.getKey() + " was not equal to " + peerEntry.getKey(), 0,


Mime
View raw message