Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions hbase-assembly/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,6 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions hbase-asyncfs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk18on</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down
5 changes: 0 additions & 5 deletions hbase-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,6 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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<String> values = new ArrayList<>();
for (Tag tag : tags) {
values.add(tag.value());
List<Class<?>> 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 */
Expand All @@ -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() {
Expand All @@ -91,36 +87,29 @@ public TestClassFilter() {

@Override
public boolean isCandidateClass(Class<?> c) {
return isTestClass(c) && isCategorizedClass(c);
return isTestClass(c) && isTagedClass(c);
}

private boolean isTestClass(Class<?> c) {
if (Modifier.isAbstract(c.getModifiers())) {
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;
}
}

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;
}
}
Expand Down

This file was deleted.

Loading