Ross Laidlaw created OODT-739:
---------------------------------
Summary: Fix File Manager Unit Tests - 'metadata' and 'versioning'
Packages
Key: OODT-739
URL: https://issues.apache.org/jira/browse/OODT-739
Project: OODT
Issue Type: Sub-task
Components: file manager
Affects Versions: 0.7
Reporter: Ross Laidlaw
Assignee: Ross Laidlaw
Fix For: 0.7
This patch updates test classes in the metadata.extractors and versioning
packages in File Manager.
For example, I replaced constructors such as:
{noformat}
public TestAcquisitionDateVersioner() {
System.setProperty("org.apache.oodt.cas.filemgr.mime.type.repository",
new File("./src/main/resources/mime-types.xml").getAbsolutePath());
}
{noformat}
...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).
{noformat}
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);
}
{noformat}
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).
--
This message was sent by Atlassian JIRA
(v6.2#6252)