Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 331117

Summary: [Tests] Leverage tests for other files systems basing on FileSystemTest
Product: [Eclipse Project] Platform Reporter: Tomasz Zarna <tomasz.zarna>
Component: ResourcesAssignee: Tomasz Zarna <tomasz.zarna>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jamesblackburn+eclipse, Szymon.Brandys
Version: 3.7Flags: Szymon.Brandys: review+
Target Milestone: 3.7 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch for org.eclipse.core.tests.resources
none
Somce changes in the proposal
none
Szymon's patch with the suggestion about subclassing
none
mylyn/context/zip none

Description Tomasz Zarna CLA 2010-11-25 07:20:35 EST
Created attachment 183845 [details]
Patch for org.eclipse.core.tests.resources

FileSystemTest is a base class for CreateDirectoryTest, DeleteTest, OpenOutputStreamTest and PutInfoTest which all can be use to test file systems other then "mem". 

I managed to reuse the tests by adding 3 simple methods to FileSystemTest :
* getFileStoreUri, to provide URI for your fs
* fileSystemSetUp, to setup your fs
* fileSystemTearDown, to cleanup when done

A better approach would be to create an abstract class with these methods + add a default implementation for the "mem" fs. But is that really necessary?
Comment 1 Szymon Brandys CLA 2010-12-21 20:22:54 EST
Created attachment 185686 [details]
Somce changes in the proposal

I think we can simplify the code a bit.
Comment 2 Tomasz Zarna CLA 2010-12-22 05:38:26 EST
Fine with me, the only thing I would change is the comment for doFSSetUp()/doFSTearDown() methods and suggest to override the methods to test a different FS. A setup/cleanup for a custom FS shouldn't be made by modifying org.eclipse.core.tests.filesystem.FileSystemTest as one may understand the current comment.
Comment 3 Szymon Brandys CLA 2010-12-22 05:48:58 EST
Please attach a patch with suggested changes and I will commit it.
Comment 4 Tomasz Zarna CLA 2010-12-22 06:13:20 EST
Created attachment 185689 [details]
Szymon's patch with the suggestion about subclassing
Comment 5 Tomasz Zarna CLA 2010-12-22 06:13:22 EST
Created attachment 185690 [details]
mylyn/context/zip
Comment 6 Szymon Brandys CLA 2010-12-22 06:31:54 EST
The fix committed to HEAD.