HBASE-14382 TestInterfaceAudienceAnnotations should hadoop-compt module resources
This commit is contained in:
parent
27d3ab43ef
commit
a11bb2a933
|
@ -231,13 +231,15 @@ public class TestInterfaceAudienceAnnotations {
|
|||
|
||||
// find classes that are:
|
||||
// In the main jar
|
||||
// AND are not in a hadoop-compat module
|
||||
// AND are public
|
||||
// NOT test classes
|
||||
// AND NOT generated classes
|
||||
// AND are NOT annotated with InterfaceAudience
|
||||
// AND are NOT from Clover rewriting sources
|
||||
ClassFinder classFinder = new ClassFinder(
|
||||
new MainCodeResourcePathFilter(),
|
||||
new And(new MainCodeResourcePathFilter(),
|
||||
new TestFileNameFilter()),
|
||||
new Not((FileNameFilter)new TestFileNameFilter()),
|
||||
new And(new PublicClassFilter(),
|
||||
new Not(new TestClassFilter()),
|
||||
|
@ -268,13 +270,15 @@ public class TestInterfaceAudienceAnnotations {
|
|||
|
||||
// find classes that are:
|
||||
// In the main jar
|
||||
// AND are not in a hadoop-compat module
|
||||
// AND are public
|
||||
// NOT test classes
|
||||
// AND NOT generated classes
|
||||
// AND are annotated with InterfaceAudience.Public
|
||||
// AND NOT annotated with InterfaceStability
|
||||
ClassFinder classFinder = new ClassFinder(
|
||||
new MainCodeResourcePathFilter(),
|
||||
new And(new MainCodeResourcePathFilter(),
|
||||
new TestFileNameFilter()),
|
||||
new Not((FileNameFilter)new TestFileNameFilter()),
|
||||
new And(new PublicClassFilter(),
|
||||
new Not(new TestClassFilter()),
|
||||
|
|
|
@ -85,9 +85,15 @@ public class ClassFinder {
|
|||
}
|
||||
}
|
||||
|
||||
public static class And implements ClassFilter {
|
||||
public static class And implements ClassFilter, ResourcePathFilter {
|
||||
ClassFilter[] classFilters;
|
||||
ResourcePathFilter[] resourcePathFilters;
|
||||
|
||||
public And(ClassFilter...classFilters) { this.classFilters = classFilters; }
|
||||
public And(ResourcePathFilter... resourcePathFilters) {
|
||||
this.resourcePathFilters = resourcePathFilters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCandidateClass(Class<?> c) {
|
||||
for (ClassFilter filter : classFilters) {
|
||||
|
@ -97,6 +103,15 @@ public class ClassFinder {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean isCandidatePath(String resourcePath, boolean isJar) {
|
||||
for (ResourcePathFilter filter : resourcePathFilters) {
|
||||
if (!filter.isCandidatePath(resourcePath, isJar)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public ClassFinder() {
|
||||
|
|
|
@ -48,6 +48,7 @@ public class ClassTestFinder extends ClassFinder {
|
|||
return new Class<?>[0];
|
||||
}
|
||||
|
||||
/** Filters both test classes and anything in the hadoop-compat modules */
|
||||
public static class TestFileNameFilter implements FileNameFilter, ResourcePathFilter {
|
||||
private static final Pattern hadoopCompactRe =
|
||||
Pattern.compile("hbase-hadoop\\d?-compat");
|
||||
|
|
Loading…
Reference in New Issue