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