commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r995078 - /commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java
Date Wed, 08 Sep 2010 14:57:57 GMT
Author: niallp
Date: Wed Sep  8 14:57:57 2010
New Revision: 995078

URL: http://svn.apache.org/viewvc?rev=995078&view=rev
Log:
IO-208 Add test case for timeout (connection and read) support for FileUtils.copyURLToFile

Modified:
    commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java

Modified: commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java?rev=995078&r1=995077&r2=995078&view=diff
==============================================================================
--- commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java (original)
+++ commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java Wed Sep
 8 14:57:57 2010
@@ -468,6 +468,29 @@ public class FileUtilsTestCase extends F
         //TODO Maybe test copy to itself like for copyFile()
     }
 
+    public void testCopyURLToFileWithTimeout() throws Exception {
+        // Creates file
+        File file = new File(getTestDirectory(), "testCopyURLToFileWithTimeout");
+        file.deleteOnExit();
+
+        // Loads resource
+        String resourceName = "/java/lang/Object.class";
+        FileUtils.copyURLToFile(getClass().getResource(resourceName), file, 500, 500);
+
+        // Tests that resuorce was copied correctly
+        FileInputStream fis = new FileInputStream(file);
+        try {
+            assertTrue(
+                "Content is not equal.",
+                IOUtils.contentEquals(
+                    getClass().getResourceAsStream(resourceName),
+                    fis));
+        } finally {
+            fis.close();
+        }
+        //TODO Maybe test copy to itself like for copyFile()
+    }
+
     // forceMkdir
 
     public void testForceMkdir() throws Exception {



Mime
View raw message