You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ni...@apache.org on 2010/09/08 16:57:57 UTC
svn commit: r995078 -
/commons/proper/io/trunk/src/test/org/apache/commons/io/FileUtilsTestCase.java
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 {