accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject [11/14] accumulo git commit: ACCUMULO-3920 Deprecate mock components
Date Thu, 30 Jul 2015 21:51:45 GMT
http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
index 4e565ee..ad9f419 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloInputFormatTest.java
@@ -33,7 +33,6 @@ import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -59,12 +58,13 @@ import org.apache.log4j.Level;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TestName;
 
 public class AccumuloInputFormatTest {
 
   private static final String PREFIX = AccumuloInputFormatTest.class.getSimpleName();
-  private static final String INSTANCE_NAME = PREFIX + "_mapred_instance";
   private static final String TEST_TABLE_1 = PREFIX + "_mapred_table_1";
 
   private JobConf job;
@@ -74,6 +74,16 @@ public class AccumuloInputFormatTest {
     System.setProperty("hadoop.tmp.dir", System.getProperty("user.dir") + "/target/hadoop-tmp");
   }
 
+  @Rule
+  public TestName test = new TestName();
+
+  private Instance inst;
+
+  @Before
+  public void setupInstance() throws Exception {
+    inst = new org.apache.accumulo.core.client.mock.MockInstance(test.getMethodName());
+  }
+
   @Before
   public void createJob() {
     job = new JobConf();
@@ -242,13 +252,14 @@ public class AccumuloInputFormatTest {
     @Override
     public int run(String[] args) throws Exception {
 
-      if (args.length != 3) {
-        throw new IllegalArgumentException("Usage : " + MRTester.class.getName() + " <user> <pass> <table>");
+      if (args.length != 4) {
+        throw new IllegalArgumentException("Usage : " + MRTester.class.getName() + " <user> <pass> <table> <instanceName>");
       }
 
       String user = args[0];
       String pass = args[1];
       String table = args[2];
+      String instanceName = args[3];
 
       JobConf job = new JobConf(getConf());
       job.setJarByClass(this.getClass());
@@ -257,7 +268,7 @@ public class AccumuloInputFormatTest {
 
       AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
       AccumuloInputFormat.setInputTableName(job, table);
-      AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
+      AccumuloInputFormat.setMockInstance(job, instanceName);
 
       job.setMapperClass(TestMapper.class);
       job.setMapOutputKeyClass(Key.class);
@@ -278,8 +289,7 @@ public class AccumuloInputFormatTest {
 
   @Test
   public void testMap() throws Exception {
-    MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
-    Connector c = mockInstance.getConnector("root", new PasswordToken(""));
+    Connector c = inst.getConnector("root", new PasswordToken(""));
     c.tableOperations().create(TEST_TABLE_1);
     BatchWriter bw = c.createBatchWriter(TEST_TABLE_1, new BatchWriterConfig());
     for (int i = 0; i < 100; i++) {
@@ -289,7 +299,7 @@ public class AccumuloInputFormatTest {
     }
     bw.close();
 
-    MRTester.main("root", "", TEST_TABLE_1);
+    MRTester.main("root", "", TEST_TABLE_1, inst.getInstanceName());
     assertNull(e1);
     assertNull(e2);
   }
@@ -298,21 +308,20 @@ public class AccumuloInputFormatTest {
   public void testCorrectRangeInputSplits() throws Exception {
     JobConf job = new JobConf();
 
-    String username = "user", table = "table", instance = "mapred_testCorrectRangeInputSplits";
+    String username = "user", table = "table";
     PasswordToken password = new PasswordToken("password");
     Authorizations auths = new Authorizations("foo");
     Collection<Pair<Text,Text>> fetchColumns = Collections.singleton(new Pair<Text,Text>(new Text("foo"), new Text("bar")));
     boolean isolated = true, localIters = true;
     Level level = Level.WARN;
 
-    Instance inst = new MockInstance(instance);
     Connector connector = inst.getConnector(username, password);
     connector.tableOperations().create(table);
 
     AccumuloInputFormat.setConnectorInfo(job, username, password);
     AccumuloInputFormat.setInputTableName(job, table);
     AccumuloInputFormat.setScanAuthorizations(job, auths);
-    AccumuloInputFormat.setMockInstance(job, instance);
+    AccumuloInputFormat.setMockInstance(job, inst.getInstanceName());
     AccumuloInputFormat.setScanIsolation(job, isolated);
     AccumuloInputFormat.setLocalIterators(job, localIters);
     AccumuloInputFormat.fetchColumns(job, fetchColumns);
@@ -334,7 +343,7 @@ public class AccumuloInputFormatTest {
     Assert.assertEquals(table, risplit.getTableName());
     Assert.assertEquals(password, risplit.getToken());
     Assert.assertEquals(auths, risplit.getAuths());
-    Assert.assertEquals(instance, risplit.getInstanceName());
+    Assert.assertEquals(inst.getInstanceName(), risplit.getInstanceName());
     Assert.assertEquals(isolated, risplit.isIsolatedScan());
     Assert.assertEquals(localIters, risplit.usesLocalIterators());
     Assert.assertEquals(fetchColumns, risplit.getFetchedColumns());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloMultiTableInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloMultiTableInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloMultiTableInputFormatTest.java
index a5545ee..f9cca65 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloMultiTableInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloMultiTableInputFormatTest.java
@@ -28,9 +28,9 @@ import java.util.Map;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.mapreduce.InputTableConfig;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -142,7 +142,7 @@ public class AccumuloMultiTableInputFormatTest {
 
   @Test
   public void testMap() throws Exception {
-    MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
+    Instance mockInstance = new org.apache.accumulo.core.client.mock.MockInstance(INSTANCE_NAME);
     Connector c = mockInstance.getConnector("root", new PasswordToken(""));
     c.tableOperations().create(TEST_TABLE_1);
     c.tableOperations().create(TEST_TABLE_2);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java
index fa12227..d1f4c4c 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloOutputFormatTest.java
@@ -31,8 +31,8 @@ import java.util.concurrent.TimeUnit;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -181,7 +181,7 @@ public class AccumuloOutputFormatTest {
 
   @Test
   public void testMR() throws Exception {
-    MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
+    Instance mockInstance = new org.apache.accumulo.core.client.mock.MockInstance(INSTANCE_NAME);
     Connector c = mockInstance.getConnector("root", new PasswordToken(""));
     c.tableOperations().create(TEST_TABLE_1);
     c.tableOperations().create(TEST_TABLE_2);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java
index 4a52c19..3d59149 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/AccumuloRowInputFormatTest.java
@@ -30,8 +30,8 @@ import java.util.Map.Entry;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.MutationsRejectedException;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.KeyValue;
@@ -50,11 +50,12 @@ import org.apache.hadoop.mapred.Reporter;
 import org.apache.hadoop.mapred.lib.NullOutputFormat;
 import org.apache.hadoop.util.Tool;
 import org.apache.hadoop.util.ToolRunner;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TestName;
 
 public class AccumuloRowInputFormatTest {
   private static final String PREFIX = AccumuloRowInputFormatTest.class.getSimpleName();
-  private static final String INSTANCE_NAME = PREFIX + "_mapred_instance";
   private static final String TEST_TABLE_1 = PREFIX + "_mapred_table_1";
 
   private static final String ROW1 = "row1";
@@ -152,13 +153,14 @@ public class AccumuloRowInputFormatTest {
     @Override
     public int run(String[] args) throws Exception {
 
-      if (args.length != 3) {
-        throw new IllegalArgumentException("Usage : " + MRTester.class.getName() + " <user> <pass> <table>");
+      if (args.length != 4) {
+        throw new IllegalArgumentException("Usage : " + MRTester.class.getName() + " <user> <pass> <table> <instanceName>");
       }
 
       String user = args[0];
       String pass = args[1];
       String table = args[2];
+      String instanceName = args[3];
 
       JobConf job = new JobConf(getConf());
       job.setJarByClass(this.getClass());
@@ -167,7 +169,7 @@ public class AccumuloRowInputFormatTest {
 
       AccumuloInputFormat.setConnectorInfo(job, user, new PasswordToken(pass));
       AccumuloInputFormat.setInputTableName(job, table);
-      AccumuloRowInputFormat.setMockInstance(job, INSTANCE_NAME);
+      AccumuloRowInputFormat.setMockInstance(job, instanceName);
 
       job.setMapperClass(TestMapper.class);
       job.setMapOutputKeyClass(Key.class);
@@ -186,10 +188,13 @@ public class AccumuloRowInputFormatTest {
     }
   }
 
+  @Rule
+  public TestName test = new TestName();
+
   @Test
   public void test() throws Exception {
-    final MockInstance instance = new MockInstance(INSTANCE_NAME);
-    final Connector conn = instance.getConnector("root", new PasswordToken(""));
+    final Instance inst = new org.apache.accumulo.core.client.mock.MockInstance(test.getMethodName());
+    final Connector conn = inst.getConnector("root", new PasswordToken(""));
     conn.tableOperations().create(TEST_TABLE_1);
     BatchWriter writer = null;
     try {
@@ -202,7 +207,7 @@ public class AccumuloRowInputFormatTest {
         writer.close();
       }
     }
-    MRTester.main(new String[] {"root", "", TEST_TABLE_1});
+    MRTester.main(new String[] {"root", "", TEST_TABLE_1, inst.getInstanceName()});
     assertNull(e1);
     assertNull(e2);
   }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapred/RangeInputSplitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/RangeInputSplitTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/RangeInputSplitTest.java
index f567454..6c75ec2 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/RangeInputSplitTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/RangeInputSplitTest.java
@@ -33,6 +33,7 @@ import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.iterators.user.SummingCombiner;
 import org.apache.accumulo.core.iterators.user.WholeRowIterator;
 import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.DeprecationUtil;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.hadoop.io.Text;
 import org.apache.log4j.Level;
@@ -86,7 +87,7 @@ public class RangeInputSplitTest {
     split.setToken(new PasswordToken("password"));
     split.setPrincipal("root");
     split.setInstanceName("instance");
-    split.setMockInstance(true);
+    DeprecationUtil.setMockInstance(split, true);
     split.setZooKeepers("localhost");
     split.setIterators(iterators);
     split.setLogLevel(Level.WARN);
@@ -112,7 +113,7 @@ public class RangeInputSplitTest {
     Assert.assertEquals(split.getToken(), newSplit.getToken());
     Assert.assertEquals(split.getPrincipal(), newSplit.getPrincipal());
     Assert.assertEquals(split.getInstanceName(), newSplit.getInstanceName());
-    Assert.assertEquals(split.isMockInstance(), newSplit.isMockInstance());
+    Assert.assertEquals(DeprecationUtil.isMockInstanceSet(split), DeprecationUtil.isMockInstanceSet(newSplit));
     Assert.assertEquals(split.getZooKeepers(), newSplit.getZooKeepers());
     Assert.assertEquals(split.getIterators(), newSplit.getIterators());
     Assert.assertEquals(split.getLogLevel(), newSplit.getLogLevel());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapred/TokenFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapred/TokenFileTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapred/TokenFileTest.java
index f025783..7b4ef75 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapred/TokenFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapred/TokenFileTest.java
@@ -30,9 +30,9 @@ import java.util.Map.Entry;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.impl.Credentials;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -52,14 +52,11 @@ import org.apache.hadoop.util.ToolRunner;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TemporaryFolder;
+import org.junit.rules.TestName;
 
-/**
- *
- */
 public class TokenFileTest {
   private static AssertionError e1 = null;
   private static final String PREFIX = TokenFileTest.class.getSimpleName();
-  private static final String INSTANCE_NAME = PREFIX + "_mapred_instance";
   private static final String TEST_TABLE_1 = PREFIX + "_mapred_table_1";
   private static final String TEST_TABLE_2 = PREFIX + "_mapred_table_2";
 
@@ -99,14 +96,15 @@ public class TokenFileTest {
     @Override
     public int run(String[] args) throws Exception {
 
-      if (args.length != 4) {
-        throw new IllegalArgumentException("Usage : " + MRTokenFileTester.class.getName() + " <user> <token file> <inputtable> <outputtable>");
+      if (args.length != 5) {
+        throw new IllegalArgumentException("Usage : " + MRTokenFileTester.class.getName() + " <user> <token file> <inputtable> <outputtable> <instanceName>");
       }
 
       String user = args[0];
       String tokenFile = args[1];
       String table1 = args[2];
       String table2 = args[3];
+      String instanceName = args[4];
 
       JobConf job = new JobConf(getConf());
       job.setJarByClass(this.getClass());
@@ -115,7 +113,7 @@ public class TokenFileTest {
 
       AccumuloInputFormat.setConnectorInfo(job, user, tokenFile);
       AccumuloInputFormat.setInputTableName(job, table1);
-      AccumuloInputFormat.setMockInstance(job, INSTANCE_NAME);
+      AccumuloInputFormat.setMockInstance(job, instanceName);
 
       job.setMapperClass(TestMapper.class);
       job.setMapOutputKeyClass(Key.class);
@@ -127,7 +125,7 @@ public class TokenFileTest {
       AccumuloOutputFormat.setConnectorInfo(job, user, tokenFile);
       AccumuloOutputFormat.setCreateTables(job, false);
       AccumuloOutputFormat.setDefaultTableName(job, table2);
-      AccumuloOutputFormat.setMockInstance(job, INSTANCE_NAME);
+      AccumuloOutputFormat.setMockInstance(job, instanceName);
 
       job.setNumReduceTasks(0);
 
@@ -145,10 +143,13 @@ public class TokenFileTest {
   @Rule
   public TemporaryFolder folder = new TemporaryFolder(new File(System.getProperty("user.dir") + "/target"));
 
+  @Rule
+  public TestName test = new TestName();
+
   @Test
   public void testMR() throws Exception {
-    MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
-    Connector c = mockInstance.getConnector("root", new PasswordToken(""));
+    Instance inst = new org.apache.accumulo.core.client.mock.MockInstance(test.getMethodName());
+    Connector c = inst.getConnector("root", new PasswordToken(""));
     c.tableOperations().create(TEST_TABLE_1);
     c.tableOperations().create(TEST_TABLE_2);
     BatchWriter bw = c.createBatchWriter(TEST_TABLE_1, new BatchWriterConfig());
@@ -165,7 +166,7 @@ public class TokenFileTest {
     out.println(outString);
     out.close();
 
-    MRTokenFileTester.main(new String[] {"root", tf.getAbsolutePath(), TEST_TABLE_1, TEST_TABLE_2});
+    MRTokenFileTester.main(new String[] {"root", tf.getAbsolutePath(), TEST_TABLE_1, TEST_TABLE_2, inst.getInstanceName()});
     assertNull(e1);
 
     Scanner scanner = c.createScanner(TEST_TABLE_2, new Authorizations());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
index b8b3c47..43b21ce 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloFileOutputFormatTest.java
@@ -28,8 +28,8 @@ import java.io.IOException;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.mapreduce.lib.impl.FileOutputConfigurator;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
@@ -66,7 +66,7 @@ public class AccumuloFileOutputFormatTest {
 
   @BeforeClass
   public static void setup() throws Exception {
-    MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
+    Instance mockInstance = new org.apache.accumulo.core.client.mock.MockInstance(INSTANCE_NAME);
     Connector c = mockInstance.getConnector("root", new PasswordToken(""));
     c.tableOperations().create(EMPTY_TABLE);
     c.tableOperations().create(TEST_TABLE);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
index 83662e8..ff5e5f6 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloInputFormatTest.java
@@ -35,7 +35,6 @@ import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -57,11 +56,22 @@ import org.apache.hadoop.util.Tool;
 import org.apache.hadoop.util.ToolRunner;
 import org.apache.log4j.Level;
 import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TestName;
 
 public class AccumuloInputFormatTest {
 
-  private static final String PREFIX = AccumuloInputFormatTest.class.getSimpleName();
+  @Rule
+  public TestName test = new TestName();
+
+  private Instance inst;
+
+  @Before
+  public void setupInstance() throws Exception {
+    inst = new org.apache.accumulo.core.client.mock.MockInstance(test.getMethodName());
+  }
 
   /**
    * Check that the iterator configuration is getting stored in the Job conf correctly.
@@ -280,11 +290,9 @@ public class AccumuloInputFormatTest {
 
   @Test
   public void testMap() throws Exception {
-    final String INSTANCE_NAME = PREFIX + "_mapreduce_instance";
-    final String TEST_TABLE_1 = PREFIX + "_mapreduce_table_1";
+    final String TEST_TABLE_1 = test.getMethodName() + "_mapreduce_table_1";
 
-    MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
-    Connector c = mockInstance.getConnector("root", new PasswordToken(""));
+    Connector c = inst.getConnector("root", new PasswordToken(""));
     c.tableOperations().create(TEST_TABLE_1);
     BatchWriter bw = c.createBatchWriter(TEST_TABLE_1, new BatchWriterConfig());
     for (int i = 0; i < 100; i++) {
@@ -294,18 +302,16 @@ public class AccumuloInputFormatTest {
     }
     bw.close();
 
-    Assert.assertEquals(0, MRTester.main(new String[] {"root", "", TEST_TABLE_1, INSTANCE_NAME, AccumuloInputFormat.class.getName()}));
+    Assert.assertEquals(0, MRTester.main(new String[] {"root", "", TEST_TABLE_1, inst.getInstanceName(), AccumuloInputFormat.class.getCanonicalName()}));
     assertNull(e1);
     assertNull(e2);
   }
 
   @Test
   public void testMapWithBatchScanner() throws Exception {
-    final String INSTANCE_NAME = PREFIX + "_mapreduce_instance";
-    final String TEST_TABLE_2 = PREFIX + "_mapreduce_table_2";
+    final String TEST_TABLE_2 = test.getMethodName() + "_mapreduce_table_2";
 
-    MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
-    Connector c = mockInstance.getConnector("root", new PasswordToken(""));
+    Connector c = inst.getConnector("root", new PasswordToken(""));
     c.tableOperations().create(TEST_TABLE_2);
     BatchWriter bw = c.createBatchWriter(TEST_TABLE_2, new BatchWriterConfig());
     for (int i = 0; i < 100; i++) {
@@ -315,7 +321,8 @@ public class AccumuloInputFormatTest {
     }
     bw.close();
 
-    Assert.assertEquals(0, MRTester.main(new String[] {"root", "", TEST_TABLE_2, INSTANCE_NAME, AccumuloInputFormat.class.getName(), "True"}));
+    Assert
+        .assertEquals(0, MRTester.main(new String[] {"root", "", TEST_TABLE_2, inst.getInstanceName(), AccumuloInputFormat.class.getCanonicalName(), "True"}));
     assertNull(e1);
     assertNull(e2);
   }
@@ -324,21 +331,20 @@ public class AccumuloInputFormatTest {
   public void testCorrectRangeInputSplits() throws Exception {
     Job job = Job.getInstance(new Configuration(), this.getClass().getSimpleName() + "_" + System.currentTimeMillis());
 
-    String username = "user", table = "table", instance = "mapreduce_testCorrectRangeInputSplits";
+    String username = "user", table = "table";
     PasswordToken password = new PasswordToken("password");
     Authorizations auths = new Authorizations("foo");
     Collection<Pair<Text,Text>> fetchColumns = Collections.singleton(new Pair<Text,Text>(new Text("foo"), new Text("bar")));
     boolean isolated = true, localIters = true;
     Level level = Level.WARN;
 
-    Instance inst = new MockInstance(instance);
     Connector connector = inst.getConnector(username, password);
     connector.tableOperations().create(table);
 
     AccumuloInputFormat.setConnectorInfo(job, username, password);
     AccumuloInputFormat.setInputTableName(job, table);
     AccumuloInputFormat.setScanAuthorizations(job, auths);
-    AccumuloInputFormat.setMockInstance(job, instance);
+    AccumuloInputFormat.setMockInstance(job, inst.getInstanceName());
     AccumuloInputFormat.setScanIsolation(job, isolated);
     AccumuloInputFormat.setLocalIterators(job, localIters);
     AccumuloInputFormat.fetchColumns(job, fetchColumns);
@@ -360,7 +366,7 @@ public class AccumuloInputFormatTest {
     Assert.assertEquals(table, risplit.getTableName());
     Assert.assertEquals(password, risplit.getToken());
     Assert.assertEquals(auths, risplit.getAuths());
-    Assert.assertEquals(instance, risplit.getInstanceName());
+    Assert.assertEquals(inst.getInstanceName(), risplit.getInstanceName());
     Assert.assertEquals(isolated, risplit.isIsolatedScan());
     Assert.assertEquals(localIters, risplit.usesLocalIterators());
     Assert.assertEquals(fetchColumns, risplit.getFetchedColumns());
@@ -372,8 +378,7 @@ public class AccumuloInputFormatTest {
     String user = "testPartialInputSplitUser";
     PasswordToken password = new PasswordToken("");
 
-    MockInstance mockInstance = new MockInstance("testPartialInputSplitDelegationToConfiguration");
-    Connector c = mockInstance.getConnector(user, password);
+    Connector c = inst.getConnector(user, password);
     c.tableOperations().create("testtable");
     BatchWriter bw = c.createBatchWriter("testtable", new BatchWriterConfig());
     for (int i = 0; i < 100; i++) {
@@ -394,8 +399,7 @@ public class AccumuloInputFormatTest {
     String user = "testPartialFailedInputSplit";
     PasswordToken password = new PasswordToken("");
 
-    MockInstance mockInstance = new MockInstance("testPartialFailedInputSplitDelegationToConfiguration");
-    Connector c = mockInstance.getConnector(user, password);
+    Connector c = inst.getConnector(user, password);
     c.tableOperations().create("testtable");
     BatchWriter bw = c.createBatchWriter("testtable", new BatchWriterConfig());
     for (int i = 0; i < 100; i++) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloMultiTableInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloMultiTableInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloMultiTableInputFormatTest.java
index b83bfef..f1c3ca9 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloMultiTableInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloMultiTableInputFormatTest.java
@@ -28,8 +28,8 @@ import java.util.Map;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -140,7 +140,7 @@ public class AccumuloMultiTableInputFormatTest {
    */
   @Test
   public void testMap() throws Exception {
-    MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
+    Instance mockInstance = new org.apache.accumulo.core.client.mock.MockInstance(INSTANCE_NAME);
     Connector c = mockInstance.getConnector("root", new PasswordToken(""));
     c.tableOperations().create(TEST_TABLE_1);
     c.tableOperations().create(TEST_TABLE_2);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java
index 242bba6..c02ca66 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloOutputFormatTest.java
@@ -31,8 +31,8 @@ import java.util.concurrent.TimeUnit;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -174,7 +174,7 @@ public class AccumuloOutputFormatTest {
 
   @Test
   public void testMR() throws Exception {
-    MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
+    Instance mockInstance = new org.apache.accumulo.core.client.mock.MockInstance(INSTANCE_NAME);
     Connector c = mockInstance.getConnector("root", new PasswordToken(""));
     c.tableOperations().create(TEST_TABLE_1);
     c.tableOperations().create(TEST_TABLE_2);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java
index 2c8bfb1..8df9d0f 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/AccumuloRowInputFormatTest.java
@@ -30,8 +30,8 @@ import java.util.Map.Entry;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.MutationsRejectedException;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.KeyValue;
@@ -183,7 +183,7 @@ public class AccumuloRowInputFormatTest {
 
   @Test
   public void test() throws Exception {
-    final MockInstance instance = new MockInstance(INSTANCE_NAME);
+    final Instance instance = new org.apache.accumulo.core.client.mock.MockInstance(INSTANCE_NAME);
     final Connector conn = instance.getConnector("root", new PasswordToken(""));
     conn.tableOperations().create(TEST_TABLE_1);
     BatchWriter writer = null;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplitTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplitTest.java
index 833e594..1cf8c55 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplitTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/RangeInputSplitTest.java
@@ -33,6 +33,7 @@ import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.iterators.user.SummingCombiner;
 import org.apache.accumulo.core.iterators.user.WholeRowIterator;
 import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.DeprecationUtil;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.hadoop.io.Text;
 import org.apache.log4j.Level;
@@ -89,7 +90,7 @@ public class RangeInputSplitTest {
     split.setToken(new PasswordToken("password"));
     split.setPrincipal("root");
     split.setInstanceName("instance");
-    split.setMockInstance(true);
+    DeprecationUtil.setMockInstance(split, true);
     split.setZooKeepers("localhost");
     split.setIterators(iterators);
     split.setLogLevel(Level.WARN);
@@ -116,7 +117,7 @@ public class RangeInputSplitTest {
     Assert.assertEquals(split.getToken(), newSplit.getToken());
     Assert.assertEquals(split.getPrincipal(), newSplit.getPrincipal());
     Assert.assertEquals(split.getInstanceName(), newSplit.getInstanceName());
-    Assert.assertEquals(split.isMockInstance(), newSplit.isMockInstance());
+    Assert.assertEquals(DeprecationUtil.isMockInstanceSet(split), DeprecationUtil.isMockInstanceSet(newSplit));
     Assert.assertEquals(split.getZooKeepers(), newSplit.getZooKeepers());
     Assert.assertEquals(split.getIterators(), newSplit.getIterators());
     Assert.assertEquals(split.getLogLevel(), newSplit.getLogLevel());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/TokenFileTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/TokenFileTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/TokenFileTest.java
index 8f49751..825d905 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/TokenFileTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/TokenFileTest.java
@@ -30,9 +30,9 @@ import java.util.Map.Entry;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.impl.Credentials;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -140,7 +140,7 @@ public class TokenFileTest {
 
   @Test
   public void testMR() throws Exception {
-    MockInstance mockInstance = new MockInstance(INSTANCE_NAME);
+    Instance mockInstance = new org.apache.accumulo.core.client.mock.MockInstance(INSTANCE_NAME);
     Connector c = mockInstance.getConnector("root", new PasswordToken(""));
     c.tableOperations().create(TEST_TABLE_1);
     c.tableOperations().create(TEST_TABLE_2);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplitTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplitTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplitTest.java
index 4f3caf0..74c3438 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplitTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/impl/BatchInputSplitTest.java
@@ -27,13 +27,13 @@ import java.util.HashSet;
 import java.util.Set;
 
 import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.client.mapreduce.impl.BatchInputSplit;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.iterators.user.SummingCombiner;
 import org.apache.accumulo.core.iterators.user.WholeRowIterator;
 import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.util.DeprecationUtil;
 import org.apache.accumulo.core.util.Pair;
 import org.apache.hadoop.io.Text;
 import org.apache.log4j.Level;
@@ -88,7 +88,7 @@ public class BatchInputSplitTest {
     split.setFetchedColumns(fetchedColumns);
     split.setToken(new PasswordToken("password"));
     split.setPrincipal("root");
-    split.setMockInstance(true);
+    DeprecationUtil.setMockInstance(split, true);
     split.setInstanceName("instance");
     split.setZooKeepers("localhost");
     split.setIterators(iterators);
@@ -113,7 +113,7 @@ public class BatchInputSplitTest {
     Assert.assertEquals(split.getToken(), newSplit.getToken());
     Assert.assertEquals(split.getPrincipal(), newSplit.getPrincipal());
     Assert.assertEquals(split.getInstanceName(), newSplit.getInstanceName());
-    Assert.assertEquals(split.isMockInstance(), newSplit.isMockInstance());
+    Assert.assertEquals(DeprecationUtil.isMockInstanceSet(split), DeprecationUtil.isMockInstanceSet(newSplit));
     Assert.assertEquals(split.getZooKeepers(), newSplit.getZooKeepers());
     Assert.assertEquals(split.getIterators(), newSplit.getIterators());
     Assert.assertEquals(split.getLogLevel(), newSplit.getLogLevel());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java
index 751421a..a7e5e0a 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mapreduce/lib/impl/ConfiguratorBaseTest.java
@@ -26,7 +26,6 @@ import org.apache.accumulo.core.client.ClientConfiguration;
 import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty;
 import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.ZooKeeperInstance;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
@@ -100,15 +99,17 @@ public class ConfiguratorBaseTest {
     // assertEquals(1234000, ((ZooKeeperInstance) instance).getZooKeepersSessionTimeOut());
   }
 
+  @SuppressWarnings("deprecation")
   @Test
   public void testSetMockInstance() {
+    Class<?> mockClass = org.apache.accumulo.core.client.mock.MockInstance.class;
     Configuration conf = new Configuration();
     ConfiguratorBase.setMockInstance(this.getClass(), conf, "testInstanceName");
     assertEquals("testInstanceName", conf.get(ConfiguratorBase.enumToConfKey(this.getClass(), ConfiguratorBase.InstanceOpts.NAME)));
     assertEquals(null, conf.get(ConfiguratorBase.enumToConfKey(this.getClass(), ConfiguratorBase.InstanceOpts.ZOO_KEEPERS)));
-    assertEquals(MockInstance.class.getSimpleName(), conf.get(ConfiguratorBase.enumToConfKey(this.getClass(), ConfiguratorBase.InstanceOpts.TYPE)));
+    assertEquals(mockClass.getSimpleName(), conf.get(ConfiguratorBase.enumToConfKey(this.getClass(), ConfiguratorBase.InstanceOpts.TYPE)));
     Instance instance = ConfiguratorBase.getInstance(this.getClass(), conf);
-    assertEquals(MockInstance.class.getName(), instance.getClass().getName());
+    assertEquals(mockClass.getName(), instance.getClass().getName());
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java b/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
index 980498e..4a78a4b 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mock/MockConnectorTest.java
@@ -53,6 +53,7 @@ import org.junit.Test;
 
 import com.google.common.collect.Iterators;
 
+@Deprecated
 public class MockConnectorTest {
   Random random = new Random();
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java b/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java
index 308152e..c1f39e2 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java
@@ -24,7 +24,6 @@ import static org.junit.Assert.fail;
 import java.util.EnumSet;
 import java.util.HashSet;
 import java.util.Map.Entry;
-import java.util.Random;
 
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
@@ -47,11 +46,24 @@ import org.apache.accumulo.core.data.Value;
 import org.apache.accumulo.core.iterators.Filter;
 import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
 import org.apache.accumulo.core.security.Authorizations;
+import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TestName;
 
+@Deprecated
 public class MockNamespacesTest {
 
-  Random random = new Random();
+  @Rule
+  public TestName test = new TestName();
+
+  private Connector conn;
+
+  @Before
+  public void setupInstance() throws Exception {
+    Instance inst = new MockInstance(test.getMethodName());
+    conn = inst.getConnector("user", new PasswordToken("pass"));
+  }
 
   /**
    * This test creates a table without specifying a namespace. In this case, it puts the table into the default namespace.
@@ -59,12 +71,10 @@ public class MockNamespacesTest {
   @Test
   public void testDefaultNamespace() throws Exception {
     String tableName = "test";
-    Instance instance = new MockInstance("default");
-    Connector c = instance.getConnector("user", new PasswordToken("pass"));
 
-    assertTrue(c.namespaceOperations().exists(Namespaces.DEFAULT_NAMESPACE));
-    c.tableOperations().create(tableName);
-    assertTrue(c.tableOperations().exists(tableName));
+    assertTrue(conn.namespaceOperations().exists(Namespaces.DEFAULT_NAMESPACE));
+    conn.tableOperations().create(tableName);
+    assertTrue(conn.tableOperations().exists(tableName));
   }
 
   /**
@@ -78,38 +88,35 @@ public class MockNamespacesTest {
     String tableName1 = namespace + ".table1";
     String tableName2 = namespace + ".table2";
 
-    Instance instance = new MockInstance("createdelete");
-    Connector c = instance.getConnector("user", new PasswordToken("pass"));
-
-    c.namespaceOperations().create(namespace);
-    assertTrue(c.namespaceOperations().exists(namespace));
+    conn.namespaceOperations().create(namespace);
+    assertTrue(conn.namespaceOperations().exists(namespace));
 
-    c.tableOperations().create(tableName1);
-    assertTrue(c.tableOperations().exists(tableName1));
+    conn.tableOperations().create(tableName1);
+    assertTrue(conn.tableOperations().exists(tableName1));
 
-    c.tableOperations().create(tableName2);
-    assertTrue(c.tableOperations().exists(tableName2));
+    conn.tableOperations().create(tableName2);
+    assertTrue(conn.tableOperations().exists(tableName2));
 
     // deleting
     try {
       // can't delete a namespace with tables in it
-      c.namespaceOperations().delete(namespace);
+      conn.namespaceOperations().delete(namespace);
       fail();
     } catch (NamespaceNotEmptyException e) {
       // ignore, supposed to happen
     }
-    assertTrue(c.namespaceOperations().exists(namespace));
-    assertTrue(c.tableOperations().exists(tableName1));
-    assertTrue(c.tableOperations().exists(tableName2));
-
-    c.tableOperations().delete(tableName2);
-    assertTrue(!c.tableOperations().exists(tableName2));
-    assertTrue(c.namespaceOperations().exists(namespace));
-
-    c.tableOperations().delete(tableName1);
-    assertTrue(!c.tableOperations().exists(tableName1));
-    c.namespaceOperations().delete(namespace);
-    assertTrue(!c.namespaceOperations().exists(namespace));
+    assertTrue(conn.namespaceOperations().exists(namespace));
+    assertTrue(conn.tableOperations().exists(tableName1));
+    assertTrue(conn.tableOperations().exists(tableName2));
+
+    conn.tableOperations().delete(tableName2);
+    assertTrue(!conn.tableOperations().exists(tableName2));
+    assertTrue(conn.namespaceOperations().exists(namespace));
+
+    conn.tableOperations().delete(tableName1);
+    assertTrue(!conn.tableOperations().exists(tableName1));
+    conn.namespaceOperations().delete(namespace);
+    assertTrue(!conn.namespaceOperations().exists(namespace));
   }
 
   /**
@@ -130,51 +137,48 @@ public class MockNamespacesTest {
     String propKey = Property.TABLE_SCAN_MAXMEM.getKey();
     String propVal = "42K";
 
-    Instance instance = new MockInstance("props");
-    Connector c = instance.getConnector("user", new PasswordToken("pass"));
-
-    c.namespaceOperations().create(namespace);
-    c.tableOperations().create(tableName1);
-    c.namespaceOperations().setProperty(namespace, propKey, propVal);
+    conn.namespaceOperations().create(namespace);
+    conn.tableOperations().create(tableName1);
+    conn.namespaceOperations().setProperty(namespace, propKey, propVal);
 
     // check the namespace has the property
-    assertTrue(checkNamespaceHasProp(c, namespace, propKey, propVal));
+    assertTrue(checkNamespaceHasProp(conn, namespace, propKey, propVal));
 
     // check that the table gets it from the namespace
-    assertTrue(checkTableHasProp(c, tableName1, propKey, propVal));
+    assertTrue(checkTableHasProp(conn, tableName1, propKey, propVal));
 
     // test a second table to be sure the first wasn't magical
     // (also, changed the order, the namespace has the property already)
-    c.tableOperations().create(tableName2);
-    assertTrue(checkTableHasProp(c, tableName2, propKey, propVal));
+    conn.tableOperations().create(tableName2);
+    assertTrue(checkTableHasProp(conn, tableName2, propKey, propVal));
 
     // test that table properties override namespace properties
     String propKey2 = Property.TABLE_FILE_MAX.getKey();
     String propVal2 = "42";
     String tablePropVal = "13";
 
-    c.tableOperations().setProperty(tableName2, propKey2, tablePropVal);
-    c.namespaceOperations().setProperty("propchange", propKey2, propVal2);
+    conn.tableOperations().setProperty(tableName2, propKey2, tablePropVal);
+    conn.namespaceOperations().setProperty("propchange", propKey2, propVal2);
 
-    assertTrue(checkTableHasProp(c, tableName2, propKey2, tablePropVal));
+    assertTrue(checkTableHasProp(conn, tableName2, propKey2, tablePropVal));
 
     // now check that you can change the default namespace's properties
     propVal = "13K";
     String tableName = "some_table";
-    c.tableOperations().create(tableName);
-    c.namespaceOperations().setProperty(Namespaces.DEFAULT_NAMESPACE, propKey, propVal);
+    conn.tableOperations().create(tableName);
+    conn.namespaceOperations().setProperty(Namespaces.DEFAULT_NAMESPACE, propKey, propVal);
 
-    assertTrue(checkTableHasProp(c, tableName, propKey, propVal));
+    assertTrue(checkTableHasProp(conn, tableName, propKey, propVal));
 
     // test the properties server-side by configuring an iterator.
     // should not show anything with column-family = 'a'
     String tableName3 = namespace + ".table3";
-    c.tableOperations().create(tableName3);
+    conn.tableOperations().create(tableName3);
 
     IteratorSetting setting = new IteratorSetting(250, "thing", SimpleFilter.class.getName());
-    c.namespaceOperations().attachIterator(namespace, setting);
+    conn.namespaceOperations().attachIterator(namespace, setting);
 
-    BatchWriter bw = c.createBatchWriter(tableName3, new BatchWriterConfig());
+    BatchWriter bw = conn.createBatchWriter(tableName3, new BatchWriterConfig());
     Mutation m = new Mutation("r");
     m.put("a", "b", new Value("abcde".getBytes()));
     bw.addMutation(m);
@@ -197,22 +201,18 @@ public class MockNamespacesTest {
     String tableName1 = "renamed.table1";
     // String tableName2 = "cloned.table2";
 
-    Instance instance = new MockInstance("renameclone");
-    Connector c = instance.getConnector("user", new PasswordToken("pass"));
-
-    c.tableOperations().create(tableName);
-    c.namespaceOperations().create(namespace1);
-    c.namespaceOperations().create(namespace2);
+    conn.tableOperations().create(tableName);
+    conn.namespaceOperations().create(namespace1);
+    conn.namespaceOperations().create(namespace2);
 
-    c.tableOperations().rename(tableName, tableName1);
+    conn.tableOperations().rename(tableName, tableName1);
 
-    assertTrue(c.tableOperations().exists(tableName1));
-    assertTrue(!c.tableOperations().exists(tableName));
+    assertTrue(conn.tableOperations().exists(tableName1));
+    assertTrue(!conn.tableOperations().exists(tableName));
 
     // TODO implement clone in mock
     // c.tableOperations().clone(tableName1, tableName2, false, null, null);
     // assertTrue(c.tableOperations().exists(tableName1)); assertTrue(c.tableOperations().exists(tableName2));
-    return;
   }
 
   /**
@@ -224,18 +224,15 @@ public class MockNamespacesTest {
     String namespace2 = "n2";
     String table = "t";
 
-    Instance instance = new MockInstance("rename");
-    Connector c = instance.getConnector("user", new PasswordToken("pass"));
+    conn.namespaceOperations().create(namespace1);
+    conn.tableOperations().create(namespace1 + "." + table);
 
-    c.namespaceOperations().create(namespace1);
-    c.tableOperations().create(namespace1 + "." + table);
+    conn.namespaceOperations().rename(namespace1, namespace2);
 
-    c.namespaceOperations().rename(namespace1, namespace2);
-
-    assertTrue(!c.namespaceOperations().exists(namespace1));
-    assertTrue(c.namespaceOperations().exists(namespace2));
-    assertTrue(!c.tableOperations().exists(namespace1 + "." + table));
-    assertTrue(c.tableOperations().exists(namespace2 + "." + table));
+    assertTrue(!conn.namespaceOperations().exists(namespace1));
+    assertTrue(conn.namespaceOperations().exists(namespace2));
+    assertTrue(!conn.tableOperations().exists(namespace1 + "." + table));
+    assertTrue(conn.tableOperations().exists(namespace2 + "." + table));
   }
 
   /**
@@ -243,34 +240,31 @@ public class MockNamespacesTest {
    */
   @Test
   public void testNamespaceIterators() throws Exception {
-    Instance instance = new MockInstance("Iterators");
-    Connector c = instance.getConnector("user", new PasswordToken("pass"));
-
     String namespace = "iterator";
     String tableName = namespace + ".table";
     String iter = "thing";
 
-    c.namespaceOperations().create(namespace);
-    c.tableOperations().create(tableName);
+    conn.namespaceOperations().create(namespace);
+    conn.tableOperations().create(tableName);
 
     IteratorSetting setting = new IteratorSetting(250, iter, SimpleFilter.class.getName());
     HashSet<IteratorScope> scope = new HashSet<IteratorScope>();
     scope.add(IteratorScope.scan);
-    c.namespaceOperations().attachIterator(namespace, setting, EnumSet.copyOf(scope));
+    conn.namespaceOperations().attachIterator(namespace, setting, EnumSet.copyOf(scope));
 
-    BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
+    BatchWriter bw = conn.createBatchWriter(tableName, new BatchWriterConfig());
     Mutation m = new Mutation("r");
     m.put("a", "b", new Value("abcde".getBytes(UTF_8)));
     bw.addMutation(m);
     bw.flush();
 
-    Scanner s = c.createScanner(tableName, Authorizations.EMPTY);
+    Scanner s = conn.createScanner(tableName, Authorizations.EMPTY);
     System.out.println(s.iterator().next());
     // do scanners work correctly in mock?
     // assertTrue(!s.iterator().hasNext());
 
-    assertTrue(c.namespaceOperations().listIterators(namespace).containsKey(iter));
-    c.namespaceOperations().removeIterator(namespace, iter, EnumSet.copyOf(scope));
+    assertTrue(conn.namespaceOperations().listIterators(namespace).containsKey(iter));
+    conn.namespaceOperations().removeIterator(namespace, iter, EnumSet.copyOf(scope));
   }
 
   private boolean checkTableHasProp(Connector c, String t, String propKey, String propVal) throws AccumuloException, TableNotFoundException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java b/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
index 9733bd3..792e199 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
@@ -59,16 +59,29 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.io.Text;
 import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TestName;
 
 import com.google.common.collect.Iterators;
 
+@Deprecated
 public class MockTableOperationsTest {
 
+  @Rule
+  public TestName test = new TestName();
+
+  private Connector conn;
+
+  @Before
+  public void setupInstance() throws Exception {
+    Instance inst = new MockInstance(test.getMethodName());
+    conn = inst.getConnector("user", new PasswordToken("pass"));
+  }
+
   @Test
   public void testCreateUseVersions() throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException {
-    Instance instance = new MockInstance("topstest");
-    Connector conn = instance.getConnector("user", new PasswordToken("pass"));
     String t = "tableName1";
 
     {
@@ -128,8 +141,6 @@ public class MockTableOperationsTest {
 
   @Test
   public void testTableNotFound() throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException {
-    Instance instance = new MockInstance("topstest");
-    Connector conn = instance.getConnector("user", new PasswordToken("pass"));
     IteratorSetting setting = new IteratorSetting(100, "myvers", VersioningIterator.class);
     String t = "tableName";
     try {
@@ -161,7 +172,7 @@ public class MockTableOperationsTest {
       Assert.fail();
     } catch (TableNotFoundException e) {}
     try {
-      conn.tableOperations().removeIterator(t, null, null);
+      conn.tableOperations().removeIterator(t, null, EnumSet.noneOf(IteratorScope.class));
       Assert.fail();
     } catch (TableNotFoundException e) {}
     try {
@@ -188,12 +199,10 @@ public class MockTableOperationsTest {
   @Test
   public void testImport() throws Throwable {
     ImportTestFilesAndData dataAndFiles = prepareTestFiles();
-    Instance instance = new MockInstance("foo");
-    Connector connector = instance.getConnector("user", new PasswordToken(new byte[0]));
-    TableOperations tableOperations = connector.tableOperations();
+    TableOperations tableOperations = conn.tableOperations();
     tableOperations.create("a_table");
     tableOperations.importDirectory("a_table", dataAndFiles.importPath.toString(), dataAndFiles.failurePath.toString(), false);
-    Scanner scanner = connector.createScanner("a_table", new Authorizations());
+    Scanner scanner = conn.createScanner("a_table", new Authorizations());
     Iterator<Entry<Key,Value>> iterator = scanner.iterator();
     for (int i = 0; i < 5; i++) {
       Assert.assertTrue(iterator.hasNext());
@@ -235,18 +244,14 @@ public class MockTableOperationsTest {
 
   @Test(expected = TableNotFoundException.class)
   public void testFailsWithNoTable() throws Throwable {
-    Instance instance = new MockInstance("foo");
-    Connector connector = instance.getConnector("user", new PasswordToken(new byte[0]));
-    TableOperations tableOperations = connector.tableOperations();
+    TableOperations tableOperations = conn.tableOperations();
     ImportTestFilesAndData testFiles = prepareTestFiles();
     tableOperations.importDirectory("doesnt_exist_table", testFiles.importPath.toString(), testFiles.failurePath.toString(), false);
   }
 
   @Test(expected = IOException.class)
   public void testFailsWithNonEmptyFailureDirectory() throws Throwable {
-    Instance instance = new MockInstance("foo");
-    Connector connector = instance.getConnector("user", new PasswordToken(new byte[0]));
-    TableOperations tableOperations = connector.tableOperations();
+    TableOperations tableOperations = conn.tableOperations();
     ImportTestFilesAndData testFiles = prepareTestFiles();
     FileSystem fs = testFiles.failurePath.getFileSystem(new Configuration());
     fs.open(testFiles.failurePath.suffix("/something")).close();
@@ -255,11 +260,9 @@ public class MockTableOperationsTest {
 
   @Test
   public void testDeleteRows() throws Exception {
-    Instance instance = new MockInstance("rows");
-    Connector connector = instance.getConnector("user", new PasswordToken("foo".getBytes()));
-    TableOperations to = connector.tableOperations();
+    TableOperations to = conn.tableOperations();
     to.create("test");
-    BatchWriter bw = connector.createBatchWriter("test", new BatchWriterConfig());
+    BatchWriter bw = conn.createBatchWriter("test", new BatchWriterConfig());
     for (int r = 0; r < 20; r++) {
       Mutation m = new Mutation("" + r);
       for (int c = 0; c < 5; c++) {
@@ -269,7 +272,7 @@ public class MockTableOperationsTest {
     }
     bw.flush();
     to.deleteRows("test", new Text("1"), new Text("2"));
-    Scanner s = connector.createScanner("test", Authorizations.EMPTY);
+    Scanner s = conn.createScanner("test", Authorizations.EMPTY);
     int oneCnt = 0;
     for (Entry<Key,Value> entry : s) {
       char rowStart = entry.getKey().getRow().toString().charAt(0);
@@ -281,11 +284,9 @@ public class MockTableOperationsTest {
 
   @Test
   public void testDeleteRowsWithNullKeys() throws Exception {
-    Instance instance = new MockInstance("rows");
-    Connector connector = instance.getConnector("user", new PasswordToken("foo"));
-    TableOperations to = connector.tableOperations();
+    TableOperations to = conn.tableOperations();
     to.create("test2");
-    BatchWriter bw = connector.createBatchWriter("test2", new BatchWriterConfig());
+    BatchWriter bw = conn.createBatchWriter("test2", new BatchWriterConfig());
     for (int r = 0; r < 30; r++) {
       Mutation m = new Mutation(Integer.toString(r));
       for (int c = 0; c < 5; c++) {
@@ -298,7 +299,7 @@ public class MockTableOperationsTest {
     // test null end
     // will remove rows 4 through 9 (6 * 5 = 30 entries)
     to.deleteRows("test2", new Text("30"), null);
-    Scanner s = connector.createScanner("test2", Authorizations.EMPTY);
+    Scanner s = conn.createScanner("test2", Authorizations.EMPTY);
     int rowCnt = 0;
     for (Entry<Key,Value> entry : s) {
       String rowId = entry.getKey().getRow().toString();
@@ -311,7 +312,7 @@ public class MockTableOperationsTest {
     // test null start
     // will remove 0-1, 10-19, 2
     to.deleteRows("test2", null, new Text("2"));
-    s = connector.createScanner("test2", Authorizations.EMPTY);
+    s = conn.createScanner("test2", Authorizations.EMPTY);
     rowCnt = 0;
     for (Entry<Key,Value> entry : s) {
       char rowStart = entry.getKey().getRow().toString().charAt(0);
@@ -324,7 +325,7 @@ public class MockTableOperationsTest {
     // test null start and end
     // deletes everything still left
     to.deleteRows("test2", null, null);
-    s = connector.createScanner("test2", Authorizations.EMPTY);
+    s = conn.createScanner("test2", Authorizations.EMPTY);
     rowCnt = Iterators.size(s.iterator());
     s.close();
     to.delete("test2");
@@ -334,8 +335,6 @@ public class MockTableOperationsTest {
 
   @Test
   public void testTableIdMap() throws Exception {
-    Instance inst = new MockInstance("testTableIdMap");
-    Connector conn = inst.getConnector("root", new PasswordToken(""));
     TableOperations tops = conn.tableOperations();
     tops.create("foo");
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java b/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java
index b03bda9..4f041c9 100644
--- a/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java
+++ b/core/src/test/java/org/apache/accumulo/core/client/mock/TestBatchScanner821.java
@@ -31,11 +31,23 @@ import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Range;
 import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.iterators.WrappingIterator;
 import org.apache.accumulo.core.security.Authorizations;
+import org.apache.hadoop.io.Text;
 import org.junit.Test;
 
+@Deprecated
 public class TestBatchScanner821 {
 
+  public static class TransformIterator extends WrappingIterator {
+
+    @Override
+    public Key getTopKey() {
+      Key k = getSource().getTopKey();
+      return new Key(new Text(k.getRow().toString().toLowerCase()), k.getColumnFamily(), k.getColumnQualifier(), k.getColumnVisibility(), k.getTimestamp());
+    }
+  }
+
   @Test
   public void test() throws Exception {
     MockInstance inst = new MockInstance();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/client/mock/TransformIterator.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/TransformIterator.java b/core/src/test/java/org/apache/accumulo/core/client/mock/TransformIterator.java
deleted file mode 100644
index a7e7eef..0000000
--- a/core/src/test/java/org/apache/accumulo/core/client/mock/TransformIterator.java
+++ /dev/null
@@ -1,30 +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.core.client.mock;
-
-import org.apache.accumulo.core.data.Key;
-import org.apache.accumulo.core.iterators.WrappingIterator;
-import org.apache.hadoop.io.Text;
-
-public class TransformIterator extends WrappingIterator {
-
-  @Override
-  public Key getTopKey() {
-    Key k = getSource().getTopKey();
-    return new Key(new Text(k.getRow().toString().toLowerCase()), k.getColumnFamily(), k.getColumnQualifier(), k.getColumnVisibility(), k.getTimestamp());
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java
index 365cee4..c3696d4 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/IntersectingIteratorTest.java
@@ -16,6 +16,10 @@
  */
 package org.apache.accumulo.core.iterators.user;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -26,14 +30,12 @@ import java.util.Map.Entry;
 import java.util.Random;
 import java.util.TreeMap;
 
-import junit.framework.TestCase;
-
 import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Key;
@@ -47,13 +49,13 @@ import org.apache.accumulo.core.iterators.SortedMapIterator;
 import org.apache.accumulo.core.iterators.system.MultiIterator;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.hadoop.io.Text;
-import org.apache.log4j.Level;
-import org.apache.log4j.Logger;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.TestName;
 
-public class IntersectingIteratorTest extends TestCase {
+public class IntersectingIteratorTest {
 
   private static final Collection<ByteSequence> EMPTY_COL_FAMS = new ArrayList<ByteSequence>();
-  private static final Logger log = Logger.getLogger(IntersectingIterator.class);
   private static IteratorEnvironment env = new DefaultIteratorEnvironment();
 
   TreeMap<Key,Value> map;
@@ -66,10 +68,6 @@ public class IntersectingIteratorTest extends TestCase {
 
   int docid = 0;
 
-  static {
-    log.setLevel(Level.OFF);
-  }
-
   private TreeMap<Key,Value> createSortedMap(float hitRatio, int numRows, int numDocsPerRow, Text[] columnFamilies, Text[] otherColumnFamilies,
       HashSet<Text> docs, Text[] negatedColumns) {
     Random r = new Random();
@@ -130,16 +128,13 @@ public class IntersectingIteratorTest extends TestCase {
     docid = 0;
   }
 
-  public void testNull() {}
-
-  @Override
-  public void setUp() {
-    Logger.getRootLogger().setLevel(Level.ERROR);
-  }
-
   private static final int NUM_ROWS = 10;
   private static final int NUM_DOCIDS = 1000;
 
+  @Rule
+  public TestName test = new TestName();
+
+  @Test
   public void test1() throws IOException {
     columnFamilies = new Text[2];
     columnFamilies[0] = new Text("C");
@@ -168,6 +163,7 @@ public class IntersectingIteratorTest extends TestCase {
     cleanup();
   }
 
+  @Test
   public void test2() throws IOException {
     columnFamilies = new Text[3];
     columnFamilies[0] = new Text("A");
@@ -197,6 +193,7 @@ public class IntersectingIteratorTest extends TestCase {
     cleanup();
   }
 
+  @Test
   public void test3() throws IOException {
     columnFamilies = new Text[6];
     columnFamilies[0] = new Text("C");
@@ -234,6 +231,7 @@ public class IntersectingIteratorTest extends TestCase {
     cleanup();
   }
 
+  @Test
   public void test4() throws IOException {
     columnFamilies = new Text[3];
     notFlags = new boolean[3];
@@ -270,6 +268,7 @@ public class IntersectingIteratorTest extends TestCase {
     cleanup();
   }
 
+  @Test
   public void test6() throws IOException {
     columnFamilies = new Text[1];
     columnFamilies[0] = new Text("C");
@@ -297,9 +296,10 @@ public class IntersectingIteratorTest extends TestCase {
     cleanup();
   }
 
+  @Test
   public void testWithBatchScanner() throws Exception {
     Value empty = new Value(new byte[] {});
-    MockInstance inst = new MockInstance("mockabye");
+    Instance inst = new org.apache.accumulo.core.client.mock.MockInstance(test.getMethodName());
     Connector connector = inst.getConnector("user", new PasswordToken("pass"));
     connector.tableOperations().create("index");
     BatchWriter bw = connector.createBatchWriter("index", new BatchWriterConfig());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java
index 2649f90..7a203c8 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/RegExFilterTest.java
@@ -17,14 +17,14 @@
 package org.apache.accumulo.core.iterators.user;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.TreeMap;
 
-import junit.framework.TestCase;
-
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchWriter;
@@ -35,7 +35,6 @@ import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableExistsException;
 import org.apache.accumulo.core.client.TableNotFoundException;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.Key;
@@ -46,12 +45,26 @@ import org.apache.accumulo.core.iterators.DefaultIteratorEnvironment;
 import org.apache.accumulo.core.iterators.SortedMapIterator;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.hadoop.io.Text;
+import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TestName;
 
-public class RegExFilterTest extends TestCase {
+public class RegExFilterTest {
 
   private static final Collection<ByteSequence> EMPTY_COL_FAMS = new ArrayList<ByteSequence>();
 
+  private Connector conn;
+
+  @Rule
+  public TestName test = new TestName();
+
+  @Before
+  public void setupInstance() throws Exception {
+    Instance instance = new org.apache.accumulo.core.client.mock.MockInstance(test.getMethodName());
+    conn = instance.getConnector("root", new PasswordToken(""));
+  }
+
   private Key nkv(TreeMap<Key,Value> tm, String row, String cf, String cq, String val) {
     Key k = nk(row, cf, cq);
     tm.put(k, new Value(val.getBytes()));
@@ -62,6 +75,7 @@ public class RegExFilterTest extends TestCase {
     return new Key(new Text(row), new Text(cf), new Text(cq));
   }
 
+  @Test
   public void test1() throws IOException {
     TreeMap<Key,Value> tm = new TreeMap<Key,Value>();
 
@@ -263,9 +277,6 @@ public class RegExFilterTest extends TestCase {
     ball[b1.length] = (byte) 0;
     System.arraycopy(b2, 0, ball, b1.length + 1, b2.length);
 
-    Instance instance = new MockInstance();
-    Connector conn = instance.getConnector("root", new PasswordToken(new byte[0]));
-
     conn.tableOperations().create(table);
     BatchWriter bw = conn.createBatchWriter(table, new BatchWriterConfig());
     Mutation m = new Mutation(ball);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
index 7914ec0..6026c14 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/RowFilterTest.java
@@ -32,9 +32,9 @@ import java.util.TreeMap;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.data.ByteSequence;
 import org.apache.accumulo.core.data.ColumnUpdate;
@@ -47,14 +47,24 @@ import org.apache.accumulo.core.iterators.SortedKeyValueIterator;
 import org.apache.accumulo.core.iterators.SortedMapIterator;
 import org.apache.accumulo.core.security.Authorizations;
 import org.apache.hadoop.io.Text;
+import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
-
-/**
- *
- */
+import org.junit.rules.TestName;
 
 public class RowFilterTest {
 
+  @Rule
+  public TestName test = new TestName();
+
+  private Connector conn;
+
+  @Before
+  public void setupInstance() throws Exception {
+    Instance instance = new org.apache.accumulo.core.client.mock.MockInstance(test.getMethodName());
+    conn = instance.getConnector("", new PasswordToken(""));
+  }
+
   public static class SummingRowFilter extends RowFilter {
 
     @Override
@@ -187,9 +197,6 @@ public class RowFilterTest {
 
   @Test
   public void test1() throws Exception {
-    MockInstance instance = new MockInstance("rft1");
-    Connector conn = instance.getConnector("", new PasswordToken(""));
-
     conn.tableOperations().create("table1");
     BatchWriter bw = conn.createBatchWriter("table1", new BatchWriterConfig());
 
@@ -231,9 +238,6 @@ public class RowFilterTest {
 
   @Test
   public void testChainedRowFilters() throws Exception {
-    MockInstance instance = new MockInstance("rft1");
-    Connector conn = instance.getConnector("", new PasswordToken(""));
-
     conn.tableOperations().create("chained_row_filters");
     BatchWriter bw = conn.createBatchWriter("chained_row_filters", new BatchWriterConfig());
     for (Mutation m : createMutations()) {
@@ -247,9 +251,6 @@ public class RowFilterTest {
 
   @Test
   public void testFilterConjunction() throws Exception {
-    MockInstance instance = new MockInstance("rft1");
-    Connector conn = instance.getConnector("", new PasswordToken(""));
-
     conn.tableOperations().create("filter_conjunction");
     BatchWriter bw = conn.createBatchWriter("filter_conjunction", new BatchWriterConfig());
     for (Mutation m : createMutations()) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java b/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
index 758f718..e98afd7 100644
--- a/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/iterators/user/TransformingIteratorTest.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -37,9 +38,9 @@ import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.data.ArrayByteSequence;
@@ -58,7 +59,9 @@ import org.apache.accumulo.core.security.ColumnVisibility;
 import org.apache.hadoop.io.Text;
 import org.junit.Assert;
 import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TestName;
 
 public class TransformingIteratorTest {
   private static final String TABLE_NAME = "test_table";
@@ -66,9 +69,12 @@ public class TransformingIteratorTest {
   private Connector connector;
   private Scanner scanner;
 
+  @Rule
+  public TestName test = new TestName();
+
   @Before
   public void setUpMockAccumulo() throws Exception {
-    MockInstance instance = new MockInstance("test");
+    Instance instance = new org.apache.accumulo.core.client.mock.MockInstance(test.getMethodName());
     connector = instance.getConnector("user", new PasswordToken("password"));
     connector.securityOperations().changeUserAuthorizations("user", authorizations);
 
@@ -278,9 +284,6 @@ public class TransformingIteratorTest {
 
   @Test
   public void testDeepCopy() throws Exception {
-    MockInstance instance = new MockInstance("test");
-    Connector connector = instance.getConnector("user", new PasswordToken("password"));
-
     connector.tableOperations().create("shard_table");
 
     BatchWriter bw = connector.createBatchWriter("shard_table", new BatchWriterConfig());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java b/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java
index 0e59025..0a0a940 100644
--- a/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/metadata/MetadataServicerTest.java
@@ -21,20 +21,46 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
 
+import java.util.HashMap;
+
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
-import org.apache.accumulo.core.client.ClientConfiguration;
 import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.Instance;
 import org.apache.accumulo.core.client.TableExistsException;
 import org.apache.accumulo.core.client.TableNotFoundException;
+import org.apache.accumulo.core.client.admin.TableOperations;
 import org.apache.accumulo.core.client.impl.ClientContext;
-import org.apache.accumulo.core.client.impl.Credentials;
-import org.apache.accumulo.core.client.mock.MockInstance;
-import org.apache.accumulo.core.client.security.tokens.PasswordToken;
+import org.apache.accumulo.core.replication.ReplicationTable;
+import org.easymock.EasyMock;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 public class MetadataServicerTest {
 
+  private static final String userTableName = "tableName";
+  private static final String userTableId = "tableId";
+  private static ClientContext context;
+
+  @BeforeClass
+  public static void setupContext() throws Exception {
+    HashMap<String,String> tableNameToIdMap = new HashMap<>();
+    tableNameToIdMap.put(RootTable.NAME, RootTable.ID);
+    tableNameToIdMap.put(MetadataTable.NAME, MetadataTable.ID);
+    tableNameToIdMap.put(ReplicationTable.NAME, ReplicationTable.ID);
+    tableNameToIdMap.put(userTableName, userTableId);
+
+    context = EasyMock.createMock(ClientContext.class);
+    Connector conn = EasyMock.createMock(Connector.class);
+    Instance inst = EasyMock.createMock(Instance.class);
+    TableOperations tableOps = EasyMock.createMock(TableOperations.class);
+    EasyMock.expect(tableOps.tableIdMap()).andReturn(tableNameToIdMap).anyTimes();
+    EasyMock.expect(conn.tableOperations()).andReturn(tableOps).anyTimes();
+    EasyMock.expect(context.getInstance()).andReturn(inst).anyTimes();
+    EasyMock.expect(context.getConnector()).andReturn(conn).anyTimes();
+    EasyMock.replay(context, conn, inst, tableOps);
+  }
+
   @Test
   public void checkSystemTableIdentifiers() {
     assertNotEquals(RootTable.ID, MetadataTable.ID);
@@ -43,14 +69,6 @@ public class MetadataServicerTest {
 
   @Test
   public void testGetCorrectServicer() throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException {
-    String userTableName = "A";
-    MockInstance instance = new MockInstance("metadataTest");
-    Connector connector = instance.getConnector("root", new PasswordToken(""));
-    connector.tableOperations().create(userTableName);
-    String userTableId = connector.tableOperations().tableIdMap().get(userTableName);
-    Credentials credentials = new Credentials("root", new PasswordToken(""));
-    ClientContext context = new ClientContext(instance, credentials, new ClientConfiguration());
-
     MetadataServicer ms = MetadataServicer.forTableId(context, RootTable.ID);
     assertTrue(ms instanceof ServicerForRootTable);
     assertFalse(ms instanceof TableMetadataServicer);
@@ -62,6 +80,12 @@ public class MetadataServicerTest {
     assertEquals(RootTable.NAME, ((TableMetadataServicer) ms).getServicingTableName());
     assertEquals(MetadataTable.ID, ms.getServicedTableId());
 
+    ms = MetadataServicer.forTableId(context, ReplicationTable.ID);
+    assertTrue(ms instanceof ServicerForUserTables);
+    assertTrue(ms instanceof TableMetadataServicer);
+    assertEquals(MetadataTable.NAME, ((TableMetadataServicer) ms).getServicingTableName());
+    assertEquals(ReplicationTable.ID, ms.getServicedTableId());
+
     ms = MetadataServicer.forTableId(context, userTableId);
     assertTrue(ms instanceof ServicerForUserTables);
     assertTrue(ms instanceof TableMetadataServicer);
@@ -79,6 +103,12 @@ public class MetadataServicerTest {
     assertEquals(RootTable.NAME, ((TableMetadataServicer) ms).getServicingTableName());
     assertEquals(MetadataTable.ID, ms.getServicedTableId());
 
+    ms = MetadataServicer.forTableName(context, ReplicationTable.NAME);
+    assertTrue(ms instanceof ServicerForUserTables);
+    assertTrue(ms instanceof TableMetadataServicer);
+    assertEquals(MetadataTable.NAME, ((TableMetadataServicer) ms).getServicingTableName());
+    assertEquals(ReplicationTable.ID, ms.getServicedTableId());
+
     ms = MetadataServicer.forTableName(context, userTableName);
     assertTrue(ms instanceof ServicerForUserTables);
     assertTrue(ms instanceof TableMetadataServicer);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/2556df3a/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java b/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java
index 0457caa..bd4b1ba 100644
--- a/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/security/CredentialsTest.java
@@ -30,24 +30,37 @@ 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.impl.Credentials;
-import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.SecurityErrorCode;
 import org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer;
 import org.apache.accumulo.core.client.security.tokens.NullToken;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.security.thrift.TCredentials;
+import org.apache.accumulo.core.util.DeprecationUtil;
+import org.easymock.EasyMock;
+import org.junit.Before;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TestName;
 
-/**
- *
- */
 public class CredentialsTest {
 
+  @Rule
+  public TestName test = new TestName();
+
+  private Instance inst;
+
+  @Before
+  public void setupInstance() {
+    inst = EasyMock.createMock(Instance.class);
+    EasyMock.expect(inst.getInstanceID()).andReturn(test.getMethodName()).anyTimes();
+    EasyMock.replay(inst);
+  }
+
   @Test
   public void testToThrift() throws DestroyFailedException {
     // verify thrift serialization
     Credentials creds = new Credentials("test", new PasswordToken("testing"));
-    TCredentials tCreds = creds.toThrift(new MockInstance());
+    TCredentials tCreds = creds.toThrift(inst);
     assertEquals("test", tCreds.getPrincipal());
     assertEquals(PasswordToken.class.getName(), tCreds.getTokenClassName());
     assertArrayEquals(AuthenticationTokenSerializer.serialize(new PasswordToken("testing")), tCreds.getToken());
@@ -55,7 +68,7 @@ public class CredentialsTest {
     // verify that we can't serialize if it's destroyed
     creds.getToken().destroy();
     try {
-      creds.toThrift(new MockInstance());
+      creds.toThrift(inst);
       fail();
     } catch (Exception e) {
       assertTrue(e instanceof RuntimeException);
@@ -67,14 +80,14 @@ public class CredentialsTest {
   @Test
   public void roundtripThrift() throws DestroyFailedException {
     Credentials creds = new Credentials("test", new PasswordToken("testing"));
-    TCredentials tCreds = creds.toThrift(new MockInstance());
+    TCredentials tCreds = creds.toThrift(inst);
     Credentials roundtrip = Credentials.fromThrift(tCreds);
     assertEquals("Roundtrip through thirft changed credentials equality", creds, roundtrip);
   }
 
   @Test
   public void testMockConnector() throws AccumuloException, DestroyFailedException, AccumuloSecurityException {
-    Instance inst = new MockInstance();
+    Instance inst = DeprecationUtil.makeMockInstance(test.getMethodName());
     Connector rootConnector = inst.getConnector("root", new PasswordToken());
     PasswordToken testToken = new PasswordToken("testPass");
     rootConnector.securityOperations().createLocalUser("testUser", testToken);


Mime
View raw message