You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by nd...@apache.org on 2015/09/09 20:49:10 UTC
hbase git commit: HBASE-14382 TestInterfaceAudienceAnnotations should
hadoop-compt module resources
Repository: hbase
Updated Branches:
refs/heads/master 27d3ab43e -> a11bb2a93
HBASE-14382 TestInterfaceAudienceAnnotations should hadoop-compt module resources
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/a11bb2a9
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/a11bb2a9
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/a11bb2a9
Branch: refs/heads/master
Commit: a11bb2a933ad799546e7179fdf6ce75e3e22d44b
Parents: 27d3ab4
Author: Nick Dimiduk <nd...@apache.org>
Authored: Wed Sep 9 11:08:28 2015 -0700
Committer: Nick Dimiduk <nd...@apache.org>
Committed: Wed Sep 9 11:08:28 2015 -0700
----------------------------------------------------------------------
.../hbase/TestInterfaceAudienceAnnotations.java | 8 ++++++--
.../java/org/apache/hadoop/hbase/ClassFinder.java | 17 ++++++++++++++++-
.../org/apache/hadoop/hbase/ClassTestFinder.java | 1 +
3 files changed, 23 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11bb2a9/hbase-client/src/test/java/org/apache/hadoop/hbase/TestInterfaceAudienceAnnotations.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/test/java/org/apache/hadoop/hbase/TestInterfaceAudienceAnnotations.java b/hbase-client/src/test/java/org/apache/hadoop/hbase/TestInterfaceAudienceAnnotations.java
index be79278..0e0fbb0 100644
--- a/hbase-client/src/test/java/org/apache/hadoop/hbase/TestInterfaceAudienceAnnotations.java
+++ b/hbase-client/src/test/java/org/apache/hadoop/hbase/TestInterfaceAudienceAnnotations.java
@@ -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()),
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11bb2a9/hbase-common/src/test/java/org/apache/hadoop/hbase/ClassFinder.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/test/java/org/apache/hadoop/hbase/ClassFinder.java b/hbase-common/src/test/java/org/apache/hadoop/hbase/ClassFinder.java
index d46537c..01d387c 100644
--- a/hbase-common/src/test/java/org/apache/hadoop/hbase/ClassFinder.java
+++ b/hbase-common/src/test/java/org/apache/hadoop/hbase/ClassFinder.java
@@ -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() {
http://git-wip-us.apache.org/repos/asf/hbase/blob/a11bb2a9/hbase-common/src/test/java/org/apache/hadoop/hbase/ClassTestFinder.java
----------------------------------------------------------------------
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 5d4d941..9d5618b 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
@@ -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");