diff --git a/hbase-assembly/pom.xml b/hbase-assembly/pom.xml
index 7d5a1bf8c71d..dcd81ebf2609 100644
--- a/hbase-assembly/pom.xml
+++ b/hbase-assembly/pom.xml
@@ -408,11 +408,6 @@
junit-jupiter-paramscompile
-
- org.junit.vintage
- junit-vintage-engine
- compile
- org.hamcresthamcrest-core
diff --git a/hbase-asyncfs/pom.xml b/hbase-asyncfs/pom.xml
index ef501e3f29d1..f149dec3bd24 100644
--- a/hbase-asyncfs/pom.xml
+++ b/hbase-asyncfs/pom.xml
@@ -83,6 +83,11 @@
junit-jupiter-paramstest
+
+ org.hamcrest
+ hamcrest-library
+ test
+ org.bouncycastlebcprov-jdk18on
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/BackupTestUtil.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/BackupTestUtil.java
index 3665eeb7a76c..5d49ed574d5d 100644
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/BackupTestUtil.java
+++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/BackupTestUtil.java
@@ -17,7 +17,7 @@
*/
package org.apache.hadoop.hbase.backup;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestIncrementalBackupMergeWithBulkLoad.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestIncrementalBackupMergeWithBulkLoad.java
index 4d4076f28c05..702ecbb5a3b6 100644
--- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestIncrementalBackupMergeWithBulkLoad.java
+++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestIncrementalBackupMergeWithBulkLoad.java
@@ -22,9 +22,9 @@
import static org.apache.hadoop.hbase.backup.BackupTestUtil.verifyBackup;
import static org.apache.hadoop.hbase.backup.BackupType.FULL;
import static org.apache.hadoop.hbase.backup.BackupType.INCREMENTAL;
-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 java.io.IOException;
import java.nio.ByteBuffer;
diff --git a/hbase-balancer/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancerRegionReplicaSameHosts.java b/hbase-balancer/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancerRegionReplicaSameHosts.java
index 0e1e8a1e52c7..648346d8bee0 100644
--- a/hbase-balancer/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancerRegionReplicaSameHosts.java
+++ b/hbase-balancer/src/test/java/org/apache/hadoop/hbase/master/balancer/TestStochasticLoadBalancerRegionReplicaSameHosts.java
@@ -17,6 +17,7 @@
*/
package org.apache.hadoop.hbase.master.balancer;
+import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -34,8 +35,7 @@ public class TestStochasticLoadBalancerRegionReplicaSameHosts extends Stochastic
@Test
public void testRegionReplicationOnMidClusterSameHosts() {
- conf.setLong(StochasticLoadBalancer.MAX_STEPS_KEY, 2000000L);
- loadBalancer.onConfigurationChange(conf);
+ setMaxRunTime(Duration.ofSeconds(10));
int numHosts = 30;
int numRegions = 30 * 30;
int replication = 3; // 3 replicas per region
diff --git a/hbase-common/pom.xml b/hbase-common/pom.xml
index ea58c0327c78..e357efc0332a 100644
--- a/hbase-common/pom.xml
+++ b/hbase-common/pom.xml
@@ -125,11 +125,6 @@
junit-jupiter-paramstest
-
- org.junit.vintage
- junit-vintage-engine
- test
- org.awaitilityawaitility
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/ClassTestFinder.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/ClassTestFinder.java
index dc51187e3cf8..998b1fa4eb08 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/ClassTestFinder.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/ClassTestFinder.java
@@ -22,9 +22,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
-import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.Tag;
-import org.junit.runners.Suite;
/**
* ClassFinder that is pre-configured with filters that will only allow test classes. The name is
@@ -36,26 +34,24 @@ public ClassTestFinder() {
super(new TestFileNameFilter(), new TestFileNameFilter(), new TestClassFilter());
}
- public ClassTestFinder(Class> category) {
- super(new TestFileNameFilter(), new TestFileNameFilter(), new TestClassFilter(category));
+ public ClassTestFinder(Class> tag) {
+ super(new TestFileNameFilter(), new TestFileNameFilter(), new TestClassFilter(tag));
}
- public static Class>[] getCategoryAnnotations(Class> c) {
- Category category = c.getAnnotation(Category.class);
- if (category != null) {
- return category.value();
- }
- return new Class>[0];
- }
-
- public static String[] getTagAnnotations(Class> c) {
+ public static Class>[] getTagAnnotations(Class> c) {
// TODO handle optional Tags annotation
Tag[] tags = c.getAnnotationsByType(Tag.class);
- List values = new ArrayList<>();
- for (Tag tag : tags) {
- values.add(tag.value());
+ List> values = new ArrayList<>();
+ if (tags != null) {
+ for (Tag tag : tags) {
+ try {
+ values.add(Class.forName(tag.value()));
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
}
- return values.toArray(new String[values.size()]);
+ return values.toArray(new Class>[values.size()]);
}
/** Filters both test classes and anything in the hadoop-compat modules */
@@ -79,10 +75,10 @@ public boolean isCandidatePath(String resourcePath, boolean isJar) {
* is annotated with org.junit.Test OR - the class is annotated with Suite.SuiteClasses
*/
public static class TestClassFilter implements ClassFilter {
- private Class> categoryAnnotation = null;
+ private Class> tagAnnotation = null;
public TestClassFilter(Class> categoryAnnotation) {
- this.categoryAnnotation = categoryAnnotation;
+ this.tagAnnotation = categoryAnnotation;
}
public TestClassFilter() {
@@ -91,7 +87,7 @@ public TestClassFilter() {
@Override
public boolean isCandidateClass(Class> c) {
- return isTestClass(c) && isCategorizedClass(c);
+ return isTestClass(c) && isTagedClass(c);
}
private boolean isTestClass(Class> c) {
@@ -99,15 +95,8 @@ private boolean isTestClass(Class> c) {
return false;
}
- if (c.getAnnotation(Suite.SuiteClasses.class) != null) {
- return true;
- }
-
for (Method met : c.getMethods()) {
- if (
- met.getAnnotation(org.junit.Test.class) != null
- || met.getAnnotation(org.junit.jupiter.api.Test.class) != null
- ) {
+ if (met.getAnnotation(org.junit.jupiter.api.Test.class) != null) {
return true;
}
}
@@ -115,12 +104,12 @@ private boolean isTestClass(Class> c) {
return false;
}
- private boolean isCategorizedClass(Class> c) {
- if (this.categoryAnnotation == null) {
+ private boolean isTagedClass(Class> c) {
+ if (this.tagAnnotation == null) {
return true;
}
- for (Class> cc : getCategoryAnnotations(c)) {
- if (cc.equals(this.categoryAnnotation)) {
+ for (Class> cc : getTagAnnotations(c)) {
+ if (cc.equals(this.tagAnnotation)) {
return true;
}
}
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java
deleted file mode 100644
index 73f5442b6a78..000000000000
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRule.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase;
-
-import edu.umd.cs.findbugs.annotations.NonNull;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-import org.apache.hadoop.hbase.testclassification.IntegrationTests;
-import org.apache.hadoop.hbase.testclassification.LargeTests;
-import org.apache.hadoop.hbase.testclassification.MediumTests;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.apache.yetus.audience.InterfaceAudience;
-import org.junit.experimental.categories.Category;
-import org.junit.rules.TestRule;
-import org.junit.rules.Timeout;
-import org.junit.runner.Description;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-import org.junit.runners.model.Statement;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.hbase.thirdparty.com.google.common.collect.Iterables;
-import org.apache.hbase.thirdparty.com.google.common.collect.Sets;
-
-/**
- * The class level TestRule for all the tests. Every test class should have a {@code ClassRule} with
- * it.
- *
- * For now it only sets a test method timeout based off the test categories small, medium, large.
- * Based on junit Timeout TestRule; see https://github.com/junit-team/junit/wiki/Rules
- */
-@InterfaceAudience.Private
-public final class HBaseClassTestRule implements TestRule {
- private static final Logger LOG = LoggerFactory.getLogger(HBaseClassTestRule.class);
- public static final Set> UNIT_TEST_CLASSES = Collections.unmodifiableSet(
- Sets.> newHashSet(SmallTests.class, MediumTests.class, LargeTests.class));
-
- // Each unit test has this timeout.
- private static long PER_UNIT_TEST_TIMEOUT_MINS = 13;
-
- private final Class> clazz;
-
- private final Timeout timeout;
-
- private final SystemExitRule systemExitRule = new SystemExitRule();
-
- private HBaseClassTestRule(Class> clazz, Timeout timeout) {
- this.clazz = clazz;
- this.timeout = timeout;
- }
-
- /**
- * Mainly used for {@link HBaseClassTestRuleChecker} to confirm that we use the correct class to
- * generate timeout ClassRule.
- */
- public Class> getClazz() {
- return clazz;
- }
-
- private static long getTimeoutInSeconds(Class> clazz) {
- Category[] categories = clazz.getAnnotationsByType(Category.class);
- // Starting JUnit 4.13, it appears that the timeout is applied across all the parameterized
- // runs. So the timeout is multiplied by number of parameterized runs.
- int numParams = getNumParameters(clazz);
- // @Category is not repeatable -- it is only possible to get an array of length zero or one.
- if (categories.length == 1) {
- for (Class> c : categories[0].value()) {
- if (UNIT_TEST_CLASSES.contains(c)) {
- long timeout = numParams * PER_UNIT_TEST_TIMEOUT_MINS;
- LOG.info("Test {} timeout: {} mins", clazz, timeout);
- return TimeUnit.MINUTES.toSeconds(timeout);
- }
- if (c == IntegrationTests.class) {
- return TimeUnit.MINUTES.toSeconds(Long.MAX_VALUE);
- }
- }
- }
- throw new IllegalArgumentException(
- clazz.getName() + " does not have SmallTests/MediumTests/LargeTests in @Category");
- }
-
- /**
- * @param clazz Test class that is running.
- * @return the number of parameters for this given test class. If the test is not parameterized or
- * if there is any issue determining the number of parameters, returns 1.
- */
- static int getNumParameters(Class> clazz) {
- RunWith[] runWiths = clazz.getAnnotationsByType(RunWith.class);
- boolean testParameterized = runWiths != null
- && Arrays.stream(runWiths).anyMatch((r) -> r.value().equals(Parameterized.class));
- if (!testParameterized) {
- return 1;
- }
- for (Method method : clazz.getMethods()) {
- if (!isParametersMethod(method)) {
- continue;
- }
- // Found the parameters method. Figure out the number of parameters.
- Object parameters;
- try {
- parameters = method.invoke(clazz);
- } catch (IllegalAccessException | InvocationTargetException e) {
- LOG.warn("Error invoking parameters method {} in test class {}", method.getName(), clazz,
- e);
- continue;
- }
- if (parameters instanceof List) {
- return ((List) parameters).size();
- } else if (parameters instanceof Collection) {
- return ((Collection) parameters).size();
- } else if (parameters instanceof Iterable) {
- return Iterables.size((Iterable) parameters);
- } else if (parameters instanceof Object[]) {
- return ((Object[]) parameters).length;
- }
- }
- LOG.warn("Unable to determine parameters size. Returning the default of 1.");
- return 1;
- }
-
- /**
- * Helper method that checks if the input method is a valid JUnit @Parameters method.
- * @param method Input method.
- * @return true if the method is a valid JUnit parameters method, false otherwise.
- */
- private static boolean isParametersMethod(@NonNull Method method) {
- // A valid parameters method is public static and with @Parameters annotation.
- boolean methodPublicStatic =
- Modifier.isPublic(method.getModifiers()) && Modifier.isStatic(method.getModifiers());
- Parameters[] params = method.getAnnotationsByType(Parameters.class);
- return methodPublicStatic && (params != null && params.length > 0);
- }
-
- public static HBaseClassTestRule forClass(Class> clazz) {
- return new HBaseClassTestRule(clazz, Timeout.builder().withLookingForStuckThread(true)
- .withTimeout(getTimeoutInSeconds(clazz), TimeUnit.SECONDS).build());
- }
-
- @Override
- public Statement apply(Statement base, Description description) {
- return systemExitRule.apply(timeout.apply(base, description), description);
- }
-
-}
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRuleChecker.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRuleChecker.java
deleted file mode 100644
index d6ee1ccaaeee..000000000000
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseClassTestRuleChecker.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import org.apache.hadoop.hbase.testclassification.IntegrationTests;
-import org.apache.yetus.audience.InterfaceAudience;
-import org.junit.ClassRule;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.Description;
-import org.junit.runner.notification.RunListener;
-import org.junit.runner.notification.RunListener.ThreadSafe;
-
-/**
- * A RunListener to confirm that we have a {@link HBaseClassTestRule} class rule for every test.
- */
-@InterfaceAudience.Private
-@ThreadSafe
-public class HBaseClassTestRuleChecker extends RunListener {
-
- @Override
- public void testStarted(Description description) throws Exception {
- Category[] categories = description.getTestClass().getAnnotationsByType(Category.class);
-
- // @Category is not repeatable -- it is only possible to get an array of length zero or one.
- if (categories.length == 1) {
- for (Class> c : categories[0].value()) {
- if (c == IntegrationTests.class) {
- return;
- }
- }
- }
- for (Field field : description.getTestClass().getFields()) {
- if (
- Modifier.isStatic(field.getModifiers()) && field.getType() == HBaseClassTestRule.class
- && field.isAnnotationPresent(ClassRule.class)
- ) {
- HBaseClassTestRule timeout = (HBaseClassTestRule) field.get(null);
- assertEquals("The HBaseClassTestRule ClassRule in " + description.getTestClass().getName()
- + " is for " + timeout.getClazz().getName(), description.getTestClass(),
- timeout.getClazz());
- return;
- }
- }
- fail("No HBaseClassTestRule ClassRule for " + description.getTestClass().getName());
- }
-}
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseJupiterExtension.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseJupiterExtension.java
index 9d4ea87e0ec1..1c606568c307 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseJupiterExtension.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/HBaseJupiterExtension.java
@@ -178,7 +178,7 @@ private T runWithTimeout(Invocation invocation, ExtensionContext ctx, Str
private void printThreadDump() {
LOG.info("====> TEST TIMED OUT. PRINTING THREAD DUMP. <====");
- LOG.info(TimedOutTestsListener.buildThreadDiagnosticString());
+ LOG.info(TimedOutTestsThreadDumpHelper.buildThreadDiagnosticString());
}
@Override
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/ResourceCheckerJUnitListener.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/ResourceCheckerJUnitListener.java
deleted file mode 100644
index 2a796cc40774..000000000000
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/ResourceCheckerJUnitListener.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import org.junit.runner.notification.RunListener;
-
-/**
- * Listen to the test progress and check the usage of:
- *
- *
threads
- *
open file descriptor
- *
max open file descriptor
- *
- *
- * When surefire forkMode=once/always/perthread, this code is executed on the forked process.
- */
-public class ResourceCheckerJUnitListener extends RunListener {
-
- private final Map rcs = new ConcurrentHashMap<>();
-
- /**
- * To be implemented by sub classes if they want to add specific ResourceAnalyzer.
- */
- protected void addResourceAnalyzer(ResourceChecker rc) {
- }
-
- private void start(String testName) {
- ResourceChecker rc = new ResourceChecker(testName);
- JUnitResourceCheckers.addResourceAnalyzer(rc);
- addResourceAnalyzer(rc);
- rcs.put(testName, rc);
- rc.start();
- }
-
- private void end(String testName) {
- ResourceChecker rc = rcs.remove(testName);
- assert rc != null;
- rc.end();
- }
-
- /**
- * Get the test name from the JUnit Description
- * @return the string for the short test name
- */
- private String descriptionToShortTestName(org.junit.runner.Description description) {
- final int toRemove = "org.apache.hadoop.hbase.".length();
- return description.getTestClass().getName().substring(toRemove) + "#"
- + description.getMethodName();
- }
-
- @Override
- public void testStarted(org.junit.runner.Description description) throws java.lang.Exception {
- start(descriptionToShortTestName(description));
- }
-
- @Override
- public void testFinished(org.junit.runner.Description description) throws java.lang.Exception {
- end(descriptionToShortTestName(description));
- }
-}
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/SystemExitRule.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/SystemExitRule.java
deleted file mode 100644
index 4e3642cdb3b2..000000000000
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/SystemExitRule.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase;
-
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-/*
-* Test rules to prevent System.exit or Runtime.halt from exiting
-* the JVM - instead an exception is thrown.
-* */
-public class SystemExitRule implements TestRule {
- final static SecurityManager securityManager = new TestSecurityManager();
-
- @Override
- public Statement apply(final Statement s, Description d) {
- return new Statement() {
- @Override
- public void evaluate() throws Throwable {
-
- try {
- forbidSystemExitCall();
- s.evaluate();
- } finally {
- System.setSecurityManager(null);
- }
- }
-
- };
- };
-
- // Exiting the JVM is not allowed in tests and this exception is thrown instead
- // when it is done
- public static class SystemExitInTestException extends SecurityException {
- }
-
- private static void forbidSystemExitCall() {
- System.setSecurityManager(securityManager);
- }
-}
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TableNameTestRule.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TableNameTestRule.java
deleted file mode 100644
index ef73abd042e3..000000000000
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TableNameTestRule.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase;
-
-import org.junit.rules.TestWatcher;
-import org.junit.runner.Description;
-
-/**
- * Returns a {@code TableName} based on currently running test method name. Supports tests built on
- * the {@link org.junit.runners.Parameterized} runner.
- * @deprecated Use {@link TableNameTestExtension} instead, once we finish the migration of JUnit5,
- * which means we do not need {@link TableNameTestRule} any more, we can remove these
- * dependencies, see
- * HBASE-23671 for more
- * details.
- */
-@Deprecated
-public class TableNameTestRule extends TestWatcher {
-
- private TableName tableName;
-
- @Override
- protected void starting(Description description) {
- tableName = TableName.valueOf(cleanUpTestName(description.getMethodName()));
- }
-
- /**
- * Helper to handle parameterized method names. Unlike regular test methods, parameterized method
- * names look like 'foo[x]'. This is problematic for tests that use this name for HBase tables.
- * This helper strips out the parameter suffixes.
- * @return current test method name with out parameterized suffixes.
- */
- public static String cleanUpTestName(String methodName) {
- int index = methodName.indexOf('[');
- if (index == -1) {
- return methodName;
- }
- return methodName.substring(0, index);
- }
-
- public TableName getTableName() {
- return tableName;
- }
-}
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestBuildThreadDiagnosticString.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestBuildThreadDiagnosticString.java
index 74a4448983e1..6e4ce1f69ce1 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestBuildThreadDiagnosticString.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestBuildThreadDiagnosticString.java
@@ -35,7 +35,7 @@ public class TestBuildThreadDiagnosticString {
@Test
public void test() {
- String threadDump = TimedOutTestsListener.buildThreadDiagnosticString();
+ String threadDump = TimedOutTestsThreadDumpHelper.buildThreadDiagnosticString();
LOG.info(threadDump);
assertThat(threadDump,
containsString(getClass().getName() + ".test(" + getClass().getSimpleName() + ".java:"));
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseClassTestRule.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseClassTestRule.java
deleted file mode 100644
index dc2b13c1c3ed..000000000000
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/TestHBaseClassTestRule.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase;
-
-import static junit.framework.TestCase.assertEquals;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
-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.Parameters;
-
-import org.apache.hbase.thirdparty.com.google.common.collect.Iterables;
-
-/**
- * Tests HBaseClassTestRule.
- */
-@Category(SmallTests.class)
-public class TestHBaseClassTestRule {
-
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestHBaseClassTestRule.class);
-
- // Test input classes of various kinds.
- private static class NonParameterizedClass {
- void dummy() {
- }
-
- int dummy(int a) {
- return 0;
- }
- }
-
- @RunWith(Parameterized.class)
- private static class ParameterizedClassWithNoParametersMethod {
- void dummy() {
- }
- }
-
- @RunWith(Parameterized.class)
- @SuppressWarnings("UnusedMethod")
- private static class InValidParameterizedClass {
- // Not valid because parameters method is private.
- @Parameters
- private static List
-
- org.junit.vintage
- junit-vintage-engine
- test
- org.mockitomockito-core
diff --git a/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestSecureExport.java b/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestSecureExport.java
index 46885b64e123..bc0055b0f109 100644
--- a/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestSecureExport.java
+++ b/hbase-endpoint/src/test/java/org/apache/hadoop/hbase/coprocessor/TestSecureExport.java
@@ -70,6 +70,7 @@
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
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.TestInfo;
@@ -304,7 +305,7 @@ public void testAccessCase() throws Throwable {
}
@Test
- @org.junit.Ignore // See HBASE-23990
+ @Disabled // See HBASE-23990
public void testVisibilityLabels() throws IOException, Throwable {
final String exportTable = methodName + "_export";
final String importTable = methodName + "_import";
diff --git a/hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/row/stats/TestRowStatisticsEventHandler.java b/hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/row/stats/TestRowStatisticsEventHandler.java
index 423f23073a7b..fff85cd173fe 100644
--- a/hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/row/stats/TestRowStatisticsEventHandler.java
+++ b/hbase-examples/src/test/java/org/apache/hadoop/hbase/coprocessor/example/row/stats/TestRowStatisticsEventHandler.java
@@ -17,7 +17,7 @@
*/
package org.apache.hadoop.hbase.coprocessor.example.row.stats;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doThrow;
@@ -36,9 +36,9 @@
import org.apache.hadoop.hbase.metrics.impl.CounterImpl;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
@Tag(SmallTests.TAG)
public class TestRowStatisticsEventHandler {
@@ -53,7 +53,7 @@ public class TestRowStatisticsEventHandler {
private Counter failureCounter;
private RowStatisticsEventHandler eventHandler;
- @Before
+ @BeforeEach
public void setup() {
bufferedMutator = mock(BufferedMutator.class);
failureCounter = new CounterImpl();
diff --git a/hbase-it/pom.xml b/hbase-it/pom.xml
index 59987810f117..62b67b63548a 100644
--- a/hbase-it/pom.xml
+++ b/hbase-it/pom.xml
@@ -196,6 +196,11 @@
junit-jupiter-paramstest
+
+ org.junit.platform
+ junit-platform-launcher
+ test
+ org.hamcresthamcrest-core
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestDDLMasterFailover.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestDDLMasterFailover.java
index 6ca28bb4ae53..b659cf329ea6 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestDDLMasterFailover.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestDDLMasterFailover.java
@@ -17,7 +17,11 @@
*/
package org.apache.hadoop.hbase;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.util.ArrayList;
@@ -46,9 +50,8 @@
import org.apache.hadoop.hbase.util.Threads;
import org.apache.hadoop.hbase.util.hbck.HbckTestingUtil;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.Tag;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -96,7 +99,7 @@
* -Dhbase.IntegrationTestDDLMasterFailover.numRegions=50 --monkey masterKilling
*/
-@Category(IntegrationTests.class)
+@Tag(IntegrationTests.TAG)
public class IntegrationTestDDLMasterFailover extends IntegrationTestBase {
private static final Logger LOG = LoggerFactory.getLogger(IntegrationTestDDLMasterFailover.class);
@@ -200,8 +203,7 @@ protected void verifyNamespaces() throws IOException {
assertTrue(admin.getNamespaceDescriptor(nsName) != null,
"Namespace: " + nsName + " in namespaceMap does not exist");
} catch (NamespaceNotFoundException nsnfe) {
- Assert
- .fail("Namespace: " + nsName + " in namespaceMap does not exist: " + nsnfe.getMessage());
+ fail("Namespace: " + nsName + " in namespaceMap does not exist: " + nsnfe.getMessage());
}
}
admin.close();
@@ -220,8 +222,8 @@ protected void verifyTables() throws IOException {
"Table: " + tableName + " in disabledTables is not disabled");
}
for (TableName tableName : deletedTables.keySet()) {
- Assert.assertFalse("Table: " + tableName + " in deletedTables is not deleted",
- admin.tableExists(tableName));
+ assertFalse(admin.tableExists(tableName),
+ "Table: " + tableName + " in deletedTables is not deleted");
}
admin.close();
}
@@ -549,7 +551,7 @@ void perform() throws IOException {
TableName tableName = selected.getTableName();
LOG.info("Deleting table :" + selected);
admin.deleteTable(tableName);
- Assert.assertFalse("Table: " + selected + " was not deleted", admin.tableExists(tableName));
+ assertFalse(admin.tableExists(tableName), "Table: " + selected + " was not deleted");
deletedTables.put(tableName, selected);
LOG.info("Deleted table :" + selected);
} catch (Exception e) {
@@ -648,10 +650,10 @@ void perform() throws IOException {
TableDescriptor freshTableDesc = admin.getDescriptor(tableName);
ColumnFamilyDescriptor freshColumnDesc =
freshTableDesc.getColumnFamily(columnDesc.getName());
- Assert.assertEquals("Column family: " + columnDesc + " was not altered",
- freshColumnDesc.getMaxVersions(), versions);
- Assert.assertEquals("Column family: " + freshColumnDesc + " was not altered",
- freshColumnDesc.getMinVersions(), versions);
+ assertEquals(freshColumnDesc.getMaxVersions(), versions,
+ "Column family: " + columnDesc + " was not altered");
+ assertEquals(freshColumnDesc.getMinVersions(), versions,
+ "Column family: " + freshColumnDesc + " was not altered");
assertTrue(admin.isTableDisabled(tableName),
"After alter versions of column family, Table: " + tableName + " is not disabled");
disabledTables.put(tableName, freshTableDesc);
@@ -699,11 +701,10 @@ void perform() throws IOException {
TableDescriptor freshTableDesc = admin.getDescriptor(tableName);
ColumnFamilyDescriptor freshColumnDesc =
freshTableDesc.getColumnFamily(columnDesc.getName());
- Assert.assertEquals("Encoding of column family: " + columnDesc + " was not altered",
- freshColumnDesc.getDataBlockEncoding().getId(), id);
- Assert.assertTrue(
- "After alter encoding of column family, Table: " + tableName + " is not disabled",
- admin.isTableDisabled(tableName));
+ assertEquals(freshColumnDesc.getDataBlockEncoding().getId(), id,
+ "Encoding of column family: " + columnDesc + " was not altered");
+ assertTrue(admin.isTableDisabled(tableName),
+ "After alter encoding of column family, Table: " + tableName + " is not disabled");
disabledTables.put(tableName, freshTableDesc);
LOG.info("Altered encoding of column family: " + freshColumnDesc + " to: " + id
+ " in table: " + tableName);
@@ -737,10 +738,10 @@ void perform() throws IOException {
admin.deleteColumnFamily(tableName, cfd.getName());
// assertion
TableDescriptor freshTableDesc = admin.getDescriptor(tableName);
- Assert.assertFalse("Column family: " + cfd + " was not added",
- freshTableDesc.hasColumnFamily(cfd.getName()));
- Assert.assertTrue("After delete column family, Table: " + tableName + " is not disabled",
- admin.isTableDisabled(tableName));
+ assertFalse(freshTableDesc.hasColumnFamily(cfd.getName()),
+ "Column family: " + cfd + " was not added");
+ assertTrue(admin.isTableDisabled(tableName),
+ "After delete column family, Table: " + tableName + " is not disabled");
disabledTables.put(tableName, freshTableDesc);
LOG.info("Deleted column family: " + cfd + " from table: " + tableName);
} catch (Exception e) {
@@ -788,8 +789,8 @@ void perform() throws IOException {
table.put(put);
}
TableDescriptor freshTableDesc = admin.getDescriptor(tableName);
- Assert.assertTrue("After insert, Table: " + tableName + " in not enabled",
- admin.isTableEnabled(tableName));
+ assertTrue(admin.isTableEnabled(tableName),
+ "After insert, Table: " + tableName + " in not enabled");
enabledTables.put(tableName, freshTableDesc);
LOG.info("Added " + numRows + " rows to table: " + selected);
} catch (Exception e) {
@@ -902,11 +903,9 @@ private void checkException(List workers) {
for (Worker worker : workers) {
Exception e = worker.getSavedException();
if (e != null) {
- LOG.error("Found exception in thread: " + worker.getName());
- e.printStackTrace();
+ LOG.error("Found exception in thread: " + worker.getName(), e);
}
- Assert.assertNull("Action failed: " + worker.getAction() + " in thread: " + worker.getName(),
- e);
+ assertNull(e, "Action failed: " + worker.getAction() + " in thread: " + worker.getName());
}
}
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestRegionReplicaReplication.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestRegionReplicaReplication.java
index 9462d0a47a92..ba2ad27629e2 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestRegionReplicaReplication.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestRegionReplicaReplication.java
@@ -17,6 +17,8 @@
*/
package org.apache.hadoop.hbase;
+import static org.junit.jupiter.api.Assertions.fail;
+
import java.io.IOException;
import java.util.List;
import java.util.concurrent.BlockingQueue;
@@ -34,9 +36,8 @@
import org.apache.hadoop.hbase.util.test.LoadTestDataGenerator;
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.Assert;
-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.hbase.thirdparty.com.google.common.collect.Lists;
@@ -67,7 +68,7 @@
* -DIntegrationTestRegionReplicaReplication.num_write_threads=100
*
*/
-@Category(IntegrationTests.class)
+@Tag(IntegrationTests.TAG)
public class IntegrationTestRegionReplicaReplication extends IntegrationTestIngest {
private static final String TEST_NAME =
@@ -194,7 +195,7 @@ protected void runIngestTest(long defaultRunTime, long keysPerServerPerIter, int
if (0 != ret) {
String errorMsg = "Load failed with error code " + ret;
LOG.error(errorMsg);
- Assert.fail(errorMsg);
+ fail(errorMsg);
}
args = Lists.newArrayList(getArgsForLoadTestTool("", "", startKey, numKeys));
@@ -211,7 +212,7 @@ protected void runIngestTest(long defaultRunTime, long keysPerServerPerIter, int
if (0 != ret) {
String errorMsg = "Load failed with error code " + ret;
LOG.error(errorMsg);
- Assert.fail(errorMsg);
+ fail(errorMsg);
}
startKey += numKeys;
}
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestsDriver.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestsDriver.java
index dcc2e3234da4..bbe900ffff8a 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestsDriver.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/IntegrationTestsDriver.java
@@ -18,14 +18,20 @@
package org.apache.hadoop.hbase;
import java.io.IOException;
+import java.io.PrintWriter;
import java.util.Set;
import java.util.regex.Pattern;
import org.apache.hadoop.hbase.testclassification.IntegrationTests;
import org.apache.hadoop.hbase.util.AbstractHBaseTool;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.internal.TextListener;
-import org.junit.runner.JUnitCore;
-import org.junit.runner.Result;
+import org.junit.platform.engine.DiscoverySelector;
+import org.junit.platform.engine.discovery.DiscoverySelectors;
+import org.junit.platform.launcher.Launcher;
+import org.junit.platform.launcher.LauncherDiscoveryRequest;
+import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder;
+import org.junit.platform.launcher.core.LauncherFactory;
+import org.junit.platform.launcher.listeners.SummaryGeneratingListener;
+import org.junit.platform.launcher.listeners.TestExecutionSummary;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -95,6 +101,23 @@ private Class>[] findIntegrationTestClasses()
return classes.toArray(new Class>[classes.size()]);
}
+ private static int runTests(Class>[] classes) {
+ DiscoverySelector[] selectors = new DiscoverySelector[classes.length];
+ for (int i = 0; i < classes.length; i++) {
+ selectors[i] = DiscoverySelectors.selectClass(classes[i]);
+ }
+ LauncherDiscoveryRequest request =
+ LauncherDiscoveryRequestBuilder.request().selectors(selectors).build();
+ Launcher launcher = LauncherFactory.create();
+ SummaryGeneratingListener listener = new SummaryGeneratingListener();
+ launcher.registerTestExecutionListeners(listener);
+ launcher.execute(request);
+
+ TestExecutionSummary summary = listener.getSummary();
+ summary.printTo(new PrintWriter(System.out));
+ return summary.getTotalFailureCount() > 0 ? 1 : 0;
+ }
+
@Override
protected int doWork() throws Exception {
// this is called from the command line, so we should set to use the distributed cluster
@@ -104,10 +127,6 @@ protected int doWork() throws Exception {
for (Class> aClass : classes) {
LOG.info(" " + aClass);
}
- JUnitCore junit = new JUnitCore();
- junit.addListener(new TextListener(System.out));
- Result result = junit.run(classes);
-
- return result.wasSuccessful() ? 0 : 1;
+ return runTests(classes);
}
}
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/StripeCompactionsPerformanceEvaluation.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/StripeCompactionsPerformanceEvaluation.java
index d23255d7ee20..f812d6dc2103 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/StripeCompactionsPerformanceEvaluation.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/StripeCompactionsPerformanceEvaluation.java
@@ -17,6 +17,8 @@
*/
package org.apache.hadoop.hbase;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.io.IOException;
import java.util.List;
import java.util.Locale;
@@ -40,7 +42,6 @@
import org.apache.hadoop.hbase.util.RegionSplitter;
import org.apache.hadoop.hbase.util.test.LoadTestDataGenerator;
import org.apache.yetus.audience.InterfaceAudience;
-import org.junit.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -259,7 +260,7 @@ private void runOneTest(String description, Configuration conf) throws Exception
*/
status(description + " test took "
+ (EnvironmentEdgeManager.currentTime() - testStartTime) / 1000 + "sec");
- Assert.assertTrue(success);
+ assertTrue(success);
}
private static void status(String s) {
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/UnbalanceKillAndRebalanceAction.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/UnbalanceKillAndRebalanceAction.java
index 3a0f292e4a4b..d46644f45d20 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/UnbalanceKillAndRebalanceAction.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/chaos/actions/UnbalanceKillAndRebalanceAction.java
@@ -17,6 +17,8 @@
*/
package org.apache.hadoop.hbase.chaos.actions;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
@@ -25,7 +27,6 @@
import java.util.concurrent.ThreadLocalRandom;
import org.apache.hadoop.hbase.ClusterMetrics;
import org.apache.hadoop.hbase.ServerName;
-import org.junit.Assert;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -69,8 +70,8 @@ public void perform() throws Exception {
Set killedServers = new HashSet<>();
int liveCount = (int) Math.ceil(FRC_SERVERS_THAT_HOARD_AND_LIVE * victimServers.size());
int deadCount = (int) Math.ceil(FRC_SERVERS_THAT_HOARD_AND_DIE * victimServers.size());
- Assert.assertTrue("There are not enough victim servers: " + victimServers.size(),
- liveCount + deadCount < victimServers.size());
+ assertTrue(liveCount + deadCount < victimServers.size(),
+ "There are not enough victim servers: " + victimServers.size());
Random rand = ThreadLocalRandom.current();
List targetServers = new ArrayList<>(liveCount);
for (int i = 0; i < liveCount + deadCount; ++i) {
diff --git a/hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestTableSnapshotInputFormat.java b/hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestTableSnapshotInputFormat.java
index ec11284eb285..a6c795d39c71 100644
--- a/hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestTableSnapshotInputFormat.java
+++ b/hbase-it/src/test/java/org/apache/hadoop/hbase/mapreduce/IntegrationTestTableSnapshotInputFormat.java
@@ -28,9 +28,9 @@
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
import org.apache.hadoop.util.ToolRunner;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Tag;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -61,7 +61,7 @@
* "IntegrationTestTableSnapshotInputFormat.tableDir" => temporary directory to restore the
* snapshot files
*/
-@Category(IntegrationTests.class)
+@Tag(IntegrationTests.TAG)
// Not runnable as a unit test. See TestTableSnapshotInputFormat
public class IntegrationTestTableSnapshotInputFormat extends IntegrationTestBase {
private static final Logger LOG =
@@ -97,7 +97,7 @@ public void setConf(Configuration conf) {
}
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
util = getTestingUtil(getConf());
@@ -106,7 +106,7 @@ public void setUp() throws Exception {
}
@Override
- @After
+ @AfterEach
public void cleanUp() throws Exception {
util.restoreCluster();
}
diff --git a/hbase-mapreduce/pom.xml b/hbase-mapreduce/pom.xml
index 8b2063e64b8d..d0aa63d79c7b 100644
--- a/hbase-mapreduce/pom.xml
+++ b/hbase-mapreduce/pom.xml
@@ -191,6 +191,11 @@
junit-jupiter-paramstest
+
+ org.hamcrest
+ hamcrest-library
+ test
+ org.slf4jjcl-over-slf4j
diff --git a/hbase-rest/pom.xml b/hbase-rest/pom.xml
index 4463173c817c..3975c55ccf54 100644
--- a/hbase-rest/pom.xml
+++ b/hbase-rest/pom.xml
@@ -213,6 +213,11 @@
junit-jupiter-paramstest
+
+ org.hamcrest
+ hamcrest-library
+ test
+ org.mockitomockito-core
diff --git a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/model/TestColumnSchemaModel.java b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/model/TestColumnSchemaModel.java
index c6aac9eb96d0..45685b327cc4 100644
--- a/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/model/TestColumnSchemaModel.java
+++ b/hbase-rest/src/test/java/org/apache/hadoop/hbase/rest/model/TestColumnSchemaModel.java
@@ -20,20 +20,15 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.testclassification.RestTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.junit.ClassRule;
-import org.junit.experimental.categories.Category;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
-@Category({ RestTests.class, SmallTests.class })
+@Tag(RestTests.TAG)
+@Tag(SmallTests.TAG)
public class TestColumnSchemaModel extends TestModelBase {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestColumnSchemaModel.class);
-
protected static final String COLUMN_NAME = "testcolumn";
protected static final boolean BLOCKCACHE = true;
protected static final int BLOCKSIZE = 16384;
diff --git a/hbase-server/pom.xml b/hbase-server/pom.xml
index 80353e14185f..8cd7b4bc8535 100644
--- a/hbase-server/pom.xml
+++ b/hbase-server/pom.xml
@@ -297,11 +297,6 @@
junit-jupiter-paramstest
-
- org.junit.vintage
- junit-vintage-engine
- test
- org.awaitilityawaitility
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/ClearUserNamespacesAndTablesRule.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/ClearUserNamespacesAndTablesRule.java
deleted file mode 100644
index 87adccf2e3d4..000000000000
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/ClearUserNamespacesAndTablesRule.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase;
-
-import java.util.List;
-import java.util.Objects;
-import java.util.StringJoiner;
-import java.util.concurrent.CompletableFuture;
-import java.util.function.Supplier;
-import java.util.stream.Collectors;
-import org.apache.hadoop.hbase.client.AsyncAdmin;
-import org.apache.hadoop.hbase.client.AsyncConnection;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.rules.ExternalResource;
-import org.junit.rules.TestRule;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A {@link TestRule} that clears all user namespaces and tables {@link ExternalResource#before()
- * before} the test executes. Can be used in either the {@link Rule} or {@link ClassRule} positions.
- * Lazily realizes the provided {@link AsyncConnection} so as to avoid initialization races with
- * other {@link Rule Rules}. Does not {@link AsyncConnection#close() close()} provided
- * connection instance when finished.
- *
- * Use in combination with {@link MiniClusterRule} and {@link ConnectionRule}, for example:
- *
- *
- * {
- * @code
- * public class TestMyClass {
- * @ClassRule
- * public static final MiniClusterRule miniClusterRule = MiniClusterRule.newBuilder().build();
- *
- * private final ConnectionRule connectionRule =
- * new ConnectionRule(miniClusterRule::createConnection);
- * private final ClearUserNamespacesAndTablesRule clearUserNamespacesAndTablesRule =
- * new ClearUserNamespacesAndTablesRule(connectionRule::getConnection);
- *
- * @Rule
- * public TestRule rule =
- * RuleChain.outerRule(connectionRule).around(clearUserNamespacesAndTablesRule);
- * }
- * }
- *
- */
-public class ClearUserNamespacesAndTablesRule extends ExternalResource {
- private static final Logger logger =
- LoggerFactory.getLogger(ClearUserNamespacesAndTablesRule.class);
-
- private final Supplier connectionSupplier;
- private AsyncAdmin admin;
-
- public ClearUserNamespacesAndTablesRule(final Supplier connectionSupplier) {
- this.connectionSupplier = connectionSupplier;
- }
-
- @Override
- protected void before() throws Throwable {
- final AsyncConnection connection = Objects.requireNonNull(connectionSupplier.get());
- admin = connection.getAdmin();
-
- clearTablesAndNamespaces().join();
- }
-
- private CompletableFuture clearTablesAndNamespaces() {
- return deleteUserTables().thenCompose(_void -> deleteUserNamespaces());
- }
-
- private CompletableFuture deleteUserTables() {
- return listTableNames().thenApply(tableNames -> tableNames.stream()
- .map(tableName -> disableIfEnabled(tableName).thenCompose(_void -> deleteTable(tableName)))
- .toArray(CompletableFuture[]::new)).thenCompose(CompletableFuture::allOf);
- }
-
- private CompletableFuture> listTableNames() {
- return CompletableFuture.runAsync(() -> logger.trace("listing tables"))
- .thenCompose(_void -> admin.listTableNames(false)).thenApply(tableNames -> {
- if (logger.isTraceEnabled()) {
- final StringJoiner joiner = new StringJoiner(", ", "[", "]");
- tableNames.stream().map(TableName::getNameAsString).forEach(joiner::add);
- logger.trace("found existing tables {}", joiner.toString());
- }
- return tableNames;
- });
- }
-
- private CompletableFuture isTableEnabled(final TableName tableName) {
- return admin.isTableEnabled(tableName).thenApply(isEnabled -> {
- logger.trace("table {} is enabled.", tableName);
- return isEnabled;
- });
- }
-
- private CompletableFuture disableIfEnabled(final TableName tableName) {
- return isTableEnabled(tableName).thenCompose(
- isEnabled -> isEnabled ? disableTable(tableName) : CompletableFuture.completedFuture(null));
- }
-
- private CompletableFuture disableTable(final TableName tableName) {
- return CompletableFuture.runAsync(() -> logger.trace("disabling enabled table {}", tableName))
- .thenCompose(_void -> admin.disableTable(tableName));
- }
-
- private CompletableFuture deleteTable(final TableName tableName) {
- return CompletableFuture.runAsync(() -> logger.trace("deleting disabled table {}", tableName))
- .thenCompose(_void -> admin.deleteTable(tableName));
- }
-
- private CompletableFuture> listUserNamespaces() {
- return CompletableFuture.runAsync(() -> logger.trace("listing namespaces"))
- .thenCompose(_void -> admin.listNamespaceDescriptors()).thenApply(namespaceDescriptors -> {
- final StringJoiner joiner = new StringJoiner(", ", "[", "]");
- final List names = namespaceDescriptors.stream().map(NamespaceDescriptor::getName)
- .peek(joiner::add).collect(Collectors.toList());
- logger.trace("found existing namespaces {}", joiner);
- return names;
- })
- .thenApply(namespaces -> namespaces.stream()
- .filter(
- namespace -> !Objects.equals(namespace, NamespaceDescriptor.SYSTEM_NAMESPACE.getName()))
- .filter(
- namespace -> !Objects.equals(namespace, NamespaceDescriptor.DEFAULT_NAMESPACE.getName()))
- .collect(Collectors.toList()));
- }
-
- private CompletableFuture deleteNamespace(final String namespace) {
- return CompletableFuture.runAsync(() -> logger.trace("deleting namespace {}", namespace))
- .thenCompose(_void -> admin.deleteNamespace(namespace));
- }
-
- private CompletableFuture deleteUserNamespaces() {
- return listUserNamespaces().thenCompose(namespaces -> CompletableFuture
- .allOf(namespaces.stream().map(this::deleteNamespace).toArray(CompletableFuture[]::new)));
- }
-}
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/ConnectionRule.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/ConnectionRule.java
deleted file mode 100644
index 9927eb8c6a36..000000000000
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/ConnectionRule.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase;
-
-import java.io.IOException;
-import java.util.concurrent.CompletableFuture;
-import java.util.function.Supplier;
-import org.apache.hadoop.hbase.client.AsyncConnection;
-import org.apache.hadoop.hbase.client.Connection;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.rules.ExternalResource;
-
-/**
- * A {@link Rule} that manages the lifecycle of an instance of {@link AsyncConnection}. Can be used
- * in either the {@link Rule} or {@link ClassRule} positions.
- *
- * Use in combination with {@link MiniClusterRule}, for example:
- *
- *
- * {
- * @code
- * public class TestMyClass {
- * private static final MiniClusterRule miniClusterRule = MiniClusterRule.newBuilder().build();
- * private static final ConnectionRule connectionRule =
- * ConnectionRule.createAsyncConnectionRule(miniClusterRule::createConnection);
- *
- * @ClassRule
- * public static final TestRule rule =
- * RuleChain.outerRule(miniClusterRule).around(connectionRule);
- * }
- * }
- *
- *
- * @deprecated Use {@link ConnectionExtension} instead, once we finish the migration of JUnit5,
- * which means we do not need {@link ConnectionRule} any more, we can remove these
- * dependencies, see
- * HBASE-23671 for more
- * details.
- */
-@Deprecated
-public final class ConnectionRule extends ExternalResource {
-
- private final Supplier connectionSupplier;
- private final Supplier> asyncConnectionSupplier;
-
- private Connection connection;
- private AsyncConnection asyncConnection;
-
- public static ConnectionRule createConnectionRule(final Supplier connectionSupplier) {
- return new ConnectionRule(connectionSupplier, null);
- }
-
- public static ConnectionRule createAsyncConnectionRule(
- final Supplier> asyncConnectionSupplier) {
- return new ConnectionRule(null, asyncConnectionSupplier);
- }
-
- public static ConnectionRule createConnectionRule(final Supplier connectionSupplier,
- final Supplier> asyncConnectionSupplier) {
- return new ConnectionRule(connectionSupplier, asyncConnectionSupplier);
- }
-
- private ConnectionRule(final Supplier connectionSupplier,
- final Supplier> asyncConnectionSupplier) {
- this.connectionSupplier = connectionSupplier;
- this.asyncConnectionSupplier = asyncConnectionSupplier;
- }
-
- public Connection getConnection() {
- if (connection == null) {
- throw new IllegalStateException(
- "ConnectionRule not initialized with a synchronous connection.");
- }
- return connection;
- }
-
- public AsyncConnection getAsyncConnection() {
- if (asyncConnection == null) {
- throw new IllegalStateException(
- "ConnectionRule not initialized with an asynchronous connection.");
- }
- return asyncConnection;
- }
-
- @Override
- protected void before() throws Throwable {
- if (connectionSupplier != null) {
- this.connection = connectionSupplier.get();
- }
- if (asyncConnectionSupplier != null) {
- this.asyncConnection = asyncConnectionSupplier.get().join();
- }
- if (connection == null && asyncConnection != null) {
- this.connection = asyncConnection.toConnection();
- }
- }
-
- @Override
- protected void after() {
- CompletableFuture closeConnection = CompletableFuture.runAsync(() -> {
- if (this.connection != null) {
- try {
- connection.close();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- });
- CompletableFuture closeAsyncConnection = CompletableFuture.runAsync(() -> {
- if (this.asyncConnection != null) {
- try {
- asyncConnection.close();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- });
- CompletableFuture.allOf(closeConnection, closeAsyncConnection).join();
- }
-}
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniClusterRule.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniClusterRule.java
deleted file mode 100644
index a36fd05d4055..000000000000
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/MiniClusterRule.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase;
-
-import java.io.IOException;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.function.Supplier;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hbase.client.AsyncConnection;
-import org.apache.hadoop.hbase.client.Connection;
-import org.apache.hadoop.hbase.client.ConnectionFactory;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.rules.ExternalResource;
-import org.junit.rules.TestRule;
-
-/**
- * A {@link TestRule} that manages an instance of the {@link SingleProcessHBaseCluster}. Can be used
- * in either the {@link Rule} or {@link ClassRule} positions. Built on top of an instance of
- * {@link HBaseTestingUtil}, so be weary of intermixing direct use of that class with this Rule.
- *
- * Use in combination with {@link ConnectionRule}, for example:
- *
- *
- * {
- * @code
- * public class TestMyClass {
- * @ClassRule
- * public static final MiniClusterRule miniClusterRule = MiniClusterRule.newBuilder().build();
- *
- * @Rule
- * public final ConnectionRule connectionRule =
- * ConnectionRule.createAsyncConnectionRule(miniClusterRule::createAsyncConnection);
- * }
- * }
- *
- *
- * @deprecated Use {@link MiniClusterExtension} instead, Once we finish the migration of JUnit5,
- * which means we do not need {@link MiniClusterRule} any more, we can remove these
- * dependencies, see
- * HBASE-23671 for more
- * details.
- */
-@Deprecated
-public final class MiniClusterRule extends ExternalResource {
-
- /**
- * A builder for fluent composition of a new {@link MiniClusterRule}.
- */
- public static class Builder {
-
- private StartTestingClusterOption miniClusterOption;
- private Configuration conf;
-
- /**
- * Use the provided {@link StartTestingClusterOption} to construct the
- * {@link SingleProcessHBaseCluster}.
- */
- public Builder setMiniClusterOption(final StartTestingClusterOption miniClusterOption) {
- this.miniClusterOption = miniClusterOption;
- return this;
- }
-
- /**
- * Seed the underlying {@link HBaseTestingUtil} with the provided {@link Configuration}.
- */
- public Builder setConfiguration(final Configuration conf) {
- this.conf = conf;
- return this;
- }
-
- public Builder setConfiguration(Supplier supplier) {
- return setConfiguration(supplier.get());
- }
-
- public MiniClusterRule build() {
- return new MiniClusterRule(conf,
- miniClusterOption != null
- ? miniClusterOption
- : StartTestingClusterOption.builder().build());
- }
- }
-
- private final HBaseTestingUtil testingUtility;
- private final StartTestingClusterOption miniClusterOptions;
-
- private SingleProcessHBaseCluster miniCluster;
-
- private MiniClusterRule(final Configuration conf,
- final StartTestingClusterOption miniClusterOptions) {
- this.testingUtility = new HBaseTestingUtil(conf);
- this.miniClusterOptions = miniClusterOptions;
- }
-
- public static Builder newBuilder() {
- return new Builder();
- }
-
- /**
- * Returns the underlying instance of {@link HBaseTestingUtil}
- */
- public HBaseTestingUtil getTestingUtility() {
- return testingUtility;
- }
-
- /**
- * Create a {@link Connection} to the managed {@link SingleProcessHBaseCluster}. It's up to the
- * caller to {@link Connection#close() close()} the connection when finished.
- */
- public Connection createConnection() {
- try {
- return createAsyncConnection().get().toConnection();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Create a {@link AsyncConnection} to the managed {@link SingleProcessHBaseCluster}. It's up to
- * the caller to {@link AsyncConnection#close() close()} the connection when finished.
- */
- public CompletableFuture createAsyncConnection() {
- if (miniCluster == null) {
- throw new IllegalStateException("test cluster not initialized");
- }
- return ConnectionFactory.createAsyncConnection(miniCluster.getConf());
- }
-
- @Override
- protected void before() throws Throwable {
- miniCluster = testingUtility.startMiniCluster(miniClusterOptions);
- }
-
- @Override
- protected void after() {
- try {
- testingUtility.shutdownMiniCluster();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestCheckTestClasses.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/TestCheckTestClasses.java
deleted file mode 100644
index 961bc83763f7..000000000000
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/TestCheckTestClasses.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase;
-
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-import org.apache.hadoop.hbase.testclassification.MiscTests;
-import org.apache.hadoop.hbase.testclassification.SmallTests;
-import org.junit.ClassRule;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-/**
- * Checks tests are categorized.
- *
- * @deprecated Will be removed after we fully upgrade to junit5, so keep it as is.
- */
-@Deprecated
-@Category({ MiscTests.class, SmallTests.class })
-public class TestCheckTestClasses {
-
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestCheckTestClasses.class);
-
- /**
- * Throws an assertion if we find a test class without category (small/medium/large/integration).
- * List all the test classes without category in the assertion message.
- */
- @Test
- public void checkClasses() throws Exception {
- List> badClasses = new java.util.ArrayList<>();
- ClassTestFinder classFinder = new ClassTestFinder();
- for (Class> c : classFinder.findClasses(false)) {
- if (
- ClassTestFinder.getCategoryAnnotations(c).length == 0
- && ClassTestFinder.getTagAnnotations(c).length == 0
- ) {
- badClasses.add(c);
- }
- }
- assertTrue(
- "There are " + badClasses.size() + " test classes without category and tag: " + badClasses,
- badClasses.isEmpty());
- }
-}
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRegionLocatorPagedScanRpcCount.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRegionLocatorPagedScanRpcCount.java
index 6c63ec7cb03d..3e772d9feb55 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRegionLocatorPagedScanRpcCount.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestRegionLocatorPagedScanRpcCount.java
@@ -18,7 +18,7 @@
package org.apache.hadoop.hbase.client;
import static org.apache.hadoop.hbase.util.FutureUtils.get;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
@@ -26,7 +26,6 @@
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.hadoop.hbase.ClientMetaTableAccessor;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtil;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionLocation;
@@ -35,11 +34,10 @@
import org.apache.hadoop.hbase.testclassification.ClientTests;
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;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
@@ -52,13 +50,10 @@
* Cluster runs with {@code hbase.meta.scanner.caching = 2} so the {@code limit > caching} branch is
* exercised cheaply with a small table (5 user regions).
*/
-@Category({ MediumTests.class, ClientTests.class })
+@Tag(MediumTests.TAG)
+@Tag(ClientTests.TAG)
public class TestRegionLocatorPagedScanRpcCount {
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestRegionLocatorPagedScanRpcCount.class);
-
private static final HBaseTestingUtil UTIL = new HBaseTestingUtil();
private static final TableName TABLE_NAME = TableName.valueOf("LocatorPaged");
private static final byte[] FAMILY = Bytes.toBytes("family");
@@ -69,7 +64,7 @@ public class TestRegionLocatorPagedScanRpcCount {
private static AsyncConnection CONN;
- @BeforeClass
+ @BeforeAll
public static void setUp() throws Exception {
UTIL.getConfiguration().setInt(HConstants.HBASE_META_SCANNER_CACHING, META_CACHING);
UTIL.startMiniCluster(1);
@@ -85,7 +80,7 @@ public static void setUp() throws Exception {
CONN = ConnectionFactory.createAsyncConnection(UTIL.getConfiguration()).get();
}
- @AfterClass
+ @AfterAll
public static void tearDown() throws Exception {
Closeables.close(CONN, true);
UTIL.shutdownMiniCluster();
@@ -95,7 +90,7 @@ public static void tearDown() throws Exception {
public void testSingleRpcWhenLimitWithinCaching() throws Exception {
// limit (2) <= caching (2): trivially one ScannerNext. Baseline.
int rpcs = runPagedScanAndCountRpcs(2);
- assertEquals("expected exactly one ScannerNext RPC for limit <= caching", 1, rpcs);
+ assertEquals(1, rpcs, "expected exactly one ScannerNext RPC for limit <= caching");
}
@Test
@@ -103,8 +98,8 @@ public void testSingleRpcWhenLimitExceedsCaching() throws Exception {
// limit (5) > caching (2): without the isPagedScan fix this would be ceil(5/2) = 3
// ScannerNext RPCs. With the fix, getMetaScan sizes caching to limit -> 1 RPC.
int rpcs = runPagedScanAndCountRpcs(NUM_REGIONS);
- assertEquals("expected exactly one ScannerNext RPC for paged scan even when limit > caching", 1,
- rpcs);
+ assertEquals(1, rpcs,
+ "expected exactly one ScannerNext RPC for paged scan even when limit > caching");
}
@Test
@@ -120,10 +115,9 @@ public void testUnboundedPathStillUsesConfiguredCaching() throws Exception {
get(ClientMetaTableAccessor.getTableHRegionLocations(metaTable, TABLE_NAME));
assertEquals(NUM_REGIONS, all.size());
int rpcs = onNextCalls.get();
- assertEquals(
+ assertEquals((int) Math.ceil((double) NUM_REGIONS / META_CACHING), rpcs,
"unbounded scan should still split across "
- + "ceil(NUM_REGIONS / caching) ScannerNext batches; got " + rpcs,
- (int) Math.ceil((double) NUM_REGIONS / META_CACHING), rpcs);
+ + "ceil(NUM_REGIONS / caching) ScannerNext batches; got " + rpcs);
}
private int runPagedScanAndCountRpcs(int limit) throws Exception {
@@ -131,7 +125,7 @@ private int runPagedScanAndCountRpcs(int limit) throws Exception {
AsyncTable metaTable = wrapMetaTable(onNextCalls);
List page =
get(ClientMetaTableAccessor.getTableHRegionLocations(metaTable, TABLE_NAME, null, limit));
- assertEquals("paged call returned wrong number of regions", limit, page.size());
+ assertEquals(limit, page.size(), "paged call returned wrong number of regions");
return onNextCalls.get();
}
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCacheRefCnt.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCacheRefCnt.java
index 08e7e8ea69e4..b466719136c0 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCacheRefCnt.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketCacheRefCnt.java
@@ -45,6 +45,7 @@
import org.apache.hadoop.hbase.nio.RefCnt;
import org.apache.hadoop.hbase.testclassification.IOTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
@@ -101,7 +102,7 @@ private void disableWriter() {
}
}
- @org.junit.Ignore
+ @Disabled
@Test // Disabled by HBASE-24079. Reenable issue HBASE-24082
// Flakey TestBucketCacheRefCnt.testBlockInRAMCache:121 expected:<3> but was:<2>
public void testBlockInRAMCache() throws IOException {
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/QosTestBase.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/QosTestBase.java
index 192ac6d0b8a6..f2dba9f7dbb7 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/QosTestBase.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/ipc/QosTestBase.java
@@ -17,7 +17,7 @@
*/
package org.apache.hadoop.hbase.ipc;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.security.User;
@@ -37,7 +37,7 @@ protected final void checkMethod(Configuration conf, final String methodName, fi
final AnnotationReadingPriorityFunction> qosf, final Message param) {
RPCProtos.RequestHeader.Builder builder = RPCProtos.RequestHeader.newBuilder();
builder.setMethodName(methodName);
- assertEquals(methodName, expected, qosf.getPriority(builder.build(), param,
- User.createUserForTesting(conf, "someuser", new String[] { "somegroup" })));
+ assertEquals(expected, qosf.getPriority(builder.build(), param,
+ User.createUserForTesting(conf, "someuser", new String[] { "somegroup" })), methodName);
}
}
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 ec1a567591cd..0d485ae8c964 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/regionserver/AbstractTestDateTieredCompactionPolicy.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/AbstractTestDateTieredCompactionPolicy.java
index 48a4e7b2984c..f5226411163d 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/trace/OpenTelemetryClassRule.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/OpenTelemetryClassRule.java
deleted file mode 100644
index 7b5455f20119..000000000000
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/OpenTelemetryClassRule.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.trace;
-
-import io.opentelemetry.api.GlobalOpenTelemetry;
-import io.opentelemetry.api.OpenTelemetry;
-import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator;
-import io.opentelemetry.context.propagation.ContextPropagators;
-import io.opentelemetry.sdk.OpenTelemetrySdk;
-import io.opentelemetry.sdk.testing.exporter.InMemorySpanExporter;
-import io.opentelemetry.sdk.testing.junit4.OpenTelemetryRule;
-import io.opentelemetry.sdk.trace.SdkTracerProvider;
-import io.opentelemetry.sdk.trace.data.SpanData;
-import io.opentelemetry.sdk.trace.export.SimpleSpanProcessor;
-import java.util.List;
-import org.junit.rules.ExternalResource;
-
-/**
- *
- * Like {@link OpenTelemetryRule}, except modeled after the junit5 implementation
- * {@code OpenTelemetryExtension}. Use this class when you need to make asserts on {@link SpanData}
- * created on a MiniCluster. Make sure this rule initialized before the MiniCluster so that it can
- * register its instance of {@link OpenTelemetry} as the global instance before any server-side
- * component can call {@link TraceUtil#getGlobalTracer()}.
- *
- *
- * For example:
- *
- *
- *
- * {
- * @code
- * public class TestMyClass {
- * private static final OpenTelemetryClassRule otelClassRule = OpenTelemetryClassRule.create();
- * private static final MiniClusterRule miniClusterRule = MiniClusterRule.newBuilder().build();
- * protected static final ConnectionRule connectionRule =
- * ConnectionRule.createAsyncConnectionRule(miniClusterRule::createAsyncConnection);
- *
- * @ClassRule
- * public static final TestRule classRule =
- * RuleChain.outerRule(otelClassRule).around(miniClusterRule).around(connectionRule);
- *
- * @Rule
- * public final OpenTelemetryTestRule otelTestRule = new OpenTelemetryTestRule(otelClassRule);
- *
- * @Test
- * public void myTest() {
- * // ...
- * // do something that makes spans
- * final List spans = otelClassRule.getSpans();
- * // make assertions on them
- * }
- * }
- * }
- *
- *
- * @see junit5/OpenTelemetryExtension.java
- */
-public final class OpenTelemetryClassRule extends ExternalResource {
-
- public static OpenTelemetryClassRule create() {
- InMemorySpanExporter spanExporter = InMemorySpanExporter.create();
-
- SdkTracerProvider tracerProvider = SdkTracerProvider.builder()
- .addSpanProcessor(SimpleSpanProcessor.create(spanExporter)).build();
-
- OpenTelemetrySdk openTelemetry = OpenTelemetrySdk.builder()
- .setPropagators(ContextPropagators.create(W3CTraceContextPropagator.getInstance()))
- .setTracerProvider(tracerProvider).build();
-
- return new OpenTelemetryClassRule(openTelemetry, spanExporter);
- }
-
- private final OpenTelemetrySdk openTelemetry;
- private final InMemorySpanExporter spanExporter;
-
- private OpenTelemetryClassRule(final OpenTelemetrySdk openTelemetry,
- final InMemorySpanExporter spanExporter) {
- this.openTelemetry = openTelemetry;
- this.spanExporter = spanExporter;
- }
-
- /** Returns the {@link OpenTelemetry} created by this Rule. */
- public OpenTelemetry getOpenTelemetry() {
- return openTelemetry;
- }
-
- /** Returns all the exported {@link SpanData} so far. */
- public List getSpans() {
- return spanExporter.getFinishedSpanItems();
- }
-
- /**
- * Clears the collected exported {@link SpanData}.
- */
- public void clearSpans() {
- spanExporter.reset();
- }
-
- @Override
- protected void before() throws Throwable {
- GlobalOpenTelemetry.resetForTest();
- GlobalOpenTelemetry.set(openTelemetry);
- }
-
- @Override
- protected void after() {
- GlobalOpenTelemetry.resetForTest();
- }
-}
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/OpenTelemetryTestRule.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/OpenTelemetryTestRule.java
deleted file mode 100644
index a51dc2eff450..000000000000
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/trace/OpenTelemetryTestRule.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.hadoop.hbase.trace;
-
-import org.junit.rules.ExternalResource;
-
-/**
- * Used alongside {@link OpenTelemetryClassRule}. See that class's javadoc for details on when to
- * use these classes instead of {@link io.opentelemetry.sdk.testing.junit4.OpenTelemetryRule} and an
- * example of how to use these classes together.
- */
-public final class OpenTelemetryTestRule extends ExternalResource {
-
- private final OpenTelemetryClassRule classRuleSupplier;
-
- public OpenTelemetryTestRule(final OpenTelemetryClassRule classRule) {
- this.classRuleSupplier = classRule;
- }
-
- @Override
- protected void before() throws Throwable {
- classRuleSupplier.clearSpans();
- }
-}
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 3aa247c06325..07add0667b01 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 static void assertArchiveEqualToOriginal(FileStatus[] expected, FileStatu
// 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 8f5e660f1f7f..e508e4964a89 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.Locale;
@@ -147,7 +147,7 @@ public static void verifyTags(Table table) throws IOException {
}
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 a69971e1f36f..aff65053b866 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 41e98464bfde..7923b0e865fb 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-shaded/hbase-shaded-check-invariants/pom.xml b/hbase-shaded/hbase-shaded-check-invariants/pom.xml
index 51afd3a5b001..8668efd27eef 100644
--- a/hbase-shaded/hbase-shaded-check-invariants/pom.xml
+++ b/hbase-shaded/hbase-shaded-check-invariants/pom.xml
@@ -84,11 +84,6 @@
junit-jupiter-paramsprovided
-
- org.junit.vintage
- junit-vintage-engine
- provided
- org.mockitomockito-core
diff --git a/hbase-shaded/hbase-shaded-testing-util-tester/pom.xml b/hbase-shaded/hbase-shaded-testing-util-tester/pom.xml
index 97950ed9f2d2..40c26684f4fa 100644
--- a/hbase-shaded/hbase-shaded-testing-util-tester/pom.xml
+++ b/hbase-shaded/hbase-shaded-testing-util-tester/pom.xml
@@ -48,11 +48,6 @@
junit-jupiter-paramstest
-
- org.junit.vintage
- junit-vintage-engine
- test
- org.apache.hbasehbase-logging
diff --git a/hbase-shaded/hbase-shaded-testing-util-tester/src/test/java/org/apache/hbase/shaded/TestShadedHBaseTestingUtility.java b/hbase-shaded/hbase-shaded-testing-util-tester/src/test/java/org/apache/hbase/shaded/TestShadedHBaseTestingUtility.java
index 6bff222a8a25..11fd9f98236a 100644
--- a/hbase-shaded/hbase-shaded-testing-util-tester/src/test/java/org/apache/hbase/shaded/TestShadedHBaseTestingUtility.java
+++ b/hbase-shaded/hbase-shaded-testing-util-tester/src/test/java/org/apache/hbase/shaded/TestShadedHBaseTestingUtility.java
@@ -17,9 +17,8 @@
*/
package org.apache.hbase.shaded;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
-import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtil;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Put;
@@ -27,26 +26,23 @@
import org.apache.hadoop.hbase.testclassification.ClientTests;
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({ ClientTests.class, MediumTests.class })
+@Tag(ClientTests.TAG)
+@Tag(MediumTests.TAG)
public class TestShadedHBaseTestingUtility {
- private static final HBaseTestingUtil TEST_UTIL = new HBaseTestingUtil();
- @ClassRule
- public static final HBaseClassTestRule CLASS_RULE =
- HBaseClassTestRule.forClass(TestShadedHBaseTestingUtility.class);
+ private static final HBaseTestingUtil TEST_UTIL = new HBaseTestingUtil();
- @BeforeClass
+ @BeforeAll
public static void setUp() throws Exception {
TEST_UTIL.startMiniCluster();
}
- @AfterClass
+ @AfterAll
public static void tearDown() throws Exception {
TEST_UTIL.shutdownMiniCluster();
}
diff --git a/hbase-shaded/hbase-shaded-with-hadoop-check-invariants/pom.xml b/hbase-shaded/hbase-shaded-with-hadoop-check-invariants/pom.xml
index bc77916b6324..a09b93eb2c26 100644
--- a/hbase-shaded/hbase-shaded-with-hadoop-check-invariants/pom.xml
+++ b/hbase-shaded/hbase-shaded-with-hadoop-check-invariants/pom.xml
@@ -74,11 +74,6 @@
junit-jupiter-paramsprovided
-
- org.junit.vintage
- junit-vintage-engine
- provided
- org.mockitomockito-core
diff --git a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServerBase.java b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServerBase.java
index 2f90c39bfc74..f313e5f463eb 100644
--- a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServerBase.java
+++ b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift/TestThriftHttpServerBase.java
@@ -21,7 +21,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.fail;
import java.io.IOException;
import java.net.HttpURLConnection;
@@ -40,7 +39,6 @@
import org.apache.thrift.transport.THttpClient;
import org.apache.thrift.transport.TTransportException;
import org.junit.jupiter.api.Test;
-import org.junit.rules.ExpectedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -73,21 +71,11 @@ public void testExceptionThrownWhenMisConfigured() throws IOException {
Configuration conf = new Configuration(TEST_UTIL.getConfiguration());
conf.set("hbase.thrift.security.qop", "privacy");
conf.setBoolean("hbase.thrift.ssl.enabled", false);
- ExpectedException thrown = ExpectedException.none();
- ThriftServerRunner tsr = null;
- try {
- thrown.expect(IllegalArgumentException.class);
- thrown.expectMessage(
- "Thrift HTTP Server's QoP is privacy, " + "but hbase.thrift.ssl.enabled is false");
- tsr = TestThriftServerCmdLine.createBoundServer(() -> new ThriftServer(conf));
- fail("Thrift HTTP Server starts up even with wrong security configurations.");
- } catch (Exception e) {
- LOG.info("Expected!", e);
- } finally {
- if (tsr != null) {
- tsr.close();
- }
- }
+ IllegalArgumentException e = assertThrows(IllegalArgumentException.class,
+ () -> TestThriftServerCmdLine.createBoundServer(() -> new ThriftServer(conf)),
+ "Thrift HTTP Server starts up even with wrong security configurations.");
+ assertEquals("Thrift HTTP Server's QoP is privacy, but hbase.thrift.ssl.enabled is false",
+ e.getMessage());
}
@Test
diff --git a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java
index 108e5fece941..76f0dfba73a6 100644
--- a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java
+++ b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java
@@ -132,6 +132,7 @@
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
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.TestInfo;
@@ -773,7 +774,7 @@ public void testScan() throws Exception {
* Tests keeping a HBase scanner alive for long periods of time. Each call to getScannerRow()
* should reset the ConnectionCache timeout for the scanner's connection.
*/
- @org.junit.Ignore
+ @Disabled
@Test // Flakey. Diasabled by HBASE-24079. Renable with Fails with HBASE-24083.
// Caused by: java.util.concurrent.RejectedExecutionException:
// Task org.apache.hadoop.hbase.client.ResultBoundedCompletionService$QueueingFuture@e385431
diff --git a/pom.xml b/pom.xml
index e47de81da76d..edead44b751b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -910,7 +910,6 @@
9.0.1109.4.14.05.13.4
- 5.13.44.3.01.31.49.0
@@ -1669,28 +1668,11 @@
- org.junit.jupiter
- junit-jupiter-api
+ org.junit
+ junit-bom${junit.jupiter.version}
- test
-
-
- org.junit.jupiter
- junit-jupiter-engine
- ${junit.jupiter.version}
- test
-
-
- org.junit.jupiter
- junit-jupiter-params
- ${junit.jupiter.version}
- test
-
-
- org.junit.vintage
- junit-vintage-engine
- ${junit.vintage.version}
- test
+ pom
+ importorg.awaitility
@@ -2588,6 +2570,24 @@