commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerem...@apache.org
Subject cvs commit: jakarta-commons/io/src/test/org/apache/commons/io FileUtilsTestCase.java
Date Sun, 14 Mar 2004 10:22:27 GMT
jeremias    2004/03/14 02:22:27

  Modified:    io/src/test/org/apache/commons/io FileUtilsTestCase.java
  Log:
  Looks like the 200ms weren't enough. Gump failed in one of the tests. Maybe this helps.
sleeps are never good but I don't know how to do this in a better way.
  
  Revision  Changes    Path
  1.14      +19 -11    jakarta-commons/io/src/test/org/apache/commons/io/FileUtilsTestCase.java
  
  Index: FileUtilsTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/io/src/test/org/apache/commons/io/FileUtilsTestCase.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- FileUtilsTestCase.java	12 Mar 2004 22:22:25 -0000	1.13
  +++ FileUtilsTestCase.java	14 Mar 2004 10:22:27 -0000	1.14
  @@ -42,6 +42,9 @@
        * Size of test directory.
        */
       private static final int TEST_DIRECTORY_SIZE = 0;
  +    
  +    /** Delay in milliseconds to make sure test for "last modified date" are accurate */
  +    private static final int LAST_MODIFIED_DELAY = 600;
   
       private File testFile1;
       private File testFile2;
  @@ -250,8 +253,9 @@
       public void testCopyFile1() throws Exception {
           File destination = new File(getTestDirectory(), "copy1.txt");
           
  -        Thread.sleep(200); //This is to slow things down so we can catch if 
  -                           //the lastModified date is not ok
  +        Thread.sleep(LAST_MODIFIED_DELAY);
  +        //This is to slow things down so we can catch if 
  +        //the lastModified date is not ok
           
           FileUtils.copyFile(testFile1, destination);
           assertTrue("Check Exist", destination.exists());
  @@ -263,8 +267,9 @@
       public void testCopyFile2() throws Exception {
           File destination = new File(getTestDirectory(), "copy2.txt");
           
  -        Thread.sleep(200); //This is to slow things down so we can catch if 
  -                           //the lastModified date is not ok
  +        Thread.sleep(LAST_MODIFIED_DELAY);
  +        //This is to slow things down so we can catch if 
  +        //the lastModified date is not ok
           
           FileUtils.copyFile(testFile1, destination);
           assertTrue("Check Exist", destination.exists());
  @@ -276,8 +281,9 @@
       public void testCopyFile2WithoutFileDatePreservation() throws Exception {
           File destination = new File(getTestDirectory(), "copy2.txt");
           
  -        Thread.sleep(200); //This is to slow things down so we can catch if 
  -                           //the lastModified date is not ok
  +        Thread.sleep(LAST_MODIFIED_DELAY);
  +        //This is to slow things down so we can catch if 
  +        //the lastModified date is not ok
           
           FileUtils.copyFile(testFile1, destination, false);
           assertTrue("Check Exist", destination.exists());
  @@ -312,8 +318,9 @@
               directory.mkdirs();
           File destination = new File(directory, testFile1.getName());
           
  -        Thread.sleep(200); //This is to slow things down so we can catch if 
  -                           //the lastModified date is not ok
  +        Thread.sleep(LAST_MODIFIED_DELAY);
  +        //This is to slow things down so we can catch if 
  +        //the lastModified date is not ok
           
           FileUtils.copyFileToDirectory(testFile1, directory);
           assertTrue("Check Exist", destination.exists());
  @@ -328,8 +335,9 @@
               directory.mkdirs();
           File destination = new File(directory, testFile1.getName());
           
  -        Thread.sleep(200); //This is to slow things down so we can catch if 
  -                           //the lastModified date is not ok
  +        Thread.sleep(LAST_MODIFIED_DELAY);
  +        //This is to slow things down so we can catch if 
  +        //the lastModified date is not ok
           
           FileUtils.copyFileToDirectory(testFile1, directory);
           assertTrue("Check Exist", destination.exists());
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message