diff --git a/WHATSNEW b/WHATSNEW index 641200af0..66e14f10f 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -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 task has been move to a package of its own. +* The 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: 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: -------------- diff --git a/build.xml b/build.xml index 452224b55..d1307cc12 100644 --- a/build.xml +++ b/build.xml @@ -161,6 +161,7 @@ + + + + + + - + 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; } - @@ -181,29 +182,87 @@ h6 { + +

Class .

- +

Tests

- - +
+ + + + + +
-

+ + + + cur = TestCases['.'] = new Array(); + + + cur[''] = ''; + + + - + @@ -435,7 +494,7 @@ h6 {

Classes

- +
@@ -487,29 +546,29 @@ h6 { - - - - - - + + + + + + - - - - - + + + + + - + Error @@ -529,7 +588,7 @@ h6 { - + Error @@ -590,6 +649,28 @@ h6 { + + + + + \\ + + + + + + + + + + - + + + @@ -163,14 +190,25 @@

TestCase

NameTestsErrorsFailuresTime(s)
NameTestsErrorsFailuresTime(s)
NameStatusTypeTime(s)
NameStatusTypeTime(s)
- - - - - + + + + + + + +
+

- Back to top @@ -223,28 +261,17 @@ - - - - + + + cur = TestCases['.'] = new Array(); + + + cur[''] = ''; + + @@ -345,8 +372,6 @@ - @@ -374,6 +399,28 @@ + + + + + \\ + + + + + + + + + + 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 diff --git a/src/main/org/apache/tools/ant/taskdefs/Javac.java b/src/main/org/apache/tools/ant/taskdefs/Javac.java index bb672a96d..92d90fb33 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javac.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javac.java @@ -87,17 +87,17 @@ import java.io.File; *

* 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 duncan@x180.com * @author Robin Green greenrd@hotmail.com - * @author Stefan Bodewig + * @author Stefan Bodewig * @author J D Glanville */ 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 0) { File[] newCompileList = new File[compileList.length + newFiles.length]; diff --git a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java index 1e6849640..91bd6ddc2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Javadoc.java +++ b/src/main/org/apache/tools/ant/taskdefs/Javadoc.java @@ -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(); } } diff --git a/src/main/org/apache/tools/ant/taskdefs/Manifest.java b/src/main/org/apache/tools/ant/taskdefs/Manifest.java index 947aa97b3..2c62575f5 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Manifest.java +++ b/src/main/org/apache/tools/ant/taskdefs/Manifest.java @@ -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; diff --git a/src/main/org/apache/tools/ant/taskdefs/Property.java b/src/main/org/apache/tools/ant/taskdefs/Property.java index aa775c03e..53c1e4fc9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Property.java +++ b/src/main/org/apache/tools/ant/taskdefs/Property.java @@ -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); } diff --git a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java index 2f145825b..c7ee9fa9b 100644 --- a/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java +++ b/src/main/org/apache/tools/ant/taskdefs/XSLTProcess.java @@ -88,7 +88,6 @@ import org.apache.tools.ant.util.FileUtils; * @author Sam Ruby * @author Russell Gold * @author Stefan Bodewig - * @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(); diff --git a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java index 2f5d2c9ab..8295aea85 100644 --- a/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java +++ b/src/main/org/apache/tools/ant/taskdefs/compilers/DefaultCompilerAdapter.java @@ -67,7 +67,7 @@ import java.util.Random; * * @author James Davidson duncan@x180.com * @author Robin Green greenrd@hotmail.com - * @author Stefan Bodewig + * @author Stefan Bodewig * @author J D Glanville */ 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 { diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java index 7383163e6..5b40e6611 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/BorlandDeploymentTool.java @@ -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 " + diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java index 39077da14..1cd06ad3a 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ejb/WLRun.java @@ -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; diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java index e9fa5493a..5821a834d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java @@ -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 diff --git a/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java b/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java index 47caa9c4b..cf118dde4 100644 --- a/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java +++ b/src/main/org/apache/tools/ant/taskdefs/rmic/WLRmic.java @@ -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"+ diff --git a/src/main/org/apache/tools/ant/types/CommandlineJava.java b/src/main/org/apache/tools/ant/types/CommandlineJava.java index 52071c13e..bbc3ddb8d 100644 --- a/src/main/org/apache/tools/ant/types/CommandlineJava.java +++ b/src/main/org/apache/tools/ant/types/CommandlineJava.java @@ -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 " -> 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 diff --git a/src/main/org/apache/tools/ant/types/Description.java b/src/main/org/apache/tools/ant/types/Description.java index d343b4740..0a7f962a7 100644 --- a/src/main/org/apache/tools/ant/types/Description.java +++ b/src/main/org/apache/tools/ant/types/Description.java @@ -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); + } + } } diff --git a/src/testcases/org/apache/tools/ant/taskdefs/TaskdefsTest.java b/src/testcases/org/apache/tools/ant/taskdefs/TaskdefsTest.java index 7e67ce9ad..dede67ae6 100644 --- a/src/testcases/org/apache/tools/ant/taskdefs/TaskdefsTest.java +++ b/src/testcases/org/apache/tools/ant/taskdefs/TaskdefsTest.java @@ -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()); + } } diff --git a/src/testcases/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java b/src/testcases/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java index 394e7560f..3b617f801 100644 --- a/src/testcases/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java +++ b/src/testcases/org/apache/tools/ant/taskdefs/optional/AbstractXSLTLiaisonTest.java @@ -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()); } diff --git a/src/testcases/org/apache/tools/ant/types/DescriptionTest.java b/src/testcases/org/apache/tools/ant/types/DescriptionTest.java new file mode 100644 index 000000000..a0ffe8bd4 --- /dev/null +++ b/src/testcases/org/apache/tools/ant/types/DescriptionTest.java @@ -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 + * . + */ + +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 Conor MacNeill + */ +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()); + } +} diff --git a/src/testcases/org/apache/tools/ant/types/FilterSetTest.java b/src/testcases/org/apache/tools/ant/types/FilterSetTest.java index 41bc12dd3..9982c31ff 100644 --- a/src/testcases/org/apache/tools/ant/types/FilterSetTest.java +++ b/src/testcases/org/apache/tools/ant/types/FilterSetTest.java @@ -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",