You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bu...@apache.org on 2015/05/11 09:51:01 UTC
[1/2] hbase git commit: HBASE-13611 update clover profile to work
with clover 4.x and maven 3.
Repository: hbase
Updated Branches:
refs/heads/branch-1.0 858ebb90d -> 549319a4a
refs/heads/branch-1.1 0347bf8e0 -> 44fdd02d8
HBASE-13611 update clover profile to work with clover 4.x and maven 3.
* change pom to use a maven 3 compat version of clover
* add clover to javadoc plugin deps so that instrumented doclet works
* modify IA annotation test to filter out clover instrumentation
* make splitlog counters check for atomiclong before casting
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/44fdd02d
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/44fdd02d
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/44fdd02d
Branch: refs/heads/branch-1.1
Commit: 44fdd02d80135930b750dd3a870d13625c756629
Parents: 0347bf8
Author: Sean Busbey <bu...@apache.org>
Authored: Fri May 1 23:53:13 2015 -0500
Committer: Sean Busbey <bu...@cloudera.com>
Committed: Mon May 11 01:40:15 2015 -0500
----------------------------------------------------------------------
.../hbase/TestInterfaceAudienceAnnotations.java | 27 +++++++++++++++++++-
.../apache/hadoop/hbase/SplitLogCounters.java | 5 +++-
pom.xml | 22 ++++++++++++----
3 files changed, 47 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/44fdd02d/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 ace11ec..be79278 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
@@ -199,6 +199,29 @@ public class TestInterfaceAudienceAnnotations {
}
/**
+ * Selects classes that appear to be source instrumentation from Clover.
+ * Clover generates instrumented code in order to calculate coverage. Part of the
+ * generated source is a static inner class on each source class.
+ *
+ * - has an enclosing class
+ * - enclosing class is not an interface
+ * - name starts with "__CLR"
+ */
+ class CloverInstrumentationFilter implements ClassFinder.ClassFilter {
+ @Override
+ public boolean isCandidateClass(Class<?> clazz) {
+ boolean clover = false;
+ final Class<?> enclosing = clazz.getEnclosingClass();
+ if (enclosing != null) {
+ if (!(enclosing.isInterface())) {
+ clover = clazz.getSimpleName().startsWith("__CLR");
+ }
+ }
+ return clover;
+ }
+ }
+
+ /**
* Checks whether all the classes in client and common modules contain
* {@link InterfaceAudience} annotations.
*/
@@ -212,6 +235,7 @@ public class TestInterfaceAudienceAnnotations {
// 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 Not((FileNameFilter)new TestFileNameFilter()),
@@ -219,7 +243,8 @@ public class TestInterfaceAudienceAnnotations {
new Not(new TestClassFilter()),
new Not(new GeneratedClassFilter()),
new Not(new IsInterfaceStabilityClassFilter()),
- new Not(new InterfaceAudienceAnnotatedClassFilter()))
+ new Not(new InterfaceAudienceAnnotatedClassFilter()),
+ new Not(new CloverInstrumentationFilter()))
);
Set<Class<?>> classes = classFinder.findClasses(false);
http://git-wip-us.apache.org/repos/asf/hbase/blob/44fdd02d/hbase-server/src/main/java/org/apache/hadoop/hbase/SplitLogCounters.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/SplitLogCounters.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/SplitLogCounters.java
index 6af5045..bde1b88 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/SplitLogCounters.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/SplitLogCounters.java
@@ -88,7 +88,10 @@ public class SplitLogCounters {
public static void resetCounters() throws Exception {
Class<?> cl = SplitLogCounters.class;
for (Field fld : cl.getDeclaredFields()) {
- if (!fld.isSynthetic()) ((AtomicLong)fld.get(null)).set(0);
+ /* Guard against source instrumentation. */
+ if ((!fld.isSynthetic()) && (AtomicLong.class.isAssignableFrom(fld.getType()))) {
+ ((AtomicLong)fld.get(null)).set(0);
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/44fdd02d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index add282f..bfcdf4e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1098,7 +1098,7 @@
<zookeeper.version>3.4.6</zookeeper.version>
<slf4j.version>1.7.7</slf4j.version>
<hadoop-snappy.version>0.0.1-SNAPSHOT</hadoop-snappy.version>
- <clover.version>2.6.3</clover.version>
+ <clover.version>4.0.3</clover.version>
<jamon-runtime.version>2.3.1</jamon-runtime.version>
<jettison.version>1.3.3</jettison.version>
<netty.version>4.0.23.Final</netty.version>
@@ -2235,9 +2235,8 @@
<!-- Profile for running clover. You need to have a clover license under ~/.clover.license for ${clover.version}
or you can provide the license with -Dmaven.clover.licenseLocation=/path/to/license. Committers can find
the license under https://svn.apache.org/repos/private/committers/donated-licenses/clover/
- Note that clover 2.6.3 does not run with maven 3, so you have to use maven2. The report will be generated
- under target/site/clover/index.html when you run
- MAVEN_OPTS=-Xmx2048m mvn clean test -Pclover site -->
+ The report will be generated under target/site/clover/index.html when you run
+ MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=512m" mvn clean package -Pclover site -->
<profile>
<id>clover</id>
<activation>
@@ -2248,10 +2247,23 @@
</activation>
<properties>
<maven.clover.licenseLocation>${user.home}/.clover.license</maven.clover.licenseLocation>
- <clover.version>2.6.3</clover.version>
</properties>
<build>
<plugins>
+ <!-- When Clover is active, we need to add it as a dependency for the javadoc plugin, or
+ our instrumented classes for the doclet will fail
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>com.atlassian.maven.plugins</groupId>
+ <artifactId>maven-clover2-plugin</artifactId>
+ <version>${clover.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
[2/2] hbase git commit: HBASE-13611 update clover profile to work
with clover 4.x and maven 3.
Posted by bu...@apache.org.
HBASE-13611 update clover profile to work with clover 4.x and maven 3.
* change pom to use a maven 3 compat version of clover
* add clover to javadoc plugin deps so that instrumented doclet works
* modify IA annotation test to filter out clover instrumentation
* make splitlog counters check for atomiclong before casting
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/549319a4
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/549319a4
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/549319a4
Branch: refs/heads/branch-1.0
Commit: 549319a4aa57b9732a62c4275d6f00a677e2ce81
Parents: 858ebb9
Author: Sean Busbey <bu...@apache.org>
Authored: Fri May 1 23:53:13 2015 -0500
Committer: Sean Busbey <bu...@cloudera.com>
Committed: Mon May 11 01:50:29 2015 -0500
----------------------------------------------------------------------
.../hbase/TestInterfaceAudienceAnnotations.java | 27 +++++++++++++++++++-
.../apache/hadoop/hbase/SplitLogCounters.java | 5 +++-
pom.xml | 22 ++++++++++++----
3 files changed, 47 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/549319a4/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 ace11ec..be79278 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
@@ -199,6 +199,29 @@ public class TestInterfaceAudienceAnnotations {
}
/**
+ * Selects classes that appear to be source instrumentation from Clover.
+ * Clover generates instrumented code in order to calculate coverage. Part of the
+ * generated source is a static inner class on each source class.
+ *
+ * - has an enclosing class
+ * - enclosing class is not an interface
+ * - name starts with "__CLR"
+ */
+ class CloverInstrumentationFilter implements ClassFinder.ClassFilter {
+ @Override
+ public boolean isCandidateClass(Class<?> clazz) {
+ boolean clover = false;
+ final Class<?> enclosing = clazz.getEnclosingClass();
+ if (enclosing != null) {
+ if (!(enclosing.isInterface())) {
+ clover = clazz.getSimpleName().startsWith("__CLR");
+ }
+ }
+ return clover;
+ }
+ }
+
+ /**
* Checks whether all the classes in client and common modules contain
* {@link InterfaceAudience} annotations.
*/
@@ -212,6 +235,7 @@ public class TestInterfaceAudienceAnnotations {
// 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 Not((FileNameFilter)new TestFileNameFilter()),
@@ -219,7 +243,8 @@ public class TestInterfaceAudienceAnnotations {
new Not(new TestClassFilter()),
new Not(new GeneratedClassFilter()),
new Not(new IsInterfaceStabilityClassFilter()),
- new Not(new InterfaceAudienceAnnotatedClassFilter()))
+ new Not(new InterfaceAudienceAnnotatedClassFilter()),
+ new Not(new CloverInstrumentationFilter()))
);
Set<Class<?>> classes = classFinder.findClasses(false);
http://git-wip-us.apache.org/repos/asf/hbase/blob/549319a4/hbase-server/src/main/java/org/apache/hadoop/hbase/SplitLogCounters.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/SplitLogCounters.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/SplitLogCounters.java
index 6af5045..bde1b88 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/SplitLogCounters.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/SplitLogCounters.java
@@ -88,7 +88,10 @@ public class SplitLogCounters {
public static void resetCounters() throws Exception {
Class<?> cl = SplitLogCounters.class;
for (Field fld : cl.getDeclaredFields()) {
- if (!fld.isSynthetic()) ((AtomicLong)fld.get(null)).set(0);
+ /* Guard against source instrumentation. */
+ if ((!fld.isSynthetic()) && (AtomicLong.class.isAssignableFrom(fld.getType()))) {
+ ((AtomicLong)fld.get(null)).set(0);
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/hbase/blob/549319a4/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 4d6ae11..dd6cd09 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1082,7 +1082,7 @@
<zookeeper.version>3.4.6</zookeeper.version>
<slf4j.version>1.7.7</slf4j.version>
<hadoop-snappy.version>0.0.1-SNAPSHOT</hadoop-snappy.version>
- <clover.version>2.6.3</clover.version>
+ <clover.version>4.0.3</clover.version>
<jamon-runtime.version>2.3.1</jamon-runtime.version>
<jettison.version>1.3.3</jettison.version>
<netty.version>4.0.23.Final</netty.version>
@@ -2172,9 +2172,8 @@
<!-- Profile for running clover. You need to have a clover license under ~/.clover.license for ${clover.version}
or you can provide the license with -Dmaven.clover.licenseLocation=/path/to/license. Committers can find
the license under https://svn.apache.org/repos/private/committers/donated-licenses/clover/
- Note that clover 2.6.3 does not run with maven 3, so you have to use maven2. The report will be generated
- under target/site/clover/index.html when you run
- MAVEN_OPTS=-Xmx2048m mvn clean test -Pclover site -->
+ The report will be generated under target/site/clover/index.html when you run
+ MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=512m" mvn clean package -Pclover site -->
<profile>
<id>clover</id>
<activation>
@@ -2185,10 +2184,23 @@
</activation>
<properties>
<maven.clover.licenseLocation>${user.home}/.clover.license</maven.clover.licenseLocation>
- <clover.version>2.6.3</clover.version>
</properties>
<build>
<plugins>
+ <!-- When Clover is active, we need to add it as a dependency for the javadoc plugin, or
+ our instrumented classes for the doclet will fail
+ -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>com.atlassian.maven.plugins</groupId>
+ <artifactId>maven-clover2-plugin</artifactId>
+ <version>${clover.version}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>