Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 331117 - [Tests] Leverage tests for other files systems basing on FileSystemTest
Summary: [Tests] Leverage tests for other files systems basing on FileSystemTest
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Tomasz Zarna CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-25 07:20 EST by Tomasz Zarna CLA
Modified: 2010-12-22 06:31 EST (History)
2 users (show)

See Also:
Szymon.Brandys: review+


Attachments
Patch for org.eclipse.core.tests.resources (1.56 KB, patch)
2010-11-25 07:20 EST, Tomasz Zarna CLA
no flags Details | Diff
Somce changes in the proposal (2.39 KB, patch)
2010-12-21 20:22 EST, Szymon Brandys CLA
no flags Details | Diff
Szymon's patch with the suggestion about subclassing (2.73 KB, patch)
2010-12-22 06:13 EST, Tomasz Zarna CLA
no flags Details | Diff
mylyn/context/zip (20.58 KB, application/octet-stream)
2010-12-22 06:13 EST, Tomasz Zarna CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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.