Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
0.7
-
Don't Know (Unsure) - The default level
Description
This patch updates test classes in the metadata.extractors and versioning packages in File Manager.
For example, I replaced constructors such as:
public TestAcquisitionDateVersioner() { System.setProperty("org.apache.oodt.cas.filemgr.mime.type.repository", new File("./src/main/resources/mime-types.xml").getAbsolutePath()); }
...with setUp and tearDown methods that use Properties objects to save/restore System properties, and URLs to retrieve paths to resources (similar to the other patches for sub-tasks under OODT-685).
private Properties initialProperties = new Properties(System.getProperties()); public void setUp() throws Exception { Properties properties = new Properties(System.getProperties()); URL url = this.getClass().getResource("/mime-types.xml"); properties.setProperty("org.apache.oodt.cas.filemgr.mime.type.repository", new File(url.getFile()).getAbsolutePath()); System.setProperties(properties); } public void tearDown() throws Exception { System.setProperties(initialProperties); }
Before and after applying the patch, all tests passed in metadata and versioning. I'm not sure if it will help, but I was thinking that by doing this it might reduce the chance of side-effects for other tests if we reset the System properties (depending on how we're running the tests I guess).