ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "J. David Beutel" <...@getsu.com>
Subject Re: timezone for junitreport, and antlib
Date Mon, 27 Aug 2007 20:47:36 GMT
Thanks for the help!  It would be nice to do in XSLT, and that looks 
like a good function, but I gather that it requires XSLT 2.0, so Saxon.  
I'm using the JDK 1.5 built-in, Apache XSLTC.  Using Saxon for 
junitreport looks a little difficult, so I'm leaning toward the other 
approach, but please let me know if I'm overlooking some easy way.

Cheers,
11011011

jcumps@gmail.com wrote:
>> Or I could try to convert the timezone in the junitreport but I'm not 
>> sure how do-able that would be in XSLT.
>
> If you do it in the stylesheets, you don't need to alter JUnit java code.
> This link shows the XSLT functions you need, and some examples:
> http://www.xsltfunctions.com/xsl/fn_adjust-datetime-to-timezone.html
>
> Regards, Jan
>
> ----- Original Message ----- From: <Jan.Materne@rzf.fin-nrw.de>
> To: <dev@ant.apache.org>
> Sent: Friday, August 24, 2007 9:03 AM
> Subject: AW: timezone for junitreport, and antlib
>
>
>> The timestamps displayed by the 1.7.0 junitreport are in the GMT 
>> timezone.  It looks like that's determined by 
>> DateUtils.createDateFormat() via the junit task's 
>> XMLJUnitResultFormatter.startTestSuite().
>
>
> public class XMLJUnitResultFormatter ...
>    public void startTestSuite(JUnitTest suite) {
>        ...
>        //add the timestamp
>        final String timestamp = DateUtils.format(new Date(),
>                DateUtils.ISO8601_DATETIME_PATTERN);
>        rootElement.setAttribute(TIMESTAMP, timestamp);
>
>
>
> public final class DateUtils {
>    /**
>     * ISO8601-like pattern for date-time. It does not support timezone.
>     *  <tt>yyyy-MM-ddTHH:mm:ss</tt>
>     */
>    public static final String ISO8601_DATETIME_PATTERN
>            = "yyyy-MM-dd'T'HH:mm:ss";
>
>
>
> Yes it's done there ;)
>
>
>
>
>> I'd like to display them in my local timezone, or at least in the 
>> timezone in which the junit task was run.  Does anyone know how to do 
>> this?  It looks like I'd need to change Ant.
>
>
> It is not possible atm in Ant.
>
>
>
>> I could try adding an attribute to the junit formatter element for
> using
>> the local (or an arbitrary) timezone, altho I don't know if it would 
>> apply to the other types of formatter.  Or I could try to convert the 
>> timezone in the junitreport (junit-frames.xsl and 
>> junit-noframes.xsl), but I'm not sure how do-able that would be in 
>> XSLT.  Which approach would be acceptable to a committer?
>
>
> When I wrote the FailureRecorder (<formatter type="failure"/>) I got the
> problem
> how to configure that recorder. Passing attributes is not simple there,
> as this is
> not a task. Its not a ProjectComponent, it is a simple class.
>
> I have done this using magic System properties
> (ant.junit.failureCollector) so I could
> specify the configuration via nested <sysproperty>.
>
>
>
>> By the way, is anyone working on externalizing the junit support to 
>> an antlib?  JUnit 4 works well enough on Ant 1.7.0, but the report 
>> still doesn't support some features as well as it could, such as 
>> @Ignore.
>
>
> The Ant team does not have a JUnit AntLib - neither as project nor in
> the sandbox.
> I dont know if the JUnit team has. If I remember right, it was said,
> that they would
> maintain a JUnit AntLib ... but I dont know what the status is.
>
>
> Jan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message