Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id ACB4417ECD for ; Tue, 30 Sep 2014 01:40:00 +0000 (UTC) Received: (qmail 10216 invoked by uid 500); 30 Sep 2014 01:40:00 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 10152 invoked by uid 500); 30 Sep 2014 01:40:00 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 10139 invoked by uid 99); 30 Sep 2014 01:40:00 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Sep 2014 01:40:00 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 377BFA02ED6; Tue, 30 Sep 2014 01:40:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: enis@apache.org To: commits@hbase.apache.org Date: Tue, 30 Sep 2014 01:40:00 -0000 Message-Id: <7ef6dfd331dd43d6a1b3eb4d25b7c0bc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] HBASE-12042 Replace internal uses of HTable(Configuration, String) with HTable(Configuration, TableName) (Solomon Duskis) Repository: hbase Updated Branches: refs/heads/master 683f3b3d5 -> 6189b52fb http://git-wip-us.apache.org/repos/asf/hbase/blob/6189b52f/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollPeriod.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollPeriod.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollPeriod.java index cb59d17..3357e08 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollPeriod.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRollPeriod.java @@ -29,6 +29,7 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HTableDescriptor; +import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.testclassification.RegionServerTests; import org.apache.hadoop.hbase.client.HTable; @@ -72,13 +73,12 @@ public class TestLogRollPeriod { */ @Test public void testNoEdits() throws Exception { - final String tableName = "TestLogRollPeriodNoEdits"; - + TableName tableName = TableName.valueOf("TestLogRollPeriodNoEdits"); TEST_UTIL.createTable(tableName, "cf"); try { Table table = new HTable(TEST_UTIL.getConfiguration(), tableName); try { - HRegionServer server = TEST_UTIL.getRSForFirstRegionInTable(Bytes.toBytes(tableName)); + HRegionServer server = TEST_UTIL.getRSForFirstRegionInTable(tableName); HLog log = server.getWAL(); checkMinLogRolls(log, 5); } finally { @@ -94,12 +94,12 @@ public class TestLogRollPeriod { */ @Test(timeout=60000) public void testWithEdits() throws Exception { - final String tableName = "TestLogRollPeriodWithEdits"; + final TableName tableName = TableName.valueOf("TestLogRollPeriodWithEdits"); final String family = "cf"; TEST_UTIL.createTable(tableName, family); try { - HRegionServer server = TEST_UTIL.getRSForFirstRegionInTable(Bytes.toBytes(tableName)); + HRegionServer server = TEST_UTIL.getRSForFirstRegionInTable(tableName); HLog log = server.getWAL(); final Table table = new HTable(TEST_UTIL.getConfiguration(), tableName); http://git-wip-us.apache.org/repos/asf/hbase/blob/6189b52f/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java index fbd60d2..a3349a1 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestLogRolling.java @@ -179,7 +179,7 @@ public class TestLogRolling { Table table = createTestTable(this.tableName); - server = TEST_UTIL.getRSForFirstRegionInTable(Bytes.toBytes(tableName)); + server = TEST_UTIL.getRSForFirstRegionInTable(table.getName()); this.log = server.getWAL(); for (int i = 1; i <= 256; i++) { // 256 writes should cause 8 log rolls doPut(table, i); @@ -332,15 +332,14 @@ public class TestLogRolling { this.log = server.getWAL(); // Create the test table and open it - String tableName = getName(); - HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); + HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(getName())); desc.addFamily(new HColumnDescriptor(HConstants.CATALOG_FAMILY)); admin.createTable(desc); - Table table = new HTable(TEST_UTIL.getConfiguration(), tableName); + Table table = new HTable(TEST_UTIL.getConfiguration(), desc.getTableName()); assertTrue(table.isAutoFlush()); - server = TEST_UTIL.getRSForFirstRegionInTable(Bytes.toBytes(tableName)); + server = TEST_UTIL.getRSForFirstRegionInTable(desc.getTableName()); this.log = server.getWAL(); assertTrue("Need HDFS-826 for this test", ((FSHLog) log).canGetCurReplicas()); @@ -440,14 +439,13 @@ public class TestLogRolling { this.log = server.getWAL(); // Create the test table and open it - String tableName = getName(); - HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); + HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(getName())); desc.addFamily(new HColumnDescriptor(HConstants.CATALOG_FAMILY)); admin.createTable(desc); - HTable table = new HTable(TEST_UTIL.getConfiguration(), tableName); + HTable table = new HTable(TEST_UTIL.getConfiguration(), desc.getTableName()); - server = TEST_UTIL.getRSForFirstRegionInTable(Bytes.toBytes(tableName)); + server = TEST_UTIL.getRSForFirstRegionInTable(desc.getTableName()); this.log = server.getWAL(); final List paths = new ArrayList(); final List preLogRolledCalled = new ArrayList(); @@ -599,12 +597,10 @@ public class TestLogRolling { // When the hbase:meta table can be opened, the region servers are running Table t = new HTable(TEST_UTIL.getConfiguration(), TableName.META_TABLE_NAME); try { - String tableName = getName(); - table = createTestTable(tableName); - String tableName2 = tableName + "1"; - table2 = createTestTable(tableName2); + table = createTestTable(getName()); + table2 = createTestTable(getName() + "1"); - server = TEST_UTIL.getRSForFirstRegionInTable(Bytes.toBytes(tableName)); + server = TEST_UTIL.getRSForFirstRegionInTable(table.getName()); this.log = server.getWAL(); FSHLog fshLog = (FSHLog)log; HRegion region = server.getOnlineRegions(table2.getName()).get(0); @@ -662,7 +658,7 @@ public class TestLogRolling { HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(tableName)); desc.addFamily(new HColumnDescriptor(HConstants.CATALOG_FAMILY)); admin.createTable(desc); - return new HTable(TEST_UTIL.getConfiguration(), tableName); + return new HTable(TEST_UTIL.getConfiguration(), desc.getTableName()); } } http://git-wip-us.apache.org/repos/asf/hbase/blob/6189b52f/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java index f6ad422..b87e7ef 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestReplicationSink.java @@ -38,6 +38,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.Stoppable; +import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.Get; import org.apache.hadoop.hbase.client.Result; import org.apache.hadoop.hbase.client.ResultScanner; @@ -62,10 +63,10 @@ public class TestReplicationSink { private static ReplicationSink SINK; - private static final byte[] TABLE_NAME1 = - Bytes.toBytes("table1"); - private static final byte[] TABLE_NAME2 = - Bytes.toBytes("table2"); + private static final TableName TABLE_NAME1 = + TableName.valueOf("table1"); + private static final TableName TABLE_NAME2 = + TableName.valueOf("table2"); private static final byte[] FAM_NAME1 = Bytes.toBytes("info1"); private static final byte[] FAM_NAME2 = Bytes.toBytes("info2"); @@ -233,8 +234,8 @@ public class TestReplicationSink { assertEquals(0, res.size()); } - private WALEntry createEntry(byte [] table, int row, KeyValue.Type type, List cells) { - byte[] fam = Bytes.equals(table, TABLE_NAME1) ? FAM_NAME1 : FAM_NAME2; + private WALEntry createEntry(TableName table, int row, KeyValue.Type type, List cells) { + byte[] fam = table.equals(TABLE_NAME1) ? FAM_NAME1 : FAM_NAME2; byte[] rowBytes = Bytes.toBytes(row); // Just make sure we don't get the same ts for two consecutive rows with // same key @@ -262,7 +263,7 @@ public class TestReplicationSink { uuidBuilder.setLeastSigBits(HConstants.DEFAULT_CLUSTER_ID.getLeastSignificantBits()); uuidBuilder.setMostSigBits(HConstants.DEFAULT_CLUSTER_ID.getMostSignificantBits()); keyBuilder.setClusterId(uuidBuilder.build()); - keyBuilder.setTableName(ByteStringer.wrap(table)); + keyBuilder.setTableName(ByteStringer.wrap(table.getName())); keyBuilder.setWriteTime(now); keyBuilder.setEncodedRegionName(ByteStringer.wrap(HConstants.EMPTY_BYTE_ARRAY)); keyBuilder.setLogSequenceNumber(-1); http://git-wip-us.apache.org/repos/asf/hbase/blob/6189b52f/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 c6bdfc2..5b718f0 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 @@ -111,7 +111,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testVisibilityLabelsWithDeleteColumns() throws Throwable { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); final Table table = createTableAndWriteDataWithLabels(tableName, SECRET + "&" + TOPSECRET, SECRET); try { @@ -120,7 +120,7 @@ public class TestVisibilityLabelsWithDeletes { public Void run() throws Exception { Table table = null; try { - table = new HTable(conf, TEST_NAME.getMethodName()); + table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(TOPSECRET + "&" + SECRET)); d.deleteColumns(fam, qual); @@ -157,7 +157,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testVisibilityLabelsWithDeleteFamily() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); final Table table = createTableAndWriteDataWithLabels(tableName, SECRET, CONFIDENTIAL + "|" + TOPSECRET); try { @@ -165,7 +165,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row2); d.setCellVisibility(new CellVisibility(TOPSECRET + "|" + CONFIDENTIAL)); d.deleteFamily(fam); @@ -199,7 +199,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testVisibilityLabelsWithDeleteFamilyVersion() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); long[] ts = new long[] { 123l, 125l }; final Table table = createTableAndWriteDataWithLabels(tableName, ts, CONFIDENTIAL + "|" + TOPSECRET, SECRET); @@ -209,7 +209,7 @@ public class TestVisibilityLabelsWithDeletes { public Void run() throws Exception { Table table = null; try { - table = new HTable(conf, TEST_NAME.getMethodName()); + table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(TOPSECRET + "|" + CONFIDENTIAL)); d.deleteFamilyVersion(fam, 123l); @@ -245,7 +245,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testVisibilityLabelsWithDeleteColumnExactVersion() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); long[] ts = new long[] { 123l, 125l }; final Table table = createTableAndWriteDataWithLabels(tableName, ts, CONFIDENTIAL + "|" + TOPSECRET, SECRET); @@ -255,7 +255,7 @@ public class TestVisibilityLabelsWithDeletes { public Void run() throws Exception { Table table = null; try { - table = new HTable(conf, TEST_NAME.getMethodName()); + table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(TOPSECRET + "|" + CONFIDENTIAL)); d.deleteColumn(fam, qual, 123l); @@ -291,7 +291,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testVisibilityLabelsWithDeleteColumnsWithMultipleVersions() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPuts(tableName); @@ -300,7 +300,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|(" + SECRET + "&" + TOPSECRET+")")); @@ -353,7 +353,7 @@ public class TestVisibilityLabelsWithDeletes { public void testVisibilityLabelsWithDeleteColumnsWithMultipleVersionsNoTimestamp() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPuts(tableName); @@ -362,7 +362,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(CONFIDENTIAL)); d.deleteColumns(fam, qual); @@ -410,7 +410,7 @@ public class TestVisibilityLabelsWithDeletes { testVisibilityLabelsWithDeleteColumnsWithNoMatchVisExpWithMultipleVersionsNoTimestamp() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPuts(tableName); @@ -419,7 +419,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(CONFIDENTIAL)); d.deleteColumns(fam, qual); @@ -471,7 +471,7 @@ public class TestVisibilityLabelsWithDeletes { public void testVisibilityLabelsWithDeleteFamilyWithMultipleVersionsNoTimestamp() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPuts(tableName); @@ -480,7 +480,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(CONFIDENTIAL)); d.deleteFamily(fam); @@ -525,7 +525,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testVisibilityLabelsWithDeleteFamilyWithPutsReAppearing() throws Exception { - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin(); @@ -548,7 +548,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(CONFIDENTIAL)); d.deleteFamily(fam); @@ -575,7 +575,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET)); d.deleteFamily(fam); @@ -609,7 +609,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testVisibilityLabelsWithDeleteColumnsWithPutsReAppearing() throws Exception { - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin(); @@ -632,7 +632,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(CONFIDENTIAL)); d.deleteColumns(fam, qual); @@ -659,7 +659,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET)); d.deleteColumns(fam, qual); @@ -693,7 +693,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testVisibilityCombinations() throws Exception { - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin(); @@ -716,13 +716,13 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET)); d.deleteColumns(fam, qual, 126l); table.delete(d); - table = new HTable(conf, TEST_NAME.getMethodName()); + table = new HTable(conf, tableName); d = new Delete(row1); d.setCellVisibility(new CellVisibility(CONFIDENTIAL)); d.deleteColumn(fam, qual, 123l); @@ -750,7 +750,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testVisibilityLabelsWithDeleteColumnWithSpecificVersionWithPutsReAppearing() throws Exception { - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin(); @@ -780,13 +780,13 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(CONFIDENTIAL)); d.deleteColumn(fam, qual, 123l); table.delete(d); - table = new HTable(conf, TEST_NAME.getMethodName()); + table = new HTable(conf, tableName); d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET)); d.deleteColumn(fam, qual, 123l); @@ -817,7 +817,7 @@ public class TestVisibilityLabelsWithDeletes { testVisibilityLabelsWithDeleteFamilyWithNoMatchingVisExpWithMultipleVersionsNoTimestamp() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPuts(tableName); @@ -826,7 +826,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(CONFIDENTIAL)); d.deleteFamily(fam); @@ -877,7 +877,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testDeleteFamilyAndDeleteColumnsWithAndWithoutVisibilityExp() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPuts(tableName); @@ -886,7 +886,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.deleteFamily(fam); table.delete(d); @@ -1056,7 +1056,7 @@ public class TestVisibilityLabelsWithDeletes { public void testDeleteColumnWithSpecificTimeStampUsingMultipleVersionsUnMatchingVisExpression() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPuts(tableName); @@ -1065,7 +1065,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|(" + SECRET + "&" + TOPSECRET+")")); @@ -1127,7 +1127,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testDeleteColumnWithLatestTimeStampUsingMultipleVersions() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPuts(tableName); @@ -1136,7 +1136,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET)); d.deleteColumn(fam, qual); @@ -1192,7 +1192,7 @@ public class TestVisibilityLabelsWithDeletes { @Test (timeout=180000) public void testDeleteColumnWithLatestTimeStampWhenNoVersionMatches() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPuts(tableName); @@ -1205,7 +1205,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET )); d.deleteColumn(fam, qual); @@ -1285,7 +1285,7 @@ public class TestVisibilityLabelsWithDeletes { public void testDeleteColumnWithLatestTimeStampUsingMultipleVersionsAfterCompaction() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPuts(tableName); @@ -1294,7 +1294,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET)); d.deleteColumn(fam, qual); @@ -1357,7 +1357,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testDeleteFamilyLatestTimeStampWithMulipleVersions() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPuts(tableName); @@ -1366,7 +1366,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET)); d.deleteFamily(fam); @@ -1412,7 +1412,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testDeleteColumnswithMultipleColumnsWithMultipleVersions() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPutsWithDiffCols(tableName); @@ -1421,7 +1421,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET)); d.deleteColumns(fam, qual, 125l); @@ -1475,7 +1475,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testDeleteColumnsWithDiffColsAndTags() throws Exception { - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin(); @@ -1498,7 +1498,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET)); d.deleteColumns(fam, qual, 126l); @@ -1529,7 +1529,7 @@ public class TestVisibilityLabelsWithDeletes { } @Test public void testDeleteColumnsWithDiffColsAndTags1() throws Exception { - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin(); @@ -1552,7 +1552,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET)); d.deleteColumns(fam, qual, 126l); @@ -1584,7 +1584,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testDeleteFamilyWithoutCellVisibilityWithMulipleVersions() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPutsWithoutVisibility(tableName); @@ -1593,7 +1593,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.deleteFamily(fam); table.delete(d); @@ -1629,7 +1629,7 @@ public class TestVisibilityLabelsWithDeletes { public void testDeleteFamilyLatestTimeStampWithMulipleVersionsWithoutCellVisibilityInPuts() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPutsWithoutVisibility(tableName); @@ -1637,7 +1637,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET)); d.deleteFamily(fam); @@ -1697,7 +1697,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testDeleteFamilySpecificTimeStampWithMulipleVersions() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPuts(tableName); @@ -1706,7 +1706,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|(" + SECRET + "&" + TOPSECRET + ")")); @@ -1758,7 +1758,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testScanAfterCompaction() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPuts(tableName); @@ -1767,7 +1767,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|(" + SECRET + "&" + TOPSECRET+")")); @@ -1817,7 +1817,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testDeleteFamilySpecificTimeStampWithMulipleVersionsDoneTwice() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { // Do not flush here. @@ -1826,7 +1826,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|(" + TOPSECRET + "&" + SECRET+")")); @@ -1878,7 +1878,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|(" + TOPSECRET + "&" + SECRET+")")); @@ -1936,14 +1936,14 @@ public class TestVisibilityLabelsWithDeletes { } }; VisibilityLabelsResponse response = SUPERUSER.runAs(action); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = doPuts(tableName); try { PrivilegedExceptionAction actiona = new PrivilegedExceptionAction() { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(CONFIDENTIAL)); d.deleteFamilyVersion(fam, 123l); @@ -1993,14 +1993,14 @@ public class TestVisibilityLabelsWithDeletes { @Test (timeout=180000) public void testSpecificDeletesFollowedByDeleteFamily() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = doPuts(tableName); try { PrivilegedExceptionAction actiona = new PrivilegedExceptionAction() { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|(" + TOPSECRET + "&" + SECRET + ")")); @@ -2046,7 +2046,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(CONFIDENTIAL)); d.deleteFamily(fam); @@ -2097,14 +2097,14 @@ public class TestVisibilityLabelsWithDeletes { } }; VisibilityLabelsResponse response = SUPERUSER.runAs(action); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = doPuts(tableName); try { PrivilegedExceptionAction actiona = new PrivilegedExceptionAction() { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|(" + TOPSECRET + "&" + SECRET + ")")); @@ -2151,7 +2151,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(CONFIDENTIAL)); d.deleteFamily(fam); @@ -2191,7 +2191,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testDeleteColumnSpecificTimeStampWithMulipleVersionsDoneTwice() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { // Do not flush here. @@ -2200,7 +2200,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET)); d.deleteColumn(fam, qual, 125l); @@ -2251,7 +2251,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|(" + TOPSECRET + "&" + SECRET+")")); @@ -2302,7 +2302,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testDeleteColumnSpecificTimeStampWithMulipleVersionsDoneTwice1() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { // Do not flush here. @@ -2311,7 +2311,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")" + "|(" + TOPSECRET + "&" + SECRET + ")")); @@ -2363,7 +2363,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET)); d.deleteColumn(fam, qual, 127l); @@ -2417,7 +2417,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testDeleteColumnSpecificTimeStampWithMulipleVersionsDoneTwice2() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { // Do not flush here. @@ -2426,7 +2426,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|(" + TOPSECRET + "&" + SECRET+")")); @@ -2483,7 +2483,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|(" + TOPSECRET + "&" + SECRET+")")); @@ -2539,7 +2539,7 @@ public class TestVisibilityLabelsWithDeletes { public void testDeleteColumnAndDeleteFamilylSpecificTimeStampWithMulipleVersion() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { // Do not flush here. @@ -2548,7 +2548,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility(SECRET + "&" + TOPSECRET)); d.deleteColumn(fam, qual, 125l); @@ -2599,7 +2599,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|(" + TOPSECRET + "&" + SECRET+")")); @@ -2661,7 +2661,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testDiffDeleteTypesForTheSameCellUsingMultipleVersions() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { // Do not flush here. @@ -2670,7 +2670,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + PRIVATE + "&" + CONFIDENTIAL + ")|(" + TOPSECRET + "&" + SECRET+")")); @@ -2722,7 +2722,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.setCellVisibility(new CellVisibility("(" + CONFIDENTIAL + "&" + PRIVATE + ")|(" + TOPSECRET + "&" + SECRET+")")); @@ -2772,7 +2772,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testDeleteColumnLatestWithNoCellVisibility() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = doPuts(tableName); @@ -2781,7 +2781,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.deleteColumn(fam, qual, 125l); table.delete(d); @@ -2805,7 +2805,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.deleteColumns(fam, qual, 125l); table.delete(d); @@ -2830,7 +2830,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.deleteFamily(fam, 125l); table.delete(d); @@ -2855,7 +2855,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.deleteFamily(fam); table.delete(d); @@ -2880,7 +2880,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.deleteColumns(fam, qual); table.delete(d); @@ -2905,7 +2905,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.deleteFamilyVersion(fam, 126l); table.delete(d); @@ -2969,7 +2969,7 @@ public class TestVisibilityLabelsWithDeletes { @Test public void testVisibilityExpressionWithNotEqualORCondition() throws Exception { setAuths(); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin(); @@ -2992,7 +2992,7 @@ public class TestVisibilityLabelsWithDeletes { @Override public Void run() throws Exception { try { - Table table = new HTable(conf, TEST_NAME.getMethodName()); + Table table = new HTable(conf, tableName); Delete d = new Delete(row1); d.deleteColumn(fam, qual, 124l); d.setCellVisibility(new CellVisibility(PRIVATE )); http://git-wip-us.apache.org/repos/asf/hbase/blob/6189b52f/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 4918084..828c89b 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 @@ -120,7 +120,7 @@ public class TestVisibilityWithCheckAuths { } }; SUPERUSER.runAs(action); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Admin hBaseAdmin = TEST_UTIL.getHBaseAdmin(); HColumnDescriptor colDesc = new HColumnDescriptor(fam); colDesc.setMaxVersions(5); @@ -135,7 +135,7 @@ public class TestVisibilityWithCheckAuths { public Void run() throws Exception { Table table = null; try { - table = new HTable(conf, TEST_NAME.getMethodName()); + table = new HTable(conf, tableName); Put p = new Put(row1); p.setCellVisibility(new CellVisibility(PUBLIC + "&" + TOPSECRET)); p.add(fam, qual, 125l, value); @@ -170,7 +170,7 @@ public class TestVisibilityWithCheckAuths { } }; SUPERUSER.runAs(action); - TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); + final TableName tableName = TableName.valueOf(TEST_NAME.getMethodName()); Table table = null; try { table = TEST_UTIL.createTable(tableName, fam); @@ -181,7 +181,7 @@ public class TestVisibilityWithCheckAuths { public Void run() throws Exception { Table table = null; try { - table = new HTable(conf, TEST_NAME.getMethodName()); + table = new HTable(conf, tableName); Put put = new Put(row1); put.add(fam, qual, HConstants.LATEST_TIMESTAMP, val); put.setCellVisibility(new CellVisibility(TOPSECRET)); @@ -198,7 +198,7 @@ public class TestVisibilityWithCheckAuths { public Void run() throws Exception { Table table = null; try { - table = new HTable(conf, TEST_NAME.getMethodName()); + table = new HTable(conf, tableName); Append append = new Append(row1); append.add(fam, qual, Bytes.toBytes("b")); table.append(append); @@ -214,7 +214,7 @@ public class TestVisibilityWithCheckAuths { public Void run() throws Exception { Table table = null; try { - table = new HTable(conf, TEST_NAME.getMethodName()); + table = new HTable(conf, tableName); Append append = new Append(row1); append.add(fam, qual, Bytes.toBytes("c")); append.setCellVisibility(new CellVisibility(PUBLIC)); http://git-wip-us.apache.org/repos/asf/hbase/blob/6189b52f/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java index f47b236..c5a3d2e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/TestHTraceHooks.java @@ -24,6 +24,7 @@ import static org.junit.Assert.assertTrue; import java.util.Collection; import org.apache.hadoop.hbase.HBaseTestingUtility; +import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.Waiter; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Table; @@ -67,7 +68,7 @@ public class TestHTraceHooks { Table table; try { - table = TEST_UTIL.createTable("table".getBytes(), + table = TEST_UTIL.createTable(TableName.valueOf("table"), FAMILY_BYTES); } finally { tableCreationSpan.close(); http://git-wip-us.apache.org/repos/asf/hbase/blob/6189b52f/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 b7868ab..70b53c5 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 @@ -163,8 +163,8 @@ public class TestHBaseFsck { @Test public void testHBaseFsck() throws Exception { assertNoErrors(doFsck(conf, false)); - String table = "tableBadMetaAssign"; - TEST_UTIL.createTable(Bytes.toBytes(table), FAM); + TableName table = TableName.valueOf("tableBadMetaAssign"); + TEST_UTIL.createTable(table, FAM); // We created 1 table, should be fine assertNoErrors(doFsck(conf, false)); @@ -216,7 +216,7 @@ public class TestHBaseFsck { assertNoErrors(doFsck(conf, false)); // comment needed - what is the purpose of this line - Table t = new HTable(conf, Bytes.toBytes(table), executorService); + Table t = new HTable(conf, table, executorService); ResultScanner s = t.getScanner(new Scan()); s.close(); t.close(); http://git-wip-us.apache.org/repos/asf/hbase/blob/6189b52f/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 9b208bc..27de51d 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.getName()); + Table table = new HTable(conf, htd.getTableName()); try { byte[] values = { 'A', 'B', 'C', 'D' }; for (int i = 0; i < values.length; i++) { @@ -121,7 +121,7 @@ public class TestHBaseFsckEncryption { TEST_UTIL.getHBaseAdmin().flush(htd.getTableName()); // Verify we have encrypted store files on disk - final List paths = findStorefilePaths(htd.getName()); + final List paths = findStorefilePaths(htd.getTableName()); assertTrue(paths.size() > 0); for (Path path: paths) { assertTrue("Store file " + path + " has incorrect key", @@ -138,7 +138,7 @@ public class TestHBaseFsckEncryption { assertEquals(hfcc.getMissing().size(), 0); } - private List findStorefilePaths(byte[] tableName) throws Exception { + private List findStorefilePaths(TableName tableName) throws Exception { List paths = new ArrayList(); for (HRegion region: TEST_UTIL.getRSForFirstRegionInTable(tableName).getOnlineRegions(htd.getTableName())) { http://git-wip-us.apache.org/repos/asf/hbase/blob/6189b52f/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 92c4e08..451da3c 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 @@ -35,6 +35,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.testclassification.MediumTests; import org.apache.hadoop.hbase.testclassification.MiscTests; @@ -92,8 +93,9 @@ public class TestRegionSplitter { expectedBounds.add(ArrayUtils.EMPTY_BYTE_ARRAY); // Do table creation/pre-splitting and verification of region boundaries - preSplitTableAndVerify(expectedBounds, - HexStringSplit.class.getSimpleName(), "NewHexPresplitTable"); + preSplitTableAndVerify(expectedBounds, + HexStringSplit.class.getSimpleName(), + TableName.valueOf("NewHexPresplitTable")); } /** @@ -122,7 +124,7 @@ public class TestRegionSplitter { // Do table creation/pre-splitting and verification of region boundaries preSplitTableAndVerify(expectedBounds, UniformSplit.class.getSimpleName(), - "NewUniformPresplitTable"); + TableName.valueOf("NewUniformPresplitTable")); } /** @@ -273,12 +275,12 @@ public class TestRegionSplitter { * @throws Various junit assertions */ private void preSplitTableAndVerify(List expectedBounds, - String splitClass, String tableName) throws Exception { + String splitClass, TableName tableName) throws Exception { final int numRegions = expectedBounds.size()-1; final Configuration conf = UTIL.getConfiguration(); conf.setInt("split.count", numRegions); SplitAlgorithm splitAlgo = RegionSplitter.newSplitAlgoInstance(conf, splitClass); - RegionSplitter.createPresplitTable(tableName, splitAlgo, + RegionSplitter.createPresplitTable(tableName.getNameAsString(), splitAlgo, new String[] {CF_NAME}, conf); verifyBounds(expectedBounds, tableName); } @@ -287,26 +289,28 @@ public class TestRegionSplitter { public void noopRollingSplit() throws Exception { final List expectedBounds = new ArrayList(); expectedBounds.add(ArrayUtils.EMPTY_BYTE_ARRAY); - rollingSplitAndVerify(TestRegionSplitter.class.getSimpleName(), "UniformSplit", expectedBounds); + rollingSplitAndVerify( + TableName.valueOf(TestRegionSplitter.class.getSimpleName()), + "UniformSplit", expectedBounds); } - private void rollingSplitAndVerify(String tableName, String splitClass, + private void rollingSplitAndVerify(TableName tableName, String splitClass, List expectedBounds) throws Exception { final Configuration conf = UTIL.getConfiguration(); // Set this larger than the number of splits so RegionSplitter won't block conf.setInt("split.outstanding", 5); SplitAlgorithm splitAlgo = RegionSplitter.newSplitAlgoInstance(conf, splitClass); - RegionSplitter.rollingSplit(tableName, splitAlgo, conf); + RegionSplitter.rollingSplit(tableName.getNameAsString(), splitAlgo, conf); verifyBounds(expectedBounds, tableName); } - private void verifyBounds(List expectedBounds, String tableName) + private void verifyBounds(List 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.getBytes()); + final HTable hTable = new HTable(conf, tableName); final Map regionInfoMap = hTable.getRegionLocations(); assertEquals(numRegions, regionInfoMap.size()); for (Map.Entry entry: regionInfoMap.entrySet()) {