geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r505539 - /geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/TestCase.groovy
Date Fri, 09 Feb 2007 22:49:30 GMT
Author: jdillon
Date: Fri Feb  9 14:49:29 2007
New Revision: 505539

URL: http://svn.apache.org/viewvc?view=rev&rev=505539
Log:
Need to handle bits where environment is not present because of errors

Modified:
    geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/TestCase.groovy

Modified: geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/TestCase.groovy
URL: http://svn.apache.org/viewvc/geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/TestCase.groovy?view=diff&rev=505539&r1=505538&r2=505539
==============================================================================
--- geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/TestCase.groovy
(original)
+++ geronimo/sandbox/build-support/libraries/system/1/groovy/gbuild/config/projects/Geronimo_CTS/report/TestCase.groovy
Fri Feb  9 14:49:29 2007
@@ -66,19 +66,54 @@
     }
     
     Date getStarted() {
-        return DATE_FORMAT.parse(result.testresult['start'])
+        def date = result.testresult['start']
+        
+        //
+        // NOTE: Sometimes environment ends up empty (when some bad error happens)
+        //       so we can't rely on this being here
+        //
+        
+        if (date) {
+            return DATE_FORMAT.parse(date)
+        }
+        else {
+            return null
+        }
     }
     
     Date getEnded() {
-        return DATE_FORMAT.parse(result.testresult['end'])
+        def date = result.testresult['end']
+        
+        //
+        // NOTE: Sometimes environment ends up empty (when some bad error happens)
+        //       so we can't rely on this being here
+        //
+        
+        if (date) {
+            return DATE_FORMAT.parse(date)
+        }
+        else {
+            return null
+        }
     }
     
     long getTime() {
-        return ended.time - started.time
+        //
+        // NOTE: started or ended may be null, so check
+        //
+        if (started && ended) {
+            return ended.time - started.time
+        }
+        return -1
     }
     
     String getDuration() {
-        return DurationFormatUtils.formatDurationHMS(time)
+        if (time) {
+            return DurationFormatUtils.formatDurationHMS(time)
+        }
+        else {
+            return 'Unknown'
+        }
     }
     
     def getStatus() {



Mime
View raw message