You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by to...@apache.org on 2007/06/19 12:12:06 UTC

svn commit: r548678 - in /harmony/enhanced/classlib/branches/java6/modules/luni: make/ src/test/api/common/org/apache/harmony/luni/tests/java/io/unix/ src/test/api/common/org/apache/harmony/luni/tests/java/io/windows/ src/test/api/unix/org/ src/test/ap...

Author: tonywu
Date: Tue Jun 19 03:11:59 2007
New Revision: 548678

URL: http://svn.apache.org/viewvc?view=rev&rev=548678
Log:
put platform to the right place and clean exlude list

Added:
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/harmony/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/harmony/luni/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/UnixFileTest.java
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/luni/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java
Removed:
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/unix/
    harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/common/org/apache/harmony/luni/tests/java/io/windows/
Modified:
    harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.drl
    harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.drl.interm
    harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.ibm
    harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86_64.drl
    harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86.drl
    harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86.ibm
    harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86_64.drl
    harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86_64.ibm

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.drl?view=diff&rev=548678&r1=548677&r2=548678
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.drl (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.drl Tue Jun 19 03:11:59 2007
@@ -1,5 +1,4 @@
 org/apache/harmony/luni/tests/java/lang/ThreadTest.java
 org/apache/harmony/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
 tests/api/java/net/SocketTest.java
-org/apache/harmony/luni/tests/java/io/windows/WinFileTest.java
 

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.drl.interm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.drl.interm?view=diff&rev=548678&r1=548677&r2=548678
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.drl.interm (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.drl.interm Tue Jun 19 03:11:59 2007
@@ -1,4 +1,3 @@
 #2315
 org/apache/harmony/luni/tests/java/net/InetAddressTest.java
 org/apache/harmony/tests/java/net/InetAddressTest.java
-org/apache/harmony/luni/tests/java/io/windows/WinFileTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.ibm?view=diff&rev=548678&r1=548677&r2=548678
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.ibm (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86.ibm Tue Jun 19 03:11:59 2007
@@ -2,4 +2,3 @@
 org/apache/harmony/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
 org/apache/harmony/luni/tests/java/lang/SecurityManager2Test.java
 org/apache/harmony/luni/tests/java/lang/PackageTest.java
-org/apache/harmony/luni/tests/java/io/windows/WinFileTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86_64.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86_64.drl?view=diff&rev=548678&r1=548677&r2=548678
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86_64.drl (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.linux.x86_64.drl Tue Jun 19 03:11:59 2007
@@ -3,4 +3,3 @@
 org/apache/harmony/tests/internal/net/www/protocol/http/HttpURLConnectionTest.java
 tests/api/java/net/SocketTest.java
 tests/api/java/net/MulticastSocketTest.java
-org/apache/harmony/luni/tests/java/io/windows/WinFileTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86.drl?view=diff&rev=548678&r1=548677&r2=548678
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86.drl (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86.drl Tue Jun 19 03:11:59 2007
@@ -1 +0,0 @@
-org/apache/harmony/luni/tests/java/io/unix/UnixFileTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86.ibm?view=diff&rev=548678&r1=548677&r2=548678
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86.ibm (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86.ibm Tue Jun 19 03:11:59 2007
@@ -1,4 +1,3 @@
 tests/api/java/util/PropertiesTest.java
 org/apache/harmony/luni/tests/java/lang/SecurityManager2Test.java
 org/apache/harmony/luni/tests/java/lang/PackageTest.java
-org/apache/harmony/luni/tests/java/io/unix/UnixFileTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86_64.drl
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86_64.drl?view=diff&rev=548678&r1=548677&r2=548678
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86_64.drl (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86_64.drl Tue Jun 19 03:11:59 2007
@@ -1,3 +1,2 @@
 tests/api/java/net/MulticastSocketTest.java
 tests/api/java/util/ArrayListTest.java
-org/apache/harmony/luni/tests/java/io/unix/UnixFileTest.java

Modified: harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86_64.ibm
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86_64.ibm?view=diff&rev=548678&r1=548677&r2=548678
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86_64.ibm (original)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/make/exclude.windows.x86_64.ibm Tue Jun 19 03:11:59 2007
@@ -1 +0,0 @@
-org/apache/harmony/luni/tests/java/io/unix/UnixFileTest.java

Added: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/UnixFileTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/UnixFileTest.java?view=auto&rev=548678
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/UnixFileTest.java (added)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/unix/org/apache/harmony/luni/tests/java/io/UnixFileTest.java Tue Jun 19 03:11:59 2007
@@ -0,0 +1,142 @@
+package org.apache.harmony.luni.tests.java.io.unix;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+/**
+ * Please note that this case can only be passed on Linux due to some file
+ * system dependent reason.
+ * 
+ */
+public class UnixFileTest extends TestCase {
+	private boolean root = false;
+	
+	private File testFile;
+
+	private File testDir;
+
+	/**
+	 * @tests java.io.File#canExecute()
+	 * 
+	 * @since 1.6
+	 */
+	public void test_canExecute() {		
+		assertFalse(testFile.canExecute());
+		assertTrue(testFile.setExecutable(true, false));
+		assertTrue(testFile.canExecute());
+		assertTrue(testFile.setExecutable(true, true));
+		assertTrue(testFile.canExecute());
+
+		assertTrue(testFile.setExecutable(false, false));
+		assertFalse(testFile.canExecute());
+		assertTrue(testFile.setExecutable(false, true));
+		assertFalse(testFile.canExecute());
+
+		assertTrue(testFile.setExecutable(true, false));
+		assertTrue(testFile.canExecute());
+
+		// tests directory
+		assertTrue(testDir.canExecute());
+		assertTrue(testDir.setExecutable(false, true));
+		if (root) {
+			assertTrue(testDir.canExecute());
+		} else {
+			assertFalse(testDir.canExecute());			
+		}		
+		assertTrue(testDir.setExecutable(true, false));
+		assertTrue(testDir.canExecute());
+	}
+
+	/**
+	 * @tests java.io.File#setExecutable(boolean, boolean)
+	 * 
+	 * @since 1.6
+	 */
+	public void test_setExecutableZZ() {		
+		// setExecutable(true, true/false)
+		assertFalse(testFile.canExecute());
+		assertTrue(testFile.setExecutable(true, false));
+		assertTrue(testFile.canExecute());
+		assertTrue(testFile.setExecutable(true, true));
+		assertTrue(testFile.canExecute());
+
+		// setExecutable(false, true/false)
+		assertTrue(testFile.setExecutable(false, true));
+		if (root) {
+			assertTrue(testFile.canExecute());			
+		} else {
+			assertFalse(testFile.canExecute());			
+		}		
+		assertTrue(testFile.setExecutable(false, false));
+		assertFalse(testFile.canExecute());
+
+		// tests directory
+		assertTrue(testDir.canExecute());
+		assertTrue(testDir.setExecutable(false, true));
+		if (root) {
+			assertTrue(testDir.canExecute());
+		} else {
+			assertFalse(testDir.canExecute());
+		}
+		assertTrue(testDir.setExecutable(false, false));
+		if (root) {
+			assertTrue(testDir.canExecute());
+		} else {
+			assertFalse(testDir.canExecute());
+		}
+
+		assertTrue(testDir.setExecutable(true, true));
+		assertTrue(testDir.canExecute());
+		assertTrue(testDir.setExecutable(true, false));
+		assertTrue(testDir.canExecute());
+	}
+
+	/**
+	 * @tests java.io.File#setExecutable(boolean)
+	 * 
+	 * @since 1.6
+	 */
+	public void test_setExecutableZ() {
+		// So far this method only deals with the situation that the user is the
+		// owner of the file
+		assertTrue(testFile.setExecutable(true));
+		assertTrue(testFile.canExecute());
+		assertTrue(testFile.setExecutable(false));
+		assertFalse(testFile.canExecute());
+		assertTrue(testFile.setExecutable(true));
+
+		// tests directory
+		assertTrue(testDir.canExecute());
+		assertTrue(testDir.setExecutable(false));
+		if (root) {
+			assertTrue(testDir.canExecute());
+		} else {
+			assertFalse(testDir.canExecute());			
+		}		
+		assertTrue(testDir.setExecutable(true));
+		assertTrue(testDir.canExecute());
+	}
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		testFile = File.createTempFile("testfile", null);
+		testDir = new File(System.getProperty("java.io.tmpdir") + "/temp");
+		if (!testDir.exists()) {
+			testDir.mkdir();
+		}
+		root = System.getProperty("user.name").equals("root");
+	}
+
+	@Override
+	protected void tearDown() throws Exception {
+		testFile.delete();
+		testDir.delete();
+		testFile = null;
+		testDir = null;
+		root = false;
+		super.tearDown();
+	}
+
+}

Added: harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java?view=auto&rev=548678
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java (added)
+++ harmony/enhanced/classlib/branches/java6/modules/luni/src/test/api/windows/org/apache/harmony/luni/tests/java/io/WinFileTest.java Tue Jun 19 03:11:59 2007
@@ -0,0 +1,94 @@
+package org.apache.harmony.luni.tests.java.io.windows;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+/**
+ * Please note that this case can only be passed on Windows due to some file
+ * system dependent reason.
+ * 
+ */
+
+public class WinFileTest extends TestCase {
+	private File testFile;
+
+	private File testDir;	
+
+	/**
+	 * @tests java.io.File#canExecute()
+	 * 
+	 * @since 1.6
+	 */
+	public void test_canExecute() {
+		// files and directories are always executable on Windows.
+		assertTrue(testFile.canExecute());
+		assertFalse(testFile.setExecutable(false, false));
+		assertTrue(testFile.canExecute());
+		assertTrue(testFile.setExecutable(true));
+		assertTrue(testFile.canExecute());
+
+		assertFalse(testDir.setExecutable(false, false));
+		assertTrue(testDir.canExecute());
+	}
+	
+	/**
+	 * @tests java.io.File#setExecutable(boolean, boolean)
+	 * 
+	 * @since 1.6
+	 */
+	public void test_setExecutableZZ() {
+		// setExecutable(false, true/false) fails on Windows.
+		assertTrue(testFile.canExecute());
+		assertFalse(testFile.setExecutable(false, false));
+		assertTrue(testFile.canExecute());
+		assertFalse(testFile.setExecutable(false, true));
+		// setExecutable(true, true/false)
+		assertTrue(testFile.setExecutable(true, false));
+		assertTrue(testFile.canExecute());
+		assertTrue(testFile.setExecutable(true, true));
+
+		// tests directory
+		assertTrue(testDir.canExecute());
+		assertFalse(testDir.setExecutable(false, true));
+		assertTrue(testDir.canExecute());
+		assertFalse(testDir.setExecutable(false, false));
+
+		assertTrue(testDir.setExecutable(true, true));
+		assertTrue(testDir.setExecutable(true, false));
+		assertTrue(testDir.canExecute());
+	}
+
+	/**
+	 * @tests java.io.File#setExecutable(boolean)
+	 * 
+	 * @since 1.6
+	 */
+	public void test_setExecutableZ() {
+		// So far this method only deals with the situation that the user is the
+		// owner of the file
+		assertTrue(testFile.setExecutable(true));
+		assertFalse(testFile.setExecutable(false));
+		// tests directory
+		assertTrue(testDir.setExecutable(true));
+		assertFalse(testDir.setExecutable(false));
+		assertTrue(testDir.canExecute());
+	}
+
+	@Override
+	protected void setUp() throws Exception {
+		super.setUp();
+		testFile = File.createTempFile("testfile", null);
+		testDir = new File(System.getProperty("java.io.tmpdir"));
+	}
+
+	@Override
+	protected void tearDown() throws Exception {
+		testFile.deleteOnExit();
+		testDir.deleteOnExit();
+		testFile = null;
+		testDir = null;
+		super.tearDown();
+	}
+
+}