Changeset 2642


Ignore:
Timestamp:
04/19/07 09:52:56 (13 years ago)
Author:
melissa
Message:

Added test to check for valid OME-XML.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/formats/test/ReaderTest.java

    r2601 r2642  
    6161 
    6262  private static boolean writeConfigFiles = false; 
     63  private static boolean testXML = false;  
    6364  private static float timeMultiplier = 1f; 
    6465 
     
    608609  } 
    609610 
     611  /** Tests that OME-XML is valid. */ 
     612  public void testValidXML() { 
     613    try {  
     614      OMEXMLMetadataStore store = new OMEXMLMetadataStore(); 
     615      store.createRoot(); 
     616      reader.setMetadataStore(store); 
     617      reader.setId(id); 
     618     
     619      String xml = ((OMEXMLMetadataStore) reader.getMetadataStore()).dumpXML();  
     620      if (xml == null) writeLog(id + " failed OME-XML validation");  
     621      assertTrue(xml != null);  
     622    } 
     623    catch (Exception e) { 
     624      writeLog(id + " failed OME-XML validation");  
     625      e.printStackTrace();  
     626      assertTrue(false); 
     627    } 
     628  } 
     629 
    610630  // -- TestCase API methods -- 
    611631 
     
    641661  public static TestSuite suite(String id) { 
    642662    TestSuite suite = new TestSuite(); 
    643     suite.addTest(new ReaderTest("testBufferedImageDimensions", id)); 
    644     if (!writeConfigFiles) { 
    645       suite.addTest(new ReaderTest("testByteArrayDimensions", id)); 
    646       suite.addTest(new ReaderTest("testThumbnailImageDimensions", id)); 
    647       suite.addTest(new ReaderTest("testThumbnailArrayDimensions", id)); 
    648       suite.addTest(new ReaderTest("testImageCount", id)); 
    649       suite.addTest(new ReaderTest("testOMEXML", id)); 
    650       suite.addTest(new ReaderTest("testSaneUsedFiles", id)); 
    651     } 
    652     if (config.initialized(id) || writeConfigFiles) { 
    653       suite.addTest(new ReaderTest("testConsistent", id)); 
    654     } 
    655     if (config.initialized(id) && !writeConfigFiles) { 
    656       suite.addTest(new ReaderTest("testMemoryUsage", id)); 
    657       suite.addTest(new ReaderTest("testAccessTime", id)); 
     663    if (testXML) suite.addTest(new ReaderTest("testValidXML", id)); 
     664    else {  
     665      suite.addTest(new ReaderTest("testBufferedImageDimensions", id)); 
     666      if (!writeConfigFiles) { 
     667        suite.addTest(new ReaderTest("testByteArrayDimensions", id)); 
     668        suite.addTest(new ReaderTest("testThumbnailImageDimensions", id)); 
     669        suite.addTest(new ReaderTest("testThumbnailArrayDimensions", id)); 
     670        suite.addTest(new ReaderTest("testImageCount", id)); 
     671        suite.addTest(new ReaderTest("testOMEXML", id)); 
     672        suite.addTest(new ReaderTest("testSaneUsedFiles", id)); 
     673        suite.addTest(new ReaderTest("testValidXML", id));  
     674      } 
     675      if (config.initialized(id) || writeConfigFiles) { 
     676        suite.addTest(new ReaderTest("testConsistent", id)); 
     677      } 
     678      if (config.initialized(id) && !writeConfigFiles) { 
     679        suite.addTest(new ReaderTest("testMemoryUsage", id)); 
     680        suite.addTest(new ReaderTest("testAccessTime", id)); 
     681      } 
    658682    } 
    659683    return suite; 
     
    762786        if (args[i].equals("-config")) ReaderTest.writeConfigFiles = true; 
    763787        else if (args[i].equals("-debug")) FormatReader.setDebug(true); 
     788        else if (args[i].equals("-xmlonly")) ReaderTest.testXML = true;  
    764789        else if (args[i].equals("-time")) { 
    765790          ReaderTest.timeMultiplier = Float.parseFloat(args[i+1]); 
Note: See TracChangeset for help on using the changeset viewer.