From f0654aa1e44ae1b7f840735d78ed01ea250000fa Mon Sep 17 00:00:00 2001
From: al_xipe <al_xipe@localhost>
Date: Sun, 18 Feb 2007 07:20:02 +0000
Subject: [PATCH] move from ant 1.6.5 to 1.7.0
---
opends/ext/ant/etc/junit-frames.xsl | 259 +++++++++++++++++++++++++++++++++++++++++----------
1 files changed, 209 insertions(+), 50 deletions(-)
diff --git a/opends/ext/ant/etc/junit-frames.xsl b/opends/ext/ant/etc/junit-frames.xsl
index 0b0e731..94e4272 100644
--- a/opends/ext/ant/etc/junit-frames.xsl
+++ b/opends/ext/ant/etc/junit-frames.xsl
@@ -6,11 +6,12 @@
<xsl:output method="html" indent="yes" encoding="US-ASCII"/>
<xsl:decimal-format decimal-separator="." grouping-separator=","/>
<!--
- Copyright 2001-2004 The Apache Software Foundation
-
- Licensed 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
+ 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
@@ -28,10 +29,6 @@
It creates a set of HTML files a la javadoc where you can browse easily
through all packages and classes.
- @author Stephane Bailliez <a href="mailto:sbailliez@apache.org"/>
- @author Erik Hatcher <a href="mailto:ehatcher@apache.org"/>
- @author Martijn Kruithof <a href="mailto:martijn@kruithof.xs4all.nl"/>
-
-->
<xsl:param name="output.dir" select="'.'"/>
@@ -62,7 +59,26 @@
<xsl:apply-templates select="." mode="all.classes"/>
</redirect:write>
- <!-- process all packages -->
+ <!-- create the all-tests.html at the root -->
+ <redirect:write file="{$output.dir}/all-tests.html">
+ <xsl:apply-templates select="." mode="all.tests"/>
+ </redirect:write>
+
+ <!-- create the alltests-fails.html at the root -->
+ <redirect:write file="{$output.dir}/alltests-fails.html">
+ <xsl:apply-templates select="." mode="all.tests">
+ <xsl:with-param name="type" select="'fails'"/>
+ </xsl:apply-templates>
+ </redirect:write>
+
+ <!-- create the alltests-errors.html at the root -->
+ <redirect:write file="{$output.dir}/alltests-errors.html">
+ <xsl:apply-templates select="." mode="all.tests">
+ <xsl:with-param name="type" select="'errors'"/>
+ </xsl:apply-templates>
+ </redirect:write>
+
+ <!-- process all packages -->
<xsl:for-each select="./testsuite[not(./@package = preceding-sibling::testsuite/@package)]">
<xsl:call-template name="package">
<xsl:with-param name="name" select="@package"/>
@@ -94,21 +110,35 @@
<!-- for each class, creates a @name.html -->
<!-- @bug there will be a problem with inner classes having the same name, it will be overwritten -->
- <xsl:for-each select="/testsuites/testsuite[@package = $name]">
- <redirect:write file="{$output.dir}/{$package.dir}/{@name}.html">
- <xsl:apply-templates select="." mode="class.details"/>
- </redirect:write>
- <xsl:if test="string-length(./system-out)!=0">
- <redirect:write file="{$output.dir}/{$package.dir}/{@name}-out.txt">
- <xsl:value-of select="./system-out" />
- </redirect:write>
- </xsl:if>
- <xsl:if test="string-length(./system-err)!=0">
- <redirect:write file="{$output.dir}/{$package.dir}/{@name}-err.txt">
- <xsl:value-of select="./system-err" />
- </redirect:write>
- </xsl:if>
- </xsl:for-each>
+ <xsl:for-each select="/testsuites/testsuite[@package = $name]">
+ <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}.html">
+ <xsl:apply-templates select="." mode="class.details"/>
+ </redirect:write>
+ <xsl:if test="string-length(./system-out)!=0">
+ <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-out.txt">
+ <xsl:value-of disable-output-escaping="yes" select="./system-out"/>
+ </redirect:write>
+ </xsl:if>
+ <xsl:if test="string-length(./system-err)!=0">
+ <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-err.txt">
+ <xsl:value-of disable-output-escaping="yes" select="./system-err"/>
+ </redirect:write>
+ </xsl:if>
+ <xsl:if test="@failures != 0">
+ <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-fails.html">
+ <xsl:apply-templates select="." mode="class.details">
+ <xsl:with-param name="type" select="'fails'"/>
+ </xsl:apply-templates>
+ </redirect:write>
+ </xsl:if>
+ <xsl:if test="@errors != 0">
+ <redirect:write file="{$output.dir}/{$package.dir}/{@id}_{@name}-errors.html">
+ <xsl:apply-templates select="." mode="class.details">
+ <xsl:with-param name="type" select="'errors'"/>
+ </xsl:apply-templates>
+ </redirect:write>
+ </xsl:if>
+ </xsl:for-each>
</xsl:template>
<xsl:template name="index.html">
@@ -183,6 +213,71 @@
}
</xsl:template>
+<!-- Create list of all/failed/errored tests -->
+<xsl:template match="testsuites" mode="all.tests">
+ <xsl:param name="type" select="'all'"/>
+ <html>
+ <xsl:variable name="title">
+ <xsl:choose>
+ <xsl:when test="$type = 'fails'">
+ <xsl:text>All Failures</xsl:text>
+ </xsl:when>
+ <xsl:when test="$type = 'errors'">
+ <xsl:text>All Errors</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>All Tests</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <head>
+ <title>Unit Test Results: <xsl:value-of select="$title"/></title>
+ <xsl:call-template name="create.stylesheet.link">
+ <xsl:with-param name="package.name"/>
+ </xsl:call-template>
+ </head>
+ <body>
+ <xsl:attribute name="onload">open('allclasses-frame.html','classListFrame')</xsl:attribute>
+ <xsl:call-template name="pageHeader"/>
+ <h2><xsl:value-of select="$title"/></h2>
+
+ <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
+ <xsl:call-template name="testcase.test.header">
+ <xsl:with-param name="show.class" select="'yes'"/>
+ </xsl:call-template>
+ <!--
+ test can even not be started at all (failure to load the class)
+ so report the error directly
+ -->
+ <xsl:if test="./error">
+ <tr class="Error">
+ <td colspan="4">
+ <xsl:apply-templates select="./error"/>
+ </td>
+ </tr>
+ </xsl:if>
+ <xsl:choose>
+ <xsl:when test="$type = 'fails'">
+ <xsl:apply-templates select=".//testcase[failure]" mode="print.test">
+ <xsl:with-param name="show.class" select="'yes'"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:when test="$type = 'errors'">
+ <xsl:apply-templates select=".//testcase[error]" mode="print.test">
+ <xsl:with-param name="show.class" select="'yes'"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select=".//testcase" mode="print.test">
+ <xsl:with-param name="show.class" select="'yes'"/>
+ </xsl:apply-templates>
+ </xsl:otherwise>
+ </xsl:choose>
+ </table>
+ </body>
+ </html>
+</xsl:template>
+
<!-- ======================================================================
This page is created for every testsuite class.
@@ -190,6 +285,7 @@
testcase methods.
====================================================================== -->
<xsl:template match="testsuite" mode="class.details">
+ <xsl:param name="type" select="'all'"/>
<xsl:variable name="package.name" select="@package"/>
<xsl:variable name="class.name"><xsl:if test="not($package.name = '')"><xsl:value-of select="$package.name"/>.</xsl:if><xsl:value-of select="@name"/></xsl:variable>
<html>
@@ -206,7 +302,8 @@
<script type="text/javascript" language="JavaScript"><![CDATA[
function displayProperties (name) {
var win = window.open('','JUnitSystemProperties','scrollbars=1,resizable=1');
- var doc = win.document.open();
+ var doc = win.document;
+ doc.open();
doc.write("<html><head><title>Properties of " + name + "</title>");
doc.write("<style type=\"text/css\">");
doc.write("body {font:normal 68% verdana,arial,helvetica; color:#000000; }");
@@ -242,19 +339,39 @@
<xsl:apply-templates select="." mode="print.test"/>
</table>
- <h2>Tests</h2>
+ <xsl:choose>
+ <xsl:when test="$type = 'fails'">
+ <h2>Failures</h2>
+ </xsl:when>
+ <xsl:when test="$type = 'errors'">
+ <h2>Errors</h2>
+ </xsl:when>
+ <xsl:otherwise>
+ <h2>Tests</h2>
+ </xsl:otherwise>
+ </xsl:choose>
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%">
- <xsl:call-template name="testcase.test.header"/>
- <!--
- test can even not be started at all (failure to load the class)
- so report the error directly
- -->
+ <xsl:call-template name="testcase.test.header"/>
+ <!--
+ test can even not be started at all (failure to load the class)
+ so report the error directly
+ -->
<xsl:if test="./error">
<tr class="Error">
<td colspan="4"><xsl:apply-templates select="./error"/></td>
</tr>
</xsl:if>
- <xsl:apply-templates select="./testcase" mode="print.test"/>
+ <xsl:choose>
+ <xsl:when test="$type = 'fails'">
+ <xsl:apply-templates select="./testcase[failure]" mode="print.test"/>
+ </xsl:when>
+ <xsl:when test="$type = 'errors'">
+ <xsl:apply-templates select="./testcase[error]" mode="print.test"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="./testcase" mode="print.test"/>
+ </xsl:otherwise>
+ </xsl:choose>
</table>
<div class="Properties">
<a>
@@ -265,7 +382,7 @@
<xsl:if test="string-length(./system-out)!=0">
<div class="Properties">
<a>
- <xsl:attribute name="href">./<xsl:value-of select="@name"/>-out.txt</xsl:attribute>
+ <xsl:attribute name="href">./<xsl:value-of select="@id"/>_<xsl:value-of select="@name"/>-out.txt</xsl:attribute>
System.out »
</a>
</div>
@@ -273,7 +390,7 @@
<xsl:if test="string-length(./system-err)!=0">
<div class="Properties">
<a>
- <xsl:attribute name="href">./<xsl:value-of select="@name"/>-err.txt</xsl:attribute>
+ <xsl:attribute name="href">./<xsl:value-of select="@id"/>_<xsl:value-of select="@name"/>-err.txt</xsl:attribute>
System.err »
</a>
</div>
@@ -328,7 +445,7 @@
<xsl:sort select="@name"/>
<tr>
<td nowrap="nowrap">
- <a href="{@name}.html" target="classFrame"><xsl:value-of select="@name"/></a>
+ <a href="{@id}_{@name}.html" target="classFrame"><xsl:value-of select="@name"/></a>
</td>
</tr>
</xsl:for-each>
@@ -369,7 +486,7 @@
<xsl:attribute name="href">
<xsl:if test="not($package.name='')">
<xsl:value-of select="translate($package.name,'.','/')"/><xsl:text>/</xsl:text>
- </xsl:if><xsl:value-of select="@name"/><xsl:text>.html</xsl:text>
+ </xsl:if><xsl:value-of select="@id"/>_<xsl:value-of select="@name"/><xsl:text>.html</xsl:text>
</xsl:attribute>
<xsl:value-of select="@name"/>
</a>
@@ -448,9 +565,9 @@
<xsl:otherwise>Pass</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
- <td><xsl:value-of select="$testCount"/></td>
- <td><xsl:value-of select="$failureCount"/></td>
- <td><xsl:value-of select="$errorCount"/></td>
+ <td><a title="Display all tests" href="all-tests.html"><xsl:value-of select="$testCount"/></a></td>
+ <td><a title="Display all failures" href="alltests-fails.html"><xsl:value-of select="$failureCount"/></a></td>
+ <td><a title="Display all errors" href="alltests-errors.html"><xsl:value-of select="$errorCount"/></a></td>
<td>
<xsl:call-template name="display-percent">
<xsl:with-param name="value" select="$successRate"/>
@@ -461,7 +578,6 @@
<xsl:with-param name="value" select="$timeCount"/>
</xsl:call-template>
</td>
-
</tr>
</table>
<table border="0" width="95%">
@@ -500,6 +616,8 @@
<xsl:with-param name="value" select="sum($insamepackage/@time)"/>
</xsl:call-template>
</td>
+ <td><xsl:value-of select="$insamepackage/@timestamp"/></td>
+ <td><xsl:value-of select="$insamepackage/@hostname"/></td>
</tr>
</xsl:for-each>
</table>
@@ -574,7 +692,7 @@
<table width="100%">
<tr>
<td align="left"></td>
- <td align="right">Designed for use with <a href="http://www.junit.org/">JUnit</a> and <a href="http://jakarta.apache.org/">Ant</a>.</td>
+ <td align="right">Designed for use with <a href="http://www.junit.org/">JUnit</a> and <a href="http://ant.apache.org/">Ant</a>.</td>
</tr>
</table>
<hr size="1"/>
@@ -588,12 +706,18 @@
<th>Errors</th>
<th>Failures</th>
<th nowrap="nowrap">Time(s)</th>
+ <th nowrap="nowrap">Time Stamp</th>
+ <th>Host</th>
</tr>
</xsl:template>
<!-- method header -->
<xsl:template name="testcase.test.header">
+ <xsl:param name="show.class" select="''"/>
<tr valign="top">
+ <xsl:if test="boolean($show.class)">
+ <th>Class</th>
+ </xsl:if>
<th>Name</th>
<th>Status</th>
<th width="80%">Type</th>
@@ -612,18 +736,39 @@
<xsl:otherwise>Pass</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
- <td><a href="{@name}.html"><xsl:value-of select="@name"/></a></td>
- <td><xsl:apply-templates select="@tests"/></td>
- <td><xsl:apply-templates select="@errors"/></td>
- <td><xsl:apply-templates select="@failures"/></td>
+ <td><a title="Display all tests" href="{@id}_{@name}.html"><xsl:value-of select="@name"/></a></td>
+ <td><a title="Display all tests" href="{@id}_{@name}.html"><xsl:apply-templates select="@tests"/></a></td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="@errors != 0">
+ <a title="Display only errors" href="{@id}_{@name}-errors.html"><xsl:apply-templates select="@errors"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="@errors"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="@failures != 0">
+ <a title="Display only failures" href="{@id}_{@name}-fails.html"><xsl:apply-templates select="@failures"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates select="@failures"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
<td><xsl:call-template name="display-time">
<xsl:with-param name="value" select="@time"/>
</xsl:call-template>
</td>
+ <td><xsl:apply-templates select="@timestamp"/></td>
+ <td><xsl:apply-templates select="@hostname"/></td>
</tr>
</xsl:template>
<xsl:template match="testcase" mode="print.test">
+ <xsl:param name="show.class" select="''"/>
<tr valign="top">
<xsl:attribute name="class">
<xsl:choose>
@@ -632,7 +777,23 @@
<xsl:otherwise>TableRowColor</xsl:otherwise>
</xsl:choose>
</xsl:attribute>
- <td><xsl:value-of select="@name"/></td>
+ <xsl:variable name="class.href">
+ <xsl:value-of select="concat(translate(../@package,'.','/'), '/', ../@id, '_', ../@name, '.html')"/>
+ </xsl:variable>
+ <xsl:if test="boolean($show.class)">
+ <td><a href="{$class.href}"><xsl:value-of select="../@name"/></a></td>
+ </xsl:if>
+ <td>
+ <a name="{@name}"/>
+ <xsl:choose>
+ <xsl:when test="boolean($show.class)">
+ <a href="{concat($class.href, '#', @name)}"><xsl:value-of select="@name"/></a>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </td>
<xsl:choose>
<xsl:when test="failure">
<td>Failure</td>
@@ -699,8 +860,7 @@
-->
<xsl:template name="br-replace">
<xsl:param name="word"/>
- <xsl:param name="br"><br/></xsl:param>
- <xsl:value-of select='stringutils:replace(string($word),"
",$br)'/>
+ <xsl:value-of disable-output-escaping="yes" select='stringutils:replace(string($word),"
","<br/>")'/>
</xsl:template>
<xsl:template name="display-time">
@@ -713,4 +873,3 @@
<xsl:value-of select="format-number($value,'0.00%')"/>
</xsl:template>
</xsl:stylesheet>
-
--
Gitblit v1.10.0