You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2007/05/04 04:14:36 UTC

svn commit: r535060 - in /geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report: ReportGenerator.groovy model/SectionModel.groovy model/SuiteModel.groovy

Author: jdillon
Date: Thu May  3 19:14:35 2007
New Revision: 535060

URL: http://svn.apache.org/viewvc?view=rev&rev=535060
Log:
Add the start of support for rendering section data in the report

Added:
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/SectionModel.groovy   (with props)
Modified:
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/ReportGenerator.groovy
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/SuiteModel.groovy

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=535060&r1=535059&r2=535060
==============================================================================
--- 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 Thu May  3 19:14:35 2007
@@ -119,7 +119,9 @@
         
         // Once its sane, start the report
         log.info 'Generate report'
-        def suiteModel = new SuiteModel()
+        
+        def sectionDef = loadProperties('project/tck-testsuite/sections.properties')
+        def suiteModel = new SuiteModel(sectionDef)
         
         // Basic render setup
         def createRenderer = { templateName, targetPath ->
@@ -246,6 +248,13 @@
         }
         
         logMemoryUsage()
+        
+        //
+        // HACK: Start of section muck...
+        //
+        def sections = suiteModel.sections.each {
+            println "$it : $it.passCount / $it.failureCount / $it.errorCount :: $it.duration"
+        }
         
         log.info "Rendering overview bits"
         renderWithSuite('iteration-overview.vm', "iteration-overview.html")

Added: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/SectionModel.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/SectionModel.groovy?view=auto&rev=535060
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/SectionModel.groovy (added)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/SectionModel.groovy Thu May  3 19:14:35 2007
@@ -0,0 +1,118 @@
+/*
+ * 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.model
+
+import gbuild.config.projects.Geronimo_CTS.report.TestCase
+
+import gbuild.system.util.Sorting
+
+import org.apache.commons.lang.time.DurationFormatUtils
+
+/**
+ * Container for the statistical data for the tests within a section as 
+ * defined in sections.properties).
+ */
+class SectionModel
+    extends TestModel
+{
+    String packagePrefix
+    
+    protected SectionModel(String name, String packagePrefix) {
+        super(name)
+        
+        this.packagePrefix = packagePrefix
+    }
+    
+    //
+    // Model data collection
+    //
+    
+    long passCount = 0
+    
+    long failureCount = 0
+    
+    long errorCount = 0
+    
+    long time = 0
+    
+    
+    def leftShift(TestCase testCase) {
+        def model = super.leftShift(testCase)
+        
+        collectData(testCase)
+        
+        return model
+    }
+    
+    def collectData(TestCase testCase) {
+        if (testCase.status.passed) {
+            passCount++
+        }
+        else if (testCase.status.failed) {
+            failureCount++
+        }
+        else if (testCase.status.error) {
+            errorCount++
+        }
+        if (testCase.time > 0) {
+            time += testCase.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
+    }
+    
+    /**
+     * Added to help render barGraph
+     */
+    int getSuccessRateAsInteger() {
+        return successRate.toInteger()
+    }
+    
+    String getStatusIcon() {
+        if (passed) {
+            return 'icon_success_sml.gif'
+        }
+        else if (errorCount > 0) {
+            return 'icon_error_sml.gif'
+        }
+        else if (failureCount > 0) {
+            return 'icon_warning_sml.gif'
+        }
+    }
+}
+

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

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

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

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/SuiteModel.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/SuiteModel.groovy?view=diff&rev=535060&r1=535059&r2=535060
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/SuiteModel.groovy (original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/model/SuiteModel.groovy Thu May  3 19:14:35 2007
@@ -39,8 +39,16 @@
  */
 class SuiteModel extends GroupModel
 {
-    def SuiteModel() {
+    def sectionsMap = new HashMap()
+    
+    def SuiteModel(Map sectionDef) {
         super("TestSuite")
+        
+        // Prime the sections model
+        sectionDef.each { name, pkg ->
+            def section = new SectionModel(name, pkg)
+            sectionsMap[pkg] = section
+        }
     }
     
     IterationModel createIteration(Map props) {
@@ -56,6 +64,28 @@
     
     def leftShift(TestCase testCase) {
         throw new Exception('Use iteration model to add test cases')
+    }
+    
+    def testCaseAdded(TestCase testCase) {
+        super.testCaseAdded(testCase)
+        
+        // Maintain the section model
+        for (entry in sectionsMap) {
+            if (testCase.className.startsWith(entry.key)) {
+                entry.value << testCase
+                break
+            }
+        }
+    }
+    
+    def getSections() {
+        def list = []
+        
+        sectionsMap.each { pkg, section ->
+            list.add(section)
+        }
+        
+        return list.sort()
     }
     
     Collection getIterations() {