hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [1/3] HBASE-11068 Update code to use Admin factory method instead of constructor
Date Mon, 04 Aug 2014 18:42:48 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 757b13dea -> e91e2659a


http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestGzipFilter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestGzipFilter.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestGzipFilter.java
index 23da0ec..8f8e62e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestGzipFilter.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestGzipFilter.java
@@ -34,6 +34,7 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
@@ -50,7 +51,7 @@ import org.junit.experimental.categories.Category;
 
 @Category(MediumTests.class)
 public class TestGzipFilter {
-  private static final String TABLE = "TestGzipFilter";
+  private static final TableName TABLE = TableName.valueOf("TestGzipFilter");
   private static final String CFA = "a";
   private static final String COLUMN_1 = CFA + ":1";
   private static final String COLUMN_2 = CFA + ":2";
@@ -68,11 +69,11 @@ public class TestGzipFilter {
     REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
     client = new Client(new Cluster().add("localhost",
       REST_TEST_UTIL.getServletPort()));
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     if (admin.tableExists(TABLE)) {
       return;
     }
-    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE));
+    HTableDescriptor htd = new HTableDescriptor(TABLE);
     htd.addFamily(new HColumnDescriptor(CFA));
     admin.createTable(htd);
   }

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
index 0c999b8..64dc02f 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestMultiRowResource.java
@@ -21,6 +21,7 @@ package org.apache.hadoop.hbase.rest;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.*;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.rest.client.Client;
 import org.apache.hadoop.hbase.rest.client.Cluster;
@@ -49,7 +50,7 @@ import static org.junit.Assert.assertEquals;
 @Category(MediumTests.class)
 public class TestMultiRowResource {
 
-  private static final String TABLE = "TestRowResource";
+  private static final TableName TABLE = TableName.valueOf("TestRowResource");
   private static final String CFA = "a";
   private static final String CFB = "b";
   private static final String COLUMN_1 = CFA + ":1";
@@ -82,11 +83,11 @@ public class TestMultiRowResource {
     marshaller = context.createMarshaller();
     unmarshaller = context.createUnmarshaller();
     client = new Client(new Cluster().add("localhost", REST_TEST_UTIL.getServletPort()));
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     if (admin.tableExists(TABLE)) {
       return;
     }
-    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE));
+    HTableDescriptor htd = new HTableDescriptor(TABLE);
     htd.addFamily(new HColumnDescriptor(CFA));
     htd.addFamily(new HColumnDescriptor(CFB));
     admin.createTable(htd);

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannerResource.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannerResource.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannerResource.java
index 84aa994..a13280e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannerResource.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannerResource.java
@@ -33,6 +33,7 @@ import javax.xml.bind.Unmarshaller;
 import org.apache.commons.httpclient.Header;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.*;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
@@ -55,7 +56,7 @@ import org.junit.experimental.categories.Category;
 
 @Category(MediumTests.class)
 public class TestScannerResource {
-  private static final String TABLE = "TestScannerResource";
+  private static final TableName TABLE = TableName.valueOf("TestScannerResource");
   private static final String NONEXISTENT_TABLE = "ThisTableDoesNotExist";
   private static final String CFA = "a";
   private static final String CFB = "b";
@@ -73,7 +74,7 @@ public class TestScannerResource {
   private static int expectedRows2;
   private static Configuration conf;
 
-  static int insertData(Configuration conf, String tableName, String column, double prob)
+  static int insertData(Configuration conf, TableName tableName, String column, double prob)
       throws IOException {
     Random rng = new Random();
     int count = 0;
@@ -163,11 +164,11 @@ public class TestScannerResource {
       ScannerModel.class);
     marshaller = context.createMarshaller();
     unmarshaller = context.createUnmarshaller();
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     if (admin.tableExists(TABLE)) {
       return;
     }
-    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE));
+    HTableDescriptor htd = new HTableDescriptor(TABLE);
     htd.addFamily(new HColumnDescriptor(CFA));
     htd.addFamily(new HColumnDescriptor(CFB));
     admin.createTable(htd);

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithFilters.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithFilters.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithFilters.java
index 0fc97e8..4634335 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithFilters.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithFilters.java
@@ -33,6 +33,7 @@ import javax.xml.bind.Unmarshaller;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.*;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
@@ -75,7 +76,7 @@ public class TestScannersWithFilters {
 
   private static final Log LOG = LogFactory.getLog(TestScannersWithFilters.class);
 
-  private static final String TABLE = "TestScannersWithFilters";
+  private static final TableName TABLE = TableName.valueOf("TestScannersWithFilters");
 
   private static final byte [][] ROWS_ONE = {
     Bytes.toBytes("testRowOne-0"), Bytes.toBytes("testRowOne-1"),
@@ -128,9 +129,9 @@ public class TestScannersWithFilters {
     unmarshaller = context.createUnmarshaller();
     client = new Client(new Cluster().add("localhost", 
       REST_TEST_UTIL.getServletPort()));
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     if (!admin.tableExists(TABLE)) {
-      HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE));
+      HTableDescriptor htd = new HTableDescriptor(TABLE);
       htd.addFamily(new HColumnDescriptor(FAMILIES[0]));
       htd.addFamily(new HColumnDescriptor(FAMILIES[1]));
       admin.createTable(htd);

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithLabels.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithLabels.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithLabels.java
index e6845f7..edf31b8 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithLabels.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestScannersWithLabels.java
@@ -38,6 +38,7 @@ import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.KeyValue;
 import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Durability;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
@@ -66,7 +67,7 @@ import org.junit.experimental.categories.Category;
 
 @Category(MediumTests.class)
 public class TestScannersWithLabels {
-  private static final String TABLE = "TestScannersWithLabels";
+  private static final TableName TABLE = TableName.valueOf("TestScannersWithLabels");
   private static final String CFA = "a";
   private static final String CFB = "b";
   private static final String COLUMN_1 = CFA + ":1";
@@ -86,7 +87,7 @@ public class TestScannersWithLabels {
   private static Unmarshaller unmarshaller;
   private static Configuration conf;
 
-  private static int insertData(String tableName, String column, double prob) throws IOException {
+  private static int insertData(TableName tableName, String column, double prob) throws IOException {
     Random rng = new Random();
     int count = 0;
     HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName);
@@ -142,11 +143,11 @@ public class TestScannersWithLabels {
         ScannerModel.class);
     marshaller = context.createMarshaller();
     unmarshaller = context.createUnmarshaller();
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     if (admin.tableExists(TABLE)) {
       return;
     }
-    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE));
+    HTableDescriptor htd = new HTableDescriptor(TABLE);
     htd.addFamily(new HColumnDescriptor(CFA));
     htd.addFamily(new HColumnDescriptor(CFB));
     admin.createTable(htd);

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestSchemaResource.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestSchemaResource.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestSchemaResource.java
index ac3dfdb..36cd193 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestSchemaResource.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestSchemaResource.java
@@ -29,6 +29,8 @@ import javax.xml.bind.JAXBException;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.MediumTests;
+import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.rest.client.Client;
 import org.apache.hadoop.hbase.rest.client.Cluster;
@@ -95,8 +97,8 @@ public class TestSchemaResource {
     TableSchemaModel model;
     Response response;
 
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
-    assertFalse(admin.tableExists(TABLE1));
+    Admin admin = TEST_UTIL.getHBaseAdmin();
+    assertFalse(admin.tableExists(TableName.valueOf(TABLE1)));
 
     // create the table
     model = testTableSchemaModel.buildTestModel(TABLE1);
@@ -133,7 +135,7 @@ public class TestSchemaResource {
     // delete the table and make sure HBase concurs
     response = client.delete(schemaPath);
     assertEquals(response.getCode(), 200);
-    assertFalse(admin.tableExists(TABLE1));
+    assertFalse(admin.tableExists(TableName.valueOf(TABLE1)));
   }
 
   @Test
@@ -142,8 +144,8 @@ public class TestSchemaResource {
     TableSchemaModel model;
     Response response;
 
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
-    assertFalse(admin.tableExists(TABLE2));
+    Admin admin = TEST_UTIL.getHBaseAdmin();
+    assertFalse(admin.tableExists(TableName.valueOf(TABLE2)));
 
     // create the table
     model = testTableSchemaModel.buildTestModel(TABLE2);
@@ -184,7 +186,7 @@ public class TestSchemaResource {
     // delete the table and make sure HBase concurs
     response = client.delete(schemaPath);
     assertEquals(response.getCode(), 200);
-    assertFalse(admin.tableExists(TABLE2));
+    assertFalse(admin.tableExists(TableName.valueOf(TABLE2)));
   }
 
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java
index aac2ab7..25b62b8 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableResource.java
@@ -31,6 +31,7 @@ import javax.xml.bind.JAXBException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.*;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
@@ -56,7 +57,7 @@ import org.junit.experimental.categories.Category;
 public class TestTableResource {
   private static final Log LOG = LogFactory.getLog(TestTableResource.class);
 
-  private static String TABLE = "TestTableResource";
+  private static TableName TABLE = TableName.valueOf("TestTableResource");
   private static String COLUMN_FAMILY = "test";
   private static String COLUMN = COLUMN_FAMILY + ":qualifier";
   private static Map<HRegionInfo, ServerName> regionMap;
@@ -78,11 +79,11 @@ public class TestTableResource {
         TableInfoModel.class,
         TableListModel.class,
         TableRegionModel.class);
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     if (admin.tableExists(TABLE)) {
       return;
     }
-    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE));
+    HTableDescriptor htd = new HTableDescriptor(TABLE);
     htd.addFamily(new HColumnDescriptor(COLUMN_FAMILY));
     admin.createTable(htd);
     HTable table = new HTable(TEST_UTIL.getConfiguration(), TABLE);
@@ -106,7 +107,7 @@ public class TestTableResource {
     Map<HRegionInfo, ServerName> m = table.getRegionLocations();
     assertEquals(m.size(), 1);
     // tell the master to split the table
-    admin.split(TABLE);
+    admin.split(TABLE.toBytes());
     // give some time for the split to happen
 
     long timeout = System.currentTimeMillis() + (15 * 1000);
@@ -139,7 +140,7 @@ public class TestTableResource {
     assertTrue(tables.hasNext());
     while (tables.hasNext()) {
       TableModel table = tables.next();
-      if (table.getName().equals(TABLE)) {
+      if (table.getName().equals(TABLE.getNameAsString())) {
         found = true;
         break;
       }
@@ -148,7 +149,7 @@ public class TestTableResource {
   }
 
   void checkTableInfo(TableInfoModel model) {
-    assertEquals(model.getName(), TABLE);
+    assertEquals(model.getName(), TABLE.getNameAsString());
     Iterator<TableRegionModel> regions = model.getRegions().iterator();
     assertTrue(regions.hasNext());
     while (regions.hasNext()) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java
index 8d09edb..749b8ea 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/TestTableScan.java
@@ -48,6 +48,7 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.filter.Filter;
 import org.apache.hadoop.hbase.filter.ParseFilter;
@@ -74,7 +75,7 @@ import org.xml.sax.XMLReader;
 @Category(MediumTests.class)
 public class TestTableScan {
 
-  private static final String TABLE = "TestScanResource";
+  private static final TableName TABLE = TableName.valueOf("TestScanResource");
   private static final String CFA = "a";
   private static final String CFB = "b";
   private static final String COLUMN_1 = CFA + ":1";
@@ -96,9 +97,9 @@ public class TestTableScan {
     REST_TEST_UTIL.startServletContainer(conf);
     client = new Client(new Cluster().add("localhost",
       REST_TEST_UTIL.getServletPort()));
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     if (!admin.tableExists(TABLE)) {
-    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE));
+    HTableDescriptor htd = new HTableDescriptor(TABLE);
     htd.addFamily(new HColumnDescriptor(CFA));
     htd.addFamily(new HColumnDescriptor(CFB));
     admin.createTable(htd);

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java
index 76fb800..120604e 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/client/TestRemoteTable.java
@@ -39,6 +39,7 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
@@ -58,7 +59,7 @@ import org.junit.experimental.categories.Category;
 
 @Category(MediumTests.class)
 public class TestRemoteTable {
-  private static final String TABLE = "TestRemoteTable";
+  private static final TableName TABLE = TableName.valueOf("TestRemoteTable");
   private static final byte[] ROW_1 = Bytes.toBytes("testrow1");
   private static final byte[] ROW_2 = Bytes.toBytes("testrow2");
   private static final byte[] ROW_3 = Bytes.toBytes("testrow3");
@@ -88,12 +89,12 @@ public class TestRemoteTable {
 
   @Before
   public void before() throws Exception  {
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     if (admin.tableExists(TABLE)) {
       if (admin.isTableEnabled(TABLE)) admin.disableTable(TABLE);
       admin.deleteTable(TABLE);
     }
-    HTableDescriptor htd = new HTableDescriptor(TableName.valueOf(TABLE));
+    HTableDescriptor htd = new HTableDescriptor(TABLE);
     htd.addFamily(new HColumnDescriptor(COLUMN_1).setMaxVersions(3));
     htd.addFamily(new HColumnDescriptor(COLUMN_2).setMaxVersions(3));
     htd.addFamily(new HColumnDescriptor(COLUMN_3).setMaxVersions(3));
@@ -116,7 +117,7 @@ public class TestRemoteTable {
     remoteTable = new RemoteHTable(
       new Client(new Cluster().add("localhost", 
           REST_TEST_UTIL.getServletPort())),
-        TEST_UTIL.getConfiguration(), TABLE);
+        TEST_UTIL.getConfiguration(), TABLE.toBytes());
   }
   
   @After

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
index cf50310..6458a55 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestAccessController.java
@@ -49,10 +49,13 @@ import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.TableNotFoundException;
 import org.apache.hadoop.hbase.Tag;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Append;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
+import org.apache.hadoop.hbase.client.HConnection;
+import org.apache.hadoop.hbase.client.HConnectionManager;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Increment;
 import org.apache.hadoop.hbase.client.Put;
@@ -205,7 +208,7 @@ public class TestAccessController extends SecureTestUtil {
   @Before
   public void setUp() throws Exception {
     // Create the test table (owner added to the _acl_ table)
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     HTableDescriptor htd = new HTableDescriptor(TEST_TABLE.getTableName());
     HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY);
     hcd.setMaxVersions(100);
@@ -911,7 +914,7 @@ public class TestAccessController extends SecureTestUtil {
 
       HTable table = new HTable(conf, tableName);
       try {
-        HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
+        Admin admin = TEST_UTIL.getHBaseAdmin();
         TEST_UTIL.waitTableEnabled(admin, tableName.getName());
         LoadIncrementalHFiles loader = new LoadIncrementalHFiles(conf);
         loader.doBulkLoad(loadPath, table);
@@ -1031,7 +1034,7 @@ public class TestAccessController extends SecureTestUtil {
     final byte[] qualifier = Bytes.toBytes("q");
 
     // create table
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     if (admin.tableExists(tableName)) {
       admin.disableTable(tableName);
       admin.deleteTable(tableName);
@@ -1305,7 +1308,7 @@ public class TestAccessController extends SecureTestUtil {
     final byte[] qualifier = Bytes.toBytes("q");
 
     // create table
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     if (admin.tableExists(tableName)) {
       admin.disableTable(tableName);
       admin.deleteTable(tableName);
@@ -1419,7 +1422,7 @@ public class TestAccessController extends SecureTestUtil {
     final byte[] qualifier = Bytes.toBytes("q");
 
     // create table
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     if (admin.tableExists(tableName)) {
       admin.disableTable(tableName);
       admin.deleteTable(tableName);
@@ -1884,7 +1887,7 @@ public class TestAccessController extends SecureTestUtil {
       Permission.Action.ADMIN, Permission.Action.CREATE, Permission.Action.READ,
         Permission.Action.WRITE);
 
-    final HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    final Admin admin = TEST_UTIL.getHBaseAdmin();
     HTableDescriptor htd = new HTableDescriptor(TEST_TABLE2);
     htd.addFamily(new HColumnDescriptor(TEST_FAMILY));
     admin.createTable(htd);
@@ -1955,7 +1958,7 @@ public class TestAccessController extends SecureTestUtil {
     AccessTestAction listTablesAction = new AccessTestAction() {
       @Override
       public Object run() throws Exception {
-        HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
+        Admin admin = TEST_UTIL.getHBaseAdmin();
         try {
           admin.listTables();
         } finally {
@@ -1968,7 +1971,7 @@ public class TestAccessController extends SecureTestUtil {
     AccessTestAction getTableDescAction = new AccessTestAction() {
       @Override
       public Object run() throws Exception {
-        HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
+        Admin admin = TEST_UTIL.getHBaseAdmin();
         try {
           admin.getTableDescriptor(TEST_TABLE.getTableName());
         } finally {
@@ -1997,12 +2000,14 @@ public class TestAccessController extends SecureTestUtil {
     AccessTestAction deleteTableAction = new AccessTestAction() {
       @Override
       public Object run() throws Exception {
-        HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
+        HConnection unmanagedConnection = HConnectionManager.createConnection(TEST_UTIL.getConfiguration());
+        Admin admin = unmanagedConnection.getAdmin();
         try {
           admin.disableTable(TEST_TABLE.getTableName());
           admin.deleteTable(TEST_TABLE.getTableName());
         } finally {
           admin.close();
+          unmanagedConnection.close();
         }
         return null;
       }

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java
index f01c1b9..e3ea397 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLWithMultipleVersions.java
@@ -33,6 +33,7 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.TableNotFoundException;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
@@ -123,7 +124,7 @@ public class TestCellACLWithMultipleVersions extends SecureTestUtil {
   @Before
   public void setUp() throws Exception {
     // Create the test table (owner added to the _acl_ table)
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     HTableDescriptor htd = new HTableDescriptor(TEST_TABLE.getTableName());
     HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY1);
     hcd.setMaxVersions(4);

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java
index 16454c8..555986c 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestCellACLs.java
@@ -31,6 +31,7 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.TableNotFoundException;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
@@ -124,7 +125,7 @@ public class TestCellACLs extends SecureTestUtil {
   @Before
   public void setUp() throws Exception {
     // Create the test table (owner added to the _acl_ table)
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     HTableDescriptor htd = new HTableDescriptor(TEST_TABLE.getTableName());
     HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY);
     hcd.setMaxVersions(4);

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestScanEarlyTermination.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestScanEarlyTermination.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestScanEarlyTermination.java
index ab19142..0a1397b 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestScanEarlyTermination.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestScanEarlyTermination.java
@@ -30,6 +30,7 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.TableNotFoundException;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
@@ -111,7 +112,7 @@ public class TestScanEarlyTermination extends SecureTestUtil {
 
   @Before
   public void setUp() throws Exception {
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     HTableDescriptor htd = new HTableDescriptor(TEST_TABLE.getTableName());
     htd.setOwner(USER_OWNER);
     HColumnDescriptor hcd = new HColumnDescriptor(TEST_FAMILY1);

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestTablePermissions.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestTablePermissions.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestTablePermissions.java
index 1d98143..b81bf4f 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestTablePermissions.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/access/TestTablePermissions.java
@@ -39,6 +39,7 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Abortable;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.exceptions.DeserializationException;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.LargeTests;
@@ -292,7 +293,7 @@ public class TestTablePermissions {
         .add(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes("v1")));
     table.put(new Put(Bytes.toBytes("row2"))
         .add(TEST_FAMILY, TEST_QUALIFIER, Bytes.toBytes("v2")));
-    HBaseAdmin admin = UTIL.getHBaseAdmin();
+    Admin admin = UTIL.getHBaseAdmin();
     admin.split(TEST_TABLE.getName());
 
     // wait for split

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java
index d5aa8a9..84ecf6a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabels.java
@@ -41,6 +41,7 @@ import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Append;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
@@ -725,7 +726,7 @@ public class TestVisibilityLabels {
 
   @Test
   public void testUserShouldNotDoDDLOpOnLabelsTable() throws Exception {
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     try {
       admin.disableTable(LABELS_TABLE_NAME);
       fail("Lables table should not get disabled by user.");

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
index f6df81d..95db8d7 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDeletes.java
@@ -36,6 +36,7 @@ import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
@@ -518,7 +519,7 @@ public class TestVisibilityLabelsWithDeletes {
     TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
     HTable table = null;
     try {
-      HBaseAdmin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
       HColumnDescriptor colDesc = new HColumnDescriptor(fam);
       colDesc.setMaxVersions(5);
       HTableDescriptor desc = new HTableDescriptor(tableName);
@@ -600,7 +601,7 @@ public class TestVisibilityLabelsWithDeletes {
     TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
     HTable table = null;
     try {
-      HBaseAdmin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
       HColumnDescriptor colDesc = new HColumnDescriptor(fam);
       colDesc.setMaxVersions(5);
       HTableDescriptor desc = new HTableDescriptor(tableName);
@@ -682,7 +683,7 @@ public class TestVisibilityLabelsWithDeletes {
     TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
     HTable table = null;
     try {
-      HBaseAdmin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
       HColumnDescriptor colDesc = new HColumnDescriptor(fam);
       colDesc.setMaxVersions(5);
       HTableDescriptor desc = new HTableDescriptor(tableName);
@@ -738,7 +739,7 @@ public class TestVisibilityLabelsWithDeletes {
     TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
     HTable table = null;
     try {
-      HBaseAdmin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
       HColumnDescriptor colDesc = new HColumnDescriptor(fam);
       colDesc.setMaxVersions(5);
       HTableDescriptor desc = new HTableDescriptor(tableName);
@@ -927,7 +928,7 @@ public class TestVisibilityLabelsWithDeletes {
   private HTable doPuts(TableName tableName) throws IOException, InterruptedIOException,
       RetriesExhaustedWithDetailsException, InterruptedException {
     HTable table;
-    HBaseAdmin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+    Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
     HColumnDescriptor colDesc = new HColumnDescriptor(fam);
     colDesc.setMaxVersions(5);
     HTableDescriptor desc = new HTableDescriptor(tableName);
@@ -969,7 +970,7 @@ public class TestVisibilityLabelsWithDeletes {
   private HTable doPutsWithDiffCols(TableName tableName) throws IOException,
       InterruptedIOException, RetriesExhaustedWithDetailsException, InterruptedException {
     HTable table;
-    HBaseAdmin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+    Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
     HColumnDescriptor colDesc = new HColumnDescriptor(fam);
     colDesc.setMaxVersions(5);
     HTableDescriptor desc = new HTableDescriptor(tableName);
@@ -1004,7 +1005,7 @@ public class TestVisibilityLabelsWithDeletes {
   private HTable doPutsWithoutVisibility(TableName tableName) throws IOException,
       InterruptedIOException, RetriesExhaustedWithDetailsException, InterruptedException {
     HTable table;
-    HBaseAdmin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+    Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
     HColumnDescriptor colDesc = new HColumnDescriptor(fam);
     colDesc.setMaxVersions(5);
     HTableDescriptor desc = new HTableDescriptor(tableName);
@@ -1454,7 +1455,7 @@ public class TestVisibilityLabelsWithDeletes {
     TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
     HTable table = null;
     try {
-      HBaseAdmin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
       HColumnDescriptor colDesc = new HColumnDescriptor(fam);
       colDesc.setMaxVersions(5);
       HTableDescriptor desc = new HTableDescriptor(tableName);
@@ -1507,7 +1508,7 @@ public class TestVisibilityLabelsWithDeletes {
     TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
     HTable table = null;
     try {
-      HBaseAdmin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
       HColumnDescriptor colDesc = new HColumnDescriptor(fam);
       colDesc.setMaxVersions(5);
       HTableDescriptor desc = new HTableDescriptor(tableName);
@@ -2916,7 +2917,7 @@ public class TestVisibilityLabelsWithDeletes {
     TableName tableName = TableName.valueOf(TEST_NAME.getMethodName());
     HTable table = null;
     try {
-      HBaseAdmin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
+      Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
       HColumnDescriptor colDesc = new HColumnDescriptor(fam);
       colDesc.setMaxVersions(5);
       HTableDescriptor desc = new HTableDescriptor(tableName);

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
index 2f75ea6..35b961c 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/SnapshotTestingUtils.java
@@ -44,6 +44,7 @@ import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.TableNotEnabledException;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Durability;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
@@ -84,7 +85,7 @@ public class SnapshotTestingUtils {
    * @throws IOException
    *           if the admin operation fails
    */
-  public static void assertNoSnapshots(HBaseAdmin admin) throws IOException {
+  public static void assertNoSnapshots(Admin admin) throws IOException {
     assertEquals("Have some previous snapshots", 0, admin.listSnapshots()
         .size());
   }
@@ -94,7 +95,7 @@ public class SnapshotTestingUtils {
    * name and table match the passed in parameters.
    */
   public static List<SnapshotDescription> assertExistsMatchingSnapshot(
-      HBaseAdmin admin, String snapshotName, TableName tableName)
+      Admin admin, String snapshotName, TableName tableName)
       throws IOException {
     // list the snapshot
     List<SnapshotDescription> snapshots = admin.listSnapshots();
@@ -114,7 +115,7 @@ public class SnapshotTestingUtils {
   /**
    * Make sure that there is only one snapshot returned from the master
    */
-  public static void assertOneSnapshotThatMatches(HBaseAdmin admin,
+  public static void assertOneSnapshotThatMatches(Admin admin,
       SnapshotDescription snapshot) throws IOException {
     assertOneSnapshotThatMatches(admin, snapshot.getName(),
         TableName.valueOf(snapshot.getTable()));
@@ -125,7 +126,7 @@ public class SnapshotTestingUtils {
    * name and table match the passed in parameters.
    */
   public static List<SnapshotDescription> assertOneSnapshotThatMatches(
-      HBaseAdmin admin, String snapshotName, TableName tableName)
+      Admin admin, String snapshotName, TableName tableName)
       throws IOException {
     // list the snapshot
     List<SnapshotDescription> snapshots = admin.listSnapshots();
@@ -142,7 +143,7 @@ public class SnapshotTestingUtils {
    * name and table match the passed in parameters.
    */
   public static List<SnapshotDescription> assertOneSnapshotThatMatches(
-      HBaseAdmin admin, byte[] snapshot, TableName tableName) throws IOException {
+      Admin admin, byte[] snapshot, TableName tableName) throws IOException {
     return assertOneSnapshotThatMatches(admin, Bytes.toString(snapshot),
         tableName);
   }
@@ -153,7 +154,7 @@ public class SnapshotTestingUtils {
    */
   public static void confirmSnapshotValid(
       SnapshotDescription snapshotDescriptor, TableName tableName,
-      byte[] testFamily, Path rootDir, HBaseAdmin admin, FileSystem fs)
+      byte[] testFamily, Path rootDir, Admin admin, FileSystem fs)
       throws IOException {
     ArrayList nonEmptyTestFamilies = new ArrayList(1);
     nonEmptyTestFamilies.add(testFamily);
@@ -166,7 +167,7 @@ public class SnapshotTestingUtils {
    */
   public static void confirmEmptySnapshotValid(
       SnapshotDescription snapshotDescriptor, TableName tableName,
-      byte[] testFamily, Path rootDir, HBaseAdmin admin, FileSystem fs)
+      byte[] testFamily, Path rootDir, Admin admin, FileSystem fs)
       throws IOException {
     ArrayList emptyTestFamilies = new ArrayList(1);
     emptyTestFamilies.add(testFamily);
@@ -183,7 +184,7 @@ public class SnapshotTestingUtils {
   public static void confirmSnapshotValid(
       SnapshotDescription snapshotDescriptor, TableName tableName,
       List<byte[]> nonEmptyTestFamilies, List<byte[]> emptyTestFamilies,
-      Path rootDir, HBaseAdmin admin, FileSystem fs) throws IOException {
+      Path rootDir, Admin admin, FileSystem fs) throws IOException {
     final Configuration conf = admin.getConfiguration();
 
     // check snapshot dir
@@ -265,14 +266,14 @@ public class SnapshotTestingUtils {
    * Take snapshot with maximum of numTries attempts, ignoring CorruptedSnapshotException
    * except for the last CorruptedSnapshotException
    */
-  public static void snapshot(HBaseAdmin admin,
+  public static void snapshot(Admin admin,
       final String snapshotName, final String tableName,
       SnapshotDescription.Type type, int numTries) throws IOException {
     int tries = 0;
     CorruptedSnapshotException lastEx = null;
     while (tries++ < numTries) {
       try {
-        admin.snapshot(snapshotName, tableName, type);
+        admin.snapshot(snapshotName, TableName.valueOf(tableName), type);
         return;
       } catch (CorruptedSnapshotException cse) {
         LOG.warn("Got CorruptedSnapshotException", cse);
@@ -282,12 +283,12 @@ public class SnapshotTestingUtils {
     throw lastEx;
   }
 
-  public static void cleanupSnapshot(HBaseAdmin admin, byte[] tableName)
+  public static void cleanupSnapshot(Admin admin, byte[] tableName)
       throws IOException {
     SnapshotTestingUtils.cleanupSnapshot(admin, Bytes.toString(tableName));
   }
 
-  public static void cleanupSnapshot(HBaseAdmin admin, String snapshotName)
+  public static void cleanupSnapshot(Admin admin, String snapshotName)
       throws IOException {
     // delete the taken snapshot
     admin.deleteSnapshot(snapshotName);
@@ -356,7 +357,7 @@ public class SnapshotTestingUtils {
    * not empty. Note that this will leave the table disabled
    * in the case of an offline snapshot.
    */
-  public static void createSnapshotAndValidate(HBaseAdmin admin,
+  public static void createSnapshotAndValidate(Admin admin,
       TableName tableName, String familyName, String snapshotNameString,
       Path rootDir, FileSystem fs, boolean onlineSnapshot)
       throws Exception {
@@ -370,7 +371,7 @@ public class SnapshotTestingUtils {
    * Take a snapshot of the specified table and verify the given families.
    * Note that this will leave the table disabled in the case of an offline snapshot.
    */
-  public static void createSnapshotAndValidate(HBaseAdmin admin,
+  public static void createSnapshotAndValidate(Admin admin,
       TableName tableName, List<byte[]> nonEmptyFamilyNames, List<byte[]> emptyFamilyNames,
       String snapshotNameString, Path rootDir, FileSystem fs, boolean onlineSnapshot)
         throws Exception {
@@ -702,7 +703,7 @@ public class SnapshotTestingUtils {
     table.put(put);
   }
 
-  public static void deleteAllSnapshots(final HBaseAdmin admin)
+  public static void deleteAllSnapshots(final Admin admin)
       throws IOException {
     // Delete all the snapshots
     for (SnapshotDescription snapshot: admin.listSnapshots()) {
@@ -729,7 +730,7 @@ public class SnapshotTestingUtils {
     }
   }
 
-  public static void verifyReplicasCameOnline(TableName tableName, HBaseAdmin admin,
+  public static void verifyReplicasCameOnline(TableName tableName, Admin admin,
       int regionReplication) throws IOException {
     List<HRegionInfo> regions = admin.getTableRegions(tableName);
     HashSet<HRegionInfo> set = new HashSet<HRegionInfo>();

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
index c4fc0a9..e4e2719 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestExportSnapshot.java
@@ -43,6 +43,7 @@ import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.MediumTests;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
@@ -77,7 +78,7 @@ public class TestExportSnapshot {
   private byte[] snapshotName;
   private int tableNumFiles;
   private TableName tableName;
-  private HBaseAdmin admin;
+  private Admin admin;
 
   public static void setUpBaseConf(Configuration conf) {
     conf.setBoolean(SnapshotManager.HBASE_SNAPSHOT_ENABLED, true);

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java
index fd69d62..be12cc5 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestFlushSnapshotFromClient.java
@@ -43,6 +43,7 @@ import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.LargeTests;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.TableNotFoundException;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.ScannerCallable;
@@ -77,11 +78,9 @@ public class TestFlushSnapshotFromClient {
   private static final Log LOG = LogFactory.getLog(TestFlushSnapshotFromClient.class);
   private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
   private static final int NUM_RS = 2;
-  private static final String STRING_TABLE_NAME = "test";
   private static final byte[] TEST_FAM = Bytes.toBytes("fam");
   private static final byte[] TEST_QUAL = Bytes.toBytes("q");
-  private static final TableName TABLE_NAME =
-      TableName.valueOf(STRING_TABLE_NAME);
+  private static final TableName TABLE_NAME = TableName.valueOf("test");
   private final int DEFAULT_NUM_ROWS = 100;
 
   /**
@@ -142,7 +141,7 @@ public class TestFlushSnapshotFromClient {
    */
   @Test (timeout=300000)
   public void testFlushTableSnapshot() throws Exception {
-    HBaseAdmin admin = UTIL.getHBaseAdmin();
+    Admin admin = UTIL.getHBaseAdmin();
     // make sure we don't fail on listing snapshots
     SnapshotTestingUtils.assertNoSnapshots(admin);
 
@@ -157,7 +156,7 @@ public class TestFlushSnapshotFromClient {
     // take a snapshot of the enabled table
     String snapshotString = "offlineTableSnapshot";
     byte[] snapshot = Bytes.toBytes(snapshotString);
-    admin.snapshot(snapshotString, STRING_TABLE_NAME, SnapshotDescription.Type.FLUSH);
+    admin.snapshot(snapshotString, TABLE_NAME, SnapshotDescription.Type.FLUSH);
     LOG.debug("Snapshot completed.");
 
     // make sure we have the snapshot
@@ -181,7 +180,7 @@ public class TestFlushSnapshotFromClient {
    */
   @Test(timeout=30000)
   public void testSkipFlushTableSnapshot() throws Exception {
-    HBaseAdmin admin = UTIL.getHBaseAdmin();
+    Admin admin = UTIL.getHBaseAdmin();
     // make sure we don't fail on listing snapshots
     SnapshotTestingUtils.assertNoSnapshots(admin);
 
@@ -196,7 +195,7 @@ public class TestFlushSnapshotFromClient {
     // take a snapshot of the enabled table
     String snapshotString = "skipFlushTableSnapshot";
     byte[] snapshot = Bytes.toBytes(snapshotString);
-    admin.snapshot(snapshotString, STRING_TABLE_NAME, SnapshotDescription.Type.SKIPFLUSH);
+    admin.snapshot(snapshotString, TABLE_NAME, SnapshotDescription.Type.SKIPFLUSH);
     LOG.debug("Snapshot completed.");
 
     // make sure we have the snapshot
@@ -225,7 +224,7 @@ public class TestFlushSnapshotFromClient {
    */
   @Test (timeout=300000)
   public void testFlushTableSnapshotWithProcedure() throws Exception {
-    HBaseAdmin admin = UTIL.getHBaseAdmin();
+    Admin admin = UTIL.getHBaseAdmin();
     // make sure we don't fail on listing snapshots
     SnapshotTestingUtils.assertNoSnapshots(admin);
 
@@ -241,7 +240,7 @@ public class TestFlushSnapshotFromClient {
     String snapshotString = "offlineTableSnapshot";
     byte[] snapshot = Bytes.toBytes(snapshotString);
     Map<String, String> props = new HashMap<String, String>();
-    props.put("table", STRING_TABLE_NAME);
+    props.put("table", TABLE_NAME.getNameAsString());
     admin.execProcedure(SnapshotManager.ONLINE_SNAPSHOT_CONTROLLER_DESCRIPTION,
         snapshotString, props);
 
@@ -265,19 +264,19 @@ public class TestFlushSnapshotFromClient {
 
   @Test (timeout=300000)
   public void testSnapshotFailsOnNonExistantTable() throws Exception {
-    HBaseAdmin admin = UTIL.getHBaseAdmin();
+    Admin admin = UTIL.getHBaseAdmin();
     // make sure we don't fail on listing snapshots
     SnapshotTestingUtils.assertNoSnapshots(admin);
-    String tableName = "_not_a_table";
+    TableName tableName = TableName.valueOf("_not_a_table");
 
     // make sure the table doesn't exist
     boolean fail = false;
     do {
     try {
-      admin.getTableDescriptor(Bytes.toBytes(tableName));
+      admin.getTableDescriptor(tableName);
       fail = true;
       LOG.error("Table:" + tableName + " already exists, checking a new name");
-      tableName = tableName+"!";
+      tableName = TableName.valueOf(tableName+"!");
     } catch (TableNotFoundException e) {
       fail = false;
       }
@@ -294,7 +293,7 @@ public class TestFlushSnapshotFromClient {
 
   @Test(timeout = 300000)
   public void testAsyncFlushSnapshot() throws Exception {
-    HBaseAdmin admin = UTIL.getHBaseAdmin();
+    Admin admin = UTIL.getHBaseAdmin();
     SnapshotDescription snapshot = SnapshotDescription.newBuilder().setName("asyncSnapshot")
         .setTable(TABLE_NAME.getNameAsString())
         .setType(SnapshotDescription.Type.FLUSH)
@@ -316,7 +315,7 @@ public class TestFlushSnapshotFromClient {
   @Test (timeout=300000)
   public void testSnapshotStateAfterMerge() throws Exception {
     int numRows = DEFAULT_NUM_ROWS;
-    HBaseAdmin admin = UTIL.getHBaseAdmin();
+    Admin admin = UTIL.getHBaseAdmin();
     // make sure we don't fail on listing snapshots
     SnapshotTestingUtils.assertNoSnapshots(admin);
     // load the table so we have some data
@@ -324,12 +323,12 @@ public class TestFlushSnapshotFromClient {
 
     // Take a snapshot
     String snapshotBeforeMergeName = "snapshotBeforeMerge";
-    admin.snapshot(snapshotBeforeMergeName, STRING_TABLE_NAME, SnapshotDescription.Type.FLUSH);
+    admin.snapshot(snapshotBeforeMergeName, TABLE_NAME, SnapshotDescription.Type.FLUSH);
 
     // Clone the table
-    String cloneBeforeMergeName = "cloneBeforeMerge";
+    TableName cloneBeforeMergeName = TableName.valueOf("cloneBeforeMerge");
     admin.cloneSnapshot(snapshotBeforeMergeName, cloneBeforeMergeName);
-    SnapshotTestingUtils.waitForTableToBeOnline(UTIL, TableName.valueOf(cloneBeforeMergeName));
+    SnapshotTestingUtils.waitForTableToBeOnline(UTIL, cloneBeforeMergeName);
 
     // Merge two regions
     List<HRegionInfo> regions = admin.getTableRegions(TABLE_NAME);
@@ -351,13 +350,13 @@ public class TestFlushSnapshotFromClient {
     assertEquals(numRegionsAfterMerge, admin.getTableRegions(TABLE_NAME).size());
 
     // Clone the table
-    String cloneAfterMergeName = "cloneAfterMerge";
+    TableName cloneAfterMergeName = TableName.valueOf("cloneAfterMerge");
     admin.cloneSnapshot(snapshotBeforeMergeName, cloneAfterMergeName);
-    SnapshotTestingUtils.waitForTableToBeOnline(UTIL, TableName.valueOf(cloneAfterMergeName));
+    SnapshotTestingUtils.waitForTableToBeOnline(UTIL, cloneAfterMergeName);
 
     SnapshotTestingUtils.verifyRowCount(UTIL, TABLE_NAME, numRows);
-    SnapshotTestingUtils.verifyRowCount(UTIL, TableName.valueOf(cloneBeforeMergeName), numRows);
-    SnapshotTestingUtils.verifyRowCount(UTIL, TableName.valueOf(cloneAfterMergeName), numRows);
+    SnapshotTestingUtils.verifyRowCount(UTIL, cloneBeforeMergeName, numRows);
+    SnapshotTestingUtils.verifyRowCount(UTIL, cloneAfterMergeName, numRows);
 
     // test that we can delete the snapshot
     UTIL.deleteTable(cloneAfterMergeName);
@@ -367,7 +366,7 @@ public class TestFlushSnapshotFromClient {
   @Test (timeout=300000)
   public void testTakeSnapshotAfterMerge() throws Exception {
     int numRows = DEFAULT_NUM_ROWS;
-    HBaseAdmin admin = UTIL.getHBaseAdmin();
+    Admin admin = UTIL.getHBaseAdmin();
     // make sure we don't fail on listing snapshots
     SnapshotTestingUtils.assertNoSnapshots(admin);
     // load the table so we have some data
@@ -393,16 +392,16 @@ public class TestFlushSnapshotFromClient {
 
     // Take a snapshot
     String snapshotName = "snapshotAfterMerge";
-    SnapshotTestingUtils.snapshot(admin, snapshotName, STRING_TABLE_NAME,
+    SnapshotTestingUtils.snapshot(admin, snapshotName, TABLE_NAME.getNameAsString(),
       SnapshotDescription.Type.FLUSH, 3);
 
     // Clone the table
-    String cloneName = "cloneMerge";
+    TableName cloneName = TableName.valueOf("cloneMerge");
     admin.cloneSnapshot(snapshotName, cloneName);
-    SnapshotTestingUtils.waitForTableToBeOnline(UTIL, TableName.valueOf(cloneName));
+    SnapshotTestingUtils.waitForTableToBeOnline(UTIL, cloneName);
 
     SnapshotTestingUtils.verifyRowCount(UTIL, TABLE_NAME, numRows);
-    SnapshotTestingUtils.verifyRowCount(UTIL, TableName.valueOf(cloneName), numRows);
+    SnapshotTestingUtils.verifyRowCount(UTIL, cloneName, numRows);
 
     // test that we can delete the snapshot
     UTIL.deleteTable(cloneName);
@@ -414,7 +413,7 @@ public class TestFlushSnapshotFromClient {
   @Test (timeout=300000)
   public void testFlushCreateListDestroy() throws Exception {
     LOG.debug("------- Starting Snapshot test -------------");
-    HBaseAdmin admin = UTIL.getHBaseAdmin();
+    Admin admin = UTIL.getHBaseAdmin();
     // make sure we don't fail on listing snapshots
     SnapshotTestingUtils.assertNoSnapshots(admin);
     // load the table so we have some data
@@ -423,8 +422,7 @@ public class TestFlushSnapshotFromClient {
     String snapshotName = "flushSnapshotCreateListDestroy";
     FileSystem fs = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getFileSystem();
     Path rootDir = UTIL.getHBaseCluster().getMaster().getMasterFileSystem().getRootDir();
-    SnapshotTestingUtils.createSnapshotAndValidate(admin,
-      TableName.valueOf(STRING_TABLE_NAME), Bytes.toString(TEST_FAM),
+    SnapshotTestingUtils.createSnapshotAndValidate(admin, TABLE_NAME, Bytes.toString(TEST_FAM),
       snapshotName, rootDir, fs, true);
   }
 
@@ -435,12 +433,10 @@ public class TestFlushSnapshotFromClient {
    */
   @Test(timeout=300000)
   public void testConcurrentSnapshottingAttempts() throws IOException, InterruptedException {
-    final String STRING_TABLE2_NAME = STRING_TABLE_NAME + "2";
-    final TableName TABLE2_NAME =
-        TableName.valueOf(STRING_TABLE2_NAME);
+    final TableName TABLE2_NAME = TableName.valueOf(TABLE_NAME + "2");
 
     int ssNum = 20;
-    HBaseAdmin admin = UTIL.getHBaseAdmin();
+    Admin admin = UTIL.getHBaseAdmin();
     // make sure we don't fail on listing snapshots
     SnapshotTestingUtils.assertNoSnapshots(admin);
     // create second testing table
@@ -460,7 +456,7 @@ public class TestFlushSnapshotFromClient {
       @Override
       public void run() {
         try {
-          HBaseAdmin admin = UTIL.getHBaseAdmin();
+          Admin admin = UTIL.getHBaseAdmin();
           LOG.info("Submitting snapshot request: " + ClientSnapshotDescriptionUtils.toString(ss));
           admin.takeSnapshotAsync(ss);
         } catch (Exception e) {
@@ -541,7 +537,7 @@ public class TestFlushSnapshotFromClient {
 
   private void waitRegionsAfterMerge(final long numRegionsAfterMerge)
       throws IOException, InterruptedException {
-    HBaseAdmin admin = UTIL.getHBaseAdmin();
+    Admin admin = UTIL.getHBaseAdmin();
     // Verify that there's one region less
     long startTime = System.currentTimeMillis();
     while (admin.getTableRegions(TABLE_NAME).size() != numRegionsAfterMerge) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestRestoreFlushSnapshotFromClient.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestRestoreFlushSnapshotFromClient.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestRestoreFlushSnapshotFromClient.java
index 0ce15b6..08ac6de 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestRestoreFlushSnapshotFromClient.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/snapshot/TestRestoreFlushSnapshotFromClient.java
@@ -25,6 +25,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.LargeTests;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.master.MasterFileSystem;
@@ -60,7 +61,7 @@ public class TestRestoreFlushSnapshotFromClient {
   private int snapshot0Rows;
   private int snapshot1Rows;
   private TableName tableName;
-  private HBaseAdmin admin;
+  private Admin admin;
 
   @BeforeClass
   public static void setUpBeforeClass() throws Exception {
@@ -162,7 +163,7 @@ public class TestRestoreFlushSnapshotFromClient {
   @Test(expected=SnapshotDoesNotExistException.class)
   public void testCloneNonExistentSnapshot() throws IOException, InterruptedException {
     String snapshotName = "random-snapshot-" + System.currentTimeMillis();
-    String tableName = "random-table-" + System.currentTimeMillis();
+    TableName tableName = TableName.valueOf("random-table-" + System.currentTimeMillis());
     admin.cloneSnapshot(snapshotName, tableName);
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
index 3926442..fc4c3d0 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsck.java
@@ -62,6 +62,7 @@ import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.MetaTableAccessor;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.Durability;
 import org.apache.hadoop.hbase.client.Get;
@@ -261,7 +262,7 @@ public class TestHBaseFsck {
    * This method is used to undeploy a region -- close it and attempt to
    * remove its state from the Master.
    */
-  private void undeployRegion(HBaseAdmin admin, ServerName sn,
+  private void undeployRegion(Admin admin, ServerName sn,
       HRegionInfo hri) throws IOException, InterruptedException {
     try {
       HBaseFsckRepair.closeRegionSilentlyAndWait(admin, sn, hri);
@@ -482,7 +483,7 @@ public class TestHBaseFsck {
     Path tableinfo = null;
     try {
       setupTable(table);
-      HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+      Admin admin = TEST_UTIL.getHBaseAdmin();
 
       Path hbaseTableDir = FSUtils.getTableDir(
           FSUtils.getRootDir(conf), table);
@@ -585,8 +586,7 @@ public class TestHBaseFsck {
   /**
    * Get region info from local cluster.
    */
-  Map<ServerName, List<String>> getDeployedHRIs(
-      final HBaseAdmin admin) throws IOException {
+  Map<ServerName, List<String>> getDeployedHRIs(final Admin admin) throws IOException {
     ClusterStatus status = admin.getClusterStatus();
     Collection<ServerName> regionServers = status.getServers();
     Map<ServerName, List<String>> mm =
@@ -645,7 +645,7 @@ public class TestHBaseFsck {
       // different regions with the same start/endkeys since it doesn't
       // differentiate on ts/regionId!  We actually need to recheck
       // deployments!
-      HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+      Admin admin = TEST_UTIL.getHBaseAdmin();
       while (findDeployedHSI(getDeployedHRIs(admin), hriDupe) == null) {
         Thread.sleep(250);
       }
@@ -803,7 +803,7 @@ public class TestHBaseFsck {
             }
           }
 
-          HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+          Admin admin = TEST_UTIL.getHBaseAdmin();
           HBaseFsckRepair.closeRegionSilentlyAndWait(admin,
             cluster.getRegionServer(k).getServerName(), hbi.getHdfsHRI());
           admin.offline(regionName);
@@ -1388,7 +1388,7 @@ public class TestHBaseFsck {
       HRegionInfo hri = location.getRegionInfo();
 
       // do a regular split
-      HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+      Admin admin = TEST_UTIL.getHBaseAdmin();
       byte[] regionName = location.getRegionInfo().getRegionName();
       admin.split(location.getRegionInfo().getRegionName(), Bytes.toBytes("BM"));
       TestEndToEndSplitTransaction.blockUntilRegionSplit(
@@ -1438,7 +1438,7 @@ public class TestHBaseFsck {
       HRegionInfo hri = location.getRegionInfo();
 
       // do a regular split
-      HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+      Admin admin = TEST_UTIL.getHBaseAdmin();
       byte[] regionName = location.getRegionInfo().getRegionName();
       admin.split(location.getRegionInfo().getRegionName(), Bytes.toBytes("BM"));
       TestEndToEndSplitTransaction.blockUntilRegionSplit(
@@ -1831,7 +1831,7 @@ public class TestHBaseFsck {
       assertEquals(hfcc.getMissing().size(), missing);
 
       // its been fixed, verify that we can enable
-      HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+      Admin admin = TEST_UTIL.getHBaseAdmin();
       admin.enableTableAsync(table);
       while (!admin.isTableEnabled(table)) {
         try {
@@ -2211,7 +2211,14 @@ public class TestHBaseFsck {
     HRegionInfo hri = metaLocation.getRegionInfo();
     if (unassign) {
       LOG.info("Undeploying meta region " + hri + " from server " + hsa);
-      undeployRegion(new HBaseAdmin(conf), hsa, hri);
+      HConnection unmanagedConnection = HConnectionManager.createConnection(conf);
+      Admin admin = unmanagedConnection.getAdmin();
+      try {
+        undeployRegion(admin, hsa, hri);
+      } finally {
+        admin.close();
+        unmanagedConnection.close();
+      }
     }
 
     if (regionInfoOnly) {
@@ -2291,7 +2298,7 @@ public class TestHBaseFsck {
       assertNotEquals(region1, region2);
 
       // do a region merge
-      HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+      Admin admin = TEST_UTIL.getHBaseAdmin();
       admin.mergeRegions(region1.getEncodedNameAsBytes(),
           region2.getEncodedNameAsBytes(), false);
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/e91e2659/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java
index 6d08267..b6785b2 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/OfflineMetaRebuildTestCore.java
@@ -40,6 +40,7 @@ import org.apache.hadoop.hbase.LargeTests;
 import org.apache.hadoop.hbase.NamespaceDescriptor;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.MetaTableAccessor;
+import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Delete;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HConnectionManager;
@@ -227,7 +228,7 @@ public class OfflineMetaRebuildTestCore {
 
   protected void wipeOutMeta() throws IOException {
     // Mess it up by blowing up meta.
-    HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     Scan s = new Scan();
     HTable meta = new HTable(conf, TableName.META_TABLE_NAME);
     ResultScanner scanner = meta.getScanner(s);


Mime
View raw message