hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmhs...@apache.org
Subject [15/50] [abbrv] hbase git commit: HBASE-13611 update clover profile to work with clover 4.x and maven 3.
Date Tue, 19 May 2015 23:14:10 GMT
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/9aeafe30
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/9aeafe30
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/9aeafe30

Branch: refs/heads/hbase-11339
Commit: 9aeafe30b7d932e562f803fd071812cd27aebaf8
Parents: 8e5a183
Author: Sean Busbey <busbey@apache.org>
Authored: Fri May 1 23:53:13 2015 -0500
Committer: Sean Busbey <busbey@cloudera.com>
Committed: Mon May 11 01:01:57 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/9aeafe30/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/9aeafe30/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/9aeafe30/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 333dc56..814502b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1166,7 +1166,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>
@@ -2572,9 +2572,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>
@@ -2585,10 +2584,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>


Mime
View raw message