You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2017/02/13 21:29:16 UTC
[07/10] hbase git commit: HBASE-9702 Changed unit tests to use method
names for tables
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestIncrementsFromClientSide.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestIncrementsFromClientSide.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestIncrementsFromClientSide.java
index 0ea61ec..3d7e1dc 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestIncrementsFromClientSide.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestIncrementsFromClientSide.java
@@ -93,7 +93,7 @@ public class TestIncrementsFromClientSide {
*/
@Test
public void testDuplicateIncrement() throws Exception {
- HTableDescriptor hdt = TEST_UTIL.createTableDescriptor("HCM-testDuplicateIncrement");
+ HTableDescriptor hdt = TEST_UTIL.createTableDescriptor(TableName.valueOf(name.getMethodName()));
Map<String, String> kvs = new HashMap<String, String>();
kvs.put(HConnectionTestingUtility.SleepAtFirstRpcCall.SLEEP_TIME_CONF_KEY, "2000");
hdt.addCoprocessor(HConnectionTestingUtility.SleepAtFirstRpcCall.class.getName(), null, 1, kvs);
@@ -105,7 +105,7 @@ public class TestIncrementsFromClientSide {
c.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, 1500);
Connection connection = ConnectionFactory.createConnection(c);
- Table t = connection.getTable(TableName.valueOf("HCM-testDuplicateIncrement"));
+ Table t = connection.getTable(TableName.valueOf(name.getMethodName()));
if (t instanceof HTable) {
HTable table = (HTable) t;
table.setOperationTimeout(3 * 1000);
@@ -183,8 +183,8 @@ public class TestIncrementsFromClientSide {
@Test
public void testBatchIncrementsWithReturnResultFalse() throws Exception {
LOG.info("Starting testBatchIncrementsWithReturnResultFalse");
- final TableName TABLENAME = TableName.valueOf("testBatchAppend");
- Table table = TEST_UTIL.createTable(TABLENAME, FAMILY);
+ final TableName tableName = TableName.valueOf(name.getMethodName());
+ Table table = TEST_UTIL.createTable(tableName, FAMILY);
Increment inc1 = new Increment(Bytes.toBytes("row2"));
inc1.setReturnResults(false);
inc1.addColumn(FAMILY, Bytes.toBytes("f1"), 1);
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestLeaseRenewal.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestLeaseRenewal.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestLeaseRenewal.java
index e3e33a3..5dba207 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestLeaseRenewal.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestLeaseRenewal.java
@@ -39,8 +39,10 @@ import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
@Category(LargeTests.class)
public class TestLeaseRenewal {
@@ -56,6 +58,9 @@ public class TestLeaseRenewal {
private final static int leaseTimeout =
HConstants.DEFAULT_HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD / 4;
+ @Rule
+ public TestName name = new TestName();
+
/**
* @throws java.lang.Exception
*/
@@ -95,8 +100,7 @@ public class TestLeaseRenewal {
@Test
public void testLeaseRenewal() throws Exception {
- Table table = TEST_UTIL.createTable(
- TableName.valueOf("testLeaseRenewal"), FAMILY);
+ Table table = TEST_UTIL.createTable(TableName.valueOf(name.getMethodName()), FAMILY);
Put p = new Put(ROW_BYTES);
p.addColumn(FAMILY, COL_QUAL, VAL_BYTES);
table.put(p);
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
index 197725c..527c910 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java
@@ -62,6 +62,7 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
import org.junit.rules.TestRule;
/**
@@ -76,6 +77,9 @@ public class TestMetaWithReplicas {
private static final Log LOG = LogFactory.getLog(TestMetaWithReplicas.class);
private final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
+ @Rule
+ public TestName name = new TestName();
+
@Before
public void setup() throws Exception {
TEST_UTIL.getConfiguration().setInt("zookeeper.session.timeout", 30000);
@@ -235,17 +239,17 @@ public class TestMetaWithReplicas {
@Test
public void testMetaLookupThreadPoolCreated() throws Exception {
- TableName TABLE = TableName.valueOf("testMetaLookupThreadPoolCreated");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte[][] FAMILIES = new byte[][] { Bytes.toBytes("foo") };
- if (TEST_UTIL.getAdmin().tableExists(TABLE)) {
- TEST_UTIL.getAdmin().disableTable(TABLE);
- TEST_UTIL.getAdmin().deleteTable(TABLE);
+ if (TEST_UTIL.getAdmin().tableExists(tableName)) {
+ TEST_UTIL.getAdmin().disableTable(tableName);
+ TEST_UTIL.getAdmin().deleteTable(tableName);
}
- try (Table htable = TEST_UTIL.createTable(TABLE, FAMILIES);) {
+ try (Table htable = TEST_UTIL.createTable(tableName, FAMILIES);) {
byte[] row = "test".getBytes();
ConnectionImplementation c = ((ConnectionImplementation) TEST_UTIL.getConnection());
// check that metalookup pool would get created
- c.relocateRegion(TABLE, row);
+ c.relocateRegion(tableName, row);
ExecutorService ex = c.getCurrentMetaLookupPool();
assert(ex != null);
}
@@ -368,7 +372,7 @@ public class TestMetaWithReplicas {
public void testAccessingUnknownTables() throws Exception {
Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
conf.setBoolean(HConstants.USE_META_REPLICAS, true);
- Table table = TEST_UTIL.getConnection().getTable(TableName.valueOf("RandomTable"));
+ Table table = TEST_UTIL.getConnection().getTable(TableName.valueOf(name.getMethodName()));
Get get = new Get(Bytes.toBytes("foo"));
try {
table.get(get);
@@ -400,7 +404,7 @@ public class TestMetaWithReplicas {
}
}
assert(moveToServer != null);
- TableName tableName = TableName.valueOf("randomTable5678");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
TEST_UTIL.createTable(tableName, "f");
assertTrue(TEST_UTIL.getAdmin().tableExists(tableName));
TEST_UTIL.getAdmin().move(HRegionInfo.FIRST_META_REGIONINFO.getEncodedNameAsBytes(),
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMobCloneSnapshotFromClient.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMobCloneSnapshotFromClient.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMobCloneSnapshotFromClient.java
index a3a5a76..27b1ba3 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMobCloneSnapshotFromClient.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMobCloneSnapshotFromClient.java
@@ -38,8 +38,10 @@ import org.apache.hadoop.hbase.testclassification.ClientTests;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
/**
* Test clone snapshots from the client
@@ -49,6 +51,9 @@ public class TestMobCloneSnapshotFromClient extends TestCloneSnapshotFromClient
private static boolean delayFlush = false;
+ @Rule
+ public TestName name = new TestName();
+
protected static void setupConfiguration() {
TestCloneSnapshotFromClient.setupConfiguration();
TEST_UTIL.getConfiguration().setLong(TimeToLiveHFileCleaner.TTL_CONF_KEY, 0);
@@ -108,7 +113,7 @@ public class TestMobCloneSnapshotFromClient extends TestCloneSnapshotFromClient
SnapshotTestingUtils.loadData(TEST_UTIL, tableName, 20, FAMILY);
long tid = System.currentTimeMillis();
byte[] snapshotName3 = Bytes.toBytes("snaptb3-" + tid);
- TableName clonedTableName3 = TableName.valueOf("clonedtb3-" + System.currentTimeMillis());
+ TableName clonedTableName3 = TableName.valueOf(name.getMethodName() + System.currentTimeMillis());
admin.snapshot(snapshotName3, tableName);
delayFlush = false;
int snapshot3Rows = -1;
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiRespectsLimits.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiRespectsLimits.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiRespectsLimits.java
index 9d10705..a7b9e68 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiRespectsLimits.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultiRespectsLimits.java
@@ -35,8 +35,10 @@ import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
import java.util.ArrayList;
import java.util.List;
@@ -56,6 +58,9 @@ public class TestMultiRespectsLimits {
private final static byte[] FAMILY = Bytes.toBytes("D");
public static final int MAX_SIZE = 500;
+ @Rule
+ public TestName name = new TestName();
+
@BeforeClass
public static void setUpBeforeClass() throws Exception {
TEST_UTIL.getConfiguration().setLong(
@@ -73,17 +78,17 @@ public class TestMultiRespectsLimits {
@Test
public void testMultiLimits() throws Exception {
- final TableName name = TableName.valueOf("testMultiLimits");
- Table t = TEST_UTIL.createTable(name, FAMILY);
+ final TableName tableName = TableName.valueOf(name.getMethodName());
+ Table t = TEST_UTIL.createTable(tableName, FAMILY);
TEST_UTIL.loadTable(t, FAMILY, false);
// Split the table to make sure that the chunking happens accross regions.
try (final Admin admin = TEST_UTIL.getAdmin()) {
- admin.split(name);
+ admin.split(tableName);
TEST_UTIL.waitFor(60000, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
- return admin.getTableRegions(name).size() > 1;
+ return admin.getTableRegions(tableName).size() > 1;
}
});
}
@@ -112,13 +117,13 @@ public class TestMultiRespectsLimits {
@Test
public void testBlockMultiLimits() throws Exception {
- final TableName name = TableName.valueOf("testBlockMultiLimits");
- HTableDescriptor desc = new HTableDescriptor(name);
+ final TableName tableName = TableName.valueOf(name.getMethodName());
+ HTableDescriptor desc = new HTableDescriptor(tableName);
HColumnDescriptor hcd = new HColumnDescriptor(FAMILY);
hcd.setDataBlockEncoding(DataBlockEncoding.FAST_DIFF);
desc.addFamily(hcd);
TEST_UTIL.getAdmin().createTable(desc);
- Table t = TEST_UTIL.getConnection().getTable(name);
+ Table t = TEST_UTIL.getConnection().getTable(tableName);
final HRegionServer regionServer = TEST_UTIL.getHBaseCluster().getRegionServer(0);
RpcServerInterface rpcServer = regionServer.getRpcServer();
@@ -150,11 +155,11 @@ public class TestMultiRespectsLimits {
// Make sure that a flush happens
try (final Admin admin = TEST_UTIL.getAdmin()) {
- admin.flush(name);
+ admin.flush(tableName);
TEST_UTIL.waitFor(60000, new Waiter.Predicate<Exception>() {
@Override
public boolean evaluate() throws Exception {
- return regionServer.getOnlineRegions(name).get(0).getMaxFlushedSeqId() > 3;
+ return regionServer.getOnlineRegions(tableName).get(0).getMaxFlushedSeqId() > 3;
}
});
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java
index 56f01c3..a25c4af 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMultipleTimestamps.java
@@ -35,8 +35,10 @@ import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
/**
* Run tests related to {@link TimestampsFilter} using HBase client APIs.
@@ -48,6 +50,9 @@ public class TestMultipleTimestamps {
private static final Log LOG = LogFactory.getLog(TestMultipleTimestamps.class);
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
+ @Rule
+ public TestName name = new TestName();
+
/**
* @throws java.lang.Exception
*/
@@ -82,14 +87,12 @@ public class TestMultipleTimestamps {
@Test
public void testReseeksWithOneColumnMiltipleTimestamp() throws IOException {
- TableName TABLE =
- TableName.valueOf("testReseeksWithOne" +
- "ColumnMiltipleTimestamps");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte [] FAMILY = Bytes.toBytes("event_log");
byte [][] FAMILIES = new byte[][] { FAMILY };
// create table; set versions to max...
- Table ht = TEST_UTIL.createTable(TABLE, FAMILIES, Integer.MAX_VALUE);
+ Table ht = TEST_UTIL.createTable(tableName, FAMILIES, Integer.MAX_VALUE);
Integer[] putRows = new Integer[] {1, 3, 5, 7};
Integer[] putColumns = new Integer[] { 1, 3, 5};
@@ -102,7 +105,7 @@ public class TestMultipleTimestamps {
put(ht, FAMILY, putRows, putColumns, putTimestamps);
- TEST_UTIL.flush(TABLE);
+ TEST_UTIL.flush(tableName);
ResultScanner scanner = scan(ht, FAMILY, scanRows, scanColumns,
scanTimestamps, scanMaxVersions);
@@ -123,15 +126,13 @@ public class TestMultipleTimestamps {
@Test
public void testReseeksWithMultipleColumnOneTimestamp() throws IOException {
- LOG.info("testReseeksWithMultipleColumnOneTimestamp");
- TableName TABLE =
- TableName.valueOf("testReseeksWithMultiple" +
- "ColumnOneTimestamps");
+ LOG.info(name.getMethodName());
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte [] FAMILY = Bytes.toBytes("event_log");
byte [][] FAMILIES = new byte[][] { FAMILY };
// create table; set versions to max...
- Table ht = TEST_UTIL.createTable(TABLE, FAMILIES, Integer.MAX_VALUE);
+ Table ht = TEST_UTIL.createTable(tableName, FAMILIES, Integer.MAX_VALUE);
Integer[] putRows = new Integer[] {1, 3, 5, 7};
Integer[] putColumns = new Integer[] { 1, 3, 5};
@@ -144,7 +145,7 @@ public class TestMultipleTimestamps {
put(ht, FAMILY, putRows, putColumns, putTimestamps);
- TEST_UTIL.flush(TABLE);
+ TEST_UTIL.flush(tableName);
ResultScanner scanner = scan(ht, FAMILY, scanRows, scanColumns,
scanTimestamps, scanMaxVersions);
@@ -164,15 +165,14 @@ public class TestMultipleTimestamps {
@Test
public void testReseeksWithMultipleColumnMultipleTimestamp() throws
IOException {
- LOG.info("testReseeksWithMultipleColumnMultipleTimestamp");
+ LOG.info(name.getMethodName());
- TableName TABLE =
- TableName.valueOf("testReseeksWithMultipleColumnMiltipleTimestamps");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte [] FAMILY = Bytes.toBytes("event_log");
byte [][] FAMILIES = new byte[][] { FAMILY };
// create table; set versions to max...
- Table ht = TEST_UTIL.createTable(TABLE, FAMILIES, Integer.MAX_VALUE);
+ Table ht = TEST_UTIL.createTable(tableName, FAMILIES, Integer.MAX_VALUE);
Integer[] putRows = new Integer[] {1, 3, 5, 7};
Integer[] putColumns = new Integer[] { 1, 3, 5};
@@ -185,7 +185,7 @@ public class TestMultipleTimestamps {
put(ht, FAMILY, putRows, putColumns, putTimestamps);
- TEST_UTIL.flush(TABLE);
+ TEST_UTIL.flush(tableName);
Scan scan = new Scan();
scan.setMaxVersions(10);
ResultScanner scanner = ht.getScanner(scan);
@@ -218,14 +218,13 @@ public class TestMultipleTimestamps {
@Test
public void testReseeksWithMultipleFiles() throws IOException {
- LOG.info("testReseeksWithMultipleFiles");
- TableName TABLE =
- TableName.valueOf("testReseeksWithMultipleFiles");
+ LOG.info(name.getMethodName());
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte [] FAMILY = Bytes.toBytes("event_log");
byte [][] FAMILIES = new byte[][] { FAMILY };
// create table; set versions to max...
- Table ht = TEST_UTIL.createTable(TABLE, FAMILIES, Integer.MAX_VALUE);
+ Table ht = TEST_UTIL.createTable(tableName, FAMILIES, Integer.MAX_VALUE);
Integer[] putRows1 = new Integer[] {1, 2, 3};
Integer[] putColumns1 = new Integer[] { 2, 5, 6};
@@ -246,9 +245,9 @@ public class TestMultipleTimestamps {
int scanMaxVersions = 5;
put(ht, FAMILY, putRows1, putColumns1, putTimestamps1);
- TEST_UTIL.flush(TABLE);
+ TEST_UTIL.flush(tableName);
put(ht, FAMILY, putRows2, putColumns2, putTimestamps2);
- TEST_UTIL.flush(TABLE);
+ TEST_UTIL.flush(tableName);
put(ht, FAMILY, putRows3, putColumns3, putTimestamps3);
ResultScanner scanner = scan(ht, FAMILY, scanRows, scanColumns,
@@ -287,21 +286,20 @@ public class TestMultipleTimestamps {
}
public void testWithVersionDeletes(boolean flushTables) throws IOException {
- LOG.info("testWithVersionDeletes_"+ (flushTables ? "flush" : "noflush"));
- TableName TABLE =
- TableName.valueOf("testWithVersionDeletes_" + (flushTables ?
+ LOG.info(name.getMethodName() + "_"+ (flushTables ? "flush" : "noflush"));
+ final TableName tableName = TableName.valueOf(name.getMethodName() + "_" + (flushTables ?
"flush" : "noflush"));
byte [] FAMILY = Bytes.toBytes("event_log");
byte [][] FAMILIES = new byte[][] { FAMILY };
// create table; set versions to max...
- Table ht = TEST_UTIL.createTable(TABLE, FAMILIES, Integer.MAX_VALUE);
+ Table ht = TEST_UTIL.createTable(tableName, FAMILIES, Integer.MAX_VALUE);
// For row:0, col:0: insert versions 1 through 5.
putNVersions(ht, FAMILY, 0, 0, 1, 5);
if (flushTables) {
- TEST_UTIL.flush(TABLE);
+ TEST_UTIL.flush(tableName);
}
// delete version 4.
@@ -321,20 +319,19 @@ public class TestMultipleTimestamps {
@Test
public void testWithMultipleVersionDeletes() throws IOException {
- LOG.info("testWithMultipleVersionDeletes");
+ LOG.info(name.getMethodName());
- TableName TABLE =
- TableName.valueOf("testWithMultipleVersionDeletes");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte [] FAMILY = Bytes.toBytes("event_log");
byte [][] FAMILIES = new byte[][] { FAMILY };
// create table; set versions to max...
- Table ht = TEST_UTIL.createTable(TABLE, FAMILIES, Integer.MAX_VALUE);
+ Table ht = TEST_UTIL.createTable(tableName, FAMILIES, Integer.MAX_VALUE);
// For row:0, col:0: insert versions 1 through 5.
putNVersions(ht, FAMILY, 0, 0, 1, 5);
- TEST_UTIL.flush(TABLE);
+ TEST_UTIL.flush(tableName);
// delete all versions before 4.
deleteAllVersionsBefore(ht, FAMILY, 0, 0, 4);
@@ -349,18 +346,17 @@ public class TestMultipleTimestamps {
@Test
public void testWithColumnDeletes() throws IOException {
- TableName TABLE =
- TableName.valueOf("testWithColumnDeletes");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte [] FAMILY = Bytes.toBytes("event_log");
byte [][] FAMILIES = new byte[][] { FAMILY };
// create table; set versions to max...
- Table ht = TEST_UTIL.createTable(TABLE, FAMILIES, Integer.MAX_VALUE);
+ Table ht = TEST_UTIL.createTable(tableName, FAMILIES, Integer.MAX_VALUE);
// For row:0, col:0: insert versions 1 through 5.
putNVersions(ht, FAMILY, 0, 0, 1, 5);
- TEST_UTIL.flush(TABLE);
+ TEST_UTIL.flush(tableName);
// delete all versions before 4.
deleteColumn(ht, FAMILY, 0, 0);
@@ -375,18 +371,17 @@ public class TestMultipleTimestamps {
@Test
public void testWithFamilyDeletes() throws IOException {
- TableName TABLE =
- TableName.valueOf("testWithFamilyDeletes");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte [] FAMILY = Bytes.toBytes("event_log");
byte [][] FAMILIES = new byte[][] { FAMILY };
// create table; set versions to max...
- Table ht = TEST_UTIL.createTable(TABLE, FAMILIES, Integer.MAX_VALUE);
+ Table ht = TEST_UTIL.createTable(tableName, FAMILIES, Integer.MAX_VALUE);
// For row:0, col:0: insert versions 1 through 5.
putNVersions(ht, FAMILY, 0, 0, 1, 5);
- TEST_UTIL.flush(TABLE);
+ TEST_UTIL.flush(tableName);
// delete all versions before 4.
deleteFamily(ht, FAMILY, 0);
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestPutWithDelete.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestPutWithDelete.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestPutWithDelete.java
index 0b5cd4e..88df9d0 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestPutWithDelete.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestPutWithDelete.java
@@ -24,8 +24,10 @@ import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
import static org.junit.Assert.assertTrue;
@@ -33,6 +35,9 @@ import static org.junit.Assert.assertTrue;
public class TestPutWithDelete {
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
+ @Rule
+ public TestName name = new TestName();
+
/**
* @throws java.lang.Exception
*/
@@ -51,7 +56,7 @@ public class TestPutWithDelete {
@Test
public void testHbasePutDeleteCell() throws Exception {
- final TableName tableName = TableName.valueOf("TestPutWithDelete");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
final byte[] rowKey = Bytes.toBytes("12345");
final byte[] family = Bytes.toBytes("cf");
Table table = TEST_UTIL.createTable(tableName, family);
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClient.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClient.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClient.java
index 4ae959d..ec6e020 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClient.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRestoreSnapshotFromClient.java
@@ -49,6 +49,7 @@ import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
import org.junit.rules.TestRule;
/**
@@ -75,6 +76,9 @@ public class TestRestoreSnapshotFromClient {
private int snapshot1Rows;
private Admin admin;
+ @Rule
+ public TestName name = new TestName();
+
@BeforeClass
public static void setupCluster() throws Exception {
setupConf(TEST_UTIL.getConfiguration());
@@ -106,8 +110,7 @@ public class TestRestoreSnapshotFromClient {
this.admin = TEST_UTIL.getAdmin();
long tid = System.currentTimeMillis();
- tableName =
- TableName.valueOf("testtb-" + tid);
+ tableName = TableName.valueOf(name.getMethodName() + "-" + tid);
emptySnapshot = Bytes.toBytes("emptySnaptb-" + tid);
snapshotName0 = Bytes.toBytes("snaptb0-" + tid);
snapshotName1 = Bytes.toBytes("snaptb1-" + tid);
@@ -244,8 +247,7 @@ public class TestRestoreSnapshotFromClient {
@Test
public void testCloneSnapshotOfCloned() throws IOException, InterruptedException {
- TableName clonedTableName =
- TableName.valueOf("clonedtb-" + System.currentTimeMillis());
+ TableName clonedTableName = TableName.valueOf(name.getMethodName() + "-" + System.currentTimeMillis());
admin.cloneSnapshot(snapshotName0, clonedTableName);
verifyRowCount(TEST_UTIL, clonedTableName, snapshot0Rows);
SnapshotTestingUtils.verifyReplicasCameOnline(clonedTableName, admin, getNumReplicas());
@@ -280,7 +282,7 @@ public class TestRestoreSnapshotFromClient {
@Test
public void testCorruptedSnapshot() throws IOException, InterruptedException {
SnapshotTestingUtils.corruptSnapshot(TEST_UTIL, Bytes.toString(snapshotName0));
- TableName cloneName = TableName.valueOf("corruptedClone-" + System.currentTimeMillis());
+ TableName cloneName = TableName.valueOf(name.getMethodName() + "-" + System.currentTimeMillis());
try {
admin.cloneSnapshot(snapshotName0, cloneName);
fail("Expected CorruptedSnapshotException, got succeeded cloneSnapshot()");
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResultSizeEstimation.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResultSizeEstimation.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResultSizeEstimation.java
index 1647e97..d754e63 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResultSizeEstimation.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestResultSizeEstimation.java
@@ -32,8 +32,10 @@ import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
import static org.junit.Assert.assertEquals;
@@ -45,6 +47,9 @@ public class TestResultSizeEstimation {
final static int TAG_DATA_SIZE = 2048;
final static int SCANNER_DATA_LIMIT = TAG_DATA_SIZE + 256;
+ @Rule
+ public TestName name = new TestName();
+
@BeforeClass
public static void setUpBeforeClass() throws Exception {
Configuration conf = TEST_UTIL.getConfiguration();
@@ -69,9 +74,9 @@ public class TestResultSizeEstimation {
byte [] QUALIFIER = Bytes.toBytes("testQualifier");
byte [] VALUE = Bytes.toBytes("testValue");
- TableName TABLE = TableName.valueOf("testResultSizeEstimation");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte[][] FAMILIES = new byte[][] { FAMILY };
- Table table = TEST_UTIL.createTable(TABLE, FAMILIES);
+ Table table = TEST_UTIL.createTable(tableName, FAMILIES);
Put p = new Put(ROW1);
p.add(new KeyValue(ROW1, FAMILY, QUALIFIER, Long.MAX_VALUE, VALUE));
table.put(p);
@@ -99,9 +104,9 @@ public class TestResultSizeEstimation {
byte [] QUALIFIER = Bytes.toBytes("testQualifier");
byte [] VALUE = Bytes.toBytes("testValue");
- TableName TABLE = TableName.valueOf("testResultSizeEstimationWithTags");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte[][] FAMILIES = new byte[][] { FAMILY };
- Table table = TEST_UTIL.createTable(TABLE, FAMILIES);
+ Table table = TEST_UTIL.createTable(tableName, FAMILIES);
Put p = new Put(ROW1);
p.add(new KeyValue(ROW1, FAMILY, QUALIFIER, Long.MAX_VALUE, VALUE,
new Tag[] { new ArrayBackedTag((byte)1, new byte[TAG_DATA_SIZE]) } ));
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java
index c48ec31..df058f2 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestScannersFromClientSide.java
@@ -52,8 +52,10 @@ import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
/**
* A client-side test, mostly testing scanners with various parameters.
@@ -68,6 +70,9 @@ public class TestScannersFromClientSide {
private static byte [] QUALIFIER = Bytes.toBytes("testQualifier");
private static byte [] VALUE = Bytes.toBytes("testValue");
+ @Rule
+ public TestName name = new TestName();
+
/**
* @throws java.lang.Exception
*/
@@ -109,10 +114,10 @@ public class TestScannersFromClientSide {
*/
@Test
public void testScanBatch() throws Exception {
- TableName TABLE = TableName.valueOf("testScanBatch");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte [][] QUALIFIERS = HTestConst.makeNAscii(QUALIFIER, 8);
- Table ht = TEST_UTIL.createTable(TABLE, FAMILY);
+ Table ht = TEST_UTIL.createTable(tableName, FAMILY);
Put put;
Scan scan;
@@ -179,8 +184,8 @@ public class TestScannersFromClientSide {
@Test
public void testMaxResultSizeIsSetToDefault() throws Exception {
- TableName TABLE = TableName.valueOf("testMaxResultSizeIsSetToDefault");
- Table ht = TEST_UTIL.createTable(TABLE, FAMILY);
+ final TableName tableName = TableName.valueOf(name.getMethodName());
+ Table ht = TEST_UTIL.createTable(tableName, FAMILY);
// The max result size we expect the scan to use by default.
long expectedMaxResultSize =
@@ -229,7 +234,7 @@ public class TestScannersFromClientSide {
@Test
public void testSmallScan() throws Exception {
- TableName TABLE = TableName.valueOf("testSmallScan");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
int numRows = 10;
byte[][] ROWS = HTestConst.makeNAscii(ROW, numRows);
@@ -237,7 +242,7 @@ public class TestScannersFromClientSide {
int numQualifiers = 10;
byte[][] QUALIFIERS = HTestConst.makeNAscii(QUALIFIER, numQualifiers);
- Table ht = TEST_UTIL.createTable(TABLE, FAMILY);
+ Table ht = TEST_UTIL.createTable(tableName, FAMILY);
Put put;
List<Put> puts = new ArrayList<Put>();
@@ -313,11 +318,11 @@ public class TestScannersFromClientSide {
*/
@Test
public void testGetMaxResults() throws Exception {
- TableName TABLE = TableName.valueOf("testGetMaxResults");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte [][] FAMILIES = HTestConst.makeNAscii(FAMILY, 3);
byte [][] QUALIFIERS = HTestConst.makeNAscii(QUALIFIER, 20);
- Table ht = TEST_UTIL.createTable(TABLE, FAMILIES);
+ Table ht = TEST_UTIL.createTable(tableName, FAMILIES);
Get get;
Put put;
@@ -433,12 +438,12 @@ public class TestScannersFromClientSide {
*/
@Test
public void testScanMaxResults() throws Exception {
- TableName TABLE = TableName.valueOf("testScanLimit");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte [][] ROWS = HTestConst.makeNAscii(ROW, 2);
byte [][] FAMILIES = HTestConst.makeNAscii(FAMILY, 3);
byte [][] QUALIFIERS = HTestConst.makeNAscii(QUALIFIER, 10);
- Table ht = TEST_UTIL.createTable(TABLE, FAMILIES);
+ Table ht = TEST_UTIL.createTable(tableName, FAMILIES);
Put put;
Scan scan;
@@ -483,11 +488,11 @@ public class TestScannersFromClientSide {
*/
@Test
public void testGetRowOffset() throws Exception {
- TableName TABLE = TableName.valueOf("testGetRowOffset");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte [][] FAMILIES = HTestConst.makeNAscii(FAMILY, 3);
byte [][] QUALIFIERS = HTestConst.makeNAscii(QUALIFIER, 20);
- Table ht = TEST_UTIL.createTable(TABLE, FAMILIES);
+ Table ht = TEST_UTIL.createTable(tableName, FAMILIES);
Get get;
Put put;
@@ -579,10 +584,10 @@ public class TestScannersFromClientSide {
*/
@Test
public void testScanOnReopenedRegion() throws Exception {
- TableName TABLE = TableName.valueOf("testScanOnReopenedRegion");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
byte [][] QUALIFIERS = HTestConst.makeNAscii(QUALIFIER, 2);
- Table ht = TEST_UTIL.createTable(TABLE, FAMILY);
+ Table ht = TEST_UTIL.createTable(tableName, FAMILY);
Put put;
Scan scan;
@@ -604,7 +609,7 @@ public class TestScannersFromClientSide {
HRegionLocation loc;
- try (RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(TABLE)) {
+ try (RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(tableName)) {
loc = locator.getRegionLocation(ROW);
}
HRegionInfo hri = loc.getRegionInfo();
@@ -651,7 +656,7 @@ public class TestScannersFromClientSide {
@Test
public void testAsyncScannerWithSmallData() throws Exception {
- testAsyncScanner(TableName.valueOf("testAsyncScannerWithSmallData"),
+ testAsyncScanner(TableName.valueOf(name.getMethodName()),
2,
3,
10);
@@ -659,7 +664,7 @@ public class TestScannersFromClientSide {
@Test
public void testAsyncScannerWithManyRows() throws Exception {
- testAsyncScanner(TableName.valueOf("testAsyncScannerWithManyRows"),
+ testAsyncScanner(TableName.valueOf(name.getMethodName()),
30000,
1,
1);
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestShortCircuitConnection.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestShortCircuitConnection.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestShortCircuitConnection.java
index 589ca34..9bf3d21 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestShortCircuitConnection.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestShortCircuitConnection.java
@@ -38,14 +38,19 @@ import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
@Category({ MediumTests.class, ClientTests.class })
public class TestShortCircuitConnection {
private final static HBaseTestingUtility UTIL = new HBaseTestingUtility();
+ @Rule
+ public TestName name = new TestName();
+
@BeforeClass
public static void setUpBeforeClass() throws Exception {
UTIL.startMiniCluster(1);
@@ -59,14 +64,14 @@ public class TestShortCircuitConnection {
@Test
@SuppressWarnings("deprecation")
public void testShortCircuitConnection() throws IOException, InterruptedException {
- TableName tn = TableName.valueOf("testShortCircuitConnection");
- HTableDescriptor htd = UTIL.createTableDescriptor(tn);
+ final TableName tableName = TableName.valueOf(name.getMethodName());
+ HTableDescriptor htd = UTIL.createTableDescriptor(tableName);
HColumnDescriptor hcd = new HColumnDescriptor(Bytes.toBytes("cf"));
htd.addFamily(hcd);
UTIL.createTable(htd, null);
- HRegionServer regionServer = UTIL.getRSForFirstRegionInTable(tn);
+ HRegionServer regionServer = UTIL.getRSForFirstRegionInTable(tableName);
ClusterConnection connection = regionServer.getClusterConnection();
- Table tableIf = connection.getTable(tn);
+ Table tableIf = connection.getTable(tableName);
assertTrue(tableIf instanceof HTable);
HTable table = (HTable) tableIf;
assertTrue(table.getConnection() == connection);
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSnapshotFromClient.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSnapshotFromClient.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSnapshotFromClient.java
index c813faf..3d8ee55 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSnapshotFromClient.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSnapshotFromClient.java
@@ -50,10 +50,12 @@ import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import com.google.common.collect.Lists;
+import org.junit.rules.TestName;
/**
* Test create/using/deleting snapshots from the client
@@ -71,6 +73,9 @@ public class TestSnapshotFromClient {
protected static final TableName TABLE_NAME =
TableName.valueOf(STRING_TABLE_NAME);
+ @Rule
+ public TestName name = new TestName();
+
/**
* Setup the config for the cluster
* @throws Exception on failure
@@ -312,11 +317,11 @@ public class TestSnapshotFromClient {
@Test(timeout = 300000)
public void testListTableSnapshots() throws Exception {
Admin admin = null;
- TableName tableName2 = TableName.valueOf("testListTableSnapshots");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
try {
admin = UTIL.getAdmin();
- HTableDescriptor htd = new HTableDescriptor(tableName2);
+ HTableDescriptor htd = new HTableDescriptor(tableName);
UTIL.createTable(htd, new byte[][] { TEST_FAM }, UTIL.getConfiguration());
String table1Snapshot1 = "Table1Snapshot1";
@@ -328,7 +333,7 @@ public class TestSnapshotFromClient {
LOG.debug("Snapshot2 completed.");
String table2Snapshot1 = "Table2Snapshot1";
- admin.snapshot(Bytes.toBytes(table2Snapshot1), tableName2);
+ admin.snapshot(Bytes.toBytes(table2Snapshot1), tableName);
LOG.debug(table2Snapshot1 + " completed.");
List<SnapshotDescription> listTableSnapshots = admin.listTableSnapshots("test.*", ".*");
@@ -346,8 +351,8 @@ public class TestSnapshotFromClient {
admin.deleteSnapshots("Table.*");
} catch (SnapshotDoesNotExistException ignore) {
}
- if (admin.tableExists(tableName2)) {
- UTIL.deleteTable(tableName2);
+ if (admin.tableExists(tableName)) {
+ UTIL.deleteTable(tableName);
}
admin.close();
}
@@ -396,11 +401,11 @@ public class TestSnapshotFromClient {
@Test(timeout = 300000)
public void testDeleteTableSnapshots() throws Exception {
Admin admin = null;
- TableName tableName2 = TableName.valueOf("testListTableSnapshots");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
try {
admin = UTIL.getAdmin();
- HTableDescriptor htd = new HTableDescriptor(tableName2);
+ HTableDescriptor htd = new HTableDescriptor(tableName);
UTIL.createTable(htd, new byte[][] { TEST_FAM }, UTIL.getConfiguration());
String table1Snapshot1 = "Table1Snapshot1";
@@ -412,15 +417,15 @@ public class TestSnapshotFromClient {
LOG.debug("Snapshot2 completed.");
String table2Snapshot1 = "Table2Snapshot1";
- admin.snapshot(Bytes.toBytes(table2Snapshot1), tableName2);
+ admin.snapshot(Bytes.toBytes(table2Snapshot1), tableName);
LOG.debug(table2Snapshot1 + " completed.");
admin.deleteTableSnapshots("test.*", ".*");
assertEquals(0, admin.listTableSnapshots("test.*", ".*").size());
} finally {
if (admin != null) {
- if (admin.tableExists(tableName2)) {
- UTIL.deleteTable(tableName2);
+ if (admin.tableExists(tableName)) {
+ UTIL.deleteTable(tableName);
}
admin.close();
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSplitOrMergeStatus.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSplitOrMergeStatus.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSplitOrMergeStatus.java
index f6b6361..852c5cf 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSplitOrMergeStatus.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestSplitOrMergeStatus.java
@@ -32,8 +32,10 @@ import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.JVMClusterUtil;
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
import java.io.IOException;
import java.util.List;
@@ -49,6 +51,9 @@ public class TestSplitOrMergeStatus {
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static byte [] FAMILY = Bytes.toBytes("testFamily");
+ @Rule
+ public TestName name = new TestName();
+
/**
* @throws java.lang.Exception
*/
@@ -67,8 +72,8 @@ public class TestSplitOrMergeStatus {
@Test
public void testSplitSwitch() throws Exception {
- TableName name = TableName.valueOf("testSplitSwitch");
- Table t = TEST_UTIL.createTable(name, FAMILY);
+ final TableName tableName = TableName.valueOf(name.getMethodName());
+ Table t = TEST_UTIL.createTable(tableName, FAMILY);
TEST_UTIL.loadTable(t, FAMILY, false);
RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(t.getName());
@@ -94,8 +99,8 @@ public class TestSplitOrMergeStatus {
@Test
public void testMergeSwitch() throws Exception {
- TableName name = TableName.valueOf("testMergeSwitch");
- Table t = TEST_UTIL.createTable(name, FAMILY);
+ final TableName tableName = TableName.valueOf(name.getMethodName());
+ Table t = TEST_UTIL.createTable(tableName, FAMILY);
TEST_UTIL.loadTable(t, FAMILY, false);
RegionLocator locator = TEST_UTIL.getConnection().getRegionLocator(t.getName());
@@ -105,7 +110,7 @@ public class TestSplitOrMergeStatus {
admin.split(t.getName());
waitOnSplitOrMerge(t); //Split the table to ensure we have two regions at least.
- waitForMergable(admin, name);
+ waitForMergable(admin, tableName);
int orignalCount = locator.getAllRegionLocations().size();
boolean[] results = admin.setSplitOrMergeEnabled(false, false, MasterSwitchType.MERGE);
assertEquals(results.length, 1);
@@ -117,7 +122,7 @@ public class TestSplitOrMergeStatus {
int count = waitOnSplitOrMerge(t).size();
assertTrue(orignalCount == count);
- waitForMergable(admin, name);
+ waitForMergable(admin, tableName);
results = admin.setSplitOrMergeEnabled(true, false, MasterSwitchType.MERGE);
assertEquals(results.length, 1);
assertFalse(results[0]);
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableFavoredNodes.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableFavoredNodes.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableFavoredNodes.java
index 8ef7c88..f587d20 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableFavoredNodes.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTableFavoredNodes.java
@@ -61,8 +61,10 @@ import com.google.common.collect.Maps;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
@Category({ClientTests.class, MediumTests.class})
@@ -80,6 +82,9 @@ public class TestTableFavoredNodes {
private final byte[][] splitKeys = new byte[][] {Bytes.toBytes(1), Bytes.toBytes(9)};
private final int NUM_REGIONS = splitKeys.length + 1;
+ @Rule
+ public TestName name = new TestName();
+
@BeforeClass
public static void setupBeforeClass() throws Exception {
Configuration conf = TEST_UTIL.getConfiguration();
@@ -115,8 +120,7 @@ public class TestTableFavoredNodes {
*/
@Test
public void testCreateTable() throws Exception {
-
- TableName tableName = TableName.valueOf("createTable");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
TEST_UTIL.createTable(tableName, Bytes.toBytes("f"), splitKeys);
TEST_UTIL.waitUntilAllRegionsAssigned(tableName);
@@ -135,8 +139,7 @@ public class TestTableFavoredNodes {
*/
@Test
public void testTruncateTable() throws Exception {
-
- TableName tableName = TableName.valueOf("truncateTable");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
TEST_UTIL.createTable(tableName, Bytes.toBytes("f"), splitKeys);
TEST_UTIL.waitUntilAllRegionsAssigned(tableName);
@@ -161,8 +164,7 @@ public class TestTableFavoredNodes {
*/
@Test
public void testSplitTable() throws Exception {
-
- TableName tableName = TableName.valueOf("splitRegions");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
TEST_UTIL.createTable(tableName, Bytes.toBytes("f"), splitKeys);
TEST_UTIL.waitUntilAllRegionsAssigned(tableName);
@@ -219,8 +221,7 @@ public class TestTableFavoredNodes {
*/
@Test
public void testMergeTable() throws Exception {
-
- TableName tableName = TableName.valueOf("mergeRegions");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
TEST_UTIL.createTable(tableName, Bytes.toBytes("f"), splitKeys);
TEST_UTIL.waitUntilAllRegionsAssigned(tableName);
@@ -335,8 +336,7 @@ public class TestTableFavoredNodes {
*/
@Test
public void testSystemTables() throws Exception {
-
- TableName tableName = TableName.valueOf("createTable");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
TEST_UTIL.createTable(tableName, Bytes.toBytes("f"), splitKeys);
TEST_UTIL.waitUntilAllRegionsAssigned(tableName);
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTimestampsFilter.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTimestampsFilter.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTimestampsFilter.java
index c803752..5c487d7 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTimestampsFilter.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestTimestampsFilter.java
@@ -37,8 +37,10 @@ import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
/**
* Run tests related to {@link TimestampsFilter} using HBase client APIs.
@@ -50,6 +52,9 @@ public class TestTimestampsFilter {
private static final Log LOG = LogFactory.getLog(TestTimestampsFilter.class);
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
+ @Rule
+ public TestName name = new TestName();
+
/**
* @throws java.lang.Exception
*/
@@ -92,7 +97,7 @@ public class TestTimestampsFilter {
*/
@Test
public void testTimestampsFilter() throws Exception {
- byte [] TABLE = Bytes.toBytes("testTimestampsFilter");
+ final byte [] TABLE = Bytes.toBytes(name.getMethodName());
byte [] FAMILY = Bytes.toBytes("event_log");
byte [][] FAMILIES = new byte[][] { FAMILY };
Cell kvs[];
@@ -168,7 +173,7 @@ public class TestTimestampsFilter {
@Test
public void testMultiColumns() throws Exception {
- byte [] TABLE = Bytes.toBytes("testTimestampsFilterMultiColumns");
+ final byte [] TABLE = Bytes.toBytes(name.getMethodName());
byte [] FAMILY = Bytes.toBytes("event_log");
byte [][] FAMILIES = new byte[][] { FAMILY };
@@ -227,7 +232,7 @@ public class TestTimestampsFilter {
}
private void testWithVersionDeletes(boolean flushTables) throws IOException {
- byte [] TABLE = Bytes.toBytes("testWithVersionDeletes_" +
+ final byte [] TABLE = Bytes.toBytes(name.getMethodName() + "_" +
(flushTables ? "flush" : "noflush"));
byte [] FAMILY = Bytes.toBytes("event_log");
byte [][] FAMILIES = new byte[][] { FAMILY };
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.java
index 435e20b..481f311 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.java
@@ -45,8 +45,10 @@ import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher;
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -55,7 +57,6 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
-
/**
* Unit testing of ReplicationAdmin
*/
@@ -74,6 +75,9 @@ public class TestReplicationAdmin {
private static ReplicationAdmin admin;
+ @Rule
+ public TestName name = new TestName();
+
/**
* @throws java.lang.Exception
*/
@@ -218,98 +222,98 @@ public class TestReplicationAdmin {
public void testAppendPeerTableCFs() throws Exception {
ReplicationPeerConfig rpc1 = new ReplicationPeerConfig();
rpc1.setClusterKey(KEY_ONE);
- TableName tab1 = TableName.valueOf("t1");
- TableName tab2 = TableName.valueOf("t2");
- TableName tab3 = TableName.valueOf("t3");
- TableName tab4 = TableName.valueOf("t4");
- TableName tab5 = TableName.valueOf("t5");
- TableName tab6 = TableName.valueOf("t6");
+ final TableName tableName1 = TableName.valueOf(name.getMethodName() + "t1");
+ final TableName tableName2 = TableName.valueOf(name.getMethodName() + "t2");
+ final TableName tableName3 = TableName.valueOf(name.getMethodName() + "t3");
+ final TableName tableName4 = TableName.valueOf(name.getMethodName() + "t4");
+ final TableName tableName5 = TableName.valueOf(name.getMethodName() + "t5");
+ final TableName tableName6 = TableName.valueOf(name.getMethodName() + "t6");
// Add a valid peer
admin.addPeer(ID_ONE, rpc1, null);
Map<TableName, List<String>> tableCFs = new HashMap<>();
- tableCFs.put(tab1, null);
+ tableCFs.put(tableName1, null);
admin.appendPeerTableCFs(ID_ONE, tableCFs);
Map<TableName, List<String>> result =
ReplicationSerDeHelper.parseTableCFsFromConfig(admin.getPeerTableCFs(ID_ONE));
assertEquals(1, result.size());
- assertEquals(true, result.containsKey(tab1));
- assertNull(result.get(tab1));
+ assertEquals(true, result.containsKey(tableName1));
+ assertNull(result.get(tableName1));
// append table t2 to replication
tableCFs.clear();
- tableCFs.put(tab2, null);
+ tableCFs.put(tableName2, null);
admin.appendPeerTableCFs(ID_ONE, tableCFs);
result = ReplicationSerDeHelper.parseTableCFsFromConfig(admin.getPeerTableCFs(ID_ONE));
assertEquals(2, result.size());
- assertTrue("Should contain t1", result.containsKey(tab1));
- assertTrue("Should contain t2", result.containsKey(tab2));
- assertNull(result.get(tab1));
- assertNull(result.get(tab2));
+ assertTrue("Should contain t1", result.containsKey(tableName1));
+ assertTrue("Should contain t2", result.containsKey(tableName2));
+ assertNull(result.get(tableName1));
+ assertNull(result.get(tableName2));
// append table column family: f1 of t3 to replication
tableCFs.clear();
- tableCFs.put(tab3, new ArrayList<String>());
- tableCFs.get(tab3).add("f1");
+ tableCFs.put(tableName3, new ArrayList<String>());
+ tableCFs.get(tableName3).add("f1");
admin.appendPeerTableCFs(ID_ONE, tableCFs);
result = ReplicationSerDeHelper.parseTableCFsFromConfig(admin.getPeerTableCFs(ID_ONE));
assertEquals(3, result.size());
- assertTrue("Should contain t1", result.containsKey(tab1));
- assertTrue("Should contain t2", result.containsKey(tab2));
- assertTrue("Should contain t3", result.containsKey(tab3));
- assertNull(result.get(tab1));
- assertNull(result.get(tab2));
- assertEquals(1, result.get(tab3).size());
- assertEquals("f1", result.get(tab3).get(0));
+ assertTrue("Should contain t1", result.containsKey(tableName1));
+ assertTrue("Should contain t2", result.containsKey(tableName2));
+ assertTrue("Should contain t3", result.containsKey(tableName3));
+ assertNull(result.get(tableName1));
+ assertNull(result.get(tableName2));
+ assertEquals(1, result.get(tableName3).size());
+ assertEquals("f1", result.get(tableName3).get(0));
tableCFs.clear();
- tableCFs.put(tab4, new ArrayList<String>());
- tableCFs.get(tab4).add("f1");
- tableCFs.get(tab4).add("f2");
+ tableCFs.put(tableName4, new ArrayList<String>());
+ tableCFs.get(tableName4).add("f1");
+ tableCFs.get(tableName4).add("f2");
admin.appendPeerTableCFs(ID_ONE, tableCFs);
result = ReplicationSerDeHelper.parseTableCFsFromConfig(admin.getPeerTableCFs(ID_ONE));
assertEquals(4, result.size());
- assertTrue("Should contain t1", result.containsKey(tab1));
- assertTrue("Should contain t2", result.containsKey(tab2));
- assertTrue("Should contain t3", result.containsKey(tab3));
- assertTrue("Should contain t4", result.containsKey(tab4));
- assertNull(result.get(tab1));
- assertNull(result.get(tab2));
- assertEquals(1, result.get(tab3).size());
- assertEquals("f1", result.get(tab3).get(0));
- assertEquals(2, result.get(tab4).size());
- assertEquals("f1", result.get(tab4).get(0));
- assertEquals("f2", result.get(tab4).get(1));
+ assertTrue("Should contain t1", result.containsKey(tableName1));
+ assertTrue("Should contain t2", result.containsKey(tableName2));
+ assertTrue("Should contain t3", result.containsKey(tableName3));
+ assertTrue("Should contain t4", result.containsKey(tableName4));
+ assertNull(result.get(tableName1));
+ assertNull(result.get(tableName2));
+ assertEquals(1, result.get(tableName3).size());
+ assertEquals("f1", result.get(tableName3).get(0));
+ assertEquals(2, result.get(tableName4).size());
+ assertEquals("f1", result.get(tableName4).get(0));
+ assertEquals("f2", result.get(tableName4).get(1));
// append "table5" => [], then append "table5" => ["f1"]
tableCFs.clear();
- tableCFs.put(tab5, new ArrayList<String>());
+ tableCFs.put(tableName5, new ArrayList<String>());
admin.appendPeerTableCFs(ID_ONE, tableCFs);
tableCFs.clear();
- tableCFs.put(tab5, new ArrayList<String>());
- tableCFs.get(tab5).add("f1");
+ tableCFs.put(tableName5, new ArrayList<String>());
+ tableCFs.get(tableName5).add("f1");
admin.appendPeerTableCFs(ID_ONE, tableCFs);
result = ReplicationSerDeHelper.parseTableCFsFromConfig(admin.getPeerTableCFs(ID_ONE));
assertEquals(5, result.size());
- assertTrue("Should contain t5", result.containsKey(tab5));
+ assertTrue("Should contain t5", result.containsKey(tableName5));
// null means replication all cfs of tab5
- assertNull(result.get(tab5));
+ assertNull(result.get(tableName5));
// append "table6" => ["f1"], then append "table6" => []
tableCFs.clear();
- tableCFs.put(tab6, new ArrayList<String>());
- tableCFs.get(tab6).add("f1");
+ tableCFs.put(tableName6, new ArrayList<String>());
+ tableCFs.get(tableName6).add("f1");
admin.appendPeerTableCFs(ID_ONE, tableCFs);
tableCFs.clear();
- tableCFs.put(tab6, new ArrayList<String>());
+ tableCFs.put(tableName6, new ArrayList<String>());
admin.appendPeerTableCFs(ID_ONE, tableCFs);
result = ReplicationSerDeHelper.parseTableCFsFromConfig(admin.getPeerTableCFs(ID_ONE));
assertEquals(6, result.size());
- assertTrue("Should contain t6", result.containsKey(tab6));
+ assertTrue("Should contain t6", result.containsKey(tableName6));
// null means replication all cfs of tab6
- assertNull(result.get(tab6));
+ assertNull(result.get(tableName6));
admin.removePeer(ID_ONE);
}
@@ -318,15 +322,15 @@ public class TestReplicationAdmin {
public void testRemovePeerTableCFs() throws Exception {
ReplicationPeerConfig rpc1 = new ReplicationPeerConfig();
rpc1.setClusterKey(KEY_ONE);
- TableName tab1 = TableName.valueOf("t1");
- TableName tab2 = TableName.valueOf("t2");
- TableName tab3 = TableName.valueOf("t3");
- TableName tab4 = TableName.valueOf("t4");
+ final TableName tableName1 = TableName.valueOf(name.getMethodName() + "t1");
+ final TableName tableName2 = TableName.valueOf(name.getMethodName() + "t2");
+ final TableName tableName3 = TableName.valueOf(name.getMethodName() + "t3");
+ final TableName tableName4 = TableName.valueOf(name.getMethodName() + "t4");
// Add a valid peer
admin.addPeer(ID_ONE, rpc1, null);
Map<TableName, List<String>> tableCFs = new HashMap<>();
try {
- tableCFs.put(tab3, null);
+ tableCFs.put(tableName3, null);
admin.removePeerTableCFs(ID_ONE, tableCFs);
assertTrue(false);
} catch (ReplicationException e) {
@@ -334,13 +338,13 @@ public class TestReplicationAdmin {
assertNull(admin.getPeerTableCFs(ID_ONE));
tableCFs.clear();
- tableCFs.put(tab1, null);
- tableCFs.put(tab2, new ArrayList<String>());
- tableCFs.get(tab2).add("cf1");
+ tableCFs.put(tableName1, null);
+ tableCFs.put(tableName2, new ArrayList<String>());
+ tableCFs.get(tableName2).add("cf1");
admin.setPeerTableCFs(ID_ONE, tableCFs);
try {
tableCFs.clear();
- tableCFs.put(tab3, null);
+ tableCFs.put(tableName3, null);
admin.removePeerTableCFs(ID_ONE, tableCFs);
assertTrue(false);
} catch (ReplicationException e) {
@@ -348,43 +352,43 @@ public class TestReplicationAdmin {
Map<TableName, List<String>> result =
ReplicationSerDeHelper.parseTableCFsFromConfig(admin.getPeerTableCFs(ID_ONE));
assertEquals(2, result.size());
- assertTrue("Should contain t1", result.containsKey(tab1));
- assertTrue("Should contain t2", result.containsKey(tab2));
- assertNull(result.get(tab1));
- assertEquals(1, result.get(tab2).size());
- assertEquals("cf1", result.get(tab2).get(0));
+ assertTrue("Should contain t1", result.containsKey(tableName1));
+ assertTrue("Should contain t2", result.containsKey(tableName2));
+ assertNull(result.get(tableName1));
+ assertEquals(1, result.get(tableName2).size());
+ assertEquals("cf1", result.get(tableName2).get(0));
try {
tableCFs.clear();
- tableCFs.put(tab1, new ArrayList<String>());
- tableCFs.get(tab1).add("f1");
+ tableCFs.put(tableName1, new ArrayList<String>());
+ tableCFs.get(tableName1).add("f1");
admin.removePeerTableCFs(ID_ONE, tableCFs);
assertTrue(false);
} catch (ReplicationException e) {
}
tableCFs.clear();
- tableCFs.put(tab1, null);
+ tableCFs.put(tableName1, null);
admin.removePeerTableCFs(ID_ONE, tableCFs);
result = ReplicationSerDeHelper.parseTableCFsFromConfig(admin.getPeerTableCFs(ID_ONE));
assertEquals(1, result.size());
- assertEquals(1, result.get(tab2).size());
- assertEquals("cf1", result.get(tab2).get(0));
+ assertEquals(1, result.get(tableName2).size());
+ assertEquals("cf1", result.get(tableName2).get(0));
try {
tableCFs.clear();
- tableCFs.put(tab2, null);
+ tableCFs.put(tableName2, null);
admin.removePeerTableCFs(ID_ONE, tableCFs);
assertTrue(false);
} catch (ReplicationException e) {
}
tableCFs.clear();
- tableCFs.put(tab2, new ArrayList<String>());
- tableCFs.get(tab2).add("cf1");
+ tableCFs.put(tableName2, new ArrayList<String>());
+ tableCFs.get(tableName2).add("cf1");
admin.removePeerTableCFs(ID_ONE, tableCFs);
assertNull(admin.getPeerTableCFs(ID_ONE));
tableCFs.clear();
- tableCFs.put(tab4, new ArrayList<String>());
+ tableCFs.put(tableName4, new ArrayList<String>());
admin.setPeerTableCFs(ID_ONE, tableCFs);
admin.removePeerTableCFs(ID_ONE, tableCFs);
assertNull(admin.getPeerTableCFs(ID_ONE));
@@ -429,8 +433,8 @@ public class TestReplicationAdmin {
public void testNamespacesAndTableCfsConfigConflict() throws Exception {
String ns1 = "ns1";
String ns2 = "ns2";
- TableName tab1 = TableName.valueOf("ns1:tabl");
- TableName tab2 = TableName.valueOf("ns2:tab2");
+ final TableName tableName1 = TableName.valueOf(ns1 + ":" + name.getMethodName());
+ final TableName tableName2 = TableName.valueOf(ns2 + ":" + name.getMethodName() + "2");
ReplicationPeerConfig rpc = new ReplicationPeerConfig();
rpc.setClusterKey(KEY_ONE);
@@ -444,11 +448,11 @@ public class TestReplicationAdmin {
admin.updatePeerConfig(ID_ONE, rpc);
rpc = admin.getPeerConfig(ID_ONE);
Map<TableName, List<String>> tableCfs = new HashMap<>();
- tableCfs.put(tab1, new ArrayList<String>());
+ tableCfs.put(tableName1, new ArrayList<String>());
rpc.setTableCFsMap(tableCfs);
try {
admin.updatePeerConfig(ID_ONE, rpc);
- fail("Should throw ReplicationException, because table " + tab1 + " conflict with namespace "
+ fail("Should throw ReplicationException, because table " + tableName1 + " conflict with namespace "
+ ns1);
} catch (IOException e) {
// OK
@@ -456,7 +460,7 @@ public class TestReplicationAdmin {
rpc = admin.getPeerConfig(ID_ONE);
tableCfs.clear();
- tableCfs.put(tab2, new ArrayList<String>());
+ tableCfs.put(tableName2, new ArrayList<String>());
rpc.setTableCFsMap(tableCfs);
admin.updatePeerConfig(ID_ONE, rpc);
rpc = admin.getPeerConfig(ID_ONE);
@@ -466,7 +470,7 @@ public class TestReplicationAdmin {
try {
admin.updatePeerConfig(ID_ONE, rpc);
fail("Should throw ReplicationException, because namespace " + ns2 + " conflict with table "
- + tab2);
+ + tableName2);
} catch (IOException e) {
// OK
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.java
index b603cc2..96fca47 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/replication/TestReplicationAdminWithClusters.java
@@ -35,8 +35,10 @@ import org.apache.hadoop.hbase.testclassification.ClientTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
/**
* Unit testing of ReplicationAdmin with clusters
@@ -50,6 +52,9 @@ public class TestReplicationAdminWithClusters extends TestReplicationBase {
static Admin admin2;
static ReplicationAdmin adminExt;
+ @Rule
+ public TestName name = new TestName();
+
@BeforeClass
public static void setUpBeforeClass() throws Exception {
TestReplicationBase.setUpBeforeClass();
@@ -145,12 +150,12 @@ public class TestReplicationAdminWithClusters extends TestReplicationBase {
@Test(timeout = 300000, expected = TableNotFoundException.class)
public void testDisableReplicationForNonExistingTable() throws Exception {
- admin1.disableTableReplication(TableName.valueOf("nonExistingTable"));
+ admin1.disableTableReplication(TableName.valueOf(name.getMethodName()));
}
@Test(timeout = 300000, expected = TableNotFoundException.class)
public void testEnableReplicationForNonExistingTable() throws Exception {
- admin1.enableTableReplication(TableName.valueOf("nonExistingTable"));
+ admin1.enableTableReplication(TableName.valueOf(name.getMethodName()));
}
@Test(timeout = 300000, expected = IllegalArgumentException.class)
@@ -169,33 +174,33 @@ public class TestReplicationAdminWithClusters extends TestReplicationBase {
*/
@Test(timeout = 300000)
public void testEnableReplicationForExplicitSetTableCfs() throws Exception {
- TableName tn = TableName.valueOf("testEnableReplicationForSetTableCfs");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
String peerId = "2";
- if (admin2.isTableAvailable(tableName)) {
- admin2.disableTable(tableName);
- admin2.deleteTable(tableName);
+ if (admin2.isTableAvailable(TestReplicationBase.tableName)) {
+ admin2.disableTable(TestReplicationBase.tableName);
+ admin2.deleteTable(TestReplicationBase.tableName);
}
- assertFalse("Table should not exists in the peer cluster", admin2.isTableAvailable(tableName));
+ assertFalse("Table should not exists in the peer cluster", admin2.isTableAvailable(TestReplicationBase.tableName));
Map<TableName, ? extends Collection<String>> tableCfs =
new HashMap<TableName, Collection<String>>();
- tableCfs.put(tn, null);
+ tableCfs.put(tableName, null);
try {
adminExt.setPeerTableCFs(peerId, tableCfs);
- admin1.enableTableReplication(tableName);
+ admin1.enableTableReplication(TestReplicationBase.tableName);
assertFalse("Table should not be created if user has set table cfs explicitly for the "
+ "peer and this is not part of that collection",
- admin2.isTableAvailable(tableName));
+ admin2.isTableAvailable(TestReplicationBase.tableName));
- tableCfs.put(tableName, null);
+ tableCfs.put(TestReplicationBase.tableName, null);
adminExt.setPeerTableCFs(peerId, tableCfs);
- admin1.enableTableReplication(tableName);
+ admin1.enableTableReplication(TestReplicationBase.tableName);
assertTrue(
"Table should be created if user has explicitly added table into table cfs collection",
- admin2.isTableAvailable(tableName));
+ admin2.isTableAvailable(TestReplicationBase.tableName));
} finally {
adminExt.removePeerTableCFs(peerId, adminExt.getPeerTableCFs(peerId));
- admin1.disableTableReplication(tableName);
+ admin1.disableTableReplication(TestReplicationBase.tableName);
}
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/constraint/TestConstraints.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/constraint/TestConstraints.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/constraint/TestConstraints.java
index afd55bb..acc3fca 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/constraint/TestConstraints.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/constraint/TestConstraints.java
@@ -33,19 +33,23 @@ import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.constraint.TestConstraint.CheckWasRunConstraint;
import org.apache.hadoop.hbase.constraint.WorksConstraint.NameConstraint;
import org.apache.hadoop.hbase.util.Pair;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
/**
* Test reading/writing the constraints into the {@link HTableDescriptor}
*/
@Category({MiscTests.class, SmallTests.class})
public class TestConstraints {
+ @Rule
+ public TestName name = new TestName();
@SuppressWarnings("unchecked")
@Test
public void testSimpleReadWrite() throws Throwable {
- HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("table"));
+ HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(name.getMethodName()));
Constraints.add(desc, WorksConstraint.class);
List<? extends Constraint> constraints = Constraints.getConstraints(desc,
@@ -70,7 +74,7 @@ public class TestConstraints {
@SuppressWarnings("unchecked")
@Test
public void testReadWriteWithConf() throws Throwable {
- HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("table"));
+ HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(name.getMethodName()));
Constraints.add(
desc,
new Pair<Class<? extends Constraint>, Configuration>(
@@ -103,7 +107,7 @@ public class TestConstraints {
@SuppressWarnings("unchecked")
@Test
public void testEnableDisableRemove() throws Exception {
- HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("table"));
+ HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(name.getMethodName()));
// check general enabling/disabling of constraints
// first add a constraint
Constraints.add(desc, AllPassConstraint.class);
@@ -139,7 +143,7 @@ public class TestConstraints {
@SuppressWarnings("unchecked")
@Test
public void testUpdateConstraint() throws Exception {
- HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("table"));
+ HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(name.getMethodName()));
Constraints.add(desc, CheckConfigurationConstraint.class,
CheckWasRunConstraint.class);
Constraints.setConfiguration(desc, CheckConfigurationConstraint.class,
@@ -165,7 +169,7 @@ public class TestConstraints {
*/
@Test
public void testRemoveUnsetConstraint() throws Throwable {
- HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("table"));
+ HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(name.getMethodName()));
Constraints.remove(desc);
Constraints.remove(desc, AlsoWorks.class);
}
@@ -175,7 +179,7 @@ public class TestConstraints {
Configuration conf = new Configuration();
conf.setBoolean("_ENABLED", false);
conf.setLong("_PRIORITY", 10);
- HTableDescriptor desc = new HTableDescriptor(TableName.valueOf("table"));
+ HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(name.getMethodName()));
Constraints.add(desc, AlsoWorks.class, conf);
Constraints.add(desc, WorksConstraint.class);
assertFalse(Constraints.enabled(desc, AlsoWorks.class));
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorMetrics.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorMetrics.java
index 50e97ba..2b21a2c 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorMetrics.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestCoprocessorMetrics.java
@@ -67,6 +67,7 @@ import org.apache.hadoop.hbase.util.Bytes;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -74,6 +75,7 @@ import com.google.common.collect.Lists;
import com.google.protobuf.RpcCallback;
import com.google.protobuf.RpcController;
import com.google.protobuf.ServiceException;
+import org.junit.rules.TestName;
/**
* Testing of coprocessor metrics end-to-end.
@@ -86,6 +88,10 @@ public class TestCoprocessorMetrics {
private static final byte[] foo = Bytes.toBytes("foo");
private static final byte[] bar = Bytes.toBytes("bar");
+
+ @Rule
+ public TestName name = new TestName();
+
/**
* MasterObserver that has a Timer metric for create table operation.
*/
@@ -289,7 +295,7 @@ public class TestCoprocessorMetrics {
long prevCount = createTableTimer.getHistogram().getCount();
LOG.info("Creating table");
admin.createTable(
- new HTableDescriptor("testMasterObserver")
+ new HTableDescriptor(TableName.valueOf(name.getMethodName()))
.addFamily(new HColumnDescriptor("foo")));
assertEquals(1, createTableTimer.getHistogram().getCount() - prevCount);
@@ -333,14 +339,14 @@ public class TestCoprocessorMetrics {
try (Connection connection = ConnectionFactory.createConnection(UTIL.getConfiguration());
Admin admin = connection.getAdmin()) {
admin.createTable(
- new HTableDescriptor("testWALObserver")
+ new HTableDescriptor(TableName.valueOf(name.getMethodName()))
.addFamily(new HColumnDescriptor("foo")));
Counter rollWalRequests = (Counter)metric.get();
long prevCount = rollWalRequests.getCount();
assertTrue(prevCount > 0);
- try (Table table = connection.getTable(TableName.valueOf("testWALObserver"))) {
+ try (Table table = connection.getTable(TableName.valueOf(name.getMethodName()))) {
table.put(new Put(foo).addColumn(foo, foo, foo));
}
@@ -368,7 +374,7 @@ public class TestCoprocessorMetrics {
@Test
public void testRegionObserverSingleRegion() throws IOException {
- TableName tableName = TableName.valueOf("testRegionObserverSingleRegion");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
try (Connection connection = ConnectionFactory.createConnection(UTIL.getConfiguration());
Admin admin = connection.getAdmin()) {
admin.createTable(
@@ -387,7 +393,7 @@ public class TestCoprocessorMetrics {
@Test
public void testRegionObserverMultiRegion() throws IOException {
- TableName tableName = TableName.valueOf("testRegionObserverMultiRegion");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
try (Connection connection = ConnectionFactory.createConnection(UTIL.getConfiguration());
Admin admin = connection.getAdmin()) {
admin.createTable(
@@ -411,8 +417,8 @@ public class TestCoprocessorMetrics {
@Test
public void testRegionObserverMultiTable() throws IOException {
- TableName tableName1 = TableName.valueOf("testRegionObserverMultiTable1");
- TableName tableName2 = TableName.valueOf("testRegionObserverMultiTable2");
+ final TableName tableName1 = TableName.valueOf(name.getMethodName() + "1");
+ final TableName tableName2 = TableName.valueOf(name.getMethodName() + "2");
try (Connection connection = ConnectionFactory.createConnection(UTIL.getConfiguration());
Admin admin = connection.getAdmin()) {
admin.createTable(
@@ -426,7 +432,7 @@ public class TestCoprocessorMetrics {
// add the coprocessor for the region
.addCoprocessor(CustomRegionObserver.class.getName()));
try (Table table1 = connection.getTable(tableName1);
- Table table2 = connection.getTable(tableName2);) {
+ Table table2 = connection.getTable(tableName2)) {
table1.get(new Get(bar));
table2.get(new Get(foo)); // 2 gets to 2 separate tables
}
@@ -436,7 +442,7 @@ public class TestCoprocessorMetrics {
@Test
public void testRegionObserverMultiCoprocessor() throws IOException {
- TableName tableName = TableName.valueOf("testRegionObserverMultiCoprocessor");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
try (Connection connection = ConnectionFactory.createConnection(UTIL.getConfiguration());
Admin admin = connection.getAdmin()) {
admin.createTable(
@@ -458,7 +464,7 @@ public class TestCoprocessorMetrics {
@Test
public void testRegionObserverAfterRegionClosed() throws IOException {
- TableName tableName = TableName.valueOf("testRegionObserverAfterRegionClosed");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
try (Connection connection = ConnectionFactory.createConnection(UTIL.getConfiguration());
Admin admin = connection.getAdmin()) {
admin.createTable(
@@ -502,7 +508,7 @@ public class TestCoprocessorMetrics {
@Test
public void testRegionObserverEndpoint() throws IOException, ServiceException {
- TableName tableName = TableName.valueOf("testRegionObserverEndpoint");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
try (Connection connection = ConnectionFactory.createConnection(UTIL.getConfiguration());
Admin admin = connection.getAdmin()) {
admin.createTable(
http://git-wip-us.apache.org/repos/asf/hbase/blob/55c2e2d4/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
index 20d48bc..94cefcf 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestRegionObserverInterface.java
@@ -81,8 +81,10 @@ import org.apache.hadoop.hbase.util.JVMClusterUtil;
import org.apache.hadoop.hbase.util.Threads;
import org.junit.AfterClass;
import org.junit.BeforeClass;
+import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
@Category({ CoprocessorTests.class, MediumTests.class })
public class TestRegionObserverInterface {
@@ -97,6 +99,9 @@ public class TestRegionObserverInterface {
private static HBaseTestingUtility util = new HBaseTestingUtility();
private static MiniHBaseCluster cluster = null;
+ @Rule
+ public TestName name = new TestName();
+
@BeforeClass
public static void setupBeforeClass() throws Exception {
// set configure to indicate which cp should be loaded
@@ -116,7 +121,7 @@ public class TestRegionObserverInterface {
@Test(timeout = 300000)
public void testRegionObserver() throws IOException {
- TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + ".testRegionObserver");
+ final TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + "." + name.getMethodName());
// recreate table every time in order to reset the status of the
// coprocessor.
Table table = util.createTable(tableName, new byte[][] { A, B, C });
@@ -176,7 +181,7 @@ public class TestRegionObserverInterface {
@Test(timeout = 300000)
public void testRowMutation() throws IOException {
- TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + ".testRowMutation");
+ final TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + "." + name.getMethodName());
Table table = util.createTable(tableName, new byte[][] { A, B, C });
try {
verifyMethodResult(SimpleRegionObserver.class,
@@ -208,7 +213,7 @@ public class TestRegionObserverInterface {
@Test(timeout = 300000)
public void testIncrementHook() throws IOException {
- TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + ".testIncrementHook");
+ final TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + "." + name.getMethodName());
Table table = util.createTable(tableName, new byte[][] { A, B, C });
try {
Increment inc = new Increment(Bytes.toBytes(0));
@@ -231,7 +236,7 @@ public class TestRegionObserverInterface {
@Test(timeout = 300000)
public void testCheckAndPutHooks() throws IOException {
- TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + ".testCheckAndPutHooks");
+ final TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + "." + name.getMethodName());
try (Table table = util.createTable(tableName, new byte[][] { A, B, C })) {
Put p = new Put(Bytes.toBytes(0));
p.addColumn(A, A, A);
@@ -252,8 +257,7 @@ public class TestRegionObserverInterface {
@Test(timeout = 300000)
public void testCheckAndDeleteHooks() throws IOException {
- TableName tableName =
- TableName.valueOf(TEST_TABLE.getNameAsString() + ".testCheckAndDeleteHooks");
+ final TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + "." + name.getMethodName());
Table table = util.createTable(tableName, new byte[][] { A, B, C });
try {
Put p = new Put(Bytes.toBytes(0));
@@ -278,7 +282,7 @@ public class TestRegionObserverInterface {
@Test(timeout = 300000)
public void testAppendHook() throws IOException {
- TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + ".testAppendHook");
+ final TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + "." + name.getMethodName());
Table table = util.createTable(tableName, new byte[][] { A, B, C });
try {
Append app = new Append(Bytes.toBytes(0));
@@ -302,7 +306,7 @@ public class TestRegionObserverInterface {
@Test(timeout = 300000)
// HBase-3583
public void testHBase3583() throws IOException {
- TableName tableName = TableName.valueOf("testHBase3583");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
util.createTable(tableName, new byte[][] { A, B, C });
util.waitUntilAllRegionsAssigned(tableName);
@@ -344,7 +348,7 @@ public class TestRegionObserverInterface {
@Test(timeout = 300000)
public void testHBASE14489() throws IOException {
- TableName tableName = TableName.valueOf("testHBASE14489");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
Table table = util.createTable(tableName, new byte[][] { A });
Put put = new Put(ROW);
put.addColumn(A, A, A);
@@ -369,7 +373,7 @@ public class TestRegionObserverInterface {
@Test(timeout = 300000)
// HBase-3758
public void testHBase3758() throws IOException {
- TableName tableName = TableName.valueOf("testHBase3758");
+ final TableName tableName = TableName.valueOf(name.getMethodName());
util.createTable(tableName, new byte[][] { A, B, C });
verifyMethodResult(SimpleRegionObserver.class,
@@ -466,7 +470,7 @@ public class TestRegionObserverInterface {
*/
@Test(timeout = 300000)
public void testCompactionOverride() throws Exception {
- TableName compactTable = TableName.valueOf("TestCompactionOverride");
+ final TableName compactTable = TableName.valueOf(name.getMethodName());
Admin admin = util.getAdmin();
if (admin.tableExists(compactTable)) {
admin.disableTable(compactTable);
@@ -537,8 +541,8 @@ public class TestRegionObserverInterface {
@Test(timeout = 300000)
public void bulkLoadHFileTest() throws Exception {
- String testName = TestRegionObserverInterface.class.getName() + ".bulkLoadHFileTest";
- TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + ".bulkLoadHFileTest");
+ final String testName = TestRegionObserverInterface.class.getName() + "." + name.getMethodName();
+ final TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + "." + name.getMethodName());
Configuration conf = util.getConfiguration();
Table table = util.createTable(tableName, new byte[][] { A, B, C });
try (RegionLocator locator = util.getConnection().getRegionLocator(tableName)) {
@@ -566,8 +570,8 @@ public class TestRegionObserverInterface {
@Test(timeout = 300000)
public void testRecovery() throws Exception {
- LOG.info(TestRegionObserverInterface.class.getName() + ".testRecovery");
- TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + ".testRecovery");
+ LOG.info(TestRegionObserverInterface.class.getName() + "." + name.getMethodName());
+ final TableName tableName = TableName.valueOf(TEST_TABLE.getNameAsString() + "." + name.getMethodName());
Table table = util.createTable(tableName, new byte[][] { A, B, C });
try (RegionLocator locator = util.getConnection().getRegionLocator(tableName)) {
@@ -616,7 +620,7 @@ public class TestRegionObserverInterface {
@Test(timeout = 300000)
public void testPreWALRestoreSkip() throws Exception {
- LOG.info(TestRegionObserverInterface.class.getName() + ".testPreWALRestoreSkip");
+ LOG.info(TestRegionObserverInterface.class.getName() + "." + name.getMethodName());
TableName tableName = TableName.valueOf(SimpleRegionObserver.TABLE_SKIPPED);
Table table = util.createTable(tableName, new byte[][] { A, B, C });