[
https://issues.apache.org/jira/browse/OODT-739?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ross Laidlaw resolved OODT-739.
-------------------------------
Resolution: Fixed
Jenkins build 1434 ran as expected for the metadata and versioning tests (no
failures introduced by this patch).
> 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
> Labels: patch, test
> Fix For: 0.7
>
> Attachments:
> OODT-739.fix-metadata-and-versioning-tests.rlaidlaw.2014-08-05.patch.txt
>
>
> 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)