geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r504012 - in /geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report: AllStats.groovy ReportGenerator.groovy resources/iteration-overview.tmpl resources/package-overview.tmpl
Date Tue, 06 Feb 2007 07:03:14 GMT
Author: jdillon
Date: Mon Feb  5 23:03:13 2007
New Revision: 504012

URL: http://svn.apache.org/viewvc?view=rev&rev=504012
Log:
Hacked in package and iteration overviews

Added:
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/AllStats.groovy
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-overview.tmpl
  (with props)
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-overview.tmpl
  (with props)
Modified:
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/AllStats.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/AllStats.groovy?view=auto&rev=504012
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/AllStats.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/AllStats.groovy
Mon Feb  5 23:03:13 2007
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//
+// $Id$
+//
+
+package gbuild.config.projects.Geronimo_CTS.report
+
+import gbuild.system.LogSupport
+
+import org.apache.commons.lang.time.DurationFormatUtils
+
+/**
+ * ???
+ */
+class AllStats extends LogSupport
+{
+    Map byIteration = [:]
+    
+    def add(iteration, stats) {
+        byIteration[iteration] = stats
+    }
+    
+    //
+    // HACK: Overview helpers
+    //
+    
+    Set getPackageNames() {
+        def packageNames = new HashSet()
+        byIteration.each {
+            packageNames.addAll(it.value.packageNames)
+        }
+        return packageNames
+    }
+    
+    Stats getPackageSummary(String packageName) {
+        for (stats in byIteration.values()) {
+            if (stats.packageNames.contains(packageName)) {
+                return stats.byPackage[packageName]
+            }
+        }
+        
+        assert false
+    }
+    
+    //
+    // HACK: Global stats
+    //
+    
+    private long sum(name) {
+        long sum = 0
+        byIteration.each{ sum += it.value[name] }
+        return sum
+    }
+    
+    long getPassCount() {
+        return sum('passCount')
+    }
+    
+    long getFailureCount() {
+        return sum('failureCount')
+    }
+    
+    long getErrorCount() {
+        return sum('errorCount')
+    }
+    
+    long getTime() {
+        return sum('time')
+    }
+    
+    long getCount() {
+        return passCount + failureCount + errorCount
+    }
+    
+    String getDuration() {
+        return DurationFormatUtils.formatDurationHMS(time)
+    }
+    
+    boolean getPassed() {
+        return failureCount + errorCount == 0
+    }
+    
+    double getSuccessRate() {
+        return passCount * 100 / count
+    }
+}
+

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/AllStats.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/AllStats.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/AllStats.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy?view=diff&rev=504012&r1=504011&r2=504012
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy
Mon Feb  5 23:03:13 2007
@@ -112,6 +112,9 @@
             return testSuite
         }
         
+        // Holds stats for all results
+        def allStats = new AllStats()
+        
         // Process each result archive
         archives.each { archive ->
             log.info "Processing results archive: $archive"
@@ -121,6 +124,7 @@
             
             // Load runtests.properties, so we can see webcontainer and iteration (and others)
             def props = loadProperties("$workDir/runtests.properties")
+            def iteration = props.iteration
             
             // Load the testuite
             def testSuite = loadTestSuite(workDir)
@@ -178,35 +182,57 @@
             }
             
             // Render iteration details
-            log.info "Rendering iteration summary: $props.iteration"
+            log.info "Rendering iteration summary: $iteration"
             def template = engine.getTemplate('iteration-detail.tmpl')
             template.params.stats = stats
             template.params.props = props
-            template.params.iteration = props.iteration
+            template.params.iteration = iteration
             
-            def file = new File(targetDir, "iteration-${props.iteration}.html")
+            def file = new File(targetDir, "iteration-${iteration}.html")
             ant.mkdir(dir: file.parentFile)
             template.render(file)
             
-            //
-            // TODO: Save stats for global summary
-            //
+            // Save stats for overview
+            allStats.add(iteration, stats)
             
             // Clean up
             log.info "Cleaning up"
             ant.delete(dir: workDir)
         }
         
-        //
-        // TODO: Render interation summary
-        //
-        
-        //
-        // TODO: Render summary overview
-        //
-        
-        //
-        // TODO: Install boilerplate resources
-        //
+        // Render iteration overview
+        def renderIterationOverview = {
+            log.info "Rendering iteration overview"
+            
+            def template = engine.getTemplate('iteration-overview.tmpl')
+            template.params.allStats = allStats
+            def file = new File(targetDir, 'iteration-overview.html')
+            template.render(file)
+        }
+        
+        renderIterationOverview()
+        
+        // Render package overview
+        def renderPackageOverview = {
+            log.info "Rendering package overview"
+            
+            def template = engine.getTemplate('package-overview.tmpl')
+            template.params.allStats = allStats
+            def file = new File(targetDir, 'package-overview.html')
+            template.render(file)
+        }
+        
+        renderPackageOverview()
+        
+        // Install boilerplate resources
+        def url = getClass().classLoader.getResource('gbuild/config/projects/Geronimo_CTS/report/resources/boilerplate')
+        assert url != null
+        assert url.protocol == 'file'
+        
+        ant.copy(todir: targetDir) {
+            fileset(dir: url.path) {
+                include(name: '**')
+            }
+        }
     }
 }

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-overview.tmpl
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-overview.tmpl?view=auto&rev=504012
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-overview.tmpl
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-overview.tmpl
Mon Feb  5 23:03:13 2007
@@ -0,0 +1,67 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//
+// $Id$
+//
+
+def sorter = { String a, String b ->
+    return a.toInteger() <=> b.toInteger()
+}
+
+%>
+<html>
+<head>
+    <title>Iteration Overview</title>
+</head>
+<body>
+    <div>
+        <h1>Iterations</h1>
+        
+        <table>
+            <thead>
+                <tr>
+                    <th>Iteration</th>
+                    <th>Tests</th>
+                    <th>Failures</th>
+                    <th>Errors</th>
+                    <th>Success Rate</td>
+                    <th>Duration</td>
+                </tr>
+            </thead>
+            <tbody>
+                <% allStats.byIteration.keySet().sort(sorter).each { iteration -> %>
+                <%
+                def iterationSummary = allStats.byIteration[iteration]
+                %>
+                <tr>
+                    <td><a href="iteration-${iteration}.html">$iteration</a></td>
+                    <td>$iterationSummary.count</td>
+                    <td>$iterationSummary.failureCount</td>
+                    <td>$iterationSummary.errorCount</td>
+                    <td>$iterationSummary.successRate</td>
+                    <td>$iterationSummary.duration</td>
+                </tr>
+                <% } %>
+            </tbody>
+        </table>
+    </div>
+</body>
+</html>

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-overview.tmpl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-overview.tmpl
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-overview.tmpl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-overview.tmpl
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-overview.tmpl?view=auto&rev=504012
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-overview.tmpl
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-overview.tmpl
Mon Feb  5 23:03:13 2007
@@ -0,0 +1,68 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+//
+// $Id$
+//
+
+def sorter = { String a, String b ->
+    return a.toLowerCase() <=> b.toLowerCase()
+}
+
+%>
+<html>
+<head>
+    <title>Package Overview</title>
+</head>
+<body>
+    <div>
+        <h1>Packages</h1>
+        
+        <table>
+            <thead>
+                <tr>
+                    <th>Package</th>
+                    <th>Tests</th>
+                    <th>Failures</th>
+                    <th>Errors</th>
+                    <th>Success Rate</td>
+                    <th>Duration</td>
+                </tr>
+            </thead>
+            <tbody>
+                <% allStats.packageNames.sort(sorter).each { packageName -> %>
+                <%
+                def packageSummary = allStats.getPackageSummary(packageName)
+                def href = packageName.replace('.', '/') + '/index.html'
+                %>
+                <tr>
+                    <td><a href="$href">$packageName</a></td>
+                    <td>$packageSummary.count</td>
+                    <td>$packageSummary.failureCount</td>
+                    <td>$packageSummary.errorCount</td>
+                    <td>$packageSummary.successRate</td>
+                    <td>$packageSummary.duration</td>
+                </tr>
+                <% } %>
+            </tbody>
+        </table>
+    </div>
+</body>
+</html>

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-overview.tmpl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-overview.tmpl
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-overview.tmpl
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message