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 | |||
| 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 | |||
| implemented by custom formatters. | |||
| @@ -93,6 +93,16 @@ Changes that could break older environments: | |||
| </delete> | |||
| will now remove "somedir" as well, unless there are still files left | |||
| 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: | |||
| -------------- | |||
| @@ -161,6 +161,7 @@ | |||
| <available property="xalan.envcheck" | |||
| classname="org.apache.xalan.xslt.EnvironmentCheck" | |||
| classpathref="classpath" /> | |||
| <condition property="javamail.complete"> | |||
| <and> | |||
| <available classname="javax.activation.DataHandler" | |||
| @@ -180,6 +181,11 @@ | |||
| <tstamp> | |||
| <format property="year" pattern="yyyy" /> | |||
| </tstamp> | |||
| <filterset id="ant.filters"> | |||
| <filter token="VERSION" value="${version}" /> | |||
| <filter token="DATE" value="${TODAY}" /> | |||
| <filter token="TIME" value="${TSTAMP}" /> | |||
| </filterset> | |||
| </target> | |||
| <!-- | |||
| @@ -256,12 +262,7 @@ | |||
| <include name="**/version.txt" /> | |||
| <include name="**/defaultManifest.mf" /> | |||
| </fileset> | |||
| <filterset> | |||
| <filter token="VERSION" value="${version}" /> | |||
| <filter token="DATE" value="${TODAY}" /> | |||
| <filter token="TIME" value="${TSTAMP}" /> | |||
| </filterset> | |||
| <filterset refid="ant.filters"/> | |||
| </copy> | |||
| <copy todir="${build.classes}/${optional.package}/junit/xsl"> | |||
| @@ -369,9 +370,9 @@ | |||
| <copy todir="${dist.lib}" file="${lib.dir}/optional/README"/> | |||
| <copy todir="${dist.docs}" | |||
| filtering="on"> | |||
| <copy todir="${dist.docs}"> | |||
| <fileset dir="${docs.dir}"/> | |||
| <filterset refid="ant.filters"/> | |||
| </copy> | |||
| <copy todir="${dist.dir}"> | |||
| @@ -655,10 +656,10 @@ | |||
| <echo message="file.encoding=${file.encoding}" /> | |||
| <echo message="user.language=${user.language}" /> | |||
| </target> | |||
| <!-- 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"> | |||
| <java classname="org.apache.xalan.xslt.EnvironmentCheck"/> | |||
| <java classname="org.apache.xalan.xslt.EnvironmentCheck"/> | |||
| </target> | |||
| <!-- | |||
| @@ -118,54 +118,55 @@ | |||
| </html> | |||
| </xsl:template> | |||
| <!-- this is the stylesheet css to use for nearly everything --> | |||
| <xsl:template name="stylesheet.css"> | |||
| body { | |||
| font:normal 68% verdana,arial,helvetica; | |||
| 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 { | |||
| line-height:1.5em; | |||
| margin-top:0.5em; margin-bottom:1.0em; | |||
| } | |||
| h1 { | |||
| margin: 0px 0px 5px; | |||
| font: 165% verdana,arial,helvetica | |||
| margin: 0px 0px 5px; font: 165% verdana,arial,helvetica | |||
| } | |||
| 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 { | |||
| margin-bottom: 0.5em; | |||
| font: bold 115% verdana,arial,helvetica | |||
| margin-bottom: 0.5em; font: bold 115% verdana,arial,helvetica | |||
| } | |||
| h4 { | |||
| margin-bottom: 0.5em; | |||
| font: bold 100% verdana,arial,helvetica | |||
| margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica | |||
| } | |||
| h5 { | |||
| margin-bottom: 0.5em; | |||
| font: bold 100% verdana,arial,helvetica | |||
| margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica | |||
| } | |||
| h6 { | |||
| margin-bottom: 0.5em; | |||
| font: bold 100% verdana,arial,helvetica | |||
| margin-bottom: 0.5em; font: bold 100% verdana,arial,helvetica | |||
| } | |||
| .Error { | |||
| font-weight:bold; | |||
| color:red; | |||
| font-weight:bold; color:red; | |||
| } | |||
| .Failure { | |||
| font-weight:bold; | |||
| color:purple; | |||
| font-weight:bold; color:purple; | |||
| } | |||
| .Properties { | |||
| text-align:right; | |||
| } | |||
| </xsl:template> | |||
| @@ -181,29 +182,87 @@ h6 { | |||
| <xsl:call-template name="create.stylesheet.link"> | |||
| <xsl:with-param name="package.name" select="$package.name"/> | |||
| </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> | |||
| <body> | |||
| <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> | |||
| <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:apply-templates select="." mode="print.test"/> | |||
| </table> | |||
| <h2>Tests</h2> | |||
| <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"/> | |||
| </table> | |||
| </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> | |||
| </html> | |||
| </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. | |||
| @@ -340,15 +399,15 @@ h6 { | |||
| <xsl:variable name="failureCount" select="sum(testsuite/@failures)"/> | |||
| <xsl:variable name="timeCount" select="sum(testsuite/@time)"/> | |||
| <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 bgcolor="#EEEEE" valign="top"> | |||
| <tr valign="top"> | |||
| <xsl:attribute name="class"> | |||
| <xsl:choose> | |||
| <xsl:when test="$errorCount > 0">Error</xsl:when> | |||
| @@ -381,13 +440,13 @@ h6 { | |||
| </table> | |||
| <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:for-each select="testsuite[not(./@package = preceding-sibling::testsuite/@package)]"> | |||
| <xsl:sort select="@package" order="ascending"/> | |||
| <!-- get the node set containing all testsuites that have the same 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 --> | |||
| <xsl:attribute name="class"> | |||
| <xsl:choose> | |||
| @@ -435,7 +494,7 @@ h6 { | |||
| <xsl:if test="count($insamepackage) > 0"> | |||
| <h2>Classes</h2> | |||
| <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:apply-templates select="$insamepackage" mode="print.test"> | |||
| <xsl:sort select="@name"/> | |||
| @@ -487,29 +546,29 @@ h6 { | |||
| <!-- class 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> | |||
| </xsl:template> | |||
| <!-- method 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> | |||
| </xsl:template> | |||
| <!-- class information --> | |||
| <xsl:template match="testsuite" mode="print.test"> | |||
| <tr bgcolor="#EEEEE" valign="top"> | |||
| <tr valign="top"> | |||
| <xsl:attribute name="class"> | |||
| <xsl:choose> | |||
| <xsl:when test="@errors[.> 0]">Error</xsl:when> | |||
| @@ -529,7 +588,7 @@ h6 { | |||
| </xsl:template> | |||
| <xsl:template match="testcase" mode="print.test"> | |||
| <tr bgcolor="#EEEEE" valign="top"> | |||
| <tr valign="top"> | |||
| <xsl:attribute name="class"> | |||
| <xsl:choose> | |||
| <xsl:when test="error">Error</xsl:when> | |||
| @@ -590,6 +649,28 @@ h6 { | |||
| <!--pre><xsl:value-of select="."/></pre--> | |||
| </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 | |||
| @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"> | |||
| <!-- ====================================================================== | |||
| 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:decimal-format decimal-separator="." grouping-separator="," /> | |||
| <xsl:template match="testsuites"> | |||
| <HTML> | |||
| <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> | |||
| <body> | |||
| <a name="#top"></a> | |||
| @@ -163,14 +190,25 @@ | |||
| <h3>TestCase <xsl:value-of select="@name"/></h3> | |||
| <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> | |||
| <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/> | |||
| <xsl:apply-templates select="properties"/> | |||
| <a href="#top">Back to top</a> | |||
| </xsl:for-each> | |||
| @@ -223,28 +261,17 @@ | |||
| </table> | |||
| </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 --> | |||
| <xsl:template name="pageHeader"> | |||
| @@ -345,8 +372,6 @@ | |||
| </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:call-template name="display-failures"/> | |||
| </xsl:template> | |||
| @@ -374,6 +399,28 @@ | |||
| <!--pre><xsl:value-of select="."/></pre--> | |||
| </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 | |||
| @param word the text from which to convert CR to BR tag | |||
| @@ -2,7 +2,7 @@ | |||
| <project name="antlr-test" basedir="." default="test1"> | |||
| <property name="tmp.dir" value="antlr.tmp"/> | |||
| <property name="tmp.dir" location="antlr.tmp"/> | |||
| <target name="test1"> | |||
| @@ -18,6 +18,7 @@ | |||
| </target> | |||
| <target name="test3"> | |||
| <deltree dir="${tmp.dir}"/> | |||
| <mkdir dir="${tmp.dir}"/> | |||
| <antlr target="antlr.g" outputdirectory="${tmp.dir}"/> | |||
| </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"/> | |||
| </target> | |||
| <target name="cleanup"> | |||
| <delete file="dest1.txt" quiet="true" /> | |||
| <delete file="dest2.txt" quiet="true" /> | |||
| <delete file="dest3.txt" quiet="true" /> | |||
| </target> | |||
| </project> | |||
| @@ -866,6 +866,9 @@ public class AntClassLoader extends ClassLoader implements BuildListener { | |||
| if (t instanceof ClassFormatError) { | |||
| throw (ClassFormatError)t; | |||
| } | |||
| else if (t instanceof NoClassDefFoundError) { | |||
| throw (NoClassDefFoundError)t; | |||
| } | |||
| else { | |||
| throw new IOException(t.toString()); | |||
| } | |||
| @@ -914,6 +917,7 @@ public class AntClassLoader extends ClassLoader implements BuildListener { | |||
| } | |||
| } | |||
| catch (IOException ioe) { | |||
| // ioe.printStackTrace(); | |||
| log("Exception reading component " + pathComponent , Project.MSG_VERBOSE); | |||
| } | |||
| } | |||
| @@ -143,7 +143,12 @@ public class DefaultLogger implements BuildLogger { | |||
| error.printStackTrace(err); | |||
| } | |||
| 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); | |||
| Text messageText = doc.createTextNode(event.getMessage()); | |||
| Text messageText = doc.createCDATASection(event.getMessage()); | |||
| messageElement.appendChild(messageText); | |||
| TimedElement parentElement = null; | |||
| @@ -330,7 +330,14 @@ public class ExecuteOn extends ExecTask { | |||
| } | |||
| } else { // no targetFilePos | |||
| // 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 | |||
| @@ -87,17 +87,17 @@ import java.io.File; | |||
| * <p> | |||
| * When this task executes, it will recursively scan the sourcedir and | |||
| * 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 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> | |||
| */ | |||
| public class Javac extends MatchingTask { | |||
| private static final String FAIL_MSG | |||
| private static final String FAIL_MSG | |||
| = "Compile failed, messages should have been provided."; | |||
| private Path src; | |||
| @@ -116,6 +116,8 @@ public class Javac extends MatchingTask { | |||
| private boolean includeJavaRuntime = false; | |||
| private boolean fork = false; | |||
| private boolean nowarn = false; | |||
| private String memoryInitialSize; | |||
| private String memoryMaximumSize; | |||
| protected boolean failOnError = true; | |||
| protected File[] compileList = new File[0]; | |||
| @@ -157,7 +159,7 @@ public class Javac extends MatchingTask { | |||
| this.destDir = destDir; | |||
| } | |||
| /** | |||
| /** | |||
| * Gets the destination directory into which the java source files | |||
| * should be compiled. | |||
| */ | |||
| @@ -298,6 +300,30 @@ public class Javac extends MatchingTask { | |||
| 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. | |||
| */ | |||
| @@ -334,21 +360,21 @@ public class Javac extends MatchingTask { | |||
| return optimize; | |||
| } | |||
| /** | |||
| /** | |||
| * Set the depend flag. | |||
| */ | |||
| */ | |||
| public void setDepend(boolean depend) { | |||
| this.depend = depend; | |||
| } | |||
| } | |||
| /** Gets the depend flag. */ | |||
| public boolean getDepend() { | |||
| return depend; | |||
| } | |||
| /** | |||
| /** | |||
| * Set the verbose flag. | |||
| */ | |||
| */ | |||
| public void setVerbose(boolean verbose) { | |||
| this.verbose = verbose; | |||
| } | |||
| @@ -404,12 +430,12 @@ public class Javac extends MatchingTask { | |||
| /** | |||
| * 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. | |||
| @@ -438,12 +464,12 @@ public class Javac extends MatchingTask { | |||
| if (list.length == 0) { | |||
| throw new BuildException("srcdir attribute must be set!", location); | |||
| } | |||
| if (destDir != null && !destDir.isDirectory()) { | |||
| 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 | |||
| resetFileLists(); | |||
| for (int i=0; i<list.length; i++) { | |||
| @@ -458,13 +484,13 @@ public class Javac extends MatchingTask { | |||
| scanDir(srcDir, destDir != null ? destDir : srcDir, files); | |||
| } | |||
| // compile the source files | |||
| String compiler = project.getProperty("build.compiler"); | |||
| if (fork) { | |||
| if (compiler != null) { | |||
| if (fork) { | |||
| if (compiler != null) { | |||
| if (isJdkCompiler(compiler)) { | |||
| log("Since fork is true, ignoring build.compiler setting.", | |||
| Project.MSG_WARN); | |||
| @@ -473,13 +499,13 @@ public class Javac extends MatchingTask { | |||
| else { | |||
| log("Since build.compiler setting isn't classic or modern, ignoring fork setting.", Project.MSG_WARN); | |||
| } | |||
| } | |||
| } | |||
| else { | |||
| compiler = "extJavac"; | |||
| } | |||
| } | |||
| } | |||
| if (compiler == null) { | |||
| if (compiler == null) { | |||
| if (Project.getJavaVersion() != Project.JAVA_1_1 && | |||
| Project.getJavaVersion() != Project.JAVA_1_2) { | |||
| compiler = "modern"; | |||
| @@ -492,14 +518,14 @@ public class Javac extends MatchingTask { | |||
| CompilerAdapter adapter = CompilerAdapterFactory.getCompiler( | |||
| compiler, this ); | |||
| log("Compiling " + compileList.length + | |||
| log("Compiling " + compileList.length + | |||
| " source file" | |||
| + (compileList.length == 1 ? "" : "s") | |||
| + (destDir != null ? " to " + destDir : "")); | |||
| // now we need to populate the compiler adapter | |||
| adapter.setJavac( this ); | |||
| // finally, lets execute the compiler!! | |||
| if (!adapter.execute()) { | |||
| 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() { | |||
| 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 | |||
| */ | |||
| protected void scanDir(File srcDir, File destDir, String files[]) { | |||
| @@ -529,7 +555,7 @@ public class Javac extends MatchingTask { | |||
| m.setTo("*.class"); | |||
| SourceFileScanner sfs = new SourceFileScanner(this); | |||
| File[] newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m); | |||
| if (newFiles.length > 0) { | |||
| File[] newCompileList = new File[compileList.length + | |||
| newFiles.length]; | |||
| @@ -679,14 +679,13 @@ public class Javadoc extends Task { | |||
| } | |||
| public String getPackages() { | |||
| StringBuffer p = new StringBuffer( "\"" ); | |||
| StringBuffer p = new StringBuffer(); | |||
| for (int i = 0; i < packages.size(); i++) { | |||
| if ( i > 0 ) { | |||
| p.append( ":" ); | |||
| } | |||
| p.append( packages.elementAt(i).toString() ); | |||
| } | |||
| p.append( "\"" ); | |||
| return p.toString(); | |||
| } | |||
| } | |||
| @@ -450,11 +450,6 @@ public class Manifest { | |||
| */ | |||
| public Manifest(InputStream is) throws ManifestException, IOException { | |||
| BufferedReader reader = new BufferedReader(new InputStreamReader(is)); | |||
| String line = reader.readLine(); | |||
| if (line == null) { | |||
| return; | |||
| } | |||
| // This should be the manifest version | |||
| String nextSectionName = mainSection.read(reader); | |||
| String readManifestVersion = mainSection.getAttributeValue(ATTRIBUTE_MANIFEST_VERSION); | |||
| @@ -463,6 +458,7 @@ public class Manifest { | |||
| mainSection.removeAttribute(ATTRIBUTE_MANIFEST_VERSION); | |||
| } | |||
| String line = null; | |||
| while ((line = reader.readLine()) != null) { | |||
| if (line.length() == 0) { | |||
| continue; | |||
| @@ -160,6 +160,18 @@ public class Property extends Task { | |||
| } | |||
| 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)) { | |||
| 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:russgold@acm.org">Russell Gold</a> | |||
| * @author <a href="stefan.bodewig@epost.de">Stefan Bodewig</a> | |||
| * @version $Revision$ $Date$ | |||
| */ | |||
| public class XSLTProcess extends MatchingTask { | |||
| @@ -268,6 +267,7 @@ public class XSLTProcess extends MatchingTask { | |||
| loadClass("org.apache.tools.ant.taskdefs.optional.TraXLiaison"); | |||
| liaison = (XSLTLiaison)clazz.newInstance(); | |||
| } else if (proc.equals("xslp")) { | |||
| log("DEPRECATED - xslp processor is deprecated. Use trax or xalan instead."); | |||
| final Class clazz = | |||
| loadClass("org.apache.tools.ant.taskdefs.optional.XslpLiaison"); | |||
| 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 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> | |||
| */ | |||
| public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| @@ -92,6 +92,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| protected Location location; | |||
| protected boolean includeAntRuntime; | |||
| protected boolean includeJavaRuntime; | |||
| protected String memoryInitialSize; | |||
| protected String memoryMaximumSize; | |||
| protected File[] compileList; | |||
| protected static String lSep = System.getProperty("line.separator"); | |||
| @@ -116,6 +118,8 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| location = attributes.getLocation(); | |||
| includeAntRuntime = attributes.getIncludeantruntime(); | |||
| includeJavaRuntime = attributes.getIncludejavaruntime(); | |||
| memoryInitialSize = attributes.getMemoryInitialSize(); | |||
| memoryMaximumSize = attributes.getMemoryMaximumSize(); | |||
| } | |||
| public Javac getJavac() { | |||
| @@ -136,7 +140,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| 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 | |||
| if (compileClasspath == null) { | |||
| @@ -166,7 +170,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| classpath.addExisting(new Path(null, | |||
| System.getProperty("java.home") | |||
| + File.separator + "lib" | |||
| + File.separator | |||
| + File.separator | |||
| + "classes.zip")); | |||
| } else { | |||
| // 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")); | |||
| } | |||
| } | |||
| return classpath; | |||
| } | |||
| @@ -206,10 +210,23 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| protected Commandline setupJavacCommandlineSwitches(Commandline cmd) { | |||
| 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()) { | |||
| cmd.createArgument().setValue("-nowarn"); | |||
| } | |||
| if (deprecation == true) { | |||
| cmd.createArgument().setValue("-deprecation"); | |||
| } | |||
| @@ -218,7 +235,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| cmd.createArgument().setValue("-d"); | |||
| cmd.createArgument().setFile(destDir); | |||
| } | |||
| cmd.createArgument().setValue("-classpath"); | |||
| // 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" | |||
| */ | |||
| protected void logAndAddFilesToCompile(Commandline cmd) { | |||
| @@ -333,10 +350,10 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| 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 ;-). | |||
| * | |||
| * 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. | |||
| */ | |||
| if (Commandline.toString(args).length() > 4096) { | |||
| @@ -361,9 +378,9 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| } else { | |||
| commandArray = args; | |||
| } | |||
| try { | |||
| Execute exe = new Execute(new LogStreamHandler(attributes, | |||
| Execute exe = new Execute(new LogStreamHandler(attributes, | |||
| Project.MSG_INFO, | |||
| Project.MSG_WARN)); | |||
| exe.setAntRun(project); | |||
| @@ -372,7 +389,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||
| exe.execute(); | |||
| return exe.getExitValue(); | |||
| } catch (IOException e) { | |||
| throw new BuildException("Error running " + args[0] | |||
| throw new BuildException("Error running " + args[0] | |||
| + " compiler", e, location); | |||
| } | |||
| } finally { | |||
| @@ -215,10 +215,10 @@ public class BorlandDeploymentTool extends GenericDeploymentTool implements Exe | |||
| */ | |||
| 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()) { | |||
| 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 { | |||
| 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"); | |||
| } | |||
| 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); | |||
| 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()) { | |||
| throw new BuildException("BEA home " + beaHome.getPath() + | |||
| " 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; | |||
| @@ -586,7 +586,9 @@ public class FTP | |||
| 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 getting files, then throw an error | |||
| @@ -78,9 +78,9 @@ public class WLRmic extends DefaultRmicAdapter { | |||
| try { | |||
| // Create an instance of the rmic | |||
| Class c = Class.forName("weblogic.rmic"); | |||
| Method doRmic = c.getMethod("main", | |||
| Method doRmic = c.getMethod("main", | |||
| new Class [] { String[].class }); | |||
| doRmic.invoke(null, new Object[] { }); | |||
| doRmic.invoke(null, new Object[] {cmd.getArguments() }); | |||
| return true; | |||
| } catch (ClassNotFoundException ex) { | |||
| 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. | |||
| */ | |||
| public String[] getCommandline() { | |||
| String[] result = new String[size()]; | |||
| String[] result = new String[size()]; | |||
| int pos = 0; | |||
| String[] vmArgs = getActualVMCommand().getCommandline(); | |||
| // first argument is the java.exe path... | |||
| @@ -285,7 +285,8 @@ public class CommandlineJava implements Cloneable { | |||
| public int size() { | |||
| int size = getActualVMCommand().size() + javaCommand.size() + sysProperties.size(); | |||
| // 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; | |||
| } | |||
| // jar execution requires an additional -jar option | |||
| @@ -70,17 +70,16 @@ import org.apache.tools.ant.Project; | |||
| * @version $Revision$ $Date$ | |||
| */ | |||
| public class Description extends DataType { | |||
| private Project project; | |||
| public Description(Project project) { | |||
| this.project = 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; | |||
| private StringBuffer logBuffer; | |||
| private StringBuffer fullLogBuffer; | |||
| private StringBuffer outBuffer; | |||
| private StringBuffer errBuffer; | |||
| private BuildException buildException; | |||
| @@ -78,6 +79,12 @@ public abstract class TaskdefsTest extends TestCase { | |||
| return logBuffer.toString(); | |||
| } | |||
| protected String getFullLog() { | |||
| return fullLogBuffer.toString(); | |||
| } | |||
| protected void expectBuildException(String taskname, String cause) { | |||
| expectSpecificBuildException(taskname, cause, null); | |||
| } | |||
| @@ -136,6 +143,7 @@ public abstract class TaskdefsTest extends TestCase { | |||
| protected void configureProject(String filename) { | |||
| logBuffer = new StringBuffer(); | |||
| fullLogBuffer = new StringBuffer(); | |||
| project = new Project(); | |||
| project.init(); | |||
| project.setUserProperty( "ant.file" , new File(filename).getAbsolutePath() ); | |||
| @@ -156,6 +164,7 @@ public abstract class TaskdefsTest extends TestCase { | |||
| PrintStream err = new PrintStream(new AntOutputStream()); | |||
| System.setErr(err); | |||
| logBuffer = new StringBuffer(); | |||
| fullLogBuffer = new StringBuffer(); | |||
| buildException = null; | |||
| project.executeTarget(targetName); | |||
| } finally { | |||
| @@ -253,6 +262,8 @@ public abstract class TaskdefsTest extends TestCase { | |||
| { | |||
| 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.DocumentBuilderFactory; | |||
| import java.io.File; | |||
| import java.io.FileNotFoundException; | |||
| import java.net.URL; | |||
| /** | |||
| @@ -85,8 +86,12 @@ public abstract class AbstractXSLTLiaisonTest extends TestCase { | |||
| // to override | |||
| 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); | |||
| if (url == null){ | |||
| throw new FileNotFoundException("Unable to load '" + name + "' from classpath"); | |||
| } | |||
| 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; | |||
| private Project project; | |||
| public FilterSetTest(String name) { | |||
| super(name); | |||
| } | |||
| @@ -82,6 +80,10 @@ public class FilterSetTest extends TaskdefsTest { | |||
| configureProject("src/etc/testcases/types/filterset.xml"); | |||
| } | |||
| public void tearDown() { | |||
| executeTarget("cleanup"); | |||
| } | |||
| public void test1() { | |||
| executeTarget("test1"); | |||
| assertTrue("Filterset 1 failed", compareFiles("src/etc/testcases/types/gold/filterset1.txt", | |||