git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269663 13f79535-47bb-0310-9956-ffa450edef68master
@@ -36,7 +36,7 @@ Changes that could break older environments: | |||||
encoding attribute of the task and set it to UTF8 to get the old | encoding attribute of the task and set it to UTF8 to get the old | ||||
behavior. | behavior. | ||||
* The <pvcs> task has been move to a package of its own. | |||||
* The <pvcs> task has been moved to a package of its own. | |||||
* JUnitResultFormater has two additional methods that must be | * JUnitResultFormater has two additional methods that must be | ||||
implemented by custom formatters. | implemented by custom formatters. | ||||
@@ -93,6 +93,16 @@ Changes that could break older environments: | |||||
</delete> | </delete> | ||||
will now remove "somedir" as well, unless there are still files left | will now remove "somedir" as well, unless there are still files left | ||||
in it (matched by the default excludes). | in it (matched by the default excludes). | ||||
* The copy task will now fail if the file to be copied is not found. | |||||
* Ant properties defined in properties files now behave the same way as | |||||
properties defined in the build file. In particular the $ character needs | |||||
to be escaped in property values by doubling it to $$. So, to define a | |||||
property with the value $hello, you need to define it in a properties file | |||||
as | |||||
test.prop=$$hello | |||||
This was not the case in Ant 1.3 | |||||
Other changes: | Other changes: | ||||
-------------- | -------------- | ||||
@@ -161,6 +161,7 @@ | |||||
<available property="xalan.envcheck" | <available property="xalan.envcheck" | ||||
classname="org.apache.xalan.xslt.EnvironmentCheck" | classname="org.apache.xalan.xslt.EnvironmentCheck" | ||||
classpathref="classpath" /> | classpathref="classpath" /> | ||||
<condition property="javamail.complete"> | <condition property="javamail.complete"> | ||||
<and> | <and> | ||||
<available classname="javax.activation.DataHandler" | <available classname="javax.activation.DataHandler" | ||||
@@ -180,6 +181,11 @@ | |||||
<tstamp> | <tstamp> | ||||
<format property="year" pattern="yyyy" /> | <format property="year" pattern="yyyy" /> | ||||
</tstamp> | </tstamp> | ||||
<filterset id="ant.filters"> | |||||
<filter token="VERSION" value="${version}" /> | |||||
<filter token="DATE" value="${TODAY}" /> | |||||
<filter token="TIME" value="${TSTAMP}" /> | |||||
</filterset> | |||||
</target> | </target> | ||||
<!-- | <!-- | ||||
@@ -256,12 +262,7 @@ | |||||
<include name="**/version.txt" /> | <include name="**/version.txt" /> | ||||
<include name="**/defaultManifest.mf" /> | <include name="**/defaultManifest.mf" /> | ||||
</fileset> | </fileset> | ||||
<filterset> | |||||
<filter token="VERSION" value="${version}" /> | |||||
<filter token="DATE" value="${TODAY}" /> | |||||
<filter token="TIME" value="${TSTAMP}" /> | |||||
</filterset> | |||||
<filterset refid="ant.filters"/> | |||||
</copy> | </copy> | ||||
<copy todir="${build.classes}/${optional.package}/junit/xsl"> | <copy todir="${build.classes}/${optional.package}/junit/xsl"> | ||||
@@ -369,9 +370,9 @@ | |||||
<copy todir="${dist.lib}" file="${lib.dir}/optional/README"/> | <copy todir="${dist.lib}" file="${lib.dir}/optional/README"/> | ||||
<copy todir="${dist.docs}" | |||||
filtering="on"> | |||||
<copy todir="${dist.docs}"> | |||||
<fileset dir="${docs.dir}"/> | <fileset dir="${docs.dir}"/> | ||||
<filterset refid="ant.filters"/> | |||||
</copy> | </copy> | ||||
<copy todir="${dist.dir}"> | <copy todir="${dist.dir}"> | ||||
@@ -655,10 +656,10 @@ | |||||
<echo message="file.encoding=${file.encoding}" /> | <echo message="file.encoding=${file.encoding}" /> | ||||
<echo message="user.language=${user.language}" /> | <echo message="user.language=${user.language}" /> | ||||
</target> | </target> | ||||
<!-- helper class from Xalan2 to check for jar versioning of xml/xsl processors --> | <!-- helper class from Xalan2 to check for jar versioning of xml/xsl processors --> | ||||
<target name="xml-check" depends="check_for_optional_packages" if="xalan.envcheck"> | <target name="xml-check" depends="check_for_optional_packages" if="xalan.envcheck"> | ||||
<java classname="org.apache.xalan.xslt.EnvironmentCheck"/> | |||||
<java classname="org.apache.xalan.xslt.EnvironmentCheck"/> | |||||
</target> | </target> | ||||
<!-- | <!-- | ||||
@@ -118,54 +118,55 @@ | |||||
</html> | </html> | ||||
</xsl:template> | </xsl:template> | ||||
<!-- this is the stylesheet css to use for nearly everything --> | <!-- this is the stylesheet css to use for nearly everything --> | ||||
<xsl:template name="stylesheet.css"> | <xsl:template name="stylesheet.css"> | ||||
body { | body { | ||||
font:normal 68% verdana,arial,helvetica; | font:normal 68% verdana,arial,helvetica; | ||||
color:#000000; | color:#000000; | ||||
} | } | ||||
td { | |||||
font-size: 68% | |||||
table tr td, table tr th { | |||||
font-size: 68%; | |||||
} | |||||
table.details tr th{ | |||||
font-weight: bold; | |||||
text-align:left; | |||||
background:#a6caf0; | |||||
} | |||||
table.details tr td{ | |||||
background:#eeeee0; | |||||
} | } | ||||
p { | p { | ||||
line-height:1.5em; | line-height:1.5em; | ||||
margin-top:0.5em; margin-bottom:1.0em; | margin-top:0.5em; margin-bottom:1.0em; | ||||
} | } | ||||
h1 { | h1 { | ||||
margin: 0px 0px 5px; | |||||
font: 165% verdana,arial,helvetica | |||||
margin: 0px 0px 5px; font: 165% verdana,arial,helvetica | |||||
} | } | ||||
h2 { | h2 { | ||||
margin-top: 1em; | |||||
margin-bottom: 0.5em; | |||||
font: bold 125% verdana,arial,helvetica | |||||
margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica | |||||
} | } | ||||
h3 { | h3 { | ||||
margin-bottom: 0.5em; | |||||
font: bold 115% verdana,arial,helvetica | |||||
margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica | |||||
} | } | ||||
h4 { | h4 { | ||||
margin-bottom: 0.5em; | |||||
font: bold 100% verdana,arial,helvetica | |||||
margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica | |||||
} | } | ||||
h5 { | h5 { | ||||
margin-bottom: 0.5em; | |||||
font: bold 100% verdana,arial,helvetica | |||||
margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica | |||||
} | } | ||||
h6 { | h6 { | ||||
margin-bottom: 0.5em; | |||||
font: bold 100% verdana,arial,helvetica | |||||
margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica | |||||
} | } | ||||
.Error { | .Error { | ||||
font-weight:bold; | |||||
color:red; | |||||
font-weight:bold; color:red; | |||||
} | } | ||||
.Failure { | .Failure { | ||||
font-weight:bold; | |||||
color:purple; | |||||
font-weight:bold; color:purple; | |||||
} | |||||
.Properties { | |||||
text-align:right; | |||||
} | } | ||||
</xsl:template> | </xsl:template> | ||||
@@ -181,29 +182,87 @@ h6 { | |||||
<xsl:call-template name="create.stylesheet.link"> | <xsl:call-template name="create.stylesheet.link"> | ||||
<xsl:with-param name="package.name" select="$package.name"/> | <xsl:with-param name="package.name" select="$package.name"/> | ||||
</xsl:call-template> | </xsl:call-template> | ||||
<script language="JavaScript"> | |||||
var TestCases = new Array(); | |||||
var cur; | |||||
<xsl:apply-templates select="properties"/> | |||||
</script> | |||||
<script language="JavaScript"><![CDATA[ | |||||
function displayProperties (name) { | |||||
var win = window.open('','JUnitSystemProperties','scrollbars=1,resizable=1'); | |||||
var doc = win.document.open(); | |||||
doc.write("<html><head><title>Properties of " + name + "</title>"); | |||||
doc.write("<style>") | |||||
doc.write("body {font:normal 68% verdana,arial,helvetica; color:#000000; }"); | |||||
doc.write("table tr td, table tr th { font-size: 68%; }"); | |||||
doc.write("table.properties { border-collapse:collapse; border-left:solid 1 #cccccc; border-top:solid 1 #cccccc; padding:5px; }"); | |||||
doc.write("table.properties th { text-align:left; border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#eeeeee; }"); | |||||
doc.write("table.properties td { font:normal; text-align:left; border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#fffffff; }"); | |||||
doc.write("h3 { margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica }"); | |||||
doc.write("</style>"); | |||||
doc.write("</head><body>"); | |||||
doc.write("<h3>Properties of " + name + "</h3>"); | |||||
doc.write("<div align=\"right\"><a href=\"javascript:window.close();\">Close</a></div>"); | |||||
doc.write("<table class='properties'>"); | |||||
doc.write("<tr><th>Name</th><th>Value</th></tr>"); | |||||
for (prop in TestCases[name]) { | |||||
doc.write("<tr><th>" + prop + "</th><td>" + TestCases[name][prop] + "</td></tr>"); | |||||
} | |||||
doc.write("</table>"); | |||||
doc.write("</body></html>"); | |||||
doc.close(); | |||||
win.focus(); | |||||
} | |||||
]]> | |||||
</script> | |||||
</head> | </head> | ||||
<body> | <body> | ||||
<xsl:call-template name="pageHeader"/> | <xsl:call-template name="pageHeader"/> | ||||
<h3>Class <xsl:if test="not($package.name = '')"><xsl:value-of select="$package.name"/>.</xsl:if><xsl:value-of select="@name"/></h3> | <h3>Class <xsl:if test="not($package.name = '')"><xsl:value-of select="$package.name"/>.</xsl:if><xsl:value-of select="@name"/></h3> | ||||
<table border="0" cellpadding="5" cellspacing="2" width="95%"> | |||||
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%"> | |||||
<xsl:call-template name="testsuite.test.header"/> | <xsl:call-template name="testsuite.test.header"/> | ||||
<xsl:apply-templates select="." mode="print.test"/> | <xsl:apply-templates select="." mode="print.test"/> | ||||
</table> | </table> | ||||
<h2>Tests</h2> | <h2>Tests</h2> | ||||
<p> | <p> | ||||
<table border="0" cellpadding="5" cellspacing="2" width="95%"> | |||||
<xsl:call-template name="testcase.test.header"/> | |||||
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%"> | |||||
<!-- | |||||
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:apply-templates select="./testcase" mode="print.test"/> | ||||
</table> | </table> | ||||
</p> | </p> | ||||
<div class="Properties"> | |||||
<a> | |||||
<xsl:attribute name="href">javascript:displayProperties('<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>');</xsl:attribute> | |||||
Properties >> | |||||
</a> | |||||
</div> | |||||
</body> | </body> | ||||
</html> | </html> | ||||
</xsl:template> | </xsl:template> | ||||
<!-- | |||||
Write properties into a JavaScript data structure. | |||||
This is based on the original idea by Erik Hatcher (erik@hatcher.net) | |||||
--> | |||||
<xsl:template match="properties"> | |||||
cur = TestCases['<xsl:value-of select="../@package"/>.<xsl:value-of select="../@name"/>'] = new Array(); | |||||
<xsl:for-each select="property"> | |||||
<xsl:sort select="@name"/> | |||||
cur['<xsl:value-of select="@name"/>'] = '<xsl:call-template name="JS-escape"><xsl:with-param name="string" select="@value"/></xsl:call-template>'; | |||||
</xsl:for-each> | |||||
</xsl:template> | |||||
<!-- ====================================================================== | <!-- ====================================================================== | ||||
This page is created for every package. | This page is created for every package. | ||||
@@ -340,15 +399,15 @@ h6 { | |||||
<xsl:variable name="failureCount" select="sum(testsuite/@failures)"/> | <xsl:variable name="failureCount" select="sum(testsuite/@failures)"/> | ||||
<xsl:variable name="timeCount" select="sum(testsuite/@time)"/> | <xsl:variable name="timeCount" select="sum(testsuite/@time)"/> | ||||
<xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/> | <xsl:variable name="successRate" select="($testCount - $failureCount - $errorCount) div $testCount"/> | ||||
<table border="0" cellpadding="5" cellspacing="2" width="95%"> | |||||
<tr bgcolor="#A6CAF0" valign="top"> | |||||
<td><strong>Tests</strong></td> | |||||
<td><strong>Failures</strong></td> | |||||
<td><strong>Errors</strong></td> | |||||
<td><strong>Success rate</strong></td> | |||||
<td><strong>Time</strong></td> | |||||
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%"> | |||||
<tr valign="top"> | |||||
<th>Tests</th> | |||||
<th>Failures</th> | |||||
<th>Errors</th> | |||||
<th>Success rate</th> | |||||
<th>Time</th> | |||||
</tr> | </tr> | ||||
<tr bgcolor="#EEEEE" valign="top"> | |||||
<tr valign="top"> | |||||
<xsl:attribute name="class"> | <xsl:attribute name="class"> | ||||
<xsl:choose> | <xsl:choose> | ||||
<xsl:when test="$errorCount > 0">Error</xsl:when> | <xsl:when test="$errorCount > 0">Error</xsl:when> | ||||
@@ -381,13 +440,13 @@ h6 { | |||||
</table> | </table> | ||||
<h2>Packages</h2> | <h2>Packages</h2> | ||||
<table border="0" cellpadding="5" cellspacing="2" width="95%"> | |||||
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%"> | |||||
<xsl:call-template name="testsuite.test.header"/> | <xsl:call-template name="testsuite.test.header"/> | ||||
<xsl:for-each select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]"> | <xsl:for-each select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]"> | ||||
<xsl:sort select="@package" order="ascending"/> | <xsl:sort select="@package" order="ascending"/> | ||||
<!-- get the node set containing all testsuites that have the same package --> | <!-- get the node set containing all testsuites that have the same package --> | ||||
<xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = current()/@package]"/> | <xsl:variable name="insamepackage" select="/testsuites/testsuite[./@package = current()/@package]"/> | ||||
<tr bgcolor="#EEEEE" valign="top"> | |||||
<tr valign="top"> | |||||
<!-- display a failure if there is any failure/error in the package --> | <!-- display a failure if there is any failure/error in the package --> | ||||
<xsl:attribute name="class"> | <xsl:attribute name="class"> | ||||
<xsl:choose> | <xsl:choose> | ||||
@@ -435,7 +494,7 @@ h6 { | |||||
<xsl:if test="count($insamepackage) > 0"> | <xsl:if test="count($insamepackage) > 0"> | ||||
<h2>Classes</h2> | <h2>Classes</h2> | ||||
<p> | <p> | ||||
<table border="0" cellpadding="5" cellspacing="2" width="95%"> | |||||
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%"> | |||||
<xsl:call-template name="testsuite.test.header"/> | <xsl:call-template name="testsuite.test.header"/> | ||||
<xsl:apply-templates select="$insamepackage" mode="print.test"> | <xsl:apply-templates select="$insamepackage" mode="print.test"> | ||||
<xsl:sort select="@name"/> | <xsl:sort select="@name"/> | ||||
@@ -487,29 +546,29 @@ h6 { | |||||
<!-- class header --> | <!-- class header --> | ||||
<xsl:template name="testsuite.test.header"> | <xsl:template name="testsuite.test.header"> | ||||
<tr bgcolor="#A6CAF0" valign="top"> | |||||
<td width="80%"><strong>Name</strong></td> | |||||
<td><strong>Tests</strong></td> | |||||
<td><strong>Errors</strong></td> | |||||
<td><strong>Failures</strong></td> | |||||
<td nowrap="nowrap"><strong>Time(s)</strong></td> | |||||
<tr valign="top"> | |||||
<th width="80%">Name</th> | |||||
<th>Tests</th> | |||||
<th>Errors</th> | |||||
<th>Failures</th> | |||||
<th nowrap="nowrap">Time(s)</th> | |||||
</tr> | </tr> | ||||
</xsl:template> | </xsl:template> | ||||
<!-- method header --> | <!-- method header --> | ||||
<xsl:template name="testcase.test.header"> | <xsl:template name="testcase.test.header"> | ||||
<tr bgcolor="#A6CAF0" valign="top"> | |||||
<td><strong>Name</strong></td> | |||||
<td><strong>Status</strong></td> | |||||
<td width="80%"><strong>Type</strong></td> | |||||
<td nowrap="nowrap"><strong>Time(s)</strong></td> | |||||
<tr valign="top"> | |||||
<th>Name</th> | |||||
<th>Status</th> | |||||
<th width="80%">Type</th> | |||||
<th nowrap="nowrap">Time(s)</th> | |||||
</tr> | </tr> | ||||
</xsl:template> | </xsl:template> | ||||
<!-- class information --> | <!-- class information --> | ||||
<xsl:template match="testsuite" mode="print.test"> | <xsl:template match="testsuite" mode="print.test"> | ||||
<tr bgcolor="#EEEEE" valign="top"> | |||||
<tr valign="top"> | |||||
<xsl:attribute name="class"> | <xsl:attribute name="class"> | ||||
<xsl:choose> | <xsl:choose> | ||||
<xsl:when test="@errors[.> 0]">Error</xsl:when> | <xsl:when test="@errors[.> 0]">Error</xsl:when> | ||||
@@ -529,7 +588,7 @@ h6 { | |||||
</xsl:template> | </xsl:template> | ||||
<xsl:template match="testcase" mode="print.test"> | <xsl:template match="testcase" mode="print.test"> | ||||
<tr bgcolor="#EEEEE" valign="top"> | |||||
<tr valign="top"> | |||||
<xsl:attribute name="class"> | <xsl:attribute name="class"> | ||||
<xsl:choose> | <xsl:choose> | ||||
<xsl:when test="error">Error</xsl:when> | <xsl:when test="error">Error</xsl:when> | ||||
@@ -590,6 +649,28 @@ h6 { | |||||
<!--pre><xsl:value-of select="."/></pre--> | <!--pre><xsl:value-of select="."/></pre--> | ||||
</xsl:template> | </xsl:template> | ||||
<xsl:template name="JS-escape"> | |||||
<xsl:param name="string"/> | |||||
<xsl:choose><!-- something isn't right here, basically all single quotes need to be replaced with backslash-single-quote | |||||
<xsl:when test="contains($string,''')"> | |||||
<xsl:value-of select="substring-before($string,''')"/> | |||||
\' | |||||
<xsl:call-template name="JS-escape"> | |||||
<xsl:with-param name="string" select="substring-after($string,''')"/> | |||||
</xsl:call-template> | |||||
</xsl:when> --> | |||||
<xsl:when test="contains($string,'\')"> | |||||
<xsl:value-of select="substring-before($string,'\')"/>\\<xsl:call-template name="JS-escape"> | |||||
<xsl:with-param name="string" select="substring-after($string,'\')"/> | |||||
</xsl:call-template> | |||||
</xsl:when> | |||||
<xsl:otherwise> | |||||
<xsl:value-of select="$string"/> | |||||
</xsl:otherwise> | |||||
</xsl:choose> | |||||
</xsl:template> | |||||
<!-- | <!-- | ||||
template that will convert a carriage return into a br tag | template that will convert a carriage return into a br tag | ||||
@param word the text from which to convert CR to BR tag | @param word the text from which to convert CR to BR tag | ||||
@@ -1,68 +1,95 @@ | |||||
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> | ||||
<!-- ====================================================================== | |||||
Stylesheet to transform an XML file generated by the Ant MAudit task into | |||||
a set of JavaDoc-like HTML page to make pages more convenient to be browsed. | |||||
It use the Xalan redirect extension to write to multiple output files. | |||||
Note: HTML output can be made much more clean by removing non css attributes | |||||
====================================================================== --> | |||||
<xsl:output method="html" indent="yes"/> | <xsl:output method="html" indent="yes"/> | ||||
<xsl:decimal-format decimal-separator="." grouping-separator="," /> | <xsl:decimal-format decimal-separator="." grouping-separator="," /> | ||||
<xsl:template match="testsuites"> | <xsl:template match="testsuites"> | ||||
<HTML> | <HTML> | ||||
<HEAD> | <HEAD> | ||||
<style type="text/css"> | |||||
BODY { | |||||
font:normal 68% verdana,arial,helvetica; | |||||
color:#000000; | |||||
} | |||||
TABLE TR TD, TABLE TR TH { | |||||
font-size: 68%; | |||||
} | |||||
TABLE.details TR TH{ | |||||
font-weight: bold; | |||||
text-align:left; | |||||
background:#A6CAF0; | |||||
} | |||||
TABLE.details TR TD{ | |||||
background:#EEEEE0; | |||||
} | |||||
P { | |||||
line-height:1.5em; | |||||
margin-top:0.5em; margin-bottom:1.0em; | |||||
} | |||||
H1 { | |||||
MARGIN: 0px 0px 5px; FONT: 165% verdana,arial,helvetica | |||||
} | |||||
H2 { | |||||
MARGIN-TOP: 1em; MARGIN-BOTTOM: 0.5em; FONT: bold 125% verdana,arial,helvetica | |||||
} | |||||
H3 { | |||||
MARGIN-BOTTOM: 0.5em; FONT: bold 115% verdana,arial,helvetica | |||||
} | |||||
H4 { | |||||
MARGIN-BOTTOM: 0.5em; FONT: bold 100% verdana,arial,helvetica | |||||
} | |||||
H5 { | |||||
MARGIN-BOTTOM: 0.5em; FONT: bold 100% verdana,arial,helvetica | |||||
} | |||||
H6 { | |||||
MARGIN-BOTTOM: 0.5em; FONT: bold 100% verdana,arial,helvetica | |||||
} | |||||
.Error { | |||||
font-weight:bold; color:red; | |||||
} | |||||
.Failure { | |||||
font-weight:bold; color:purple; | |||||
} | |||||
</style> | |||||
<style type="text/css"> | |||||
body { | |||||
font:normal 68% verdana,arial,helvetica; | |||||
color:#000000; | |||||
} | |||||
table tr td, table tr th { | |||||
font-size: 68%; | |||||
} | |||||
table.details tr th{ | |||||
font-weight: bold; | |||||
text-align:left; | |||||
background:#a6caf0; | |||||
} | |||||
table.details tr td{ | |||||
background:#eeeee0; | |||||
} | |||||
p { | |||||
line-height:1.5em; | |||||
margin-top:0.5em; margin-bottom:1.0em; | |||||
} | |||||
h1 { | |||||
margin: 0px 0px 5px; font: 165% verdana,arial,helvetica | |||||
} | |||||
h2 { | |||||
margin-top: 1em; margin-bottom: 0.5em; font: bold 125% verdana,arial,helvetica | |||||
} | |||||
h3 { | |||||
margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica | |||||
} | |||||
h4 { | |||||
margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica | |||||
} | |||||
h5 { | |||||
margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica | |||||
} | |||||
h6 { | |||||
margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica | |||||
} | |||||
.Error { | |||||
font-weight:bold; color:red; | |||||
} | |||||
.Failure { | |||||
font-weight:bold; color:purple; | |||||
} | |||||
.Properties { | |||||
text-align:right; | |||||
} | |||||
</style> | |||||
<script language="JavaScript"> | |||||
var TestCases = new Array(); | |||||
var cur; | |||||
<xsl:for-each select="./testsuite"> | |||||
<xsl:apply-templates select="properties"/> | |||||
</xsl:for-each> | |||||
</script> | |||||
<script language="JavaScript"><![CDATA[ | |||||
function displayProperties (name) { | |||||
var win = window.open('','JUnitSystemProperties','scrollbars=1,resizable=1'); | |||||
var doc = win.document.open(); | |||||
doc.write("<html><head><title>Properties of " + name + "</title>"); | |||||
doc.write("<style>") | |||||
doc.write("body {font:normal 68% verdana,arial,helvetica; color:#000000; }"); | |||||
doc.write("table tr td, table tr th { font-size: 68%; }"); | |||||
doc.write("table.properties { border-collapse:collapse; border-left:solid 1 #cccccc; border-top:solid 1 #cccccc; padding:5px; }"); | |||||
doc.write("table.properties th { text-align:left; border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#eeeeee; }"); | |||||
doc.write("table.properties td { font:normal; text-align:left; border-right:solid 1 #cccccc; border-bottom:solid 1 #cccccc; background-color:#fffffff; }"); | |||||
doc.write("h3 { margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica }"); | |||||
doc.write("</style>"); | |||||
doc.write("</head><body>"); | |||||
doc.write("<h3>Properties of " + name + "</h3>"); | |||||
doc.write("<div align=\"right\"><a href=\"javascript:window.close();\">Close</a></div>"); | |||||
doc.write("<table class='properties'>"); | |||||
doc.write("<tr><th>Name</th><th>Value</th></tr>"); | |||||
for (prop in TestCases[name]) { | |||||
doc.write("<tr><th>" + prop + "</th><td>" + TestCases[name][prop] + "</td></tr>"); | |||||
} | |||||
doc.write("</table>"); | |||||
doc.write("</body></html>"); | |||||
doc.close(); | |||||
win.focus(); | |||||
} | |||||
]]> | |||||
</script> | |||||
</HEAD> | </HEAD> | ||||
<body> | <body> | ||||
<a name="#top"></a> | <a name="#top"></a> | ||||
@@ -163,14 +190,25 @@ | |||||
<h3>TestCase <xsl:value-of select="@name"/></h3> | <h3>TestCase <xsl:value-of select="@name"/></h3> | ||||
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%"> | <table class="details" border="0" cellpadding="5" cellspacing="2" width="95%"> | ||||
<!-- Header --> | |||||
<xsl:call-template name="testcase.test.header"/> | |||||
<!-- match the testcases of this package --> | |||||
<xsl:apply-templates select="testcase" mode="print.test"/> | |||||
<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"/> | |||||
</table> | </table> | ||||
<div class="Properties"> | |||||
<a> | |||||
<xsl:attribute name="href">javascript:displayProperties('<xsl:value-of select="@package"/>.<xsl:value-of select="@name"/>');</xsl:attribute> | |||||
Properties >> | |||||
</a> | |||||
</div> | |||||
<p/> | <p/> | ||||
<xsl:apply-templates select="properties"/> | |||||
<a href="#top">Back to top</a> | <a href="#top">Back to top</a> | ||||
</xsl:for-each> | </xsl:for-each> | ||||
@@ -223,28 +261,17 @@ | |||||
</table> | </table> | ||||
</xsl:template> | </xsl:template> | ||||
<xsl:template match="properties"> | |||||
<!-- | |||||
I have NO idea how to display properties ! :-( | |||||
It takes an incredible amount of space in the page and it's | |||||
really unreadable. | |||||
<xsl:variable name="count" select="count(property)"/> | |||||
<h3>System Properties</h3> | |||||
<table class="details" border="0" cellpadding="5" cellspacing="2" width="95%"> | |||||
<tr valign="top"> | |||||
<th>Name</th> | |||||
<th>Value</th> | |||||
</tr> | |||||
<xsl:for-each select="property"> | |||||
<tr valign="top"> | |||||
<td><xsl:value-of select="@name"/></td> | |||||
<td><xsl:value-of select="@value"/></td> | |||||
</tr> | |||||
</xsl:for-each> | |||||
</table> | |||||
--> | |||||
</xsl:template> | |||||
<!-- | |||||
Write properties into a JavaScript data structure. | |||||
This is based on the original idea by Erik Hatcher (erik@hatcher.net) | |||||
--> | |||||
<xsl:template match="properties"> | |||||
cur = TestCases['<xsl:value-of select="../@package"/>.<xsl:value-of select="../@name"/>'] = new Array(); | |||||
<xsl:for-each select="property"> | |||||
<xsl:sort select="@name"/> | |||||
cur['<xsl:value-of select="@name"/>'] = '<xsl:call-template name="JS-escape"><xsl:with-param name="string" select="@value"/></xsl:call-template>'; | |||||
</xsl:for-each> | |||||
</xsl:template> | |||||
<!-- Page HEADER --> | <!-- Page HEADER --> | ||||
<xsl:template name="pageHeader"> | <xsl:template name="pageHeader"> | ||||
@@ -345,8 +372,6 @@ | |||||
</xsl:template> | </xsl:template> | ||||
<!-- Note : the below template error and failure are the same style | |||||
so just call the same style store in the toolkit template --> | |||||
<xsl:template match="failure"> | <xsl:template match="failure"> | ||||
<xsl:call-template name="display-failures"/> | <xsl:call-template name="display-failures"/> | ||||
</xsl:template> | </xsl:template> | ||||
@@ -374,6 +399,28 @@ | |||||
<!--pre><xsl:value-of select="."/></pre--> | <!--pre><xsl:value-of select="."/></pre--> | ||||
</xsl:template> | </xsl:template> | ||||
<xsl:template name="JS-escape"> | |||||
<xsl:param name="string"/> | |||||
<xsl:choose><!-- something isn't right here, basically all single quotes need to be replaced with backslash-single-quote | |||||
<xsl:when test="contains($string,''')"> | |||||
<xsl:value-of select="substring-before($string,''')"/> | |||||
\' | |||||
<xsl:call-template name="JS-escape"> | |||||
<xsl:with-param name="string" select="substring-after($string,''')"/> | |||||
</xsl:call-template> | |||||
</xsl:when> --> | |||||
<xsl:when test="contains($string,'\')"> | |||||
<xsl:value-of select="substring-before($string,'\')"/>\\<xsl:call-template name="JS-escape"> | |||||
<xsl:with-param name="string" select="substring-after($string,'\')"/> | |||||
</xsl:call-template> | |||||
</xsl:when> | |||||
<xsl:otherwise> | |||||
<xsl:value-of select="$string"/> | |||||
</xsl:otherwise> | |||||
</xsl:choose> | |||||
</xsl:template> | |||||
<!-- | <!-- | ||||
template that will convert a carriage return into a br tag | template that will convert a carriage return into a br tag | ||||
@param word the text from which to convert CR to BR tag | @param word the text from which to convert CR to BR tag | ||||
@@ -2,7 +2,7 @@ | |||||
<project name="antlr-test" basedir="." default="test1"> | <project name="antlr-test" basedir="." default="test1"> | ||||
<property name="tmp.dir" value="antlr.tmp"/> | |||||
<property name="tmp.dir" location="antlr.tmp"/> | |||||
<target name="test1"> | <target name="test1"> | ||||
@@ -18,6 +18,7 @@ | |||||
</target> | </target> | ||||
<target name="test3"> | <target name="test3"> | ||||
<deltree dir="${tmp.dir}"/> | |||||
<mkdir dir="${tmp.dir}"/> | <mkdir dir="${tmp.dir}"/> | ||||
<antlr target="antlr.g" outputdirectory="${tmp.dir}"/> | <antlr target="antlr.g" outputdirectory="${tmp.dir}"/> | ||||
</target> | </target> | ||||
@@ -0,0 +1,5 @@ | |||||
<project name="test" default="main" basedir="."> | |||||
<description>Test Project Description</description> | |||||
<target name="main"> | |||||
</target> | |||||
</project> |
@@ -0,0 +1,6 @@ | |||||
<project name="test" default="main" basedir="."> | |||||
<description>Multi Line | |||||
Project Description</description> | |||||
<target name="main"> | |||||
</target> | |||||
</project> |
@@ -0,0 +1,6 @@ | |||||
<project name="test" default="main" basedir="."> | |||||
<description>Multi Instance </description> | |||||
<description>Project Description</description> | |||||
<target name="main"> | |||||
</target> | |||||
</project> |
@@ -0,0 +1,6 @@ | |||||
<project name="test" default="main" basedir="."> | |||||
<description>Multi Instance </description> | |||||
<target name="main"> | |||||
<description>Nested Project Description</description> | |||||
</target> | |||||
</project> |
@@ -34,4 +34,10 @@ | |||||
<fixcrlf eol="lf" srcdir="." includes="dest3.txt"/> | <fixcrlf eol="lf" srcdir="." includes="dest3.txt"/> | ||||
</target> | </target> | ||||
<target name="cleanup"> | |||||
<delete file="dest1.txt" quiet="true" /> | |||||
<delete file="dest2.txt" quiet="true" /> | |||||
<delete file="dest3.txt" quiet="true" /> | |||||
</target> | |||||
</project> | </project> |
@@ -866,6 +866,9 @@ public class AntClassLoader extends ClassLoader implements BuildListener { | |||||
if (t instanceof ClassFormatError) { | if (t instanceof ClassFormatError) { | ||||
throw (ClassFormatError)t; | throw (ClassFormatError)t; | ||||
} | } | ||||
else if (t instanceof NoClassDefFoundError) { | |||||
throw (NoClassDefFoundError)t; | |||||
} | |||||
else { | else { | ||||
throw new IOException(t.toString()); | throw new IOException(t.toString()); | ||||
} | } | ||||
@@ -914,6 +917,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener { | |||||
} | } | ||||
} | } | ||||
catch (IOException ioe) { | catch (IOException ioe) { | ||||
// ioe.printStackTrace(); | |||||
log("Exception reading component " + pathComponent , Project.MSG_VERBOSE); | log("Exception reading component " + pathComponent , Project.MSG_VERBOSE); | ||||
} | } | ||||
} | } | ||||
@@ -143,7 +143,12 @@ public class DefaultLogger implements BuildLogger { | |||||
error.printStackTrace(err); | error.printStackTrace(err); | ||||
} | } | ||||
else { | else { | ||||
err.println(error.getMessage()); | |||||
if (error instanceof BuildException) { | |||||
err.println(error.toString()); | |||||
} | |||||
else { | |||||
err.println(error.getMessage()); | |||||
} | |||||
} | } | ||||
} | } | ||||
@@ -248,7 +248,7 @@ public class XmlLogger implements BuildListener { | |||||
} | } | ||||
messageElement.setAttribute(PRIORITY_ATTR, name); | messageElement.setAttribute(PRIORITY_ATTR, name); | ||||
Text messageText = doc.createTextNode(event.getMessage()); | |||||
Text messageText = doc.createCDATASection(event.getMessage()); | |||||
messageElement.appendChild(messageText); | messageElement.appendChild(messageText); | ||||
TimedElement parentElement = null; | TimedElement parentElement = null; | ||||
@@ -330,7 +330,14 @@ public class ExecuteOn extends ExecTask { | |||||
} | } | ||||
} else { // no targetFilePos | } else { // no targetFilePos | ||||
// 0 --> srcIndex | |||||
System.arraycopy(orig, 0, result, 0, srcIndex); | System.arraycopy(orig, 0, result, 0, srcIndex); | ||||
// srcIndex --> end | |||||
System.arraycopy(orig, srcIndex, result, | |||||
srcIndex + srcFiles.length, | |||||
orig.length - srcIndex); | |||||
} | } | ||||
// fill in source file names | // fill in source file names | ||||
@@ -87,17 +87,17 @@ import java.io.File; | |||||
* <p> | * <p> | ||||
* When this task executes, it will recursively scan the sourcedir and | * When this task executes, it will recursively scan the sourcedir and | ||||
* destdir looking for Java source files to compile. This task makes its | * destdir looking for Java source files to compile. This task makes its | ||||
* compile decision based on timestamp. | |||||
* compile decision based on timestamp. | |||||
* | * | ||||
* @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a> | * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a> | ||||
* @author Robin Green <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com</a> | * @author Robin Green <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com</a> | ||||
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | |||||
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | |||||
* @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | ||||
*/ | */ | ||||
public class Javac extends MatchingTask { | public class Javac extends MatchingTask { | ||||
private static final String FAIL_MSG | |||||
private static final String FAIL_MSG | |||||
= "Compile failed, messages should have been provided."; | = "Compile failed, messages should have been provided."; | ||||
private Path src; | private Path src; | ||||
@@ -116,6 +116,8 @@ public class Javac extends MatchingTask { | |||||
private boolean includeJavaRuntime = false; | private boolean includeJavaRuntime = false; | ||||
private boolean fork = false; | private boolean fork = false; | ||||
private boolean nowarn = false; | private boolean nowarn = false; | ||||
private String memoryInitialSize; | |||||
private String memoryMaximumSize; | |||||
protected boolean failOnError = true; | protected boolean failOnError = true; | ||||
protected File[] compileList = new File[0]; | protected File[] compileList = new File[0]; | ||||
@@ -157,7 +159,7 @@ public class Javac extends MatchingTask { | |||||
this.destDir = destDir; | this.destDir = destDir; | ||||
} | } | ||||
/** | |||||
/** | |||||
* Gets the destination directory into which the java source files | * Gets the destination directory into which the java source files | ||||
* should be compiled. | * should be compiled. | ||||
*/ | */ | ||||
@@ -298,6 +300,30 @@ public class Javac extends MatchingTask { | |||||
return deprecation; | return deprecation; | ||||
} | } | ||||
/** | |||||
* Set the memoryInitialSize flag. | |||||
*/ | |||||
public void setMemoryInitialSize(String memoryInitialSize) { | |||||
this.memoryInitialSize = memoryInitialSize; | |||||
} | |||||
/** Gets the memoryInitialSize flag. */ | |||||
public String getMemoryInitialSize() { | |||||
return memoryInitialSize; | |||||
} | |||||
/** | |||||
* Set the memoryMaximumSize flag. | |||||
*/ | |||||
public void setMemoryMaximumSize(String memoryMaximumSize) { | |||||
this.memoryMaximumSize = memoryMaximumSize; | |||||
} | |||||
/** Gets the memoryMaximumSize flag. */ | |||||
public String getMemoryMaximumSize() { | |||||
return memoryMaximumSize; | |||||
} | |||||
/** | /** | ||||
* Set the Java source file encoding name. | * Set the Java source file encoding name. | ||||
*/ | */ | ||||
@@ -334,21 +360,21 @@ public class Javac extends MatchingTask { | |||||
return optimize; | return optimize; | ||||
} | } | ||||
/** | |||||
/** | |||||
* Set the depend flag. | * Set the depend flag. | ||||
*/ | |||||
*/ | |||||
public void setDepend(boolean depend) { | public void setDepend(boolean depend) { | ||||
this.depend = depend; | this.depend = depend; | ||||
} | |||||
} | |||||
/** Gets the depend flag. */ | /** Gets the depend flag. */ | ||||
public boolean getDepend() { | public boolean getDepend() { | ||||
return depend; | return depend; | ||||
} | } | ||||
/** | |||||
/** | |||||
* Set the verbose flag. | * Set the verbose flag. | ||||
*/ | |||||
*/ | |||||
public void setVerbose(boolean verbose) { | public void setVerbose(boolean verbose) { | ||||
this.verbose = verbose; | this.verbose = verbose; | ||||
} | } | ||||
@@ -404,12 +430,12 @@ public class Javac extends MatchingTask { | |||||
/** | /** | ||||
* Sets whether to fork the javac compiler. | * Sets whether to fork the javac compiler. | ||||
*/ | |||||
public void setFork(boolean fork) | |||||
*/ | |||||
public void setFork(boolean fork) | |||||
{ | { | ||||
this.fork = fork; | |||||
this.fork = fork; | |||||
} | } | ||||
/** | /** | ||||
* Sets whether the -nowarn option should be used. | * Sets whether the -nowarn option should be used. | ||||
@@ -438,12 +464,12 @@ public class Javac extends MatchingTask { | |||||
if (list.length == 0) { | if (list.length == 0) { | ||||
throw new BuildException("srcdir attribute must be set!", location); | throw new BuildException("srcdir attribute must be set!", location); | ||||
} | } | ||||
if (destDir != null && !destDir.isDirectory()) { | if (destDir != null && !destDir.isDirectory()) { | ||||
throw new BuildException("destination directory \"" + destDir + "\" does not exist or is not a directory", location); | throw new BuildException("destination directory \"" + destDir + "\" does not exist or is not a directory", location); | ||||
} | } | ||||
// scan source directories and dest directory to build up | |||||
// scan source directories and dest directory to build up | |||||
// compile lists | // compile lists | ||||
resetFileLists(); | resetFileLists(); | ||||
for (int i=0; i<list.length; i++) { | for (int i=0; i<list.length; i++) { | ||||
@@ -458,13 +484,13 @@ public class Javac extends MatchingTask { | |||||
scanDir(srcDir, destDir != null ? destDir : srcDir, files); | scanDir(srcDir, destDir != null ? destDir : srcDir, files); | ||||
} | } | ||||
// compile the source files | // compile the source files | ||||
String compiler = project.getProperty("build.compiler"); | String compiler = project.getProperty("build.compiler"); | ||||
if (fork) { | |||||
if (compiler != null) { | |||||
if (fork) { | |||||
if (compiler != null) { | |||||
if (isJdkCompiler(compiler)) { | if (isJdkCompiler(compiler)) { | ||||
log("Since fork is true, ignoring build.compiler setting.", | log("Since fork is true, ignoring build.compiler setting.", | ||||
Project.MSG_WARN); | Project.MSG_WARN); | ||||
@@ -473,13 +499,13 @@ public class Javac extends MatchingTask { | |||||
else { | else { | ||||
log("Since build.compiler setting isn't classic or modern, ignoring fork setting.", Project.MSG_WARN); | log("Since build.compiler setting isn't classic or modern, ignoring fork setting.", Project.MSG_WARN); | ||||
} | } | ||||
} | |||||
} | |||||
else { | else { | ||||
compiler = "extJavac"; | compiler = "extJavac"; | ||||
} | } | ||||
} | |||||
} | |||||
if (compiler == null) { | |||||
if (compiler == null) { | |||||
if (Project.getJavaVersion() != Project.JAVA_1_1 && | if (Project.getJavaVersion() != Project.JAVA_1_1 && | ||||
Project.getJavaVersion() != Project.JAVA_1_2) { | Project.getJavaVersion() != Project.JAVA_1_2) { | ||||
compiler = "modern"; | compiler = "modern"; | ||||
@@ -492,14 +518,14 @@ public class Javac extends MatchingTask { | |||||
CompilerAdapter adapter = CompilerAdapterFactory.getCompiler( | CompilerAdapter adapter = CompilerAdapterFactory.getCompiler( | ||||
compiler, this ); | compiler, this ); | ||||
log("Compiling " + compileList.length + | |||||
log("Compiling " + compileList.length + | |||||
" source file" | " source file" | ||||
+ (compileList.length == 1 ? "" : "s") | + (compileList.length == 1 ? "" : "s") | ||||
+ (destDir != null ? " to " + destDir : "")); | + (destDir != null ? " to " + destDir : "")); | ||||
// now we need to populate the compiler adapter | // now we need to populate the compiler adapter | ||||
adapter.setJavac( this ); | adapter.setJavac( this ); | ||||
// finally, lets execute the compiler!! | // finally, lets execute the compiler!! | ||||
if (!adapter.execute()) { | if (!adapter.execute()) { | ||||
if (failOnError) { | if (failOnError) { | ||||
@@ -513,14 +539,14 @@ public class Javac extends MatchingTask { | |||||
} | } | ||||
/** | /** | ||||
* Clear the list of files to be compiled and copied.. | |||||
* Clear the list of files to be compiled and copied.. | |||||
*/ | */ | ||||
protected void resetFileLists() { | protected void resetFileLists() { | ||||
compileList = new File[0]; | compileList = new File[0]; | ||||
} | } | ||||
/** | /** | ||||
* Scans the directory looking for source files to be compiled. | |||||
* Scans the directory looking for source files to be compiled. | |||||
* The results are returned in the class variable compileList | * The results are returned in the class variable compileList | ||||
*/ | */ | ||||
protected void scanDir(File srcDir, File destDir, String files[]) { | protected void scanDir(File srcDir, File destDir, String files[]) { | ||||
@@ -529,7 +555,7 @@ public class Javac extends MatchingTask { | |||||
m.setTo("*.class"); | m.setTo("*.class"); | ||||
SourceFileScanner sfs = new SourceFileScanner(this); | SourceFileScanner sfs = new SourceFileScanner(this); | ||||
File[] newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m); | File[] newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m); | ||||
if (newFiles.length > 0) { | if (newFiles.length > 0) { | ||||
File[] newCompileList = new File[compileList.length + | File[] newCompileList = new File[compileList.length + | ||||
newFiles.length]; | newFiles.length]; | ||||
@@ -679,14 +679,13 @@ public class Javadoc extends Task { | |||||
} | } | ||||
public String getPackages() { | public String getPackages() { | ||||
StringBuffer p = new StringBuffer( "\"" ); | |||||
StringBuffer p = new StringBuffer(); | |||||
for (int i = 0; i < packages.size(); i++) { | for (int i = 0; i < packages.size(); i++) { | ||||
if ( i > 0 ) { | if ( i > 0 ) { | ||||
p.append( ":" ); | p.append( ":" ); | ||||
} | } | ||||
p.append( packages.elementAt(i).toString() ); | p.append( packages.elementAt(i).toString() ); | ||||
} | } | ||||
p.append( "\"" ); | |||||
return p.toString(); | return p.toString(); | ||||
} | } | ||||
} | } | ||||
@@ -450,11 +450,6 @@ public class Manifest { | |||||
*/ | */ | ||||
public Manifest(InputStream is) throws ManifestException, IOException { | public Manifest(InputStream is) throws ManifestException, IOException { | ||||
BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | ||||
String line = reader.readLine(); | |||||
if (line == null) { | |||||
return; | |||||
} | |||||
// This should be the manifest version | // This should be the manifest version | ||||
String nextSectionName = mainSection.read(reader); | String nextSectionName = mainSection.read(reader); | ||||
String readManifestVersion = mainSection.getAttributeValue(ATTRIBUTE_MANIFEST_VERSION); | String readManifestVersion = mainSection.getAttributeValue(ATTRIBUTE_MANIFEST_VERSION); | ||||
@@ -463,6 +458,7 @@ public class Manifest { | |||||
mainSection.removeAttribute(ATTRIBUTE_MANIFEST_VERSION); | mainSection.removeAttribute(ATTRIBUTE_MANIFEST_VERSION); | ||||
} | } | ||||
String line = null; | |||||
while ((line = reader.readLine()) != null) { | while ((line = reader.readLine()) != null) { | ||||
if (line.length() == 0) { | if (line.length() == 0) { | ||||
continue; | continue; | ||||
@@ -160,6 +160,18 @@ public class Property extends Task { | |||||
} | } | ||||
public void execute() throws BuildException { | public void execute() throws BuildException { | ||||
if (name != null) { | |||||
if (value == null && ref == null) { | |||||
throw new BuildException("You must specify value, location or refid with the name attribute", | |||||
location); | |||||
} | |||||
} else { | |||||
if (file == null && resource == null && env == null) { | |||||
throw new BuildException("You must specify file, resource or environment when not using the name attribute", | |||||
location); | |||||
} | |||||
} | |||||
if ((name != null) && (value != null)) { | if ((name != null) && (value != null)) { | ||||
addProperty(name, value); | addProperty(name, value); | ||||
} | } | ||||
@@ -88,7 +88,6 @@ import org.apache.tools.ant.util.FileUtils; | |||||
* @author <a href="mailto:rubys@us.ibm.com">Sam Ruby</a> | * @author <a href="mailto:rubys@us.ibm.com">Sam Ruby</a> | ||||
* @author <a href="mailto:russgold@acm.org">Russell Gold</a> | * @author <a href="mailto:russgold@acm.org">Russell Gold</a> | ||||
* @author <a href="stefan.bodewig@epost.de">Stefan Bodewig</a> | * @author <a href="stefan.bodewig@epost.de">Stefan Bodewig</a> | ||||
* @version $Revision$ $Date$ | |||||
*/ | */ | ||||
public class XSLTProcess extends MatchingTask { | public class XSLTProcess extends MatchingTask { | ||||
@@ -268,6 +267,7 @@ public class XSLTProcess extends MatchingTask { | |||||
loadClass("org.apache.tools.ant.taskdefs.optional.TraXLiaison"); | loadClass("org.apache.tools.ant.taskdefs.optional.TraXLiaison"); | ||||
liaison = (XSLTLiaison)clazz.newInstance(); | liaison = (XSLTLiaison)clazz.newInstance(); | ||||
} else if (proc.equals("xslp")) { | } else if (proc.equals("xslp")) { | ||||
log("DEPRECATED - xslp processor is deprecated. Use trax or xalan instead."); | |||||
final Class clazz = | final Class clazz = | ||||
loadClass("org.apache.tools.ant.taskdefs.optional.XslpLiaison"); | loadClass("org.apache.tools.ant.taskdefs.optional.XslpLiaison"); | ||||
liaison = (XSLTLiaison) clazz.newInstance(); | liaison = (XSLTLiaison) clazz.newInstance(); | ||||
@@ -67,7 +67,7 @@ import java.util.Random; | |||||
* | * | ||||
* @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a> | * @author James Davidson <a href="mailto:duncan@x180.com">duncan@x180.com</a> | ||||
* @author Robin Green <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com</a> | * @author Robin Green <a href="mailto:greenrd@hotmail.com">greenrd@hotmail.com</a> | ||||
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | |||||
* @author <a href="mailto:stefan.bodewig@epost.de">Stefan Bodewig</a> | |||||
* @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | * @author <a href="mailto:jayglanville@home.com">J D Glanville</a> | ||||
*/ | */ | ||||
public abstract class DefaultCompilerAdapter implements CompilerAdapter { | public abstract class DefaultCompilerAdapter implements CompilerAdapter { | ||||
@@ -92,6 +92,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
protected Location location; | protected Location location; | ||||
protected boolean includeAntRuntime; | protected boolean includeAntRuntime; | ||||
protected boolean includeJavaRuntime; | protected boolean includeJavaRuntime; | ||||
protected String memoryInitialSize; | |||||
protected String memoryMaximumSize; | |||||
protected File[] compileList; | protected File[] compileList; | ||||
protected static String lSep = System.getProperty("line.separator"); | protected static String lSep = System.getProperty("line.separator"); | ||||
@@ -116,6 +118,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
location = attributes.getLocation(); | location = attributes.getLocation(); | ||||
includeAntRuntime = attributes.getIncludeantruntime(); | includeAntRuntime = attributes.getIncludeantruntime(); | ||||
includeJavaRuntime = attributes.getIncludejavaruntime(); | includeJavaRuntime = attributes.getIncludejavaruntime(); | ||||
memoryInitialSize = attributes.getMemoryInitialSize(); | |||||
memoryMaximumSize = attributes.getMemoryMaximumSize(); | |||||
} | } | ||||
public Javac getJavac() { | public Javac getJavac() { | ||||
@@ -136,7 +140,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
classpath.setLocation(destDir); | classpath.setLocation(destDir); | ||||
} | } | ||||
// Combine the build classpath with the system classpath, in an | |||||
// Combine the build classpath with the system classpath, in an | |||||
// order determined by the value of build.classpath | // order determined by the value of build.classpath | ||||
if (compileClasspath == null) { | if (compileClasspath == null) { | ||||
@@ -166,7 +170,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
classpath.addExisting(new Path(null, | classpath.addExisting(new Path(null, | ||||
System.getProperty("java.home") | System.getProperty("java.home") | ||||
+ File.separator + "lib" | + File.separator + "lib" | ||||
+ File.separator | |||||
+ File.separator | |||||
+ "classes.zip")); | + "classes.zip")); | ||||
} else { | } else { | ||||
// JDK > 1.1 seems to set java.home to the JRE directory. | // JDK > 1.1 seems to set java.home to the JRE directory. | ||||
@@ -195,7 +199,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
+ File.separator + "ui.jar")); | + File.separator + "ui.jar")); | ||||
} | } | ||||
} | } | ||||
return classpath; | return classpath; | ||||
} | } | ||||
@@ -206,10 +210,23 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
protected Commandline setupJavacCommandlineSwitches(Commandline cmd) { | protected Commandline setupJavacCommandlineSwitches(Commandline cmd) { | ||||
Path classpath = getCompileClasspath(); | Path classpath = getCompileClasspath(); | ||||
// we cannot be using Java 1.0 when forking, so we only have to | |||||
// distinguish between Java 1.1, and Java 1.2 and higher, as Java 1.1 | |||||
// has its own parameter format | |||||
boolean usingJava1_1 = Project.getJavaVersion().equals(Project.JAVA_1_1); | |||||
String memoryParameterPrefix = usingJava1_1 ? "-J-" : "-J-X"; | |||||
if (memoryInitialSize != null) { | |||||
cmd.createArgument().setValue(memoryParameterPrefix+"ms"+memoryInitialSize); | |||||
} | |||||
if (memoryMaximumSize != null) { | |||||
cmd.createArgument().setValue(memoryParameterPrefix+"mx"+memoryMaximumSize); | |||||
} | |||||
if (attributes.getNowarn()) { | if (attributes.getNowarn()) { | ||||
cmd.createArgument().setValue("-nowarn"); | cmd.createArgument().setValue("-nowarn"); | ||||
} | } | ||||
if (deprecation == true) { | if (deprecation == true) { | ||||
cmd.createArgument().setValue("-deprecation"); | cmd.createArgument().setValue("-deprecation"); | ||||
} | } | ||||
@@ -218,7 +235,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
cmd.createArgument().setValue("-d"); | cmd.createArgument().setValue("-d"); | ||||
cmd.createArgument().setFile(destDir); | cmd.createArgument().setFile(destDir); | ||||
} | } | ||||
cmd.createArgument().setValue("-classpath"); | cmd.createArgument().setValue("-classpath"); | ||||
// Just add "sourcepath" to classpath ( for JDK1.1 ) | // Just add "sourcepath" to classpath ( for JDK1.1 ) | ||||
@@ -298,7 +315,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
} | } | ||||
/** | /** | ||||
* Logs the compilation parameters, adds the files to compile and logs the | |||||
* Logs the compilation parameters, adds the files to compile and logs the | |||||
* &qout;niceSourceList" | * &qout;niceSourceList" | ||||
*/ | */ | ||||
protected void logAndAddFilesToCompile(Commandline cmd) { | protected void logAndAddFilesToCompile(Commandline cmd) { | ||||
@@ -333,10 +350,10 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
try { | try { | ||||
/* | /* | ||||
* Many system have been reported to get into trouble with | |||||
* Many system have been reported to get into trouble with | |||||
* long command lines - no, not only Windows ;-). | * long command lines - no, not only Windows ;-). | ||||
* | * | ||||
* POSIX seems to define a lower limit of 4k, so use a temporary | |||||
* POSIX seems to define a lower limit of 4k, so use a temporary | |||||
* file if the total length of the command line exceeds this limit. | * file if the total length of the command line exceeds this limit. | ||||
*/ | */ | ||||
if (Commandline.toString(args).length() > 4096) { | if (Commandline.toString(args).length() > 4096) { | ||||
@@ -361,9 +378,9 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
} else { | } else { | ||||
commandArray = args; | commandArray = args; | ||||
} | } | ||||
try { | try { | ||||
Execute exe = new Execute(new LogStreamHandler(attributes, | |||||
Execute exe = new Execute(new LogStreamHandler(attributes, | |||||
Project.MSG_INFO, | Project.MSG_INFO, | ||||
Project.MSG_WARN)); | Project.MSG_WARN)); | ||||
exe.setAntRun(project); | exe.setAntRun(project); | ||||
@@ -372,7 +389,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
exe.execute(); | exe.execute(); | ||||
return exe.getExitValue(); | return exe.getExitValue(); | ||||
} catch (IOException e) { | } catch (IOException e) { | ||||
throw new BuildException("Error running " + args[0] | |||||
throw new BuildException("Error running " + args[0] | |||||
+ " compiler", e, location); | + " compiler", e, location); | ||||
} | } | ||||
} finally { | } finally { | ||||
@@ -215,10 +215,10 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||||
*/ | */ | ||||
protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) { | protected void addVendorFiles(Hashtable ejbFiles, String ddPrefix) { | ||||
File borlandDD = new File(getConfig().descriptorDir,BAS_DD); | |||||
File borlandDD = new File(getConfig().descriptorDir,ddPrefix + BAS_DD); | |||||
if (borlandDD.exists()) { | if (borlandDD.exists()) { | ||||
log("Borland specific file found "+ borlandDD, Project.MSG_VERBOSE); | log("Borland specific file found "+ borlandDD, Project.MSG_VERBOSE); | ||||
ejbFiles.put(META_DIR + BAS_DD, ddPrefix + borlandDD); | |||||
ejbFiles.put(META_DIR + BAS_DD, borlandDD); | |||||
} | } | ||||
else { | else { | ||||
log("Unable to locate borland deployment descriptor. It was expected to be in " + | log("Unable to locate borland deployment descriptor. It was expected to be in " + | ||||
@@ -183,34 +183,34 @@ public class WLRun extends Task { | |||||
" is not valid"); | " is not valid"); | ||||
} | } | ||||
File securityPolicyFile = null; | |||||
if (securityPolicy == null) { | |||||
securityPolicyFile = new File(weblogicSystemHome, DEFAULT_WL60_POLICY_FILE); | |||||
if (beaHome != null) { | |||||
executeWLS6(); | |||||
} else { | |||||
executeWLS(); | |||||
} | } | ||||
else { | |||||
securityPolicyFile = new File(weblogicSystemHome, securityPolicy); | |||||
} | |||||
private File findSecurityPolicyFile(String defaultSecurityPolicy) { | |||||
String securityPolicy = this.securityPolicy; | |||||
if (securityPolicy == null) { | |||||
securityPolicy = defaultSecurityPolicy; | |||||
} | } | ||||
if (!securityPolicyFile.exists()) { | |||||
// OK it maybe an absolute path. Use the project to resolve it | |||||
File securityPolicyFile = new File( weblogicSystemHome, securityPolicy ); | |||||
// If an explicit securityPolicy file was specified, it maybe an | |||||
// absolute path. Use the project to resolve it. | |||||
if (this.securityPolicy != null && !securityPolicyFile.exists()) { | |||||
securityPolicyFile = project.resolveFile(securityPolicy); | securityPolicyFile = project.resolveFile(securityPolicy); | ||||
if (!securityPolicyFile.exists()) { | |||||
throw new BuildException("Security policy " + securityPolicy + | |||||
" was not found."); | |||||
} | |||||
} | } | ||||
if (beaHome != null) { | |||||
executeWLS6(securityPolicyFile); | |||||
} | |||||
else { | |||||
executeWLS(securityPolicyFile); | |||||
// If we still can't find it, complain | |||||
if (!securityPolicyFile.exists()) { | |||||
throw new BuildException("Security policy " + securityPolicy + | |||||
" was not found."); | |||||
} | } | ||||
return securityPolicyFile; | |||||
} | } | ||||
private void executeWLS6(File securityPolicyFile) { | |||||
private void executeWLS6() { | |||||
File securityPolicyFile = findSecurityPolicyFile( DEFAULT_WL60_POLICY_FILE ); | |||||
if (!beaHome.isDirectory()) { | if (!beaHome.isDirectory()) { | ||||
throw new BuildException("BEA home " + beaHome.getPath() + | throw new BuildException("BEA home " + beaHome.getPath() + | ||||
" is not valid"); | " is not valid"); | ||||
@@ -259,8 +259,8 @@ public class WLRun extends Task { | |||||
} | } | ||||
} | } | ||||
private void executeWLS(File securityPolicyFile) { | |||||
private void executeWLS() { | |||||
File securityPolicyFile = findSecurityPolicyFile( DEFAULT_WL51_POLICY_FILE ); | |||||
File propertiesFile = null; | File propertiesFile = null; | ||||
@@ -586,7 +586,9 @@ public class FTP | |||||
FTPFile[] files = ftp.listFiles(remoteFile); | FTPFile[] files = ftp.listFiles(remoteFile); | ||||
if (files == null) | |||||
// For Microsoft's Ftp-Service an Array with length 0 is | |||||
// returned if configured to return listings in "MS-DOS"-Format | |||||
if (files == null || files.length == 0) | |||||
{ | { | ||||
// If we are sending files, then assume out of date. | // If we are sending files, then assume out of date. | ||||
// If we are getting files, then throw an error | // If we are getting files, then throw an error | ||||
@@ -78,9 +78,9 @@ public class WLRmic extends DefaultRmicAdapter { | |||||
try { | try { | ||||
// Create an instance of the rmic | // Create an instance of the rmic | ||||
Class c = Class.forName("weblogic.rmic"); | Class c = Class.forName("weblogic.rmic"); | ||||
Method doRmic = c.getMethod("main", | |||||
Method doRmic = c.getMethod("main", | |||||
new Class [] { String[].class }); | new Class [] { String[].class }); | ||||
doRmic.invoke(null, new Object[] { }); | |||||
doRmic.invoke(null, new Object[] {cmd.getArguments() }); | |||||
return true; | return true; | ||||
} catch (ClassNotFoundException ex) { | } catch (ClassNotFoundException ex) { | ||||
throw new BuildException("Cannot use WebLogic rmic, as it is not available"+ | throw new BuildException("Cannot use WebLogic rmic, as it is not available"+ | ||||
@@ -221,7 +221,7 @@ public class CommandlineJava implements Cloneable { | |||||
* @return the list of all arguments necessary to run the vm. | * @return the list of all arguments necessary to run the vm. | ||||
*/ | */ | ||||
public String[] getCommandline() { | public String[] getCommandline() { | ||||
String[] result = new String[size()]; | |||||
String[] result = new String[size()]; | |||||
int pos = 0; | int pos = 0; | ||||
String[] vmArgs = getActualVMCommand().getCommandline(); | String[] vmArgs = getActualVMCommand().getCommandline(); | ||||
// first argument is the java.exe path... | // first argument is the java.exe path... | ||||
@@ -285,7 +285,8 @@ public class CommandlineJava implements Cloneable { | |||||
public int size() { | public int size() { | ||||
int size = getActualVMCommand().size() + javaCommand.size() + sysProperties.size(); | int size = getActualVMCommand().size() + javaCommand.size() + sysProperties.size(); | ||||
// classpath is "-classpath <classpath>" -> 2 args | // classpath is "-classpath <classpath>" -> 2 args | ||||
if (classpath != null && classpath.size() > 0) { | |||||
Path fullClasspath = classpath != null ? classpath.concatSystemClasspath("ignore") : null; | |||||
if (fullClasspath != null && fullClasspath.toString().trim().length() > 0) { | |||||
size += 2; | size += 2; | ||||
} | } | ||||
// jar execution requires an additional -jar option | // jar execution requires an additional -jar option | ||||
@@ -70,17 +70,16 @@ import org.apache.tools.ant.Project; | |||||
* @version $Revision$ $Date$ | * @version $Revision$ $Date$ | ||||
*/ | */ | ||||
public class Description extends DataType { | public class Description extends DataType { | ||||
private Project project; | |||||
public Description(Project project) { | |||||
this.project = project; | |||||
} | |||||
/** | /** | ||||
* Adds descriptive text to the project. | * Adds descriptive text to the project. | ||||
*/ | */ | ||||
public void addText(String text) { | |||||
project.setDescription(text); | |||||
} | |||||
public void addText(String text) { | |||||
String currentDescription = project.getDescription(); | |||||
if (currentDescription == null) { | |||||
project.setDescription(text); | |||||
} else { | |||||
project.setDescription(currentDescription + text); | |||||
} | |||||
} | |||||
} | } |
@@ -66,6 +66,7 @@ public abstract class TaskdefsTest extends TestCase { | |||||
protected Project project; | protected Project project; | ||||
private StringBuffer logBuffer; | private StringBuffer logBuffer; | ||||
private StringBuffer fullLogBuffer; | |||||
private StringBuffer outBuffer; | private StringBuffer outBuffer; | ||||
private StringBuffer errBuffer; | private StringBuffer errBuffer; | ||||
private BuildException buildException; | private BuildException buildException; | ||||
@@ -78,6 +79,12 @@ public abstract class TaskdefsTest extends TestCase { | |||||
return logBuffer.toString(); | return logBuffer.toString(); | ||||
} | } | ||||
protected String getFullLog() { | |||||
return fullLogBuffer.toString(); | |||||
} | |||||
protected void expectBuildException(String taskname, String cause) { | protected void expectBuildException(String taskname, String cause) { | ||||
expectSpecificBuildException(taskname, cause, null); | expectSpecificBuildException(taskname, cause, null); | ||||
} | } | ||||
@@ -136,6 +143,7 @@ public abstract class TaskdefsTest extends TestCase { | |||||
protected void configureProject(String filename) { | protected void configureProject(String filename) { | ||||
logBuffer = new StringBuffer(); | logBuffer = new StringBuffer(); | ||||
fullLogBuffer = new StringBuffer(); | |||||
project = new Project(); | project = new Project(); | ||||
project.init(); | project.init(); | ||||
project.setUserProperty( "ant.file" , new File(filename).getAbsolutePath() ); | project.setUserProperty( "ant.file" , new File(filename).getAbsolutePath() ); | ||||
@@ -156,6 +164,7 @@ public abstract class TaskdefsTest extends TestCase { | |||||
PrintStream err = new PrintStream(new AntOutputStream()); | PrintStream err = new PrintStream(new AntOutputStream()); | ||||
System.setErr(err); | System.setErr(err); | ||||
logBuffer = new StringBuffer(); | logBuffer = new StringBuffer(); | ||||
fullLogBuffer = new StringBuffer(); | |||||
buildException = null; | buildException = null; | ||||
project.executeTarget(targetName); | project.executeTarget(targetName); | ||||
} finally { | } finally { | ||||
@@ -253,6 +262,8 @@ public abstract class TaskdefsTest extends TestCase { | |||||
{ | { | ||||
logBuffer.append(event.getMessage()); | logBuffer.append(event.getMessage()); | ||||
} | } | ||||
fullLogBuffer.append(event.getMessage()); | |||||
} | } | ||||
} | } | ||||
@@ -62,6 +62,7 @@ import org.w3c.dom.Document; | |||||
import javax.xml.parsers.DocumentBuilder; | import javax.xml.parsers.DocumentBuilder; | ||||
import javax.xml.parsers.DocumentBuilderFactory; | import javax.xml.parsers.DocumentBuilderFactory; | ||||
import java.io.File; | import java.io.File; | ||||
import java.io.FileNotFoundException; | |||||
import java.net.URL; | import java.net.URL; | ||||
/** | /** | ||||
@@ -85,8 +86,12 @@ public abstract class AbstractXSLTLiaisonTest extends TestCase { | |||||
// to override | // to override | ||||
protected abstract XSLTLiaison createLiaison() throws Exception ; | protected abstract XSLTLiaison createLiaison() throws Exception ; | ||||
protected File getFile(String name){ | |||||
/** load the file from the caller classloader that loaded this class */ | |||||
protected File getFile(String name) throws FileNotFoundException { | |||||
URL url = getClass().getResource(name); | URL url = getClass().getResource(name); | ||||
if (url == null){ | |||||
throw new FileNotFoundException("Unable to load '" + name + "' from classpath"); | |||||
} | |||||
return new File(url.getFile()); | return new File(url.getFile()); | ||||
} | } | ||||
@@ -0,0 +1,102 @@ | |||||
/* | |||||
* The Apache Software License, Version 1.1 | |||||
* | |||||
* Copyright (c) 2001 The Apache Software Foundation. All rights | |||||
* reserved. | |||||
* | |||||
* Redistribution and use in source and binary forms, with or without | |||||
* modification, are permitted provided that the following conditions | |||||
* are met: | |||||
* | |||||
* 1. Redistributions of source code must retain the above copyright | |||||
* notice, this list of conditions and the following disclaimer. | |||||
* | |||||
* 2. Redistributions in binary form must reproduce the above copyright | |||||
* notice, this list of conditions and the following disclaimer in | |||||
* the documentation and/or other materials provided with the | |||||
* distribution. | |||||
* | |||||
* 3. The end-user documentation included with the redistribution, if | |||||
* any, must include the following acknowlegement: | |||||
* "This product includes software developed by the | |||||
* Apache Software Foundation (http://www.apache.org/)." | |||||
* Alternately, this acknowlegement may appear in the software itself, | |||||
* if and wherever such third-party acknowlegements normally appear. | |||||
* | |||||
* 4. The names "The Jakarta Project", "Ant", and "Apache Software | |||||
* Foundation" must not be used to endorse or promote products derived | |||||
* from this software without prior written permission. For written | |||||
* permission, please contact apache@apache.org. | |||||
* | |||||
* 5. Products derived from this software may not be called "Apache" | |||||
* nor may "Apache" appear in their names without prior written | |||||
* permission of the Apache Group. | |||||
* | |||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED | |||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |||||
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR | |||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |||||
* SUCH DAMAGE. | |||||
* ==================================================================== | |||||
* | |||||
* This software consists of voluntary contributions made by many | |||||
* individuals on behalf of the Apache Software Foundation. For more | |||||
* information on the Apache Software Foundation, please see | |||||
* <http://www.apache.org/>. | |||||
*/ | |||||
package org.apache.tools.ant.types; | |||||
import org.apache.tools.ant.BuildException; | |||||
import org.apache.tools.ant.Project; | |||||
import org.apache.tools.ant.taskdefs.TaskdefsTest; | |||||
import junit.framework.TestCase; | |||||
import junit.framework.AssertionFailedError; | |||||
import java.io.*; | |||||
/** | |||||
* FilterSet testing | |||||
* | |||||
* @author <a href="mailto:conor@apache.org">Conor MacNeill</a> | |||||
*/ | |||||
public class DescriptionTest extends TaskdefsTest { | |||||
public DescriptionTest(String name) { | |||||
super(name); | |||||
} | |||||
public void setUp() { | |||||
} | |||||
public void tearDown() { | |||||
} | |||||
public void test1() { | |||||
configureProject("src/etc/testcases/types/description1.xml"); | |||||
assertEquals("Single description failed", "Test Project Description", project.getDescription()); | |||||
} | |||||
public void test2() { | |||||
configureProject("src/etc/testcases/types/description2.xml"); | |||||
assertEquals("Multi line description failed", "Multi Line\nProject Description", project.getDescription()); | |||||
} | |||||
public void test3() { | |||||
configureProject("src/etc/testcases/types/description3.xml"); | |||||
assertEquals("Multi instance description failed", "Multi Instance Project Description", project.getDescription()); | |||||
} | |||||
public void test4() { | |||||
configureProject("src/etc/testcases/types/description4.xml"); | |||||
assertEquals("Multi instance nested description failed", "Multi Instance Nested Project Description", project.getDescription()); | |||||
} | |||||
} |
@@ -72,8 +72,6 @@ public class FilterSetTest extends TaskdefsTest { | |||||
static private final int BUF_SIZE = 32768; | static private final int BUF_SIZE = 32768; | ||||
private Project project; | |||||
public FilterSetTest(String name) { | public FilterSetTest(String name) { | ||||
super(name); | super(name); | ||||
} | } | ||||
@@ -82,6 +80,10 @@ public class FilterSetTest extends TaskdefsTest { | |||||
configureProject("src/etc/testcases/types/filterset.xml"); | configureProject("src/etc/testcases/types/filterset.xml"); | ||||
} | } | ||||
public void tearDown() { | |||||
executeTarget("cleanup"); | |||||
} | |||||
public void test1() { | public void test1() { | ||||
executeTarget("test1"); | executeTarget("test1"); | ||||
assertTrue("Filterset 1 failed", compareFiles("src/etc/testcases/types/gold/filterset1.txt", | assertTrue("Filterset 1 failed", compareFiles("src/etc/testcases/types/gold/filterset1.txt", | ||||