This is an automated email from the ASF dual-hosted git repository.
Apache9 pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push:
new 6cc7ba60fd9 HBASE-30190 Addendum remove junit4 references in
hbase-server (#8316)
6cc7ba60fd9 is described below
commit 6cc7ba60fd9861a23d53901f9c6056d7918ffe21
Author: Duo Zhang <[email protected]>
AuthorDate: Sat Jun 6 10:00:58 2026 +0800
HBASE-30190 Addendum remove junit4 references in hbase-server (#8316)
---
.../TestPassCustomCellViaRegionObserver.java | 61 +++++++++-----------
.../favored/TestFavoredNodeAssignmentHelper.java | 20 +++----
.../TestFirstKeyValueMatchingQualifiersFilter.java | 25 ++++----
.../hbase/master/TestMasterNotCarryTable.java | 23 +++-----
.../master/TestMirroringTableStateManager.java | 31 ++++------
.../apache/hadoop/hbase/master/TestRegionPlan.java | 40 ++++++-------
.../hadoop/hbase/master/TestTableStateManager.java | 35 +++++-------
.../balancer/TestCacheAwareLoadBalancer.java | 2 +-
...terBalancingConditionalReplicaDistribution.java | 17 ++----
...estLargeClusterBalancingMetaTableIsolation.java | 17 ++----
...tLargeClusterBalancingSystemTableIsolation.java | 17 ++----
...ancingTableIsolationAndReplicaDistribution.java | 17 ++----
.../master/balancer/TestRegionLocationFinder.java | 31 +++++-----
.../balancer/TestRegionsOnMasterOptions.java | 45 +++++++--------
.../hbase/master/balancer/TestServerAndLoad.java | 17 ++----
.../TestStoreFileTableSkewCostFunction.java | 25 ++++----
.../balancer/TestUnattainableBalancerCostGoal.java | 17 ++----
.../hbase/master/cleaner/TestLogsCleaner.java | 6 +-
.../hadoop/hbase/mob/MobStressToolRunner.java | 4 +-
.../hadoop/hbase/protobuf/TestProtobufUtil.java | 17 ++----
.../AbstractTestDateTieredCompactionPolicy.java | 2 +-
.../hbase/regionserver/TestShortCircuitGet.java | 43 ++++++--------
.../hadoop/hbase/regionserver/TestWALLockup.java | 48 +++++++---------
.../hbase/regionserver/wal/TestWALOpenError.java | 53 ++++++++---------
.../replication/master/TestTableCFsUpdater.java | 43 +++++++-------
.../hadoop/hbase/util/HFileArchiveTestingUtil.java | 8 +--
.../apache/hadoop/hbase/util/HFileTestUtil.java | 6 +-
.../hadoop/hbase/util/TestServerHttpUtils.java | 2 +-
.../hadoop/hbase/util/hbck/HbckTestingUtil.java | 2 +-
.../wal/TestBoundedRegionGroupingStrategy.java | 66 ++++++++++------------
30 files changed, 310 insertions(+), 430 deletions(-)
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestPassCustomCellViaRegionObserver.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestPassCustomCellViaRegionObserver.java
index 1e939b0c4e6..6ea6836878c 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestPassCustomCellViaRegionObserver.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/coprocessor/TestPassCustomCellViaRegionObserver.java
@@ -17,9 +17,9 @@
*/
package org.apache.hadoop.hbase.coprocessor;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.nio.ByteBuffer;
@@ -32,7 +32,6 @@ import java.util.stream.IntStream;
import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellUtil;
import org.apache.hadoop.hbase.CompareOperator;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValueUtil;
@@ -53,25 +52,17 @@ import
org.apache.hadoop.hbase.testclassification.CoprocessorTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.wal.WALEdit;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
-
-@Category({ CoprocessorTests.class, MediumTests.class })
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
+
+@Tag(CoprocessorTests.TAG)
+@Tag(MediumTests.TAG)
public class TestPassCustomCellViaRegionObserver {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestPassCustomCellViaRegionObserver.class);
-
- @Rule
- public TestName testName = new TestName();
-
private TableName tableName;
private Table table = null;
@@ -85,22 +76,22 @@ public class TestPassCustomCellViaRegionObserver {
private static final byte[] QUALIFIER_FROM_CP =
Bytes.toBytes("QUALIFIER_FROM_CP");
- @BeforeClass
+ @BeforeAll
public static void setupBeforeClass() throws Exception {
// small retry number can speed up the failed tests.
UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2);
UTIL.startMiniCluster();
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
UTIL.shutdownMiniCluster();
}
- @Before
- public void clearTable() throws IOException {
+ @BeforeEach
+ public void clearTable(TestInfo testInfo) throws IOException {
RegionObserverImpl.COUNT.set(0);
- tableName = TableName.valueOf(testName.getMethodName());
+ tableName = TableName.valueOf(testInfo.getTestMethod().get().getName());
if (table != null) {
table.close();
}
@@ -149,8 +140,8 @@ public class TestPassCustomCellViaRegionObserver {
Delete delete = new Delete(ROW);
delete.addColumns(FAMILY, QUALIFIER);
table.delete(delete);
- assertTrue(Arrays.asList(table.get(new Get(ROW)).rawCells()).toString(),
- table.get(new Get(ROW)).isEmpty());
+ assertTrue(table.get(new Get(ROW)).isEmpty(),
+ Arrays.asList(table.get(new Get(ROW)).rawCells()).toString());
assertObserverHasExecuted();
assertTrue(table.checkAndPut(ROW, FAMILY, QUALIFIER, null, put));
@@ -186,21 +177,21 @@ public class TestPassCustomCellViaRegionObserver {
private static void assertResult(Result result, byte[] expectedValue) {
assertFalse(result.isEmpty());
for (Cell c : result.rawCells()) {
- assertTrue(c.toString(), Bytes.equals(ROW, CellUtil.cloneRow(c)));
- assertTrue(c.toString(), Bytes.equals(FAMILY, CellUtil.cloneFamily(c)));
- assertTrue(c.toString(), Bytes.equals(expectedValue,
CellUtil.cloneValue(c)));
+ assertTrue(Bytes.equals(ROW, CellUtil.cloneRow(c)), c.toString());
+ assertTrue(Bytes.equals(FAMILY, CellUtil.cloneFamily(c)), c.toString());
+ assertTrue(Bytes.equals(expectedValue, CellUtil.cloneValue(c)),
c.toString());
}
}
private static void assertResult(Result result, byte[] expectedValue, byte[]
expectedFromCp) {
assertFalse(result.isEmpty());
for (Cell c : result.rawCells()) {
- assertTrue(c.toString(), Bytes.equals(ROW, CellUtil.cloneRow(c)));
- assertTrue(c.toString(), Bytes.equals(FAMILY, CellUtil.cloneFamily(c)));
+ assertTrue(Bytes.equals(ROW, CellUtil.cloneRow(c)), c.toString());
+ assertTrue(Bytes.equals(FAMILY, CellUtil.cloneFamily(c)), c.toString());
if (Bytes.equals(QUALIFIER, CellUtil.cloneQualifier(c))) {
- assertTrue(c.toString(), Bytes.equals(expectedValue,
CellUtil.cloneValue(c)));
+ assertTrue(Bytes.equals(expectedValue, CellUtil.cloneValue(c)),
c.toString());
} else if (Bytes.equals(QUALIFIER_FROM_CP, CellUtil.cloneQualifier(c))) {
- assertTrue(c.toString(), Bytes.equals(expectedFromCp,
CellUtil.cloneValue(c)));
+ assertTrue(Bytes.equals(expectedFromCp, CellUtil.cloneValue(c)),
c.toString());
} else {
fail("No valid qualifier");
}
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/favored/TestFavoredNodeAssignmentHelper.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/favored/TestFavoredNodeAssignmentHelper.java
index 18d7cc6f8b1..76da67df95d 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/favored/TestFavoredNodeAssignmentHelper.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/favored/TestFavoredNodeAssignmentHelper.java
@@ -36,6 +36,7 @@ import java.util.TreeMap;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.TableNameTestExtension;
import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.RegionInfoBuilder;
import org.apache.hadoop.hbase.master.RackManager;
@@ -44,11 +45,10 @@ import
org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.hbase.util.Triple;
-import org.junit.BeforeClass;
-import org.junit.Rule;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
import org.mockito.Mockito;
import org.apache.hbase.thirdparty.com.google.common.collect.Lists;
@@ -65,8 +65,8 @@ public class TestFavoredNodeAssignmentHelper {
// Some tests have randomness, so we run them multiple times
private static final int MAX_ATTEMPTS = 100;
- @Rule
- public TestName name = new TestName();
+ @RegisterExtension
+ private final TableNameTestExtension tableNameExt = new
TableNameTestExtension();
private static String getRack(int index) {
if (index < 10) {
@@ -80,7 +80,7 @@ public class TestFavoredNodeAssignmentHelper {
}
}
- @BeforeClass
+ @BeforeAll
public static void setupBeforeClass() throws Exception {
// Set up some server -> rack mappings
// Have three racks in the cluster with 10 hosts each.
@@ -296,7 +296,7 @@ public class TestFavoredNodeAssignmentHelper {
// create regions
List<RegionInfo> regions = new ArrayList<>(regionCount);
for (int i = 0; i < regionCount; i++) {
-
regions.add(RegionInfoBuilder.newBuilder(TableName.valueOf(name.getMethodName()))
+ regions.add(RegionInfoBuilder.newBuilder(tableNameExt.getTableName())
.setStartKey(Bytes.toBytes(i)).setEndKey(Bytes.toBytes(i +
1)).build());
}
// place the regions
@@ -390,7 +390,7 @@ public class TestFavoredNodeAssignmentHelper {
List<RegionInfo> regions = new ArrayList<>(20);
for (int i = 0; i < 20; i++) {
-
regions.add(RegionInfoBuilder.newBuilder(TableName.valueOf(name.getMethodName()))
+ regions.add(RegionInfoBuilder.newBuilder(tableNameExt.getTableName())
.setStartKey(Bytes.toBytes(i)).setEndKey(Bytes.toBytes(i +
1)).build());
}
Map<ServerName, List<RegionInfo>> assignmentMap = new HashMap<ServerName,
List<RegionInfo>>();
@@ -532,7 +532,7 @@ public class TestFavoredNodeAssignmentHelper {
helper.initialize();
assertTrue(helper.canPlaceFavoredNodes());
- RegionInfo region =
RegionInfoBuilder.newBuilder(TableName.valueOf(name.getMethodName()))
+ RegionInfo region =
RegionInfoBuilder.newBuilder(tableNameExt.getTableName())
.setStartKey(HConstants.EMPTY_START_ROW).setEndKey(HConstants.EMPTY_END_ROW).build();
for (int maxattempts = 0; maxattempts < MAX_ATTEMPTS; maxattempts++) {
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFirstKeyValueMatchingQualifiersFilter.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFirstKeyValueMatchingQualifiersFilter.java
index dcad0e50328..a3547f940cf 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFirstKeyValueMatchingQualifiersFilter.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/filter/TestFirstKeyValueMatchingQualifiersFilter.java
@@ -17,26 +17,22 @@
*/
package org.apache.hadoop.hbase.filter;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Set;
import java.util.TreeSet;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.testclassification.FilterTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.ClassRule;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
@SuppressWarnings("deprecation")
-@Category({ FilterTests.class, SmallTests.class })
+@Tag(FilterTests.TAG)
+@Tag(SmallTests.TAG)
public class TestFirstKeyValueMatchingQualifiersFilter {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
-
HBaseClassTestRule.forClass(TestFirstKeyValueMatchingQualifiersFilter.class);
-
private static final byte[] ROW = Bytes.toBytes("test");
private static final byte[] COLUMN_FAMILY = Bytes.toBytes("test");
private static final byte[] COLUMN_QUALIFIER_1 = Bytes.toBytes("foo");
@@ -48,6 +44,7 @@ public class TestFirstKeyValueMatchingQualifiersFilter {
* Test the functionality of
* {@link
FirstKeyValueMatchingQualifiersFilter#filterCell(org.apache.hadoop.hbase.Cell)}
*/
+ @Test
public void testFirstKeyMatchingQualifierFilter() throws Exception {
Set<byte[]> quals = new TreeSet<>(Bytes.BYTES_COMPARATOR);
quals.add(COLUMN_QUALIFIER_1);
@@ -57,19 +54,19 @@ public class TestFirstKeyValueMatchingQualifiersFilter {
// Match in first attempt
KeyValue cell;
cell = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER_1, VAL_1);
- assertTrue("includeAndSetFlag", filter.filterCell(cell) ==
Filter.ReturnCode.INCLUDE);
+ assertTrue(filter.filterCell(cell) == Filter.ReturnCode.INCLUDE,
"includeAndSetFlag");
cell = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER_2, VAL_1);
- assertTrue("flagIsSetSkipToNextRow", filter.filterCell(cell) ==
Filter.ReturnCode.NEXT_ROW);
+ assertTrue(filter.filterCell(cell) == Filter.ReturnCode.NEXT_ROW,
"flagIsSetSkipToNextRow");
// A mismatch in first attempt and match in second attempt.
filter.reset();
cell = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER_3, VAL_1);
System.out.println(filter.filterCell(cell));
- assertTrue("includeFlagIsUnset", filter.filterCell(cell) ==
Filter.ReturnCode.INCLUDE);
+ assertTrue(filter.filterCell(cell) == Filter.ReturnCode.INCLUDE,
"includeFlagIsUnset");
cell = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER_2, VAL_1);
- assertTrue("includeAndSetFlag", filter.filterCell(cell) ==
Filter.ReturnCode.INCLUDE);
+ assertTrue(filter.filterCell(cell) == Filter.ReturnCode.INCLUDE,
"includeAndSetFlag");
cell = new KeyValue(ROW, COLUMN_FAMILY, COLUMN_QUALIFIER_1, VAL_1);
- assertTrue("flagIsSetSkipToNextRow", filter.filterCell(cell) ==
Filter.ReturnCode.NEXT_ROW);
+ assertTrue(filter.filterCell(cell) == Filter.ReturnCode.NEXT_ROW,
"flagIsSetSkipToNextRow");
}
}
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNotCarryTable.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNotCarryTable.java
index 35969c54afc..e683e984ad2 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNotCarryTable.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterNotCarryTable.java
@@ -17,36 +17,31 @@
*/
package org.apache.hadoop.hbase.master;
-import static org.junit.Assert.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.testclassification.MasterTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.CommonFSUtils;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Category({ MasterTests.class, MediumTests.class })
+@Tag(MasterTests.TAG)
+@Tag(MediumTests.TAG)
public class TestMasterNotCarryTable {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestMasterNotCarryTable.class);
-
private static final Logger LOG =
LoggerFactory.getLogger(TestMasterNotCarryTable.class);
private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
private static HMaster master;
- @BeforeClass
+ @BeforeAll
public static void setUp() throws Exception {
Configuration c = UTIL.getConfiguration();
// We use local filesystem. Set it so it writes into the testdir.
@@ -61,7 +56,7 @@ public class TestMasterNotCarryTable {
}
}
- @AfterClass
+ @AfterAll
public static void tearDown() throws Exception {
master.stop("Shutdown");
UTIL.shutdownMiniZKCluster();
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMirroringTableStateManager.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMirroringTableStateManager.java
index 454a22eab2b..961fb70ee1b 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMirroringTableStateManager.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMirroringTableStateManager.java
@@ -17,10 +17,9 @@
*/
package org.apache.hadoop.hbase.master;
-import static junit.framework.TestCase.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.TableName;
@@ -32,13 +31,11 @@ import org.apache.hadoop.hbase.zookeeper.ZKUtil;
import org.apache.hadoop.hbase.zookeeper.ZKWatcher;
import org.apache.hadoop.hbase.zookeeper.ZNodePaths;
import org.apache.zookeeper.KeeperException;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil;
import org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos;
@@ -47,29 +44,25 @@ import
org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos;
* Tests that table state is mirrored out to zookeeper for hbase-1.x clients.
Also tests that table
* state gets migrated from zookeeper on master start.
*/
-@Category({ MasterTests.class, LargeTests.class })
+@Tag(MasterTests.TAG)
+@Tag(LargeTests.TAG)
public class TestMirroringTableStateManager {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestMirroringTableStateManager.class);
- @Rule
- public TestName name = new TestName();
private final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
- @Before
+ @BeforeEach
public void before() throws Exception {
TEST_UTIL.startMiniCluster();
}
- @After
+ @AfterEach
public void after() throws Exception {
TEST_UTIL.shutdownMiniCluster();
}
@Test
- public void testMirroring() throws Exception {
- final TableName tableName = TableName.valueOf(name.getMethodName());
+ public void testMirroring(TestInfo testInfo) throws Exception {
+ final TableName tableName =
TableName.valueOf(testInfo.getTestMethod().get().getName());
TEST_UTIL.createTable(tableName, HConstants.CATALOG_FAMILY_STR);
ZKWatcher zkw = TEST_UTIL.getZooKeeperWatcher();
assertTrue(TableState.State.ENABLED.equals(getTableStateInZK(zkw,
tableName)));
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlan.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlan.java
index c65198b825b..64e83367bb5 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlan.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestRegionPlan.java
@@ -17,39 +17,34 @@
*/
package org.apache.hadoop.hbase.master;
-import static junit.framework.TestCase.assertFalse;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.ServerName;
-import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.TableNameTestExtension;
import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.RegionInfoBuilder;
import org.apache.hadoop.hbase.testclassification.MasterTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
-@Category({ MasterTests.class, SmallTests.class })
+@Tag(MasterTests.TAG)
+@Tag(SmallTests.TAG)
public class TestRegionPlan {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestRegionPlan.class);
-
private final ServerName SRC = ServerName.valueOf("source", 1234, 2345);
private final ServerName DEST = ServerName.valueOf("dest", 1234, 2345);
- @Rule
- public TestName name = new TestName();
+
+ @RegisterExtension
+ private final TableNameTestExtension tableNameExt = new
TableNameTestExtension();
@Test
public void testCompareTo() {
- RegionInfo hri =
RegionInfoBuilder.newBuilder(TableName.valueOf(name.getMethodName())).build();
+ RegionInfo hri =
RegionInfoBuilder.newBuilder(tableNameExt.getTableName()).build();
RegionPlan a = new RegionPlan(hri, null, null);
RegionPlan b = new RegionPlan(hri, null, null);
assertEquals(0, a.compareTo(b));
@@ -72,7 +67,7 @@ public class TestRegionPlan {
@Test
public void testEqualsWithNulls() {
- RegionInfo hri =
RegionInfoBuilder.newBuilder(TableName.valueOf(name.getMethodName())).build();
+ RegionInfo hri =
RegionInfoBuilder.newBuilder(tableNameExt.getTableName()).build();
RegionPlan a = new RegionPlan(hri, null, null);
RegionPlan b = new RegionPlan(hri, null, null);
assertTrue(a.equals(b));
@@ -89,7 +84,7 @@ public class TestRegionPlan {
@Test
public void testEquals() {
- RegionInfo hri =
RegionInfoBuilder.newBuilder(TableName.valueOf(name.getMethodName())).build();
+ RegionInfo hri =
RegionInfoBuilder.newBuilder(tableNameExt.getTableName()).build();
// Identity equality
RegionPlan plan = new RegionPlan(hri, SRC, DEST);
@@ -97,8 +92,7 @@ public class TestRegionPlan {
assertEquals(plan, new RegionPlan(hri, SRC, DEST));
// HRI is used for equality
- RegionInfo other =
- RegionInfoBuilder.newBuilder(TableName.valueOf(name.getMethodName() +
"other")).build();
+ RegionInfo other =
RegionInfoBuilder.newBuilder(tableNameExt.getTableName("other")).build();
assertNotEquals(plan.hashCode(), new RegionPlan(other, SRC,
DEST).hashCode());
assertNotEquals(plan, new RegionPlan(other, SRC, DEST));
}
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestTableStateManager.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestTableStateManager.java
index 8bfe0464509..4c89dbcc9f2 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestTableStateManager.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestTableStateManager.java
@@ -17,9 +17,8 @@
*/
package org.apache.hadoop.hbase.master;
-import static junit.framework.TestCase.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.MetaTableAccessor;
@@ -29,49 +28,41 @@ import
org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.testclassification.MasterTests;
import org.apache.hadoop.hbase.util.JVMClusterUtil;
import org.apache.hadoop.hbase.util.Threads;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
/**
* Tests the default table lock manager
*/
-@Category({ MasterTests.class, LargeTests.class })
+@Tag(MasterTests.TAG)
+@Tag(LargeTests.TAG)
public class TestTableStateManager {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestTableStateManager.class);
-
private final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
- @Rule
- public TestName name = new TestName();
-
- @Before
+ @BeforeEach
public void before() throws Exception {
TEST_UTIL.startMiniCluster();
}
- @After
+ @AfterEach
public void after() throws Exception {
TEST_UTIL.shutdownMiniCluster();
}
@Test
- public void testMigration() throws Exception {
- final TableName tableName = TableName.valueOf(name.getMethodName());
+ public void testMigration(TestInfo testInfo) throws Exception {
+ final TableName tableName =
TableName.valueOf(testInfo.getTestMethod().get().getName());
TEST_UTIL.createTable(tableName, HConstants.CATALOG_FAMILY_STR);
TEST_UTIL.getAdmin().disableTable(tableName);
// Table is disabled. Now remove the DISABLED column from the hbase:meta
for this table's
// region. We want to see if Master will read the DISABLED from zk and
make use of it as
// though it were reading the zk table state written by a hbase-1.x
cluster.
TableState state =
MetaTableAccessor.getTableState(TEST_UTIL.getConnection(), tableName);
- assertTrue("State=" + state,
state.getState().equals(TableState.State.DISABLED));
+ assertTrue(state.getState().equals(TableState.State.DISABLED), "State=" +
state);
MetaTableAccessor.deleteTableState(TEST_UTIL.getConnection(), tableName);
assertTrue(MetaTableAccessor.getTableState(TEST_UTIL.getConnection(),
tableName) == null);
// Now kill Master so a new one can come up and run through the zk
migration.
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestCacheAwareLoadBalancer.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestCacheAwareLoadBalancer.java
index 4e0232417d4..a6b92da2440 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestCacheAwareLoadBalancer.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestCacheAwareLoadBalancer.java
@@ -17,9 +17,9 @@
*/
package org.apache.hadoop.hbase.master.balancer;
-import static org.junit.Assert.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingConditionalReplicaDistribution.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingConditionalReplicaDistribution.java
index 08d5cdb6b58..94bc8898e6a 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingConditionalReplicaDistribution.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingConditionalReplicaDistribution.java
@@ -24,7 +24,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.RegionInfo;
@@ -35,22 +34,18 @@ import
org.apache.hadoop.hbase.testclassification.MasterTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.net.DNSToSwitchMapping;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableSet;
-@Category({ MediumTests.class, MasterTests.class })
+@Tag(MediumTests.TAG)
+@Tag(MasterTests.TAG)
public class TestLargeClusterBalancingConditionalReplicaDistribution {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
-
HBaseClassTestRule.forClass(TestLargeClusterBalancingConditionalReplicaDistribution.class);
-
private static final Logger LOG =
LoggerFactory.getLogger(TestLargeClusterBalancingConditionalReplicaDistribution.class);
@@ -62,7 +57,7 @@ public class
TestLargeClusterBalancingConditionalReplicaDistribution {
private static final ServerName[] servers = new ServerName[NUM_SERVERS];
private static final Map<ServerName, List<RegionInfo>> serverToRegions = new
HashMap<>();
- @BeforeClass
+ @BeforeAll
public static void setup() {
// Initialize servers
for (int i = 0; i < NUM_SERVERS; i++) {
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingMetaTableIsolation.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingMetaTableIsolation.java
index 3bf02dd634e..9d5754ee483 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingMetaTableIsolation.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingMetaTableIsolation.java
@@ -25,7 +25,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.RegionInfo;
@@ -34,22 +33,18 @@ import
org.apache.hadoop.hbase.master.balancer.BalancerTestBase.MockMapping;
import org.apache.hadoop.hbase.testclassification.MasterTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.net.DNSToSwitchMapping;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableSet;
-@Category({ MediumTests.class, MasterTests.class })
+@Tag(MasterTests.TAG)
+@Tag(MediumTests.TAG)
public class TestLargeClusterBalancingMetaTableIsolation {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
-
HBaseClassTestRule.forClass(TestLargeClusterBalancingMetaTableIsolation.class);
-
private static final Logger LOG =
LoggerFactory.getLogger(TestLargeClusterBalancingMetaTableIsolation.class);
@@ -61,7 +56,7 @@ public class TestLargeClusterBalancingMetaTableIsolation {
private static final ServerName[] servers = new ServerName[NUM_SERVERS];
private static final Map<ServerName, List<RegionInfo>> serverToRegions = new
HashMap<>();
- @BeforeClass
+ @BeforeAll
public static void setup() {
// Initialize servers
for (int i = 0; i < NUM_SERVERS; i++) {
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingSystemTableIsolation.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingSystemTableIsolation.java
index 8f640b5b310..084764592ba 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingSystemTableIsolation.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingSystemTableIsolation.java
@@ -25,7 +25,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.RegionInfo;
@@ -34,22 +33,18 @@ import
org.apache.hadoop.hbase.master.balancer.BalancerTestBase.MockMapping;
import org.apache.hadoop.hbase.testclassification.MasterTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.net.DNSToSwitchMapping;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableSet;
-@Category({ MediumTests.class, MasterTests.class })
+@Tag(MasterTests.TAG)
+@Tag(MediumTests.TAG)
public class TestLargeClusterBalancingSystemTableIsolation {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
-
HBaseClassTestRule.forClass(TestLargeClusterBalancingSystemTableIsolation.class);
-
private static final Logger LOG =
LoggerFactory.getLogger(TestLargeClusterBalancingSystemTableIsolation.class);
@@ -62,7 +57,7 @@ public class TestLargeClusterBalancingSystemTableIsolation {
private static final ServerName[] servers = new ServerName[NUM_SERVERS];
private static final Map<ServerName, List<RegionInfo>> serverToRegions = new
HashMap<>();
- @BeforeClass
+ @BeforeAll
public static void setup() {
// Initialize servers
for (int i = 0; i < NUM_SERVERS; i++) {
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingTableIsolationAndReplicaDistribution.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingTableIsolationAndReplicaDistribution.java
index 064e5cad9db..963834e461b 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingTableIsolationAndReplicaDistribution.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestLargeClusterBalancingTableIsolationAndReplicaDistribution.java
@@ -26,7 +26,6 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.RegionInfo;
@@ -35,22 +34,18 @@ import
org.apache.hadoop.hbase.master.balancer.BalancerTestBase.MockMapping;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.testclassification.MasterTests;
import org.apache.hadoop.net.DNSToSwitchMapping;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableSet;
-@Category({ MasterTests.class, LargeTests.class })
+@Tag(MasterTests.TAG)
+@Tag(LargeTests.TAG)
public class TestLargeClusterBalancingTableIsolationAndReplicaDistribution {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule
-
.forClass(TestLargeClusterBalancingTableIsolationAndReplicaDistribution.class);
-
private static final Logger LOG =
LoggerFactory.getLogger(TestLargeClusterBalancingTableIsolationAndReplicaDistribution.class);
private static final TableName SYSTEM_TABLE_NAME =
TableName.valueOf("hbase:system");
@@ -63,7 +58,7 @@ public class
TestLargeClusterBalancingTableIsolationAndReplicaDistribution {
private static final ServerName[] servers = new ServerName[NUM_SERVERS];
private static final Map<ServerName, List<RegionInfo>> serverToRegions = new
HashMap<>();
- @BeforeClass
+ @BeforeAll
public static void setup() {
// Initialize servers
for (int i = 0; i < NUM_SERVERS; i++) {
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionLocationFinder.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionLocationFinder.java
index 5496ff6b547..1a82a840a9a 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionLocationFinder.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionLocationFinder.java
@@ -17,11 +17,11 @@
*/
package org.apache.hadoop.hbase.master.balancer;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNotSame;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNotSame;
+import static org.junit.jupiter.api.Assertions.assertSame;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -32,7 +32,6 @@ import java.util.Map;
import java.util.Random;
import java.util.TreeMap;
import org.apache.hadoop.hbase.ClusterMetrics;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HDFSBlocksDistribution;
@@ -51,19 +50,15 @@ import org.apache.hadoop.hbase.regionserver.HRegionServer;
import org.apache.hadoop.hbase.testclassification.MasterTests;
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.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
-@Category({ MasterTests.class, MediumTests.class })
+@Tag(MasterTests.TAG)
+@Tag(MediumTests.TAG)
public class TestRegionLocationFinder {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestRegionLocationFinder.class);
-
private final static HBaseTestingUtility TEST_UTIL = new
HBaseTestingUtility();
private static MiniHBaseCluster cluster;
@@ -74,7 +69,7 @@ public class TestRegionLocationFinder {
private static RegionLocationFinder finder = new RegionLocationFinder();
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
cluster = TEST_UTIL.startMiniCluster(ServerNum);
table = TEST_UTIL.createTable(tableName, FAMILY,
HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);
@@ -93,7 +88,7 @@ public class TestRegionLocationFinder {
finder.setClusterMetrics(cluster.getMaster().getClusterMetrics());
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
table.close();
TEST_UTIL.deleteTable(tableName);
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionsOnMasterOptions.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionsOnMasterOptions.java
index 759f0ab2cf8..d3c8e869997 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionsOnMasterOptions.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestRegionsOnMasterOptions.java
@@ -17,17 +17,17 @@
*/
package org.apache.hadoop.hbase.master.balancer;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.List;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.MiniHBaseCluster;
import org.apache.hadoop.hbase.StartMiniClusterOption;
import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.TableNameTestExtension;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.master.HMaster;
import org.apache.hadoop.hbase.master.LoadBalancer;
@@ -35,14 +35,12 @@ import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.JVMClusterUtil;
import org.apache.hadoop.hbase.util.Threads;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,17 +50,11 @@ import org.slf4j.LoggerFactory;
* kill combinations to make sure the distribution is more than just for
startup. NOTE: Regions on
* Master does not work well. See HBASE-19828. Until addressed, disabling this
test.
*/
-@Ignore
-@Category({ MediumTests.class })
+@Disabled
+@Tag(MediumTests.TAG)
public class TestRegionsOnMasterOptions {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestRegionsOnMasterOptions.class);
-
private static final Logger LOG =
LoggerFactory.getLogger(TestRegionsOnMasterOptions.class);
- @Rule
- public TestName name = new TestName();
private final static HBaseTestingUtility TEST_UTIL = new
HBaseTestingUtility();
private Configuration c;
private String tablesOnMasterOldValue;
@@ -75,14 +67,17 @@ public class TestRegionsOnMasterOptions {
private static final int REGIONS = 12;
private static final int SYSTEM_REGIONS = 2; // ns and meta -- no acl unless
enabled.
- @Before
+ @RegisterExtension
+ private final TableNameTestExtension tableNameExt = new
TableNameTestExtension();
+
+ @BeforeEach
public void setup() {
this.c = TEST_UTIL.getConfiguration();
this.tablesOnMasterOldValue = c.get(LoadBalancer.TABLES_ON_MASTER);
this.systemTablesOnMasterOldValue =
c.get(LoadBalancer.SYSTEM_TABLES_ON_MASTER);
}
- @After
+ @AfterEach
public void tearDown() {
unset(LoadBalancer.TABLES_ON_MASTER, this.tablesOnMasterOldValue);
unset(LoadBalancer.SYSTEM_TABLES_ON_MASTER,
this.systemTablesOnMasterOldValue);
@@ -112,7 +107,7 @@ public class TestRegionsOnMasterOptions {
checkBalance(0, rsCount);
}
- @Ignore // Fix this. The Master startup doesn't allow Master reporting as a
RegionServer, not
+ // Fix this. The Master startup doesn't allow Master reporting as a
RegionServer, not
// until way late after the Master startup finishes. Needs more work.
@Test
public void testSystemTablesOnMaster() throws Exception {
@@ -172,7 +167,7 @@ public class TestRegionsOnMasterOptions {
StartMiniClusterOption option =
StartMiniClusterOption.builder().numMasters(MASTERS)
.numRegionServers(SLAVES).numDataNodes(SLAVES).build();
MiniHBaseCluster cluster = TEST_UTIL.startMiniCluster(option);
- TableName tn = TableName.valueOf(this.name.getMethodName());
+ TableName tn = tableNameExt.getTableName();
try {
Table t = TEST_UTIL.createMultiRegionTable(tn,
HConstants.CATALOG_FAMILY, REGIONS);
LOG.info("Server: " +
cluster.getMaster().getServerManager().getOnlineServersList());
@@ -229,7 +224,7 @@ public class TestRegionsOnMasterOptions {
}
private void checkCount(int actual, int expected) {
- assertTrue("Actual=" + actual + ", expected=" + expected,
- actual >= (expected - 2) && actual <= (expected + 2)); // Lots of slop
+/- 2
+ assertTrue(actual >= (expected - 2) && actual <= (expected + 2),
+ "Actual=" + actual + ", expected=" + expected); // Lots of slop +/- 2
}
}
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestServerAndLoad.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestServerAndLoad.java
index 9568edad74c..e4c974c2963 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestServerAndLoad.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestServerAndLoad.java
@@ -17,24 +17,19 @@
*/
package org.apache.hadoop.hbase.master.balancer;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.testclassification.MasterTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
-@Category({ MasterTests.class, SmallTests.class })
+@Tag(MasterTests.TAG)
+@Tag(SmallTests.TAG)
public class TestServerAndLoad {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestServerAndLoad.class);
-
@Test
public void test() {
ServerName server = ServerName.valueOf("host", 12345, 112244);
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStoreFileTableSkewCostFunction.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStoreFileTableSkewCostFunction.java
index b3419586f8b..5e28dc26d0b 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStoreFileTableSkewCostFunction.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStoreFileTableSkewCostFunction.java
@@ -18,8 +18,8 @@
package org.apache.hadoop.hbase.master.balancer;
import static
org.apache.hadoop.hbase.master.balancer.CandidateGeneratorTestUtil.createMockBalancerClusterState;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.when;
import java.util.ArrayDeque;
@@ -30,7 +30,6 @@ import java.util.List;
import java.util.Map;
import java.util.Random;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.RegionMetrics;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.Size;
@@ -39,18 +38,14 @@ import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.RegionInfoBuilder;
import org.apache.hadoop.hbase.testclassification.MasterTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
-@Category({ MasterTests.class, SmallTests.class })
+@Tag(MasterTests.TAG)
+@Tag(SmallTests.TAG)
public class TestStoreFileTableSkewCostFunction {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestStoreFileTableSkewCostFunction.class);
-
private static final TableName DEFAULT_TABLE =
TableName.valueOf("testTable");
private static final Map<Long, Integer> REGION_TO_STORE_FILE_SIZE_MB = new
HashMap<>();
@@ -80,7 +75,7 @@ public class TestStoreFileTableSkewCostFunction {
double cost = costFunction.cost();
// Expect zero cost since all regions (from the same table) are balanced.
- assertEquals("Uniform distribution should yield zero cost", 0.0, cost,
1e-6);
+ assertEquals(0.0, cost, 1e-6, "Uniform distribution should yield zero
cost");
}
/**
@@ -110,7 +105,7 @@ public class TestStoreFileTableSkewCostFunction {
double cost = costFunction.cost();
// Expect a positive cost because the distribution is skewed.
- assertTrue("Skewed distribution should yield a positive cost", cost > 0.0);
+ assertTrue(cost > 0.0, "Skewed distribution should yield a positive cost");
}
/**
@@ -129,7 +124,7 @@ public class TestStoreFileTableSkewCostFunction {
double cost = costFunction.cost();
// Expect zero cost when there is no load.
- assertEquals("Empty distribution should yield zero cost", 0.0, cost, 1e-6);
+ assertEquals(0.0, cost, 1e-6, "Empty distribution should yield zero cost");
}
/**
@@ -164,7 +159,7 @@ public class TestStoreFileTableSkewCostFunction {
double cost = costFunction.cost();
// Expect a positive cost because the skew is computed per table.
- assertTrue("Multiple table distribution should yield a positive cost",
cost > 0.0);
+ assertTrue(cost > 0.0, "Multiple table distribution should yield a
positive cost");
}
/**
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestUnattainableBalancerCostGoal.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestUnattainableBalancerCostGoal.java
index cf3f241cab8..e15160c82b4 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestUnattainableBalancerCostGoal.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/balancer/TestUnattainableBalancerCostGoal.java
@@ -25,17 +25,15 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.RegionInfo;
import org.apache.hadoop.hbase.client.RegionInfoBuilder;
import org.apache.hadoop.hbase.testclassification.MasterTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -47,13 +45,10 @@ import
org.apache.hbase.thirdparty.com.google.common.collect.ImmutableSet;
* wasteful. This test ensures that the balancer will not get stuck in a loop
of continuously moving
* regions.
*/
-@Category({ MasterTests.class, MediumTests.class })
+@Tag(MasterTests.TAG)
+@Tag(MediumTests.TAG)
public class TestUnattainableBalancerCostGoal {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestUnattainableBalancerCostGoal.class);
-
private static final Logger LOG =
LoggerFactory.getLogger(TestUnattainableBalancerCostGoal.class);
private static final TableName SYSTEM_TABLE_NAME =
TableName.valueOf("hbase:system");
@@ -66,7 +61,7 @@ public class TestUnattainableBalancerCostGoal {
private static final ServerName[] servers = new ServerName[NUM_SERVERS];
private static final Map<ServerName, List<RegionInfo>> serverToRegions = new
HashMap<>();
- @BeforeClass
+ @BeforeAll
public static void setup() {
// Initialize servers
for (int i = 0; i < NUM_SERVERS; i++) {
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java
index 244651cd9bb..bb9a73c78c5 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/cleaner/TestLogsCleaner.java
@@ -17,9 +17,9 @@
*/
package org.apache.hadoop.hbase.master.cleaner;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.spy;
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/MobStressToolRunner.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/MobStressToolRunner.java
index 705cd90284f..a42698d20a3 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/MobStressToolRunner.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/mob/MobStressToolRunner.java
@@ -17,8 +17,8 @@
*/
package org.apache.hadoop.hbase.mob;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.Arrays;
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java
index c4137fd7119..8f293374b8d 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/protobuf/TestProtobufUtil.java
@@ -17,8 +17,8 @@
*/
package org.apache.hadoop.hbase.protobuf;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import com.google.protobuf.ByteString;
import java.io.IOException;
@@ -28,7 +28,6 @@ import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.CellBuilderType;
import org.apache.hadoop.hbase.CellComparatorImpl;
import org.apache.hadoop.hbase.ExtendedCellBuilderFactory;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.ServerName;
@@ -52,22 +51,18 @@ import
org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameBytesPair;
import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import
org.apache.hadoop.hbase.shaded.protobuf.generated.ZooKeeperProtos.MetaRegionServer;
/**
* Class to test ProtobufUtil.
*/
-@Category({ MiscTests.class, SmallTests.class })
+@Tag(MiscTests.TAG)
+@Tag(SmallTests.TAG)
public class TestProtobufUtil {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestProtobufUtil.class);
-
@Test
public void testException() throws IOException {
NameBytesPair.Builder builder = NameBytesPair.newBuilder();
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/AbstractTestDateTieredCompactionPolicy.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/AbstractTestDateTieredCompactionPolicy.java
index 48a4e7b2984..f5226411163 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/AbstractTestDateTieredCompactionPolicy.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/AbstractTestDateTieredCompactionPolicy.java
@@ -17,7 +17,7 @@
*/
package org.apache.hadoop.hbase.regionserver;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.util.ArrayList;
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestShortCircuitGet.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestShortCircuitGet.java
index 4836effb433..dad8b52d0dc 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestShortCircuitGet.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestShortCircuitGet.java
@@ -17,15 +17,14 @@
*/
package org.apache.hadoop.hbase.regionserver;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.Arrays;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.MiniHBaseCluster.MiniHBaseClusterRegionServer;
@@ -47,13 +46,10 @@ import org.apache.hadoop.hbase.ipc.ServerCall;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import org.apache.hbase.thirdparty.com.google.protobuf.RpcController;
import org.apache.hbase.thirdparty.com.google.protobuf.ServiceException;
@@ -65,11 +61,9 @@ import
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.MultiRespo
import
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanRequest;
import
org.apache.hadoop.hbase.shaded.protobuf.generated.ClientProtos.ScanResponse;
-@Category({ RegionServerTests.class, MediumTests.class })
+@Tag(RegionServerTests.TAG)
+@Tag(MediumTests.TAG)
public class TestShortCircuitGet {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestShortCircuitGet.class);
private final static HBaseTestingUtility TEST_UTIL = new
HBaseTestingUtility();
private static final byte[] FAMILY = Bytes.toBytes("testFamily");
@@ -85,10 +79,7 @@ public class TestShortCircuitGet {
static final byte[] r6 = Bytes.toBytes("row-6");
static final TableName tableName = TableName.valueOf("TestShortCircuitGet");
- @Rule
- public TestName name = new TestName();
-
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
Configuration conf = TEST_UTIL.getConfiguration();
conf.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, 30 * 60 * 1000);
@@ -101,7 +92,7 @@ public class TestShortCircuitGet {
TEST_UTIL.startMiniCluster(1);
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
TEST_UTIL.shutdownMiniCluster();
}
@@ -141,9 +132,9 @@ public class TestShortCircuitGet {
scan.withStartRow(r0, true).withStopRow(r1, true);
resultScanner = table.getScanner(scan);
Result result = resultScanner.next();
- assertTrue("Expected row: row-0", Bytes.equals(r0, result.getRow()));
+ assertTrue(Bytes.equals(r0, result.getRow()), "Expected row: row-0");
result = resultScanner.next();
- assertTrue("Expected row: row-1", Bytes.equals(r1, result.getRow()));
+ assertTrue(Bytes.equals(r1, result.getRow()), "Expected row: row-1");
assertNull(resultScanner.next());
} finally {
if (resultScanner != null) {
@@ -283,7 +274,7 @@ public class TestShortCircuitGet {
try {
table1 = connection.getTable(tableName);
Result result = table1.get(get2);
- assertTrue("Expected row: row-2", Bytes.equals(r2, result.getRow()));
+ assertTrue(Bytes.equals(r2, result.getRow()), "Expected row: row-2");
} finally {
if (table1 != null) {
@@ -304,8 +295,8 @@ public class TestShortCircuitGet {
try {
table2 = connection.getTable(tableName);
Result[] results = table2.get(Arrays.asList(get3, get4));
- assertTrue("Expected row: row-3", Bytes.equals(r3,
results[0].getRow()));
- assertTrue("Expected row: row-4", Bytes.equals(r4,
results[1].getRow()));
+ assertTrue(Bytes.equals(r3, results[0].getRow()), "Expected row:
row-3");
+ assertTrue(Bytes.equals(r4, results[1].getRow()), "Expected row:
row-4");
} finally {
if (table2 != null) {
table2.close();
@@ -328,9 +319,9 @@ public class TestShortCircuitGet {
table3 = connection.getTable(tableName);
resultScanner = table3.getScanner(newScan);
Result result = resultScanner.next();
- assertTrue("Expected row: row-5", Bytes.equals(r5, result.getRow()));
+ assertTrue(Bytes.equals(r5, result.getRow()), "Expected row: row-5");
result = resultScanner.next();
- assertTrue("Expected row: row-6", Bytes.equals(r6, result.getRow()));
+ assertTrue(Bytes.equals(r6, result.getRow()), "Expected row: row-6");
result = resultScanner.next();
assertNull(result);
} finally {
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestWALLockup.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestWALLockup.java
index 731781bfc1b..a5d2f81dd30 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestWALLockup.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestWALLockup.java
@@ -17,7 +17,8 @@
*/
package org.apache.hadoop.hbase.regionserver;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.util.NavigableMap;
@@ -30,7 +31,6 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.CellScanner;
import org.apache.hadoop.hbase.ChoreService;
import org.apache.hadoop.hbase.CoordinatedStateManager;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.Server;
@@ -52,14 +52,11 @@ import org.apache.hadoop.hbase.wal.WALEdit;
import org.apache.hadoop.hbase.wal.WALKeyImpl;
import org.apache.hadoop.hbase.wal.WALProvider.Writer;
import org.apache.hadoop.hbase.zookeeper.ZKWatcher;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
import org.mockito.Mockito;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -69,18 +66,12 @@ import
org.apache.hbase.thirdparty.com.google.common.io.Closeables;
/**
* Testing for lock up of FSHLog.
*/
-@Category({ RegionServerTests.class, MediumTests.class })
+@Tag(RegionServerTests.TAG)
+@Tag(MediumTests.TAG)
public class TestWALLockup {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestWALLockup.class);
-
private static final Logger LOG =
LoggerFactory.getLogger(TestWALLockup.class);
- @Rule
- public TestName name = new TestName();
-
private static final String COLUMN_FAMILY = "MyCF";
private static final byte[] COLUMN_FAMILY_BYTES =
Bytes.toBytes(COLUMN_FAMILY);
@@ -90,18 +81,21 @@ public class TestWALLockup {
private String dir;
// Test names
- protected TableName tableName;
+ private TableName tableName;
+
+ private String methodName;
- @Before
- public void setup() throws IOException {
+ @BeforeEach
+ public void setup(TestInfo testInfo) throws IOException {
CONF = TEST_UTIL.getConfiguration();
// Disable block cache.
CONF.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0f);
dir = TEST_UTIL.getDataTestDir("TestHRegion").toString();
- tableName = TableName.valueOf(name.getMethodName());
+ methodName = testInfo.getTestMethod().get().getName();
+ tableName = TableName.valueOf(methodName);
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
EnvironmentEdgeManagerTestHelper.reset();
LOG.info("Cleaning test directory: " + TEST_UTIL.getDataTestDir());
@@ -109,7 +103,7 @@ public class TestWALLockup {
}
private String getName() {
- return name.getMethodName();
+ return methodName;
}
// A WAL that we can have throw exceptions when a flag is set.
@@ -259,7 +253,7 @@ public class TestWALLockup {
} catch (Exception e) {
exception = true;
}
- assertTrue("Did not get sync exception", exception);
+ assertTrue(exception, "Did not get sync exception");
// Get a memstore flush going too so we have same hung profile as up in
the issue over
// in HBASE-14317. Flush hangs trying to get sequenceid because the
ringbuffer is held up
@@ -348,7 +342,7 @@ public class TestWALLockup {
protected void publishSyncOnRingBufferAndBlock(long sequence) {
try {
super.blockOnSync(super.publishSyncOnRingBuffer(sequence, false));
- Assert.fail("Expect an IOException here.");
+ fail("Expect an IOException here.");
} catch (IOException ignore) {
// Here, we will get an IOException.
}
@@ -435,7 +429,7 @@ public class TestWALLockup {
LOG.info("Call sync for testing whether RingBufferEventHandler is
hanging.");
dodgyWAL.sync(false); // Should not get a hang here, otherwise we will
see timeout in this
// test.
- Assert.fail("Expect an IOException here.");
+ fail("Expect an IOException here.");
} catch (IOException ignore) {
}
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALOpenError.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALOpenError.java
index eafafd3d708..f6b63560390 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALOpenError.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/wal/TestWALOpenError.java
@@ -17,6 +17,8 @@
*/
package org.apache.hadoop.hbase.regionserver.wal;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.IOException;
import java.util.List;
import org.apache.hadoop.conf.Configuration;
@@ -24,7 +26,6 @@ import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.FailedCloseWALAfterInitializedErrorException;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.ServerName;
@@ -34,29 +35,23 @@ import org.apache.hadoop.hbase.util.CommonFSUtils;
import org.apache.hadoop.hbase.wal.FSHLogProvider;
import org.apache.hadoop.hbase.wal.WALFactory;
import org.apache.hadoop.hdfs.MiniDFSCluster;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Test WAL Init ERROR
*/
-@Category({ RegionServerTests.class, MediumTests.class })
+@Tag(RegionServerTests.TAG)
+@Tag(MediumTests.TAG)
public class TestWALOpenError {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestWALOpenError.class);
-
private static final Logger LOG =
LoggerFactory.getLogger(TestWALOpenError.class);
protected static Configuration conf;
@@ -70,18 +65,16 @@ public class TestWALOpenError {
protected WALFactory wals;
private ServerName currentServername;
- @Rule
- public final TestName currentTest = new TestName();
-
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ public void setUp(TestInfo testInfo) throws Exception {
fs = cluster.getFileSystem();
- dir = new Path(hbaseDir, currentTest.getMethodName());
- this.currentServername = ServerName.valueOf(currentTest.getMethodName(),
16010, 1);
+ String methodName = testInfo.getTestMethod().get().getName();
+ dir = new Path(hbaseDir, methodName);
+ this.currentServername = ServerName.valueOf(methodName, 16010, 1);
wals = new WALFactory(conf, this.currentServername.toString());
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
// testAppendClose closes the FileSystem, which will prevent us from
closing cleanly here.
try {
@@ -97,7 +90,7 @@ public class TestWALOpenError {
}
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniDFSCluster(3);
conf = TEST_UTIL.getConfiguration();
@@ -109,7 +102,7 @@ public class TestWALOpenError {
hbaseWALDir = TEST_UTIL.createWALRootDir();
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
TEST_UTIL.shutdownMiniCluster();
}
@@ -128,11 +121,11 @@ public class TestWALOpenError {
} catch (IOException ex) {
hasFakeInitException = ex.getMessage().contains("Fake init exception");
}
- Assert.assertTrue(hasFakeInitException);
- Assert.assertTrue(myFSLogCreated.closed);
+ assertTrue(hasFakeInitException);
+ assertTrue(myFSLogCreated.closed);
FileStatus[] fileStatuses = CommonFSUtils.listStatus(fs,
myFSLogCreated.walDir);
- Assert.assertTrue(fileStatuses == null || fileStatuses.length == 0);
+ assertTrue(fileStatuses == null || fileStatuses.length == 0);
}
@Test
@@ -144,7 +137,7 @@ public class TestWALOpenError {
} catch (FailedCloseWALAfterInitializedErrorException ex) {
failedCloseWalException = true;
}
- Assert.assertTrue(failedCloseWalException);
+ assertTrue(failedCloseWalException);
}
public static class MyFSWalProvider extends FSHLogProvider {
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/master/TestTableCFsUpdater.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/master/TestTableCFsUpdater.java
index f016455e92a..bab250ead6a 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/master/TestTableCFsUpdater.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/master/TestTableCFsUpdater.java
@@ -17,18 +17,18 @@
*/
package org.apache.hadoop.hbase.replication.master;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Abortable;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName;
+import org.apache.hadoop.hbase.TableNameTestExtension;
import org.apache.hadoop.hbase.client.replication.ReplicationPeerConfigUtil;
import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
import org.apache.hadoop.hbase.replication.ZKReplicationPeerStorage;
@@ -37,23 +37,18 @@ import
org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.zookeeper.ZKUtil;
import org.apache.hadoop.hbase.zookeeper.ZKWatcher;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@Category({ ReplicationTests.class, SmallTests.class })
+@Tag(ReplicationTests.TAG)
+@Tag(SmallTests.TAG)
public class TestTableCFsUpdater extends ReplicationPeerConfigUpgrader {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestTableCFsUpdater.class);
-
private static final Logger LOG =
LoggerFactory.getLogger(TestTableCFsUpdater.class);
private final static HBaseTestingUtility TEST_UTIL = new
HBaseTestingUtility();
@@ -61,20 +56,20 @@ public class TestTableCFsUpdater extends
ReplicationPeerConfigUpgrader {
private static Abortable abortable = null;
private static ZKStorageUtil zkStorageUtil = null;
+ @RegisterExtension
+ private final TableNameTestExtension tableNameExt = new
TableNameTestExtension();
+
private static class ZKStorageUtil extends ZKReplicationPeerStorage {
public ZKStorageUtil(ZKWatcher zookeeper, Configuration conf) {
super(zookeeper, conf);
}
}
- @Rule
- public TestName name = new TestName();
-
public TestTableCFsUpdater() throws IOException {
super(zkw, TEST_UTIL.getConfiguration());
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniZKCluster();
Configuration conf = TEST_UTIL.getConfiguration();
@@ -93,7 +88,7 @@ public class TestTableCFsUpdater extends
ReplicationPeerConfigUpgrader {
zkStorageUtil = new ZKStorageUtil(zkw, conf);
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
TEST_UTIL.shutdownMiniZKCluster();
}
@@ -101,9 +96,9 @@ public class TestTableCFsUpdater extends
ReplicationPeerConfigUpgrader {
@Test
public void testUpgrade() throws Exception {
String peerId = "1";
- final TableName tableName1 = TableName.valueOf(name.getMethodName() + "1");
- final TableName tableName2 = TableName.valueOf(name.getMethodName() + "2");
- final TableName tableName3 = TableName.valueOf(name.getMethodName() + "3");
+ final TableName tableName1 = tableNameExt.getTableName("1");
+ final TableName tableName2 = tableNameExt.getTableName("2");
+ final TableName tableName3 = tableNameExt.getTableName("3");
ReplicationPeerConfig rpc = new ReplicationPeerConfig();
rpc.setClusterKey(zkw.getQuorum());
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileArchiveTestingUtil.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileArchiveTestingUtil.java
index 18286bca91c..d66d4cf8c46 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileArchiveTestingUtil.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileArchiveTestingUtil.java
@@ -17,8 +17,8 @@
*/
package org.apache.hadoop.hbase.util;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
import java.io.IOException;
import java.util.ArrayList;
@@ -115,8 +115,8 @@ public class HFileArchiveTestingUtil {
// check the backed up files versus the current (should match up, less the
// backup time in the name)
- assertEquals("Didn't expect any backup files, but got: " + backedup,
hasTimedBackup,
- backedup.size() > 0);
+ assertEquals(hasTimedBackup, backedup.size() > 0,
+ "Didn't expect any backup files, but got: " + backedup);
String msg = null;
if (hasTimedBackup) {
assertArchiveEquality(original, backedup);
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileTestUtil.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileTestUtil.java
index f6adfbb394b..71789453f20 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileTestUtil.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/HFileTestUtil.java
@@ -18,8 +18,8 @@
package org.apache.hadoop.hbase.util;
import static
org.apache.hadoop.hbase.regionserver.HStoreFile.BULKLOAD_TIME_KEY;
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertArrayEquals;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.util.Arrays;
@@ -151,7 +151,7 @@ public class HFileTestUtil {
}
Tag t = tag.get();
byte[] tval = Tag.cloneValue(t);
- assertArrayEquals(c.toString() + " has tag" + Bytes.toString(tval),
r.getRow(), tval);
+ assertArrayEquals(r.getRow(), tval, c.toString() + " has tag" +
Bytes.toString(tval));
}
}
}
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestServerHttpUtils.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestServerHttpUtils.java
index 9067f92dab8..179668bf986 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestServerHttpUtils.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/TestServerHttpUtils.java
@@ -17,7 +17,7 @@
*/
package org.apache.hadoop.hbase.util;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.BufferedReader;
import java.io.IOException;
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/HbckTestingUtil.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/HbckTestingUtil.java
index 41e98464bfd..7923b0e865f 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/HbckTestingUtil.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/util/hbck/HbckTestingUtil.java
@@ -17,7 +17,7 @@
*/
package org.apache.hadoop.hbase.util.hbck;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import java.util.ArrayList;
diff --git
a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestBoundedRegionGroupingStrategy.java
b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestBoundedRegionGroupingStrategy.java
index 2f65e82aabb..a16506718a7 100644
---
a/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestBoundedRegionGroupingStrategy.java
+++
b/hbase-server/src/test/java/org/apache/hadoop/hbase/wal/TestBoundedRegionGroupingStrategy.java
@@ -22,17 +22,17 @@ import static
org.apache.hadoop.hbase.wal.BoundedGroupingStrategy.NUM_REGION_GRO
import static
org.apache.hadoop.hbase.wal.RegionGroupingProvider.DELEGATE_PROVIDER;
import static
org.apache.hadoop.hbase.wal.RegionGroupingProvider.REGION_GROUPING_STRATEGY;
import static org.apache.hadoop.hbase.wal.WALFactory.WAL_PROVIDER;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
-import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
+import java.util.stream.Stream;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
+import org.apache.hadoop.hbase.HBaseParameterizedTestTemplate;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.RegionInfoBuilder;
@@ -40,28 +40,21 @@ import
org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.util.CommonFSUtils;
import org.apache.hadoop.hdfs.DistributedFileSystem;
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameter;
-import org.junit.runners.Parameterized.Parameters;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.params.provider.Arguments;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-@RunWith(Parameterized.class)
-@Category({ RegionServerTests.class, MediumTests.class })
+@Tag(RegionServerTests.TAG)
+@Tag(MediumTests.TAG)
+@HBaseParameterizedTestTemplate(name = "{index}: delegate-provider={0}")
public class TestBoundedRegionGroupingStrategy {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestBoundedRegionGroupingStrategy.class);
-
private static final Logger LOG =
LoggerFactory.getLogger(TestBoundedRegionGroupingStrategy.class);
@@ -70,20 +63,22 @@ public class TestBoundedRegionGroupingStrategy {
private static Configuration CONF;
private static DistributedFileSystem FS;
- @Parameter
public String walProvider;
- @Parameters(name = "{index}: delegate-provider={0}")
- public static Iterable<Object[]> data() {
- return Arrays.asList(new Object[] { "defaultProvider" }, new Object[] {
"asyncfs" });
+ public TestBoundedRegionGroupingStrategy(String walProvider) {
+ this.walProvider = walProvider;
+ }
+
+ public static Stream<Arguments> parameters() {
+ return Stream.of(Arguments.of("defaultProvider"), Arguments.of("asyncfs"));
}
- @Before
+ @BeforeEach
public void setUp() throws Exception {
CONF.set(DELEGATE_PROVIDER, walProvider);
}
- @After
+ @AfterEach
public void tearDown() throws Exception {
FileStatus[] entries = FS.listStatus(new Path("/"));
for (FileStatus dir : entries) {
@@ -91,7 +86,7 @@ public class TestBoundedRegionGroupingStrategy {
}
}
- @BeforeClass
+ @BeforeAll
public static void setUpBeforeClass() throws Exception {
CONF = TEST_UTIL.getConfiguration();
// Make block sizes small.
@@ -114,7 +109,7 @@ public class TestBoundedRegionGroupingStrategy {
FS = TEST_UTIL.getDFSCluster().getFileSystem();
}
- @AfterClass
+ @AfterAll
public static void tearDownAfterClass() throws Exception {
TEST_UTIL.shutdownMiniCluster();
}
@@ -122,7 +117,7 @@ public class TestBoundedRegionGroupingStrategy {
/**
* Write to a log file with three concurrent threads and verifying all data
is written.
*/
- @Test
+ @TestTemplate
public void testConcurrentWrites() throws Exception {
// Run the WPE tool with three threads writing 3000 edits each
concurrently.
// When done, verify that all edits were written.
@@ -134,7 +129,7 @@ public class TestBoundedRegionGroupingStrategy {
/**
* Make sure we can successfully run with more regions then our bound.
*/
- @Test
+ @TestTemplate
public void testMoreRegionsThanBound() throws Exception {
final String parallelism = Integer.toString(DEFAULT_NUM_REGION_GROUPS * 2);
int errCode =
@@ -143,7 +138,7 @@ public class TestBoundedRegionGroupingStrategy {
assertEquals(0, errCode);
}
- @Test
+ @TestTemplate
public void testBoundsGreaterThanDefault() throws Exception {
final int temp = CONF.getInt(NUM_REGION_GROUPS, DEFAULT_NUM_REGION_GROUPS);
try {
@@ -158,7 +153,7 @@ public class TestBoundedRegionGroupingStrategy {
}
}
- @Test
+ @TestTemplate
public void testMoreRegionsThanBoundWithBoundsGreaterThanDefault() throws
Exception {
final int temp = CONF.getInt(NUM_REGION_GROUPS, DEFAULT_NUM_REGION_GROUPS);
try {
@@ -176,7 +171,7 @@ public class TestBoundedRegionGroupingStrategy {
/**
* Ensure that we can use Set.add to deduplicate WALs
*/
- @Test
+ @TestTemplate
public void setMembershipDedups() throws IOException {
final int temp = CONF.getInt(NUM_REGION_GROUPS, DEFAULT_NUM_REGION_GROUPS);
WALFactory wals = null;
@@ -197,8 +192,9 @@ public class TestBoundedRegionGroupingStrategy {
count++;
}
}
- assertEquals("received back a different number of WALs that are not
equal() to each other "
- + "than the bound we placed.", temp * 4, count);
+ assertEquals(temp * 4, count,
+ "received back a different number of WALs that are not equal() to each
other "
+ + "than the bound we placed.");
} finally {
if (wals != null) {
wals.close();