You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2005/02/04 08:57:00 UTC
cvs commit: ant/src/testcases/org/apache/tools/ant/util FileUtilsTest.java
bodewig 2005/02/03 23:57:00
Modified: src/testcases/org/apache/tools/ant Tag: ANT_16_BRANCH
ProjectTest.java
src/testcases/org/apache/tools/ant/types Tag: ANT_16_BRANCH
CommandlineJavaTest.java
src/testcases/org/apache/tools/ant/util Tag: ANT_16_BRANCH
FileUtilsTest.java
Log:
Tests didn't pass on Unix
Revision Changes Path
No revision
No revision
1.18.2.5 +4 -1 ant/src/testcases/org/apache/tools/ant/ProjectTest.java
Index: ProjectTest.java
===================================================================
RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/ProjectTest.java,v
retrieving revision 1.18.2.4
retrieving revision 1.18.2.5
diff -u -r1.18.2.4 -r1.18.2.5
--- ProjectTest.java 9 Mar 2004 17:02:00 -0000 1.18.2.4
+++ ProjectTest.java 4 Feb 2005 07:57:00 -0000 1.18.2.5
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2004 The Apache Software Foundation
+ * Copyright 2000-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
import org.apache.tools.ant.input.DefaultInputHandler;
import org.apache.tools.ant.input.InputHandler;
import org.apache.tools.ant.input.PropertyFileInputHandler;
+import org.apache.tools.ant.taskdefs.condition.Os;
import org.apache.tools.ant.types.*;
import org.apache.tools.ant.util.JavaEnvUtils;
@@ -74,6 +75,7 @@
assertEquals(File.separator,
p.resolveFile("\\", null).getPath());
+ if (!Os.isFamily("unix")) {
/*
* throw in drive letters
*/
@@ -94,6 +96,7 @@
p.resolveFile(driveSpec + "/////", null).getPath());
assertEquals(driveSpec + "\\",
p.resolveFile(driveSpec + "\\\\\\\\\\\\", null).getPath());
+ }
/*
* Now test some relative file name magic.
No revision
No revision
1.17.2.7 +3 -3 ant/src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java
Index: CommandlineJavaTest.java
===================================================================
RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/types/CommandlineJavaTest.java,v
retrieving revision 1.17.2.6
retrieving revision 1.17.2.7
diff -u -r1.17.2.6 -r1.17.2.7
--- CommandlineJavaTest.java 20 Apr 2004 06:53:30 -0000 1.17.2.6
+++ CommandlineJavaTest.java 4 Feb 2005 07:57:00 -0000 1.17.2.7
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2004 The Apache Software Foundation
+ * Copyright 2000-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,7 +43,7 @@
project.setProperty("build.sysclasspath", "ignore");
}
- public void testGetCommandline() {
+ public void testGetCommandline() throws CloneNotSupportedException {
CommandlineJava c = new CommandlineJava();
c.createArgument().setValue("org.apache.tools.ant.CommandlineJavaTest");
c.setClassname("junit.textui.TestRunner");
@@ -131,7 +131,7 @@
assertNull(System.getProperty("key2"));
}
- public void testAssertions() {
+ public void testAssertions() throws CloneNotSupportedException {
if (JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_2)
|| JavaEnvUtils.isJavaVersion(JavaEnvUtils.JAVA_1_3)) {
return;
No revision
No revision
1.22.2.5 +21 -29 ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java
Index: FileUtilsTest.java
===================================================================
RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/util/FileUtilsTest.java,v
retrieving revision 1.22.2.4
retrieving revision 1.22.2.5
diff -u -r1.22.2.4 -r1.22.2.5
--- FileUtilsTest.java 9 Mar 2004 17:02:09 -0000 1.22.2.4
+++ FileUtilsTest.java 4 Feb 2005 07:57:00 -0000 1.22.2.5
@@ -1,5 +1,5 @@
/*
- * Copyright 2001-2004 The Apache Software Foundation
+ * Copyright 2001-2005 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,9 @@
package org.apache.tools.ant.util;
-import java.io.*;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
import junit.framework.TestCase;
@@ -64,21 +66,14 @@
* granularity (should be > 2s to account for Windows FAT).
*/
try {
- Thread.currentThread().sleep(5000);
+ Thread.sleep(5000);
} catch (InterruptedException ie) {
fail(ie.getMessage());
}
fu.setFileLastModified(removeThis, -1);
long secondModTime = removeThis.lastModified();
- try {
- Class.forName("java.lang.ThreadLocal");
- assertTrue(secondModTime > modTime);
- } catch (ClassNotFoundException e) {
- // JDK 1.1
- assertEquals(modTime, secondModTime);
- }
-
+ assertTrue(secondModTime > modTime);
// number of milliseconds in a day
final int millisperday=24 * 3600 * 1000;
@@ -87,19 +82,13 @@
// it did not work on a computer running JDK 1.4.1_02 + Windows 2000
fu.setFileLastModified(removeThis, secondModTime + millisperday);
long thirdModTime = removeThis.lastModified();
- try {
- Class.forName("java.lang.ThreadLocal");
- /*
- * I would love to compare this with 123456, but depending on
- * the filesystems granularity it can take an arbitrary value.
- *
- * Just assert the time has changed.
- */
- assertTrue(thirdModTime != secondModTime);
- } catch (ClassNotFoundException e) {
- // JDK 1.1
- assertEquals(modTime, thirdModTime);
- }
+ /*
+ * I would love to compare this with 123456, but depending on
+ * the filesystems granularity it can take an arbitrary value.
+ *
+ * Just assert the time has changed.
+ */
+ assertTrue(thirdModTime != secondModTime);
}
public void testResolveFile() {
@@ -111,6 +100,7 @@
assertEquals(File.separator,
fu.resolveFile(null, "\\").getPath());
+ if (!Os.isFamily("unix")) {
/*
* throw in drive letters
*/
@@ -131,17 +121,18 @@
fu.resolveFile(null, driveSpec + "/////").getPath());
assertEquals(driveSpec + "\\",
fu.resolveFile(null, driveSpec + "\\\\\\\\\\\\").getPath());
+ }
if (Os.isFamily("netware")) {
/*
* throw in NetWare volume names
*/
- driveSpec = "SYS:";
+ String driveSpec = "SYS:";
assertEquals(driveSpec,
fu.resolveFile(null, driveSpec + "/").getPath());
assertEquals(driveSpec,
fu.resolveFile(null, driveSpec + "\\").getPath());
- driveSpecLower = "sys:";
+ String driveSpecLower = "sys:";
assertEquals(driveSpec,
fu.resolveFile(null, driveSpecLower + "/").getPath());
assertEquals(driveSpec,
@@ -193,6 +184,7 @@
assertEquals(File.separator,
fu.normalize("\\").getPath());
+ if (!Os.isFamily("unix")) {
/*
* throw in drive letters
*/
@@ -215,19 +207,19 @@
fu.normalize(driveSpec + "/////").getPath());
assertEquals(driveSpec + "\\",
fu.normalize(driveSpec + "\\\\\\\\\\\\").getPath());
-
+ }
if (Os.isFamily("netware")) {
/*
* throw in NetWare volume names
*/
- driveSpec = "SYS:";
+ String driveSpec = "SYS:";
assertEquals(driveSpec,
fu.normalize(driveSpec).getPath());
assertEquals(driveSpec,
fu.normalize(driveSpec + "/").getPath());
assertEquals(driveSpec,
fu.normalize(driveSpec + "\\").getPath());
- driveSpecLower = "sys:";
+ String driveSpecLower = "sys:";
assertEquals(driveSpec,
fu.normalize(driveSpecLower).getPath());
assertEquals(driveSpec,
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org