Repository: hbase Updated Branches: refs/heads/branch-1 e7c610b94 -> 1e821bc02
http://git-wip-us.apache.org/repos/asf/hbase/blob/1e821bc0/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 06b5f48..23571c2 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 @@ -30,6 +30,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.MediumTests; +import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.client.Table; @@ -71,13 +72,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 { @@ -93,12 +93,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/1e821bc0/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 1a4b08a..cf70d4a 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 @@ -178,7 +178,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); @@ -331,15 +331,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()); @@ -439,14 +438,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<Path> paths = new ArrayList<Path>(); final List<Integer> preLogRolledCalled = new ArrayList<Integer>(); @@ -598,12 +596,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); @@ -661,7 +657,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/1e821bc0/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 8a08f0c..99dc687 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 @@ -37,6 +37,7 @@ import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.MediumTests; 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; @@ -61,10 +62,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"); @@ -232,8 +233,8 @@ public class TestReplicationSink { assertEquals(0, res.size()); } - private WALEntry createEntry(byte [] table, int row, KeyValue.Type type, List<Cell> cells) { - byte[] fam = Bytes.equals(table, TABLE_NAME1) ? FAM_NAME1 : FAM_NAME2; + private WALEntry createEntry(TableName table, int row, KeyValue.Type type, List<Cell> 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 @@ -261,7 +262,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/1e821bc0/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 1a617dc..55324f7 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 @@ -110,7 +110,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 { @@ -119,7 +119,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); @@ -156,7 +156,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 { @@ -164,7 +164,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); @@ -198,7 +198,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); @@ -208,7 +208,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); @@ -244,7 +244,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); @@ -254,7 +254,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); @@ -290,7 +290,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); @@ -299,7 +299,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+")")); @@ -352,7 +352,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); @@ -361,7 +361,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); @@ -409,7 +409,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); @@ -418,7 +418,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); @@ -470,7 +470,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); @@ -479,7 +479,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); @@ -524,7 +524,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(); @@ -547,7 +547,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); @@ -574,7 +574,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); @@ -608,7 +608,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(); @@ -631,7 +631,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); @@ -658,7 +658,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); @@ -692,7 +692,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(); @@ -715,13 +715,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); @@ -749,7 +749,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(); @@ -779,13 +779,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); @@ -816,7 +816,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); @@ -825,7 +825,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); @@ -876,7 +876,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); @@ -885,7 +885,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); @@ -1055,7 +1055,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); @@ -1064,7 +1064,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+")")); @@ -1126,7 +1126,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); @@ -1135,7 +1135,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); @@ -1191,7 +1191,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); @@ -1204,7 +1204,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); @@ -1284,7 +1284,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); @@ -1293,7 +1293,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); @@ -1356,7 +1356,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); @@ -1365,7 +1365,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); @@ -1411,7 +1411,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); @@ -1420,7 +1420,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); @@ -1474,7 +1474,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(); @@ -1497,7 +1497,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); @@ -1528,7 +1528,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(); @@ -1551,7 +1551,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); @@ -1583,7 +1583,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); @@ -1592,7 +1592,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); @@ -1628,7 +1628,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); @@ -1636,7 +1636,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); @@ -1696,7 +1696,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); @@ -1705,7 +1705,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 + ")")); @@ -1757,7 +1757,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); @@ -1766,7 +1766,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+")")); @@ -1816,7 +1816,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. @@ -1825,7 +1825,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+")")); @@ -1877,7 +1877,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+")")); @@ -1935,14 +1935,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<Void> actiona = new PrivilegedExceptionAction<Void>() { @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); @@ -1992,14 +1992,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<Void> actiona = new PrivilegedExceptionAction<Void>() { @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 + ")")); @@ -2045,7 +2045,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); @@ -2096,14 +2096,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<Void> actiona = new PrivilegedExceptionAction<Void>() { @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 + ")")); @@ -2150,7 +2150,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); @@ -2190,7 +2190,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. @@ -2199,7 +2199,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); @@ -2250,7 +2250,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+")")); @@ -2301,7 +2301,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. @@ -2310,7 +2310,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 + ")")); @@ -2362,7 +2362,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); @@ -2416,7 +2416,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. @@ -2425,7 +2425,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+")")); @@ -2482,7 +2482,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+")")); @@ -2538,7 +2538,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. @@ -2547,7 +2547,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); @@ -2598,7 +2598,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+")")); @@ -2660,7 +2660,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. @@ -2669,7 +2669,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+")")); @@ -2721,7 +2721,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+")")); @@ -2771,7 +2771,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); @@ -2780,7 +2780,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); @@ -2804,7 +2804,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); @@ -2829,7 +2829,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); @@ -2854,7 +2854,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); @@ -2879,7 +2879,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); @@ -2904,7 +2904,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); @@ -2968,7 +2968,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(); @@ -2991,7 +2991,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/1e821bc0/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 ff0d29f..3627e01 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 @@ -119,7 +119,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); @@ -134,7 +134,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); @@ -169,7 +169,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); @@ -180,7 +180,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)); @@ -197,7 +197,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); @@ -213,7 +213,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/1e821bc0/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 0925fe3..0f439e2 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 @@ -25,6 +25,7 @@ import java.util.Collection; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.MediumTests; +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; @@ -66,7 +67,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/1e821bc0/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 7002013..70afecc 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 @@ -157,8 +157,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)); @@ -210,7 +210,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/1e821bc0/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 6dfe90c..901f0ef 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 @@ -102,7 +102,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++) { @@ -120,7 +120,7 @@ public class TestHBaseFsckEncryption { TEST_UTIL.getHBaseAdmin().flush(htd.getTableName()); // Verify we have encrypted store files on disk - final List<Path> paths = findStorefilePaths(htd.getName()); + final List<Path> paths = findStorefilePaths(htd.getTableName()); assertTrue(paths.size() > 0); for (Path path: paths) { assertTrue("Store file " + path + " has incorrect key", @@ -137,7 +137,7 @@ public class TestHBaseFsckEncryption { assertEquals(hfcc.getMissing().size(), 0); } - private List<Path> findStorefilePaths(byte[] tableName) throws Exception { + private List<Path> findStorefilePaths(TableName tableName) throws Exception { List<Path> paths = new ArrayList<Path>(); for (HRegion region: TEST_UTIL.getRSForFirstRegionInTable(tableName).getOnlineRegions(htd.getTableName())) { http://git-wip-us.apache.org/repos/asf/hbase/blob/1e821bc0/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 878e109..7a35ea6 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 @@ -36,6 +36,7 @@ import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.MediumTests; import org.apache.hadoop.hbase.ServerName; +import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.util.RegionSplitter.HexStringSplit; import org.apache.hadoop.hbase.util.RegionSplitter.SplitAlgorithm; @@ -91,8 +92,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")); } /** @@ -121,7 +123,7 @@ public class TestRegionSplitter { // Do table creation/pre-splitting and verification of region boundaries preSplitTableAndVerify(expectedBounds, UniformSplit.class.getSimpleName(), - "NewUniformPresplitTable"); + TableName.valueOf("NewUniformPresplitTable")); } /** @@ -272,12 +274,12 @@ public class TestRegionSplitter { * @throws Various junit assertions */ private void preSplitTableAndVerify(List<byte[]> 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); } @@ -286,26 +288,28 @@ public class TestRegionSplitter { public void noopRollingSplit() throws Exception { final List<byte[]> expectedBounds = new ArrayList<byte[]>(); 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<byte[]> 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<byte[]> expectedBounds, String tableName) + 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.getBytes()); + final HTable hTable = new HTable(conf, tableName); final Map<HRegionInfo, ServerName> regionInfoMap = hTable.getRegionLocations(); assertEquals(numRegions, regionInfoMap.size()); for (Map.Entry<HRegionInfo, ServerName> entry: regionInfoMap.entrySet()) {
