Re: [xwiki-devs] [xwiki-notifications] r17898 - platform/core/trunk/xwiki-officeimporter/src/test/java/org/xwiki/officeimporter/internal
On Mar 23, 2009, at 6:52 AM, asiri (SVN) wrote:
Author: asiri Date: 2009-03-23 06:52:52 +0100 (Mon, 23 Mar 2009) New Revision: 17898
Modified: platform/core/trunk/xwiki-officeimporter/src/test/java/org/xwiki/ officeimporter/internal/OfficeImporterFileStorageTest.java Log: XWIKI-3406: Office Importer not working under windows environments
* Forgot to cleanup the temporary storage.
Modified: platform/core/trunk/xwiki-officeimporter/src/test/java/org/ xwiki/officeimporter/internal/OfficeImporterFileStorageTest.java =================================================================== --- platform/core/trunk/xwiki-officeimporter/src/test/java/org/xwiki/ officeimporter/internal/OfficeImporterFileStorageTest.java 2009-03-23 05:50:34 UTC (rev 17897) +++ platform/core/trunk/xwiki-officeimporter/src/test/java/org/xwiki/ officeimporter/internal/OfficeImporterFileStorageTest.java 2009-03-23 05:52:52 UTC (rev 17898) @@ -45,5 +45,6 @@ { OfficeImporterFileStorage storage = new OfficeImporterFileStorage("Temp/\\:*?\"<>|Dir"); assertEquals("Temp---------Dir", storage.getTempDir().getName()); + storage.cleanUp();
There's no guarantee that this will be called. Imagine if there's an exception for example. You should do cleaning in tearDown(). Shouldn't it be the code under test that should do the cleaning in this case? Thanks -Vincent
Hi, On Mon, Mar 23, 2009 at 1:47 PM, Vincent Massol <[email protected]> wrote:
On Mar 23, 2009, at 6:52 AM, asiri (SVN) wrote:
Author: asiri Date: 2009-03-23 06:52:52 +0100 (Mon, 23 Mar 2009) New Revision: 17898
Modified: platform/core/trunk/xwiki-officeimporter/src/test/java/org/xwiki/ officeimporter/internal/OfficeImporterFileStorageTest.java Log: XWIKI-3406: Office Importer not working under windows environments
* Forgot to cleanup the temporary storage.
Modified: platform/core/trunk/xwiki-officeimporter/src/test/java/org/ xwiki/officeimporter/internal/OfficeImporterFileStorageTest.java =================================================================== --- platform/core/trunk/xwiki-officeimporter/src/test/java/org/xwiki/ officeimporter/internal/OfficeImporterFileStorageTest.java 2009-03-23 05:50:34 UTC (rev 17897) +++ platform/core/trunk/xwiki-officeimporter/src/test/java/org/xwiki/ officeimporter/internal/OfficeImporterFileStorageTest.java 2009-03-23 05:52:52 UTC (rev 17898) @@ -45,5 +45,6 @@ { OfficeImporterFileStorage storage = new OfficeImporterFileStorage("Temp/\\:*?\"<>|Dir"); assertEquals("Temp---------Dir", storage.getTempDir().getName()); + storage.cleanUp();
There's no guarantee that this will be called. Imagine if there's an exception for example. You should do cleaning in tearDown().
I didn't pay much attention to cleaning in this case. But in the code what I did is to use a finally clause to perform the cleaning, which is guaranteed to execute always (except for jvm exit). I could do the same here. (or in the tearDown() as you suggested).
Shouldn't it be the code under test that should do the cleaning in this case?
I do not understand what you mean here. Did you mean that I should test proper cleaning of temporary files? Thanks. - Asiri
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (2)
-
Asiri Rathnayake -
Vincent Massol