Repository: hbase
Updated Branches:
  refs/heads/master 645fbd7d8 -> 9246af8da


http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelReplicationWithExpAsString.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelReplicationWithExpAsString.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelReplicationWithExpAsString.java
index 33583de..01e22da 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelReplicationWithExpAsString.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelReplicationWithExpAsString.java
@@ -38,10 +38,13 @@ import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.Tag;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.client.replication.ReplicationAdmin;
 import org.apache.hadoop.hbase.codec.KeyValueCodecWithTags;
 import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
@@ -137,7 +140,7 @@ public class TestVisibilityLabelReplicationWithExpAsString 
extends TestVisibilit
     TEST_UTIL.waitTableEnabled(LABELS_TABLE_NAME.getName(), 50000);
     TEST_UTIL1.startMiniCluster(1);
     HBaseAdmin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
-    HTableDescriptor table = new 
HTableDescriptor(TableName.valueOf(TABLE_NAME));
+    HTableDescriptor table = new HTableDescriptor(TABLE_NAME);
     HColumnDescriptor desc = new HColumnDescriptor(fam);
     desc.setScope(HConstants.REPLICATION_SCOPE_GLOBAL);
     table.addFamily(desc);
@@ -171,11 +174,13 @@ public class 
TestVisibilityLabelReplicationWithExpAsString extends TestVisibilit
       final boolean nullExpected, final String... auths) throws IOException,
       InterruptedException {
     PrivilegedExceptionAction<Void> scanAction = new 
PrivilegedExceptionAction<Void>() {
-      HTable table2 = null;
+      Table table2 = null;
 
       public Void run() throws Exception {
+        Connection connection = null;
         try {
-          table2 = new HTable(conf1, TABLE_NAME_BYTES);
+          connection = ConnectionFactory.createConnection(conf1);
+          table2 = connection.getTable(TABLE_NAME);
           CellScanner cellScanner;
           Cell current;
           Get get = new Get(row);
@@ -205,6 +210,9 @@ public class TestVisibilityLabelReplicationWithExpAsString 
extends TestVisibilit
           if (table2 != null) {
             table2.close();
           }
+          if(connection != null){
+            connection.close();
+          }
         }
       }
     };

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/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 455d632..dcd5fbb 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
@@ -42,6 +42,8 @@ import org.apache.hadoop.hbase.HTableDescriptor;
 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.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Increment;
@@ -378,7 +380,7 @@ public abstract class TestVisibilityLabels {
     t.join();
     Table table = null;
     try {
-      table = new HTable(TEST_UTIL.getConfiguration(), tableName);
+      table = TEST_UTIL.getConnection().getTable(tableName);
       Scan s = new Scan();
       s.setAuthorizations(new Authorizations(SECRET));
       ResultScanner scanner = table.getScanner(s);
@@ -472,7 +474,7 @@ public abstract class TestVisibilityLabels {
     SUPERUSER.runAs(action);
     Table ht = null;
     try {
-      ht = new HTable(conf, LABELS_TABLE_NAME);
+      ht = TEST_UTIL.getConnection().getTable(LABELS_TABLE_NAME);
       Scan scan = new Scan();
       scan.setAuthorizations(new Authorizations(VisibilityUtils.SYSTEM_LABEL));
       ResultScanner scanner = ht.getScanner(scan);
@@ -581,9 +583,11 @@ public abstract class TestVisibilityLabels {
                 
"org.apache.hadoop.hbase.security.visibility.InvalidLabelException: "
                     + "Label 'public' is not set for the user testUser"));
         assertTrue(resultList.get(2).getException().getValue().isEmpty());
+        Connection connection = null;
         Table ht = null;
         try {
-          ht = new HTable(conf, LABELS_TABLE_NAME);
+          connection = ConnectionFactory.createConnection(conf);
+          ht = connection.getTable(LABELS_TABLE_NAME);
           ResultScanner scanner = ht.getScanner(new Scan());
           Result result = null;
           List<Result> results = new ArrayList<Result>();
@@ -597,6 +601,9 @@ public abstract class TestVisibilityLabels {
           if (ht != null) {
             ht.close();
           }
+          if (connection != null){
+            connection.close();
+          }
         }
 
         GetAuthsResponse authsResponse = null;
@@ -774,7 +781,7 @@ public abstract class TestVisibilityLabels {
     TEST_UTIL.getHBaseAdmin().createTable(desc);
     Table table = null;
     try {
-      table = new HTable(TEST_UTIL.getConfiguration(), tableName);
+      table = TEST_UTIL.getConnection().getTable(tableName);
       Put put = new Put(r1);
       put.add(fam, qual, 3l, v1);
       put.add(fam, qual2, 3l, v1);
@@ -862,7 +869,7 @@ public abstract class TestVisibilityLabels {
     HColumnDescriptor col = new HColumnDescriptor(fam);
     desc.addFamily(col);
     TEST_UTIL.getHBaseAdmin().createTable(desc);
-    Table table = new HTable(TEST_UTIL.getConfiguration(), tableName);
+    Table table = TEST_UTIL.getConnection().getTable(tableName);
     try {
       Put p1 = new Put(row1);
       p1.add(fam, qual, value);

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java
index 899e63d..9ea64d1 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsReplication.java
@@ -45,6 +45,8 @@ import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.Tag;
 import org.apache.hadoop.hbase.TagRewriteCell;
 import org.apache.hadoop.hbase.TagType;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.client.Durability;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
@@ -85,8 +87,7 @@ public class TestVisibilityLabelsReplication {
   protected static final String TEMP = "temp";
   protected static Configuration conf;
   protected static Configuration conf1;
-  protected static String TABLE_NAME = "TABLE_NAME";
-  protected static byte[] TABLE_NAME_BYTES = Bytes.toBytes(TABLE_NAME);
+  protected static TableName TABLE_NAME = TableName.valueOf("TABLE_NAME");
   protected static ReplicationAdmin replicationAdmin;
   public static final String TOPSECRET = "topsecret";
   public static final String PUBLIC = "public";
@@ -187,7 +188,7 @@ public class TestVisibilityLabelsReplication {
     TEST_UTIL.waitTableEnabled(LABELS_TABLE_NAME.getName(), 50000);
     TEST_UTIL1.startMiniCluster(1);
     HBaseAdmin hBaseAdmin = TEST_UTIL.getHBaseAdmin();
-    HTableDescriptor table = new 
HTableDescriptor(TableName.valueOf(TABLE_NAME));
+    HTableDescriptor table = new HTableDescriptor(TABLE_NAME);
     HColumnDescriptor desc = new HColumnDescriptor(fam);
     desc.setScope(HConstants.REPLICATION_SCOPE_GLOBAL);
     table.addFamily(desc);
@@ -218,8 +219,7 @@ public class TestVisibilityLabelsReplication {
 
   @Test
   public void testVisibilityReplication() throws Exception {
-    TableName tableName = TableName.valueOf(TABLE_NAME);
-    Table table = writeData(tableName, "(" + SECRET + "&" + PUBLIC + ")" + 
"|(" + CONFIDENTIAL
+    Table table = writeData(TABLE_NAME, "(" + SECRET + "&" + PUBLIC + ")" + 
"|(" + CONFIDENTIAL
         + ")&(" + TOPSECRET + ")", "(" + PRIVATE + "|" + CONFIDENTIAL + ")&(" 
+ PUBLIC + "|"
         + TOPSECRET + ")", "(" + SECRET + "|" + CONFIDENTIAL + ")" + "&" + "!" 
+ TOPSECRET,
         CellVisibility.quote(UNICODE_VIS_TAG) + "&" + SECRET);
@@ -252,9 +252,9 @@ public class TestVisibilityLabelsReplication {
       current = cellScanner.current();
       assertTrue(Bytes.equals(current.getRowArray(), current.getRowOffset(),
           current.getRowLength(), row4, 0, row4.length));
-      HTable table2 = null;
+      Table table2 = null;
       try {
-        table2 = new HTable(TEST_UTIL1.getConfiguration(), TABLE_NAME_BYTES);
+        table2 = TEST_UTIL1.getConnection().getTable(TABLE_NAME);
         s = new Scan();
         // Ensure both rows are replicated
         scanner = table2.getScanner(s);
@@ -314,11 +314,13 @@ public class TestVisibilityLabelsReplication {
       final boolean nullExpected, final String... auths) throws IOException,
       InterruptedException {
     PrivilegedExceptionAction<Void> scanAction = new 
PrivilegedExceptionAction<Void>() {
-      HTable table2 = null;
+      Table table2 = null;
+      Connection connection = null;
 
       public Void run() throws Exception {
         try {
-          table2 = new HTable(conf1, TABLE_NAME_BYTES);
+          connection = ConnectionFactory.createConnection(conf1);
+          table2 = connection.getTable(TABLE_NAME);
           CellScanner cellScanner;
           Cell current;
           Get get = new Get(row);
@@ -356,6 +358,9 @@ public class TestVisibilityLabelsReplication {
           if (table2 != null) {
             table2.close();
           }
+          if(connection != null) {
+            connection.close();
+          }
         }
       }
     };
@@ -394,9 +399,9 @@ public class TestVisibilityLabelsReplication {
   }
 
   static Table writeData(TableName tableName, String... labelExps) throws 
Exception {
-    HTable table = null;
+    Table table = null;
     try {
-      table = new HTable(conf, TABLE_NAME_BYTES);
+      table = TEST_UTIL.getConnection().getTable(TABLE_NAME);
       int i = 1;
       List<Put> puts = new ArrayList<Put>();
       for (String labelExp : labelExps) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithACL.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithACL.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithACL.java
index d4f5d67..7e7d8a3 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithACL.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithACL.java
@@ -31,6 +31,8 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
@@ -124,7 +126,8 @@ public class TestVisibilityLabelsWithACL {
       public Void run() throws Exception {
         Scan s = new Scan();
         s.setAuthorizations(new Authorizations(SECRET, CONFIDENTIAL));
-        Table t = new HTable(conf, table.getName());
+        Connection connection = ConnectionFactory.createConnection(conf);
+        Table t = connection.getTable(table.getName());
         try {
           ResultScanner scanner = t.getScanner(s);
           Result result = scanner.next();
@@ -134,6 +137,7 @@ public class TestVisibilityLabelsWithACL {
           assertNull(result);
         } finally {
           t.close();
+          connection.close();
         }
         return null;
       }
@@ -153,7 +157,7 @@ public class TestVisibilityLabelsWithACL {
       public Void run() throws Exception {
         Scan s = new Scan();
         s.setAuthorizations(new Authorizations(SECRET, CONFIDENTIAL));
-        Table t = new HTable(conf, table.getName());
+        Table t = TEST_UTIL.getConnection().getTable(table.getName());
         try {
           ResultScanner scanner = t.getScanner(s);
           Result[] result = scanner.next(5);
@@ -179,7 +183,7 @@ public class TestVisibilityLabelsWithACL {
       public Void run() throws Exception {
         Get g = new Get(row1);
         g.setAuthorizations(new Authorizations(SECRET, CONFIDENTIAL));
-        Table t = new HTable(conf, table.getName());
+        Table t = TEST_UTIL.getConnection().getTable(table.getName());
         try {
           Result result = t.get(g);
           assertTrue(!result.isEmpty());
@@ -208,12 +212,14 @@ public class TestVisibilityLabelsWithACL {
       public Void run() throws Exception {
         Get g = new Get(row1);
         g.setAuthorizations(new Authorizations(SECRET, CONFIDENTIAL));
-        Table t = new HTable(conf, table.getName());
+        Connection connection = ConnectionFactory.createConnection(conf);
+        Table t = connection.getTable(table.getName());
         try {
           Result result = t.get(g);
           assertTrue(result.isEmpty());
         } finally {
           t.close();
+          connection.close();
         }
         return null;
       }

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java
index dcfed5f..52f86c3 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityLabelsWithDefaultVisLabelService.java
@@ -150,7 +150,7 @@ public class TestVisibilityLabelsWithDefaultVisLabelService 
extends TestVisibili
     // Scan the visibility label
     Scan s = new Scan();
     s.setAuthorizations(new Authorizations(VisibilityUtils.SYSTEM_LABEL));
-    Table ht = new HTable(conf, LABELS_TABLE_NAME);
+    Table ht = TEST_UTIL.getConnection().getTable(LABELS_TABLE_NAME);
     int i = 0;
     try {
       ResultScanner scanner = ht.getScanner(s);

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/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 6029c8b..b2d0ae5 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
@@ -17,17 +17,6 @@
  */
 package org.apache.hadoop.hbase.security.visibility;
 
-import static 
org.apache.hadoop.hbase.security.visibility.VisibilityConstants.LABELS_TABLE_NAME;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.security.PrivilegedExceptionAction;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellScanner;
@@ -38,7 +27,6 @@ import org.apache.hadoop.hbase.HTableDescriptor;
 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.HTable;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
@@ -58,6 +46,17 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.TestName;
 
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import static 
org.apache.hadoop.hbase.security.visibility.VisibilityConstants.LABELS_TABLE_NAME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
 /**
  * Tests visibility labels with deletes
  */
@@ -119,7 +118,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(TOPSECRET + "&" + SECRET));
             d.addColumns(fam, qual);
@@ -161,7 +160,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row2);
             d.setCellVisibility(new CellVisibility(TOPSECRET + "|" + 
CONFIDENTIAL));
             d.addFamily(fam);
@@ -203,7 +202,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(TOPSECRET + "|" + 
CONFIDENTIAL));
             d.deleteFamilyVersion(fam, 123l);
@@ -245,7 +244,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(TOPSECRET + "|" + 
CONFIDENTIAL));
             d.addColumn(fam, qual, 123l);
@@ -285,7 +284,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + 
CONFIDENTIAL + ")|(" +
                 SECRET + "&" + TOPSECRET+")"));
@@ -340,7 +339,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d1 = new Delete(row1);
             d1.setCellVisibility(new CellVisibility(CONFIDENTIAL));
             d1.addColumns(fam, qual);
@@ -389,7 +388,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
             d.addColumns(fam, qual);
@@ -441,7 +440,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d1 = new Delete(row1);
             d1.setCellVisibility(new CellVisibility(CONFIDENTIAL));
             d1.addFamily(fam);
@@ -487,7 +486,7 @@ public class TestVisibilityLabelsWithDeletes {
     HTableDescriptor desc = new HTableDescriptor(tableName);
     desc.addFamily(colDesc);
     hBaseAdmin.createTable(desc);
-    try (Table table = new HTable(conf, tableName)) {
+    try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
       Put put = new Put(Bytes.toBytes("row1"));
       put.add(fam, qual, value);
       put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
@@ -500,7 +499,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
             d.addFamily(fam);
@@ -525,7 +524,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET));
             d.addFamily(fam);
@@ -561,7 +560,7 @@ public class TestVisibilityLabelsWithDeletes {
     HTableDescriptor desc = new HTableDescriptor(tableName);
     desc.addFamily(colDesc);
     hBaseAdmin.createTable(desc);
-    try (Table table = new HTable(conf, tableName)) {
+    try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
       Put put = new Put(Bytes.toBytes("row1"));
       put.add(fam, qual, value);
       put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
@@ -574,7 +573,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
             d.addColumns(fam, qual);
@@ -599,7 +598,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET));
             d.addColumns(fam, qual);
@@ -635,7 +634,7 @@ public class TestVisibilityLabelsWithDeletes {
     HTableDescriptor desc = new HTableDescriptor(tableName);
     desc.addFamily(colDesc);
     hBaseAdmin.createTable(desc);
-    try (Table table = new HTable(conf, tableName)) {
+    try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
       Put put = new Put(Bytes.toBytes("row1"));
       put.add(fam, qual, 123l, value);
       put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
@@ -647,7 +646,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET));
             d.addColumns(fam, qual, 126l);
@@ -656,7 +655,7 @@ public class TestVisibilityLabelsWithDeletes {
             throw new IOException(t);
           }
 
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
             d.addColumn(fam, qual, 123l);
@@ -687,7 +686,7 @@ public class TestVisibilityLabelsWithDeletes {
     desc.addFamily(colDesc);
     hBaseAdmin.createTable(desc);
 
-    try (Table table = new HTable(conf, tableName)) {
+    try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
       Put put1 = new Put(Bytes.toBytes("row1"));
       put1.add(fam, qual, 123l, value);
       put1.setCellVisibility(new CellVisibility(CONFIDENTIAL));
@@ -708,14 +707,14 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
             d.addColumn(fam, qual, 123l);
             table.delete(d);
           }
 
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET));
             d.addColumn(fam, qual, 123l);
@@ -760,7 +759,7 @@ public class TestVisibilityLabelsWithDeletes {
               + SECRET + "&" + TOPSECRET + ")"));
           d3.addFamily(fam);
 
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             table.delete(createList(d1, d2, d3));
           } catch (Throwable t) {
             throw new IOException(t);
@@ -804,7 +803,7 @@ public class TestVisibilityLabelsWithDeletes {
           Delete d2 = new Delete(row1);
           d2.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
           d2.addColumns(fam, qual);
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             table.delete(createList(d1, d2));
           } catch (Throwable t) {
             throw new IOException(t);
@@ -894,7 +893,7 @@ public class TestVisibilityLabelsWithDeletes {
         + "&" + SECRET + ")"));
     puts.add(put);
 
-    Table table = new HTable(conf, tableName);
+    Table table = TEST_UTIL.getConnection().getTable(tableName);
     table.put(puts);
     return table;
   }
@@ -936,7 +935,7 @@ public class TestVisibilityLabelsWithDeletes {
         + TOPSECRET + "&" + SECRET+")"));
     puts.add(put);
 
-    Table table = new HTable(conf, tableName);
+    Table table = TEST_UTIL.getConnection().getTable(tableName);
     table.put(puts);
     return table;
   }
@@ -970,7 +969,7 @@ public class TestVisibilityLabelsWithDeletes {
     put.add(fam, qual, 127l, value);
     puts.add(put);
 
-    Table table = new HTable(conf, tableName);
+    Table table = TEST_UTIL.getConnection().getTable(tableName);
     table.put(puts);
 
     TEST_UTIL.getHBaseAdmin().flush(tableName);
@@ -993,7 +992,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + 
CONFIDENTIAL + ")|(" +
                 SECRET + "&" + TOPSECRET+")"));
@@ -1057,7 +1056,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
             d.addColumn(fam, qual);
@@ -1121,7 +1120,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET ));
             d.addColumn(fam, qual);
@@ -1209,7 +1208,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
             d.addColumn(fam, qual);
@@ -1280,7 +1279,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
             d.addFamily(fam);
@@ -1337,7 +1336,7 @@ public class TestVisibilityLabelsWithDeletes {
           Delete d = new Delete(row1);
           d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
           d.addColumns(fam, qual, 125l);
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             table.delete(d);
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1395,7 +1394,7 @@ public class TestVisibilityLabelsWithDeletes {
     HTableDescriptor desc = new HTableDescriptor(tableName);
     desc.addFamily(colDesc);
     hBaseAdmin.createTable(desc);
-    try (Table table = new HTable(conf, tableName)) {
+    try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
       Put put = new Put(Bytes.toBytes("row1"));
       put.add(fam, qual1, 125l, value);
       put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
@@ -1416,7 +1415,7 @@ public class TestVisibilityLabelsWithDeletes {
           d2.setCellVisibility(new CellVisibility(CONFIDENTIAL));
           d2.addColumns(fam, qual1, 125l);
 
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             table.delete(createList(d1, d2));
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1442,7 +1441,7 @@ public class TestVisibilityLabelsWithDeletes {
     HTableDescriptor desc = new HTableDescriptor(tableName);
     desc.addFamily(colDesc);
     hBaseAdmin.createTable(desc);
-    try (Table table = new HTable(conf, tableName)) {
+    try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
       Put put = new Put(Bytes.toBytes("row1"));
       put.add(fam, qual1, 125l, value);
       put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
@@ -1463,7 +1462,7 @@ public class TestVisibilityLabelsWithDeletes {
           d2.setCellVisibility(new CellVisibility(CONFIDENTIAL));
           d2.addColumns(fam, qual1, 126l);
 
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             table.delete(createList(d1, d2));
           } catch (Throwable t) {
             throw new IOException(t);
@@ -1491,7 +1490,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.addFamily(fam);
             table.delete(d);
@@ -1534,7 +1533,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
             d.addFamily(fam);
@@ -1602,7 +1601,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + 
CONFIDENTIAL + ")|("
                 + SECRET + "&" + TOPSECRET + ")"));
@@ -1662,7 +1661,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + 
CONFIDENTIAL + ")|(" +
                 SECRET + "&" + TOPSECRET+")"));
@@ -1720,7 +1719,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + 
CONFIDENTIAL + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
@@ -1771,7 +1770,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + 
PRIVATE + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
@@ -1834,7 +1833,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
             d.deleteFamilyVersion(fam, 123l);
@@ -1885,7 +1884,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + 
PRIVATE + ")|("
                 + TOPSECRET + "&" + SECRET + ")"));
@@ -1930,7 +1929,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
             d.addFamily(fam);
@@ -1982,7 +1981,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + 
PRIVATE + ")|("
                 + TOPSECRET + "&" + SECRET + ")"));
@@ -2028,7 +2027,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(CONFIDENTIAL));
             d.addFamily(fam);
@@ -2068,7 +2067,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
             d.addColumn(fam, qual, 125l);
@@ -2118,7 +2117,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + 
PRIVATE + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
@@ -2173,7 +2172,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + 
PRIVATE + ")" +
                 "|(" + TOPSECRET + "&" + SECRET + ")"));
@@ -2224,7 +2223,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
             d.addColumn(fam, qual, 127l);
@@ -2286,7 +2285,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + 
CONFIDENTIAL + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
@@ -2342,7 +2341,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + 
PRIVATE + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
@@ -2406,7 +2405,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET));
             d.addColumn(fam, qual, 125l);
@@ -2456,7 +2455,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + 
PRIVATE + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
@@ -2524,7 +2523,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + 
CONFIDENTIAL + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
@@ -2575,7 +2574,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + 
PRIVATE + ")|("
                 + TOPSECRET + "&" + SECRET+")"));
@@ -2627,7 +2626,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.addColumn(fam, qual, 125l);
             table.delete(d);
@@ -2650,7 +2649,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.addColumns(fam, qual, 125l);
             table.delete(d);
@@ -2674,7 +2673,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.addFamily(fam, 125l);
             table.delete(d);
@@ -2698,7 +2697,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.addFamily(fam);
             table.delete(d);
@@ -2722,7 +2721,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.addColumns(fam, qual);
             table.delete(d);
@@ -2746,7 +2745,7 @@ public class TestVisibilityLabelsWithDeletes {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.deleteFamilyVersion(fam, 126l);
             table.delete(d);
@@ -2813,7 +2812,7 @@ public class TestVisibilityLabelsWithDeletes {
     HTableDescriptor desc = new HTableDescriptor(tableName);
     desc.addFamily(colDesc);
     hBaseAdmin.createTable(desc);
-    try (Table table = new HTable(conf, tableName)) {
+    try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
       Put put = new Put(Bytes.toBytes("row1"));
       put.add(fam, qual, 123l, value);
       put.setCellVisibility(new CellVisibility(CONFIDENTIAL));
@@ -2826,7 +2825,7 @@ public class TestVisibilityLabelsWithDeletes {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
-          try (Table table = new HTable(conf, tableName)) {
+          try (Table table = TEST_UTIL.getConnection().getTable(tableName)) {
             Delete d = new Delete(row1);
             d.addColumn(fam, qual, 124l);
             d.setCellVisibility(new CellVisibility(PRIVATE ));

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityWithCheckAuths.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityWithCheckAuths.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityWithCheckAuths.java
index 828c89b..457d2eb 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityWithCheckAuths.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/security/visibility/TestVisibilityWithCheckAuths.java
@@ -31,6 +31,8 @@ import org.apache.hadoop.hbase.HTableDescriptor;
 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.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Put;
 import org.apache.hadoop.hbase.client.Table;
@@ -135,7 +137,7 @@ public class TestVisibilityWithCheckAuths {
         public Void run() throws Exception {
           Table table = null;
           try {
-            table = new HTable(conf, tableName);
+            table = TEST_UTIL.getConnection().getTable(tableName);
             Put p = new Put(row1);
             p.setCellVisibility(new CellVisibility(PUBLIC + "&" + TOPSECRET));
             p.add(fam, qual, 125l, value);
@@ -179,15 +181,17 @@ public class TestVisibilityWithCheckAuths {
       PrivilegedExceptionAction<Void> actiona = new 
PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
+          Connection connection = ConnectionFactory.createConnection(conf);
           Table table = null;
           try {
-            table = new HTable(conf, tableName);
+            table = connection.getTable(tableName);
             Put put = new Put(row1);
             put.add(fam, qual, HConstants.LATEST_TIMESTAMP, val);
             put.setCellVisibility(new CellVisibility(TOPSECRET));
             table.put(put);
           } finally {
             table.close();
+            connection.close();
           }
           return null;
         }
@@ -196,14 +200,16 @@ public class TestVisibilityWithCheckAuths {
       actiona = new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
+          Connection connection = ConnectionFactory.createConnection(conf);
           Table table = null;
           try {
-            table = new HTable(conf, tableName);
+            table = TEST_UTIL.getConnection().getTable(tableName);
             Append append = new Append(row1);
             append.add(fam, qual, Bytes.toBytes("b"));
             table.append(append);
           } finally {
             table.close();
+            connection.close();
           }
           return null;
         }
@@ -213,8 +219,10 @@ public class TestVisibilityWithCheckAuths {
         @Override
         public Void run() throws Exception {
           Table table = null;
+          Connection connection = null;
           try {
-            table = new HTable(conf, tableName);
+            connection = ConnectionFactory.createConnection(conf);
+            table = connection.getTable(tableName);
             Append append = new Append(row1);
             append.add(fam, qual, Bytes.toBytes("c"));
             append.setCellVisibility(new CellVisibility(PUBLIC));
@@ -223,7 +231,12 @@ public class TestVisibilityWithCheckAuths {
           } catch (Throwable t) {
             assertTrue(t.getMessage().contains("AccessDeniedException"));
           } finally {
-            table.close();
+            if (table != null) {
+              table.close();
+            }
+            if (connection != null) {
+              connection.close();
+            }
           }
           return null;
         }

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/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 44f411f..74f358d 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
@@ -673,10 +673,10 @@ public class SnapshotTestingUtils {
 
   public static void loadData(final HBaseTestingUtility util, final TableName 
tableName, int rows,
       byte[]... families) throws IOException, InterruptedException {
-    loadData(util, new HTable(util.getConfiguration(), tableName), rows, 
families);
+    loadData(util, util.getConnection().getTable(tableName), rows, families);
   }
 
-  public static void loadData(final HBaseTestingUtility util, final HTable 
table, int rows,
+  public static void loadData(final HBaseTestingUtility util, final Table 
table, int rows,
       byte[]... families) throws IOException, InterruptedException {
     table.setAutoFlushTo(false);
 
@@ -731,7 +731,7 @@ public class SnapshotTestingUtils {
 
   public static void verifyRowCount(final HBaseTestingUtility util, final 
TableName tableName,
       long expectedRows) throws IOException {
-    Table table = new HTable(util.getConfiguration(), tableName);
+    Table table = util.getConnection().getTable(tableName);
     try {
       assertEquals(expectedRows, util.countRows(table));
     } finally {

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/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 192009b..2774bee 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
@@ -117,7 +117,6 @@ public class TestExportSnapshot {
     admin.snapshot(emptySnapshotName, tableName);
 
     // Add some rows
-    Table table = new HTable(TEST_UTIL.getConfiguration(), tableName);
     SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 50, FAMILY);
     tableNumFiles = admin.getTableRegions(tableName).size();
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/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 b96fab6..3893871 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.TableNotFoundException;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.ScannerCallable;
+import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.ipc.AbstractRpcClient;
 import org.apache.hadoop.hbase.ipc.RpcServer;
 import org.apache.hadoop.hbase.master.HMaster;
@@ -144,7 +145,7 @@ public class TestFlushSnapshotFromClient {
     SnapshotTestingUtils.assertNoSnapshots(admin);
 
     // put some stuff in the table
-    HTable table = new HTable(UTIL.getConfiguration(), TABLE_NAME);
+    Table table = UTIL.getConnection().getTable(TABLE_NAME);
     SnapshotTestingUtils.loadData(UTIL, table, DEFAULT_NUM_ROWS, TEST_FAM);
 
     LOG.debug("FS state before snapshot:");
@@ -183,7 +184,7 @@ public class TestFlushSnapshotFromClient {
     SnapshotTestingUtils.assertNoSnapshots(admin);
 
     // put some stuff in the table
-    HTable table = new HTable(UTIL.getConfiguration(), TABLE_NAME);
+    Table table = UTIL.getConnection().getTable(TABLE_NAME);
     UTIL.loadTable(table, TEST_FAM);
 
     LOG.debug("FS state before snapshot:");
@@ -227,7 +228,7 @@ public class TestFlushSnapshotFromClient {
     SnapshotTestingUtils.assertNoSnapshots(admin);
 
     // put some stuff in the table
-    HTable table = new HTable(UTIL.getConfiguration(), TABLE_NAME);
+    Table table = UTIL.getConnection().getTable(TABLE_NAME);
     SnapshotTestingUtils.loadData(UTIL, table, DEFAULT_NUM_ROWS, TEST_FAM);
 
     LOG.debug("FS state before snapshot:");

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/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 e6bc205..4b36c11 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
@@ -26,6 +26,7 @@ import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.HTable;
+import org.apache.hadoop.hbase.client.Table;
 import org.apache.hadoop.hbase.master.MasterFileSystem;
 import org.apache.hadoop.hbase.master.snapshot.SnapshotManager;
 import 
org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
@@ -102,7 +103,7 @@ public class TestRestoreFlushSnapshotFromClient {
 
     // create Table and disable it
     SnapshotTestingUtils.createTable(UTIL, tableName, FAMILY);
-    HTable table = new HTable(UTIL.getConfiguration(), tableName);
+    Table table = UTIL.getConnection().getTable(tableName);
     SnapshotTestingUtils.loadData(UTIL, table, 500, FAMILY);
     snapshot0Rows = UTIL.countRows(table);
     LOG.info("=== before snapshot with 500 rows");

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReaderWithACL.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReaderWithACL.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReaderWithACL.java
index 8635c11..4af63c1 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReaderWithACL.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedReaderWithACL.java
@@ -101,7 +101,7 @@ public class MultiThreadedReaderWithACL extends 
MultiThreadedReader {
             int specialPermCellInsertionFactor = 
Integer.parseInt(dataGenerator.getArgs()[2]);
             int mod = ((int) keyToRead % userNames.length);
             if (userVsTable.get(userNames[mod]) == null) {
-              localTable = new HTable(conf, tableName);
+              localTable = connection.getTable(tableName);
               userVsTable.put(userNames[mod], localTable);
               result = localTable.get(get);
             } else {

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdaterWithACL.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdaterWithACL.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdaterWithACL.java
index 30d425c..7529727 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdaterWithACL.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedUpdaterWithACL.java
@@ -118,7 +118,7 @@ public class MultiThreadedUpdaterWithACL extends 
MultiThreadedUpdater {
           try {
             int mod = ((int) rowKeyBase % userNames.length);
             if (userVsTable.get(userNames[mod]) == null) {
-              localTable = new HTable(conf, tableName);
+              localTable = connection.getTable(tableName);
               userVsTable.put(userNames[mod], localTable);
               res = localTable.get(get);
             } else {
@@ -227,7 +227,7 @@ public class MultiThreadedUpdaterWithACL extends 
MultiThreadedUpdater {
       public Object run() throws Exception {
         try {
           if (table == null) {
-            table = new HTable(conf, tableName);
+            table = connection.getTable(tableName);
           }
           if (m instanceof Increment) {
             table.increment((Increment) m);

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriterWithACL.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriterWithACL.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriterWithACL.java
index 1476567..f247670 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriterWithACL.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/MultiThreadedWriterWithACL.java
@@ -127,7 +127,7 @@ public class MultiThreadedWriterWithACL extends 
MultiThreadedWriter {
       public Object run() throws Exception {
         try {
           if (table == null) {
-            table = new HTable(conf, tableName);
+            table = connection.getTable(tableName);
           }
           table.put(put);
         } catch (IOException e) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ProcessBasedLocalHBaseCluster.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ProcessBasedLocalHBaseCluster.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ProcessBasedLocalHBaseCluster.java
index be7ec79..9f98624 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ProcessBasedLocalHBaseCluster.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/ProcessBasedLocalHBaseCluster.java
@@ -173,7 +173,7 @@ public class ProcessBasedLocalHBaseCluster {
     int attemptsLeft = 10;
     while (attemptsLeft-- > 0) {
       try {
-        new HTable(conf, TableName.META_TABLE_NAME);
+        testUtil.getConnection().getTable(TableName.META_TABLE_NAME);
       } catch (Exception e) {
         LOG.info("Waiting for HBase to startup. Retries left: " + attemptsLeft,
             e);

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/util/RestartMetaTest.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/RestartMetaTest.java 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/RestartMetaTest.java
index 81b219d..b0a17a9 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/RestartMetaTest.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/RestartMetaTest.java
@@ -24,6 +24,8 @@ import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.hbase.HBaseTestingUtility;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.client.Result;
 import org.apache.hadoop.hbase.client.ResultScanner;
@@ -109,7 +111,9 @@ public class RestartMetaTest extends AbstractHBaseTool {
         " seconds....\n\n");
     Threads.sleep(5 * SLEEP_SEC_AFTER_DATA_LOAD);
 
-    int metaRSPort = HBaseTestingUtility.getMetaRSPort(conf);
+    Connection connection = ConnectionFactory.createConnection(conf);
+
+    int metaRSPort = HBaseTestingUtility.getMetaRSPort(connection);
 
     LOG.debug("Killing hbase:meta region server running on port " + 
metaRSPort);
     hbaseCluster.killRegionServer(metaRSPort);
@@ -121,7 +125,7 @@ public class RestartMetaTest extends AbstractHBaseTool {
 
     LOG.debug("Trying to scan meta");
 
-    Table metaTable = new HTable(conf, TableName.META_TABLE_NAME);
+    Table metaTable = connection.getTable(TableName.META_TABLE_NAME);
     ResultScanner scanner = metaTable.getScanner(new Scan());
     Result result;
     while ((result = scanner.next()) != null) {
@@ -131,6 +135,8 @@ public class RestartMetaTest extends AbstractHBaseTool {
           + Bytes.toStringBinary(result.getFamilyMap(HConstants.CATALOG_FAMILY)
               .get(HConstants.SERVER_QUALIFIER)));
     }
+    metaTable.close();
+    connection.close();
     return 0;
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
index 034d6bc..9a7db90 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestCoprocessorScanPolicy.java
@@ -166,7 +166,7 @@ public class TestCoprocessorScanPolicy {
     .setTimeToLive(1);
     desc.addFamily(hcd);
     TEST_UTIL.getHBaseAdmin().createTable(desc);
-    Table t = new HTable(new Configuration(TEST_UTIL.getConfiguration()), 
tableName);
+    Table t = TEST_UTIL.getConnection().getTable(tableName);
     long now = EnvironmentEdgeManager.currentTime();
     ManualEnvironmentEdge me = new ManualEnvironmentEdge();
     me.setValue(now);

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckEncryption.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckEncryption.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckEncryption.java
index 27de51d..69ffa55 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckEncryption.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestHBaseFsckEncryption.java
@@ -103,7 +103,7 @@ public class TestHBaseFsckEncryption {
   @Test
   public void testFsckWithEncryption() throws Exception {
     // Populate the table with some data
-    Table table = new HTable(conf, htd.getTableName());
+    Table table = TEST_UTIL.getConnection().getTable(htd.getTableName());
     try {
       byte[] values = { 'A', 'B', 'C', 'D' };
       for (int i = 0; i < values.length; i++) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMergeTable.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMergeTable.java 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMergeTable.java
index 89dfbc1..69e5d70 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMergeTable.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMergeTable.java
@@ -31,6 +31,7 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.*;
 import org.apache.hadoop.hbase.client.Admin;
 import org.apache.hadoop.hbase.client.Connection;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HConnectionManager;
 import org.apache.hadoop.hbase.client.Put;
@@ -114,14 +115,15 @@ public class TestMergeTable {
       LOG.info("Starting mini hbase cluster");
       UTIL.startMiniHBaseCluster(1, 1);
       Configuration c = new Configuration(UTIL.getConfiguration());
-      Connection connection = HConnectionManager.getConnection(c);
+      Connection connection = UTIL.getConnection();
 
       List<HRegionInfo> originalTableRegions =
         MetaTableAccessor.getTableRegions(connection, desc.getTableName());
       LOG.info("originalTableRegions size=" + originalTableRegions.size() +
         "; " + originalTableRegions);
-      Admin admin = new HBaseAdmin(c);
+      Admin admin = connection.getAdmin();
       admin.disableTable(desc.getTableName());
+      admin.close();
       HMerge.merge(c, FileSystem.get(c), desc.getTableName());
       List<HRegionInfo> postMergeTableRegions =
         MetaTableAccessor.getTableRegions(connection, desc.getTableName());

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java
index d10ce1e..68d4b37 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestMiniClusterLoadSequential.java
@@ -152,7 +152,7 @@ public class TestMiniClusterLoadSequential {
     LOG.info("Starting load test: dataBlockEncoding=" + dataBlockEncoding +
         ", isMultiPut=" + isMultiPut);
     numKeys = numKeys();
-    Admin admin = new HBaseAdmin(conf);
+    Admin admin = TEST_UTIL.getHBaseAdmin();
     while (admin.getClusterStatus().getServers().size() < NUM_RS) {
       LOG.info("Sleeping until " + NUM_RS + " RSs are online");
       Threads.sleepWithoutInterrupt(1000);

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestProcessBasedCluster.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestProcessBasedCluster.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestProcessBasedCluster.java
index e8d22b8..513d538 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestProcessBasedCluster.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestProcessBasedCluster.java
@@ -62,7 +62,7 @@ public class TestProcessBasedCluster {
           HTestConst.DEFAULT_CF_STR_SET,
           HColumnDescriptor.DEFAULT_VERSIONS, COLS_PER_ROW, FLUSHES, 
NUM_REGIONS,
           ROWS_PER_FLUSH);
-      Table table = new HTable(TEST_UTIL.getConfiguration(), 
HTestConst.DEFAULT_TABLE);
+      Table table = 
TEST_UTIL.getConnection().getTable(HTestConst.DEFAULT_TABLE);
       ResultScanner scanner = table.getScanner(HTestConst.DEFAULT_CF_BYTES);
       Result result;
       int rows = 0;

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java
index 432c4b3..63154a8 100644
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java
+++ 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestRegionSplitter.java
@@ -310,9 +310,8 @@ public class TestRegionSplitter {
     private void verifyBounds(List<byte[]> expectedBounds, TableName tableName)
             throws Exception {
         // Get region boundaries from the cluster and verify their endpoints
-        final Configuration conf = UTIL.getConfiguration();
         final int numRegions = expectedBounds.size()-1;
-        final HTable hTable = new HTable(conf, tableName);
+        final HTable hTable = (HTable) 
UTIL.getConnection().getTable(tableName);
         final Map<HRegionInfo, ServerName> regionInfoMap = 
hTable.getRegionLocations();
         assertEquals(numRegions, regionInfoMap.size());
         for (Map.Entry<HRegionInfo, ServerName> entry: 
regionInfoMap.entrySet()) {

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/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 6c33a9b..349bf56 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
@@ -215,7 +215,7 @@ public class OfflineMetaRebuildTestCore {
 
   protected HRegionInfo createRegion(Configuration conf, final Table htbl,
       byte[] startKey, byte[] endKey) throws IOException {
-    Table meta = new HTable(conf, TableName.META_TABLE_NAME);
+    Table meta = TEST_UTIL.getConnection().getTable(TableName.META_TABLE_NAME);
     HTableDescriptor htd = htbl.getTableDescriptor();
     HRegionInfo hri = new HRegionInfo(htbl.getName(), startKey, endKey);
 
@@ -240,7 +240,7 @@ public class OfflineMetaRebuildTestCore {
     // Mess it up by blowing up meta.
     Admin admin = TEST_UTIL.getHBaseAdmin();
     Scan s = new Scan();
-    Table meta = new HTable(conf, TableName.META_TABLE_NAME);
+    Table meta = TEST_UTIL.getConnection().getTable(TableName.META_TABLE_NAME);
     ResultScanner scanner = meta.getScanner(s);
     List<Delete> dels = new ArrayList<Delete>();
     for (Result r : scanner) {
@@ -266,7 +266,7 @@ public class OfflineMetaRebuildTestCore {
    */
   protected int tableRowCount(Configuration conf, TableName table)
       throws IOException {
-    Table t = new HTable(conf, table);
+    Table t = TEST_UTIL.getConnection().getTable(table);
     Scan st = new Scan();
 
     ResultScanner rst = t.getScanner(st);
@@ -286,9 +286,9 @@ public class OfflineMetaRebuildTestCore {
    */
   protected int scanMeta() throws IOException {
     int count = 0;
-    HTable meta = new HTable(conf, TableName.META_TABLE_NAME);
+    Table meta = TEST_UTIL.getConnection().getTable(TableName.META_TABLE_NAME);
     ResultScanner scanner = meta.getScanner(new Scan());
-    LOG.info("Table: " + Bytes.toString(meta.getTableName()));
+    LOG.info("Table: " + meta.getName());
     for (Result res : scanner) {
       LOG.info(Bytes.toString(res.getRow()));
       count++;

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/HTablePool.java
----------------------------------------------------------------------
diff --git 
a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/HTablePool.java 
b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/HTablePool.java
index 400f10f..e9c9e1f 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/HTablePool.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/HTablePool.java
@@ -29,7 +29,20 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.client.*;
+import org.apache.hadoop.hbase.client.Append;
+import org.apache.hadoop.hbase.client.Delete;
+import org.apache.hadoop.hbase.client.Durability;
+import org.apache.hadoop.hbase.client.Get;
+import org.apache.hadoop.hbase.client.HTableFactory;
+import org.apache.hadoop.hbase.client.HTableInterface;
+import org.apache.hadoop.hbase.client.HTableInterfaceFactory;
+import org.apache.hadoop.hbase.client.Increment;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.ResultScanner;
+import org.apache.hadoop.hbase.client.Row;
+import org.apache.hadoop.hbase.client.RowMutations;
+import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.client.coprocessor.Batch;
 import org.apache.hadoop.hbase.client.coprocessor.Batch.Callback;
 import org.apache.hadoop.hbase.filter.CompareFilter.CompareOp;
@@ -220,8 +233,7 @@ public class HTablePool implements Closeable {
    * @param tableName
    *          table name
    * @return a reference to the specified table
-   * @throws RuntimeException
-   *           if there is a problem instantiating the HTable
+   * @throws RuntimeException if there is a problem instantiating the HTable
    */
   public HTableInterface getTable(byte[] tableName) {
     return getTable(Bytes.toString(tableName));
@@ -645,7 +657,7 @@ public class HTablePool implements Closeable {
 
     private void checkState() {
       if (!isOpen()) {
-        throw new IllegalStateException("Table=" + new 
String(table.getTableName())
+        throw new IllegalStateException("Table=" + table.getName()
                 + " already closed");
       }
     }

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestHTablePool.java
----------------------------------------------------------------------
diff --git 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestHTablePool.java
 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestHTablePool.java
index 2826b05..101a7cf 100644
--- 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestHTablePool.java
+++ 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestHTablePool.java
@@ -254,7 +254,7 @@ public class TestHTablePool {
     public void testCloseTablePool() throws IOException {
       HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(), 4,
           getPoolType());
-      HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
+      HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
 
       if (admin.tableExists(TABLENAME)) {
         admin.disableTable(TABLENAME);
@@ -330,7 +330,7 @@ public class TestHTablePool {
     public void testCloseTablePool() throws IOException {
       HTablePool pool = new HTablePool(TEST_UTIL.getConfiguration(), 4,
           getPoolType());
-      HBaseAdmin admin = new HBaseAdmin(TEST_UTIL.getConfiguration());
+      HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
 
       if (admin.tableExists(TABLENAME)) {
         admin.disableTable(TABLENAME);

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java
----------------------------------------------------------------------
diff --git 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java
 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java
index d3de6dd..f4df271 100644
--- 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java
+++ 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java
@@ -135,7 +135,7 @@ public class TestThriftHBaseServiceHandler {
   @BeforeClass
   public static void beforeClass() throws Exception {
     UTIL.startMiniCluster();
-    Admin admin = new HBaseAdmin(UTIL.getConfiguration());
+    Admin admin = UTIL.getHBaseAdmin();
     HTableDescriptor tableDescriptor = new 
HTableDescriptor(TableName.valueOf(tableAname));
     for (HColumnDescriptor family : families) {
       tableDescriptor.addFamily(family);

http://git-wip-us.apache.org/repos/asf/hbase/blob/9246af8d/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithLabels.java
----------------------------------------------------------------------
diff --git 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithLabels.java
 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithLabels.java
index 80c54df..42d1b08 100644
--- 
a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithLabels.java
+++ 
b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandlerWithLabels.java
@@ -138,7 +138,7 @@ public static void beforeClass() throws Exception {
   // Wait for the labels table to become available
   UTIL.waitTableEnabled(VisibilityConstants.LABELS_TABLE_NAME.getName(), 
50000);
   createLabels();
-  Admin admin = new HBaseAdmin(UTIL.getConfiguration());
+  Admin admin = UTIL.getHBaseAdmin();
   HTableDescriptor tableDescriptor = new HTableDescriptor(
       TableName.valueOf(tableAname));
   for (HColumnDescriptor family : families) {

Reply via email to