You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by "Ross Laidlaw (JIRA)" <ji...@apache.org> on 2014/08/06 08:17:12 UTC

[jira] [Updated] (OODT-739) Fix File Manager Unit Tests - 'metadata' and 'versioning' Packages

     [ https://issues.apache.org/jira/browse/OODT-739?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ross Laidlaw updated OODT-739:
------------------------------

    Attachment: OODT-739.fix-metadata-and-versioning-tests.rlaidlaw.2014-08-05.patch.txt

Since these are trivial changes, I've committed the patch in r1616106.  I've tested the changes locally and all seem ok.  If anything unexpected happens during the Jenkins build, I'll revert the commit.

> 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)