geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r506842 - in /geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report: ./ model/ resources/ resources/boilerplate/
Date Tue, 13 Feb 2007 03:33:02 GMT
Author: jdillon
Date: Mon Feb 12 19:33:01 2007
New Revision: 506842

URL: http://svn.apache.org/viewvc?view=rev&rev=506842
Log:
Crude support for some basic charts

Added:
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ChartHelper.groovy
  (with props)
Modified:
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/PageRenderer.groovy
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/IterationModel.groovy
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/boilerplate/stylesheet.css
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-detail.vm
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-overview.vm
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/overview-summary.vm
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-overview.vm

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ChartHelper.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ChartHelper.groovy?view=auto&rev=506842
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ChartHelper.groovy
(added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ChartHelper.groovy
Mon Feb 12 19:33:01 2007
@@ -0,0 +1,141 @@
+/*
+ * 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 java.awt.Color
+
+import gbuild.system.LogSupport
+
+import org.jfree.chart.JFreeChart
+import org.jfree.chart.ChartFactory
+import org.jfree.chart.ChartUtilities
+import org.jfree.chart.ChartRenderingInfo
+import org.jfree.chart.entity.StandardEntityCollection
+import org.jfree.chart.plot.PiePlot
+import org.jfree.chart.imagemap.ImageMapUtilities
+
+import org.jfree.data.general.DefaultPieDataset
+
+/**
+ * Helper to generate charts.
+ */
+class ChartHelper extends LogSupport
+{
+    private Map params
+    
+    private File targetDir
+    
+    private String baseURI
+    
+    def ChartHelper(Map params) {
+        assert params
+        
+        this.params = params
+        this.targetDir = params.targetDir
+        this.baseURI = params.baseURI
+    }
+    
+    def render(chart, width, height) {
+        assert chart
+        assert width
+        assert height
+        
+        // Just make it random, don't care what the name is
+        def chartName = UUID.randomUUID().toString()
+        
+        def file = new File("$targetDir/images/${chartName}.png")
+        file.parentFile.mkdirs()
+        
+        // Render the chart graphic
+        def info = new ChartRenderingInfo(new StandardEntityCollection())
+        ChartUtilities.saveChartAsPNG(file, chart, width, height, info)
+        
+        // Generate the image map
+        def imageMap = new StringWriter()
+        def writer = new PrintWriter(imageMap)
+        ImageMapUtilities.writeImageMap(writer, chartName, info);
+        writer.close()
+        
+        // Return the HTML snip
+        return """
+        $imageMap
+        <img src='$baseURI/images/${chartName}.png' border='0'
+             width='$width' height='$height' usemap='#${chartName}'/>
+        """
+    }
+    
+    def overviewSummaryPassedFailedErrors() {
+        def dataset = new DefaultPieDataset()
+        
+        dataset.setValue('Passed', params.model.passCount)
+        dataset.setValue('Failed', params.model.failureCount)
+        dataset.setValue('Errors', params.model.errorCount)
+        
+        def chart = ChartFactory.createPieChart('Passed/Failed/Errors', dataset, true, true,
false)
+        chart.setBackgroundPaint(Color.white)
+        
+        // Set colors to green red and medium red
+        def plot = chart.getPlot();
+        plot.setSectionPaint(0, new Color(0x00, 0x99, 0x00))
+        plot.setSectionPaint(1, new Color(0xFF, 0x00, 0x00))
+        plot.setSectionPaint(2, new Color(0x66, 0x00, 0x00))
+        
+        return render(chart, 500, 300)
+    }
+    
+    def testCaseDistributionByChildren() {
+        testCaseDistribution(params.model.children.values())
+    }
+    
+    def testCaseDistributionByIteration() {
+        testCaseDistribution(params.model.iterations)
+    }
+    
+    def testCaseDistributionByPackage() {
+        testCaseDistribution(params.model.packages)
+    }
+    
+    def testCaseDistribution(Collection group) {
+        assert group
+        
+        def dataset = new DefaultPieDataset()
+        
+        group.sort().each {
+            dataset.setValue(it.displayName, it.count)
+        }
+        
+        //
+        // TODO: Add url handling, to allow imagemap to link to iteration detail pages
+        //
+        
+        def chart = ChartFactory.createPieChart('TestCase Distribution', dataset, false,
true, false)
+        chart.setBackgroundPaint(Color.white)
+        
+        // Disable labels, tool-tip used to see details
+        chart.plot.labelGenerator = null
+        
+        return render(chart, 500, 300)
+    }
+}
+

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

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

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

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/PageRenderer.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/PageRenderer.groovy?view=diff&rev=506842&r1=506841&r2=506842
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/PageRenderer.groovy
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/PageRenderer.groovy
Mon Feb 12 19:33:01 2007
@@ -46,6 +46,9 @@
         
         // Install ourselves as render helper
         this.params.helper = this
+        
+        // Install the chart helper
+        this.params.charts = new ChartHelper(params)
     }
     
     def render() {

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/IterationModel.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/IterationModel.groovy?view=diff&rev=506842&r1=506841&r2=506842
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/IterationModel.groovy
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/IterationModel.groovy
Mon Feb 12 19:33:01 2007
@@ -64,21 +64,21 @@
         return "${iterationIndex} :: " + iterationConfig.get('name').text()
     }
     
-    String getTestConfiguration() {
+    Collection getTestConfiguration() {
         def list = []
         
         iterationConfig.tests.test.each {
             list << it.text()
         }
         
-        return list.join(' ')
+        return list
     }
     
     String getOptionsConfiguration() {
         if (iterationConfig.options) {
             return iterationConfig.options.text()
         }
-        return 'NONE'
+        return null
     }
     
     Collection getPackages() {

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/boilerplate/stylesheet.css
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/boilerplate/stylesheet.css?view=diff&rev=506842&r1=506841&r2=506842
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/boilerplate/stylesheet.css
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/boilerplate/stylesheet.css
Mon Feb 12 19:33:01 2007
@@ -173,10 +173,15 @@
     text-align: left;
 }
 
+/* Chart Tables */
+
+table.chartsTable {
+    border: none;
+}
+
 /* Properties Tables */
 
 table.propertiesTable {
-    border: none;
     border: 1px solid #999999;
 }
 

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-detail.vm
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-detail.vm?view=diff&rev=506842&r1=506841&r2=506842
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-detail.vm
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-detail.vm
Mon Feb 12 19:33:01 2007
@@ -40,8 +40,19 @@
             <col width="99%"><col>
         </colgroup>
         <tbody>
-            #summaryRow('Tests' $model.testConfiguration)
-            #summaryRow('Options' $model.optionsConfiguration)
+            <tr>
+                <td class="summaryTableKeyCell">Tests</td>
+                <td class="summaryTableValueCell">
+                    <ul>
+                        #foreach ($test in $model.testConfiguration)
+                            <li>$test</li>
+                        #end
+                    </ul>
+                </td>
+            </tr>
+            #if ($model.optionsConfiguration)
+                #summaryRow('Options' $model.optionsConfiguration)
+            #end
         </tbody>
     </table>
     
@@ -85,6 +96,20 @@
             #foreach ($pkg in $model.packages)
                 #subGroupSummaryItem($pkg)
             #end
+        </tbody>
+    </table>
+    
+    <table class="chartsTable">
+        <colgroup>
+            <col width="99%"><col>
+        </colgroup>
+        
+        <tbody>
+            <tr>
+                <td align="center">
+                    $charts.testCaseDistributionByChildren()
+                </td>
+            </tr>
         </tbody>
     </table>
 </body>

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-overview.vm
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-overview.vm?view=diff&rev=506842&r1=506841&r2=506842
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-overview.vm
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/iteration-overview.vm
Mon Feb 12 19:33:01 2007
@@ -46,5 +46,22 @@
         </tbody>
     </table>
     
+    <table class="chartsTable">
+        <colgroup>
+            <col width="99%"><col>
+        </colgroup>
+        
+        <tbody>
+            <tr>
+                <td align="center">
+                    $charts.testCaseDistributionByIteration()
+                    
+                    ##
+                    ## TODO: Add chart showing duration per/iteration
+                    ##
+                </td>
+            </tr>
+        </tbody>
+    </table>
 </body>
 </html>

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/overview-summary.vm
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/overview-summary.vm?view=diff&rev=506842&r1=506841&r2=506842
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/overview-summary.vm
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/overview-summary.vm
Mon Feb 12 19:33:01 2007
@@ -58,6 +58,20 @@
         </tbody>
     </table>
     
+    <table class="chartsTable">
+        <colgroup>
+            <col width="99%"><col>
+        </colgroup>
+        
+        <tbody>
+            <tr>
+                <td align="center">
+                    $charts.overviewSummaryPassedFailedErrors()
+                </td>
+            </tr>
+        </tbody>
+    </table>
+    
     <h2>Assembly Details</h2>
     
     ##

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-overview.vm
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-overview.vm?view=diff&rev=506842&r1=506841&r2=506842
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-overview.vm
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/resources/package-overview.vm
Mon Feb 12 19:33:01 2007
@@ -43,5 +43,19 @@
             #end
         </tbody>
     </table>
+    
+    <table class="chartsTable">
+        <colgroup>
+            <col width="99%"><col>
+        </colgroup>
+        
+        <tbody>
+            <tr>
+                <td align="center">
+                    $charts.testCaseDistributionByPackage()
+                </td>
+            </tr>
+        </tbody>
+    </table>
 </body>
 </html>



Mime
View raw message