git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278071 13f79535-47bb-0310-9956-ffa450edef68master
@@ -28,30 +28,4 @@ | |||||
/> | /> | ||||
</target> | </target> | ||||
<target name="test1.1"> | |||||
<input>Press_Return_key_to_continue...</input> | |||||
</target> | |||||
<target name="test2.1"> | |||||
<input message="Press_Return_key_to_continue..." /> | |||||
</target> | |||||
<target name="test3.1"> | |||||
<input message="All_data_is_going_to_be_deleted_from_DB_continue?" | |||||
validargs="y,n" | |||||
/> | |||||
</target> | |||||
<target name="test5.1"> | |||||
<input message="All_data_is_going_to_be_deleted_from_db_continue_(y/n)?" | |||||
validargs="y,n" | |||||
/> | |||||
</target> | |||||
<target name="test6.1"> | |||||
<input message="Please_enter_db_username" | |||||
addproperty="db.user" | |||||
/> | |||||
</target> | |||||
</project> | </project> |
@@ -62,8 +62,7 @@ public class CompilerAdapterFactory { | |||||
throws BuildException { | throws BuildException { | ||||
boolean isClassicCompilerSupported = true; | boolean isClassicCompilerSupported = true; | ||||
//as new versions of java come out, add them to this test | //as new versions of java come out, add them to this test | ||||
if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1) | |||||
&& !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2) | |||||
if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2) | |||||
&& !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) { | && !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) { | ||||
isClassicCompilerSupported = false; | isClassicCompilerSupported = false; | ||||
} | } | ||||
@@ -529,11 +529,7 @@ public abstract class DefaultCompilerAdapter implements CompilerAdapter { | |||||
* @since Ant 1.5 | * @since Ant 1.5 | ||||
*/ | */ | ||||
protected boolean assumeJava11() { | protected boolean assumeJava11() { | ||||
return "javac1.1".equals(attributes.getCompilerVersion()) | |||||
|| ("classic".equals(attributes.getCompilerVersion()) | |||||
&& JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) | |||||
|| ("extJavac".equals(attributes.getCompilerVersion()) | |||||
&& JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)); | |||||
return "javac1.1".equals(attributes.getCompilerVersion()); | |||||
} | } | ||||
/** | /** | ||||
@@ -24,7 +24,7 @@ import org.apache.tools.ant.taskdefs.ExecuteJava; | |||||
import org.apache.tools.ant.taskdefs.optional.Javah; | import org.apache.tools.ant.taskdefs.optional.Javah; | ||||
import org.apache.tools.ant.types.Commandline; | import org.apache.tools.ant.types.Commandline; | ||||
import org.apache.tools.ant.types.Path; | import org.apache.tools.ant.types.Path; | ||||
import org.apache.tools.ant.util.JavaEnvUtils; | |||||
/** | /** | ||||
* Adapter to com.sun.tools.javah.oldjavah.Main or com.sun.tools.javah.Main. | * Adapter to com.sun.tools.javah.oldjavah.Main or com.sun.tools.javah.Main. | ||||
@@ -83,25 +83,18 @@ public class SunJavah implements JavahAdapter { | |||||
cmd.createArgument().setPath(javah.getClasspath()); | cmd.createArgument().setPath(javah.getClasspath()); | ||||
} | } | ||||
// JDK1.1 is rather simpler than JDK1.2 | |||||
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||||
if (javah.getVerbose()) { | |||||
cmd.createArgument().setValue("-v"); | |||||
} | |||||
} else { | |||||
if (javah.getVerbose()) { | |||||
cmd.createArgument().setValue("-verbose"); | |||||
} | |||||
if (javah.getOld()) { | |||||
cmd.createArgument().setValue("-old"); | |||||
} | |||||
if (javah.getForce()) { | |||||
cmd.createArgument().setValue("-force"); | |||||
} | |||||
if (javah.getStubs() && !javah.getOld()) { | |||||
throw new BuildException("stubs only available in old mode.", | |||||
javah.getLocation()); | |||||
} | |||||
if (javah.getVerbose()) { | |||||
cmd.createArgument().setValue("-verbose"); | |||||
} | |||||
if (javah.getOld()) { | |||||
cmd.createArgument().setValue("-old"); | |||||
} | |||||
if (javah.getForce()) { | |||||
cmd.createArgument().setValue("-force"); | |||||
} | |||||
if (javah.getStubs() && !javah.getOld()) { | |||||
throw new BuildException("stubs only available in old mode.", | |||||
javah.getLocation()); | |||||
} | } | ||||
if (javah.getStubs()) { | if (javah.getStubs()) { | ||||
@@ -332,12 +332,10 @@ public class Coverage extends CovBase { | |||||
// check for info, do your best to select the java executable. | // check for info, do your best to select the java executable. | ||||
// JProbe 3.0 fails if there is no javaexe option. So | // JProbe 3.0 fails if there is no javaexe option. So | ||||
if (javaExe == null && (vm == null || "java2".equals(vm))) { | if (javaExe == null && (vm == null || "java2".equals(vm))) { | ||||
if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||||
if (vm == null) { | |||||
vm = "java2"; | |||||
} | |||||
javaExe = new File(JavaEnvUtils.getJreExecutable("java")); | |||||
if (vm == null) { | |||||
vm = "java2"; | |||||
} | } | ||||
javaExe = new File(JavaEnvUtils.getJreExecutable("java")); | |||||
} | } | ||||
} | } | ||||
@@ -649,20 +649,15 @@ public class Path extends DataType implements Cloneable { | |||||
} | } | ||||
if (System.getProperty("java.vendor").toLowerCase(Locale.US).indexOf("microsoft") >= 0) { | if (System.getProperty("java.vendor").toLowerCase(Locale.US).indexOf("microsoft") >= 0) { | ||||
// XXX is this code still necessary? is there any 1.2+ port? | |||||
// Pull in *.zip from packages directory | // Pull in *.zip from packages directory | ||||
FileSet msZipFiles = new FileSet(); | FileSet msZipFiles = new FileSet(); | ||||
msZipFiles.setDir(new File(System.getProperty("java.home") | msZipFiles.setDir(new File(System.getProperty("java.home") | ||||
+ File.separator + "Packages")); | + File.separator + "Packages")); | ||||
msZipFiles.setIncludes("*.ZIP"); | msZipFiles.setIncludes("*.ZIP"); | ||||
addFileset(msZipFiles); | addFileset(msZipFiles); | ||||
} else if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||||
addExisting(new Path(null, | |||||
System.getProperty("java.home") | |||||
+ File.separator + "lib" | |||||
+ File.separator | |||||
+ "classes.zip")); | |||||
} else { | } else { | ||||
// JDK > 1.1 seems to set java.home to the JRE directory. | |||||
// JDK 1.2+ seems to set java.home to the JRE directory. | |||||
addExisting(new Path(null, | addExisting(new Path(null, | ||||
System.getProperty("java.home") | System.getProperty("java.home") | ||||
+ File.separator + "lib" | + File.separator + "lib" | ||||
@@ -138,6 +138,8 @@ public final class JavaEnvUtils { | |||||
* Compares the current Java version to the passed in String - | * Compares the current Java version to the passed in String - | ||||
* assumes the argument is one of the constants defined in this | * assumes the argument is one of the constants defined in this | ||||
* class. | * class. | ||||
* Note that Ant now requires JDK 1.2+ so {@link #JAVA_1_0} and | |||||
* {@link #JAVA_1_1} need no longer be tested for. | |||||
* @param version the version to check against the current version. | * @param version the version to check against the current version. | ||||
* @return true if the version of Java is the same as the given version. | * @return true if the version of Java is the same as the given version. | ||||
* @since Ant 1.5 | * @since Ant 1.5 | ||||
@@ -22,14 +22,10 @@ import org.apache.tools.ant.input.InputHandler; | |||||
import org.apache.tools.ant.input.PropertyFileInputHandler; | import org.apache.tools.ant.input.PropertyFileInputHandler; | ||||
import org.apache.tools.ant.taskdefs.condition.Os; | import org.apache.tools.ant.taskdefs.condition.Os; | ||||
import org.apache.tools.ant.types.*; | import org.apache.tools.ant.types.*; | ||||
import org.apache.tools.ant.util.JavaEnvUtils; | |||||
import java.io.File; | import java.io.File; | ||||
import junit.framework.AssertionFailedError; | |||||
import junit.framework.Test; | |||||
import junit.framework.TestCase; | import junit.framework.TestCase; | ||||
import junit.framework.TestSuite; | |||||
/** | /** | ||||
* Very limited test class for Project. Waiting to be extended. | * Very limited test class for Project. Waiting to be extended. | ||||
@@ -191,21 +187,8 @@ public class ProjectTest extends TestCase { | |||||
assertTaskDefFails(DummyTaskPrivate.class, DummyTaskPrivate.class + " is not public"); | assertTaskDefFails(DummyTaskPrivate.class, DummyTaskPrivate.class + " is not public"); | ||||
try { | |||||
assertTaskDefFails(DummyTaskProtected.class, | |||||
DummyTaskProtected.class + " is not public"); | |||||
} catch (AssertionFailedError e) { | |||||
/* | |||||
* I don't understand this, but this is what happens with | |||||
* > java -fullversion | |||||
* java full version "Linux_JDK_1.1.8_v3_green_threads" | |||||
* from time to time | |||||
*/ | |||||
assertTrue(JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)); | |||||
assertTaskDefFails(DummyTaskProtected.class, | |||||
"No public no-arg constructor in " | |||||
+ DummyTaskProtected.class); | |||||
} | |||||
assertTaskDefFails(DummyTaskProtected.class, | |||||
DummyTaskProtected.class + " is not public"); | |||||
assertTaskDefFails(DummyTaskPackage.class, DummyTaskPackage.class + " is not public"); | assertTaskDefFails(DummyTaskPackage.class, DummyTaskPackage.class + " is not public"); | ||||
@@ -19,7 +19,6 @@ package org.apache.tools.ant.taskdefs; | |||||
import org.apache.tools.ant.BuildFileTest; | import org.apache.tools.ant.BuildFileTest; | ||||
import org.apache.tools.ant.util.FileUtils; | import org.apache.tools.ant.util.FileUtils; | ||||
import org.apache.tools.ant.util.JavaEnvUtils; | |||||
import java.io.File; | import java.io.File; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
@@ -83,10 +82,8 @@ public class CopyTest extends BuildFileTest { | |||||
} | } | ||||
//file time checks for java1.2+ | //file time checks for java1.2+ | ||||
if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||||
assertTrue(file3a.lastModified()==file3.lastModified()); | |||||
assertTrue(file3c.lastModified()<file3a.lastModified()); | |||||
} | |||||
assertTrue(file3a.lastModified()==file3.lastModified()); | |||||
assertTrue(file3c.lastModified()<file3a.lastModified()); | |||||
} | } | ||||
@@ -23,8 +23,6 @@ import org.apache.tools.ant.types.Commandline; | |||||
import org.apache.tools.ant.taskdefs.condition.Os; | import org.apache.tools.ant.taskdefs.condition.Os; | ||||
import org.apache.tools.ant.util.JavaEnvUtils; | import org.apache.tools.ant.util.JavaEnvUtils; | ||||
import java.io.File; | |||||
import junit.framework.TestCase; | import junit.framework.TestCase; | ||||
/** | /** | ||||
@@ -130,14 +128,6 @@ public class ExecuteJavaTest extends TestCase { | |||||
classpath = System.getProperty("java.class.path"); | classpath = System.getProperty("java.class.path"); | ||||
} | } | ||||
// JDK 1.1 needs classes.zip in -classpath argument | |||||
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||||
classpath += File.pathSeparator | |||||
+ System.getProperty("java.home") | |||||
+ File.separator + "lib" | |||||
+ File.separator + "classes.zip"; | |||||
} | |||||
return classpath; | return classpath; | ||||
} | } | ||||
@@ -18,8 +18,6 @@ | |||||
package org.apache.tools.ant.taskdefs; | package org.apache.tools.ant.taskdefs; | ||||
import org.apache.tools.ant.util.JavaEnvUtils; | import org.apache.tools.ant.util.JavaEnvUtils; | ||||
import java.net.*; | |||||
import junit.framework.*; | import junit.framework.*; | ||||
import java.io.*; | import java.io.*; | ||||
@@ -57,14 +55,6 @@ public class ExecuteWatchdogTest extends TestCase { | |||||
classpath = System.getProperty("java.class.path"); | classpath = System.getProperty("java.class.path"); | ||||
} | } | ||||
// JDK 1.1 needs classes.zip in -classpath argument | |||||
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||||
classpath += File.pathSeparator | |||||
+ System.getProperty("java.home") | |||||
+ File.separator + "lib" | |||||
+ File.separator + "classes.zip"; | |||||
} | |||||
return classpath; | return classpath; | ||||
} | } | ||||
@@ -19,19 +19,12 @@ package org.apache.tools.ant.taskdefs; | |||||
import org.apache.tools.ant.BuildFileTest; | import org.apache.tools.ant.BuildFileTest; | ||||
import org.apache.tools.ant.input.PropertyFileInputHandler; | import org.apache.tools.ant.input.PropertyFileInputHandler; | ||||
import org.apache.tools.ant.util.JavaEnvUtils; | |||||
/** | |||||
*/ | |||||
public class InputTest extends BuildFileTest { | |||||
private String targetPostfix = ""; | |||||
public class InputTest extends BuildFileTest { | |||||
public InputTest(String name) { | public InputTest(String name) { | ||||
super(name); | super(name); | ||||
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||||
targetPostfix = ".1"; | |||||
} | |||||
} | } | ||||
public void setUp() { | public void setUp() { | ||||
@@ -44,15 +37,15 @@ public class InputTest extends BuildFileTest { | |||||
} | } | ||||
public void test1() { | public void test1() { | ||||
executeTarget("test1" + targetPostfix); | |||||
executeTarget("test1"); | |||||
} | } | ||||
public void test2() { | public void test2() { | ||||
executeTarget("test2" + targetPostfix); | |||||
executeTarget("test2"); | |||||
} | } | ||||
public void test3() { | public void test3() { | ||||
expectSpecificBuildException("test3" + targetPostfix, "invalid input", | |||||
expectSpecificBuildException("test3", "invalid input", | |||||
"Found invalid input test for \'" | "Found invalid input test for \'" | ||||
+ getKey("All data is" | + getKey("All data is" | ||||
+ " going to be deleted from DB" | + " going to be deleted from DB" | ||||
@@ -61,19 +54,16 @@ public class InputTest extends BuildFileTest { | |||||
} | } | ||||
public void test5() { | public void test5() { | ||||
executeTarget("test5" + targetPostfix); | |||||
executeTarget("test5"); | |||||
} | } | ||||
public void test6() { | public void test6() { | ||||
executeTarget("test6" + targetPostfix); | |||||
executeTarget("test6"); | |||||
assertEquals("scott", project.getProperty("db.user")); | assertEquals("scott", project.getProperty("db.user")); | ||||
} | } | ||||
private String getKey(String key) { | private String getKey(String key) { | ||||
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||||
key = key.replace(' ', '_'); | |||||
} | |||||
return key; | |||||
return key; // XXX what is this for? | |||||
} | } | ||||
} | } |
@@ -20,7 +20,6 @@ package org.apache.tools.ant.taskdefs; | |||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; | import org.apache.tools.ant.taskdefs.compilers.CompilerAdapter; | ||||
import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; | import org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory; | ||||
import org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter; | |||||
import org.apache.tools.ant.taskdefs.compilers.Javac12; | import org.apache.tools.ant.taskdefs.compilers.Javac12; | ||||
import org.apache.tools.ant.taskdefs.compilers.Javac13; | import org.apache.tools.ant.taskdefs.compilers.Javac13; | ||||
import org.apache.tools.ant.taskdefs.compilers.JavacExternal; | import org.apache.tools.ant.taskdefs.compilers.JavacExternal; | ||||
@@ -189,8 +188,7 @@ public class JavacTest extends TestCase { | |||||
} | } | ||||
public void testCompilerAdapter() { | public void testCompilerAdapter() { | ||||
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1) | |||||
|| JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2) | |||||
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2) | |||||
|| JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) { | || JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) { | ||||
javac.setCompiler("javac1.1"); | javac.setCompiler("javac1.1"); | ||||
} else { | } else { | ||||
@@ -201,8 +199,7 @@ public class JavacTest extends TestCase { | |||||
CompilerAdapter adapter = | CompilerAdapter adapter = | ||||
CompilerAdapterFactory.getCompiler(javac.getCompiler(), javac); | CompilerAdapterFactory.getCompiler(javac.getCompiler(), javac); | ||||
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1) | |||||
|| JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2) | |||||
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2) | |||||
|| JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) { | || JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) { | ||||
assertTrue(adapter instanceof Javac12); | assertTrue(adapter instanceof Javac12); | ||||
} else { | } else { | ||||
@@ -39,8 +39,7 @@ public class ProcessDestroyerTest extends TestCase { | |||||
} | } | ||||
public void testProcessDestroyer(){ | public void testProcessDestroyer(){ | ||||
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1) | |||||
|| JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)) { | |||||
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)) { | |||||
return; | return; | ||||
} | } | ||||
@@ -31,8 +31,7 @@ import org.apache.commons.net.ftp.FTPClient; | |||||
public class FTPTest extends BuildFileTest{ | public class FTPTest extends BuildFileTest{ | ||||
// keep track of what operating systems are supported here. | // keep track of what operating systems are supported here. | ||||
private boolean supportsSymlinks = Os.isFamily("unix") | |||||
&& !JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1); | |||||
private boolean supportsSymlinks = Os.isFamily("unix"); | |||||
private FTPClient ftp; | private FTPClient ftp; | ||||
private boolean connectionSucceeded = true; | private boolean connectionSucceeded = true; | ||||
@@ -19,16 +19,12 @@ package org.apache.tools.ant.types.selectors; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.BuildFileTest; | |||||
import org.apache.tools.ant.types.Parameter; | import org.apache.tools.ant.types.Parameter; | ||||
import org.apache.tools.ant.util.JavaEnvUtils; | |||||
import java.text.SimpleDateFormat; | import java.text.SimpleDateFormat; | ||||
import java.text.ParsePosition; | import java.text.ParsePosition; | ||||
import java.util.Date; | import java.util.Date; | ||||
import junit.framework.TestCase; | |||||
import junit.framework.AssertionFailedError; | |||||
/** | /** | ||||
* Tests Date Selectors. | * Tests Date Selectors. | ||||
@@ -170,47 +166,45 @@ public class DateSelectorTest extends BaseSelectorTest { | |||||
results = selectionString(s); | results = selectionString(s); | ||||
assertEquals("TTTTTTTTTTTT", results); | assertEquals("TTTTTTTTTTTT", results); | ||||
if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||||
s = (DateSelector)getInstance(); | |||||
s.setDatetime("11/21/2001 4:54 AM"); | |||||
s.setWhen(before); | |||||
results = selectionString(s); | |||||
assertEquals("TFTFFFFFFFFT", results); | |||||
s = (DateSelector)getInstance(); | |||||
s.setDatetime("11/21/2001 4:54 AM"); | |||||
s.setWhen(before); | |||||
results = selectionString(s); | |||||
assertEquals("TFTFFFFFFFFT", results); | |||||
s = (DateSelector)getInstance(); | |||||
s.setDatetime("11/21/2001 4:55 AM"); | |||||
SimpleDateFormat formatter = new SimpleDateFormat(); | |||||
Date d = formatter.parse("11/21/2001 4:55 AM",new ParsePosition(0)); | |||||
s = (DateSelector)getInstance(); | |||||
s.setDatetime("11/21/2001 4:55 AM"); | |||||
SimpleDateFormat formatter = new SimpleDateFormat(); | |||||
Date d = formatter.parse("11/21/2001 4:55 AM",new ParsePosition(0)); | |||||
long milliseconds = s.getMillis(); | |||||
s.setWhen(equal); | |||||
results = selectionString(s); | |||||
assertEquals("TTFFTFFFTTTT", results); | |||||
long milliseconds = s.getMillis(); | |||||
s.setWhen(equal); | |||||
results = selectionString(s); | |||||
assertEquals("TTFFTFFFTTTT", results); | |||||
s = (DateSelector)getInstance(); | |||||
s.setMillis(milliseconds); | |||||
s.setWhen(equal); | |||||
results = selectionString(s); | |||||
assertEquals("TTFFTFFFTTTT", results); | |||||
s = (DateSelector)getInstance(); | |||||
s.setMillis(milliseconds); | |||||
s.setWhen(equal); | |||||
results = selectionString(s); | |||||
assertEquals("TTFFTFFFTTTT", results); | |||||
s = (DateSelector)getInstance(); | |||||
s.setDatetime("11/21/2001 4:56 AM"); | |||||
s.setWhen(after); | |||||
results = selectionString(s); | |||||
assertEquals("TFFTFTTTFFFT", results); | |||||
s = (DateSelector)getInstance(); | |||||
s.setDatetime("11/21/2001 4:56 AM"); | |||||
s.setWhen(after); | |||||
results = selectionString(s); | |||||
assertEquals("TFFTFTTTFFFT", results); | |||||
s = (DateSelector)getInstance(); | |||||
Parameter param1 = new Parameter(); | |||||
Parameter param2 = new Parameter(); | |||||
param1.setName("datetime"); | |||||
param1.setValue("11/21/2001 4:56 AM"); | |||||
param2.setName("when"); | |||||
param2.setValue("after"); | |||||
Parameter[] params = {param1,param2}; | |||||
s.setParameters(params); | |||||
results = selectionString(s); | |||||
assertEquals("TFFTFTTTFFFT", results); | |||||
} | |||||
s = (DateSelector)getInstance(); | |||||
Parameter param1 = new Parameter(); | |||||
Parameter param2 = new Parameter(); | |||||
param1.setName("datetime"); | |||||
param1.setValue("11/21/2001 4:56 AM"); | |||||
param2.setName("when"); | |||||
param2.setValue("after"); | |||||
Parameter[] params = {param1,param2}; | |||||
s.setParameters(params); | |||||
results = selectionString(s); | |||||
assertEquals("TFFTFTTTFFFT", results); | |||||
try { | try { | ||||
makeMirror(); | makeMirror(); | ||||
@@ -19,17 +19,10 @@ package org.apache.tools.ant.types.selectors; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.BuildFileTest; | |||||
import org.apache.tools.ant.types.Mapper; | import org.apache.tools.ant.types.Mapper; | ||||
import org.apache.tools.ant.util.FileNameMapper; | |||||
import org.apache.tools.ant.util.IdentityMapper; | |||||
import org.apache.tools.ant.util.GlobPatternMapper; | |||||
import org.apache.tools.ant.util.JavaEnvUtils; | |||||
import java.io.File; | import java.io.File; | ||||
import junit.framework.TestCase; | |||||
import junit.framework.AssertionFailedError; | |||||
/** | /** | ||||
* Tests Depend Selectors | * Tests Depend Selectors | ||||
@@ -106,34 +99,32 @@ public class DependSelectorTest extends BaseSelectorTest { | |||||
results = selectionString(s); | results = selectionString(s); | ||||
assertEquals("FFFFFFFFFFFF", results); | assertEquals("FFFFFFFFFFFF", results); | ||||
if (!JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||||
s = (DependSelector)getInstance(); | |||||
s.setTargetdir(beddir); | |||||
m = s.createMapper(); | |||||
m.setType(merge); | |||||
m.setTo("asf-logo.gif.gz"); | |||||
results = selectionString(s); | |||||
assertEquals("TFFFFTTTFFF", results.substring(0,11)); | |||||
s = (DependSelector)getInstance(); | |||||
s.setTargetdir(beddir); | |||||
m = s.createMapper(); | |||||
m.setType(merge); | |||||
m.setTo("asf-logo.gif.gz"); | |||||
results = selectionString(s); | |||||
assertEquals("TFFFFTTTFFF", results.substring(0,11)); | |||||
s = (DependSelector)getInstance(); | |||||
s.setTargetdir(beddir); | |||||
m = s.createMapper(); | |||||
m.setType(merge); | |||||
m.setTo("asf-logo.gif.bz2"); | |||||
results = selectionString(s); | |||||
assertEquals("TTFTTTTTTTTT", results); | |||||
s = (DependSelector)getInstance(); | |||||
s.setTargetdir(beddir); | |||||
m = s.createMapper(); | |||||
m.setType(merge); | |||||
m.setTo("asf-logo.gif.bz2"); | |||||
results = selectionString(s); | |||||
assertEquals("TTFTTTTTTTTT", results); | |||||
// Test for path relative to project base directory | |||||
s = (DependSelector)getInstance(); | |||||
subdir = new File("selectortest/tar/bz2"); | |||||
s.setTargetdir(subdir); | |||||
m = s.createMapper(); | |||||
m.setType(glob); | |||||
m.setFrom("*.bz2"); | |||||
m.setTo("*.tar.bz2"); | |||||
results = selectionString(s); | |||||
assertEquals("FFTFFFFFFTTF", results); | |||||
} | |||||
// Test for path relative to project base directory | |||||
s = (DependSelector)getInstance(); | |||||
subdir = new File("selectortest/tar/bz2"); | |||||
s.setTargetdir(subdir); | |||||
m = s.createMapper(); | |||||
m.setType(glob); | |||||
m.setFrom("*.bz2"); | |||||
m.setTo("*.tar.bz2"); | |||||
results = selectionString(s); | |||||
assertEquals("FFTFFFFFFTTF", results); | |||||
s = (DependSelector)getInstance(); | s = (DependSelector)getInstance(); | ||||
subdir = new File(beddir,"tar/bz2"); | subdir = new File(beddir,"tar/bz2"); | ||||
@@ -19,17 +19,10 @@ package org.apache.tools.ant.types.selectors; | |||||
import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
import org.apache.tools.ant.Project; | import org.apache.tools.ant.Project; | ||||
import org.apache.tools.ant.util.*; | |||||
import org.apache.tools.ant.BuildFileTest; | |||||
import org.apache.tools.ant.types.Mapper; | import org.apache.tools.ant.types.Mapper; | ||||
import org.apache.tools.ant.util.FileNameMapper; | |||||
import org.apache.tools.ant.util.IdentityMapper; | |||||
import org.apache.tools.ant.util.GlobPatternMapper; | |||||
import java.io.File; | import java.io.File; | ||||
import junit.framework.TestCase; | |||||
import junit.framework.AssertionFailedError; | |||||
/** | /** | ||||
* Tests Present Selectors | * Tests Present Selectors | ||||
@@ -113,11 +106,7 @@ public class PresentSelectorTest extends BaseSelectorTest { | |||||
m = s.createMapper(); | m = s.createMapper(); | ||||
m.setType(flatten); | m.setType(flatten); | ||||
results = selectionString(s); | results = selectionString(s); | ||||
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_1)) { | |||||
assertEquals("TTTTTFFFFFFF", results); | |||||
} else { | |||||
assertEquals("TTTTTTTTTTTF", results); | |||||
} | |||||
assertEquals("TTTTTTTTTTTF", results); | |||||
s = (PresentSelector)getInstance(); | s = (PresentSelector)getInstance(); | ||||
s.setTargetdir(beddir); | s.setTargetdir(beddir); | ||||
@@ -69,15 +69,8 @@ public class JavaEnvUtilsTest extends TestCase { | |||||
FILE_UTILS.normalize(javaHome+"/..").getAbsolutePath(); | FILE_UTILS.normalize(javaHome+"/..").getAbsolutePath(); | ||||
assertTrue(j+" is normalized and in the JDK dir", | assertTrue(j+" is normalized and in the JDK dir", | ||||
j.startsWith(javaHomeParent)); | j.startsWith(javaHomeParent)); | ||||
if (JavaEnvUtils.getJavaVersion() == JavaEnvUtils.JAVA_1_0 || | |||||
JavaEnvUtils.getJavaVersion() == JavaEnvUtils.JAVA_1_1) { | |||||
assertTrue(j+" is normalized and in the JRE dir", | |||||
j.startsWith(javaHome)); | |||||
} else { | |||||
assertTrue(j+" is normalized and not in the JRE dir", | |||||
!j.startsWith(javaHome)); | |||||
} | |||||
assertTrue(j+" is normalized and not in the JRE dir", | |||||
!j.startsWith(javaHome)); | |||||
} catch (AssertionFailedError e) { | } catch (AssertionFailedError e) { | ||||
// java.home is bogus | // java.home is bogus | ||||
@@ -117,9 +110,7 @@ public class JavaEnvUtilsTest extends TestCase { | |||||
assertTrue(j+" is normalized and in the JDK dir", | assertTrue(j+" is normalized and in the JDK dir", | ||||
j.startsWith(javaHomeParent)); | j.startsWith(javaHomeParent)); | ||||
if (JavaEnvUtils.getJavaVersion() == JavaEnvUtils.JAVA_1_0 || | |||||
JavaEnvUtils.getJavaVersion() == JavaEnvUtils.JAVA_1_1 || | |||||
Os.isFamily("mac")) { | |||||
if (Os.isFamily("mac")) { | |||||
assertTrue(j+" is normalized and in the JRE dir", | assertTrue(j+" is normalized and in the JRE dir", | ||||
j.startsWith(javaHome)); | j.startsWith(javaHome)); | ||||
} else { | } else { | ||||