You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ji...@apache.org on 2004/04/22 18:35:53 UTC

[jira] Updated: (JS2-19) TestFileCache always failing if it failed before

The following issue has been updated:

    Updater: Ate Douma (mailto:ate@douma.nu)
       Date: Thu, 22 Apr 2004 9:33 AM
    Changes:
             Attachment changed to JS2-19-patch.txt
    ---------------------------------------------------------------------
For a full history of the issue, see:

  http://issues.apache.org/jira/browse/JS2-19?page=history

---------------------------------------------------------------------
View the issue:
  http://issues.apache.org/jira/browse/JS2-19

Here is an overview of the issue:
---------------------------------------------------------------------
        Key: JS2-19
    Summary: TestFileCache always failing if it failed before
       Type: Test

     Status: Unassigned
   Priority: Major

    Project: Jetspeed 2
 Components: 
             Other
   Versions:
             2.0-dev/cvs

   Assignee: 
   Reporter: Ate Douma

    Created: Thu, 22 Apr 2004 9:33 AM
    Updated: Thu, 22 Apr 2004 9:33 AM
Environment: Windows XP, J2SE1.4.2_03, Tomcat 4.1.29

Description:
If for some reason the TestFileCache fails once the test files it creates are not removed (missing tearDown implementation).

Then, on a subsequent test run it will almost always fail again (at least under WindowsXP).

The reason:
The FileCache sorts its entries when it starts to evict. This is done on with a custom Comparator (the FileCache itself) using the file.getLastAccessed() attribute.
After the eviction the test case tries to get the document back from the cache using the 18th file originally loaded. But, if there were left over test files from a previous test run that one file may just have been evicted leading to a assertNotNull failure and the test fails.

So, I've done three things to prevent this wrong failing:
1) add a tearDown implementation removing the test files.
2) added a check in removeTestFiles so only still existing files will be removed
3) reloaded the files[] array based on the contents of the cache before trying to access file[18] so a reordering in the files won't break it anymore.

I've tested my changes multiple times by interrupting the test run in the middle resulting in left over test files. Running the test again now won't break it anymore.

Regards,

Ate


---------------------------------------------------------------------
JIRA INFORMATION:
This message is automatically generated by JIRA.

If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa

If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


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