Changeset 6860


Ignore:
Timestamp:
09/01/10 10:17:59 (9 years ago)
Author:
callan
Message:

Added a test case (and re-organized some of the mock infrastructure) for basic use.

Location:
trunk/components/bio-formats
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats/src/loci/formats/in/OMEXMLReader.java

    r6836 r6860  
    148148 
    149149    while (!foundBinData) { 
     150      System.err.println(String.format( 
     151          "in.read(..., %d, %d)", overlap, check.length - overlap)); 
    150152      int r = in.read(check, overlap, check.length - overlap); 
    151153      if (r <= 0) throw new IOException("Cannot read from input stream"); 
  • trunk/components/bio-formats/test/loci/formats/utests/SPWModelMock.java

    r6841 r6860  
    100100 * <a href="https://skyking.microscopy.wisc.edu/svn/java/trunk/components/bio-formats/test/ome/xml/utests/SPWModelMock.java">SVN</a></dd></dl> 
    101101 */ 
    102 public class SPWModelMock { 
     102public class SPWModelMock implements ModelMock { 
    103103 
    104104  private OME ome; 
     
    208208 
    209209  public static final NamingConvention WELL_COL = NamingConvention.NUMBER; 
    210    
     210 
    211211  public static final String PLANE = 
    212212    "ZrXEfwslJ9N1nDrbtxxWh4fRHo4w8nZ2N0I74Lgj9oIKN9qrPbBK24z+w+9zYzRQ" + 
     
    237237  /** XML namespace. */ 
    238238  public static final String XML_NS = 
    239     "http://www.openmicroscopy.org/Schemas/OME/2010-04"; 
     239    "http://www.openmicroscopy.org/Schemas/OME/2010-06"; 
    240240 
    241241  /** XSI namespace. */ 
     
    245245  /** XML schema location. */ 
    246246  public static final String SCHEMA_LOCATION = 
    247     "http://www.openmicroscopy.org/Schemas/OME/2010-04/ome.xsd"; 
     247    "http://www.openmicroscopy.org/Schemas/OME/2010-06/ome.xsd"; 
    248248 
    249249  public SPWModelMock(boolean makeLightSources) { 
  • trunk/components/bio-formats/test/loci/formats/utests/SPWModelReaderTest.java

    r6841 r6860  
    8585  } 
    8686 
    87   private void writeMockToFile(SPWModelMock mock, File file) throws Exception { 
     87  /** 
     88   * Writes a model mock to a file as XML. 
     89   * @param mock Mock to build a DOM tree of and serialize to XML. 
     90   * @param file File to write serialized XML to. 
     91   * @throws Exception If there is an error writing the XML to the file. 
     92   */ 
     93  public static void writeMockToFile(ModelMock mock, File file) 
     94  throws Exception { 
    8895    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 
    8996    DocumentBuilder parser = factory.newDocumentBuilder(); 
     
    135142  } 
    136143 
    137   private boolean canReadEveryPlane(IFormatReader reader) throws Exception { 
     144  /** 
     145   * Checks to see if every plane of an initialized reader can be read. 
     146   * @param reader Reader to read all planes from. 
     147   * @return <code>true</code> if all planes can be read, <code>false</code> 
     148   * otherwise. 
     149   * @throws Exception If there is an error reading data. 
     150   */ 
     151  public static boolean canReadEveryPlane(IFormatReader reader) 
     152  throws Exception { 
    138153    int sizeX = reader.getSizeX(); 
    139154    int sizeY = reader.getSizeY(); 
     
    160175          throw new RuntimeException(e); 
    161176        } 
     177        System.err.println(String.format("%d/%d", i, j)); 
    162178      } 
    163179    } 
     
    181197   * @return the number of bytes per pixel. 
    182198   */ 
    183   private int getBytesPerPixel(int type) { 
     199  public static int getBytesPerPixel(int type) { 
    184200    switch(type) { 
    185201    case 0: 
  • trunk/components/bio-formats/test/loci/formats/utests/testng.xml

    r6839 r6860  
    7474      </classes> 
    7575    </test> 
    76     <test name="SPWModel"> 
     76    <test name="ModelMockReader"> 
    7777      <groups/> 
    7878      <classes> 
    7979        <class name="loci.formats.utests.SPWModelReaderTest"/> 
     80        <class name="loci.formats.utests.BaseModelReaderTest"/> 
    8081      </classes> 
    8182    </test> 
Note: See TracChangeset for help on using the changeset viewer.