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 ta...@apache.org on 2004/05/01 01:43:25 UTC
cvs commit: jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/cache/file TestFileCache.java
taylor 2004/04/30 16:43:25
Modified: portal/src/test/org/apache/jetspeed/cache/file
TestFileCache.java
Log:
Patch applied from Ate Douma for TestFileCache failing (btw -- i never experienced this problem)
Test passes
http://nagoya.apache.org/jira/browse/JS2-19
PR:
Obtained from:
Submitted by:
Reviewed by:
CVS: ----------------------------------------------------------------------
CVS: PR:
CVS: If this change addresses a PR in the problem report tracking
CVS: database, then enter the PR number(s) here.
CVS: Obtained from:
CVS: If this change has been taken from another system, such as NCSA,
CVS: then name the system in this line, otherwise delete it.
CVS: Submitted by:
CVS: If this code has been contributed to Apache by someone else; i.e.,
CVS: they sent us a patch or a new module, then include their name/email
CVS: address here. If this is your work then delete this line.
CVS: Reviewed by:
CVS: If we are doing pre-commit code reviews and someone else has
CVS: reviewed your changes, include their name(s) here.
CVS: If you have not had it reviewed then delete this line.
Revision Changes Path
1.6 +28 -2 jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/cache/file/TestFileCache.java
Index: TestFileCache.java
===================================================================
RCS file: /home/cvs/jakarta-jetspeed-2/portal/src/test/org/apache/jetspeed/cache/file/TestFileCache.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestFileCache.java 6 Apr 2004 16:47:15 -0000 1.5
+++ TestFileCache.java 30 Apr 2004 23:43:25 -0000 1.6
@@ -77,6 +77,15 @@
cache = (FileCache) container.getComponentInstance(FileCache.class);
}
+ /**
+ * @see junit.framework.TestCase#tearDown()
+ */
+ public void tearDown() throws Exception
+ {
+ super.tearDown();
+ removeTestFiles();
+ }
+
public void testComponent()
throws Exception
{
@@ -129,6 +138,22 @@
dumpCache(cache.getIterator());
+ // Reload files array to get the files back in the correct order
+ // because the cache CAN have reordered them while evicting.
+ // This can happen if test files where left over from a previous
+ // test which then will have an older timestamp.
+ // In that case it is NOT garanteed that files[18] below will still
+ // be in the cache!
+ // Note: this is only an issue for the test itself and not for the
+ // cache as such.
+
+ Iterator it = cache.getIterator();
+ for ( int ix = 0; it.hasNext(); ix++ )
+ {
+ FileCacheEntry entry = (FileCacheEntry) it.next();
+ files[ix] = entry.getFile();
+ }
+
String stuff = (String) cache.getDocument(files[18].getCanonicalPath());
assertNotNull(stuff);
@@ -169,7 +194,8 @@
{
String testFile = "./test/testdata/psml/user/cachetest/testFile-" + ix + ".psml";
File file = new File(testFile);
- file.delete();
+ if ( file.exists() )
+ file.delete();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org