Uploaded image for project: 'OODT'
  1. OODT
  2. OODT-685 Fix OODT 0.7-SNAPSHOT Jenkins nightly build on Ubuntu
  3. OODT-739

Fix File Manager Unit Tests - 'metadata' and 'versioning' Packages

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.7
    • Fix Version/s: 0.7
    • Component/s: file manager
    • Labels:
    • Skill Level:
      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).

        Attachments

          Activity

            People

            • Assignee:
              rlaidlaw Ross Laidlaw
              Reporter:
              rlaidlaw Ross Laidlaw
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: