You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2015/05/13 00:42:57 UTC

[1/5] accumulo git commit: ACCUMULO-3804 Always seal jars

Repository: accumulo
Updated Branches:
  refs/heads/master d353b6168 -> 9cf9aaaca


http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyReadWrite.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyReadWrite.java b/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyReadWrite.java
new file mode 100644
index 0000000..1a75fea
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyReadWrite.java
@@ -0,0 +1,468 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.proxy;
+
+import static org.junit.Assert.assertEquals;
+
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.iterators.user.RegExFilter;
+import org.apache.accumulo.proxy.Proxy;
+import org.apache.accumulo.proxy.Util;
+import org.apache.accumulo.proxy.thrift.BatchScanOptions;
+import org.apache.accumulo.proxy.thrift.ColumnUpdate;
+import org.apache.accumulo.proxy.thrift.IteratorSetting;
+import org.apache.accumulo.proxy.thrift.Key;
+import org.apache.accumulo.proxy.thrift.KeyValue;
+import org.apache.accumulo.proxy.thrift.Range;
+import org.apache.accumulo.proxy.thrift.ScanColumn;
+import org.apache.accumulo.proxy.thrift.ScanOptions;
+import org.apache.accumulo.proxy.thrift.ScanResult;
+import org.apache.accumulo.proxy.thrift.TimeType;
+import org.apache.thrift.protocol.TCompactProtocol;
+import org.apache.thrift.server.TServer;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.google.common.net.HostAndPort;
+
+public class TestProxyReadWrite {
+  protected static TServer proxy;
+  protected static TestProxyClient tpc;
+  protected static ByteBuffer userpass;
+  protected static final int port = 10194;
+  protected static final String testtable = "testtable";
+
+  @BeforeClass
+  public static void setup() throws Exception {
+    Properties prop = new Properties();
+    prop.setProperty("useMockInstance", "true");
+    prop.put("tokenClass", PasswordToken.class.getName());
+
+    proxy = Proxy.createProxyServer(HostAndPort.fromParts("localhost", port), new TCompactProtocol.Factory(), prop).server;
+    tpc = new TestProxyClient("localhost", port);
+    userpass = tpc.proxy().login("root", Collections.singletonMap("password", ""));
+  }
+
+  @AfterClass
+  public static void tearDown() throws InterruptedException {
+    proxy.stop();
+  }
+
+  @Before
+  public void makeTestTable() throws Exception {
+    tpc.proxy().createTable(userpass, testtable, true, TimeType.MILLIS);
+  }
+
+  @After
+  public void deleteTestTable() throws Exception {
+    tpc.proxy().deleteTable(userpass, testtable);
+  }
+
+  private static void addMutation(Map<ByteBuffer,List<ColumnUpdate>> mutations, String row, String cf, String cq, String value) {
+    ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap(cf.getBytes()), ByteBuffer.wrap(cq.getBytes()));
+    update.setValue(value.getBytes());
+    mutations.put(ByteBuffer.wrap(row.getBytes()), Collections.singletonList(update));
+  }
+
+  private static void addMutation(Map<ByteBuffer,List<ColumnUpdate>> mutations, String row, String cf, String cq, String vis, String value) {
+    ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap(cf.getBytes()), ByteBuffer.wrap(cq.getBytes()));
+    update.setValue(value.getBytes());
+    update.setColVisibility(vis.getBytes());
+    mutations.put(ByteBuffer.wrap(row.getBytes()), Collections.singletonList(update));
+  }
+
+  /**
+   * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a range so only the entries between -Inf...5 come back (there should be
+   * 50,000)
+   */
+  @Test
+  public void readWriteBatchOneShotWithRange() throws Exception {
+    int maxInserts = 100000;
+    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+    String format = "%1$05d";
+    for (int i = 0; i < maxInserts; i++) {
+      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
+
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+        tpc.proxy().updateAndFlush(userpass, testtable, mutations);
+        mutations.clear();
+      }
+    }
+
+    Key stop = new Key();
+    stop.setRow("5".getBytes());
+    BatchScanOptions options = new BatchScanOptions();
+    options.ranges = Collections.singletonList(new Range(null, false, stop, false));
+    String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options);
+
+    int i = 0;
+    boolean hasNext = true;
+
+    int k = 1000;
+    while (hasNext) {
+      ScanResult kvList = tpc.proxy().nextK(cookie, k);
+      i += kvList.getResultsSize();
+      hasNext = kvList.isMore();
+    }
+    assertEquals(i, 50000);
+  }
+
+  /**
+   * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a columnFamily so only the entries with specified column family come back
+   * (there should be 50,000)
+   */
+  @Test
+  public void readWriteBatchOneShotWithColumnFamilyOnly() throws Exception {
+    int maxInserts = 100000;
+    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+    String format = "%1$05d";
+    for (int i = 0; i < maxInserts; i++) {
+
+      addMutation(mutations, String.format(format, i), "cf" + (i % 2), "cq" + (i % 2), Util.randString(10));
+
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+        tpc.proxy().updateAndFlush(userpass, testtable, mutations);
+        mutations.clear();
+      }
+    }
+
+    BatchScanOptions options = new BatchScanOptions();
+
+    ScanColumn sc = new ScanColumn();
+    sc.colFamily = ByteBuffer.wrap("cf0".getBytes());
+
+    options.columns = Collections.singletonList(sc);
+    String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options);
+
+    int i = 0;
+    boolean hasNext = true;
+
+    int k = 1000;
+    while (hasNext) {
+      ScanResult kvList = tpc.proxy().nextK(cookie, k);
+      i += kvList.getResultsSize();
+      hasNext = kvList.isMore();
+    }
+    assertEquals(i, 50000);
+  }
+
+  /**
+   * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a columnFamily + columnQualififer so only the entries with specified column
+   * come back (there should be 50,000)
+   */
+  @Test
+  public void readWriteBatchOneShotWithFullColumn() throws Exception {
+    int maxInserts = 100000;
+    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+    String format = "%1$05d";
+    for (int i = 0; i < maxInserts; i++) {
+
+      addMutation(mutations, String.format(format, i), "cf" + (i % 2), "cq" + (i % 2), Util.randString(10));
+
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+        tpc.proxy().updateAndFlush(userpass, testtable, mutations);
+        mutations.clear();
+      }
+    }
+
+    BatchScanOptions options = new BatchScanOptions();
+
+    ScanColumn sc = new ScanColumn();
+    sc.colFamily = ByteBuffer.wrap("cf0".getBytes());
+    sc.colQualifier = ByteBuffer.wrap("cq0".getBytes());
+
+    options.columns = Collections.singletonList(sc);
+    String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options);
+
+    int i = 0;
+    boolean hasNext = true;
+
+    int k = 1000;
+    while (hasNext) {
+      ScanResult kvList = tpc.proxy().nextK(cookie, k);
+      i += kvList.getResultsSize();
+      hasNext = kvList.isMore();
+    }
+    assertEquals(i, 50000);
+  }
+
+  /**
+   * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Filter the results so only the even numbers come back.
+   */
+  @Test
+  public void readWriteBatchOneShotWithFilterIterator() throws Exception {
+    int maxInserts = 10000;
+    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+    String format = "%1$05d";
+    for (int i = 0; i < maxInserts; i++) {
+      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
+
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+        tpc.proxy().updateAndFlush(userpass, testtable, mutations);
+        mutations.clear();
+      }
+
+    }
+
+    String regex = ".*[02468]";
+
+    org.apache.accumulo.core.client.IteratorSetting is = new org.apache.accumulo.core.client.IteratorSetting(50, regex, RegExFilter.class);
+    RegExFilter.setRegexs(is, regex, null, null, null, false);
+
+    IteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
+    ScanOptions opts = new ScanOptions();
+    opts.iterators = Collections.singletonList(pis);
+    String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
+
+    int i = 0;
+    boolean hasNext = true;
+
+    int k = 1000;
+    while (hasNext) {
+      ScanResult kvList = tpc.proxy().nextK(cookie, k);
+      for (KeyValue kv : kvList.getResults()) {
+        assertEquals(Integer.parseInt(new String(kv.getKey().getRow())), i);
+
+        i += 2;
+      }
+      hasNext = kvList.isMore();
+    }
+  }
+
+  @Test
+  public void readWriteOneShotWithRange() throws Exception {
+    int maxInserts = 100000;
+    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+    String format = "%1$05d";
+    for (int i = 0; i < maxInserts; i++) {
+      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
+
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+        tpc.proxy().updateAndFlush(userpass, testtable, mutations);
+        mutations.clear();
+      }
+    }
+
+    Key stop = new Key();
+    stop.setRow("5".getBytes());
+    ScanOptions opts = new ScanOptions();
+    opts.range = new Range(null, false, stop, false);
+    String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
+
+    int i = 0;
+    boolean hasNext = true;
+
+    int k = 1000;
+    while (hasNext) {
+      ScanResult kvList = tpc.proxy().nextK(cookie, k);
+      i += kvList.getResultsSize();
+      hasNext = kvList.isMore();
+    }
+    assertEquals(i, 50000);
+  }
+
+  /**
+   * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Filter the results so only the even numbers come back.
+   */
+  @Test
+  public void readWriteOneShotWithFilterIterator() throws Exception {
+    int maxInserts = 10000;
+    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+    String format = "%1$05d";
+    for (int i = 0; i < maxInserts; i++) {
+      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
+
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+
+        tpc.proxy().updateAndFlush(userpass, testtable, mutations);
+        mutations.clear();
+
+      }
+
+    }
+
+    String regex = ".*[02468]";
+
+    org.apache.accumulo.core.client.IteratorSetting is = new org.apache.accumulo.core.client.IteratorSetting(50, regex, RegExFilter.class);
+    RegExFilter.setRegexs(is, regex, null, null, null, false);
+
+    IteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
+    ScanOptions opts = new ScanOptions();
+    opts.iterators = Collections.singletonList(pis);
+    String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
+
+    int i = 0;
+    boolean hasNext = true;
+
+    int k = 1000;
+    while (hasNext) {
+      ScanResult kvList = tpc.proxy().nextK(cookie, k);
+      for (KeyValue kv : kvList.getResults()) {
+        assertEquals(Integer.parseInt(new String(kv.getKey().getRow())), i);
+
+        i += 2;
+      }
+      hasNext = kvList.isMore();
+    }
+  }
+
+  // @Test
+  // This test takes kind of a long time. Enable it if you think you may have memory issues.
+  public void manyWritesAndReads() throws Exception {
+    int maxInserts = 1000000;
+    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+    String format = "%1$06d";
+    String writer = tpc.proxy().createWriter(userpass, testtable, null);
+    for (int i = 0; i < maxInserts; i++) {
+      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
+
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+
+        tpc.proxy().update(writer, mutations);
+        mutations.clear();
+
+      }
+
+    }
+
+    tpc.proxy().flush(writer);
+    tpc.proxy().closeWriter(writer);
+
+    String cookie = tpc.proxy().createScanner(userpass, testtable, null);
+
+    int i = 0;
+    boolean hasNext = true;
+
+    int k = 1000;
+    while (hasNext) {
+      ScanResult kvList = tpc.proxy().nextK(cookie, k);
+      for (KeyValue kv : kvList.getResults()) {
+        assertEquals(Integer.parseInt(new String(kv.getKey().getRow())), i);
+        i++;
+      }
+      hasNext = kvList.isMore();
+      if (hasNext)
+        assertEquals(k, kvList.getResults().size());
+    }
+    assertEquals(maxInserts, i);
+  }
+
+  @Test
+  public void asynchReadWrite() throws Exception {
+    int maxInserts = 10000;
+    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+    String format = "%1$05d";
+    String writer = tpc.proxy().createWriter(userpass, testtable, null);
+    for (int i = 0; i < maxInserts; i++) {
+      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
+
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+        tpc.proxy().update(writer, mutations);
+        mutations.clear();
+      }
+    }
+
+    tpc.proxy().flush(writer);
+    tpc.proxy().closeWriter(writer);
+
+    String regex = ".*[02468]";
+
+    org.apache.accumulo.core.client.IteratorSetting is = new org.apache.accumulo.core.client.IteratorSetting(50, regex, RegExFilter.class);
+    RegExFilter.setRegexs(is, regex, null, null, null, false);
+
+    IteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
+    ScanOptions opts = new ScanOptions();
+    opts.iterators = Collections.singletonList(pis);
+    String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
+
+    int i = 0;
+    boolean hasNext = true;
+
+    int k = 1000;
+    int numRead = 0;
+    while (hasNext) {
+      ScanResult kvList = tpc.proxy().nextK(cookie, k);
+      for (KeyValue kv : kvList.getResults()) {
+        assertEquals(i, Integer.parseInt(new String(kv.getKey().getRow())));
+        numRead++;
+        i += 2;
+      }
+      hasNext = kvList.isMore();
+    }
+    assertEquals(maxInserts / 2, numRead);
+  }
+
+  @Test
+  public void testVisibility() throws Exception {
+
+    Set<ByteBuffer> auths = new HashSet<ByteBuffer>();
+    auths.add(ByteBuffer.wrap("even".getBytes()));
+    tpc.proxy().changeUserAuthorizations(userpass, "root", auths);
+
+    int maxInserts = 10000;
+    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+    String format = "%1$05d";
+    String writer = tpc.proxy().createWriter(userpass, testtable, null);
+    for (int i = 0; i < maxInserts; i++) {
+      if (i % 2 == 0)
+        addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, "even", Util.randString(10));
+      else
+        addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, "odd", Util.randString(10));
+
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+        tpc.proxy().update(writer, mutations);
+        mutations.clear();
+      }
+    }
+
+    tpc.proxy().flush(writer);
+    tpc.proxy().closeWriter(writer);
+    ScanOptions opts = new ScanOptions();
+    opts.authorizations = auths;
+    String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
+
+    int i = 0;
+    boolean hasNext = true;
+
+    int k = 1000;
+    int numRead = 0;
+    while (hasNext) {
+      ScanResult kvList = tpc.proxy().nextK(cookie, k);
+      for (KeyValue kv : kvList.getResults()) {
+        assertEquals(Integer.parseInt(new String(kv.getKey().getRow())), i);
+        i += 2;
+        numRead++;
+      }
+      hasNext = kvList.isMore();
+
+    }
+    assertEquals(maxInserts / 2, numRead);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/test/proxy/TestProxySecurityOperations.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/proxy/TestProxySecurityOperations.java b/test/src/test/java/org/apache/accumulo/test/proxy/TestProxySecurityOperations.java
new file mode 100644
index 0000000..eda38e5
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/proxy/TestProxySecurityOperations.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.util.ByteBufferUtil;
+import org.apache.accumulo.proxy.Proxy;
+import org.apache.accumulo.proxy.thrift.SystemPermission;
+import org.apache.accumulo.proxy.thrift.TablePermission;
+import org.apache.accumulo.proxy.thrift.TimeType;
+import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TCompactProtocol;
+import org.apache.thrift.server.TServer;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.google.common.net.HostAndPort;
+
+public class TestProxySecurityOperations {
+  protected static TServer proxy;
+  protected static TestProxyClient tpc;
+  protected static ByteBuffer userpass;
+  protected static final int port = 10196;
+  protected static final String testtable = "testtable";
+  protected static final String testuser = "VonJines";
+  protected static final ByteBuffer testpw = ByteBuffer.wrap("fiveones".getBytes());
+
+  @BeforeClass
+  public static void setup() throws Exception {
+    Properties prop = new Properties();
+    prop.setProperty("useMockInstance", "true");
+    prop.put("tokenClass", PasswordToken.class.getName());
+
+    proxy = Proxy.createProxyServer(HostAndPort.fromParts("localhost", port), new TCompactProtocol.Factory(), prop).server;
+    while (!proxy.isServing()) {
+      Thread.sleep(500);
+    }
+    tpc = new TestProxyClient("localhost", port);
+    userpass = tpc.proxy().login("root", Collections.singletonMap("password", ""));
+  }
+
+  @AfterClass
+  public static void tearDown() throws InterruptedException {
+    proxy.stop();
+  }
+
+  @Before
+  public void makeTestTableAndUser() throws Exception {
+    tpc.proxy().createTable(userpass, testtable, true, TimeType.MILLIS);
+    tpc.proxy().createLocalUser(userpass, testuser, testpw);
+  }
+
+  @After
+  public void deleteTestTable() throws Exception {
+    tpc.proxy().deleteTable(userpass, testtable);
+    tpc.proxy().dropLocalUser(userpass, testuser);
+  }
+
+  @Test
+  public void create() throws TException {
+    tpc.proxy().createLocalUser(userpass, testuser + "2", testpw);
+    assertTrue(tpc.proxy().listLocalUsers(userpass).contains(testuser + "2"));
+    tpc.proxy().dropLocalUser(userpass, testuser + "2");
+    assertTrue(!tpc.proxy().listLocalUsers(userpass).contains(testuser + "2"));
+  }
+
+  @Test
+  public void authenticate() throws TException {
+    assertTrue(tpc.proxy().authenticateUser(userpass, testuser, bb2pp(testpw)));
+    assertFalse(tpc.proxy().authenticateUser(userpass, "EvilUser", bb2pp(testpw)));
+
+    tpc.proxy().changeLocalUserPassword(userpass, testuser, ByteBuffer.wrap("newpass".getBytes()));
+    assertFalse(tpc.proxy().authenticateUser(userpass, testuser, bb2pp(testpw)));
+    assertTrue(tpc.proxy().authenticateUser(userpass, testuser, bb2pp(ByteBuffer.wrap("newpass".getBytes()))));
+
+  }
+
+  @Test
+  public void tablePermissions() throws TException {
+    tpc.proxy().grantTablePermission(userpass, testuser, testtable, TablePermission.ALTER_TABLE);
+    assertTrue(tpc.proxy().hasTablePermission(userpass, testuser, testtable, TablePermission.ALTER_TABLE));
+
+    tpc.proxy().revokeTablePermission(userpass, testuser, testtable, TablePermission.ALTER_TABLE);
+    assertFalse(tpc.proxy().hasTablePermission(userpass, testuser, testtable, TablePermission.ALTER_TABLE));
+
+  }
+
+  @Test
+  public void systemPermissions() throws TException {
+    tpc.proxy().grantSystemPermission(userpass, testuser, SystemPermission.ALTER_USER);
+    assertTrue(tpc.proxy().hasSystemPermission(userpass, testuser, SystemPermission.ALTER_USER));
+
+    tpc.proxy().revokeSystemPermission(userpass, testuser, SystemPermission.ALTER_USER);
+    assertFalse(tpc.proxy().hasSystemPermission(userpass, testuser, SystemPermission.ALTER_USER));
+
+  }
+
+  @Test
+  public void auths() throws TException {
+    HashSet<ByteBuffer> newauths = new HashSet<ByteBuffer>();
+    newauths.add(ByteBuffer.wrap("BBR".getBytes()));
+    newauths.add(ByteBuffer.wrap("Barney".getBytes()));
+    tpc.proxy().changeUserAuthorizations(userpass, testuser, newauths);
+    List<ByteBuffer> actualauths = tpc.proxy().getUserAuthorizations(userpass, testuser);
+    assertEquals(actualauths.size(), newauths.size());
+
+    for (ByteBuffer auth : actualauths) {
+      assertTrue(newauths.contains(auth));
+    }
+  }
+
+  private Map<String,String> bb2pp(ByteBuffer cf) {
+    Map<String,String> toRet = new TreeMap<String,String>();
+    toRet.put("password", ByteBufferUtil.toString(cf));
+    return toRet;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyTableOperations.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyTableOperations.java b/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyTableOperations.java
new file mode 100644
index 0000000..e8d7b1e
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyTableOperations.java
@@ -0,0 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.proxy.Proxy;
+import org.apache.accumulo.proxy.thrift.ColumnUpdate;
+import org.apache.accumulo.proxy.thrift.TimeType;
+import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TCompactProtocol;
+import org.apache.thrift.server.TServer;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.google.common.net.HostAndPort;
+
+public class TestProxyTableOperations {
+
+  protected static TServer proxy;
+  protected static TestProxyClient tpc;
+  protected static ByteBuffer userpass;
+  protected static final int port = 10195;
+  protected static final String testtable = "testtable";
+
+  @BeforeClass
+  public static void setup() throws Exception {
+    Properties prop = new Properties();
+    prop.setProperty("useMockInstance", "true");
+    prop.put("tokenClass", PasswordToken.class.getName());
+
+    proxy = Proxy.createProxyServer(HostAndPort.fromParts("localhost", port), new TCompactProtocol.Factory(), prop).server;
+    while (!proxy.isServing()) {
+      Thread.sleep(500);
+    }
+    tpc = new TestProxyClient("localhost", port);
+    userpass = tpc.proxy().login("root", Collections.singletonMap("password", ""));
+  }
+
+  @AfterClass
+  public static void tearDown() throws InterruptedException {
+    proxy.stop();
+  }
+
+  @Before
+  public void makeTestTable() throws Exception {
+    tpc.proxy().createTable(userpass, testtable, true, TimeType.MILLIS);
+  }
+
+  @After
+  public void deleteTestTable() throws Exception {
+    tpc.proxy().deleteTable(userpass, testtable);
+  }
+
+  @Test
+  public void createExistsDelete() throws TException {
+    assertFalse(tpc.proxy().tableExists(userpass, "testtable2"));
+    tpc.proxy().createTable(userpass, "testtable2", true, TimeType.MILLIS);
+    assertTrue(tpc.proxy().tableExists(userpass, "testtable2"));
+    tpc.proxy().deleteTable(userpass, "testtable2");
+    assertFalse(tpc.proxy().tableExists(userpass, "testtable2"));
+  }
+
+  @Test
+  public void listRename() throws TException {
+    assertFalse(tpc.proxy().tableExists(userpass, "testtable2"));
+    tpc.proxy().renameTable(userpass, testtable, "testtable2");
+    assertTrue(tpc.proxy().tableExists(userpass, "testtable2"));
+    tpc.proxy().renameTable(userpass, "testtable2", testtable);
+    assertTrue(tpc.proxy().listTables(userpass).contains("testtable"));
+
+  }
+
+  // This test does not yet function because the backing Mock instance does not yet support merging
+  @Test
+  public void merge() throws TException {
+    Set<ByteBuffer> splits = new HashSet<ByteBuffer>();
+    splits.add(ByteBuffer.wrap("a".getBytes()));
+    splits.add(ByteBuffer.wrap("c".getBytes()));
+    splits.add(ByteBuffer.wrap("z".getBytes()));
+    tpc.proxy().addSplits(userpass, testtable, splits);
+
+    tpc.proxy().mergeTablets(userpass, testtable, ByteBuffer.wrap("b".getBytes()), ByteBuffer.wrap("d".getBytes()));
+
+    splits.remove(ByteBuffer.wrap("c".getBytes()));
+
+    List<ByteBuffer> tableSplits = tpc.proxy().listSplits(userpass, testtable, 10);
+
+    for (ByteBuffer split : tableSplits)
+      assertTrue(splits.contains(split));
+    assertTrue(tableSplits.size() == splits.size());
+
+  }
+
+  @Test
+  public void splits() throws TException {
+    Set<ByteBuffer> splits = new HashSet<ByteBuffer>();
+    splits.add(ByteBuffer.wrap("a".getBytes()));
+    splits.add(ByteBuffer.wrap("b".getBytes()));
+    splits.add(ByteBuffer.wrap("z".getBytes()));
+    tpc.proxy().addSplits(userpass, testtable, splits);
+
+    List<ByteBuffer> tableSplits = tpc.proxy().listSplits(userpass, testtable, 10);
+
+    for (ByteBuffer split : tableSplits)
+      assertTrue(splits.contains(split));
+    assertTrue(tableSplits.size() == splits.size());
+  }
+
+  @Test
+  public void constraints() throws TException {
+    int cid = tpc.proxy().addConstraint(userpass, testtable, "org.apache.accumulo.TestConstraint");
+    Map<String,Integer> constraints = tpc.proxy().listConstraints(userpass, testtable);
+    assertEquals((int) constraints.get("org.apache.accumulo.TestConstraint"), cid);
+    tpc.proxy().removeConstraint(userpass, testtable, cid);
+    constraints = tpc.proxy().listConstraints(userpass, testtable);
+    assertNull(constraints.get("org.apache.accumulo.TestConstraint"));
+  }
+
+  @Test
+  public void localityGroups() throws TException {
+    Map<String,Set<String>> groups = new HashMap<String,Set<String>>();
+    Set<String> group1 = new HashSet<String>();
+    group1.add("cf1");
+    groups.put("group1", group1);
+    Set<String> group2 = new HashSet<String>();
+    group2.add("cf2");
+    group2.add("cf3");
+    groups.put("group2", group2);
+    tpc.proxy().setLocalityGroups(userpass, testtable, groups);
+
+    Map<String,Set<String>> actualGroups = tpc.proxy().getLocalityGroups(userpass, testtable);
+
+    assertEquals(groups.size(), actualGroups.size());
+    for (String groupName : groups.keySet()) {
+      assertTrue(actualGroups.containsKey(groupName));
+      assertEquals(groups.get(groupName).size(), actualGroups.get(groupName).size());
+      for (String cf : groups.get(groupName)) {
+        assertTrue(actualGroups.get(groupName).contains(cf));
+      }
+    }
+  }
+
+  @Test
+  public void tableProperties() throws TException {
+    tpc.proxy().setTableProperty(userpass, testtable, "test.property1", "wharrrgarbl");
+    assertEquals(tpc.proxy().getTableProperties(userpass, testtable).get("test.property1"), "wharrrgarbl");
+    tpc.proxy().removeTableProperty(userpass, testtable, "test.property1");
+    assertNull(tpc.proxy().getTableProperties(userpass, testtable).get("test.property1"));
+  }
+
+  private static void addMutation(Map<ByteBuffer,List<ColumnUpdate>> mutations, String row, String cf, String cq, String value) {
+    ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap(cf.getBytes()), ByteBuffer.wrap(cq.getBytes()));
+    update.setValue(value.getBytes());
+    mutations.put(ByteBuffer.wrap(row.getBytes()), Collections.singletonList(update));
+  }
+
+  @Test
+  public void tableOperationsRowMethods() throws TException {
+    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+    for (int i = 0; i < 10; i++) {
+      addMutation(mutations, "" + i, "cf", "cq", "");
+    }
+    tpc.proxy().updateAndFlush(userpass, testtable, mutations);
+
+    assertEquals(tpc.proxy().getMaxRow(userpass, testtable, null, null, true, null, true), ByteBuffer.wrap("9".getBytes()));
+
+    tpc.proxy().deleteRows(userpass, testtable, ByteBuffer.wrap("51".getBytes()), ByteBuffer.wrap("99".getBytes()));
+    assertEquals(tpc.proxy().getMaxRow(userpass, testtable, null, null, true, null, true), ByteBuffer.wrap("5".getBytes()));
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/test/server/security/SystemCredentialsIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/server/security/SystemCredentialsIT.java b/test/src/test/java/org/apache/accumulo/test/server/security/SystemCredentialsIT.java
new file mode 100644
index 0000000..7167f6a
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/server/security/SystemCredentialsIT.java
@@ -0,0 +1,233 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.server.security;
+
+import static org.junit.Assert.assertEquals;
+
+import java.nio.ByteBuffer;
+import java.util.List;
+import java.util.Map.Entry;
+
+import org.apache.accumulo.core.client.AccumuloException;
+import org.apache.accumulo.core.client.AccumuloSecurityException;
+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.impl.Credentials;
+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.conf.AccumuloConfiguration;
+import org.apache.accumulo.core.data.Key;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.metadata.RootTable;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.server.client.HdfsZooInstance;
+import org.apache.accumulo.server.security.SystemCredentials;
+import org.apache.accumulo.test.functional.ConfigurableMacIT;
+import org.junit.Test;
+
+public class SystemCredentialsIT extends ConfigurableMacIT {
+
+  private static final int FAIL_CODE = 7, BAD_PASSWD_FAIL_CODE = 8;
+
+  @Override
+  protected int defaultTimeoutSeconds() {
+    return 1 * 60;
+  }
+
+  @Test
+  public void testSystemCredentials() throws Exception {
+    assertEquals(0, exec(SystemCredentialsIT.class, "good", getCluster().getZooKeepers()).waitFor());
+    assertEquals(FAIL_CODE, exec(SystemCredentialsIT.class, "bad", getCluster().getZooKeepers()).waitFor());
+    assertEquals(BAD_PASSWD_FAIL_CODE, exec(SystemCredentialsIT.class, "bad_password", getCluster().getZooKeepers()).waitFor());
+  }
+
+  public static void main(final String[] args) throws AccumuloException, TableNotFoundException, AccumuloSecurityException {
+    Credentials creds = null;
+    if (args.length < 2)
+      throw new RuntimeException("Incorrect usage; expected to be run by test only");
+    if (args[0].equals("bad")) {
+      Instance inst = new Instance() {
+
+        @Deprecated
+        @Override
+        public void setConfiguration(AccumuloConfiguration conf) {
+          throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public int getZooKeepersSessionTimeOut() {
+          throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public String getZooKeepers() {
+          throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public String getRootTabletLocation() {
+          throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public List<String> getMasterLocations() {
+          throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public String getInstanceName() {
+          throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public String getInstanceID() {
+          return SystemCredentials.class.getName();
+        }
+
+        @Override
+        public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
+          throw new UnsupportedOperationException();
+        }
+
+        @Deprecated
+        @Override
+        public Connector getConnector(String user, CharSequence pass) throws AccumuloException, AccumuloSecurityException {
+          throw new UnsupportedOperationException();
+        }
+
+        @Deprecated
+        @Override
+        public Connector getConnector(String user, ByteBuffer pass) throws AccumuloException, AccumuloSecurityException {
+          throw new UnsupportedOperationException();
+        }
+
+        @Deprecated
+        @Override
+        public Connector getConnector(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException {
+          throw new UnsupportedOperationException();
+        }
+
+        @Deprecated
+        @Override
+        public AccumuloConfiguration getConfiguration() {
+          throw new UnsupportedOperationException();
+        }
+
+      };
+      creds = SystemCredentials.get(inst);
+    } else if (args[0].equals("good")) {
+      creds = SystemCredentials.get(HdfsZooInstance.getInstance());
+    } else if (args[0].equals("bad_password")) {
+      Instance inst = new Instance() {
+
+        @Override
+        public int getZooKeepersSessionTimeOut() {
+          throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public String getZooKeepers() {
+          throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public String getRootTabletLocation() {
+          throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public List<String> getMasterLocations() {
+          throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public String getInstanceName() {
+          throw new UnsupportedOperationException();
+        }
+
+        @Override
+        public String getInstanceID() {
+          return SystemCredentials.class.getName();
+        }
+
+        @Override
+        public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
+          throw new UnsupportedOperationException();
+        }
+
+        @Deprecated
+        @Override
+        public Connector getConnector(String user, CharSequence pass) throws AccumuloException, AccumuloSecurityException {
+          throw new UnsupportedOperationException();
+        }
+
+        @Deprecated
+        @Override
+        public Connector getConnector(String user, ByteBuffer pass) throws AccumuloException, AccumuloSecurityException {
+          throw new UnsupportedOperationException();
+        }
+
+        @Deprecated
+        @Override
+        public Connector getConnector(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException {
+          throw new UnsupportedOperationException();
+        }
+
+        @Deprecated
+        @Override
+        public AccumuloConfiguration getConfiguration() {
+          throw new UnsupportedOperationException();
+        }
+
+        @Deprecated
+        @Override
+        public void setConfiguration(AccumuloConfiguration conf) {
+          throw new UnsupportedOperationException();
+        }
+
+      };
+      creds = new SystemCredentials(inst, "!SYSTEM", new PasswordToken("fake"));
+    } else {
+      throw new RuntimeException("Incorrect usage; expected to be run by test only");
+    }
+    Instance instance = HdfsZooInstance.getInstance();
+    Connector conn;
+    try {
+      conn = instance.getConnector(creds.getPrincipal(), creds.getToken());
+    } catch (AccumuloSecurityException e) {
+      e.printStackTrace(System.err);
+      System.exit(BAD_PASSWD_FAIL_CODE);
+      return;
+    }
+    try {
+      Scanner scan = conn.createScanner(RootTable.NAME, Authorizations.EMPTY);
+      for (Entry<Key,Value> e : scan) {
+        e.hashCode();
+      }
+    } catch (RuntimeException e) {
+      // catch the runtime exception from the scanner iterator
+      if (e.getCause() instanceof AccumuloSecurityException
+          && ((AccumuloSecurityException) e.getCause()).getSecurityErrorCode() == SecurityErrorCode.BAD_CREDENTIALS) {
+        e.printStackTrace(System.err);
+        System.exit(FAIL_CODE);
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/test/start/KeywordStartIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/start/KeywordStartIT.java b/test/src/test/java/org/apache/accumulo/test/start/KeywordStartIT.java
new file mode 100644
index 0000000..f7f250a
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/start/KeywordStartIT.java
@@ -0,0 +1,197 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.start;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
+import org.apache.accumulo.core.file.rfile.PrintInfo;
+import org.apache.accumulo.core.util.Classpath;
+import org.apache.accumulo.core.util.CreateToken;
+import org.apache.accumulo.core.util.Help;
+import org.apache.accumulo.core.util.Jar;
+import org.apache.accumulo.core.util.Version;
+import org.apache.accumulo.gc.GCExecutable;
+import org.apache.accumulo.gc.SimpleGarbageCollector;
+import org.apache.accumulo.master.Master;
+import org.apache.accumulo.master.MasterExecutable;
+import org.apache.accumulo.minicluster.MiniAccumuloRunner;
+import org.apache.accumulo.minicluster.impl.MiniClusterExecutable;
+import org.apache.accumulo.monitor.Monitor;
+import org.apache.accumulo.monitor.MonitorExecutable;
+import org.apache.accumulo.proxy.Proxy;
+import org.apache.accumulo.server.init.Initialize;
+import org.apache.accumulo.server.util.Admin;
+import org.apache.accumulo.server.util.Info;
+import org.apache.accumulo.server.util.LoginProperties;
+import org.apache.accumulo.server.util.ZooKeeperMain;
+import org.apache.accumulo.shell.Shell;
+import org.apache.accumulo.start.Main;
+import org.apache.accumulo.start.spi.KeywordExecutable;
+import org.apache.accumulo.tracer.TraceServer;
+import org.apache.accumulo.tracer.TracerExecutable;
+import org.apache.accumulo.tserver.TServerExecutable;
+import org.apache.accumulo.tserver.TabletServer;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class KeywordStartIT {
+
+  private final Logger log = LoggerFactory.getLogger(getClass());
+
+  @Test
+  public void testKeywordsMatch() throws IOException {
+    for (Entry<String,KeywordExecutable> entry : Main.getExecutables(getClass().getClassLoader()).entrySet()) {
+      assertEquals(entry.getKey(), entry.getValue().keyword());
+    }
+  }
+
+  @Test
+  public void testCheckDuplicates() {
+    NoOp one = new NoOp("one");
+    NoOp anotherOne = new NoOp("another");
+    NoOp two = new NoOp("two");
+    NoOp three = new NoOp("three");
+    List<NoOp> services = Arrays.asList(one, three, two, two, three, three, anotherOne);
+    assertEquals(7, services.size());
+    Map<String,KeywordExecutable> results = Main.checkDuplicates(services);
+    assertTrue(results.containsKey(one.keyword()));
+    assertTrue(results.containsKey(anotherOne.keyword()));
+    assertFalse(results.containsKey(two.keyword()));
+    assertFalse(results.containsKey(three.keyword()));
+    assertEquals(2, results.size());
+  }
+
+  // Note: this test may fail in Eclipse, if the services files haven't been generated by the AutoService annotation processor
+  @Test
+  public void testExpectedClasses() throws IOException {
+    TreeMap<String,Class<? extends KeywordExecutable>> expectSet = new TreeMap<>();
+    expectSet.put("admin", Admin.class);
+    expectSet.put("classpath", Classpath.class);
+    expectSet.put("create-token", CreateToken.class);
+    expectSet.put("gc", GCExecutable.class);
+    expectSet.put("help", Help.class);
+    expectSet.put("info", Info.class);
+    expectSet.put("init", Initialize.class);
+    expectSet.put("jar", Jar.class);
+    expectSet.put("login-info", LoginProperties.class);
+    expectSet.put("master", MasterExecutable.class);
+    expectSet.put("minicluster", MiniClusterExecutable.class);
+    expectSet.put("monitor", MonitorExecutable.class);
+    expectSet.put("proxy", Proxy.class);
+    expectSet.put("rfile-info", PrintInfo.class);
+    expectSet.put("shell", Shell.class);
+    expectSet.put("tracer", TracerExecutable.class);
+    expectSet.put("tserver", TServerExecutable.class);
+    expectSet.put("version", Version.class);
+    expectSet.put("zookeeper", ZooKeeperMain.class);
+
+    Iterator<Entry<String,Class<? extends KeywordExecutable>>> expectIter = expectSet.entrySet().iterator();
+    TreeMap<String,KeywordExecutable> actualSet = new TreeMap<>(Main.getExecutables(getClass().getClassLoader()));
+    Iterator<Entry<String,KeywordExecutable>> actualIter = actualSet.entrySet().iterator();
+    Entry<String,Class<? extends KeywordExecutable>> expected;
+    Entry<String,KeywordExecutable> actual;
+    while (expectIter.hasNext() && actualIter.hasNext()) {
+      expected = expectIter.next();
+      actual = actualIter.next();
+      assertEquals(expected.getKey(), actual.getKey());
+      assertEquals(expected.getValue(), actual.getValue().getClass());
+    }
+    boolean moreExpected = expectIter.hasNext();
+    if (moreExpected) {
+      while (expectIter.hasNext()) {
+        log.warn("Missing class for keyword '" + expectIter.next() + "'");
+      }
+    }
+    assertFalse("Missing expected classes", moreExpected);
+    boolean moreActual = actualIter.hasNext();
+    if (moreActual) {
+      while (actualIter.hasNext()) {
+        log.warn("Extra class found with keyword '" + actualIter.next() + "'");
+      }
+    }
+    assertFalse("Found additional unexpected classes", moreActual);
+  }
+
+  @Test
+  public void checkHasMain() {
+    assertFalse("Sanity check for test failed. Somehow the test class has a main method", hasMain(this.getClass()));
+
+    HashSet<Class<?>> expectSet = new HashSet<>();
+    expectSet.add(Admin.class);
+    expectSet.add(CreateToken.class);
+    expectSet.add(Info.class);
+    expectSet.add(Initialize.class);
+    expectSet.add(LoginProperties.class);
+    expectSet.add(Master.class);
+    expectSet.add(MiniAccumuloRunner.class);
+    expectSet.add(Monitor.class);
+    expectSet.add(PrintInfo.class);
+    expectSet.add(Proxy.class);
+    expectSet.add(Shell.class);
+    expectSet.add(SimpleGarbageCollector.class);
+    expectSet.add(TabletServer.class);
+    expectSet.add(TraceServer.class);
+    expectSet.add(ZooKeeperMain.class);
+
+    for (Class<?> c : expectSet) {
+      assertTrue("Class " + c.getName() + " is missing a main method!", hasMain(c));
+    }
+
+  }
+
+  private static boolean hasMain(Class<?> classToCheck) {
+    Method main;
+    try {
+      main = classToCheck.getMethod("main", new String[0].getClass());
+    } catch (NoSuchMethodException e) {
+      return false;
+    }
+    return main != null && Modifier.isPublic(main.getModifiers()) && Modifier.isStatic(main.getModifiers());
+  }
+
+  private static class NoOp implements KeywordExecutable {
+
+    private final String kw;
+
+    public NoOp(String kw) {
+      this.kw = kw;
+    }
+
+    @Override
+    public String keyword() {
+      return kw;
+    }
+
+    @Override
+    public void execute(String[] args) throws Exception {}
+
+  }
+}


[2/5] accumulo git commit: ACCUMULO-3804 Always seal jars

Posted by ct...@apache.org.
http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java b/test/src/test/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java
new file mode 100644
index 0000000..03cb784
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java
@@ -0,0 +1,1620 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.nio.ByteBuffer;
+import java.nio.file.Files;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.UUID;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
+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.Value;
+import org.apache.accumulo.core.file.FileOperations;
+import org.apache.accumulo.core.file.FileSKVWriter;
+import org.apache.accumulo.core.iterators.DevNull;
+import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
+import org.apache.accumulo.core.iterators.user.SummingCombiner;
+import org.apache.accumulo.core.iterators.user.VersioningIterator;
+import org.apache.accumulo.core.metadata.MetadataTable;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.ByteBufferUtil;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.examples.simple.constraints.NumericValueConstraint;
+import org.apache.accumulo.harness.SharedMiniClusterIT;
+import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl;
+import org.apache.accumulo.proxy.Proxy;
+import org.apache.accumulo.proxy.thrift.AccumuloProxy.Client;
+import org.apache.accumulo.proxy.thrift.AccumuloSecurityException;
+import org.apache.accumulo.proxy.thrift.ActiveCompaction;
+import org.apache.accumulo.proxy.thrift.ActiveScan;
+import org.apache.accumulo.proxy.thrift.BatchScanOptions;
+import org.apache.accumulo.proxy.thrift.Column;
+import org.apache.accumulo.proxy.thrift.ColumnUpdate;
+import org.apache.accumulo.proxy.thrift.CompactionReason;
+import org.apache.accumulo.proxy.thrift.CompactionStrategyConfig;
+import org.apache.accumulo.proxy.thrift.CompactionType;
+import org.apache.accumulo.proxy.thrift.Condition;
+import org.apache.accumulo.proxy.thrift.ConditionalStatus;
+import org.apache.accumulo.proxy.thrift.ConditionalUpdates;
+import org.apache.accumulo.proxy.thrift.ConditionalWriterOptions;
+import org.apache.accumulo.proxy.thrift.DiskUsage;
+import org.apache.accumulo.proxy.thrift.IteratorScope;
+import org.apache.accumulo.proxy.thrift.IteratorSetting;
+import org.apache.accumulo.proxy.thrift.Key;
+import org.apache.accumulo.proxy.thrift.KeyValue;
+import org.apache.accumulo.proxy.thrift.MutationsRejectedException;
+import org.apache.accumulo.proxy.thrift.PartialKey;
+import org.apache.accumulo.proxy.thrift.Range;
+import org.apache.accumulo.proxy.thrift.ScanColumn;
+import org.apache.accumulo.proxy.thrift.ScanOptions;
+import org.apache.accumulo.proxy.thrift.ScanResult;
+import org.apache.accumulo.proxy.thrift.ScanState;
+import org.apache.accumulo.proxy.thrift.ScanType;
+import org.apache.accumulo.proxy.thrift.SystemPermission;
+import org.apache.accumulo.proxy.thrift.TableExistsException;
+import org.apache.accumulo.proxy.thrift.TableNotFoundException;
+import org.apache.accumulo.proxy.thrift.TablePermission;
+import org.apache.accumulo.proxy.thrift.TimeType;
+import org.apache.accumulo.proxy.thrift.UnknownScanner;
+import org.apache.accumulo.proxy.thrift.UnknownWriter;
+import org.apache.accumulo.proxy.thrift.WriterOptions;
+import org.apache.accumulo.server.util.PortUtils;
+import org.apache.accumulo.test.functional.SlowIterator;
+import org.apache.hadoop.fs.FSDataInputStream;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.FileUtil;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.io.Text;
+import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TProtocolFactory;
+import org.apache.thrift.server.TServer;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.common.collect.Iterators;
+import com.google.common.net.HostAndPort;
+
+/**
+ * Call every method on the proxy and try to verify that it works.
+ */
+public abstract class SimpleProxyBase extends SharedMiniClusterIT {
+
+  @Override
+  protected int defaultTimeoutSeconds() {
+    return 10 * 60;
+  }
+
+  private static final long ZOOKEEPER_PROPAGATION_TIME = 10 * 1000;
+  private TServer proxyServer;
+  private int proxyPort;
+  private org.apache.accumulo.proxy.thrift.AccumuloProxy.Client client;
+
+  private Map<String,String> properties = new HashMap<>();
+  private ByteBuffer creds = null;
+
+  private void waitForAccumulo(Connector c) throws Exception {
+    Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
+  }
+
+  @Before
+  public void setUpProxy() throws Exception {
+    Connector c = SharedMiniClusterIT.getConnector();
+    Instance inst = c.getInstance();
+    waitForAccumulo(c);
+
+    Properties props = new Properties();
+    props.put("instance", inst.getInstanceName());
+    props.put("zookeepers", inst.getZooKeepers());
+    props.put("tokenClass", PasswordToken.class.getName());
+    // Avoid issues with locally installed client configuration files with custom properties
+    File emptyFile = Files.createTempFile(null, null).toFile();
+    emptyFile.deleteOnExit();
+    props.put("clientConfigurationFile", emptyFile.toString());
+
+    properties.put("password", SharedMiniClusterIT.getRootPassword());
+    properties.put("clientConfigurationFile", emptyFile.toString());
+
+    proxyPort = PortUtils.getRandomFreePort();
+    TProtocolFactory factory = getProtocol();
+    proxyServer = Proxy.createProxyServer(HostAndPort.fromParts("localhost", proxyPort), factory, props).server;
+    while (!proxyServer.isServing())
+      UtilWaitThread.sleep(100);
+    client = new TestProxyClient("localhost", proxyPort, factory).proxy();
+    creds = client.login("root", properties);
+  }
+
+  @After
+  public void tearDownProxy() throws Exception {
+    if (null != proxyServer) {
+      proxyServer.stop();
+    }
+  }
+
+  public abstract TProtocolFactory getProtocol();
+
+  @Test
+  public void security() throws Exception {
+    client.createLocalUser(creds, "user", s2bb(SharedMiniClusterIT.getRootPassword()));
+    ByteBuffer badLogin = client.login("user", properties);
+    client.dropLocalUser(creds, "user");
+    final String table = getUniqueNames(1)[0];
+    client.createTable(creds, table, false, TimeType.MILLIS);
+
+    final IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "200"));
+
+    try {
+      client.addConstraint(badLogin, table, NumericValueConstraint.class.getName());
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.addSplits(badLogin, table, Collections.singleton(s2bb("1")));
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.clearLocatorCache(badLogin, table);
+      fail("exception not thrown");
+    } catch (TException ex) {}
+    try {
+      client.compactTable(badLogin, table, null, null, null, true, false, null);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.cancelCompaction(badLogin, table);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.createTable(badLogin, table, false, TimeType.MILLIS);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.deleteTable(badLogin, table);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.deleteRows(badLogin, table, null, null);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.tableExists(badLogin, table);
+      fail("exception not thrown");
+    } catch (TException ex) {}
+    try {
+      client.flushTable(badLogin, table, null, null, false);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.getLocalityGroups(badLogin, table);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.getMaxRow(badLogin, table, Collections.<ByteBuffer> emptySet(), null, false, null, false);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.getTableProperties(badLogin, table);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.listSplits(badLogin, table, 10000);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.listTables(badLogin);
+      fail("exception not thrown");
+    } catch (TException ex) {}
+    try {
+      client.listConstraints(badLogin, table);
+      fail("exception not thrown");
+    } catch (TException ex) {}
+    try {
+      client.mergeTablets(badLogin, table, null, null);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.offlineTable(badLogin, table, false);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.onlineTable(badLogin, table, false);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.removeConstraint(badLogin, table, 0);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.removeTableProperty(badLogin, table, Property.TABLE_FILE_MAX.getKey());
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.renameTable(badLogin, table, "someTableName");
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      Map<String,Set<String>> groups = new HashMap<String,Set<String>>();
+      groups.put("group1", Collections.singleton("cf1"));
+      groups.put("group2", Collections.singleton("cf2"));
+      client.setLocalityGroups(badLogin, table, groups);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.setTableProperty(badLogin, table, Property.TABLE_FILE_MAX.getKey(), "0");
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.tableIdMap(badLogin);
+      fail("exception not thrown");
+    } catch (TException ex) {}
+    try {
+      client.getSiteConfiguration(badLogin);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.getSystemConfiguration(badLogin);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.getTabletServers(badLogin);
+      fail("exception not thrown");
+    } catch (TException ex) {}
+    try {
+      client.getActiveScans(badLogin, "fake");
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.getActiveCompactions(badLogin, "fakse");
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.removeProperty(badLogin, "table.split.threshold");
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.setProperty(badLogin, "table.split.threshold", "500M");
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.testClassLoad(badLogin, DevNull.class.getName(), SortedKeyValueIterator.class.getName());
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.authenticateUser(badLogin, "root", s2pp(SharedMiniClusterIT.getRootPassword()));
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      HashSet<ByteBuffer> auths = new HashSet<ByteBuffer>(Arrays.asList(s2bb("A"), s2bb("B")));
+      client.changeUserAuthorizations(badLogin, "stooge", auths);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.changeLocalUserPassword(badLogin, "stooge", s2bb(""));
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.createLocalUser(badLogin, "stooge", s2bb("password"));
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.dropLocalUser(badLogin, "stooge");
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.getUserAuthorizations(badLogin, "stooge");
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.grantSystemPermission(badLogin, "stooge", SystemPermission.CREATE_TABLE);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.grantTablePermission(badLogin, "root", table, TablePermission.WRITE);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.hasSystemPermission(badLogin, "stooge", SystemPermission.CREATE_TABLE);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.hasTablePermission(badLogin, "root", table, TablePermission.WRITE);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.listLocalUsers(badLogin);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.revokeSystemPermission(badLogin, "stooge", SystemPermission.CREATE_TABLE);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.revokeTablePermission(badLogin, "root", table, TablePermission.ALTER_TABLE);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.createScanner(badLogin, table, new ScanOptions());
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.createBatchScanner(badLogin, table, new BatchScanOptions());
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.updateAndFlush(badLogin, table, new HashMap<ByteBuffer,List<ColumnUpdate>>());
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.createWriter(badLogin, table, new WriterOptions());
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.attachIterator(badLogin, "slow", setting, EnumSet.allOf(IteratorScope.class));
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.checkIteratorConflicts(badLogin, table, setting, EnumSet.allOf(IteratorScope.class));
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      final String TABLE_TEST = getUniqueNames(1)[0];
+      client.cloneTable(badLogin, table, TABLE_TEST, false, null, null);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.exportTable(badLogin, table, "/tmp");
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.importTable(badLogin, "testify", "/tmp");
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.getIteratorSetting(badLogin, table, "foo", IteratorScope.SCAN);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.listIterators(badLogin, table);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.removeIterator(badLogin, table, "name", EnumSet.allOf(IteratorScope.class));
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.splitRangeByTablets(badLogin, table, client.getRowRange(ByteBuffer.wrap("row".getBytes())), 10);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      MiniAccumuloClusterImpl cluster = SharedMiniClusterIT.getCluster();
+      Path base = cluster.getTemporaryPath();
+      Path importDir = new Path(base, "importDir");
+      Path failuresDir = new Path(base, "failuresDir");
+      assertTrue(cluster.getFileSystem().mkdirs(importDir));
+      assertTrue(cluster.getFileSystem().mkdirs(failuresDir));
+      client.importDirectory(badLogin, table, importDir.toString(), failuresDir.toString(), true);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.pingTabletServer(badLogin, "fake");
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.login("badUser", properties);
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.testTableClassLoad(badLogin, table, VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName());
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+    try {
+      client.createConditionalWriter(badLogin, table, new ConditionalWriterOptions());
+      fail("exception not thrown");
+    } catch (AccumuloSecurityException ex) {}
+  }
+
+  @Test
+  public void tableNotFound() throws Exception {
+    final String doesNotExist = "doesNotExists";
+    try {
+      client.addConstraint(creds, doesNotExist, NumericValueConstraint.class.getName());
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.addSplits(creds, doesNotExist, Collections.<ByteBuffer> emptySet());
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    final IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "200"));
+    try {
+      client.attachIterator(creds, doesNotExist, setting, EnumSet.allOf(IteratorScope.class));
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.cancelCompaction(creds, doesNotExist);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.checkIteratorConflicts(creds, doesNotExist, setting, EnumSet.allOf(IteratorScope.class));
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.clearLocatorCache(creds, doesNotExist);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      final String TABLE_TEST = getUniqueNames(1)[0];
+      client.cloneTable(creds, doesNotExist, TABLE_TEST, false, null, null);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.compactTable(creds, doesNotExist, null, null, null, true, false, null);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.createBatchScanner(creds, doesNotExist, new BatchScanOptions());
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.createScanner(creds, doesNotExist, new ScanOptions());
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.createWriter(creds, doesNotExist, new WriterOptions());
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.deleteRows(creds, doesNotExist, null, null);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.deleteTable(creds, doesNotExist);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.exportTable(creds, doesNotExist, "/tmp");
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.flushTable(creds, doesNotExist, null, null, false);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.getIteratorSetting(creds, doesNotExist, "foo", IteratorScope.SCAN);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.getLocalityGroups(creds, doesNotExist);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.getMaxRow(creds, doesNotExist, Collections.<ByteBuffer> emptySet(), null, false, null, false);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.getTableProperties(creds, doesNotExist);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.grantTablePermission(creds, "root", doesNotExist, TablePermission.WRITE);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.hasTablePermission(creds, "root", doesNotExist, TablePermission.WRITE);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      MiniAccumuloClusterImpl cluster = SharedMiniClusterIT.getCluster();
+      Path base = cluster.getTemporaryPath();
+      Path importDir = new Path(base, "importDir");
+      Path failuresDir = new Path(base, "failuresDir");
+      assertTrue(cluster.getFileSystem().mkdirs(importDir));
+      assertTrue(cluster.getFileSystem().mkdirs(failuresDir));
+      client.importDirectory(creds, doesNotExist, importDir.toString(), failuresDir.toString(), true);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.listConstraints(creds, doesNotExist);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.listSplits(creds, doesNotExist, 10000);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.mergeTablets(creds, doesNotExist, null, null);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.offlineTable(creds, doesNotExist, false);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.onlineTable(creds, doesNotExist, false);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.removeConstraint(creds, doesNotExist, 0);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.removeIterator(creds, doesNotExist, "name", EnumSet.allOf(IteratorScope.class));
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.removeTableProperty(creds, doesNotExist, Property.TABLE_FILE_MAX.getKey());
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.renameTable(creds, doesNotExist, "someTableName");
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.revokeTablePermission(creds, "root", doesNotExist, TablePermission.ALTER_TABLE);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.setTableProperty(creds, doesNotExist, Property.TABLE_FILE_MAX.getKey(), "0");
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.splitRangeByTablets(creds, doesNotExist, client.getRowRange(ByteBuffer.wrap("row".getBytes())), 10);
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.updateAndFlush(creds, doesNotExist, new HashMap<ByteBuffer,List<ColumnUpdate>>());
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.getDiskUsage(creds, Collections.singleton(doesNotExist));
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.testTableClassLoad(creds, doesNotExist, VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName());
+      fail("exception not thrown");
+    } catch (TableNotFoundException ex) {}
+    try {
+      client.createConditionalWriter(creds, doesNotExist, new ConditionalWriterOptions());
+    } catch (TableNotFoundException ex) {}
+  }
+
+  @Test
+  public void testExists() throws Exception {
+    client.createTable(creds, "ett1", false, TimeType.MILLIS);
+    client.createTable(creds, "ett2", false, TimeType.MILLIS);
+    try {
+      client.createTable(creds, "ett1", false, TimeType.MILLIS);
+      fail("exception not thrown");
+    } catch (TableExistsException tee) {}
+    try {
+      client.renameTable(creds, "ett1", "ett2");
+      fail("exception not thrown");
+    } catch (TableExistsException tee) {}
+    try {
+      client.cloneTable(creds, "ett1", "ett2", false, new HashMap<String,String>(), new HashSet<String>());
+      fail("exception not thrown");
+    } catch (TableExistsException tee) {}
+  }
+
+  @Test
+  public void testUnknownScanner() throws Exception {
+    final String TABLE_TEST = getUniqueNames(1)[0];
+
+    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+
+    String scanner = client.createScanner(creds, TABLE_TEST, null);
+    assertFalse(client.hasNext(scanner));
+    client.closeScanner(scanner);
+
+    try {
+      client.hasNext(scanner);
+      fail("exception not thrown");
+    } catch (UnknownScanner us) {}
+
+    try {
+      client.closeScanner(scanner);
+      fail("exception not thrown");
+    } catch (UnknownScanner us) {}
+
+    try {
+      client.nextEntry("99999999");
+      fail("exception not thrown");
+    } catch (UnknownScanner us) {}
+    try {
+      client.nextK("99999999", 6);
+      fail("exception not thrown");
+    } catch (UnknownScanner us) {}
+    try {
+      client.hasNext("99999999");
+      fail("exception not thrown");
+    } catch (UnknownScanner us) {}
+    try {
+      client.hasNext(UUID.randomUUID().toString());
+      fail("exception not thrown");
+    } catch (UnknownScanner us) {}
+  }
+
+  @Test
+  public void testUnknownWriter() throws Exception {
+    final String TABLE_TEST = getUniqueNames(1)[0];
+
+    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+
+    String writer = client.createWriter(creds, TABLE_TEST, null);
+    client.update(writer, mutation("row0", "cf", "cq", "value"));
+    client.flush(writer);
+    client.update(writer, mutation("row2", "cf", "cq", "value2"));
+    client.closeWriter(writer);
+
+    // this is a oneway call, so it does not throw exceptions
+    client.update(writer, mutation("row2", "cf", "cq", "value2"));
+
+    try {
+      client.flush(writer);
+      fail("exception not thrown");
+    } catch (UnknownWriter uw) {}
+    try {
+      client.flush("99999");
+      fail("exception not thrown");
+    } catch (UnknownWriter uw) {}
+    try {
+      client.flush(UUID.randomUUID().toString());
+      fail("exception not thrown");
+    } catch (UnknownWriter uw) {}
+    try {
+      client.closeWriter("99999");
+      fail("exception not thrown");
+    } catch (UnknownWriter uw) {}
+  }
+
+  @Test
+  public void testDelete() throws Exception {
+    final String TABLE_TEST = getUniqueNames(1)[0];
+
+    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+    client.updateAndFlush(creds, TABLE_TEST, mutation("row0", "cf", "cq", "value"));
+
+    assertScan(new String[][] {{"row0", "cf", "cq", "value"}}, TABLE_TEST);
+
+    ColumnUpdate upd = new ColumnUpdate(s2bb("cf"), s2bb("cq"));
+    upd.setDeleteCell(false);
+    Map<ByteBuffer,List<ColumnUpdate>> notDelete = Collections.singletonMap(s2bb("row0"), Collections.singletonList(upd));
+    client.updateAndFlush(creds, TABLE_TEST, notDelete);
+    String scanner = client.createScanner(creds, TABLE_TEST, null);
+    ScanResult entries = client.nextK(scanner, 10);
+    client.closeScanner(scanner);
+    assertFalse(entries.more);
+    assertEquals(1, entries.results.size());
+
+    upd = new ColumnUpdate(s2bb("cf"), s2bb("cq"));
+    upd.setDeleteCell(true);
+    Map<ByteBuffer,List<ColumnUpdate>> delete = Collections.singletonMap(s2bb("row0"), Collections.singletonList(upd));
+
+    client.updateAndFlush(creds, TABLE_TEST, delete);
+
+    assertScan(new String[][] {}, TABLE_TEST);
+  }
+
+  @Test
+  public void testInstanceOperations() throws Exception {
+    int tservers = 0;
+    for (String tserver : client.getTabletServers(creds)) {
+      client.pingTabletServer(creds, tserver);
+      tservers++;
+    }
+    assertTrue(tservers > 0);
+
+    // get something we know is in the site config
+    MiniAccumuloClusterImpl cluster = SharedMiniClusterIT.getCluster();
+    Map<String,String> cfg = client.getSiteConfiguration(creds);
+    assertTrue(cfg.get("instance.dfs.dir").startsWith(cluster.getConfig().getAccumuloDir().getAbsolutePath()));
+
+    // set a property in zookeeper
+    client.setProperty(creds, "table.split.threshold", "500M");
+
+    // check that we can read it
+    for (int i = 0; i < 5; i++) {
+      cfg = client.getSystemConfiguration(creds);
+      if ("500M".equals(cfg.get("table.split.threshold")))
+        break;
+      UtilWaitThread.sleep(200);
+    }
+    assertEquals("500M", cfg.get("table.split.threshold"));
+
+    // unset the setting, check that it's not what it was
+    client.removeProperty(creds, "table.split.threshold");
+    for (int i = 0; i < 5; i++) {
+      cfg = client.getSystemConfiguration(creds);
+      if (!"500M".equals(cfg.get("table.split.threshold")))
+        break;
+      UtilWaitThread.sleep(200);
+    }
+    assertNotEquals("500M", cfg.get("table.split.threshold"));
+
+    // try to load some classes via the proxy
+    assertTrue(client.testClassLoad(creds, DevNull.class.getName(), SortedKeyValueIterator.class.getName()));
+    assertFalse(client.testClassLoad(creds, "foo.bar", SortedKeyValueIterator.class.getName()));
+
+    // create a table that's very slow, so we can look for scans/compactions
+    client.createTable(creds, "slow", true, TimeType.MILLIS);
+    IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "250"));
+    client.attachIterator(creds, "slow", setting, EnumSet.allOf(IteratorScope.class));
+
+    // Should take 10 seconds to read every record
+    for (int i = 0; i < 40; i++) {
+      client.updateAndFlush(creds, "slow", mutation("row" + i, "cf", "cq", "value"));
+    }
+
+    // scan
+    Thread t = new Thread() {
+      @Override
+      public void run() {
+        String scanner;
+        try {
+          Client client2 = new TestProxyClient("localhost", proxyPort, getProtocol()).proxy();
+          scanner = client2.createScanner(creds, "slow", null);
+          client2.nextK(scanner, 10);
+          client2.closeScanner(scanner);
+        } catch (Exception e) {
+          throw new RuntimeException(e);
+        }
+      }
+    };
+    t.start();
+
+    // look for the scan many times
+    List<ActiveScan> scans = new ArrayList<ActiveScan>();
+    for (int i = 0; i < 100 && scans.isEmpty(); i++) {
+      for (String tserver : client.getTabletServers(creds)) {
+        List<ActiveScan> scansForServer = client.getActiveScans(creds, tserver);
+        for (ActiveScan scan : scansForServer) {
+          if ("root".equals(scan.getUser())) {
+            scans.add(scan);
+          }
+        }
+
+        if (!scans.isEmpty())
+          break;
+        UtilWaitThread.sleep(100);
+      }
+    }
+    t.join();
+
+    assertFalse(scans.isEmpty());
+    boolean found = false;
+    Map<String,String> map = null;
+    for (int i = 0; i < scans.size() && !found; i++) {
+      ActiveScan scan = scans.get(i);
+      if ("root".equals(scan.getUser())) {
+        assertTrue(ScanState.RUNNING.equals(scan.getState()) || ScanState.QUEUED.equals(scan.getState()));
+        assertEquals(ScanType.SINGLE, scan.getType());
+        assertEquals("slow", scan.getTable());
+
+        map = client.tableIdMap(creds);
+        assertEquals(map.get("slow"), scan.getExtent().tableId);
+        assertTrue(scan.getExtent().endRow == null);
+        assertTrue(scan.getExtent().prevEndRow == null);
+        found = true;
+      }
+    }
+
+    assertTrue("Could not find a scan against the 'slow' table", found);
+
+    // start a compaction
+    t = new Thread() {
+      @Override
+      public void run() {
+        try {
+          Client client2 = new TestProxyClient("localhost", proxyPort, getProtocol()).proxy();
+          client2.compactTable(creds, "slow", null, null, null, true, true, null);
+        } catch (Exception e) {
+          throw new RuntimeException(e);
+        }
+      }
+    };
+    t.start();
+
+    final String desiredTableId = map.get("slow");
+
+    // try to catch it in the act
+    List<ActiveCompaction> compactions = new ArrayList<ActiveCompaction>();
+    for (int i = 0; i < 100 && compactions.isEmpty(); i++) {
+      // Iterate over the tservers
+      for (String tserver : client.getTabletServers(creds)) {
+        // And get the compactions on each
+        List<ActiveCompaction> compactionsOnServer = client.getActiveCompactions(creds, tserver);
+        for (ActiveCompaction compact : compactionsOnServer) {
+          // There might be other compactions occurring (e.g. on METADATA) in which
+          // case we want to prune out those that aren't for our slow table
+          if (desiredTableId.equals(compact.getExtent().tableId)) {
+            compactions.add(compact);
+          }
+        }
+
+        // If we found a compaction for the table we wanted, so we can stop looking
+        if (!compactions.isEmpty())
+          break;
+      }
+      UtilWaitThread.sleep(10);
+    }
+    t.join();
+
+    // verify the compaction information
+    assertFalse(compactions.isEmpty());
+    for (ActiveCompaction c : compactions) {
+      if (desiredTableId.equals(c.getExtent().tableId)) {
+        assertTrue(c.inputFiles.isEmpty());
+        assertEquals(CompactionType.MINOR, c.getType());
+        assertEquals(CompactionReason.USER, c.getReason());
+        assertEquals("", c.localityGroup);
+        assertTrue(c.outputFile.contains("default_tablet"));
+
+        return;
+      }
+    }
+    fail("Expection to find running compaction for table 'slow' but did not find one");
+  }
+
+  @Test
+  public void testSecurityOperations() throws Exception {
+    final String TABLE_TEST = getUniqueNames(1)[0];
+
+    // check password
+    assertTrue(client.authenticateUser(creds, "root", s2pp(SharedMiniClusterIT.getRootPassword())));
+    assertFalse(client.authenticateUser(creds, "root", s2pp("")));
+
+    // create a user
+    client.createLocalUser(creds, "stooge", s2bb("password"));
+    // change auths
+    Set<String> users = client.listLocalUsers(creds);
+    assertEquals(new HashSet<String>(Arrays.asList("root", "stooge")), users);
+    HashSet<ByteBuffer> auths = new HashSet<ByteBuffer>(Arrays.asList(s2bb("A"), s2bb("B")));
+    client.changeUserAuthorizations(creds, "stooge", auths);
+    List<ByteBuffer> update = client.getUserAuthorizations(creds, "stooge");
+    assertEquals(auths, new HashSet<ByteBuffer>(update));
+
+    // change password
+    client.changeLocalUserPassword(creds, "stooge", s2bb(""));
+    assertTrue(client.authenticateUser(creds, "stooge", s2pp("")));
+
+    // check permission failure
+    @SuppressWarnings("serial")
+    ByteBuffer stooge = client.login("stooge", new TreeMap<String,String>() {
+      {
+        put("password", "");
+      }
+    });
+
+    try {
+      client.createTable(stooge, "fail", true, TimeType.MILLIS);
+      fail("should not create the table");
+    } catch (AccumuloSecurityException ex) {
+      assertFalse(client.listTables(creds).contains("fail"));
+    }
+    // grant permissions and test
+    assertFalse(client.hasSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE));
+    client.grantSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE);
+    assertTrue(client.hasSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE));
+    client.createTable(stooge, "success", true, TimeType.MILLIS);
+    client.listTables(creds).contains("succcess");
+
+    // revoke permissions
+    client.revokeSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE);
+    assertFalse(client.hasSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE));
+    try {
+      client.createTable(stooge, "fail", true, TimeType.MILLIS);
+      fail("should not create the table");
+    } catch (AccumuloSecurityException ex) {
+      assertFalse(client.listTables(creds).contains("fail"));
+    }
+    // create a table to test table permissions
+    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+    // denied!
+    try {
+      String scanner = client.createScanner(stooge, TABLE_TEST, null);
+      client.nextK(scanner, 100);
+      fail("stooge should not read table test");
+    } catch (AccumuloSecurityException ex) {}
+    // grant
+    assertFalse(client.hasTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ));
+    client.grantTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ);
+    assertTrue(client.hasTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ));
+    String scanner = client.createScanner(stooge, TABLE_TEST, null);
+    client.nextK(scanner, 10);
+    client.closeScanner(scanner);
+    // revoke
+    client.revokeTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ);
+    assertFalse(client.hasTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ));
+    try {
+      scanner = client.createScanner(stooge, TABLE_TEST, null);
+      client.nextK(scanner, 100);
+      fail("stooge should not read table test");
+    } catch (AccumuloSecurityException ex) {}
+
+    // delete user
+    client.dropLocalUser(creds, "stooge");
+    users = client.listLocalUsers(creds);
+    assertEquals(1, users.size());
+
+  }
+
+  @Test
+  public void testBatchWriter() throws Exception {
+    final String TABLE_TEST = getUniqueNames(1)[0];
+
+    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+    client.addConstraint(creds, TABLE_TEST, NumericValueConstraint.class.getName());
+    // zookeeper propagation time
+    UtilWaitThread.sleep(ZOOKEEPER_PROPAGATION_TIME);
+
+    WriterOptions writerOptions = new WriterOptions();
+    writerOptions.setLatencyMs(10000);
+    writerOptions.setMaxMemory(2);
+    writerOptions.setThreads(1);
+    writerOptions.setTimeoutMs(100000);
+
+    String batchWriter = client.createWriter(creds, TABLE_TEST, writerOptions);
+    client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
+    client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
+    try {
+      client.flush(batchWriter);
+      fail("constraint did not fire");
+    } catch (MutationsRejectedException ex) {}
+    try {
+      client.closeWriter(batchWriter);
+      fail("constraint did not fire");
+    } catch (MutationsRejectedException e) {}
+
+    client.removeConstraint(creds, TABLE_TEST, 2);
+
+    assertScan(new String[][] {}, TABLE_TEST);
+
+    UtilWaitThread.sleep(2000);
+
+    writerOptions = new WriterOptions();
+    writerOptions.setLatencyMs(10000);
+    writerOptions.setMaxMemory(3000);
+    writerOptions.setThreads(1);
+    writerOptions.setTimeoutMs(100000);
+
+    batchWriter = client.createWriter(creds, TABLE_TEST, writerOptions);
+
+    client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
+    client.flush(batchWriter);
+    client.closeWriter(batchWriter);
+
+    assertScan(new String[][] {{"row1", "cf", "cq", "x"}}, TABLE_TEST);
+
+    client.deleteTable(creds, TABLE_TEST);
+  }
+
+  @Test
+  public void testTableOperations() throws Exception {
+    String names[] = getUniqueNames(2);
+    final String TABLE_TEST = names[0];
+    final String TABLE_TEST2 = names[1];
+
+    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+    // constraints
+    client.addConstraint(creds, TABLE_TEST, NumericValueConstraint.class.getName());
+    assertEquals(2, client.listConstraints(creds, TABLE_TEST).size());
+
+    // zookeeper propagation time
+    UtilWaitThread.sleep(ZOOKEEPER_PROPAGATION_TIME);
+
+    client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "123"));
+
+    while (true) {
+      try {
+        client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "x"));
+        UtilWaitThread.sleep(1000);
+      } catch (MutationsRejectedException ex) {
+        break;
+      }
+    }
+
+    client.removeConstraint(creds, TABLE_TEST, 2);
+
+    UtilWaitThread.sleep(2000);
+
+    assertEquals(1, client.listConstraints(creds, TABLE_TEST).size());
+
+    while (true) {
+      try {
+        client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "x"));
+        break;
+      } catch (MutationsRejectedException ex) {
+        UtilWaitThread.sleep(1000);
+      }
+    }
+    assertScan(new String[][] {{"row1", "cf", "cq", "x"}}, TABLE_TEST);
+    // splits, merge
+    client.addSplits(creds, TABLE_TEST, new HashSet<ByteBuffer>(Arrays.asList(s2bb("a"), s2bb("m"), s2bb("z"))));
+    List<ByteBuffer> splits = client.listSplits(creds, TABLE_TEST, 1);
+    assertEquals(Arrays.asList(s2bb("m")), splits);
+    client.mergeTablets(creds, TABLE_TEST, null, s2bb("m"));
+    splits = client.listSplits(creds, TABLE_TEST, 10);
+    assertEquals(Arrays.asList(s2bb("m"), s2bb("z")), splits);
+    client.mergeTablets(creds, TABLE_TEST, null, null);
+    splits = client.listSplits(creds, TABLE_TEST, 10);
+    List<ByteBuffer> empty = Collections.emptyList();
+    assertEquals(empty, splits);
+    // iterators
+    client.deleteTable(creds, TABLE_TEST);
+    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+    HashMap<String,String> options = new HashMap<String,String>();
+    options.put("type", "STRING");
+    options.put("columns", "cf");
+    IteratorSetting setting = new IteratorSetting(10, TABLE_TEST, SummingCombiner.class.getName(), options);
+    client.attachIterator(creds, TABLE_TEST, setting, EnumSet.allOf(IteratorScope.class));
+    for (int i = 0; i < 10; i++) {
+      client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "1"));
+    }
+    assertScan(new String[][] {{"row1", "cf", "cq", "10"}}, TABLE_TEST);
+    try {
+      client.checkIteratorConflicts(creds, TABLE_TEST, setting, EnumSet.allOf(IteratorScope.class));
+      fail("checkIteratorConflicts did not throw an exception");
+    } catch (Exception ex) {
+      System.out.println("Ignoring " + ex.toString());
+    }
+    client.deleteRows(creds, TABLE_TEST, null, null);
+    client.removeIterator(creds, TABLE_TEST, "test", EnumSet.allOf(IteratorScope.class));
+    String expected[][] = new String[10][];
+    for (int i = 0; i < 10; i++) {
+      client.updateAndFlush(creds, TABLE_TEST, mutation("row" + i, "cf", "cq", "" + i));
+      expected[i] = new String[] {"row" + i, "cf", "cq", "" + i};
+      client.flushTable(creds, TABLE_TEST, null, null, true);
+    }
+    assertScan(expected, TABLE_TEST);
+    // clone
+    client.cloneTable(creds, TABLE_TEST, TABLE_TEST2, true, null, null);
+    assertScan(expected, TABLE_TEST2);
+    client.deleteTable(creds, TABLE_TEST2);
+
+    // don't know how to test this, call it just for fun
+    client.clearLocatorCache(creds, TABLE_TEST);
+
+    // compact
+    client.compactTable(creds, TABLE_TEST, null, null, null, true, true, null);
+    assertEquals(1, countFiles(TABLE_TEST));
+    assertScan(expected, TABLE_TEST);
+
+    // get disk usage
+    client.cloneTable(creds, TABLE_TEST, TABLE_TEST2, true, null, null);
+    Set<String> tablesToScan = new HashSet<String>();
+    tablesToScan.add(TABLE_TEST);
+    tablesToScan.add(TABLE_TEST2);
+    tablesToScan.add("foo");
+    client.createTable(creds, "foo", true, TimeType.MILLIS);
+    List<DiskUsage> diskUsage = (client.getDiskUsage(creds, tablesToScan));
+    assertEquals(2, diskUsage.size());
+    assertEquals(2, diskUsage.get(0).getTables().size());
+    assertEquals(1, diskUsage.get(1).getTables().size());
+    client.compactTable(creds, TABLE_TEST2, null, null, null, true, true, null);
+    diskUsage = (client.getDiskUsage(creds, tablesToScan));
+    assertEquals(3, diskUsage.size());
+    assertEquals(1, diskUsage.get(0).getTables().size());
+    assertEquals(1, diskUsage.get(1).getTables().size());
+    assertEquals(1, diskUsage.get(2).getTables().size());
+    client.deleteTable(creds, "foo");
+    client.deleteTable(creds, TABLE_TEST2);
+
+    // export/import
+    MiniAccumuloClusterImpl cluster = SharedMiniClusterIT.getCluster();
+    FileSystem fs = cluster.getFileSystem();
+    Path base = cluster.getTemporaryPath();
+    Path dir = new Path(base, "test");
+    assertTrue(fs.mkdirs(dir));
+    Path destDir = new Path(base, "test_dest");
+    assertTrue(fs.mkdirs(destDir));
+    client.offlineTable(creds, TABLE_TEST, false);
+    client.exportTable(creds, TABLE_TEST, dir.toString());
+    // copy files to a new location
+    FSDataInputStream is = fs.open(new Path(dir, "distcp.txt"));
+    try (BufferedReader r = new BufferedReader(new InputStreamReader(is))) {
+      while (true) {
+        String line = r.readLine();
+        if (line == null)
+          break;
+        Path srcPath = new Path(line);
+        FileUtil.copy(fs, srcPath, fs, destDir, false, fs.getConf());
+      }
+    }
+    client.deleteTable(creds, TABLE_TEST);
+    client.importTable(creds, "testify", destDir.toString());
+    assertScan(expected, "testify");
+    client.deleteTable(creds, "testify");
+
+    try {
+      // ACCUMULO-1558 a second import from the same dir should fail, the first import moved the files
+      client.importTable(creds, "testify2", destDir.toString());
+      fail();
+    } catch (Exception e) {}
+
+    assertFalse(client.listTables(creds).contains("testify2"));
+
+    // Locality groups
+    client.createTable(creds, "test", true, TimeType.MILLIS);
+    Map<String,Set<String>> groups = new HashMap<String,Set<String>>();
+    groups.put("group1", Collections.singleton("cf1"));
+    groups.put("group2", Collections.singleton("cf2"));
+    client.setLocalityGroups(creds, "test", groups);
+    assertEquals(groups, client.getLocalityGroups(creds, "test"));
+    // table properties
+    Map<String,String> orig = client.getTableProperties(creds, "test");
+    client.setTableProperty(creds, "test", "table.split.threshold", "500M");
+    Map<String,String> update = client.getTableProperties(creds, "test");
+    assertEquals(update.get("table.split.threshold"), "500M");
+    client.removeTableProperty(creds, "test", "table.split.threshold");
+    update = client.getTableProperties(creds, "test");
+    assertEquals(orig, update);
+    // rename table
+    Map<String,String> tables = client.tableIdMap(creds);
+    client.renameTable(creds, "test", "bar");
+    Map<String,String> tables2 = client.tableIdMap(creds);
+    assertEquals(tables.get("test"), tables2.get("bar"));
+    // table exists
+    assertTrue(client.tableExists(creds, "bar"));
+    assertFalse(client.tableExists(creds, "test"));
+    // bulk import
+    String filename = dir + "/bulk/import/rfile.rf";
+    FileSKVWriter writer = FileOperations.getInstance().openWriter(filename, fs, fs.getConf(), DefaultConfiguration.getInstance());
+    writer.startDefaultLocalityGroup();
+    writer.append(new org.apache.accumulo.core.data.Key(new Text("a"), new Text("b"), new Text("c")), new Value("value".getBytes()));
+    writer.close();
+    fs.mkdirs(new Path(dir + "/bulk/fail"));
+    client.importDirectory(creds, "bar", dir + "/bulk/import", dir + "/bulk/fail", true);
+    String scanner = client.createScanner(creds, "bar", null);
+    ScanResult more = client.nextK(scanner, 100);
+    client.closeScanner(scanner);
+    assertEquals(1, more.results.size());
+    ByteBuffer maxRow = client.getMaxRow(creds, "bar", null, null, false, null, false);
+    assertEquals(s2bb("a"), maxRow);
+
+    assertFalse(client.testTableClassLoad(creds, "bar", "abc123", SortedKeyValueIterator.class.getName()));
+    assertTrue(client.testTableClassLoad(creds, "bar", VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName()));
+  }
+
+  private Condition newCondition(String cf, String cq) {
+    return new Condition(new Column(s2bb(cf), s2bb(cq), s2bb("")));
+  }
+
+  private Condition newCondition(String cf, String cq, String val) {
+    return newCondition(cf, cq).setValue(s2bb(val));
+  }
+
+  private Condition newCondition(String cf, String cq, long ts, String val) {
+    return newCondition(cf, cq).setValue(s2bb(val)).setTimestamp(ts);
+  }
+
+  private ColumnUpdate newColUpdate(String cf, String cq, String val) {
+    return new ColumnUpdate(s2bb(cf), s2bb(cq)).setValue(s2bb(val));
+  }
+
+  private ColumnUpdate newColUpdate(String cf, String cq, long ts, String val) {
+    return new ColumnUpdate(s2bb(cf), s2bb(cq)).setTimestamp(ts).setValue(s2bb(val));
+  }
+
+  private void assertScan(String[][] expected, String table) throws Exception {
+    String scid = client.createScanner(creds, table, new ScanOptions());
+    ScanResult keyValues = client.nextK(scid, expected.length + 1);
+
+    assertEquals(expected.length, keyValues.results.size());
+    assertFalse(keyValues.more);
+
+    for (int i = 0; i < keyValues.results.size(); i++) {
+      checkKey(expected[i][0], expected[i][1], expected[i][2], expected[i][3], keyValues.results.get(i));
+    }
+
+    client.closeScanner(scid);
+  }
+
+  @Test
+  public void testConditionalWriter() throws Exception {
+    final String TABLE_TEST = getUniqueNames(1)[0];
+
+    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+
+    client.addConstraint(creds, TABLE_TEST, NumericValueConstraint.class.getName());
+    UtilWaitThread.sleep(ZOOKEEPER_PROPAGATION_TIME);
+
+    String cwid = client.createConditionalWriter(creds, TABLE_TEST, new ConditionalWriterOptions());
+
+    Map<ByteBuffer,ConditionalUpdates> updates = new HashMap<ByteBuffer,ConditionalUpdates>();
+
+    updates.put(
+        s2bb("00345"),
+        new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq")), Arrays.asList(newColUpdate("meta", "seq", 10, "1"),
+            newColUpdate("data", "img", "73435435"))));
+
+    Map<ByteBuffer,ConditionalStatus> results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00345")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "73435435"}, {"00345", "meta", "seq", "1"}}, TABLE_TEST);
+
+    // test not setting values on conditions
+    updates.clear();
+
+    updates.put(s2bb("00345"), new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq")), Arrays.asList(newColUpdate("meta", "seq", "2"))));
+    updates.put(s2bb("00346"), new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq")), Arrays.asList(newColUpdate("meta", "seq", "1"))));
+
+    results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(2, results.size());
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00345")));
+    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00346")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "73435435"}, {"00345", "meta", "seq", "1"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
+
+    // test setting values on conditions
+    updates.clear();
+
+    updates.put(
+        s2bb("00345"),
+        new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", "1")), Arrays.asList(newColUpdate("meta", "seq", 20, "2"),
+            newColUpdate("data", "img", "567890"))));
+
+    updates.put(s2bb("00346"), new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", "2")), Arrays.asList(newColUpdate("meta", "seq", "3"))));
+
+    results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(2, results.size());
+    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00345")));
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00346")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "567890"}, {"00345", "meta", "seq", "2"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
+
+    // test setting timestamp on condition to a non-existant version
+    updates.clear();
+
+    updates.put(
+        s2bb("00345"),
+        new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", 10, "2")), Arrays.asList(newColUpdate("meta", "seq", 30, "3"),
+            newColUpdate("data", "img", "1234567890"))));
+
+    results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00345")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "567890"}, {"00345", "meta", "seq", "2"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
+
+    // test setting timestamp to an existing version
+
+    updates.clear();
+
+    updates.put(
+        s2bb("00345"),
+        new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", 20, "2")), Arrays.asList(newColUpdate("meta", "seq", 30, "3"),
+            newColUpdate("data", "img", "1234567890"))));
+
+    results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00345")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
+
+    // run test w/ condition that has iterators
+    // following should fail w/o iterator
+    client.updateAndFlush(creds, TABLE_TEST, Collections.singletonMap(s2bb("00347"), Arrays.asList(newColUpdate("data", "count", "1"))));
+    client.updateAndFlush(creds, TABLE_TEST, Collections.singletonMap(s2bb("00347"), Arrays.asList(newColUpdate("data", "count", "1"))));
+    client.updateAndFlush(creds, TABLE_TEST, Collections.singletonMap(s2bb("00347"), Arrays.asList(newColUpdate("data", "count", "1"))));
+
+    updates.clear();
+    updates.put(s2bb("00347"),
+        new ConditionalUpdates(Arrays.asList(newCondition("data", "count", "3")), Arrays.asList(newColUpdate("data", "img", "1234567890"))));
+
+    results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "1"}}, TABLE_TEST);
+
+    // following test w/ iterator setup should succeed
+    Condition iterCond = newCondition("data", "count", "3");
+    Map<String,String> props = new HashMap<String,String>();
+    props.put("type", "STRING");
+    props.put("columns", "data:count");
+    IteratorSetting is = new IteratorSetting(1, "sumc", SummingCombiner.class.getName(), props);
+    iterCond.setIterators(Arrays.asList(is));
+
+    updates.clear();
+    updates.put(s2bb("00347"), new ConditionalUpdates(Arrays.asList(iterCond), Arrays.asList(newColUpdate("data", "img", "1234567890"))));
+
+    results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00347")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
+
+    // test a mutation that violated a constraint
+    updates.clear();
+    updates.put(s2bb("00347"),
+        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "1234567890")), Arrays.asList(newColUpdate("data", "count", "A"))));
+
+    results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.VIOLATED, results.get(s2bb("00347")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
+
+    // run test with two conditions
+    // both conditions should fail
+    updates.clear();
+    updates.put(
+        s2bb("00347"),
+        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "565"), newCondition("data", "count", "2")), Arrays.asList(
+            newColUpdate("data", "count", "3"), newColUpdate("data", "img", "0987654321"))));
+
+    results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
+
+    // one condition should fail
+    updates.clear();
+    updates.put(
+        s2bb("00347"),
+        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "1234567890"), newCondition("data", "count", "2")), Arrays.asList(
+            newColUpdate("data", "count", "3"), newColUpdate("data", "img", "0987654321"))));
+
+    results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
+
+    // one condition should fail
+    updates.clear();
+    updates.put(
+        s2bb("00347"),
+        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "565"), newCondition("data", "count", "1")), Arrays.asList(
+            newColUpdate("data", "count", "3"), newColUpdate("data", "img", "0987654321"))));
+
+    results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
+
+    // both conditions should succeed
+
+    ConditionalStatus result = client.updateRowConditionally(
+        creds,
+        TABLE_TEST,
+        s2bb("00347"),
+        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "1234567890"), newCondition("data", "count", "1")), Arrays.asList(
+            newColUpdate("data", "count", "3"), newColUpdate("data", "img", "0987654321"))));
+
+    assertEquals(ConditionalStatus.ACCEPTED, result);
+
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "3"}, {"00347", "data", "img", "0987654321"}}, TABLE_TEST);
+
+    client.closeConditionalWriter(cwid);
+    try {
+      client.updateRowsConditionally(cwid, updates);
+      fail("conditional writer not closed");
+    } catch (UnknownWriter uk) {}
+
+    // run test with colvis
+    client.createLocalUser(creds, "cwuser", s2bb("bestpasswordever"));
+    client.changeUserAuthorizations(creds, "cwuser", Collections.singleton(s2bb("A")));
+    client.grantTablePermission(creds, "cwuser", TABLE_TEST, TablePermission.WRITE);
+    client.grantTablePermission(creds, "cwuser", TABLE_TEST, TablePermission.READ);
+
+    ByteBuffer cwuCreds = client.login("cwuser", Collections.singletonMap("password", "bestpasswordever"));
+
+    cwid = client.createConditionalWriter(cwuCreds, TABLE_TEST, new ConditionalWriterOptions().setAuthorizations(Collections.singleton(s2bb("A"))));
+
+    updates.clear();
+    updates.put(
+        s2bb("00348"),
+        new ConditionalUpdates(Arrays.asList(new Condition(new Column(s2bb("data"), s2bb("c"), s2bb("A")))), Arrays.asList(newColUpdate("data", "seq", "1"),
+            newColUpdate("data", "c", "1").setColVisibility(s2bb("A")))));
+    updates.put(s2bb("00349"),
+        new ConditionalUpdates(Arrays.asList(new Condition(new Column(s2bb("data"), s2bb("c"), s2bb("B")))), Arrays.asList(newColUpdate("data", "seq", "1"))));
+
+    results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(2, results.size());
+    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00348")));
+    assertEquals(ConditionalStatus.INVISIBLE_VISIBILITY, results.get(s2bb("00349")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "3"}, {"00347", "data", "img", "0987654321"}, {"00348", "data", "seq", "1"}}, TABLE_TEST);
+
+    updates.clear();
+
+    updates.clear();
+    updates.put(
+        s2bb("00348"),
+        new ConditionalUpdates(Arrays.asList(new Condition(new Column(s2bb("data"), s2bb("c"), s2bb("A"))).setValue(s2bb("0"))), Arrays.asList(
+            newColUpdate("data", "seq", "2"), newColUpdate("data", "c", "2").setColVisibility(s2bb("A")))));
+
+    results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00348")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "3"}, {"00347", "data", "img", "0987654321"}, {"00348", "data", "seq", "1"}}, TABLE_TEST);
+
+    updates.clear();
+    updates.put(
+        s2bb("00348"),
+        new ConditionalUpdates(Arrays.asList(new Condition(new Column(s2bb("data"), s2bb("c"), s2bb("A"))).setValue(s2bb("1"))), Arrays.asList(
+            newColUpdate("data", "seq", "2"), newColUpdate("data", "c", "2").setColVisibility(s2bb("A")))));
+
+    results = client.updateRowsConditionally(cwid, updates);
+
+    assertEquals(1, results.size());
+    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00348")));
+
+    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
+        {"00347", "data", "count", "3"}, {"00347", "data", "img", "0987654321"}, {"00348", "data", "seq", "2"}}, TABLE_TEST);
+
+    client.closeConditionalWriter(cwid);
+    try {
+      client.updateRowsConditionally(cwid, updates);
+      fail("conditional writer not closed");
+    } catch (UnknownWriter uk) {}
+
+    client.dropLocalUser(creds, "cwuser");
+
+  }
+
+  private void checkKey(String row, String cf, String cq, String val, KeyValue keyValue) {
+    assertEquals(row, ByteBufferUtil.toString(keyValue.key.row));
+    assertEquals(cf, ByteBufferUtil.toString(keyValue.key.colFamily));
+    assertEquals(cq, ByteBufferUtil.toString(keyValue.key.colQualifier));
+    assertEquals("", ByteBufferUtil.toString(keyValue.key.colVisibility));
+    assertEquals(val, ByteBufferUtil.toString(keyValue.value));
+  }
+
+  // scan metadata for file entries for the given table
+  private int countFiles(String table) throws Exception {
+    Map<String,String> tableIdMap = client.tableIdMap(creds);
+    String tableId = tableIdMap.get(table);
+    Key start = new Key();
+    start.row = s2bb(tableId + ";");
+    Key end = new Key();
+    end.row = s2bb(tableId + "<");
+    end = client.getFollowing(end, PartialKey.ROW);
+    ScanOptions opt = new ScanOptions();
+    opt.range = new Range(start, true, end, false);
+    opt.columns = Collections.singletonList(new ScanColumn(s2bb("file")));
+    String scanner = client.createScanner(creds, MetadataTable.NAME, opt);
+    int result = 0;
+    while (true) {
+      ScanResult more = client.nextK(scanner, 100);
+      result += more.getResults().size();
+      if (!more.more)
+        break;
+    }
+    return result;
+  }
+
+  private Map<ByteBuffer,List<ColumnUpdate>> mutation(String row, String cf, String cq, String value) {
+    ColumnUpdate upd = new ColumnUpdate(s2bb(cf), s2bb(cq));
+    upd.setValue(value.getBytes());
+    return Collections.singletonMap(s2bb(row), Collections.singletonList(upd));
+  }
+
+  private ByteBuffer s2bb(String cf) {
+    return ByteBuffer.wrap(cf.getBytes());
+  }
+
+  private Map<String,String> s2pp(String cf) {
+    Map<String,String> toRet = new TreeMap<String,String>();
+    toRet.put("password", cf);
+    return toRet;
+  }
+
+  static private ByteBuffer t2bb(Text t) {
+    return ByteBuffer.wrap(t.getBytes());
+  }
+
+  @Test
+  public void testGetRowRange() throws Exception {
+    Range range = client.getRowRange(s2bb("xyzzy"));
+    org.apache.accumulo.core.data.Range range2 = new org.apache.accumulo.core.data.Range(new Text("xyzzy"));
+    assertEquals(0, range.start.row.compareTo(t2bb(range2.getStartKey().getRow())));
+    assertEquals(0, range.stop.row.compareTo(t2bb(range2.getEndKey().getRow())));
+    assertEquals(range.startInclusive, range2.isStartKeyInclusive());
+    assertEquals(range.stopInclusive, range2.isEndKeyInclusive());
+    assertEquals(0, range.start.colFamily.compareTo(t2bb(range2.getStartKey().getColumnFamily())));
+    assertEquals(0, range.start.colQualifier.compareTo(t2bb(range2.getStartKey().getColumnQualifier())));
+    assertEquals(0, range.stop.colFamily.compareTo(t2bb(range2.getEndKey().getColumnFamily())));
+    assertEquals(0, range.stop.colQualifier.compareTo(t2bb(range2.getEndKey().getColumnQualifier())));
+    assertEquals(range.start.timestamp, range.start.timestamp);
+    assertEquals(range.stop.timestamp, range.stop.timestamp);
+  }
+
+  @Test
+  public void testCompactionStrategy() throws Exception {
+    final String tableName = getUniqueNames(1)[0];
+
+    client.createTable(creds, tableName, true, TimeType.MILLIS);
+
+    client.setProperty(creds, Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "context1", System.getProperty("user.dir")
+        + "/src/test/resources/TestCompactionStrat.jar");
+    client.setTableProperty(creds, tableName, Property.TABLE_CLASSPATH.getKey(), "context1");
+
+    client.addSplits(creds, tableName, Collections.singleton(s2bb("efg")));
+
+    client.updateAndFlush(creds, tableName, mutation("a", "cf", "cq", "v1"));
+    client.flushTable(creds, tableName, null, null, true);
+
+    client.updateAndFlush(creds, tableName, mutation("b", "cf", "cq", "v2"));
+    client.flushTable(creds, tableName, null, null, true);
+
+    client.updateAndFlush(creds, tableName, mutation("y", "cf", "cq", "v1"));
+    client.flushTable(creds, tableName, null, null, true);
+
+    client.updateAndFlush(creds, tableName, mutation("z", "cf", "cq", "v2"));
+    client.flushTable(creds, tableName, null, null, true);
+
+    assertEquals(4, countFiles(tableName));
+
+    CompactionStrategyConfig csc = new CompactionStrategyConfig();
+
+    // The EfgCompactionStrat will only compact tablets with and end row of efg
+    csc.setClassName("org.apache.accumulo.test.EfgCompactionStrat");
+
+    client.compactTable(creds, tableName, null, null, null, true, true, csc);
+
+    assertEquals(3, countFiles(tableName));
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/test/proxy/TBinaryProxyIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/proxy/TBinaryProxyIT.java b/test/src/test/java/org/apache/accumulo/test/proxy/TBinaryProxyIT.java
new file mode 100644
index 0000000..9a12383
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/proxy/TBinaryProxyIT.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.proxy;
+
+import org.apache.thrift.protocol.TBinaryProtocol;
+import org.apache.thrift.protocol.TProtocolFactory;
+
+/**
+ *
+ */
+public class TBinaryProxyIT extends SimpleProxyBase {
+
+  private static final TBinaryProtocol.Factory factory = new TBinaryProtocol.Factory();
+
+  @Override
+  public TProtocolFactory getProtocol() {
+    return factory;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/test/proxy/TCompactProxyIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/proxy/TCompactProxyIT.java b/test/src/test/java/org/apache/accumulo/test/proxy/TCompactProxyIT.java
new file mode 100644
index 0000000..4d3e775
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/proxy/TCompactProxyIT.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.proxy;
+
+import org.apache.thrift.protocol.TCompactProtocol;
+import org.apache.thrift.protocol.TProtocolFactory;
+
+/**
+ *
+ */
+public class TCompactProxyIT extends SimpleProxyBase {
+
+  private static final TCompactProtocol.Factory factory = new TCompactProtocol.Factory();
+
+  @Override
+  public TProtocolFactory getProtocol() {
+    return factory;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/test/proxy/TJsonProtocolProxyIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/proxy/TJsonProtocolProxyIT.java b/test/src/test/java/org/apache/accumulo/test/proxy/TJsonProtocolProxyIT.java
new file mode 100644
index 0000000..fa04427
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/proxy/TJsonProtocolProxyIT.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.proxy;
+
+import org.apache.thrift.protocol.TJSONProtocol;
+import org.apache.thrift.protocol.TProtocolFactory;
+
+/**
+ *
+ */
+public class TJsonProtocolProxyIT extends SimpleProxyBase {
+
+  private static final TJSONProtocol.Factory factory = new TJSONProtocol.Factory();
+
+  @Override
+  public TProtocolFactory getProtocol() {
+    return factory;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/test/proxy/TTupleProxyIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/proxy/TTupleProxyIT.java b/test/src/test/java/org/apache/accumulo/test/proxy/TTupleProxyIT.java
new file mode 100644
index 0000000..6c039dd
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/proxy/TTupleProxyIT.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.proxy;
+
+import org.apache.thrift.protocol.TProtocolFactory;
+import org.apache.thrift.protocol.TTupleProtocol;
+
+/**
+ *
+ */
+public class TTupleProxyIT extends SimpleProxyBase {
+
+  private static final TTupleProtocol.Factory factory = new TTupleProtocol.Factory();
+
+  @Override
+  public TProtocolFactory getProtocol() {
+    return factory;
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyClient.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyClient.java b/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyClient.java
new file mode 100644
index 0000000..8d3863b
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyClient.java
@@ -0,0 +1,176 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.proxy;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.iterators.user.RegExFilter;
+import org.apache.accumulo.proxy.Util;
+import org.apache.accumulo.proxy.thrift.AccumuloProxy;
+import org.apache.accumulo.proxy.thrift.ColumnUpdate;
+import org.apache.accumulo.proxy.thrift.Key;
+import org.apache.accumulo.proxy.thrift.ScanResult;
+import org.apache.accumulo.proxy.thrift.TimeType;
+import org.apache.thrift.protocol.TCompactProtocol;
+import org.apache.thrift.protocol.TProtocol;
+import org.apache.thrift.protocol.TProtocolFactory;
+import org.apache.thrift.transport.TFramedTransport;
+import org.apache.thrift.transport.TSocket;
+import org.apache.thrift.transport.TTransport;
+import org.apache.thrift.transport.TTransportException;
+
+public class TestProxyClient {
+
+  protected AccumuloProxy.Client proxy;
+  protected TTransport transport;
+
+  public TestProxyClient(String host, int port) throws TTransportException {
+    this(host, port, new TCompactProtocol.Factory());
+  }
+
+  public TestProxyClient(String host, int port, TProtocolFactory protoFactory) throws TTransportException {
+    final TSocket socket = new TSocket(host, port);
+    socket.setTimeout(600000);
+    transport = new TFramedTransport(socket);
+    final TProtocol protocol = protoFactory.getProtocol(transport);
+    proxy = new AccumuloProxy.Client(protocol);
+    transport.open();
+  }
+
+  public AccumuloProxy.Client proxy() {
+    return proxy;
+  }
+
+  public static void main(String[] args) throws Exception {
+
+    TestProxyClient tpc = new TestProxyClient("localhost", 42424);
+    String principal = "root";
+    Map<String,String> props = new TreeMap<String,String>();
+    props.put("password", "secret");
+
+    System.out.println("Logging in");
+    ByteBuffer login = tpc.proxy.login(principal, props);
+
+    System.out.println("Creating user: ");
+    if (!tpc.proxy().listLocalUsers(login).contains("testuser")) {
+      tpc.proxy().createLocalUser(login, "testuser", ByteBuffer.wrap("testpass".getBytes(UTF_8)));
+    }
+    System.out.println("UserList: " + tpc.proxy().listLocalUsers(login));
+
+    System.out.println("Listing: " + tpc.proxy().listTables(login));
+
+    System.out.println("Deleting: ");
+    String testTable = "testtableOMGOMGOMG";
+
+    System.out.println("Creating: ");
+
+    if (tpc.proxy().tableExists(login, testTable))
+      tpc.proxy().deleteTable(login, testTable);
+
+    tpc.proxy().createTable(login, testTable, true, TimeType.MILLIS);
+
+    System.out.println("Listing: " + tpc.proxy().listTables(login));
+
+    System.out.println("Writing: ");
+    Date start = new Date();
+    Date then = new Date();
+    int maxInserts = 1000000;
+    String format = "%1$05d";
+    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
+    for (int i = 0; i < maxInserts; i++) {
+      String result = String.format(format, i);
+      ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap(("cf" + i).getBytes(UTF_8)), ByteBuffer.wrap(("cq" + i).getBytes(UTF_8)));
+      update.setValue(Util.randStringBuffer(10));
+      mutations.put(ByteBuffer.wrap(result.getBytes(UTF_8)), Collections.singletonList(update));
+
+      if (i % 1000 == 0) {
+        tpc.proxy().updateAndFlush(login, testTable, mutations);
+        mutations.clear();
+      }
+    }
+    tpc.proxy().updateAndFlush(login, testTable, mutations);
+    Date end = new Date();
+    System.out.println(" End of writing: " + (end.getTime() - start.getTime()));
+
+    tpc.proxy().deleteTable(login, testTable);
+    tpc.proxy().createTable(login, testTable, true, TimeType.MILLIS);
+
+    // Thread.sleep(1000);
+
+    System.out.println("Writing async: ");
+    start = new Date();
+    then = new Date();
+    mutations.clear();
+    String writer = tpc.proxy().createWriter(login, testTable, null);
+    for (int i = 0; i < maxInserts; i++) {
+      String result = String.format(format, i);
+      Key pkey = new Key();
+      pkey.setRow(result.getBytes(UTF_8));
+      ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap(("cf" + i).getBytes(UTF_8)), ByteBuffer.wrap(("cq" + i).getBytes(UTF_8)));
+      update.setValue(Util.randStringBuffer(10));
+      mutations.put(ByteBuffer.wrap(result.getBytes(UTF_8)), Collections.singletonList(update));
+      tpc.proxy().update(writer, mutations);
+      mutations.clear();
+    }
+
+    end = new Date();
+    System.out.println(" End of writing: " + (end.getTime() - start.getTime()));
+    start = end;
+    System.out.println("Closing...");
+    tpc.proxy().closeWriter(writer);
+    end = new Date();
+    System.out.println(" End of closing: " + (end.getTime() - start.getTime()));
+
+    System.out.println("Reading: ");
+
+    String regex = "cf1.*";
+
+    IteratorSetting is = new IteratorSetting(50, regex, RegExFilter.class);
+    RegExFilter.setRegexs(is, null, regex, null, null, false);
+
+    String cookie = tpc.proxy().createScanner(login, testTable, null);
+
+    int i = 0;
+    start = new Date();
+    then = new Date();
+    boolean hasNext = true;
+
+    int k = 1000;
+    while (hasNext) {
+      ScanResult kvList = tpc.proxy().nextK(cookie, k);
+
+      Date now = new Date();
+      System.out.println(i + " " + (now.getTime() - then.getTime()));
+      then = now;
+
+      i += kvList.getResultsSize();
+      // for (TKeyValue kv:kvList.getResults()) System.out.println(new Key(kv.getKey()));
+      hasNext = kvList.isMore();
+    }
+    end = new Date();
+    System.out.println("Total entries: " + i + " total time " + (end.getTime() - start.getTime()));
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyInstanceOperations.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyInstanceOperations.java b/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyInstanceOperations.java
new file mode 100644
index 0000000..ff94dd4
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/proxy/TestProxyInstanceOperations.java
@@ -0,0 +1,84 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.Properties;
+
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.proxy.Proxy;
+import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TCompactProtocol;
+import org.apache.thrift.server.TServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.net.HostAndPort;
+
+public class TestProxyInstanceOperations {
+  private static final Logger log = LoggerFactory.getLogger(TestProxyInstanceOperations.class);
+
+  protected static TServer proxy;
+  protected static TestProxyClient tpc;
+  protected static ByteBuffer userpass;
+  protected static final int port = 10197;
+
+  @BeforeClass
+  public static void setup() throws Exception {
+    Properties prop = new Properties();
+    prop.setProperty("useMockInstance", "true");
+    prop.put("tokenClass", PasswordToken.class.getName());
+
+    proxy = Proxy.createProxyServer(HostAndPort.fromParts("localhost", port), new TCompactProtocol.Factory(), prop).server;
+    log.info("Waiting for proxy to start");
+    while (!proxy.isServing()) {
+      Thread.sleep(500);
+    }
+    log.info("Proxy started");
+    tpc = new TestProxyClient("localhost", port);
+    userpass = tpc.proxy.login("root", Collections.singletonMap("password", ""));
+  }
+
+  @AfterClass
+  public static void tearDown() throws InterruptedException {
+    proxy.stop();
+  }
+
+  @Test
+  public void properties() throws TException {
+    tpc.proxy().setProperty(userpass, "test.systemprop", "whistletips");
+
+    assertEquals(tpc.proxy().getSystemConfiguration(userpass).get("test.systemprop"), "whistletips");
+    tpc.proxy().removeProperty(userpass, "test.systemprop");
+    assertNull(tpc.proxy().getSystemConfiguration(userpass).get("test.systemprop"));
+
+  }
+
+  @Test
+  public void testClassLoad() throws TException {
+    assertTrue(tpc.proxy().testClassLoad(userpass, "org.apache.accumulo.core.iterators.user.RegExFilter", "org.apache.accumulo.core.iterators.Filter"));
+  }
+
+}


[4/5] accumulo git commit: ACCUMULO-3804 Always seal jars

Posted by ct...@apache.org.
http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java b/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java
deleted file mode 100644
index e221081..0000000
--- a/test/src/test/java/org/apache/accumulo/proxy/SimpleProxyBase.java
+++ /dev/null
@@ -1,1619 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.proxy;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.InputStreamReader;
-import java.nio.ByteBuffer;
-import java.nio.file.Files;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.UUID;
-
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Instance;
-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.Value;
-import org.apache.accumulo.core.file.FileOperations;
-import org.apache.accumulo.core.file.FileSKVWriter;
-import org.apache.accumulo.core.iterators.DevNull;
-import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
-import org.apache.accumulo.core.iterators.user.SummingCombiner;
-import org.apache.accumulo.core.iterators.user.VersioningIterator;
-import org.apache.accumulo.core.metadata.MetadataTable;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.ByteBufferUtil;
-import org.apache.accumulo.core.util.UtilWaitThread;
-import org.apache.accumulo.examples.simple.constraints.NumericValueConstraint;
-import org.apache.accumulo.harness.SharedMiniClusterIT;
-import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl;
-import org.apache.accumulo.proxy.thrift.AccumuloProxy.Client;
-import org.apache.accumulo.proxy.thrift.AccumuloSecurityException;
-import org.apache.accumulo.proxy.thrift.ActiveCompaction;
-import org.apache.accumulo.proxy.thrift.ActiveScan;
-import org.apache.accumulo.proxy.thrift.BatchScanOptions;
-import org.apache.accumulo.proxy.thrift.Column;
-import org.apache.accumulo.proxy.thrift.ColumnUpdate;
-import org.apache.accumulo.proxy.thrift.CompactionReason;
-import org.apache.accumulo.proxy.thrift.CompactionStrategyConfig;
-import org.apache.accumulo.proxy.thrift.CompactionType;
-import org.apache.accumulo.proxy.thrift.Condition;
-import org.apache.accumulo.proxy.thrift.ConditionalStatus;
-import org.apache.accumulo.proxy.thrift.ConditionalUpdates;
-import org.apache.accumulo.proxy.thrift.ConditionalWriterOptions;
-import org.apache.accumulo.proxy.thrift.DiskUsage;
-import org.apache.accumulo.proxy.thrift.IteratorScope;
-import org.apache.accumulo.proxy.thrift.IteratorSetting;
-import org.apache.accumulo.proxy.thrift.Key;
-import org.apache.accumulo.proxy.thrift.KeyValue;
-import org.apache.accumulo.proxy.thrift.MutationsRejectedException;
-import org.apache.accumulo.proxy.thrift.PartialKey;
-import org.apache.accumulo.proxy.thrift.Range;
-import org.apache.accumulo.proxy.thrift.ScanColumn;
-import org.apache.accumulo.proxy.thrift.ScanOptions;
-import org.apache.accumulo.proxy.thrift.ScanResult;
-import org.apache.accumulo.proxy.thrift.ScanState;
-import org.apache.accumulo.proxy.thrift.ScanType;
-import org.apache.accumulo.proxy.thrift.SystemPermission;
-import org.apache.accumulo.proxy.thrift.TableExistsException;
-import org.apache.accumulo.proxy.thrift.TableNotFoundException;
-import org.apache.accumulo.proxy.thrift.TablePermission;
-import org.apache.accumulo.proxy.thrift.TimeType;
-import org.apache.accumulo.proxy.thrift.UnknownScanner;
-import org.apache.accumulo.proxy.thrift.UnknownWriter;
-import org.apache.accumulo.proxy.thrift.WriterOptions;
-import org.apache.accumulo.server.util.PortUtils;
-import org.apache.accumulo.test.functional.SlowIterator;
-import org.apache.hadoop.fs.FSDataInputStream;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.FileUtil;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.io.Text;
-import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TProtocolFactory;
-import org.apache.thrift.server.TServer;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.google.common.collect.Iterators;
-import com.google.common.net.HostAndPort;
-
-/**
- * Call every method on the proxy and try to verify that it works.
- */
-public abstract class SimpleProxyBase extends SharedMiniClusterIT {
-
-  @Override
-  protected int defaultTimeoutSeconds() {
-    return 10 * 60;
-  }
-
-  private static final long ZOOKEEPER_PROPAGATION_TIME = 10 * 1000;
-  private TServer proxyServer;
-  private int proxyPort;
-  private org.apache.accumulo.proxy.thrift.AccumuloProxy.Client client;
-
-  private Map<String,String> properties = new HashMap<>();
-  private ByteBuffer creds = null;
-
-  private void waitForAccumulo(Connector c) throws Exception {
-    Iterators.size(c.createScanner(MetadataTable.NAME, Authorizations.EMPTY).iterator());
-  }
-
-  @Before
-  public void setUpProxy() throws Exception {
-    Connector c = SharedMiniClusterIT.getConnector();
-    Instance inst = c.getInstance();
-    waitForAccumulo(c);
-
-    Properties props = new Properties();
-    props.put("instance", inst.getInstanceName());
-    props.put("zookeepers", inst.getZooKeepers());
-    props.put("tokenClass", PasswordToken.class.getName());
-    // Avoid issues with locally installed client configuration files with custom properties
-    File emptyFile = Files.createTempFile(null, null).toFile();
-    emptyFile.deleteOnExit();
-    props.put("clientConfigurationFile", emptyFile.toString());
-
-    properties.put("password", SharedMiniClusterIT.getRootPassword());
-    properties.put("clientConfigurationFile", emptyFile.toString());
-
-    proxyPort = PortUtils.getRandomFreePort();
-    TProtocolFactory factory = getProtocol();
-    proxyServer = Proxy.createProxyServer(HostAndPort.fromParts("localhost", proxyPort), factory, props).server;
-    while (!proxyServer.isServing())
-      UtilWaitThread.sleep(100);
-    client = new TestProxyClient("localhost", proxyPort, factory).proxy();
-    creds = client.login("root", properties);
-  }
-
-  @After
-  public void tearDownProxy() throws Exception {
-    if (null != proxyServer) {
-      proxyServer.stop();
-    }
-  }
-
-  public abstract TProtocolFactory getProtocol();
-
-  @Test
-  public void security() throws Exception {
-    client.createLocalUser(creds, "user", s2bb(SharedMiniClusterIT.getRootPassword()));
-    ByteBuffer badLogin = client.login("user", properties);
-    client.dropLocalUser(creds, "user");
-    final String table = getUniqueNames(1)[0];
-    client.createTable(creds, table, false, TimeType.MILLIS);
-
-    final IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "200"));
-
-    try {
-      client.addConstraint(badLogin, table, NumericValueConstraint.class.getName());
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.addSplits(badLogin, table, Collections.singleton(s2bb("1")));
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.clearLocatorCache(badLogin, table);
-      fail("exception not thrown");
-    } catch (TException ex) {}
-    try {
-      client.compactTable(badLogin, table, null, null, null, true, false, null);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.cancelCompaction(badLogin, table);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.createTable(badLogin, table, false, TimeType.MILLIS);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.deleteTable(badLogin, table);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.deleteRows(badLogin, table, null, null);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.tableExists(badLogin, table);
-      fail("exception not thrown");
-    } catch (TException ex) {}
-    try {
-      client.flushTable(badLogin, table, null, null, false);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.getLocalityGroups(badLogin, table);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.getMaxRow(badLogin, table, Collections.<ByteBuffer> emptySet(), null, false, null, false);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.getTableProperties(badLogin, table);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.listSplits(badLogin, table, 10000);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.listTables(badLogin);
-      fail("exception not thrown");
-    } catch (TException ex) {}
-    try {
-      client.listConstraints(badLogin, table);
-      fail("exception not thrown");
-    } catch (TException ex) {}
-    try {
-      client.mergeTablets(badLogin, table, null, null);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.offlineTable(badLogin, table, false);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.onlineTable(badLogin, table, false);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.removeConstraint(badLogin, table, 0);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.removeTableProperty(badLogin, table, Property.TABLE_FILE_MAX.getKey());
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.renameTable(badLogin, table, "someTableName");
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      Map<String,Set<String>> groups = new HashMap<String,Set<String>>();
-      groups.put("group1", Collections.singleton("cf1"));
-      groups.put("group2", Collections.singleton("cf2"));
-      client.setLocalityGroups(badLogin, table, groups);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.setTableProperty(badLogin, table, Property.TABLE_FILE_MAX.getKey(), "0");
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.tableIdMap(badLogin);
-      fail("exception not thrown");
-    } catch (TException ex) {}
-    try {
-      client.getSiteConfiguration(badLogin);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.getSystemConfiguration(badLogin);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.getTabletServers(badLogin);
-      fail("exception not thrown");
-    } catch (TException ex) {}
-    try {
-      client.getActiveScans(badLogin, "fake");
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.getActiveCompactions(badLogin, "fakse");
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.removeProperty(badLogin, "table.split.threshold");
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.setProperty(badLogin, "table.split.threshold", "500M");
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.testClassLoad(badLogin, DevNull.class.getName(), SortedKeyValueIterator.class.getName());
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.authenticateUser(badLogin, "root", s2pp(SharedMiniClusterIT.getRootPassword()));
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      HashSet<ByteBuffer> auths = new HashSet<ByteBuffer>(Arrays.asList(s2bb("A"), s2bb("B")));
-      client.changeUserAuthorizations(badLogin, "stooge", auths);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.changeLocalUserPassword(badLogin, "stooge", s2bb(""));
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.createLocalUser(badLogin, "stooge", s2bb("password"));
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.dropLocalUser(badLogin, "stooge");
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.getUserAuthorizations(badLogin, "stooge");
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.grantSystemPermission(badLogin, "stooge", SystemPermission.CREATE_TABLE);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.grantTablePermission(badLogin, "root", table, TablePermission.WRITE);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.hasSystemPermission(badLogin, "stooge", SystemPermission.CREATE_TABLE);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.hasTablePermission(badLogin, "root", table, TablePermission.WRITE);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.listLocalUsers(badLogin);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.revokeSystemPermission(badLogin, "stooge", SystemPermission.CREATE_TABLE);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.revokeTablePermission(badLogin, "root", table, TablePermission.ALTER_TABLE);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.createScanner(badLogin, table, new ScanOptions());
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.createBatchScanner(badLogin, table, new BatchScanOptions());
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.updateAndFlush(badLogin, table, new HashMap<ByteBuffer,List<ColumnUpdate>>());
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.createWriter(badLogin, table, new WriterOptions());
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.attachIterator(badLogin, "slow", setting, EnumSet.allOf(IteratorScope.class));
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.checkIteratorConflicts(badLogin, table, setting, EnumSet.allOf(IteratorScope.class));
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      final String TABLE_TEST = getUniqueNames(1)[0];
-      client.cloneTable(badLogin, table, TABLE_TEST, false, null, null);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.exportTable(badLogin, table, "/tmp");
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.importTable(badLogin, "testify", "/tmp");
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.getIteratorSetting(badLogin, table, "foo", IteratorScope.SCAN);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.listIterators(badLogin, table);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.removeIterator(badLogin, table, "name", EnumSet.allOf(IteratorScope.class));
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.splitRangeByTablets(badLogin, table, client.getRowRange(ByteBuffer.wrap("row".getBytes())), 10);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      MiniAccumuloClusterImpl cluster = SharedMiniClusterIT.getCluster();
-      Path base = cluster.getTemporaryPath();
-      Path importDir = new Path(base, "importDir");
-      Path failuresDir = new Path(base, "failuresDir");
-      assertTrue(cluster.getFileSystem().mkdirs(importDir));
-      assertTrue(cluster.getFileSystem().mkdirs(failuresDir));
-      client.importDirectory(badLogin, table, importDir.toString(), failuresDir.toString(), true);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.pingTabletServer(badLogin, "fake");
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.login("badUser", properties);
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.testTableClassLoad(badLogin, table, VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName());
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-    try {
-      client.createConditionalWriter(badLogin, table, new ConditionalWriterOptions());
-      fail("exception not thrown");
-    } catch (AccumuloSecurityException ex) {}
-  }
-
-  @Test
-  public void tableNotFound() throws Exception {
-    final String doesNotExist = "doesNotExists";
-    try {
-      client.addConstraint(creds, doesNotExist, NumericValueConstraint.class.getName());
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.addSplits(creds, doesNotExist, Collections.<ByteBuffer> emptySet());
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    final IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "200"));
-    try {
-      client.attachIterator(creds, doesNotExist, setting, EnumSet.allOf(IteratorScope.class));
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.cancelCompaction(creds, doesNotExist);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.checkIteratorConflicts(creds, doesNotExist, setting, EnumSet.allOf(IteratorScope.class));
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.clearLocatorCache(creds, doesNotExist);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      final String TABLE_TEST = getUniqueNames(1)[0];
-      client.cloneTable(creds, doesNotExist, TABLE_TEST, false, null, null);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.compactTable(creds, doesNotExist, null, null, null, true, false, null);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.createBatchScanner(creds, doesNotExist, new BatchScanOptions());
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.createScanner(creds, doesNotExist, new ScanOptions());
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.createWriter(creds, doesNotExist, new WriterOptions());
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.deleteRows(creds, doesNotExist, null, null);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.deleteTable(creds, doesNotExist);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.exportTable(creds, doesNotExist, "/tmp");
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.flushTable(creds, doesNotExist, null, null, false);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.getIteratorSetting(creds, doesNotExist, "foo", IteratorScope.SCAN);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.getLocalityGroups(creds, doesNotExist);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.getMaxRow(creds, doesNotExist, Collections.<ByteBuffer> emptySet(), null, false, null, false);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.getTableProperties(creds, doesNotExist);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.grantTablePermission(creds, "root", doesNotExist, TablePermission.WRITE);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.hasTablePermission(creds, "root", doesNotExist, TablePermission.WRITE);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      MiniAccumuloClusterImpl cluster = SharedMiniClusterIT.getCluster();
-      Path base = cluster.getTemporaryPath();
-      Path importDir = new Path(base, "importDir");
-      Path failuresDir = new Path(base, "failuresDir");
-      assertTrue(cluster.getFileSystem().mkdirs(importDir));
-      assertTrue(cluster.getFileSystem().mkdirs(failuresDir));
-      client.importDirectory(creds, doesNotExist, importDir.toString(), failuresDir.toString(), true);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.listConstraints(creds, doesNotExist);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.listSplits(creds, doesNotExist, 10000);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.mergeTablets(creds, doesNotExist, null, null);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.offlineTable(creds, doesNotExist, false);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.onlineTable(creds, doesNotExist, false);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.removeConstraint(creds, doesNotExist, 0);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.removeIterator(creds, doesNotExist, "name", EnumSet.allOf(IteratorScope.class));
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.removeTableProperty(creds, doesNotExist, Property.TABLE_FILE_MAX.getKey());
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.renameTable(creds, doesNotExist, "someTableName");
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.revokeTablePermission(creds, "root", doesNotExist, TablePermission.ALTER_TABLE);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.setTableProperty(creds, doesNotExist, Property.TABLE_FILE_MAX.getKey(), "0");
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.splitRangeByTablets(creds, doesNotExist, client.getRowRange(ByteBuffer.wrap("row".getBytes())), 10);
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.updateAndFlush(creds, doesNotExist, new HashMap<ByteBuffer,List<ColumnUpdate>>());
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.getDiskUsage(creds, Collections.singleton(doesNotExist));
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.testTableClassLoad(creds, doesNotExist, VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName());
-      fail("exception not thrown");
-    } catch (TableNotFoundException ex) {}
-    try {
-      client.createConditionalWriter(creds, doesNotExist, new ConditionalWriterOptions());
-    } catch (TableNotFoundException ex) {}
-  }
-
-  @Test
-  public void testExists() throws Exception {
-    client.createTable(creds, "ett1", false, TimeType.MILLIS);
-    client.createTable(creds, "ett2", false, TimeType.MILLIS);
-    try {
-      client.createTable(creds, "ett1", false, TimeType.MILLIS);
-      fail("exception not thrown");
-    } catch (TableExistsException tee) {}
-    try {
-      client.renameTable(creds, "ett1", "ett2");
-      fail("exception not thrown");
-    } catch (TableExistsException tee) {}
-    try {
-      client.cloneTable(creds, "ett1", "ett2", false, new HashMap<String,String>(), new HashSet<String>());
-      fail("exception not thrown");
-    } catch (TableExistsException tee) {}
-  }
-
-  @Test
-  public void testUnknownScanner() throws Exception {
-    final String TABLE_TEST = getUniqueNames(1)[0];
-
-    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
-
-    String scanner = client.createScanner(creds, TABLE_TEST, null);
-    assertFalse(client.hasNext(scanner));
-    client.closeScanner(scanner);
-
-    try {
-      client.hasNext(scanner);
-      fail("exception not thrown");
-    } catch (UnknownScanner us) {}
-
-    try {
-      client.closeScanner(scanner);
-      fail("exception not thrown");
-    } catch (UnknownScanner us) {}
-
-    try {
-      client.nextEntry("99999999");
-      fail("exception not thrown");
-    } catch (UnknownScanner us) {}
-    try {
-      client.nextK("99999999", 6);
-      fail("exception not thrown");
-    } catch (UnknownScanner us) {}
-    try {
-      client.hasNext("99999999");
-      fail("exception not thrown");
-    } catch (UnknownScanner us) {}
-    try {
-      client.hasNext(UUID.randomUUID().toString());
-      fail("exception not thrown");
-    } catch (UnknownScanner us) {}
-  }
-
-  @Test
-  public void testUnknownWriter() throws Exception {
-    final String TABLE_TEST = getUniqueNames(1)[0];
-
-    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
-
-    String writer = client.createWriter(creds, TABLE_TEST, null);
-    client.update(writer, mutation("row0", "cf", "cq", "value"));
-    client.flush(writer);
-    client.update(writer, mutation("row2", "cf", "cq", "value2"));
-    client.closeWriter(writer);
-
-    // this is a oneway call, so it does not throw exceptions
-    client.update(writer, mutation("row2", "cf", "cq", "value2"));
-
-    try {
-      client.flush(writer);
-      fail("exception not thrown");
-    } catch (UnknownWriter uw) {}
-    try {
-      client.flush("99999");
-      fail("exception not thrown");
-    } catch (UnknownWriter uw) {}
-    try {
-      client.flush(UUID.randomUUID().toString());
-      fail("exception not thrown");
-    } catch (UnknownWriter uw) {}
-    try {
-      client.closeWriter("99999");
-      fail("exception not thrown");
-    } catch (UnknownWriter uw) {}
-  }
-
-  @Test
-  public void testDelete() throws Exception {
-    final String TABLE_TEST = getUniqueNames(1)[0];
-
-    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
-    client.updateAndFlush(creds, TABLE_TEST, mutation("row0", "cf", "cq", "value"));
-
-    assertScan(new String[][] {{"row0", "cf", "cq", "value"}}, TABLE_TEST);
-
-    ColumnUpdate upd = new ColumnUpdate(s2bb("cf"), s2bb("cq"));
-    upd.setDeleteCell(false);
-    Map<ByteBuffer,List<ColumnUpdate>> notDelete = Collections.singletonMap(s2bb("row0"), Collections.singletonList(upd));
-    client.updateAndFlush(creds, TABLE_TEST, notDelete);
-    String scanner = client.createScanner(creds, TABLE_TEST, null);
-    ScanResult entries = client.nextK(scanner, 10);
-    client.closeScanner(scanner);
-    assertFalse(entries.more);
-    assertEquals(1, entries.results.size());
-
-    upd = new ColumnUpdate(s2bb("cf"), s2bb("cq"));
-    upd.setDeleteCell(true);
-    Map<ByteBuffer,List<ColumnUpdate>> delete = Collections.singletonMap(s2bb("row0"), Collections.singletonList(upd));
-
-    client.updateAndFlush(creds, TABLE_TEST, delete);
-
-    assertScan(new String[][] {}, TABLE_TEST);
-  }
-
-  @Test
-  public void testInstanceOperations() throws Exception {
-    int tservers = 0;
-    for (String tserver : client.getTabletServers(creds)) {
-      client.pingTabletServer(creds, tserver);
-      tservers++;
-    }
-    assertTrue(tservers > 0);
-
-    // get something we know is in the site config
-    MiniAccumuloClusterImpl cluster = SharedMiniClusterIT.getCluster();
-    Map<String,String> cfg = client.getSiteConfiguration(creds);
-    assertTrue(cfg.get("instance.dfs.dir").startsWith(cluster.getConfig().getAccumuloDir().getAbsolutePath()));
-
-    // set a property in zookeeper
-    client.setProperty(creds, "table.split.threshold", "500M");
-
-    // check that we can read it
-    for (int i = 0; i < 5; i++) {
-      cfg = client.getSystemConfiguration(creds);
-      if ("500M".equals(cfg.get("table.split.threshold")))
-        break;
-      UtilWaitThread.sleep(200);
-    }
-    assertEquals("500M", cfg.get("table.split.threshold"));
-
-    // unset the setting, check that it's not what it was
-    client.removeProperty(creds, "table.split.threshold");
-    for (int i = 0; i < 5; i++) {
-      cfg = client.getSystemConfiguration(creds);
-      if (!"500M".equals(cfg.get("table.split.threshold")))
-        break;
-      UtilWaitThread.sleep(200);
-    }
-    assertNotEquals("500M", cfg.get("table.split.threshold"));
-
-    // try to load some classes via the proxy
-    assertTrue(client.testClassLoad(creds, DevNull.class.getName(), SortedKeyValueIterator.class.getName()));
-    assertFalse(client.testClassLoad(creds, "foo.bar", SortedKeyValueIterator.class.getName()));
-
-    // create a table that's very slow, so we can look for scans/compactions
-    client.createTable(creds, "slow", true, TimeType.MILLIS);
-    IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "250"));
-    client.attachIterator(creds, "slow", setting, EnumSet.allOf(IteratorScope.class));
-
-    // Should take 10 seconds to read every record
-    for (int i = 0; i < 40; i++) {
-      client.updateAndFlush(creds, "slow", mutation("row" + i, "cf", "cq", "value"));
-    }
-
-    // scan
-    Thread t = new Thread() {
-      @Override
-      public void run() {
-        String scanner;
-        try {
-          Client client2 = new TestProxyClient("localhost", proxyPort, getProtocol()).proxy();
-          scanner = client2.createScanner(creds, "slow", null);
-          client2.nextK(scanner, 10);
-          client2.closeScanner(scanner);
-        } catch (Exception e) {
-          throw new RuntimeException(e);
-        }
-      }
-    };
-    t.start();
-
-    // look for the scan many times
-    List<ActiveScan> scans = new ArrayList<ActiveScan>();
-    for (int i = 0; i < 100 && scans.isEmpty(); i++) {
-      for (String tserver : client.getTabletServers(creds)) {
-        List<ActiveScan> scansForServer = client.getActiveScans(creds, tserver);
-        for (ActiveScan scan : scansForServer) {
-          if ("root".equals(scan.getUser())) {
-            scans.add(scan);
-          }
-        }
-
-        if (!scans.isEmpty())
-          break;
-        UtilWaitThread.sleep(100);
-      }
-    }
-    t.join();
-
-    assertFalse(scans.isEmpty());
-    boolean found = false;
-    Map<String,String> map = null;
-    for (int i = 0; i < scans.size() && !found; i++) {
-      ActiveScan scan = scans.get(i);
-      if ("root".equals(scan.getUser())) {
-        assertTrue(ScanState.RUNNING.equals(scan.getState()) || ScanState.QUEUED.equals(scan.getState()));
-        assertEquals(ScanType.SINGLE, scan.getType());
-        assertEquals("slow", scan.getTable());
-
-        map = client.tableIdMap(creds);
-        assertEquals(map.get("slow"), scan.getExtent().tableId);
-        assertTrue(scan.getExtent().endRow == null);
-        assertTrue(scan.getExtent().prevEndRow == null);
-        found = true;
-      }
-    }
-
-    assertTrue("Could not find a scan against the 'slow' table", found);
-
-    // start a compaction
-    t = new Thread() {
-      @Override
-      public void run() {
-        try {
-          Client client2 = new TestProxyClient("localhost", proxyPort, getProtocol()).proxy();
-          client2.compactTable(creds, "slow", null, null, null, true, true, null);
-        } catch (Exception e) {
-          throw new RuntimeException(e);
-        }
-      }
-    };
-    t.start();
-
-    final String desiredTableId = map.get("slow");
-
-    // try to catch it in the act
-    List<ActiveCompaction> compactions = new ArrayList<ActiveCompaction>();
-    for (int i = 0; i < 100 && compactions.isEmpty(); i++) {
-      // Iterate over the tservers
-      for (String tserver : client.getTabletServers(creds)) {
-        // And get the compactions on each
-        List<ActiveCompaction> compactionsOnServer = client.getActiveCompactions(creds, tserver);
-        for (ActiveCompaction compact : compactionsOnServer) {
-          // There might be other compactions occurring (e.g. on METADATA) in which
-          // case we want to prune out those that aren't for our slow table
-          if (desiredTableId.equals(compact.getExtent().tableId)) {
-            compactions.add(compact);
-          }
-        }
-
-        // If we found a compaction for the table we wanted, so we can stop looking
-        if (!compactions.isEmpty())
-          break;
-      }
-      UtilWaitThread.sleep(10);
-    }
-    t.join();
-
-    // verify the compaction information
-    assertFalse(compactions.isEmpty());
-    for (ActiveCompaction c : compactions) {
-      if (desiredTableId.equals(c.getExtent().tableId)) {
-        assertTrue(c.inputFiles.isEmpty());
-        assertEquals(CompactionType.MINOR, c.getType());
-        assertEquals(CompactionReason.USER, c.getReason());
-        assertEquals("", c.localityGroup);
-        assertTrue(c.outputFile.contains("default_tablet"));
-
-        return;
-      }
-    }
-    fail("Expection to find running compaction for table 'slow' but did not find one");
-  }
-
-  @Test
-  public void testSecurityOperations() throws Exception {
-    final String TABLE_TEST = getUniqueNames(1)[0];
-
-    // check password
-    assertTrue(client.authenticateUser(creds, "root", s2pp(SharedMiniClusterIT.getRootPassword())));
-    assertFalse(client.authenticateUser(creds, "root", s2pp("")));
-
-    // create a user
-    client.createLocalUser(creds, "stooge", s2bb("password"));
-    // change auths
-    Set<String> users = client.listLocalUsers(creds);
-    assertEquals(new HashSet<String>(Arrays.asList("root", "stooge")), users);
-    HashSet<ByteBuffer> auths = new HashSet<ByteBuffer>(Arrays.asList(s2bb("A"), s2bb("B")));
-    client.changeUserAuthorizations(creds, "stooge", auths);
-    List<ByteBuffer> update = client.getUserAuthorizations(creds, "stooge");
-    assertEquals(auths, new HashSet<ByteBuffer>(update));
-
-    // change password
-    client.changeLocalUserPassword(creds, "stooge", s2bb(""));
-    assertTrue(client.authenticateUser(creds, "stooge", s2pp("")));
-
-    // check permission failure
-    @SuppressWarnings("serial")
-    ByteBuffer stooge = client.login("stooge", new TreeMap<String,String>() {
-      {
-        put("password", "");
-      }
-    });
-
-    try {
-      client.createTable(stooge, "fail", true, TimeType.MILLIS);
-      fail("should not create the table");
-    } catch (AccumuloSecurityException ex) {
-      assertFalse(client.listTables(creds).contains("fail"));
-    }
-    // grant permissions and test
-    assertFalse(client.hasSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE));
-    client.grantSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE);
-    assertTrue(client.hasSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE));
-    client.createTable(stooge, "success", true, TimeType.MILLIS);
-    client.listTables(creds).contains("succcess");
-
-    // revoke permissions
-    client.revokeSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE);
-    assertFalse(client.hasSystemPermission(creds, "stooge", SystemPermission.CREATE_TABLE));
-    try {
-      client.createTable(stooge, "fail", true, TimeType.MILLIS);
-      fail("should not create the table");
-    } catch (AccumuloSecurityException ex) {
-      assertFalse(client.listTables(creds).contains("fail"));
-    }
-    // create a table to test table permissions
-    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
-    // denied!
-    try {
-      String scanner = client.createScanner(stooge, TABLE_TEST, null);
-      client.nextK(scanner, 100);
-      fail("stooge should not read table test");
-    } catch (AccumuloSecurityException ex) {}
-    // grant
-    assertFalse(client.hasTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ));
-    client.grantTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ);
-    assertTrue(client.hasTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ));
-    String scanner = client.createScanner(stooge, TABLE_TEST, null);
-    client.nextK(scanner, 10);
-    client.closeScanner(scanner);
-    // revoke
-    client.revokeTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ);
-    assertFalse(client.hasTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ));
-    try {
-      scanner = client.createScanner(stooge, TABLE_TEST, null);
-      client.nextK(scanner, 100);
-      fail("stooge should not read table test");
-    } catch (AccumuloSecurityException ex) {}
-
-    // delete user
-    client.dropLocalUser(creds, "stooge");
-    users = client.listLocalUsers(creds);
-    assertEquals(1, users.size());
-
-  }
-
-  @Test
-  public void testBatchWriter() throws Exception {
-    final String TABLE_TEST = getUniqueNames(1)[0];
-
-    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
-    client.addConstraint(creds, TABLE_TEST, NumericValueConstraint.class.getName());
-    // zookeeper propagation time
-    UtilWaitThread.sleep(ZOOKEEPER_PROPAGATION_TIME);
-
-    WriterOptions writerOptions = new WriterOptions();
-    writerOptions.setLatencyMs(10000);
-    writerOptions.setMaxMemory(2);
-    writerOptions.setThreads(1);
-    writerOptions.setTimeoutMs(100000);
-
-    String batchWriter = client.createWriter(creds, TABLE_TEST, writerOptions);
-    client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
-    client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
-    try {
-      client.flush(batchWriter);
-      fail("constraint did not fire");
-    } catch (MutationsRejectedException ex) {}
-    try {
-      client.closeWriter(batchWriter);
-      fail("constraint did not fire");
-    } catch (MutationsRejectedException e) {}
-
-    client.removeConstraint(creds, TABLE_TEST, 2);
-
-    assertScan(new String[][] {}, TABLE_TEST);
-
-    UtilWaitThread.sleep(2000);
-
-    writerOptions = new WriterOptions();
-    writerOptions.setLatencyMs(10000);
-    writerOptions.setMaxMemory(3000);
-    writerOptions.setThreads(1);
-    writerOptions.setTimeoutMs(100000);
-
-    batchWriter = client.createWriter(creds, TABLE_TEST, writerOptions);
-
-    client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
-    client.flush(batchWriter);
-    client.closeWriter(batchWriter);
-
-    assertScan(new String[][] {{"row1", "cf", "cq", "x"}}, TABLE_TEST);
-
-    client.deleteTable(creds, TABLE_TEST);
-  }
-
-  @Test
-  public void testTableOperations() throws Exception {
-    String names[] = getUniqueNames(2);
-    final String TABLE_TEST = names[0];
-    final String TABLE_TEST2 = names[1];
-
-    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
-    // constraints
-    client.addConstraint(creds, TABLE_TEST, NumericValueConstraint.class.getName());
-    assertEquals(2, client.listConstraints(creds, TABLE_TEST).size());
-
-    // zookeeper propagation time
-    UtilWaitThread.sleep(ZOOKEEPER_PROPAGATION_TIME);
-
-    client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "123"));
-
-    while (true) {
-      try {
-        client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "x"));
-        UtilWaitThread.sleep(1000);
-      } catch (MutationsRejectedException ex) {
-        break;
-      }
-    }
-
-    client.removeConstraint(creds, TABLE_TEST, 2);
-
-    UtilWaitThread.sleep(2000);
-
-    assertEquals(1, client.listConstraints(creds, TABLE_TEST).size());
-
-    while (true) {
-      try {
-        client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "x"));
-        break;
-      } catch (MutationsRejectedException ex) {
-        UtilWaitThread.sleep(1000);
-      }
-    }
-    assertScan(new String[][] {{"row1", "cf", "cq", "x"}}, TABLE_TEST);
-    // splits, merge
-    client.addSplits(creds, TABLE_TEST, new HashSet<ByteBuffer>(Arrays.asList(s2bb("a"), s2bb("m"), s2bb("z"))));
-    List<ByteBuffer> splits = client.listSplits(creds, TABLE_TEST, 1);
-    assertEquals(Arrays.asList(s2bb("m")), splits);
-    client.mergeTablets(creds, TABLE_TEST, null, s2bb("m"));
-    splits = client.listSplits(creds, TABLE_TEST, 10);
-    assertEquals(Arrays.asList(s2bb("m"), s2bb("z")), splits);
-    client.mergeTablets(creds, TABLE_TEST, null, null);
-    splits = client.listSplits(creds, TABLE_TEST, 10);
-    List<ByteBuffer> empty = Collections.emptyList();
-    assertEquals(empty, splits);
-    // iterators
-    client.deleteTable(creds, TABLE_TEST);
-    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
-    HashMap<String,String> options = new HashMap<String,String>();
-    options.put("type", "STRING");
-    options.put("columns", "cf");
-    IteratorSetting setting = new IteratorSetting(10, TABLE_TEST, SummingCombiner.class.getName(), options);
-    client.attachIterator(creds, TABLE_TEST, setting, EnumSet.allOf(IteratorScope.class));
-    for (int i = 0; i < 10; i++) {
-      client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "1"));
-    }
-    assertScan(new String[][] {{"row1", "cf", "cq", "10"}}, TABLE_TEST);
-    try {
-      client.checkIteratorConflicts(creds, TABLE_TEST, setting, EnumSet.allOf(IteratorScope.class));
-      fail("checkIteratorConflicts did not throw an exception");
-    } catch (Exception ex) {
-      System.out.println("Ignoring " + ex.toString());
-    }
-    client.deleteRows(creds, TABLE_TEST, null, null);
-    client.removeIterator(creds, TABLE_TEST, "test", EnumSet.allOf(IteratorScope.class));
-    String expected[][] = new String[10][];
-    for (int i = 0; i < 10; i++) {
-      client.updateAndFlush(creds, TABLE_TEST, mutation("row" + i, "cf", "cq", "" + i));
-      expected[i] = new String[] {"row" + i, "cf", "cq", "" + i};
-      client.flushTable(creds, TABLE_TEST, null, null, true);
-    }
-    assertScan(expected, TABLE_TEST);
-    // clone
-    client.cloneTable(creds, TABLE_TEST, TABLE_TEST2, true, null, null);
-    assertScan(expected, TABLE_TEST2);
-    client.deleteTable(creds, TABLE_TEST2);
-
-    // don't know how to test this, call it just for fun
-    client.clearLocatorCache(creds, TABLE_TEST);
-
-    // compact
-    client.compactTable(creds, TABLE_TEST, null, null, null, true, true, null);
-    assertEquals(1, countFiles(TABLE_TEST));
-    assertScan(expected, TABLE_TEST);
-
-    // get disk usage
-    client.cloneTable(creds, TABLE_TEST, TABLE_TEST2, true, null, null);
-    Set<String> tablesToScan = new HashSet<String>();
-    tablesToScan.add(TABLE_TEST);
-    tablesToScan.add(TABLE_TEST2);
-    tablesToScan.add("foo");
-    client.createTable(creds, "foo", true, TimeType.MILLIS);
-    List<DiskUsage> diskUsage = (client.getDiskUsage(creds, tablesToScan));
-    assertEquals(2, diskUsage.size());
-    assertEquals(2, diskUsage.get(0).getTables().size());
-    assertEquals(1, diskUsage.get(1).getTables().size());
-    client.compactTable(creds, TABLE_TEST2, null, null, null, true, true, null);
-    diskUsage = (client.getDiskUsage(creds, tablesToScan));
-    assertEquals(3, diskUsage.size());
-    assertEquals(1, diskUsage.get(0).getTables().size());
-    assertEquals(1, diskUsage.get(1).getTables().size());
-    assertEquals(1, diskUsage.get(2).getTables().size());
-    client.deleteTable(creds, "foo");
-    client.deleteTable(creds, TABLE_TEST2);
-
-    // export/import
-    MiniAccumuloClusterImpl cluster = SharedMiniClusterIT.getCluster();
-    FileSystem fs = cluster.getFileSystem();
-    Path base = cluster.getTemporaryPath();
-    Path dir = new Path(base, "test");
-    assertTrue(fs.mkdirs(dir));
-    Path destDir = new Path(base, "test_dest");
-    assertTrue(fs.mkdirs(destDir));
-    client.offlineTable(creds, TABLE_TEST, false);
-    client.exportTable(creds, TABLE_TEST, dir.toString());
-    // copy files to a new location
-    FSDataInputStream is = fs.open(new Path(dir, "distcp.txt"));
-    try (BufferedReader r = new BufferedReader(new InputStreamReader(is))) {
-      while (true) {
-        String line = r.readLine();
-        if (line == null)
-          break;
-        Path srcPath = new Path(line);
-        FileUtil.copy(fs, srcPath, fs, destDir, false, fs.getConf());
-      }
-    }
-    client.deleteTable(creds, TABLE_TEST);
-    client.importTable(creds, "testify", destDir.toString());
-    assertScan(expected, "testify");
-    client.deleteTable(creds, "testify");
-
-    try {
-      // ACCUMULO-1558 a second import from the same dir should fail, the first import moved the files
-      client.importTable(creds, "testify2", destDir.toString());
-      fail();
-    } catch (Exception e) {}
-
-    assertFalse(client.listTables(creds).contains("testify2"));
-
-    // Locality groups
-    client.createTable(creds, "test", true, TimeType.MILLIS);
-    Map<String,Set<String>> groups = new HashMap<String,Set<String>>();
-    groups.put("group1", Collections.singleton("cf1"));
-    groups.put("group2", Collections.singleton("cf2"));
-    client.setLocalityGroups(creds, "test", groups);
-    assertEquals(groups, client.getLocalityGroups(creds, "test"));
-    // table properties
-    Map<String,String> orig = client.getTableProperties(creds, "test");
-    client.setTableProperty(creds, "test", "table.split.threshold", "500M");
-    Map<String,String> update = client.getTableProperties(creds, "test");
-    assertEquals(update.get("table.split.threshold"), "500M");
-    client.removeTableProperty(creds, "test", "table.split.threshold");
-    update = client.getTableProperties(creds, "test");
-    assertEquals(orig, update);
-    // rename table
-    Map<String,String> tables = client.tableIdMap(creds);
-    client.renameTable(creds, "test", "bar");
-    Map<String,String> tables2 = client.tableIdMap(creds);
-    assertEquals(tables.get("test"), tables2.get("bar"));
-    // table exists
-    assertTrue(client.tableExists(creds, "bar"));
-    assertFalse(client.tableExists(creds, "test"));
-    // bulk import
-    String filename = dir + "/bulk/import/rfile.rf";
-    FileSKVWriter writer = FileOperations.getInstance().openWriter(filename, fs, fs.getConf(), DefaultConfiguration.getInstance());
-    writer.startDefaultLocalityGroup();
-    writer.append(new org.apache.accumulo.core.data.Key(new Text("a"), new Text("b"), new Text("c")), new Value("value".getBytes()));
-    writer.close();
-    fs.mkdirs(new Path(dir + "/bulk/fail"));
-    client.importDirectory(creds, "bar", dir + "/bulk/import", dir + "/bulk/fail", true);
-    String scanner = client.createScanner(creds, "bar", null);
-    ScanResult more = client.nextK(scanner, 100);
-    client.closeScanner(scanner);
-    assertEquals(1, more.results.size());
-    ByteBuffer maxRow = client.getMaxRow(creds, "bar", null, null, false, null, false);
-    assertEquals(s2bb("a"), maxRow);
-
-    assertFalse(client.testTableClassLoad(creds, "bar", "abc123", SortedKeyValueIterator.class.getName()));
-    assertTrue(client.testTableClassLoad(creds, "bar", VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName()));
-  }
-
-  private Condition newCondition(String cf, String cq) {
-    return new Condition(new Column(s2bb(cf), s2bb(cq), s2bb("")));
-  }
-
-  private Condition newCondition(String cf, String cq, String val) {
-    return newCondition(cf, cq).setValue(s2bb(val));
-  }
-
-  private Condition newCondition(String cf, String cq, long ts, String val) {
-    return newCondition(cf, cq).setValue(s2bb(val)).setTimestamp(ts);
-  }
-
-  private ColumnUpdate newColUpdate(String cf, String cq, String val) {
-    return new ColumnUpdate(s2bb(cf), s2bb(cq)).setValue(s2bb(val));
-  }
-
-  private ColumnUpdate newColUpdate(String cf, String cq, long ts, String val) {
-    return new ColumnUpdate(s2bb(cf), s2bb(cq)).setTimestamp(ts).setValue(s2bb(val));
-  }
-
-  private void assertScan(String[][] expected, String table) throws Exception {
-    String scid = client.createScanner(creds, table, new ScanOptions());
-    ScanResult keyValues = client.nextK(scid, expected.length + 1);
-
-    assertEquals(expected.length, keyValues.results.size());
-    assertFalse(keyValues.more);
-
-    for (int i = 0; i < keyValues.results.size(); i++) {
-      checkKey(expected[i][0], expected[i][1], expected[i][2], expected[i][3], keyValues.results.get(i));
-    }
-
-    client.closeScanner(scid);
-  }
-
-  @Test
-  public void testConditionalWriter() throws Exception {
-    final String TABLE_TEST = getUniqueNames(1)[0];
-
-    client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
-
-    client.addConstraint(creds, TABLE_TEST, NumericValueConstraint.class.getName());
-    UtilWaitThread.sleep(ZOOKEEPER_PROPAGATION_TIME);
-
-    String cwid = client.createConditionalWriter(creds, TABLE_TEST, new ConditionalWriterOptions());
-
-    Map<ByteBuffer,ConditionalUpdates> updates = new HashMap<ByteBuffer,ConditionalUpdates>();
-
-    updates.put(
-        s2bb("00345"),
-        new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq")), Arrays.asList(newColUpdate("meta", "seq", 10, "1"),
-            newColUpdate("data", "img", "73435435"))));
-
-    Map<ByteBuffer,ConditionalStatus> results = client.updateRowsConditionally(cwid, updates);
-
-    assertEquals(1, results.size());
-    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00345")));
-
-    assertScan(new String[][] { {"00345", "data", "img", "73435435"}, {"00345", "meta", "seq", "1"}}, TABLE_TEST);
-
-    // test not setting values on conditions
-    updates.clear();
-
-    updates.put(s2bb("00345"), new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq")), Arrays.asList(newColUpdate("meta", "seq", "2"))));
-    updates.put(s2bb("00346"), new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq")), Arrays.asList(newColUpdate("meta", "seq", "1"))));
-
-    results = client.updateRowsConditionally(cwid, updates);
-
-    assertEquals(2, results.size());
-    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00345")));
-    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00346")));
-
-    assertScan(new String[][] { {"00345", "data", "img", "73435435"}, {"00345", "meta", "seq", "1"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
-
-    // test setting values on conditions
-    updates.clear();
-
-    updates.put(
-        s2bb("00345"),
-        new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", "1")), Arrays.asList(newColUpdate("meta", "seq", 20, "2"),
-            newColUpdate("data", "img", "567890"))));
-
-    updates.put(s2bb("00346"), new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", "2")), Arrays.asList(newColUpdate("meta", "seq", "3"))));
-
-    results = client.updateRowsConditionally(cwid, updates);
-
-    assertEquals(2, results.size());
-    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00345")));
-    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00346")));
-
-    assertScan(new String[][] { {"00345", "data", "img", "567890"}, {"00345", "meta", "seq", "2"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
-
-    // test setting timestamp on condition to a non-existant version
-    updates.clear();
-
-    updates.put(
-        s2bb("00345"),
-        new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", 10, "2")), Arrays.asList(newColUpdate("meta", "seq", 30, "3"),
-            newColUpdate("data", "img", "1234567890"))));
-
-    results = client.updateRowsConditionally(cwid, updates);
-
-    assertEquals(1, results.size());
-    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00345")));
-
-    assertScan(new String[][] { {"00345", "data", "img", "567890"}, {"00345", "meta", "seq", "2"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
-
-    // test setting timestamp to an existing version
-
-    updates.clear();
-
-    updates.put(
-        s2bb("00345"),
-        new ConditionalUpdates(Arrays.asList(newCondition("meta", "seq", 20, "2")), Arrays.asList(newColUpdate("meta", "seq", 30, "3"),
-            newColUpdate("data", "img", "1234567890"))));
-
-    results = client.updateRowsConditionally(cwid, updates);
-
-    assertEquals(1, results.size());
-    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00345")));
-
-    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"}}, TABLE_TEST);
-
-    // run test w/ condition that has iterators
-    // following should fail w/o iterator
-    client.updateAndFlush(creds, TABLE_TEST, Collections.singletonMap(s2bb("00347"), Arrays.asList(newColUpdate("data", "count", "1"))));
-    client.updateAndFlush(creds, TABLE_TEST, Collections.singletonMap(s2bb("00347"), Arrays.asList(newColUpdate("data", "count", "1"))));
-    client.updateAndFlush(creds, TABLE_TEST, Collections.singletonMap(s2bb("00347"), Arrays.asList(newColUpdate("data", "count", "1"))));
-
-    updates.clear();
-    updates.put(s2bb("00347"),
-        new ConditionalUpdates(Arrays.asList(newCondition("data", "count", "3")), Arrays.asList(newColUpdate("data", "img", "1234567890"))));
-
-    results = client.updateRowsConditionally(cwid, updates);
-
-    assertEquals(1, results.size());
-    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
-
-    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
-        {"00347", "data", "count", "1"}}, TABLE_TEST);
-
-    // following test w/ iterator setup should succeed
-    Condition iterCond = newCondition("data", "count", "3");
-    Map<String,String> props = new HashMap<String,String>();
-    props.put("type", "STRING");
-    props.put("columns", "data:count");
-    IteratorSetting is = new IteratorSetting(1, "sumc", SummingCombiner.class.getName(), props);
-    iterCond.setIterators(Arrays.asList(is));
-
-    updates.clear();
-    updates.put(s2bb("00347"), new ConditionalUpdates(Arrays.asList(iterCond), Arrays.asList(newColUpdate("data", "img", "1234567890"))));
-
-    results = client.updateRowsConditionally(cwid, updates);
-
-    assertEquals(1, results.size());
-    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00347")));
-
-    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
-        {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
-
-    // test a mutation that violated a constraint
-    updates.clear();
-    updates.put(s2bb("00347"),
-        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "1234567890")), Arrays.asList(newColUpdate("data", "count", "A"))));
-
-    results = client.updateRowsConditionally(cwid, updates);
-
-    assertEquals(1, results.size());
-    assertEquals(ConditionalStatus.VIOLATED, results.get(s2bb("00347")));
-
-    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
-        {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
-
-    // run test with two conditions
-    // both conditions should fail
-    updates.clear();
-    updates.put(
-        s2bb("00347"),
-        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "565"), newCondition("data", "count", "2")), Arrays.asList(
-            newColUpdate("data", "count", "3"), newColUpdate("data", "img", "0987654321"))));
-
-    results = client.updateRowsConditionally(cwid, updates);
-
-    assertEquals(1, results.size());
-    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
-
-    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
-        {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
-
-    // one condition should fail
-    updates.clear();
-    updates.put(
-        s2bb("00347"),
-        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "1234567890"), newCondition("data", "count", "2")), Arrays.asList(
-            newColUpdate("data", "count", "3"), newColUpdate("data", "img", "0987654321"))));
-
-    results = client.updateRowsConditionally(cwid, updates);
-
-    assertEquals(1, results.size());
-    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
-
-    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
-        {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
-
-    // one condition should fail
-    updates.clear();
-    updates.put(
-        s2bb("00347"),
-        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "565"), newCondition("data", "count", "1")), Arrays.asList(
-            newColUpdate("data", "count", "3"), newColUpdate("data", "img", "0987654321"))));
-
-    results = client.updateRowsConditionally(cwid, updates);
-
-    assertEquals(1, results.size());
-    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00347")));
-
-    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
-        {"00347", "data", "count", "1"}, {"00347", "data", "img", "1234567890"}}, TABLE_TEST);
-
-    // both conditions should succeed
-
-    ConditionalStatus result = client.updateRowConditionally(
-        creds,
-        TABLE_TEST,
-        s2bb("00347"),
-        new ConditionalUpdates(Arrays.asList(newCondition("data", "img", "1234567890"), newCondition("data", "count", "1")), Arrays.asList(
-            newColUpdate("data", "count", "3"), newColUpdate("data", "img", "0987654321"))));
-
-    assertEquals(ConditionalStatus.ACCEPTED, result);
-
-    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
-        {"00347", "data", "count", "3"}, {"00347", "data", "img", "0987654321"}}, TABLE_TEST);
-
-    client.closeConditionalWriter(cwid);
-    try {
-      client.updateRowsConditionally(cwid, updates);
-      fail("conditional writer not closed");
-    } catch (UnknownWriter uk) {}
-
-    // run test with colvis
-    client.createLocalUser(creds, "cwuser", s2bb("bestpasswordever"));
-    client.changeUserAuthorizations(creds, "cwuser", Collections.singleton(s2bb("A")));
-    client.grantTablePermission(creds, "cwuser", TABLE_TEST, TablePermission.WRITE);
-    client.grantTablePermission(creds, "cwuser", TABLE_TEST, TablePermission.READ);
-
-    ByteBuffer cwuCreds = client.login("cwuser", Collections.singletonMap("password", "bestpasswordever"));
-
-    cwid = client.createConditionalWriter(cwuCreds, TABLE_TEST, new ConditionalWriterOptions().setAuthorizations(Collections.singleton(s2bb("A"))));
-
-    updates.clear();
-    updates.put(
-        s2bb("00348"),
-        new ConditionalUpdates(Arrays.asList(new Condition(new Column(s2bb("data"), s2bb("c"), s2bb("A")))), Arrays.asList(newColUpdate("data", "seq", "1"),
-            newColUpdate("data", "c", "1").setColVisibility(s2bb("A")))));
-    updates.put(s2bb("00349"),
-        new ConditionalUpdates(Arrays.asList(new Condition(new Column(s2bb("data"), s2bb("c"), s2bb("B")))), Arrays.asList(newColUpdate("data", "seq", "1"))));
-
-    results = client.updateRowsConditionally(cwid, updates);
-
-    assertEquals(2, results.size());
-    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00348")));
-    assertEquals(ConditionalStatus.INVISIBLE_VISIBILITY, results.get(s2bb("00349")));
-
-    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
-        {"00347", "data", "count", "3"}, {"00347", "data", "img", "0987654321"}, {"00348", "data", "seq", "1"}}, TABLE_TEST);
-
-    updates.clear();
-
-    updates.clear();
-    updates.put(
-        s2bb("00348"),
-        new ConditionalUpdates(Arrays.asList(new Condition(new Column(s2bb("data"), s2bb("c"), s2bb("A"))).setValue(s2bb("0"))), Arrays.asList(
-            newColUpdate("data", "seq", "2"), newColUpdate("data", "c", "2").setColVisibility(s2bb("A")))));
-
-    results = client.updateRowsConditionally(cwid, updates);
-
-    assertEquals(1, results.size());
-    assertEquals(ConditionalStatus.REJECTED, results.get(s2bb("00348")));
-
-    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
-        {"00347", "data", "count", "3"}, {"00347", "data", "img", "0987654321"}, {"00348", "data", "seq", "1"}}, TABLE_TEST);
-
-    updates.clear();
-    updates.put(
-        s2bb("00348"),
-        new ConditionalUpdates(Arrays.asList(new Condition(new Column(s2bb("data"), s2bb("c"), s2bb("A"))).setValue(s2bb("1"))), Arrays.asList(
-            newColUpdate("data", "seq", "2"), newColUpdate("data", "c", "2").setColVisibility(s2bb("A")))));
-
-    results = client.updateRowsConditionally(cwid, updates);
-
-    assertEquals(1, results.size());
-    assertEquals(ConditionalStatus.ACCEPTED, results.get(s2bb("00348")));
-
-    assertScan(new String[][] { {"00345", "data", "img", "1234567890"}, {"00345", "meta", "seq", "3"}, {"00346", "meta", "seq", "1"},
-        {"00347", "data", "count", "3"}, {"00347", "data", "img", "0987654321"}, {"00348", "data", "seq", "2"}}, TABLE_TEST);
-
-    client.closeConditionalWriter(cwid);
-    try {
-      client.updateRowsConditionally(cwid, updates);
-      fail("conditional writer not closed");
-    } catch (UnknownWriter uk) {}
-
-    client.dropLocalUser(creds, "cwuser");
-
-  }
-
-  private void checkKey(String row, String cf, String cq, String val, KeyValue keyValue) {
-    assertEquals(row, ByteBufferUtil.toString(keyValue.key.row));
-    assertEquals(cf, ByteBufferUtil.toString(keyValue.key.colFamily));
-    assertEquals(cq, ByteBufferUtil.toString(keyValue.key.colQualifier));
-    assertEquals("", ByteBufferUtil.toString(keyValue.key.colVisibility));
-    assertEquals(val, ByteBufferUtil.toString(keyValue.value));
-  }
-
-  // scan metadata for file entries for the given table
-  private int countFiles(String table) throws Exception {
-    Map<String,String> tableIdMap = client.tableIdMap(creds);
-    String tableId = tableIdMap.get(table);
-    Key start = new Key();
-    start.row = s2bb(tableId + ";");
-    Key end = new Key();
-    end.row = s2bb(tableId + "<");
-    end = client.getFollowing(end, PartialKey.ROW);
-    ScanOptions opt = new ScanOptions();
-    opt.range = new Range(start, true, end, false);
-    opt.columns = Collections.singletonList(new ScanColumn(s2bb("file")));
-    String scanner = client.createScanner(creds, MetadataTable.NAME, opt);
-    int result = 0;
-    while (true) {
-      ScanResult more = client.nextK(scanner, 100);
-      result += more.getResults().size();
-      if (!more.more)
-        break;
-    }
-    return result;
-  }
-
-  private Map<ByteBuffer,List<ColumnUpdate>> mutation(String row, String cf, String cq, String value) {
-    ColumnUpdate upd = new ColumnUpdate(s2bb(cf), s2bb(cq));
-    upd.setValue(value.getBytes());
-    return Collections.singletonMap(s2bb(row), Collections.singletonList(upd));
-  }
-
-  private ByteBuffer s2bb(String cf) {
-    return ByteBuffer.wrap(cf.getBytes());
-  }
-
-  private Map<String,String> s2pp(String cf) {
-    Map<String,String> toRet = new TreeMap<String,String>();
-    toRet.put("password", cf);
-    return toRet;
-  }
-
-  static private ByteBuffer t2bb(Text t) {
-    return ByteBuffer.wrap(t.getBytes());
-  }
-
-  @Test
-  public void testGetRowRange() throws Exception {
-    Range range = client.getRowRange(s2bb("xyzzy"));
-    org.apache.accumulo.core.data.Range range2 = new org.apache.accumulo.core.data.Range(new Text("xyzzy"));
-    assertEquals(0, range.start.row.compareTo(t2bb(range2.getStartKey().getRow())));
-    assertEquals(0, range.stop.row.compareTo(t2bb(range2.getEndKey().getRow())));
-    assertEquals(range.startInclusive, range2.isStartKeyInclusive());
-    assertEquals(range.stopInclusive, range2.isEndKeyInclusive());
-    assertEquals(0, range.start.colFamily.compareTo(t2bb(range2.getStartKey().getColumnFamily())));
-    assertEquals(0, range.start.colQualifier.compareTo(t2bb(range2.getStartKey().getColumnQualifier())));
-    assertEquals(0, range.stop.colFamily.compareTo(t2bb(range2.getEndKey().getColumnFamily())));
-    assertEquals(0, range.stop.colQualifier.compareTo(t2bb(range2.getEndKey().getColumnQualifier())));
-    assertEquals(range.start.timestamp, range.start.timestamp);
-    assertEquals(range.stop.timestamp, range.stop.timestamp);
-  }
-
-  @Test
-  public void testCompactionStrategy() throws Exception {
-    final String tableName = getUniqueNames(1)[0];
-
-    client.createTable(creds, tableName, true, TimeType.MILLIS);
-
-    client.setProperty(creds, Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey() + "context1", System.getProperty("user.dir")
-        + "/src/test/resources/TestCompactionStrat.jar");
-    client.setTableProperty(creds, tableName, Property.TABLE_CLASSPATH.getKey(), "context1");
-
-    client.addSplits(creds, tableName, Collections.singleton(s2bb("efg")));
-
-    client.updateAndFlush(creds, tableName, mutation("a", "cf", "cq", "v1"));
-    client.flushTable(creds, tableName, null, null, true);
-
-    client.updateAndFlush(creds, tableName, mutation("b", "cf", "cq", "v2"));
-    client.flushTable(creds, tableName, null, null, true);
-
-    client.updateAndFlush(creds, tableName, mutation("y", "cf", "cq", "v1"));
-    client.flushTable(creds, tableName, null, null, true);
-
-    client.updateAndFlush(creds, tableName, mutation("z", "cf", "cq", "v2"));
-    client.flushTable(creds, tableName, null, null, true);
-
-    assertEquals(4, countFiles(tableName));
-
-    CompactionStrategyConfig csc = new CompactionStrategyConfig();
-
-    // The EfgCompactionStrat will only compact tablets with and end row of efg
-    csc.setClassName("org.apache.accumulo.test.EfgCompactionStrat");
-
-    client.compactTable(creds, tableName, null, null, null, true, true, csc);
-
-    assertEquals(3, countFiles(tableName));
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/proxy/TBinaryProxyIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/TBinaryProxyIT.java b/test/src/test/java/org/apache/accumulo/proxy/TBinaryProxyIT.java
deleted file mode 100644
index 08c0e73..0000000
--- a/test/src/test/java/org/apache/accumulo/proxy/TBinaryProxyIT.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.proxy;
-
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TProtocolFactory;
-
-/**
- *
- */
-public class TBinaryProxyIT extends SimpleProxyBase {
-
-  private static final TBinaryProtocol.Factory factory = new TBinaryProtocol.Factory();
-
-  @Override
-  public TProtocolFactory getProtocol() {
-    return factory;
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/proxy/TCompactProxyIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/TCompactProxyIT.java b/test/src/test/java/org/apache/accumulo/proxy/TCompactProxyIT.java
deleted file mode 100644
index d053812..0000000
--- a/test/src/test/java/org/apache/accumulo/proxy/TCompactProxyIT.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.proxy;
-
-import org.apache.thrift.protocol.TCompactProtocol;
-import org.apache.thrift.protocol.TProtocolFactory;
-
-/**
- *
- */
-public class TCompactProxyIT extends SimpleProxyBase {
-
-  private static final TCompactProtocol.Factory factory = new TCompactProtocol.Factory();
-
-  @Override
-  public TProtocolFactory getProtocol() {
-    return factory;
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/proxy/TJsonProtocolProxyIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/TJsonProtocolProxyIT.java b/test/src/test/java/org/apache/accumulo/proxy/TJsonProtocolProxyIT.java
deleted file mode 100644
index 81b0f53..0000000
--- a/test/src/test/java/org/apache/accumulo/proxy/TJsonProtocolProxyIT.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.proxy;
-
-import org.apache.thrift.protocol.TJSONProtocol;
-import org.apache.thrift.protocol.TProtocolFactory;
-
-/**
- *
- */
-public class TJsonProtocolProxyIT extends SimpleProxyBase {
-
-  private static final TJSONProtocol.Factory factory = new TJSONProtocol.Factory();
-
-  @Override
-  public TProtocolFactory getProtocol() {
-    return factory;
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/proxy/TTupleProxyIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/TTupleProxyIT.java b/test/src/test/java/org/apache/accumulo/proxy/TTupleProxyIT.java
deleted file mode 100644
index 5f69c58..0000000
--- a/test/src/test/java/org/apache/accumulo/proxy/TTupleProxyIT.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.proxy;
-
-import org.apache.thrift.protocol.TProtocolFactory;
-import org.apache.thrift.protocol.TTupleProtocol;
-
-/**
- *
- */
-public class TTupleProxyIT extends SimpleProxyBase {
-
-  private static final TTupleProtocol.Factory factory = new TTupleProtocol.Factory();
-
-  @Override
-  public TProtocolFactory getProtocol() {
-    return factory;
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java b/test/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
deleted file mode 100644
index ce8745c..0000000
--- a/test/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.proxy;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.ByteBuffer;
-import java.util.Collections;
-import java.util.Properties;
-
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TCompactProtocol;
-import org.apache.thrift.server.TServer;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.net.HostAndPort;
-
-public class TestProxyInstanceOperations {
-  private static final Logger log = LoggerFactory.getLogger(TestProxyInstanceOperations.class);
-
-  protected static TServer proxy;
-  protected static TestProxyClient tpc;
-  protected static ByteBuffer userpass;
-  protected static final int port = 10197;
-
-  @BeforeClass
-  public static void setup() throws Exception {
-    Properties prop = new Properties();
-    prop.setProperty("useMockInstance", "true");
-    prop.put("tokenClass", PasswordToken.class.getName());
-
-    proxy = Proxy.createProxyServer(HostAndPort.fromParts("localhost", port), new TCompactProtocol.Factory(), prop).server;
-    log.info("Waiting for proxy to start");
-    while (!proxy.isServing()) {
-      Thread.sleep(500);
-    }
-    log.info("Proxy started");
-    tpc = new TestProxyClient("localhost", port);
-    userpass = tpc.proxy.login("root", Collections.singletonMap("password", ""));
-  }
-
-  @AfterClass
-  public static void tearDown() throws InterruptedException {
-    proxy.stop();
-  }
-
-  @Test
-  public void properties() throws TException {
-    tpc.proxy().setProperty(userpass, "test.systemprop", "whistletips");
-
-    assertEquals(tpc.proxy().getSystemConfiguration(userpass).get("test.systemprop"), "whistletips");
-    tpc.proxy().removeProperty(userpass, "test.systemprop");
-    assertNull(tpc.proxy().getSystemConfiguration(userpass).get("test.systemprop"));
-
-  }
-
-  @Test
-  public void testClassLoad() throws TException {
-    assertTrue(tpc.proxy().testClassLoad(userpass, "org.apache.accumulo.core.iterators.user.RegExFilter", "org.apache.accumulo.core.iterators.Filter"));
-  }
-
-}


[3/5] accumulo git commit: ACCUMULO-3804 Always seal jars

Posted by ct...@apache.org.
http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java b/test/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
deleted file mode 100644
index 616917f..0000000
--- a/test/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
+++ /dev/null
@@ -1,466 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.proxy;
-
-import static org.junit.Assert.assertEquals;
-
-import java.nio.ByteBuffer;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.apache.accumulo.core.iterators.user.RegExFilter;
-import org.apache.accumulo.proxy.thrift.BatchScanOptions;
-import org.apache.accumulo.proxy.thrift.ColumnUpdate;
-import org.apache.accumulo.proxy.thrift.IteratorSetting;
-import org.apache.accumulo.proxy.thrift.Key;
-import org.apache.accumulo.proxy.thrift.KeyValue;
-import org.apache.accumulo.proxy.thrift.Range;
-import org.apache.accumulo.proxy.thrift.ScanColumn;
-import org.apache.accumulo.proxy.thrift.ScanOptions;
-import org.apache.accumulo.proxy.thrift.ScanResult;
-import org.apache.accumulo.proxy.thrift.TimeType;
-import org.apache.thrift.protocol.TCompactProtocol;
-import org.apache.thrift.server.TServer;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.common.net.HostAndPort;
-
-public class TestProxyReadWrite {
-  protected static TServer proxy;
-  protected static TestProxyClient tpc;
-  protected static ByteBuffer userpass;
-  protected static final int port = 10194;
-  protected static final String testtable = "testtable";
-
-  @BeforeClass
-  public static void setup() throws Exception {
-    Properties prop = new Properties();
-    prop.setProperty("useMockInstance", "true");
-    prop.put("tokenClass", PasswordToken.class.getName());
-
-    proxy = Proxy.createProxyServer(HostAndPort.fromParts("localhost", port), new TCompactProtocol.Factory(), prop).server;
-    tpc = new TestProxyClient("localhost", port);
-    userpass = tpc.proxy().login("root", Collections.singletonMap("password", ""));
-  }
-
-  @AfterClass
-  public static void tearDown() throws InterruptedException {
-    proxy.stop();
-  }
-
-  @Before
-  public void makeTestTable() throws Exception {
-    tpc.proxy().createTable(userpass, testtable, true, TimeType.MILLIS);
-  }
-
-  @After
-  public void deleteTestTable() throws Exception {
-    tpc.proxy().deleteTable(userpass, testtable);
-  }
-
-  private static void addMutation(Map<ByteBuffer,List<ColumnUpdate>> mutations, String row, String cf, String cq, String value) {
-    ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap(cf.getBytes()), ByteBuffer.wrap(cq.getBytes()));
-    update.setValue(value.getBytes());
-    mutations.put(ByteBuffer.wrap(row.getBytes()), Collections.singletonList(update));
-  }
-
-  private static void addMutation(Map<ByteBuffer,List<ColumnUpdate>> mutations, String row, String cf, String cq, String vis, String value) {
-    ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap(cf.getBytes()), ByteBuffer.wrap(cq.getBytes()));
-    update.setValue(value.getBytes());
-    update.setColVisibility(vis.getBytes());
-    mutations.put(ByteBuffer.wrap(row.getBytes()), Collections.singletonList(update));
-  }
-
-  /**
-   * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a range so only the entries between -Inf...5 come back (there should be
-   * 50,000)
-   */
-  @Test
-  public void readWriteBatchOneShotWithRange() throws Exception {
-    int maxInserts = 100000;
-    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
-    String format = "%1$05d";
-    for (int i = 0; i < maxInserts; i++) {
-      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
-
-      if (i % 1000 == 0 || i == maxInserts - 1) {
-        tpc.proxy().updateAndFlush(userpass, testtable, mutations);
-        mutations.clear();
-      }
-    }
-
-    Key stop = new Key();
-    stop.setRow("5".getBytes());
-    BatchScanOptions options = new BatchScanOptions();
-    options.ranges = Collections.singletonList(new Range(null, false, stop, false));
-    String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options);
-
-    int i = 0;
-    boolean hasNext = true;
-
-    int k = 1000;
-    while (hasNext) {
-      ScanResult kvList = tpc.proxy().nextK(cookie, k);
-      i += kvList.getResultsSize();
-      hasNext = kvList.isMore();
-    }
-    assertEquals(i, 50000);
-  }
-
-  /**
-   * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a columnFamily so only the entries with specified column family come back
-   * (there should be 50,000)
-   */
-  @Test
-  public void readWriteBatchOneShotWithColumnFamilyOnly() throws Exception {
-    int maxInserts = 100000;
-    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
-    String format = "%1$05d";
-    for (int i = 0; i < maxInserts; i++) {
-
-      addMutation(mutations, String.format(format, i), "cf" + (i % 2), "cq" + (i % 2), Util.randString(10));
-
-      if (i % 1000 == 0 || i == maxInserts - 1) {
-        tpc.proxy().updateAndFlush(userpass, testtable, mutations);
-        mutations.clear();
-      }
-    }
-
-    BatchScanOptions options = new BatchScanOptions();
-
-    ScanColumn sc = new ScanColumn();
-    sc.colFamily = ByteBuffer.wrap("cf0".getBytes());
-
-    options.columns = Collections.singletonList(sc);
-    String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options);
-
-    int i = 0;
-    boolean hasNext = true;
-
-    int k = 1000;
-    while (hasNext) {
-      ScanResult kvList = tpc.proxy().nextK(cookie, k);
-      i += kvList.getResultsSize();
-      hasNext = kvList.isMore();
-    }
-    assertEquals(i, 50000);
-  }
-
-  /**
-   * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a columnFamily + columnQualififer so only the entries with specified column
-   * come back (there should be 50,000)
-   */
-  @Test
-  public void readWriteBatchOneShotWithFullColumn() throws Exception {
-    int maxInserts = 100000;
-    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
-    String format = "%1$05d";
-    for (int i = 0; i < maxInserts; i++) {
-
-      addMutation(mutations, String.format(format, i), "cf" + (i % 2), "cq" + (i % 2), Util.randString(10));
-
-      if (i % 1000 == 0 || i == maxInserts - 1) {
-        tpc.proxy().updateAndFlush(userpass, testtable, mutations);
-        mutations.clear();
-      }
-    }
-
-    BatchScanOptions options = new BatchScanOptions();
-
-    ScanColumn sc = new ScanColumn();
-    sc.colFamily = ByteBuffer.wrap("cf0".getBytes());
-    sc.colQualifier = ByteBuffer.wrap("cq0".getBytes());
-
-    options.columns = Collections.singletonList(sc);
-    String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options);
-
-    int i = 0;
-    boolean hasNext = true;
-
-    int k = 1000;
-    while (hasNext) {
-      ScanResult kvList = tpc.proxy().nextK(cookie, k);
-      i += kvList.getResultsSize();
-      hasNext = kvList.isMore();
-    }
-    assertEquals(i, 50000);
-  }
-
-  /**
-   * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Filter the results so only the even numbers come back.
-   */
-  @Test
-  public void readWriteBatchOneShotWithFilterIterator() throws Exception {
-    int maxInserts = 10000;
-    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
-    String format = "%1$05d";
-    for (int i = 0; i < maxInserts; i++) {
-      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
-
-      if (i % 1000 == 0 || i == maxInserts - 1) {
-        tpc.proxy().updateAndFlush(userpass, testtable, mutations);
-        mutations.clear();
-      }
-
-    }
-
-    String regex = ".*[02468]";
-
-    org.apache.accumulo.core.client.IteratorSetting is = new org.apache.accumulo.core.client.IteratorSetting(50, regex, RegExFilter.class);
-    RegExFilter.setRegexs(is, regex, null, null, null, false);
-
-    IteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
-    ScanOptions opts = new ScanOptions();
-    opts.iterators = Collections.singletonList(pis);
-    String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
-
-    int i = 0;
-    boolean hasNext = true;
-
-    int k = 1000;
-    while (hasNext) {
-      ScanResult kvList = tpc.proxy().nextK(cookie, k);
-      for (KeyValue kv : kvList.getResults()) {
-        assertEquals(Integer.parseInt(new String(kv.getKey().getRow())), i);
-
-        i += 2;
-      }
-      hasNext = kvList.isMore();
-    }
-  }
-
-  @Test
-  public void readWriteOneShotWithRange() throws Exception {
-    int maxInserts = 100000;
-    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
-    String format = "%1$05d";
-    for (int i = 0; i < maxInserts; i++) {
-      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
-
-      if (i % 1000 == 0 || i == maxInserts - 1) {
-        tpc.proxy().updateAndFlush(userpass, testtable, mutations);
-        mutations.clear();
-      }
-    }
-
-    Key stop = new Key();
-    stop.setRow("5".getBytes());
-    ScanOptions opts = new ScanOptions();
-    opts.range = new Range(null, false, stop, false);
-    String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
-
-    int i = 0;
-    boolean hasNext = true;
-
-    int k = 1000;
-    while (hasNext) {
-      ScanResult kvList = tpc.proxy().nextK(cookie, k);
-      i += kvList.getResultsSize();
-      hasNext = kvList.isMore();
-    }
-    assertEquals(i, 50000);
-  }
-
-  /**
-   * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Filter the results so only the even numbers come back.
-   */
-  @Test
-  public void readWriteOneShotWithFilterIterator() throws Exception {
-    int maxInserts = 10000;
-    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
-    String format = "%1$05d";
-    for (int i = 0; i < maxInserts; i++) {
-      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
-
-      if (i % 1000 == 0 || i == maxInserts - 1) {
-
-        tpc.proxy().updateAndFlush(userpass, testtable, mutations);
-        mutations.clear();
-
-      }
-
-    }
-
-    String regex = ".*[02468]";
-
-    org.apache.accumulo.core.client.IteratorSetting is = new org.apache.accumulo.core.client.IteratorSetting(50, regex, RegExFilter.class);
-    RegExFilter.setRegexs(is, regex, null, null, null, false);
-
-    IteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
-    ScanOptions opts = new ScanOptions();
-    opts.iterators = Collections.singletonList(pis);
-    String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
-
-    int i = 0;
-    boolean hasNext = true;
-
-    int k = 1000;
-    while (hasNext) {
-      ScanResult kvList = tpc.proxy().nextK(cookie, k);
-      for (KeyValue kv : kvList.getResults()) {
-        assertEquals(Integer.parseInt(new String(kv.getKey().getRow())), i);
-
-        i += 2;
-      }
-      hasNext = kvList.isMore();
-    }
-  }
-
-  // @Test
-  // This test takes kind of a long time. Enable it if you think you may have memory issues.
-  public void manyWritesAndReads() throws Exception {
-    int maxInserts = 1000000;
-    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
-    String format = "%1$06d";
-    String writer = tpc.proxy().createWriter(userpass, testtable, null);
-    for (int i = 0; i < maxInserts; i++) {
-      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
-
-      if (i % 1000 == 0 || i == maxInserts - 1) {
-
-        tpc.proxy().update(writer, mutations);
-        mutations.clear();
-
-      }
-
-    }
-
-    tpc.proxy().flush(writer);
-    tpc.proxy().closeWriter(writer);
-
-    String cookie = tpc.proxy().createScanner(userpass, testtable, null);
-
-    int i = 0;
-    boolean hasNext = true;
-
-    int k = 1000;
-    while (hasNext) {
-      ScanResult kvList = tpc.proxy().nextK(cookie, k);
-      for (KeyValue kv : kvList.getResults()) {
-        assertEquals(Integer.parseInt(new String(kv.getKey().getRow())), i);
-        i++;
-      }
-      hasNext = kvList.isMore();
-      if (hasNext)
-        assertEquals(k, kvList.getResults().size());
-    }
-    assertEquals(maxInserts, i);
-  }
-
-  @Test
-  public void asynchReadWrite() throws Exception {
-    int maxInserts = 10000;
-    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
-    String format = "%1$05d";
-    String writer = tpc.proxy().createWriter(userpass, testtable, null);
-    for (int i = 0; i < maxInserts; i++) {
-      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
-
-      if (i % 1000 == 0 || i == maxInserts - 1) {
-        tpc.proxy().update(writer, mutations);
-        mutations.clear();
-      }
-    }
-
-    tpc.proxy().flush(writer);
-    tpc.proxy().closeWriter(writer);
-
-    String regex = ".*[02468]";
-
-    org.apache.accumulo.core.client.IteratorSetting is = new org.apache.accumulo.core.client.IteratorSetting(50, regex, RegExFilter.class);
-    RegExFilter.setRegexs(is, regex, null, null, null, false);
-
-    IteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
-    ScanOptions opts = new ScanOptions();
-    opts.iterators = Collections.singletonList(pis);
-    String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
-
-    int i = 0;
-    boolean hasNext = true;
-
-    int k = 1000;
-    int numRead = 0;
-    while (hasNext) {
-      ScanResult kvList = tpc.proxy().nextK(cookie, k);
-      for (KeyValue kv : kvList.getResults()) {
-        assertEquals(i, Integer.parseInt(new String(kv.getKey().getRow())));
-        numRead++;
-        i += 2;
-      }
-      hasNext = kvList.isMore();
-    }
-    assertEquals(maxInserts / 2, numRead);
-  }
-
-  @Test
-  public void testVisibility() throws Exception {
-
-    Set<ByteBuffer> auths = new HashSet<ByteBuffer>();
-    auths.add(ByteBuffer.wrap("even".getBytes()));
-    tpc.proxy().changeUserAuthorizations(userpass, "root", auths);
-
-    int maxInserts = 10000;
-    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
-    String format = "%1$05d";
-    String writer = tpc.proxy().createWriter(userpass, testtable, null);
-    for (int i = 0; i < maxInserts; i++) {
-      if (i % 2 == 0)
-        addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, "even", Util.randString(10));
-      else
-        addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, "odd", Util.randString(10));
-
-      if (i % 1000 == 0 || i == maxInserts - 1) {
-        tpc.proxy().update(writer, mutations);
-        mutations.clear();
-      }
-    }
-
-    tpc.proxy().flush(writer);
-    tpc.proxy().closeWriter(writer);
-    ScanOptions opts = new ScanOptions();
-    opts.authorizations = auths;
-    String cookie = tpc.proxy().createScanner(userpass, testtable, opts);
-
-    int i = 0;
-    boolean hasNext = true;
-
-    int k = 1000;
-    int numRead = 0;
-    while (hasNext) {
-      ScanResult kvList = tpc.proxy().nextK(cookie, k);
-      for (KeyValue kv : kvList.getResults()) {
-        assertEquals(Integer.parseInt(new String(kv.getKey().getRow())), i);
-        i += 2;
-        numRead++;
-      }
-      hasNext = kvList.isMore();
-
-    }
-    assertEquals(maxInserts / 2, numRead);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java b/test/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
deleted file mode 100644
index 607b499..0000000
--- a/test/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.proxy;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.ByteBuffer;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TreeMap;
-
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.apache.accumulo.core.util.ByteBufferUtil;
-import org.apache.accumulo.proxy.thrift.SystemPermission;
-import org.apache.accumulo.proxy.thrift.TablePermission;
-import org.apache.accumulo.proxy.thrift.TimeType;
-import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TCompactProtocol;
-import org.apache.thrift.server.TServer;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.common.net.HostAndPort;
-
-public class TestProxySecurityOperations {
-  protected static TServer proxy;
-  protected static TestProxyClient tpc;
-  protected static ByteBuffer userpass;
-  protected static final int port = 10196;
-  protected static final String testtable = "testtable";
-  protected static final String testuser = "VonJines";
-  protected static final ByteBuffer testpw = ByteBuffer.wrap("fiveones".getBytes());
-
-  @BeforeClass
-  public static void setup() throws Exception {
-    Properties prop = new Properties();
-    prop.setProperty("useMockInstance", "true");
-    prop.put("tokenClass", PasswordToken.class.getName());
-
-    proxy = Proxy.createProxyServer(HostAndPort.fromParts("localhost", port), new TCompactProtocol.Factory(), prop).server;
-    while (!proxy.isServing()) {
-      Thread.sleep(500);
-    }
-    tpc = new TestProxyClient("localhost", port);
-    userpass = tpc.proxy().login("root", Collections.singletonMap("password", ""));
-  }
-
-  @AfterClass
-  public static void tearDown() throws InterruptedException {
-    proxy.stop();
-  }
-
-  @Before
-  public void makeTestTableAndUser() throws Exception {
-    tpc.proxy().createTable(userpass, testtable, true, TimeType.MILLIS);
-    tpc.proxy().createLocalUser(userpass, testuser, testpw);
-  }
-
-  @After
-  public void deleteTestTable() throws Exception {
-    tpc.proxy().deleteTable(userpass, testtable);
-    tpc.proxy().dropLocalUser(userpass, testuser);
-  }
-
-  @Test
-  public void create() throws TException {
-    tpc.proxy().createLocalUser(userpass, testuser + "2", testpw);
-    assertTrue(tpc.proxy().listLocalUsers(userpass).contains(testuser + "2"));
-    tpc.proxy().dropLocalUser(userpass, testuser + "2");
-    assertTrue(!tpc.proxy().listLocalUsers(userpass).contains(testuser + "2"));
-  }
-
-  @Test
-  public void authenticate() throws TException {
-    assertTrue(tpc.proxy().authenticateUser(userpass, testuser, bb2pp(testpw)));
-    assertFalse(tpc.proxy().authenticateUser(userpass, "EvilUser", bb2pp(testpw)));
-
-    tpc.proxy().changeLocalUserPassword(userpass, testuser, ByteBuffer.wrap("newpass".getBytes()));
-    assertFalse(tpc.proxy().authenticateUser(userpass, testuser, bb2pp(testpw)));
-    assertTrue(tpc.proxy().authenticateUser(userpass, testuser, bb2pp(ByteBuffer.wrap("newpass".getBytes()))));
-
-  }
-
-  @Test
-  public void tablePermissions() throws TException {
-    tpc.proxy().grantTablePermission(userpass, testuser, testtable, TablePermission.ALTER_TABLE);
-    assertTrue(tpc.proxy().hasTablePermission(userpass, testuser, testtable, TablePermission.ALTER_TABLE));
-
-    tpc.proxy().revokeTablePermission(userpass, testuser, testtable, TablePermission.ALTER_TABLE);
-    assertFalse(tpc.proxy().hasTablePermission(userpass, testuser, testtable, TablePermission.ALTER_TABLE));
-
-  }
-
-  @Test
-  public void systemPermissions() throws TException {
-    tpc.proxy().grantSystemPermission(userpass, testuser, SystemPermission.ALTER_USER);
-    assertTrue(tpc.proxy().hasSystemPermission(userpass, testuser, SystemPermission.ALTER_USER));
-
-    tpc.proxy().revokeSystemPermission(userpass, testuser, SystemPermission.ALTER_USER);
-    assertFalse(tpc.proxy().hasSystemPermission(userpass, testuser, SystemPermission.ALTER_USER));
-
-  }
-
-  @Test
-  public void auths() throws TException {
-    HashSet<ByteBuffer> newauths = new HashSet<ByteBuffer>();
-    newauths.add(ByteBuffer.wrap("BBR".getBytes()));
-    newauths.add(ByteBuffer.wrap("Barney".getBytes()));
-    tpc.proxy().changeUserAuthorizations(userpass, testuser, newauths);
-    List<ByteBuffer> actualauths = tpc.proxy().getUserAuthorizations(userpass, testuser);
-    assertEquals(actualauths.size(), newauths.size());
-
-    for (ByteBuffer auth : actualauths) {
-      assertTrue(newauths.contains(auth));
-    }
-  }
-
-  private Map<String,String> bb2pp(ByteBuffer cf) {
-    Map<String,String> toRet = new TreeMap<String,String>();
-    toRet.put("password", ByteBufferUtil.toString(cf));
-    return toRet;
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java b/test/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
deleted file mode 100644
index 419810d..0000000
--- a/test/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.proxy;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.nio.ByteBuffer;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.apache.accumulo.proxy.thrift.ColumnUpdate;
-import org.apache.accumulo.proxy.thrift.TimeType;
-import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TCompactProtocol;
-import org.apache.thrift.server.TServer;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-import com.google.common.net.HostAndPort;
-
-public class TestProxyTableOperations {
-
-  protected static TServer proxy;
-  protected static TestProxyClient tpc;
-  protected static ByteBuffer userpass;
-  protected static final int port = 10195;
-  protected static final String testtable = "testtable";
-
-  @BeforeClass
-  public static void setup() throws Exception {
-    Properties prop = new Properties();
-    prop.setProperty("useMockInstance", "true");
-    prop.put("tokenClass", PasswordToken.class.getName());
-
-    proxy = Proxy.createProxyServer(HostAndPort.fromParts("localhost", port), new TCompactProtocol.Factory(), prop).server;
-    while (!proxy.isServing()) {
-      Thread.sleep(500);
-    }
-    tpc = new TestProxyClient("localhost", port);
-    userpass = tpc.proxy().login("root", Collections.singletonMap("password", ""));
-  }
-
-  @AfterClass
-  public static void tearDown() throws InterruptedException {
-    proxy.stop();
-  }
-
-  @Before
-  public void makeTestTable() throws Exception {
-    tpc.proxy().createTable(userpass, testtable, true, TimeType.MILLIS);
-  }
-
-  @After
-  public void deleteTestTable() throws Exception {
-    tpc.proxy().deleteTable(userpass, testtable);
-  }
-
-  @Test
-  public void createExistsDelete() throws TException {
-    assertFalse(tpc.proxy().tableExists(userpass, "testtable2"));
-    tpc.proxy().createTable(userpass, "testtable2", true, TimeType.MILLIS);
-    assertTrue(tpc.proxy().tableExists(userpass, "testtable2"));
-    tpc.proxy().deleteTable(userpass, "testtable2");
-    assertFalse(tpc.proxy().tableExists(userpass, "testtable2"));
-  }
-
-  @Test
-  public void listRename() throws TException {
-    assertFalse(tpc.proxy().tableExists(userpass, "testtable2"));
-    tpc.proxy().renameTable(userpass, testtable, "testtable2");
-    assertTrue(tpc.proxy().tableExists(userpass, "testtable2"));
-    tpc.proxy().renameTable(userpass, "testtable2", testtable);
-    assertTrue(tpc.proxy().listTables(userpass).contains("testtable"));
-
-  }
-
-  // This test does not yet function because the backing Mock instance does not yet support merging
-  @Test
-  public void merge() throws TException {
-    Set<ByteBuffer> splits = new HashSet<ByteBuffer>();
-    splits.add(ByteBuffer.wrap("a".getBytes()));
-    splits.add(ByteBuffer.wrap("c".getBytes()));
-    splits.add(ByteBuffer.wrap("z".getBytes()));
-    tpc.proxy().addSplits(userpass, testtable, splits);
-
-    tpc.proxy().mergeTablets(userpass, testtable, ByteBuffer.wrap("b".getBytes()), ByteBuffer.wrap("d".getBytes()));
-
-    splits.remove(ByteBuffer.wrap("c".getBytes()));
-
-    List<ByteBuffer> tableSplits = tpc.proxy().listSplits(userpass, testtable, 10);
-
-    for (ByteBuffer split : tableSplits)
-      assertTrue(splits.contains(split));
-    assertTrue(tableSplits.size() == splits.size());
-
-  }
-
-  @Test
-  public void splits() throws TException {
-    Set<ByteBuffer> splits = new HashSet<ByteBuffer>();
-    splits.add(ByteBuffer.wrap("a".getBytes()));
-    splits.add(ByteBuffer.wrap("b".getBytes()));
-    splits.add(ByteBuffer.wrap("z".getBytes()));
-    tpc.proxy().addSplits(userpass, testtable, splits);
-
-    List<ByteBuffer> tableSplits = tpc.proxy().listSplits(userpass, testtable, 10);
-
-    for (ByteBuffer split : tableSplits)
-      assertTrue(splits.contains(split));
-    assertTrue(tableSplits.size() == splits.size());
-  }
-
-  @Test
-  public void constraints() throws TException {
-    int cid = tpc.proxy().addConstraint(userpass, testtable, "org.apache.accumulo.TestConstraint");
-    Map<String,Integer> constraints = tpc.proxy().listConstraints(userpass, testtable);
-    assertEquals((int) constraints.get("org.apache.accumulo.TestConstraint"), cid);
-    tpc.proxy().removeConstraint(userpass, testtable, cid);
-    constraints = tpc.proxy().listConstraints(userpass, testtable);
-    assertNull(constraints.get("org.apache.accumulo.TestConstraint"));
-  }
-
-  @Test
-  public void localityGroups() throws TException {
-    Map<String,Set<String>> groups = new HashMap<String,Set<String>>();
-    Set<String> group1 = new HashSet<String>();
-    group1.add("cf1");
-    groups.put("group1", group1);
-    Set<String> group2 = new HashSet<String>();
-    group2.add("cf2");
-    group2.add("cf3");
-    groups.put("group2", group2);
-    tpc.proxy().setLocalityGroups(userpass, testtable, groups);
-
-    Map<String,Set<String>> actualGroups = tpc.proxy().getLocalityGroups(userpass, testtable);
-
-    assertEquals(groups.size(), actualGroups.size());
-    for (String groupName : groups.keySet()) {
-      assertTrue(actualGroups.containsKey(groupName));
-      assertEquals(groups.get(groupName).size(), actualGroups.get(groupName).size());
-      for (String cf : groups.get(groupName)) {
-        assertTrue(actualGroups.get(groupName).contains(cf));
-      }
-    }
-  }
-
-  @Test
-  public void tableProperties() throws TException {
-    tpc.proxy().setTableProperty(userpass, testtable, "test.property1", "wharrrgarbl");
-    assertEquals(tpc.proxy().getTableProperties(userpass, testtable).get("test.property1"), "wharrrgarbl");
-    tpc.proxy().removeTableProperty(userpass, testtable, "test.property1");
-    assertNull(tpc.proxy().getTableProperties(userpass, testtable).get("test.property1"));
-  }
-
-  private static void addMutation(Map<ByteBuffer,List<ColumnUpdate>> mutations, String row, String cf, String cq, String value) {
-    ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap(cf.getBytes()), ByteBuffer.wrap(cq.getBytes()));
-    update.setValue(value.getBytes());
-    mutations.put(ByteBuffer.wrap(row.getBytes()), Collections.singletonList(update));
-  }
-
-  @Test
-  public void tableOperationsRowMethods() throws TException {
-    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
-    for (int i = 0; i < 10; i++) {
-      addMutation(mutations, "" + i, "cf", "cq", "");
-    }
-    tpc.proxy().updateAndFlush(userpass, testtable, mutations);
-
-    assertEquals(tpc.proxy().getMaxRow(userpass, testtable, null, null, true, null, true), ByteBuffer.wrap("9".getBytes()));
-
-    tpc.proxy().deleteRows(userpass, testtable, ByteBuffer.wrap("51".getBytes()), ByteBuffer.wrap("99".getBytes()));
-    assertEquals(tpc.proxy().getMaxRow(userpass, testtable, null, null, true, null, true), ByteBuffer.wrap("5".getBytes()));
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/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
deleted file mode 100644
index 00c5f51..0000000
--- a/test/src/test/java/org/apache/accumulo/server/security/SystemCredentialsIT.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.server.security;
-
-import static org.junit.Assert.assertEquals;
-
-import java.nio.ByteBuffer;
-import java.util.List;
-import java.util.Map.Entry;
-
-import org.apache.accumulo.core.client.AccumuloException;
-import org.apache.accumulo.core.client.AccumuloSecurityException;
-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.impl.Credentials;
-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.conf.AccumuloConfiguration;
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.data.Value;
-import org.apache.accumulo.core.metadata.RootTable;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.server.client.HdfsZooInstance;
-import org.apache.accumulo.test.functional.ConfigurableMacIT;
-import org.junit.Test;
-
-public class SystemCredentialsIT extends ConfigurableMacIT {
-
-  private static final int FAIL_CODE = 7, BAD_PASSWD_FAIL_CODE = 8;
-
-  @Override
-  protected int defaultTimeoutSeconds() {
-    return 1 * 60;
-  }
-
-  @Test
-  public void testSystemCredentials() throws Exception {
-    assertEquals(0, exec(SystemCredentialsIT.class, "good", getCluster().getZooKeepers()).waitFor());
-    assertEquals(FAIL_CODE, exec(SystemCredentialsIT.class, "bad", getCluster().getZooKeepers()).waitFor());
-    assertEquals(BAD_PASSWD_FAIL_CODE, exec(SystemCredentialsIT.class, "bad_password", getCluster().getZooKeepers()).waitFor());
-  }
-
-  public static void main(final String[] args) throws AccumuloException, TableNotFoundException, AccumuloSecurityException {
-    Credentials creds = null;
-    if (args.length < 2)
-      throw new RuntimeException("Incorrect usage; expected to be run by test only");
-    if (args[0].equals("bad")) {
-      Instance inst = new Instance() {
-
-        @Deprecated
-        @Override
-        public void setConfiguration(AccumuloConfiguration conf) {
-          throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public int getZooKeepersSessionTimeOut() {
-          throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public String getZooKeepers() {
-          throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public String getRootTabletLocation() {
-          throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public List<String> getMasterLocations() {
-          throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public String getInstanceName() {
-          throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public String getInstanceID() {
-          return SystemCredentials.class.getName();
-        }
-
-        @Override
-        public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
-          throw new UnsupportedOperationException();
-        }
-
-        @Deprecated
-        @Override
-        public Connector getConnector(String user, CharSequence pass) throws AccumuloException, AccumuloSecurityException {
-          throw new UnsupportedOperationException();
-        }
-
-        @Deprecated
-        @Override
-        public Connector getConnector(String user, ByteBuffer pass) throws AccumuloException, AccumuloSecurityException {
-          throw new UnsupportedOperationException();
-        }
-
-        @Deprecated
-        @Override
-        public Connector getConnector(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException {
-          throw new UnsupportedOperationException();
-        }
-
-        @Deprecated
-        @Override
-        public AccumuloConfiguration getConfiguration() {
-          throw new UnsupportedOperationException();
-        }
-
-      };
-      creds = SystemCredentials.get(inst);
-    } else if (args[0].equals("good")) {
-      creds = SystemCredentials.get(HdfsZooInstance.getInstance());
-    } else if (args[0].equals("bad_password")) {
-      Instance inst = new Instance() {
-
-        @Override
-        public int getZooKeepersSessionTimeOut() {
-          throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public String getZooKeepers() {
-          throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public String getRootTabletLocation() {
-          throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public List<String> getMasterLocations() {
-          throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public String getInstanceName() {
-          throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public String getInstanceID() {
-          return SystemCredentials.class.getName();
-        }
-
-        @Override
-        public Connector getConnector(String principal, AuthenticationToken token) throws AccumuloException, AccumuloSecurityException {
-          throw new UnsupportedOperationException();
-        }
-
-        @Deprecated
-        @Override
-        public Connector getConnector(String user, CharSequence pass) throws AccumuloException, AccumuloSecurityException {
-          throw new UnsupportedOperationException();
-        }
-
-        @Deprecated
-        @Override
-        public Connector getConnector(String user, ByteBuffer pass) throws AccumuloException, AccumuloSecurityException {
-          throw new UnsupportedOperationException();
-        }
-
-        @Deprecated
-        @Override
-        public Connector getConnector(String user, byte[] pass) throws AccumuloException, AccumuloSecurityException {
-          throw new UnsupportedOperationException();
-        }
-
-        @Deprecated
-        @Override
-        public AccumuloConfiguration getConfiguration() {
-          throw new UnsupportedOperationException();
-        }
-
-        @Deprecated
-        @Override
-        public void setConfiguration(AccumuloConfiguration conf) {
-          throw new UnsupportedOperationException();
-        }
-
-      };
-      creds = new SystemCredentials(inst, "!SYSTEM", new PasswordToken("fake"));
-    } else {
-      throw new RuntimeException("Incorrect usage; expected to be run by test only");
-    }
-    Instance instance = HdfsZooInstance.getInstance();
-    Connector conn;
-    try {
-      conn = instance.getConnector(creds.getPrincipal(), creds.getToken());
-    } catch (AccumuloSecurityException e) {
-      e.printStackTrace(System.err);
-      System.exit(BAD_PASSWD_FAIL_CODE);
-      return;
-    }
-    try {
-      Scanner scan = conn.createScanner(RootTable.NAME, Authorizations.EMPTY);
-      for (Entry<Key,Value> e : scan) {
-        e.hashCode();
-      }
-    } catch (RuntimeException e) {
-      // catch the runtime exception from the scanner iterator
-      if (e.getCause() instanceof AccumuloSecurityException
-          && ((AccumuloSecurityException) e.getCause()).getSecurityErrorCode() == SecurityErrorCode.BAD_CREDENTIALS) {
-        e.printStackTrace(System.err);
-        System.exit(FAIL_CODE);
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/start/KeywordStartIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/start/KeywordStartIT.java b/test/src/test/java/org/apache/accumulo/start/KeywordStartIT.java
deleted file mode 100644
index a5c28bf..0000000
--- a/test/src/test/java/org/apache/accumulo/start/KeywordStartIT.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.start;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.TreeMap;
-
-import org.apache.accumulo.core.file.rfile.PrintInfo;
-import org.apache.accumulo.core.util.Classpath;
-import org.apache.accumulo.core.util.CreateToken;
-import org.apache.accumulo.core.util.Help;
-import org.apache.accumulo.core.util.Jar;
-import org.apache.accumulo.core.util.Version;
-import org.apache.accumulo.gc.GCExecutable;
-import org.apache.accumulo.gc.SimpleGarbageCollector;
-import org.apache.accumulo.master.Master;
-import org.apache.accumulo.master.MasterExecutable;
-import org.apache.accumulo.minicluster.MiniAccumuloRunner;
-import org.apache.accumulo.minicluster.impl.MiniClusterExecutable;
-import org.apache.accumulo.monitor.Monitor;
-import org.apache.accumulo.monitor.MonitorExecutable;
-import org.apache.accumulo.proxy.Proxy;
-import org.apache.accumulo.server.init.Initialize;
-import org.apache.accumulo.server.util.Admin;
-import org.apache.accumulo.server.util.Info;
-import org.apache.accumulo.server.util.LoginProperties;
-import org.apache.accumulo.server.util.ZooKeeperMain;
-import org.apache.accumulo.shell.Shell;
-import org.apache.accumulo.start.spi.KeywordExecutable;
-import org.apache.accumulo.tracer.TraceServer;
-import org.apache.accumulo.tracer.TracerExecutable;
-import org.apache.accumulo.tserver.TServerExecutable;
-import org.apache.accumulo.tserver.TabletServer;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class KeywordStartIT {
-
-  private final Logger log = LoggerFactory.getLogger(getClass());
-
-  @Test
-  public void testKeywordsMatch() throws IOException {
-    for (Entry<String,KeywordExecutable> entry : Main.getExecutables(getClass().getClassLoader()).entrySet()) {
-      assertEquals(entry.getKey(), entry.getValue().keyword());
-    }
-  }
-
-  @Test
-  public void testCheckDuplicates() {
-    NoOp one = new NoOp("one");
-    NoOp anotherOne = new NoOp("another");
-    NoOp two = new NoOp("two");
-    NoOp three = new NoOp("three");
-    List<NoOp> services = Arrays.asList(one, three, two, two, three, three, anotherOne);
-    assertEquals(7, services.size());
-    Map<String,KeywordExecutable> results = Main.checkDuplicates(services);
-    assertTrue(results.containsKey(one.keyword()));
-    assertTrue(results.containsKey(anotherOne.keyword()));
-    assertFalse(results.containsKey(two.keyword()));
-    assertFalse(results.containsKey(three.keyword()));
-    assertEquals(2, results.size());
-  }
-
-  // Note: this test may fail in Eclipse, if the services files haven't been generated by the AutoService annotation processor
-  @Test
-  public void testExpectedClasses() throws IOException {
-    TreeMap<String,Class<? extends KeywordExecutable>> expectSet = new TreeMap<>();
-    expectSet.put("admin", Admin.class);
-    expectSet.put("classpath", Classpath.class);
-    expectSet.put("create-token", CreateToken.class);
-    expectSet.put("gc", GCExecutable.class);
-    expectSet.put("help", Help.class);
-    expectSet.put("info", Info.class);
-    expectSet.put("init", Initialize.class);
-    expectSet.put("jar", Jar.class);
-    expectSet.put("login-info", LoginProperties.class);
-    expectSet.put("master", MasterExecutable.class);
-    expectSet.put("minicluster", MiniClusterExecutable.class);
-    expectSet.put("monitor", MonitorExecutable.class);
-    expectSet.put("proxy", Proxy.class);
-    expectSet.put("rfile-info", PrintInfo.class);
-    expectSet.put("shell", Shell.class);
-    expectSet.put("tracer", TracerExecutable.class);
-    expectSet.put("tserver", TServerExecutable.class);
-    expectSet.put("version", Version.class);
-    expectSet.put("zookeeper", ZooKeeperMain.class);
-
-    Iterator<Entry<String,Class<? extends KeywordExecutable>>> expectIter = expectSet.entrySet().iterator();
-    TreeMap<String,KeywordExecutable> actualSet = new TreeMap<>(Main.getExecutables(getClass().getClassLoader()));
-    Iterator<Entry<String,KeywordExecutable>> actualIter = actualSet.entrySet().iterator();
-    Entry<String,Class<? extends KeywordExecutable>> expected;
-    Entry<String,KeywordExecutable> actual;
-    while (expectIter.hasNext() && actualIter.hasNext()) {
-      expected = expectIter.next();
-      actual = actualIter.next();
-      assertEquals(expected.getKey(), actual.getKey());
-      assertEquals(expected.getValue(), actual.getValue().getClass());
-    }
-    boolean moreExpected = expectIter.hasNext();
-    if (moreExpected) {
-      while (expectIter.hasNext()) {
-        log.warn("Missing class for keyword '" + expectIter.next() + "'");
-      }
-    }
-    assertFalse("Missing expected classes", moreExpected);
-    boolean moreActual = actualIter.hasNext();
-    if (moreActual) {
-      while (actualIter.hasNext()) {
-        log.warn("Extra class found with keyword '" + actualIter.next() + "'");
-      }
-    }
-    assertFalse("Found additional unexpected classes", moreActual);
-  }
-
-  @Test
-  public void checkHasMain() {
-    assertFalse("Sanity check for test failed. Somehow the test class has a main method", hasMain(this.getClass()));
-
-    HashSet<Class<?>> expectSet = new HashSet<>();
-    expectSet.add(Admin.class);
-    expectSet.add(CreateToken.class);
-    expectSet.add(Info.class);
-    expectSet.add(Initialize.class);
-    expectSet.add(LoginProperties.class);
-    expectSet.add(Master.class);
-    expectSet.add(MiniAccumuloRunner.class);
-    expectSet.add(Monitor.class);
-    expectSet.add(PrintInfo.class);
-    expectSet.add(Proxy.class);
-    expectSet.add(Shell.class);
-    expectSet.add(SimpleGarbageCollector.class);
-    expectSet.add(TabletServer.class);
-    expectSet.add(TraceServer.class);
-    expectSet.add(ZooKeeperMain.class);
-
-    for (Class<?> c : expectSet) {
-      assertTrue("Class " + c.getName() + " is missing a main method!", hasMain(c));
-    }
-
-  }
-
-  private static boolean hasMain(Class<?> classToCheck) {
-    Method main;
-    try {
-      main = classToCheck.getMethod("main", new String[0].getClass());
-    } catch (NoSuchMethodException e) {
-      return false;
-    }
-    return main != null && Modifier.isPublic(main.getModifiers()) && Modifier.isStatic(main.getModifiers());
-  }
-
-  private static class NoOp implements KeywordExecutable {
-
-    private final String kw;
-
-    public NoOp(String kw) {
-      this.kw = kw;
-    }
-
-    @Override
-    public String keyword() {
-      return kw;
-    }
-
-    @Override
-    public void execute(String[] args) throws Exception {}
-
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/test/fate/zookeeper/ZooLockTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/fate/zookeeper/ZooLockTest.java b/test/src/test/java/org/apache/accumulo/test/fate/zookeeper/ZooLockTest.java
new file mode 100644
index 0000000..472fc8e
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/fate/zookeeper/ZooLockTest.java
@@ -0,0 +1,381 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.fate.zookeeper;
+
+import java.io.File;
+import java.lang.reflect.Field;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.accumulo.fate.zookeeper.ZooLock;
+import org.apache.accumulo.fate.zookeeper.ZooLock.AsyncLockWatcher;
+import org.apache.accumulo.fate.zookeeper.ZooLock.LockLossReason;
+import org.apache.accumulo.fate.zookeeper.ZooReaderWriter;
+import org.apache.accumulo.minicluster.MiniAccumuloCluster;
+import org.apache.zookeeper.CreateMode;
+import org.apache.zookeeper.WatchedEvent;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.Watcher.Event.KeeperState;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.rules.TemporaryFolder;
+
+/**
+ *
+ */
+public class ZooLockTest {
+
+  private static final TemporaryFolder folder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
+
+  private static MiniAccumuloCluster accumulo;
+
+  static class ConnectedWatcher implements Watcher {
+    volatile boolean connected = false;
+
+    @Override
+    public synchronized void process(WatchedEvent event) {
+      if (event.getState() == KeeperState.SyncConnected) { // For ZK >3.4.... || event.getState() == KeeperState.ConnectedReadOnly) {
+        connected = true;
+      } else {
+        connected = false;
+      }
+    }
+
+    public synchronized boolean isConnected() {
+      return connected;
+    }
+  }
+
+  static class TestALW implements AsyncLockWatcher {
+
+    LockLossReason reason = null;
+    boolean locked = false;
+    Exception exception = null;
+    int changes = 0;
+
+    @Override
+    public synchronized void lostLock(LockLossReason reason) {
+      this.reason = reason;
+      changes++;
+      this.notifyAll();
+    }
+
+    @Override
+    public synchronized void acquiredLock() {
+      this.locked = true;
+      changes++;
+      this.notifyAll();
+    }
+
+    @Override
+    public synchronized void failedToAcquireLock(Exception e) {
+      this.exception = e;
+      changes++;
+      this.notifyAll();
+    }
+
+    public synchronized void waitForChanges(int numExpected) throws InterruptedException {
+      while (changes < numExpected) {
+        this.wait();
+      }
+    }
+
+    @Override
+    public synchronized void unableToMonitorLockNode(Throwable e) {
+      changes++;
+      this.notifyAll();
+    }
+  }
+
+  @BeforeClass
+  public static void setupMiniCluster() throws Exception {
+
+    folder.create();
+
+    accumulo = new MiniAccumuloCluster(folder.getRoot(), "superSecret");
+
+    accumulo.start();
+
+  }
+
+  private static final AtomicInteger pdCount = new AtomicInteger(0);
+
+  @Test(timeout = 10000)
+  public void testDeleteParent() throws Exception {
+    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
+
+    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
+
+    Assert.assertFalse(zl.isLocked());
+
+    ZooReaderWriter zk = ZooReaderWriter.getInstance(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes());
+
+    // intentionally created parent after lock
+    zk.mkdirs(parent);
+
+    zk.delete(parent, -1);
+
+    zk.mkdirs(parent);
+
+    TestALW lw = new TestALW();
+
+    zl.lockAsync(lw, "test1".getBytes());
+
+    lw.waitForChanges(1);
+
+    Assert.assertTrue(lw.locked);
+    Assert.assertTrue(zl.isLocked());
+    Assert.assertNull(lw.exception);
+    Assert.assertNull(lw.reason);
+
+    zl.unlock();
+  }
+
+  @Test(timeout = 10000)
+  public void testNoParent() throws Exception {
+    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
+
+    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
+
+    Assert.assertFalse(zl.isLocked());
+
+    TestALW lw = new TestALW();
+
+    zl.lockAsync(lw, "test1".getBytes());
+
+    lw.waitForChanges(1);
+
+    Assert.assertFalse(lw.locked);
+    Assert.assertFalse(zl.isLocked());
+    Assert.assertNotNull(lw.exception);
+    Assert.assertNull(lw.reason);
+  }
+
+  @Test(timeout = 10000)
+  public void testDeleteLock() throws Exception {
+    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
+
+    ZooReaderWriter zk = ZooReaderWriter.getInstance(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes());
+    zk.mkdirs(parent);
+
+    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
+
+    Assert.assertFalse(zl.isLocked());
+
+    TestALW lw = new TestALW();
+
+    zl.lockAsync(lw, "test1".getBytes());
+
+    lw.waitForChanges(1);
+
+    Assert.assertTrue(lw.locked);
+    Assert.assertTrue(zl.isLocked());
+    Assert.assertNull(lw.exception);
+    Assert.assertNull(lw.reason);
+
+    zk.delete(zl.getLockPath(), -1);
+
+    lw.waitForChanges(2);
+
+    Assert.assertEquals(LockLossReason.LOCK_DELETED, lw.reason);
+    Assert.assertNull(lw.exception);
+
+  }
+
+  @Test(timeout = 10000)
+  public void testDeleteWaiting() throws Exception {
+    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
+
+    ZooReaderWriter zk = ZooReaderWriter.getInstance(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes());
+    zk.mkdirs(parent);
+
+    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
+
+    Assert.assertFalse(zl.isLocked());
+
+    TestALW lw = new TestALW();
+
+    zl.lockAsync(lw, "test1".getBytes());
+
+    lw.waitForChanges(1);
+
+    Assert.assertTrue(lw.locked);
+    Assert.assertTrue(zl.isLocked());
+    Assert.assertNull(lw.exception);
+    Assert.assertNull(lw.reason);
+
+    ZooLock zl2 = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
+
+    TestALW lw2 = new TestALW();
+
+    zl2.lockAsync(lw2, "test2".getBytes());
+
+    Assert.assertFalse(lw2.locked);
+    Assert.assertFalse(zl2.isLocked());
+
+    ZooLock zl3 = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
+
+    TestALW lw3 = new TestALW();
+
+    zl3.lockAsync(lw3, "test3".getBytes());
+
+    List<String> children = zk.getChildren(parent);
+    Collections.sort(children);
+
+    zk.delete(parent + "/" + children.get(1), -1);
+
+    lw2.waitForChanges(1);
+
+    Assert.assertFalse(lw2.locked);
+    Assert.assertNotNull(lw2.exception);
+    Assert.assertNull(lw2.reason);
+
+    zk.delete(parent + "/" + children.get(0), -1);
+
+    lw.waitForChanges(2);
+
+    Assert.assertEquals(LockLossReason.LOCK_DELETED, lw.reason);
+    Assert.assertNull(lw.exception);
+
+    lw3.waitForChanges(1);
+
+    Assert.assertTrue(lw3.locked);
+    Assert.assertTrue(zl3.isLocked());
+    Assert.assertNull(lw3.exception);
+    Assert.assertNull(lw3.reason);
+
+    zl3.unlock();
+
+  }
+
+  @Test(timeout = 10000)
+  public void testUnexpectedEvent() throws Exception {
+    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
+
+    ConnectedWatcher watcher = new ConnectedWatcher();
+    ZooKeeper zk = new ZooKeeper(accumulo.getZooKeepers(), 30000, watcher);
+    zk.addAuthInfo("digest", "secret".getBytes());
+
+    while (!watcher.isConnected()) {
+      Thread.sleep(200);
+    }
+
+    zk.create(parent, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
+
+    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
+
+    Assert.assertFalse(zl.isLocked());
+
+    // would not expect data to be set on this node, but it should not cause problems.....
+    zk.setData(parent, "foo".getBytes(), -1);
+
+    TestALW lw = new TestALW();
+
+    zl.lockAsync(lw, "test1".getBytes());
+
+    lw.waitForChanges(1);
+
+    Assert.assertTrue(lw.locked);
+    Assert.assertTrue(zl.isLocked());
+    Assert.assertNull(lw.exception);
+    Assert.assertNull(lw.reason);
+
+    // would not expect data to be set on this node either
+    zk.setData(zl.getLockPath(), "bar".getBytes(), -1);
+
+    zk.delete(zl.getLockPath(), -1);
+
+    lw.waitForChanges(2);
+
+    Assert.assertEquals(LockLossReason.LOCK_DELETED, lw.reason);
+    Assert.assertNull(lw.exception);
+
+  }
+
+  @Test(timeout = 10000)
+  public void testTryLock() throws Exception {
+    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
+
+    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 1000, "digest", "secret".getBytes(), parent);
+
+    ConnectedWatcher watcher = new ConnectedWatcher();
+    ZooKeeper zk = new ZooKeeper(accumulo.getZooKeepers(), 1000, watcher);
+    zk.addAuthInfo("digest", "secret".getBytes());
+
+    while (!watcher.isConnected()) {
+      Thread.sleep(200);
+    }
+
+    for (int i = 0; i < 10; i++) {
+      zk.create(parent, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
+      zk.delete(parent, -1);
+    }
+
+    zk.create(parent, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
+
+    TestALW lw = new TestALW();
+
+    boolean ret = zl.tryLock(lw, "test1".getBytes());
+
+    Assert.assertTrue(ret);
+
+    // make sure still watching parent even though a lot of events occurred for the parent
+    synchronized (zl) {
+      Field field = zl.getClass().getDeclaredField("watchingParent");
+      field.setAccessible(true);
+      Assert.assertTrue((Boolean) field.get(zl));
+    }
+
+    zl.unlock();
+  }
+
+  @Test(timeout = 10000)
+  public void testChangeData() throws Exception {
+    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
+    ConnectedWatcher watcher = new ConnectedWatcher();
+    ZooKeeper zk = new ZooKeeper(accumulo.getZooKeepers(), 1000, watcher);
+    zk.addAuthInfo("digest", "secret".getBytes());
+
+    while (!watcher.isConnected()) {
+      Thread.sleep(200);
+    }
+
+    zk.create(parent, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
+
+    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 1000, "digest", "secret".getBytes(), parent);
+
+    TestALW lw = new TestALW();
+
+    zl.lockAsync(lw, "test1".getBytes());
+    Assert.assertEquals("test1", new String(zk.getData(zl.getLockPath(), null, null)));
+
+    zl.replaceLockData("test2".getBytes());
+    Assert.assertEquals("test2", new String(zk.getData(zl.getLockPath(), null, null)));
+  }
+
+  @AfterClass
+  public static void tearDownMiniCluster() throws Exception {
+    accumulo.stop();
+    folder.delete();
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/test/proxy/ProxyDurabilityIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/test/proxy/ProxyDurabilityIT.java b/test/src/test/java/org/apache/accumulo/test/proxy/ProxyDurabilityIT.java
new file mode 100644
index 0000000..11d3e43
--- /dev/null
+++ b/test/src/test/java/org/apache/accumulo/test/proxy/ProxyDurabilityIT.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.test.proxy;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.nio.ByteBuffer;
+import java.nio.file.Files;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.conf.Property;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.UtilWaitThread;
+import org.apache.accumulo.minicluster.ServerType;
+import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
+import org.apache.accumulo.minicluster.impl.ProcessReference;
+import org.apache.accumulo.proxy.Proxy;
+import org.apache.accumulo.proxy.thrift.AccumuloProxy.Client;
+import org.apache.accumulo.proxy.thrift.Column;
+import org.apache.accumulo.proxy.thrift.ColumnUpdate;
+import org.apache.accumulo.proxy.thrift.Condition;
+import org.apache.accumulo.proxy.thrift.ConditionalStatus;
+import org.apache.accumulo.proxy.thrift.ConditionalUpdates;
+import org.apache.accumulo.proxy.thrift.ConditionalWriterOptions;
+import org.apache.accumulo.proxy.thrift.Durability;
+import org.apache.accumulo.proxy.thrift.TimeType;
+import org.apache.accumulo.proxy.thrift.WriterOptions;
+import org.apache.accumulo.server.util.PortUtils;
+import org.apache.accumulo.test.functional.ConfigurableMacIT;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.RawLocalFileSystem;
+import org.apache.thrift.protocol.TJSONProtocol;
+import org.apache.thrift.server.TServer;
+import org.junit.Test;
+
+import com.google.common.collect.Iterators;
+import com.google.common.net.HostAndPort;
+
+public class ProxyDurabilityIT extends ConfigurableMacIT {
+
+  @Override
+  protected int defaultTimeoutSeconds() {
+    return 60;
+  }
+
+  @Override
+  public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
+    hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
+    cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "10s");
+    cfg.setNumTservers(1);
+  }
+
+  private static ByteBuffer bytes(String value) {
+    return ByteBuffer.wrap(value.getBytes());
+  }
+
+  @Test
+  public void testDurability() throws Exception {
+    Connector c = getConnector();
+    Properties props = new Properties();
+    // Avoid issues with locally installed client configuration files with custom properties
+    File emptyFile = Files.createTempFile(null, null).toFile();
+    emptyFile.deleteOnExit();
+    props.put("instance", c.getInstance().getInstanceName());
+    props.put("zookeepers", c.getInstance().getZooKeepers());
+    props.put("tokenClass", PasswordToken.class.getName());
+    props.put("clientConfigurationFile", emptyFile.toString());
+
+    TJSONProtocol.Factory protocol = new TJSONProtocol.Factory();
+
+    int proxyPort = PortUtils.getRandomFreePort();
+    final TServer proxyServer = Proxy.createProxyServer(HostAndPort.fromParts("localhost", proxyPort), protocol, props).server;
+    while (!proxyServer.isServing())
+      UtilWaitThread.sleep(100);
+    Client client = new TestProxyClient("localhost", proxyPort, protocol).proxy();
+    Map<String,String> properties = new TreeMap<String,String>();
+    properties.put("password", ROOT_PASSWORD);
+    ByteBuffer login = client.login("root", properties);
+
+    String tableName = getUniqueNames(1)[0];
+    client.createTable(login, tableName, true, TimeType.MILLIS);
+    assertTrue(c.tableOperations().exists(tableName));
+
+    WriterOptions options = new WriterOptions();
+    options.setDurability(Durability.NONE);
+    String writer = client.createWriter(login, tableName, options);
+    Map<ByteBuffer,List<ColumnUpdate>> cells = new TreeMap<ByteBuffer,List<ColumnUpdate>>();
+    ColumnUpdate column = new ColumnUpdate(bytes("cf"), bytes("cq"));
+    column.setValue("value".getBytes());
+    cells.put(bytes("row"), Collections.singletonList(column));
+    client.update(writer, cells);
+    client.closeWriter(writer);
+    assertEquals(1, count(tableName));
+    restartTServer();
+    assertEquals(0, count(tableName));
+
+    ConditionalWriterOptions cfg = new ConditionalWriterOptions();
+    cfg.setDurability(Durability.SYNC);
+    String cwriter = client.createConditionalWriter(login, tableName, cfg);
+    ConditionalUpdates updates = new ConditionalUpdates();
+    updates.addToConditions(new Condition(new Column(bytes("cf"), bytes("cq"), bytes(""))));
+    updates.addToUpdates(column);
+    Map<ByteBuffer,ConditionalStatus> status = client.updateRowsConditionally(cwriter, Collections.singletonMap(bytes("row"), updates));
+    assertEquals(ConditionalStatus.ACCEPTED, status.get(bytes("row")));
+    assertEquals(1, count(tableName));
+    restartTServer();
+    assertEquals(1, count(tableName));
+
+    proxyServer.stop();
+  }
+
+  private void restartTServer() throws Exception {
+    for (ProcessReference proc : cluster.getProcesses().get(ServerType.TABLET_SERVER)) {
+      cluster.killProcess(ServerType.TABLET_SERVER, proc);
+    }
+    cluster.start();
+  }
+
+  private int count(String tableName) throws Exception {
+    return Iterators.size((getConnector().createScanner(tableName, Authorizations.EMPTY)).iterator());
+  }
+
+}


[5/5] accumulo git commit: ACCUMULO-3804 Always seal jars

Posted by ct...@apache.org.
ACCUMULO-3804 Always seal jars

* Move tests to packages which correspond to their jar to avoid violations.
* Make some members more visible to enable testing from ITs in other packages.
* Remove obsoleted seal-jars option from build.sh.
* Update --test option in build.sh to test everything with sealing.
* Simplify profiles, since we don't need a separate one to seal for release.


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

Branch: refs/heads/master
Commit: 9cf9aaaca5b299a9eefa29bc56f21c27bb5c1c30
Parents: d353b61
Author: Christopher Tubbs <ct...@apache.org>
Authored: Tue May 12 18:36:13 2015 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Tue May 12 18:42:00 2015 -0400

----------------------------------------------------------------------
 assemble/build.sh                               |    9 +-
 pom.xml                                         |   32 +-
 .../apache/accumulo/proxy/TestProxyClient.java  |  175 --
 .../server/security/SystemCredentials.java      |    2 +-
 .../tabletserver/LargestFirstMemoryManager.java |    2 +-
 .../apache/accumulo/tserver/tablet/Tablet.java  |    4 +-
 .../LargestFirstMemoryManagerTest.java          |  294 ----
 .../tserver/LargestFirstMemoryManagerTest.java  |  298 ++++
 .../java/org/apache/accumulo/start/Main.java    |    4 +-
 .../providers/ReadOnlyHdfsFileProviderTest.java |    2 +-
 .../vfs/providers/VfsClassLoaderTest.java       |    2 +-
 .../accumulo/start/test/AccumuloDFSBase.java    |  130 ++
 .../apache/accumulo/test/AccumuloDFSBase.java   |  130 --
 .../accumulo/fate/zookeeper/ZooLockTest.java    |  379 ----
 .../accumulo/proxy/ProxyDurabilityIT.java       |  144 --
 .../apache/accumulo/proxy/SimpleProxyBase.java  | 1619 -----------------
 .../apache/accumulo/proxy/TBinaryProxyIT.java   |   33 -
 .../apache/accumulo/proxy/TCompactProxyIT.java  |   33 -
 .../accumulo/proxy/TJsonProtocolProxyIT.java    |   33 -
 .../apache/accumulo/proxy/TTupleProxyIT.java    |   33 -
 .../proxy/TestProxyInstanceOperations.java      |   83 -
 .../accumulo/proxy/TestProxyReadWrite.java      |  466 -----
 .../proxy/TestProxySecurityOperations.java      |  146 --
 .../proxy/TestProxyTableOperations.java         |  201 ---
 .../server/security/SystemCredentialsIT.java    |  232 ---
 .../apache/accumulo/start/KeywordStartIT.java   |  196 ---
 .../test/fate/zookeeper/ZooLockTest.java        |  381 ++++
 .../accumulo/test/proxy/ProxyDurabilityIT.java  |  145 ++
 .../accumulo/test/proxy/SimpleProxyBase.java    | 1620 ++++++++++++++++++
 .../accumulo/test/proxy/TBinaryProxyIT.java     |   33 +
 .../accumulo/test/proxy/TCompactProxyIT.java    |   33 +
 .../test/proxy/TJsonProtocolProxyIT.java        |   33 +
 .../accumulo/test/proxy/TTupleProxyIT.java      |   33 +
 .../accumulo/test/proxy/TestProxyClient.java    |  176 ++
 .../test/proxy/TestProxyInstanceOperations.java |   84 +
 .../accumulo/test/proxy/TestProxyReadWrite.java |  468 +++++
 .../test/proxy/TestProxySecurityOperations.java |  147 ++
 .../test/proxy/TestProxyTableOperations.java    |  202 +++
 .../server/security/SystemCredentialsIT.java    |  233 +++
 .../accumulo/test/start/KeywordStartIT.java     |  197 +++
 40 files changed, 4233 insertions(+), 4234 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/assemble/build.sh
----------------------------------------------------------------------
diff --git a/assemble/build.sh b/assemble/build.sh
index 78ce6ca..8c339f9 100755
--- a/assemble/build.sh
+++ b/assemble/build.sh
@@ -48,17 +48,12 @@ if [[ $1 = '--create-release-candidate' ]]; then
   cacheGPG
   # create a release candidate from a branch
   run mvn clean release:clean release:prepare release:perform
-elif [[ $1 = '--seal-jars' ]]; then
-  cacheGPG
-  # build a tag, but with sealed jars
-  run mvn clean install \
-   -P apache-release,seal-jars,thrift,assemble,docs
 elif [[ $1 = '--test' ]]; then
   cacheGPG
   # build a tag, but with tests
   run mvn clean install \
-   -P apache-release,thrift,assemble,docs
+   -P apache-release,thrift,assemble,docs,accumulo-release
 else
-  fail "Missing one of: --create-release-candidate, --test, --seal-jars"
+  fail "Missing one of: --create-release-candidate, --test"
 fi
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a6ac82c..96dd14c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -139,7 +139,6 @@
     <powermock.version>1.5</powermock.version>
     <!-- surefire/failsafe plugin option -->
     <reuseForks>false</reuseForks>
-    <sealJars>false</sealJars>
     <!-- overwritten in hadoop profiles -->
     <slf4j.version>1.7.5</slf4j.version>
     <sourceReleaseAssemblyDescriptor>source-release-tar</sourceReleaseAssemblyDescriptor>
@@ -628,7 +627,7 @@
           <configuration>
             <archive>
               <manifestEntries>
-                <Sealed>${sealJars}</Sealed>
+                <Sealed>true</Sealed>
                 <Implementation-Build>${mvngit.commit.id}</Implementation-Build>
               </manifestEntries>
             </archive>
@@ -654,7 +653,7 @@
             <goals>clean deploy</goals>
             <preparationGoals>clean verify</preparationGoals>
             <tagNameFormat>@{project.version}</tagNameFormat>
-            <releaseProfiles>apache-release,move-source-tarball,seal-jars,skip-findbugs,!test-accumulo-maven-plugin</releaseProfiles>
+            <releaseProfiles>apache-release,accumulo-release,!test-accumulo-maven-plugin</releaseProfiles>
             <useReleaseProfile>false</useReleaseProfile>
             <pushChanges>false</pushChanges>
             <localCheckout>true</localCheckout>
@@ -1253,7 +1252,14 @@
   </reporting>
   <profiles>
     <profile>
-      <id>move-source-tarball</id>
+      <id>accumulo-release</id>
+      <properties>
+        <!-- some properties to make the release build a bit faster -->
+        <checkstyle.skip>true</checkstyle.skip>
+        <findbugs.skip>true</findbugs.skip>
+        <skipITs>true</skipITs>
+        <skipTests>true</skipTests>
+      </properties>
       <build>
         <plugins>
           <plugin>
@@ -1316,24 +1322,6 @@
       </build>
     </profile>
     <profile>
-      <!-- Seal jars and skip tests when the
-           apache-release profile is activated. -->
-      <id>seal-jars</id>
-      <properties>
-        <sealJars>true</sealJars>
-        <skipITs>true</skipITs>
-        <skipTests>true</skipTests>
-      </properties>
-    </profile>
-    <profile>
-      <!-- Skip findbugs executing when the
-           apache-release profile is activated. -->
-      <id>skip-findbugs</id>
-      <properties>
-        <findbugs.skip>true</findbugs.skip>
-      </properties>
-    </profile>
-    <profile>
       <!-- Minimal testing profile. (a.k.a. SunnyDay) -->
       <id>sunny</id>
       <properties>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java
----------------------------------------------------------------------
diff --git a/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java b/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java
deleted file mode 100644
index 99ebb38..0000000
--- a/proxy/src/main/java/org/apache/accumulo/proxy/TestProxyClient.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.proxy;
-
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import java.nio.ByteBuffer;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.iterators.user.RegExFilter;
-import org.apache.accumulo.proxy.thrift.AccumuloProxy;
-import org.apache.accumulo.proxy.thrift.ColumnUpdate;
-import org.apache.accumulo.proxy.thrift.Key;
-import org.apache.accumulo.proxy.thrift.ScanResult;
-import org.apache.accumulo.proxy.thrift.TimeType;
-import org.apache.thrift.protocol.TCompactProtocol;
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.thrift.protocol.TProtocolFactory;
-import org.apache.thrift.transport.TFramedTransport;
-import org.apache.thrift.transport.TSocket;
-import org.apache.thrift.transport.TTransport;
-import org.apache.thrift.transport.TTransportException;
-
-public class TestProxyClient {
-
-  protected AccumuloProxy.Client proxy;
-  protected TTransport transport;
-
-  public TestProxyClient(String host, int port) throws TTransportException {
-    this(host, port, new TCompactProtocol.Factory());
-  }
-
-  public TestProxyClient(String host, int port, TProtocolFactory protoFactory) throws TTransportException {
-    final TSocket socket = new TSocket(host, port);
-    socket.setTimeout(600000);
-    transport = new TFramedTransport(socket);
-    final TProtocol protocol = protoFactory.getProtocol(transport);
-    proxy = new AccumuloProxy.Client(protocol);
-    transport.open();
-  }
-
-  public AccumuloProxy.Client proxy() {
-    return proxy;
-  }
-
-  public static void main(String[] args) throws Exception {
-
-    TestProxyClient tpc = new TestProxyClient("localhost", 42424);
-    String principal = "root";
-    Map<String,String> props = new TreeMap<String,String>();
-    props.put("password", "secret");
-
-    System.out.println("Logging in");
-    ByteBuffer login = tpc.proxy.login(principal, props);
-
-    System.out.println("Creating user: ");
-    if (!tpc.proxy().listLocalUsers(login).contains("testuser")) {
-      tpc.proxy().createLocalUser(login, "testuser", ByteBuffer.wrap("testpass".getBytes(UTF_8)));
-    }
-    System.out.println("UserList: " + tpc.proxy().listLocalUsers(login));
-
-    System.out.println("Listing: " + tpc.proxy().listTables(login));
-
-    System.out.println("Deleting: ");
-    String testTable = "testtableOMGOMGOMG";
-
-    System.out.println("Creating: ");
-
-    if (tpc.proxy().tableExists(login, testTable))
-      tpc.proxy().deleteTable(login, testTable);
-
-    tpc.proxy().createTable(login, testTable, true, TimeType.MILLIS);
-
-    System.out.println("Listing: " + tpc.proxy().listTables(login));
-
-    System.out.println("Writing: ");
-    Date start = new Date();
-    Date then = new Date();
-    int maxInserts = 1000000;
-    String format = "%1$05d";
-    Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<ByteBuffer,List<ColumnUpdate>>();
-    for (int i = 0; i < maxInserts; i++) {
-      String result = String.format(format, i);
-      ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap(("cf" + i).getBytes(UTF_8)), ByteBuffer.wrap(("cq" + i).getBytes(UTF_8)));
-      update.setValue(Util.randStringBuffer(10));
-      mutations.put(ByteBuffer.wrap(result.getBytes(UTF_8)), Collections.singletonList(update));
-
-      if (i % 1000 == 0) {
-        tpc.proxy().updateAndFlush(login, testTable, mutations);
-        mutations.clear();
-      }
-    }
-    tpc.proxy().updateAndFlush(login, testTable, mutations);
-    Date end = new Date();
-    System.out.println(" End of writing: " + (end.getTime() - start.getTime()));
-
-    tpc.proxy().deleteTable(login, testTable);
-    tpc.proxy().createTable(login, testTable, true, TimeType.MILLIS);
-
-    // Thread.sleep(1000);
-
-    System.out.println("Writing async: ");
-    start = new Date();
-    then = new Date();
-    mutations.clear();
-    String writer = tpc.proxy().createWriter(login, testTable, null);
-    for (int i = 0; i < maxInserts; i++) {
-      String result = String.format(format, i);
-      Key pkey = new Key();
-      pkey.setRow(result.getBytes(UTF_8));
-      ColumnUpdate update = new ColumnUpdate(ByteBuffer.wrap(("cf" + i).getBytes(UTF_8)), ByteBuffer.wrap(("cq" + i).getBytes(UTF_8)));
-      update.setValue(Util.randStringBuffer(10));
-      mutations.put(ByteBuffer.wrap(result.getBytes(UTF_8)), Collections.singletonList(update));
-      tpc.proxy().update(writer, mutations);
-      mutations.clear();
-    }
-
-    end = new Date();
-    System.out.println(" End of writing: " + (end.getTime() - start.getTime()));
-    start = end;
-    System.out.println("Closing...");
-    tpc.proxy().closeWriter(writer);
-    end = new Date();
-    System.out.println(" End of closing: " + (end.getTime() - start.getTime()));
-
-    System.out.println("Reading: ");
-
-    String regex = "cf1.*";
-
-    IteratorSetting is = new IteratorSetting(50, regex, RegExFilter.class);
-    RegExFilter.setRegexs(is, null, regex, null, null, false);
-
-    String cookie = tpc.proxy().createScanner(login, testTable, null);
-
-    int i = 0;
-    start = new Date();
-    then = new Date();
-    boolean hasNext = true;
-
-    int k = 1000;
-    while (hasNext) {
-      ScanResult kvList = tpc.proxy().nextK(cookie, k);
-
-      Date now = new Date();
-      System.out.println(i + " " + (now.getTime() - then.getTime()));
-      then = now;
-
-      i += kvList.getResultsSize();
-      // for (TKeyValue kv:kvList.getResults()) System.out.println(new Key(kv.getKey()));
-      hasNext = kvList.isMore();
-    }
-    end = new Date();
-    System.out.println("Total entries: " + i + " total time " + (end.getTime() - start.getTime()));
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/server/base/src/main/java/org/apache/accumulo/server/security/SystemCredentials.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/SystemCredentials.java b/server/base/src/main/java/org/apache/accumulo/server/security/SystemCredentials.java
index 0b44727..9473aca 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/security/SystemCredentials.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/security/SystemCredentials.java
@@ -52,7 +52,7 @@ public final class SystemCredentials extends Credentials {
 
   private final TCredentials AS_THRIFT;
 
-  SystemCredentials(Instance instance, String principal, AuthenticationToken token) {
+  public SystemCredentials(Instance instance, String principal, AuthenticationToken token) {
     super(principal, token);
     AS_THRIFT = super.toThrift(instance);
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/server/base/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java b/server/base/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java
index a39c8b6..d1bb8b5 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManager.java
@@ -145,7 +145,7 @@ public class LargestFirstMemoryManager implements MemoryManager {
     return mincIdleThresholds.get(tableId);
   }
 
-  boolean tableExists(Instance instance, String tableId) {
+  protected boolean tableExists(Instance instance, String tableId) {
     return Tables.exists(instance, tableId);
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
index 7eb2069..f9de6e6 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/tablet/Tablet.java
@@ -2792,8 +2792,8 @@ public class Tablet implements TabletCommitter {
     }
   }
 
-  public Map<Long, List<FileRef>> getBulkIngestedFiles() {
-    return new HashMap<Long, List<FileRef>>(bulkImported.asMap());
+  public Map<Long,List<FileRef>> getBulkIngestedFiles() {
+    return new HashMap<Long,List<FileRef>>(bulkImported.asMap());
   }
 
   public void cleanupBulkLoadedFiles(Set<Long> tids) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/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
deleted file mode 100644
index b08b980..0000000
--- a/server/tserver/src/test/java/org/apache/accumulo/server/tabletserver/LargestFirstMemoryManagerTest.java
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.server.tabletserver;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.accumulo.core.client.Instance;
-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.impl.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;
-
-import com.google.common.base.Function;
-
-public class LargestFirstMemoryManagerTest {
-
-  private static final long ZERO = System.currentTimeMillis();
-  private static final long LATER = ZERO + 20 * 60 * 1000;
-  private static final long ONE_GIG = 1024 * 1024 * 1024;
-  private static final long HALF_GIG = ONE_GIG / 2;
-  private static final long QGIG = ONE_GIG / 4;
-  private static final long ONE_MINUTE = 60 * 1000;
-
-  @Test
-  public void test() throws Exception {
-    LargestFirstMemoryManagerUnderTest mgr = new LargestFirstMemoryManagerUnderTest();
-    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;
-    // nothing to do
-    result = mgr.getMemoryManagementActions(tablets(t(k("x"), ZERO, 1000, 0), t(k("y"), ZERO, 2000, 0)));
-    assertEquals(0, result.tabletsToMinorCompact.size());
-    // one tablet is really big
-    result = mgr.getMemoryManagementActions(tablets(t(k("x"), ZERO, ONE_GIG, 0), t(k("y"), ZERO, 2000, 0)));
-    assertEquals(1, result.tabletsToMinorCompact.size());
-    assertEquals(k("x"), result.tabletsToMinorCompact.get(0));
-    // one tablet is idle
-    mgr.currentTime = LATER;
-    result = mgr.getMemoryManagementActions(tablets(t(k("x"), ZERO, 1001, 0), t(k("y"), LATER, 2000, 0)));
-    assertEquals(1, result.tabletsToMinorCompact.size());
-    assertEquals(k("x"), result.tabletsToMinorCompact.get(0));
-    // one tablet is idle, but one is really big
-    result = mgr.getMemoryManagementActions(tablets(t(k("x"), ZERO, 1001, 0), t(k("y"), LATER, ONE_GIG, 0)));
-    assertEquals(1, result.tabletsToMinorCompact.size());
-    assertEquals(k("y"), result.tabletsToMinorCompact.get(0));
-    // lots of work to do
-    mgr = new LargestFirstMemoryManagerUnderTest();
-    mgr.init(config);
-    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, HALF_GIG, 0), t(k("b"), ZERO, HALF_GIG + 1, 0), t(k("c"), ZERO, HALF_GIG + 2, 0),
-        t(k("d"), ZERO, HALF_GIG + 3, 0), t(k("e"), ZERO, HALF_GIG + 4, 0), t(k("f"), ZERO, HALF_GIG + 5, 0), t(k("g"), ZERO, HALF_GIG + 6, 0),
-        t(k("h"), ZERO, HALF_GIG + 7, 0), t(k("i"), ZERO, HALF_GIG + 8, 0)));
-    assertEquals(2, result.tabletsToMinorCompact.size());
-    assertEquals(k("i"), result.tabletsToMinorCompact.get(0));
-    assertEquals(k("h"), result.tabletsToMinorCompact.get(1));
-    // one finished, one in progress, one filled up
-    mgr = new LargestFirstMemoryManagerUnderTest();
-    mgr.init(config);
-    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, HALF_GIG, 0), t(k("b"), ZERO, HALF_GIG + 1, 0), t(k("c"), ZERO, HALF_GIG + 2, 0),
-        t(k("d"), ZERO, HALF_GIG + 3, 0), t(k("e"), ZERO, HALF_GIG + 4, 0), t(k("f"), ZERO, HALF_GIG + 5, 0), t(k("g"), ZERO, ONE_GIG, 0),
-        t(k("h"), ZERO, 0, HALF_GIG + 7), t(k("i"), ZERO, 0, 0)));
-    assertEquals(1, result.tabletsToMinorCompact.size());
-    assertEquals(k("g"), result.tabletsToMinorCompact.get(0));
-    // memory is very full, lots of candidates
-    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, HALF_GIG, 0), t(k("b"), ZERO, ONE_GIG + 1, 0), t(k("c"), ZERO, ONE_GIG + 2, 0),
-        t(k("d"), ZERO, ONE_GIG + 3, 0), t(k("e"), ZERO, ONE_GIG + 4, 0), t(k("f"), ZERO, ONE_GIG + 5, 0), t(k("g"), ZERO, ONE_GIG + 6, 0),
-        t(k("h"), ZERO, 0, 0), t(k("i"), ZERO, 0, 0)));
-    assertEquals(2, result.tabletsToMinorCompact.size());
-    assertEquals(k("g"), result.tabletsToMinorCompact.get(0));
-    assertEquals(k("f"), result.tabletsToMinorCompact.get(1));
-    // only have two compactors, still busy
-    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, HALF_GIG, 0), t(k("b"), ZERO, ONE_GIG + 1, 0), t(k("c"), ZERO, ONE_GIG + 2, 0),
-        t(k("d"), ZERO, ONE_GIG + 3, 0), t(k("e"), ZERO, ONE_GIG + 4, 0), t(k("f"), ZERO, ONE_GIG, ONE_GIG + 5), t(k("g"), ZERO, ONE_GIG, ONE_GIG + 6),
-        t(k("h"), ZERO, 0, 0), t(k("i"), ZERO, 0, 0)));
-    assertEquals(0, result.tabletsToMinorCompact.size());
-    // finished one
-    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, HALF_GIG, 0), t(k("b"), ZERO, ONE_GIG + 1, 0), t(k("c"), ZERO, ONE_GIG + 2, 0),
-        t(k("d"), ZERO, ONE_GIG + 3, 0), t(k("e"), ZERO, ONE_GIG + 4, 0), t(k("f"), ZERO, ONE_GIG, ONE_GIG + 5), t(k("g"), ZERO, ONE_GIG, 0),
-        t(k("h"), ZERO, 0, 0), t(k("i"), ZERO, 0, 0)));
-    assertEquals(1, result.tabletsToMinorCompact.size());
-    assertEquals(k("e"), result.tabletsToMinorCompact.get(0));
-
-    // many are running: do nothing
-    mgr = new LargestFirstMemoryManagerUnderTest();
-    mgr.init(config);
-    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, HALF_GIG, 0), t(k("b"), ZERO, HALF_GIG + 1, 0), t(k("c"), ZERO, HALF_GIG + 2, 0),
-        t(k("d"), ZERO, 0, HALF_GIG), t(k("e"), ZERO, 0, HALF_GIG), t(k("f"), ZERO, 0, HALF_GIG), t(k("g"), ZERO, 0, HALF_GIG), t(k("i"), ZERO, 0, HALF_GIG),
-        t(k("j"), ZERO, 0, HALF_GIG), t(k("k"), ZERO, 0, HALF_GIG), t(k("l"), ZERO, 0, HALF_GIG), t(k("m"), ZERO, 0, HALF_GIG)));
-    assertEquals(0, result.tabletsToMinorCompact.size());
-
-    // observe adjustment:
-    mgr = new LargestFirstMemoryManagerUnderTest();
-    mgr.init(config);
-    // compact the largest
-    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, QGIG, 0), t(k("b"), ZERO, QGIG + 1, 0), t(k("c"), ZERO, QGIG + 2, 0)));
-    assertEquals(1, result.tabletsToMinorCompact.size());
-    assertEquals(k("c"), result.tabletsToMinorCompact.get(0));
-    // show that it is compacting... do nothing
-    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, QGIG, 0), t(k("b"), ZERO, QGIG + 1, 0), t(k("c"), ZERO, 0, QGIG + 2)));
-    assertEquals(0, result.tabletsToMinorCompact.size());
-    // not going to bother compacting any more
-    mgr.currentTime += ONE_MINUTE;
-    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, QGIG, 0), t(k("b"), ZERO, QGIG + 1, 0), t(k("c"), ZERO, 0, QGIG + 2)));
-    assertEquals(0, result.tabletsToMinorCompact.size());
-    // now do nothing
-    mgr.currentTime += ONE_MINUTE;
-    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, QGIG, 0), t(k("b"), ZERO, 0, 0), t(k("c"), ZERO, 0, 0)));
-    assertEquals(0, result.tabletsToMinorCompact.size());
-    // on no! more data, this time we compact because we've adjusted
-    mgr.currentTime += ONE_MINUTE;
-    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, QGIG, 0), t(k("b"), ZERO, QGIG + 1, 0), t(k("c"), ZERO, 0, 0)));
-    assertEquals(1, result.tabletsToMinorCompact.size());
-    assertEquals(k("b"), result.tabletsToMinorCompact.get(0));
-  }
-
-  @Test
-  public void testDeletedTable() throws Exception {
-    final String deletedTableId = "1";
-    Function<String,Boolean> existenceCheck = new Function<String,Boolean>() {
-      public Boolean apply(String tableId) {
-        return !deletedTableId.equals(tableId);
-      }
-    };
-    LargestFirstMemoryManagerWithExistenceCheck mgr = new LargestFirstMemoryManagerWithExistenceCheck(existenceCheck);
-    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;
-    // one tablet is really big and the other is for a nonexistent table
-    KeyExtent extent = new KeyExtent(new Text("2"), new Text("j"), null);
-    result = mgr.getMemoryManagementActions(tablets(t(extent, ZERO, ONE_GIG, 0), t(k("j"), ZERO, ONE_GIG, 0)));
-    assertEquals(1, result.tabletsToMinorCompact.size());
-    assertEquals(extent, result.tabletsToMinorCompact.get(0));
-  }
-
-  private static class LargestFirstMemoryManagerUnderTest extends LargestFirstMemoryManager {
-
-    public long currentTime = ZERO;
-
-    @Override
-    protected long currentTimeMillis() {
-      return currentTime;
-    }
-
-    @Override
-    protected long getMinCIdleThreshold(KeyExtent extent) {
-      return 15 * 60 * 1000;
-    }
-
-    @Override
-    boolean tableExists(Instance instance, String tableId) {
-      return true;
-    }
-  }
-
-  private static class LargestFirstMemoryManagerWithExistenceCheck extends LargestFirstMemoryManagerUnderTest {
-
-    Function<String,Boolean> existenceCheck;
-
-    public LargestFirstMemoryManagerWithExistenceCheck(Function<String,Boolean> existenceCheck) {
-      super();
-      this.existenceCheck = existenceCheck;
-    }
-
-    @Override
-    boolean tableExists(Instance instance, String tableId) {
-      return existenceCheck.apply(tableId);
-    }
-  }
-
-  private static KeyExtent k(String endRow) {
-    return new KeyExtent(new Text("1"), new Text(endRow), null);
-  }
-
-  private static class TestTabletState implements TabletState {
-
-    private final KeyExtent extent;
-    private final long lastCommit;
-    private final long memSize;
-    private final long compactingSize;
-
-    TestTabletState(KeyExtent extent, long commit, long memsize, long compactingTableSize) {
-      this.extent = extent;
-      this.lastCommit = commit;
-      this.memSize = memsize;
-      this.compactingSize = compactingTableSize;
-    }
-
-    @Override
-    public KeyExtent getExtent() {
-      return extent;
-    }
-
-    @Override
-    public long getLastCommitTime() {
-      return lastCommit;
-    }
-
-    @Override
-    public long getMemTableSize() {
-      return memSize;
-    }
-
-    @Override
-    public long getMinorCompactingMemTableSize() {
-      return compactingSize;
-    }
-
-  }
-
-  private TabletState t(KeyExtent ke, long lastCommit, long memSize, long compactingSize) {
-    return new TestTabletState(ke, lastCommit, memSize, compactingSize);
-  }
-
-  private static List<TabletState> tablets(TabletState... states) {
-    return Arrays.asList(states);
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/server/tserver/src/test/java/org/apache/accumulo/tserver/LargestFirstMemoryManagerTest.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/test/java/org/apache/accumulo/tserver/LargestFirstMemoryManagerTest.java b/server/tserver/src/test/java/org/apache/accumulo/tserver/LargestFirstMemoryManagerTest.java
new file mode 100644
index 0000000..f3bd220
--- /dev/null
+++ b/server/tserver/src/test/java/org/apache/accumulo/tserver/LargestFirstMemoryManagerTest.java
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.tserver;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.accumulo.core.client.Instance;
+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.impl.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.accumulo.server.tabletserver.LargestFirstMemoryManager;
+import org.apache.accumulo.server.tabletserver.MemoryManagementActions;
+import org.apache.accumulo.server.tabletserver.TabletState;
+import org.apache.hadoop.io.Text;
+import org.junit.Test;
+
+import com.google.common.base.Function;
+
+public class LargestFirstMemoryManagerTest {
+
+  private static final long ZERO = System.currentTimeMillis();
+  private static final long LATER = ZERO + 20 * 60 * 1000;
+  private static final long ONE_GIG = 1024 * 1024 * 1024;
+  private static final long HALF_GIG = ONE_GIG / 2;
+  private static final long QGIG = ONE_GIG / 4;
+  private static final long ONE_MINUTE = 60 * 1000;
+
+  @Test
+  public void test() throws Exception {
+    LargestFirstMemoryManagerUnderTest mgr = new LargestFirstMemoryManagerUnderTest();
+    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;
+    // nothing to do
+    result = mgr.getMemoryManagementActions(tablets(t(k("x"), ZERO, 1000, 0), t(k("y"), ZERO, 2000, 0)));
+    assertEquals(0, result.tabletsToMinorCompact.size());
+    // one tablet is really big
+    result = mgr.getMemoryManagementActions(tablets(t(k("x"), ZERO, ONE_GIG, 0), t(k("y"), ZERO, 2000, 0)));
+    assertEquals(1, result.tabletsToMinorCompact.size());
+    assertEquals(k("x"), result.tabletsToMinorCompact.get(0));
+    // one tablet is idle
+    mgr.currentTime = LATER;
+    result = mgr.getMemoryManagementActions(tablets(t(k("x"), ZERO, 1001, 0), t(k("y"), LATER, 2000, 0)));
+    assertEquals(1, result.tabletsToMinorCompact.size());
+    assertEquals(k("x"), result.tabletsToMinorCompact.get(0));
+    // one tablet is idle, but one is really big
+    result = mgr.getMemoryManagementActions(tablets(t(k("x"), ZERO, 1001, 0), t(k("y"), LATER, ONE_GIG, 0)));
+    assertEquals(1, result.tabletsToMinorCompact.size());
+    assertEquals(k("y"), result.tabletsToMinorCompact.get(0));
+    // lots of work to do
+    mgr = new LargestFirstMemoryManagerUnderTest();
+    mgr.init(config);
+    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, HALF_GIG, 0), t(k("b"), ZERO, HALF_GIG + 1, 0), t(k("c"), ZERO, HALF_GIG + 2, 0),
+        t(k("d"), ZERO, HALF_GIG + 3, 0), t(k("e"), ZERO, HALF_GIG + 4, 0), t(k("f"), ZERO, HALF_GIG + 5, 0), t(k("g"), ZERO, HALF_GIG + 6, 0),
+        t(k("h"), ZERO, HALF_GIG + 7, 0), t(k("i"), ZERO, HALF_GIG + 8, 0)));
+    assertEquals(2, result.tabletsToMinorCompact.size());
+    assertEquals(k("i"), result.tabletsToMinorCompact.get(0));
+    assertEquals(k("h"), result.tabletsToMinorCompact.get(1));
+    // one finished, one in progress, one filled up
+    mgr = new LargestFirstMemoryManagerUnderTest();
+    mgr.init(config);
+    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, HALF_GIG, 0), t(k("b"), ZERO, HALF_GIG + 1, 0), t(k("c"), ZERO, HALF_GIG + 2, 0),
+        t(k("d"), ZERO, HALF_GIG + 3, 0), t(k("e"), ZERO, HALF_GIG + 4, 0), t(k("f"), ZERO, HALF_GIG + 5, 0), t(k("g"), ZERO, ONE_GIG, 0),
+        t(k("h"), ZERO, 0, HALF_GIG + 7), t(k("i"), ZERO, 0, 0)));
+    assertEquals(1, result.tabletsToMinorCompact.size());
+    assertEquals(k("g"), result.tabletsToMinorCompact.get(0));
+    // memory is very full, lots of candidates
+    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, HALF_GIG, 0), t(k("b"), ZERO, ONE_GIG + 1, 0), t(k("c"), ZERO, ONE_GIG + 2, 0),
+        t(k("d"), ZERO, ONE_GIG + 3, 0), t(k("e"), ZERO, ONE_GIG + 4, 0), t(k("f"), ZERO, ONE_GIG + 5, 0), t(k("g"), ZERO, ONE_GIG + 6, 0),
+        t(k("h"), ZERO, 0, 0), t(k("i"), ZERO, 0, 0)));
+    assertEquals(2, result.tabletsToMinorCompact.size());
+    assertEquals(k("g"), result.tabletsToMinorCompact.get(0));
+    assertEquals(k("f"), result.tabletsToMinorCompact.get(1));
+    // only have two compactors, still busy
+    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, HALF_GIG, 0), t(k("b"), ZERO, ONE_GIG + 1, 0), t(k("c"), ZERO, ONE_GIG + 2, 0),
+        t(k("d"), ZERO, ONE_GIG + 3, 0), t(k("e"), ZERO, ONE_GIG + 4, 0), t(k("f"), ZERO, ONE_GIG, ONE_GIG + 5), t(k("g"), ZERO, ONE_GIG, ONE_GIG + 6),
+        t(k("h"), ZERO, 0, 0), t(k("i"), ZERO, 0, 0)));
+    assertEquals(0, result.tabletsToMinorCompact.size());
+    // finished one
+    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, HALF_GIG, 0), t(k("b"), ZERO, ONE_GIG + 1, 0), t(k("c"), ZERO, ONE_GIG + 2, 0),
+        t(k("d"), ZERO, ONE_GIG + 3, 0), t(k("e"), ZERO, ONE_GIG + 4, 0), t(k("f"), ZERO, ONE_GIG, ONE_GIG + 5), t(k("g"), ZERO, ONE_GIG, 0),
+        t(k("h"), ZERO, 0, 0), t(k("i"), ZERO, 0, 0)));
+    assertEquals(1, result.tabletsToMinorCompact.size());
+    assertEquals(k("e"), result.tabletsToMinorCompact.get(0));
+
+    // many are running: do nothing
+    mgr = new LargestFirstMemoryManagerUnderTest();
+    mgr.init(config);
+    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, HALF_GIG, 0), t(k("b"), ZERO, HALF_GIG + 1, 0), t(k("c"), ZERO, HALF_GIG + 2, 0),
+        t(k("d"), ZERO, 0, HALF_GIG), t(k("e"), ZERO, 0, HALF_GIG), t(k("f"), ZERO, 0, HALF_GIG), t(k("g"), ZERO, 0, HALF_GIG), t(k("i"), ZERO, 0, HALF_GIG),
+        t(k("j"), ZERO, 0, HALF_GIG), t(k("k"), ZERO, 0, HALF_GIG), t(k("l"), ZERO, 0, HALF_GIG), t(k("m"), ZERO, 0, HALF_GIG)));
+    assertEquals(0, result.tabletsToMinorCompact.size());
+
+    // observe adjustment:
+    mgr = new LargestFirstMemoryManagerUnderTest();
+    mgr.init(config);
+    // compact the largest
+    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, QGIG, 0), t(k("b"), ZERO, QGIG + 1, 0), t(k("c"), ZERO, QGIG + 2, 0)));
+    assertEquals(1, result.tabletsToMinorCompact.size());
+    assertEquals(k("c"), result.tabletsToMinorCompact.get(0));
+    // show that it is compacting... do nothing
+    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, QGIG, 0), t(k("b"), ZERO, QGIG + 1, 0), t(k("c"), ZERO, 0, QGIG + 2)));
+    assertEquals(0, result.tabletsToMinorCompact.size());
+    // not going to bother compacting any more
+    mgr.currentTime += ONE_MINUTE;
+    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, QGIG, 0), t(k("b"), ZERO, QGIG + 1, 0), t(k("c"), ZERO, 0, QGIG + 2)));
+    assertEquals(0, result.tabletsToMinorCompact.size());
+    // now do nothing
+    mgr.currentTime += ONE_MINUTE;
+    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, QGIG, 0), t(k("b"), ZERO, 0, 0), t(k("c"), ZERO, 0, 0)));
+    assertEquals(0, result.tabletsToMinorCompact.size());
+    // on no! more data, this time we compact because we've adjusted
+    mgr.currentTime += ONE_MINUTE;
+    result = mgr.getMemoryManagementActions(tablets(t(k("a"), ZERO, QGIG, 0), t(k("b"), ZERO, QGIG + 1, 0), t(k("c"), ZERO, 0, 0)));
+    assertEquals(1, result.tabletsToMinorCompact.size());
+    assertEquals(k("b"), result.tabletsToMinorCompact.get(0));
+  }
+
+  @Test
+  public void testDeletedTable() throws Exception {
+    final String deletedTableId = "1";
+    Function<String,Boolean> existenceCheck = new Function<String,Boolean>() {
+      @Override
+      public Boolean apply(String tableId) {
+        return !deletedTableId.equals(tableId);
+      }
+    };
+    LargestFirstMemoryManagerWithExistenceCheck mgr = new LargestFirstMemoryManagerWithExistenceCheck(existenceCheck);
+    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;
+    // one tablet is really big and the other is for a nonexistent table
+    KeyExtent extent = new KeyExtent(new Text("2"), new Text("j"), null);
+    result = mgr.getMemoryManagementActions(tablets(t(extent, ZERO, ONE_GIG, 0), t(k("j"), ZERO, ONE_GIG, 0)));
+    assertEquals(1, result.tabletsToMinorCompact.size());
+    assertEquals(extent, result.tabletsToMinorCompact.get(0));
+  }
+
+  private static class LargestFirstMemoryManagerUnderTest extends LargestFirstMemoryManager {
+
+    public long currentTime = ZERO;
+
+    @Override
+    protected long currentTimeMillis() {
+      return currentTime;
+    }
+
+    @Override
+    protected long getMinCIdleThreshold(KeyExtent extent) {
+      return 15 * 60 * 1000;
+    }
+
+    @Override
+    protected boolean tableExists(Instance instance, String tableId) {
+      return true;
+    }
+  }
+
+  private static class LargestFirstMemoryManagerWithExistenceCheck extends LargestFirstMemoryManagerUnderTest {
+
+    Function<String,Boolean> existenceCheck;
+
+    public LargestFirstMemoryManagerWithExistenceCheck(Function<String,Boolean> existenceCheck) {
+      super();
+      this.existenceCheck = existenceCheck;
+    }
+
+    @Override
+    protected boolean tableExists(Instance instance, String tableId) {
+      return existenceCheck.apply(tableId);
+    }
+  }
+
+  private static KeyExtent k(String endRow) {
+    return new KeyExtent(new Text("1"), new Text(endRow), null);
+  }
+
+  private static class TestTabletState implements TabletState {
+
+    private final KeyExtent extent;
+    private final long lastCommit;
+    private final long memSize;
+    private final long compactingSize;
+
+    TestTabletState(KeyExtent extent, long commit, long memsize, long compactingTableSize) {
+      this.extent = extent;
+      this.lastCommit = commit;
+      this.memSize = memsize;
+      this.compactingSize = compactingTableSize;
+    }
+
+    @Override
+    public KeyExtent getExtent() {
+      return extent;
+    }
+
+    @Override
+    public long getLastCommitTime() {
+      return lastCommit;
+    }
+
+    @Override
+    public long getMemTableSize() {
+      return memSize;
+    }
+
+    @Override
+    public long getMinorCompactingMemTableSize() {
+      return compactingSize;
+    }
+
+  }
+
+  private TabletState t(KeyExtent ke, long lastCommit, long memSize, long compactingSize) {
+    return new TestTabletState(ke, lastCommit, memSize, compactingSize);
+  }
+
+  private static List<TabletState> tablets(TabletState... states) {
+    return Arrays.asList(states);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/start/src/main/java/org/apache/accumulo/start/Main.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/Main.java b/start/src/main/java/org/apache/accumulo/start/Main.java
index abc0489..99e1d5c 100644
--- a/start/src/main/java/org/apache/accumulo/start/Main.java
+++ b/start/src/main/java/org/apache/accumulo/start/Main.java
@@ -183,14 +183,14 @@ public class Main {
     System.out.println("accumulo " + kwString + " | <accumulo class> args");
   }
 
-  static Map<String,KeywordExecutable> getExecutables(final ClassLoader cl) {
+  public static Map<String,KeywordExecutable> getExecutables(final ClassLoader cl) {
     if (servicesMap == null) {
       servicesMap = checkDuplicates(ServiceLoader.load(KeywordExecutable.class, cl));
     }
     return servicesMap;
   }
 
-  static Map<String,KeywordExecutable> checkDuplicates(final Iterable<? extends KeywordExecutable> services) {
+  public static Map<String,KeywordExecutable> checkDuplicates(final Iterable<? extends KeywordExecutable> services) {
     TreeSet<String> blacklist = new TreeSet<>();
     TreeMap<String,KeywordExecutable> results = new TreeMap<>();
     for (KeywordExecutable service : services) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/ReadOnlyHdfsFileProviderTest.java
----------------------------------------------------------------------
diff --git a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/ReadOnlyHdfsFileProviderTest.java b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/ReadOnlyHdfsFileProviderTest.java
index b5cec83..225afba 100644
--- a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/ReadOnlyHdfsFileProviderTest.java
+++ b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/ReadOnlyHdfsFileProviderTest.java
@@ -19,7 +19,7 @@ package org.apache.accumulo.start.classloader.vfs.providers;
 import java.io.IOException;
 import java.util.Map;
 
-import org.apache.accumulo.test.AccumuloDFSBase;
+import org.apache.accumulo.start.test.AccumuloDFSBase;
 import org.apache.commons.vfs2.FileObject;
 import org.apache.commons.vfs2.FileSystemException;
 import org.apache.commons.vfs2.FileType;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
----------------------------------------------------------------------
diff --git a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
index 2ba4ecf..1efd7b5 100644
--- a/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
+++ b/start/src/test/java/org/apache/accumulo/start/classloader/vfs/providers/VfsClassLoaderTest.java
@@ -18,7 +18,7 @@ package org.apache.accumulo.start.classloader.vfs.providers;
 
 import java.net.URL;
 
-import org.apache.accumulo.test.AccumuloDFSBase;
+import org.apache.accumulo.start.test.AccumuloDFSBase;
 import org.apache.commons.vfs2.FileChangeEvent;
 import org.apache.commons.vfs2.FileListener;
 import org.apache.commons.vfs2.FileObject;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/start/src/test/java/org/apache/accumulo/start/test/AccumuloDFSBase.java
----------------------------------------------------------------------
diff --git a/start/src/test/java/org/apache/accumulo/start/test/AccumuloDFSBase.java b/start/src/test/java/org/apache/accumulo/start/test/AccumuloDFSBase.java
new file mode 100644
index 0000000..fc5c16d
--- /dev/null
+++ b/start/src/test/java/org/apache/accumulo/start/test/AccumuloDFSBase.java
@@ -0,0 +1,130 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.start.test;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+
+import org.apache.accumulo.start.classloader.vfs.MiniDFSUtil;
+import org.apache.accumulo.start.classloader.vfs.providers.HdfsFileProvider;
+import org.apache.commons.vfs2.CacheStrategy;
+import org.apache.commons.vfs2.FileSystemException;
+import org.apache.commons.vfs2.cache.DefaultFilesCache;
+import org.apache.commons.vfs2.cache.SoftRefFilesCache;
+import org.apache.commons.vfs2.impl.DefaultFileReplicator;
+import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
+import org.apache.commons.vfs2.impl.FileContentInfoFilenameFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hdfs.DFSConfigKeys;
+import org.apache.hadoop.hdfs.MiniDFSCluster;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+
+public class AccumuloDFSBase {
+
+  protected static Configuration conf = null;
+  protected static DefaultFileSystemManager vfs = null;
+  protected static MiniDFSCluster cluster = null;
+
+  private static URI HDFS_URI;
+
+  protected static URI getHdfsUri() {
+    return HDFS_URI;
+  }
+
+  @BeforeClass
+  public static void miniDfsClusterSetup() {
+    System.setProperty("java.io.tmpdir", System.getProperty("user.dir") + "/target");
+    // System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
+    // Logger.getRootLogger().setLevel(Level.ERROR);
+
+    // Put the MiniDFSCluster directory in the target directory
+    System.setProperty("test.build.data", "target/build/test/data");
+
+    // Setup HDFS
+    conf = new Configuration();
+    conf.set("hadoop.security.token.service.use_ip", "true");
+
+    conf.set("dfs.datanode.data.dir.perm", MiniDFSUtil.computeDatanodeDirectoryPermission());
+    conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, 1024 * 1024); // 1M blocksize
+
+    try {
+      cluster = new MiniDFSCluster.Builder(conf).build();
+      cluster.waitClusterUp();
+      // We can't assume that the hostname of "localhost" will still be "localhost" after
+      // starting up the NameNode. We may get mapped into a FQDN via settings in /etc/hosts.
+      HDFS_URI = cluster.getFileSystem().getUri();
+    } catch (IOException e) {
+      throw new RuntimeException("Error setting up mini cluster", e);
+    }
+
+    // Set up the VFS
+    vfs = new DefaultFileSystemManager();
+    try {
+      vfs.setFilesCache(new DefaultFilesCache());
+      vfs.addProvider("res", new org.apache.commons.vfs2.provider.res.ResourceFileProvider());
+      vfs.addProvider("zip", new org.apache.commons.vfs2.provider.zip.ZipFileProvider());
+      vfs.addProvider("gz", new org.apache.commons.vfs2.provider.gzip.GzipFileProvider());
+      vfs.addProvider("ram", new org.apache.commons.vfs2.provider.ram.RamFileProvider());
+      vfs.addProvider("file", new org.apache.commons.vfs2.provider.local.DefaultLocalFileProvider());
+      vfs.addProvider("jar", new org.apache.commons.vfs2.provider.jar.JarFileProvider());
+      vfs.addProvider("http", new org.apache.commons.vfs2.provider.http.HttpFileProvider());
+      vfs.addProvider("https", new org.apache.commons.vfs2.provider.https.HttpsFileProvider());
+      vfs.addProvider("ftp", new org.apache.commons.vfs2.provider.ftp.FtpFileProvider());
+      vfs.addProvider("ftps", new org.apache.commons.vfs2.provider.ftps.FtpsFileProvider());
+      vfs.addProvider("war", new org.apache.commons.vfs2.provider.jar.JarFileProvider());
+      vfs.addProvider("par", new org.apache.commons.vfs2.provider.jar.JarFileProvider());
+      vfs.addProvider("ear", new org.apache.commons.vfs2.provider.jar.JarFileProvider());
+      vfs.addProvider("sar", new org.apache.commons.vfs2.provider.jar.JarFileProvider());
+      vfs.addProvider("ejb3", new org.apache.commons.vfs2.provider.jar.JarFileProvider());
+      vfs.addProvider("tmp", new org.apache.commons.vfs2.provider.temp.TemporaryFileProvider());
+      vfs.addProvider("tar", new org.apache.commons.vfs2.provider.tar.TarFileProvider());
+      vfs.addProvider("tbz2", new org.apache.commons.vfs2.provider.tar.TarFileProvider());
+      vfs.addProvider("tgz", new org.apache.commons.vfs2.provider.tar.TarFileProvider());
+      vfs.addProvider("bz2", new org.apache.commons.vfs2.provider.bzip2.Bzip2FileProvider());
+      vfs.addProvider("hdfs", new HdfsFileProvider());
+      vfs.addExtensionMap("jar", "jar");
+      vfs.addExtensionMap("zip", "zip");
+      vfs.addExtensionMap("gz", "gz");
+      vfs.addExtensionMap("tar", "tar");
+      vfs.addExtensionMap("tbz2", "tar");
+      vfs.addExtensionMap("tgz", "tar");
+      vfs.addExtensionMap("bz2", "bz2");
+      vfs.addMimeTypeMap("application/x-tar", "tar");
+      vfs.addMimeTypeMap("application/x-gzip", "gz");
+      vfs.addMimeTypeMap("application/zip", "zip");
+      vfs.setFileContentInfoFactory(new FileContentInfoFilenameFactory());
+      vfs.setFilesCache(new SoftRefFilesCache());
+      vfs.setReplicator(new DefaultFileReplicator(new File(System.getProperty("java.io.tmpdir"), "accumulo-vfs-cache-"
+          + System.getProperty("user.name", "nouser"))));
+      vfs.setCacheStrategy(CacheStrategy.ON_RESOLVE);
+      vfs.init();
+    } catch (FileSystemException e) {
+      throw new RuntimeException("Error setting up VFS", e);
+    }
+
+  }
+
+  @AfterClass
+  public static void tearDownMiniDfsCluster() {
+    if (null != cluster) {
+      cluster.shutdown();
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/start/src/test/java/org/apache/accumulo/test/AccumuloDFSBase.java
----------------------------------------------------------------------
diff --git a/start/src/test/java/org/apache/accumulo/test/AccumuloDFSBase.java b/start/src/test/java/org/apache/accumulo/test/AccumuloDFSBase.java
deleted file mode 100644
index 3e94291..0000000
--- a/start/src/test/java/org/apache/accumulo/test/AccumuloDFSBase.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.test;
-
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-
-import org.apache.accumulo.start.classloader.vfs.MiniDFSUtil;
-import org.apache.accumulo.start.classloader.vfs.providers.HdfsFileProvider;
-import org.apache.commons.vfs2.CacheStrategy;
-import org.apache.commons.vfs2.FileSystemException;
-import org.apache.commons.vfs2.cache.DefaultFilesCache;
-import org.apache.commons.vfs2.cache.SoftRefFilesCache;
-import org.apache.commons.vfs2.impl.DefaultFileReplicator;
-import org.apache.commons.vfs2.impl.DefaultFileSystemManager;
-import org.apache.commons.vfs2.impl.FileContentInfoFilenameFactory;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hdfs.DFSConfigKeys;
-import org.apache.hadoop.hdfs.MiniDFSCluster;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-
-public class AccumuloDFSBase {
-
-  protected static Configuration conf = null;
-  protected static DefaultFileSystemManager vfs = null;
-  protected static MiniDFSCluster cluster = null;
-
-  private static URI HDFS_URI;
-
-  protected static URI getHdfsUri() {
-    return HDFS_URI;
-  }
-
-  @BeforeClass
-  public static void miniDfsClusterSetup() {
-    System.setProperty("java.io.tmpdir", System.getProperty("user.dir") + "/target");
-    // System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
-    // Logger.getRootLogger().setLevel(Level.ERROR);
-
-    // Put the MiniDFSCluster directory in the target directory
-    System.setProperty("test.build.data", "target/build/test/data");
-
-    // Setup HDFS
-    conf = new Configuration();
-    conf.set("hadoop.security.token.service.use_ip", "true");
-
-    conf.set("dfs.datanode.data.dir.perm", MiniDFSUtil.computeDatanodeDirectoryPermission());
-    conf.setLong(DFSConfigKeys.DFS_BLOCK_SIZE_KEY, 1024 * 1024); // 1M blocksize
-
-    try {
-      cluster = new MiniDFSCluster.Builder(conf).build();
-      cluster.waitClusterUp();
-      // We can't assume that the hostname of "localhost" will still be "localhost" after
-      // starting up the NameNode. We may get mapped into a FQDN via settings in /etc/hosts.
-      HDFS_URI = cluster.getFileSystem().getUri();
-    } catch (IOException e) {
-      throw new RuntimeException("Error setting up mini cluster", e);
-    }
-
-    // Set up the VFS
-    vfs = new DefaultFileSystemManager();
-    try {
-      vfs.setFilesCache(new DefaultFilesCache());
-      vfs.addProvider("res", new org.apache.commons.vfs2.provider.res.ResourceFileProvider());
-      vfs.addProvider("zip", new org.apache.commons.vfs2.provider.zip.ZipFileProvider());
-      vfs.addProvider("gz", new org.apache.commons.vfs2.provider.gzip.GzipFileProvider());
-      vfs.addProvider("ram", new org.apache.commons.vfs2.provider.ram.RamFileProvider());
-      vfs.addProvider("file", new org.apache.commons.vfs2.provider.local.DefaultLocalFileProvider());
-      vfs.addProvider("jar", new org.apache.commons.vfs2.provider.jar.JarFileProvider());
-      vfs.addProvider("http", new org.apache.commons.vfs2.provider.http.HttpFileProvider());
-      vfs.addProvider("https", new org.apache.commons.vfs2.provider.https.HttpsFileProvider());
-      vfs.addProvider("ftp", new org.apache.commons.vfs2.provider.ftp.FtpFileProvider());
-      vfs.addProvider("ftps", new org.apache.commons.vfs2.provider.ftps.FtpsFileProvider());
-      vfs.addProvider("war", new org.apache.commons.vfs2.provider.jar.JarFileProvider());
-      vfs.addProvider("par", new org.apache.commons.vfs2.provider.jar.JarFileProvider());
-      vfs.addProvider("ear", new org.apache.commons.vfs2.provider.jar.JarFileProvider());
-      vfs.addProvider("sar", new org.apache.commons.vfs2.provider.jar.JarFileProvider());
-      vfs.addProvider("ejb3", new org.apache.commons.vfs2.provider.jar.JarFileProvider());
-      vfs.addProvider("tmp", new org.apache.commons.vfs2.provider.temp.TemporaryFileProvider());
-      vfs.addProvider("tar", new org.apache.commons.vfs2.provider.tar.TarFileProvider());
-      vfs.addProvider("tbz2", new org.apache.commons.vfs2.provider.tar.TarFileProvider());
-      vfs.addProvider("tgz", new org.apache.commons.vfs2.provider.tar.TarFileProvider());
-      vfs.addProvider("bz2", new org.apache.commons.vfs2.provider.bzip2.Bzip2FileProvider());
-      vfs.addProvider("hdfs", new HdfsFileProvider());
-      vfs.addExtensionMap("jar", "jar");
-      vfs.addExtensionMap("zip", "zip");
-      vfs.addExtensionMap("gz", "gz");
-      vfs.addExtensionMap("tar", "tar");
-      vfs.addExtensionMap("tbz2", "tar");
-      vfs.addExtensionMap("tgz", "tar");
-      vfs.addExtensionMap("bz2", "bz2");
-      vfs.addMimeTypeMap("application/x-tar", "tar");
-      vfs.addMimeTypeMap("application/x-gzip", "gz");
-      vfs.addMimeTypeMap("application/zip", "zip");
-      vfs.setFileContentInfoFactory(new FileContentInfoFilenameFactory());
-      vfs.setFilesCache(new SoftRefFilesCache());
-      vfs.setReplicator(new DefaultFileReplicator(new File(System.getProperty("java.io.tmpdir"), "accumulo-vfs-cache-"
-          + System.getProperty("user.name", "nouser"))));
-      vfs.setCacheStrategy(CacheStrategy.ON_RESOLVE);
-      vfs.init();
-    } catch (FileSystemException e) {
-      throw new RuntimeException("Error setting up VFS", e);
-    }
-
-  }
-
-  @AfterClass
-  public static void tearDownMiniDfsCluster() {
-    if (null != cluster) {
-      cluster.shutdown();
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/fate/zookeeper/ZooLockTest.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/fate/zookeeper/ZooLockTest.java b/test/src/test/java/org/apache/accumulo/fate/zookeeper/ZooLockTest.java
deleted file mode 100644
index 4c21a1f..0000000
--- a/test/src/test/java/org/apache/accumulo/fate/zookeeper/ZooLockTest.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.fate.zookeeper;
-
-import java.io.File;
-import java.lang.reflect.Field;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.accumulo.fate.zookeeper.ZooLock.AsyncLockWatcher;
-import org.apache.accumulo.fate.zookeeper.ZooLock.LockLossReason;
-import org.apache.accumulo.minicluster.MiniAccumuloCluster;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.Watcher.Event.KeeperState;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.ZooKeeper;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.rules.TemporaryFolder;
-
-/**
- *
- */
-public class ZooLockTest {
-
-  private static final TemporaryFolder folder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
-
-  private static MiniAccumuloCluster accumulo;
-
-  static class ConnectedWatcher implements Watcher {
-    volatile boolean connected = false;
-
-    @Override
-    public synchronized void process(WatchedEvent event) {
-      if (event.getState() == KeeperState.SyncConnected) { // For ZK >3.4.... || event.getState() == KeeperState.ConnectedReadOnly) {
-        connected = true;
-      } else {
-        connected = false;
-      }
-    }
-
-    public synchronized boolean isConnected() {
-      return connected;
-    }
-  }
-
-  static class TestALW implements AsyncLockWatcher {
-
-    LockLossReason reason = null;
-    boolean locked = false;
-    Exception exception = null;
-    int changes = 0;
-
-    @Override
-    public synchronized void lostLock(LockLossReason reason) {
-      this.reason = reason;
-      changes++;
-      this.notifyAll();
-    }
-
-    @Override
-    public synchronized void acquiredLock() {
-      this.locked = true;
-      changes++;
-      this.notifyAll();
-    }
-
-    @Override
-    public synchronized void failedToAcquireLock(Exception e) {
-      this.exception = e;
-      changes++;
-      this.notifyAll();
-    }
-
-    public synchronized void waitForChanges(int numExpected) throws InterruptedException {
-      while (changes < numExpected) {
-        this.wait();
-      }
-    }
-
-    @Override
-    public synchronized void unableToMonitorLockNode(Throwable e) {
-      changes++;
-      this.notifyAll();
-    }
-  }
-
-  @BeforeClass
-  public static void setupMiniCluster() throws Exception {
-
-    folder.create();
-
-    accumulo = new MiniAccumuloCluster(folder.getRoot(), "superSecret");
-
-    accumulo.start();
-
-  }
-
-  private static final AtomicInteger pdCount = new AtomicInteger(0);
-
-  @Test(timeout = 10000)
-  public void testDeleteParent() throws Exception {
-    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
-
-    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
-
-    Assert.assertFalse(zl.isLocked());
-
-    ZooReaderWriter zk = ZooReaderWriter.getInstance(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes());
-
-    // intentionally created parent after lock
-    zk.mkdirs(parent);
-
-    zk.delete(parent, -1);
-
-    zk.mkdirs(parent);
-
-    TestALW lw = new TestALW();
-
-    zl.lockAsync(lw, "test1".getBytes());
-
-    lw.waitForChanges(1);
-
-    Assert.assertTrue(lw.locked);
-    Assert.assertTrue(zl.isLocked());
-    Assert.assertNull(lw.exception);
-    Assert.assertNull(lw.reason);
-
-    zl.unlock();
-  }
-
-  @Test(timeout = 10000)
-  public void testNoParent() throws Exception {
-    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
-
-    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
-
-    Assert.assertFalse(zl.isLocked());
-
-    TestALW lw = new TestALW();
-
-    zl.lockAsync(lw, "test1".getBytes());
-
-    lw.waitForChanges(1);
-
-    Assert.assertFalse(lw.locked);
-    Assert.assertFalse(zl.isLocked());
-    Assert.assertNotNull(lw.exception);
-    Assert.assertNull(lw.reason);
-  }
-
-  @Test(timeout = 10000)
-  public void testDeleteLock() throws Exception {
-    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
-
-    ZooReaderWriter zk = ZooReaderWriter.getInstance(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes());
-    zk.mkdirs(parent);
-
-    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
-
-    Assert.assertFalse(zl.isLocked());
-
-    TestALW lw = new TestALW();
-
-    zl.lockAsync(lw, "test1".getBytes());
-
-    lw.waitForChanges(1);
-
-    Assert.assertTrue(lw.locked);
-    Assert.assertTrue(zl.isLocked());
-    Assert.assertNull(lw.exception);
-    Assert.assertNull(lw.reason);
-
-    zk.delete(zl.getLockPath(), -1);
-
-    lw.waitForChanges(2);
-
-    Assert.assertEquals(LockLossReason.LOCK_DELETED, lw.reason);
-    Assert.assertNull(lw.exception);
-
-  }
-
-  @Test(timeout = 10000)
-  public void testDeleteWaiting() throws Exception {
-    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
-
-    ZooReaderWriter zk = ZooReaderWriter.getInstance(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes());
-    zk.mkdirs(parent);
-
-    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
-
-    Assert.assertFalse(zl.isLocked());
-
-    TestALW lw = new TestALW();
-
-    zl.lockAsync(lw, "test1".getBytes());
-
-    lw.waitForChanges(1);
-
-    Assert.assertTrue(lw.locked);
-    Assert.assertTrue(zl.isLocked());
-    Assert.assertNull(lw.exception);
-    Assert.assertNull(lw.reason);
-
-    ZooLock zl2 = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
-
-    TestALW lw2 = new TestALW();
-
-    zl2.lockAsync(lw2, "test2".getBytes());
-
-    Assert.assertFalse(lw2.locked);
-    Assert.assertFalse(zl2.isLocked());
-
-    ZooLock zl3 = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
-
-    TestALW lw3 = new TestALW();
-
-    zl3.lockAsync(lw3, "test3".getBytes());
-
-    List<String> children = zk.getChildren(parent);
-    Collections.sort(children);
-
-    zk.delete(parent + "/" + children.get(1), -1);
-
-    lw2.waitForChanges(1);
-
-    Assert.assertFalse(lw2.locked);
-    Assert.assertNotNull(lw2.exception);
-    Assert.assertNull(lw2.reason);
-
-    zk.delete(parent + "/" + children.get(0), -1);
-
-    lw.waitForChanges(2);
-
-    Assert.assertEquals(LockLossReason.LOCK_DELETED, lw.reason);
-    Assert.assertNull(lw.exception);
-
-    lw3.waitForChanges(1);
-
-    Assert.assertTrue(lw3.locked);
-    Assert.assertTrue(zl3.isLocked());
-    Assert.assertNull(lw3.exception);
-    Assert.assertNull(lw3.reason);
-
-    zl3.unlock();
-
-  }
-
-  @Test(timeout = 10000)
-  public void testUnexpectedEvent() throws Exception {
-    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
-
-    ConnectedWatcher watcher = new ConnectedWatcher();
-    ZooKeeper zk = new ZooKeeper(accumulo.getZooKeepers(), 30000, watcher);
-    zk.addAuthInfo("digest", "secret".getBytes());
-
-    while (!watcher.isConnected()) {
-      Thread.sleep(200);
-    }
-
-    zk.create(parent, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-
-    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 30000, "digest", "secret".getBytes(), parent);
-
-    Assert.assertFalse(zl.isLocked());
-
-    // would not expect data to be set on this node, but it should not cause problems.....
-    zk.setData(parent, "foo".getBytes(), -1);
-
-    TestALW lw = new TestALW();
-
-    zl.lockAsync(lw, "test1".getBytes());
-
-    lw.waitForChanges(1);
-
-    Assert.assertTrue(lw.locked);
-    Assert.assertTrue(zl.isLocked());
-    Assert.assertNull(lw.exception);
-    Assert.assertNull(lw.reason);
-
-    // would not expect data to be set on this node either
-    zk.setData(zl.getLockPath(), "bar".getBytes(), -1);
-
-    zk.delete(zl.getLockPath(), -1);
-
-    lw.waitForChanges(2);
-
-    Assert.assertEquals(LockLossReason.LOCK_DELETED, lw.reason);
-    Assert.assertNull(lw.exception);
-
-  }
-
-  @Test(timeout = 10000)
-  public void testTryLock() throws Exception {
-    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
-
-    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 1000, "digest", "secret".getBytes(), parent);
-
-    ConnectedWatcher watcher = new ConnectedWatcher();
-    ZooKeeper zk = new ZooKeeper(accumulo.getZooKeepers(), 1000, watcher);
-    zk.addAuthInfo("digest", "secret".getBytes());
-
-    while (!watcher.isConnected()) {
-      Thread.sleep(200);
-    }
-
-    for (int i = 0; i < 10; i++) {
-      zk.create(parent, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-      zk.delete(parent, -1);
-    }
-
-    zk.create(parent, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-
-    TestALW lw = new TestALW();
-
-    boolean ret = zl.tryLock(lw, "test1".getBytes());
-
-    Assert.assertTrue(ret);
-
-    // make sure still watching parent even though a lot of events occurred for the parent
-    synchronized (zl) {
-      Field field = zl.getClass().getDeclaredField("watchingParent");
-      field.setAccessible(true);
-      Assert.assertTrue((Boolean) field.get(zl));
-    }
-
-    zl.unlock();
-  }
-
-  @Test(timeout = 10000)
-  public void testChangeData() throws Exception {
-    String parent = "/zltest-" + this.hashCode() + "-l" + pdCount.incrementAndGet();
-    ConnectedWatcher watcher = new ConnectedWatcher();
-    ZooKeeper zk = new ZooKeeper(accumulo.getZooKeepers(), 1000, watcher);
-    zk.addAuthInfo("digest", "secret".getBytes());
-
-    while (!watcher.isConnected()) {
-      Thread.sleep(200);
-    }
-
-    zk.create(parent, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-
-    ZooLock zl = new ZooLock(accumulo.getZooKeepers(), 1000, "digest", "secret".getBytes(), parent);
-
-    TestALW lw = new TestALW();
-
-    zl.lockAsync(lw, "test1".getBytes());
-    Assert.assertEquals("test1", new String(zk.getData(zl.getLockPath(), null, null)));
-
-    zl.replaceLockData("test2".getBytes());
-    Assert.assertEquals("test2", new String(zk.getData(zl.getLockPath(), null, null)));
-  }
-
-  @AfterClass
-  public static void tearDownMiniCluster() throws Exception {
-    accumulo.stop();
-    folder.delete();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/9cf9aaac/test/src/test/java/org/apache/accumulo/proxy/ProxyDurabilityIT.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/accumulo/proxy/ProxyDurabilityIT.java b/test/src/test/java/org/apache/accumulo/proxy/ProxyDurabilityIT.java
deleted file mode 100644
index 53653da..0000000
--- a/test/src/test/java/org/apache/accumulo/proxy/ProxyDurabilityIT.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.proxy;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.nio.ByteBuffer;
-import java.nio.file.Files;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.TreeMap;
-
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
-import org.apache.accumulo.core.conf.Property;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.util.UtilWaitThread;
-import org.apache.accumulo.minicluster.ServerType;
-import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
-import org.apache.accumulo.minicluster.impl.ProcessReference;
-import org.apache.accumulo.proxy.thrift.AccumuloProxy.Client;
-import org.apache.accumulo.proxy.thrift.Column;
-import org.apache.accumulo.proxy.thrift.ColumnUpdate;
-import org.apache.accumulo.proxy.thrift.Condition;
-import org.apache.accumulo.proxy.thrift.ConditionalStatus;
-import org.apache.accumulo.proxy.thrift.ConditionalUpdates;
-import org.apache.accumulo.proxy.thrift.ConditionalWriterOptions;
-import org.apache.accumulo.proxy.thrift.Durability;
-import org.apache.accumulo.proxy.thrift.TimeType;
-import org.apache.accumulo.proxy.thrift.WriterOptions;
-import org.apache.accumulo.server.util.PortUtils;
-import org.apache.accumulo.test.functional.ConfigurableMacIT;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.RawLocalFileSystem;
-import org.apache.thrift.protocol.TJSONProtocol;
-import org.apache.thrift.server.TServer;
-import org.junit.Test;
-
-import com.google.common.collect.Iterators;
-import com.google.common.net.HostAndPort;
-
-public class ProxyDurabilityIT extends ConfigurableMacIT {
-
-  @Override
-  protected int defaultTimeoutSeconds() {
-    return 60;
-  }
-
-  @Override
-  public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {
-    hadoopCoreSite.set("fs.file.impl", RawLocalFileSystem.class.getName());
-    cfg.setProperty(Property.INSTANCE_ZK_TIMEOUT, "10s");
-    cfg.setNumTservers(1);
-  }
-
-  private static ByteBuffer bytes(String value) {
-    return ByteBuffer.wrap(value.getBytes());
-  }
-
-  @Test
-  public void testDurability() throws Exception {
-    Connector c = getConnector();
-    Properties props = new Properties();
-    // Avoid issues with locally installed client configuration files with custom properties
-    File emptyFile = Files.createTempFile(null, null).toFile();
-    emptyFile.deleteOnExit();
-    props.put("instance", c.getInstance().getInstanceName());
-    props.put("zookeepers", c.getInstance().getZooKeepers());
-    props.put("tokenClass", PasswordToken.class.getName());
-    props.put("clientConfigurationFile", emptyFile.toString());
-
-    TJSONProtocol.Factory protocol = new TJSONProtocol.Factory();
-
-    int proxyPort = PortUtils.getRandomFreePort();
-    final TServer proxyServer = Proxy.createProxyServer(HostAndPort.fromParts("localhost", proxyPort), protocol, props).server;
-    while (!proxyServer.isServing())
-      UtilWaitThread.sleep(100);
-    Client client = new TestProxyClient("localhost", proxyPort, protocol).proxy();
-    Map<String,String> properties = new TreeMap<String,String>();
-    properties.put("password", ROOT_PASSWORD);
-    ByteBuffer login = client.login("root", properties);
-
-    String tableName = getUniqueNames(1)[0];
-    client.createTable(login, tableName, true, TimeType.MILLIS);
-    assertTrue(c.tableOperations().exists(tableName));
-
-    WriterOptions options = new WriterOptions();
-    options.setDurability(Durability.NONE);
-    String writer = client.createWriter(login, tableName, options);
-    Map<ByteBuffer,List<ColumnUpdate>> cells = new TreeMap<ByteBuffer,List<ColumnUpdate>>();
-    ColumnUpdate column = new ColumnUpdate(bytes("cf"), bytes("cq"));
-    column.setValue("value".getBytes());
-    cells.put(bytes("row"), Collections.singletonList(column));
-    client.update(writer, cells);
-    client.closeWriter(writer);
-    assertEquals(1, count(tableName));
-    restartTServer();
-    assertEquals(0, count(tableName));
-
-    ConditionalWriterOptions cfg = new ConditionalWriterOptions();
-    cfg.setDurability(Durability.SYNC);
-    String cwriter = client.createConditionalWriter(login, tableName, cfg);
-    ConditionalUpdates updates = new ConditionalUpdates();
-    updates.addToConditions(new Condition(new Column(bytes("cf"), bytes("cq"), bytes(""))));
-    updates.addToUpdates(column);
-    Map<ByteBuffer,ConditionalStatus> status = client.updateRowsConditionally(cwriter, Collections.singletonMap(bytes("row"), updates));
-    assertEquals(ConditionalStatus.ACCEPTED, status.get(bytes("row")));
-    assertEquals(1, count(tableName));
-    restartTServer();
-    assertEquals(1, count(tableName));
-
-    proxyServer.stop();
-  }
-
-  private void restartTServer() throws Exception {
-    for (ProcessReference proc : cluster.getProcesses().get(ServerType.TABLET_SERVER)) {
-      cluster.killProcess(ServerType.TABLET_SERVER, proc);
-    }
-    cluster.start();
-  }
-
-  private int count(String tableName) throws Exception {
-    return Iterators.size((getConnector().createScanner(tableName, Authorizations.EMPTY)).iterator());
-  }
-
-}