maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1500464 - /maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSourceReleaseMojo.java
Date Sun, 07 Jul 2013 16:06:14 GMT
Author: hboutemy
Date: Sun Jul  7 16:06:14 2013
New Revision: 1500464

URL: http://svn.apache.org/r1500464
Log:
added global statistics

Modified:
    maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSourceReleaseMojo.java

Modified: maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSourceReleaseMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSourceReleaseMojo.java?rev=1500464&r1=1500463&r2=1500464&view=diff
==============================================================================
--- maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSourceReleaseMojo.java
(original)
+++ maven/sandbox/trunk/dist-tools/dist-tool-plugin/src/main/java/org/apache/maven/dist/tools/DistCheckSourceReleaseMojo.java
Sun Jul  7 16:06:14 2013
@@ -275,6 +275,8 @@ public class DistCheckSourceReleaseMojo
             throw new MavenReportException( ex.getMessage(), ex );
         }
 
+        DirectoryStatistics stats = new DirectoryStatistics( "" ); // global stats
+
         List<DirectoryStatistics> statistics = new ArrayList<>();
         DirectoryStatistics current = null;
         for ( DistCheckSourceRelease csr : results )
@@ -285,6 +287,7 @@ public class DistCheckSourceReleaseMojo
                 statistics.add( current );
             }
             current.addArtifact( csr );
+            stats.addArtifact( csr );
         }
 
         Sink sink = getSink();
@@ -319,7 +322,7 @@ public class DistCheckSourceReleaseMojo
         sink.table();
         sink.tableRow();
         sink.tableHeaderCell();
-        sink.rawText( "groupId/artifactId" );
+        sink.rawText( "groupId/artifactId: " + String.valueOf( stats.artifactsCount ) );
         sink.tableHeaderCell_();
         sink.tableHeaderCell();
         sink.rawText( "LATEST" );
@@ -327,12 +330,7 @@ public class DistCheckSourceReleaseMojo
         sink.tableHeaderCell();
         sink.rawText( "DATE" );
         sink.tableHeaderCell_();
-        sink.tableHeaderCell();
-        sink.rawText( "central" );
-        sink.tableHeaderCell_();
-        sink.tableHeaderCell();
-        sink.rawText( "dist" );
-        sink.tableHeaderCell_();
+        reportStatisticsHeader( stats, sink );
         sink.tableRow_();
 
         Iterator<DirectoryStatistics> dirs = statistics.iterator();
@@ -356,28 +354,7 @@ public class DistCheckSourceReleaseMojo
                 sink.tableHeaderCell();
                 sink.rawText( " " );
                 sink.tableHeaderCell_();
-                sink.tableHeaderCell();
-                sink.rawText( "central: " + String.valueOf( current.artifactsCount - current.centralMissing
) );
-                iconSuccess( sink );
-                if ( current.centralMissing > 0 )
-                {
-                    sink.rawText( "/" + String.valueOf( current.centralMissing ) );
-                    iconWarning( sink );
-                }
-                sink.tableHeaderCell_();
-                sink.tableHeaderCell();
-                sink.rawText( "dist: " + String.valueOf( current.artifactsCount - current.distError
) );
-                iconSuccess( sink );
-                if ( current.distError > 0 )
-                {
-                    sink.rawText( "/" + String.valueOf( current.distError ) );
-                    iconWarning( sink );
-                    sink.rawText( "= " + String.valueOf( current.distMissing ) );
-                    iconError( sink );
-                    sink.rawText( "/" + String.valueOf( current.distOlder ) );
-                    iconRemove( sink );
-                }
-                sink.tableHeaderCell_();
+                reportStatisticsHeader( current, sink );
                 sink.tableRow_();
             }
 
@@ -390,6 +367,32 @@ public class DistCheckSourceReleaseMojo
         sink.close();
     }
 
+    private void reportStatisticsHeader( DirectoryStatistics current, Sink sink )
+    {
+        sink.tableHeaderCell();
+        sink.rawText( "central: " + String.valueOf( current.artifactsCount - current.centralMissing
) );
+        iconSuccess( sink );
+        if ( current.centralMissing > 0 )
+        {
+            sink.rawText( "/" + String.valueOf( current.centralMissing ) );
+            iconWarning( sink );
+        }
+        sink.tableHeaderCell_();
+        sink.tableHeaderCell();
+        sink.rawText( "dist: " + String.valueOf( current.artifactsCount - current.distError
) );
+        iconSuccess( sink );
+        if ( current.distError > 0 )
+        {
+            sink.rawText( "/" + String.valueOf( current.distError ) );
+            iconWarning( sink );
+            sink.rawText( "= " + String.valueOf( current.distMissing ) );
+            iconError( sink );
+            sink.rawText( "/" + String.valueOf( current.distOlder ) );
+            iconRemove( sink );
+        }
+        sink.tableHeaderCell_();
+    }
+
     /**
      * Report a pattern for an artifact.
      *



Mime
View raw message