Changeset 6159


Ignore:
Timestamp:
04/21/10 10:16:10 (10 years ago)
Author:
melissa
Message:

Added tests for Dichroic, Filter, FilterSet, and OTF.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/ome-xml/test/ome/xml/utests/InOut201004Test.java

    r6158 r6159  
    5757 
    5858import ome.xml.r201004.Channel; 
     59import ome.xml.r201004.Dichroic; 
    5960import ome.xml.r201004.Detector; 
     61import ome.xml.r201004.Filter; 
     62import ome.xml.r201004.FilterSet; 
    6063import ome.xml.r201004.Image; 
    6164import ome.xml.r201004.Instrument; 
     
    6366import ome.xml.r201004.MetadataOnly; 
    6467import ome.xml.r201004.OME; 
     68import ome.xml.r201004.OTF; 
    6569import ome.xml.r201004.Pixels; 
    6670import ome.xml.r201004.Plate; 
     
    7377import ome.xml.r201004.enums.DimensionOrder; 
    7478import ome.xml.r201004.enums.EnumerationException; 
     79import ome.xml.r201004.enums.FilterType; 
    7580import ome.xml.r201004.enums.LaserType; 
    7681import ome.xml.r201004.enums.NamingConvention; 
     
    103108  private static String LIGHTSOURCE_ID = "LightSource:0"; 
    104109 
     110  private static String DICHROIC_ID = "Dichroic:0"; 
     111 
     112  private static String FILTERSET_ID = "FilterSet:0"; 
     113 
     114  private static String EM_FILTER_ID = "Filter:0"; 
     115 
     116  private static String EX_FILTER_ID = "Filter:1"; 
     117 
     118  private static String OTF_ID = "OTF:0"; 
     119 
    105120  private static String PLATE_ID = "Plate:0"; 
    106121 
     
    124139 
    125140  private static final String LIGHTSOURCE_MODEL = "ReallyBright!"; 
     141 
     142  private static final String DICHROIC_SN = "0123456789"; 
     143 
     144  private static final String FILTERSET_LOT = "RandomLot"; 
     145 
     146  private static final FilterType EM_FILTER_TYPE = FilterType.LONGPASS; 
     147 
     148  private static final FilterType EX_FILTER_TYPE = FilterType.NEUTRALDENSITY; 
     149 
     150  private static final PixelType OTF_PIXELTYPE = PixelType.FLOAT; 
    126151 
    127152  private static final Double LIGHTSOURCE_POWER = 1000.0; 
     
    246271    assertEquals(LIGHTSOURCE_POWER, laser.getPower()); 
    247272    assertEquals(LASER_TYPE, laser.getType()); 
     273  } 
     274 
     275  @Test(dependsOnMethods={"testValidInstrumentNode"}) 
     276  public void testValidDichroicNode() { 
     277    Dichroic dichroic = ome.getInstrument(0).getDichroic(0); 
     278    assertNotNull(dichroic); 
     279    assertEquals(DICHROIC_ID, dichroic.getID()); 
     280    assertEquals(DICHROIC_SN, dichroic.getSerialNumber()); 
     281  } 
     282 
     283  @Test(dependsOnMethods={"testValidDichroicNode"}) 
     284  public void testValidFilterSetNode() { 
     285    Dichroic dichroic = ome.getInstrument(0).getDichroic(0); 
     286    assertEquals(1, dichroic.sizeOfFilterSetList()); 
     287    FilterSet filterSet = dichroic.getFilterSet(0); 
     288    assertNotNull(filterSet); 
     289    assertEquals(FILTERSET_ID, filterSet.getID()); 
     290    assertEquals(FILTERSET_LOT, filterSet.getLotNumber()); 
     291    assertEquals(filterSet.getLinkedDichroic(0).getID(), dichroic.getID()); 
     292  } 
     293 
     294  @Test(dependsOnMethods={"testValidFilterSetNode"}) 
     295  public void testValidEmissionFilter() { 
     296    Filter emFilter = ome.getInstrument(0).getFilter(0); 
     297    assertNotNull(emFilter); 
     298    assertEquals(EM_FILTER_ID, emFilter.getID()); 
     299    assertEquals(EM_FILTER_TYPE, emFilter.getType()); 
     300    FilterSet filterSet = ome.getInstrument(0).getDichroic(0).getFilterSet(0); 
     301    assertEquals(EM_FILTER_ID, filterSet.getLinkedEmissionFilter(0).getID()); 
     302  } 
     303 
     304  @Test(dependsOnMethods={"testValidFilterSetNode"}) 
     305  public void testValidExcitationFilter() { 
     306    Filter exFilter = ome.getInstrument(0).getFilter(1); 
     307    assertNotNull(exFilter); 
     308    assertEquals(EX_FILTER_ID, exFilter.getID()); 
     309    assertEquals(EX_FILTER_TYPE, exFilter.getType()); 
     310    FilterSet filterSet = ome.getInstrument(0).getDichroic(0).getFilterSet(0); 
     311    assertEquals(EX_FILTER_ID, filterSet.getLinkedExcitationFilter(0).getID()); 
     312  } 
     313 
     314  @Test(dependsOnMethods={"testValidFilterSetNode"}) 
     315  public void testValidOTF() { 
     316    OTF otf = ome.getInstrument(0).getDichroic(0).getFilterSet(0).getOTF(0); 
     317    assertNotNull(otf); 
     318    assertEquals(OTF_ID, otf.getID()); 
     319    assertEquals(OTF_PIXELTYPE, otf.getType()); 
    248320  } 
    249321 
     
    364436    instrument.addLightSource(laser); 
    365437 
     438    // Create <Dichroic/> under <Instrument/> 
     439    Dichroic dichroic = new Dichroic(); 
     440    dichroic.setID(DICHROIC_ID); 
     441    dichroic.setSerialNumber(DICHROIC_SN); 
     442    // Create <FilterSet/> under <Dichroic/> 
     443    FilterSet filterSet = new FilterSet(); 
     444    filterSet.setID(FILTERSET_ID); 
     445    filterSet.setLotNumber(FILTERSET_LOT); 
     446    filterSet.linkDichroic(dichroic); 
     447 
     448    Filter emFilter = new Filter(); 
     449    Filter exFilter = new Filter(); 
     450    OTF otf = new OTF(); 
     451 
     452    emFilter.setID(EM_FILTER_ID); 
     453    emFilter.setType(EM_FILTER_TYPE); 
     454    exFilter.setID(EX_FILTER_ID); 
     455    exFilter.setType(EX_FILTER_TYPE); 
     456    otf.setID(OTF_ID); 
     457    otf.setType(OTF_PIXELTYPE); 
     458 
     459    instrument.addFilter(emFilter); 
     460    instrument.addFilter(exFilter); 
     461    instrument.addOTF(otf); 
     462 
     463    filterSet.linkEmissionFilter(emFilter); 
     464    filterSet.linkExcitationFilter(exFilter); 
     465    filterSet.addOTF(otf); 
     466    instrument.addFilterSet(filterSet); 
     467    dichroic.addFilterSet(filterSet); 
     468    instrument.addDichroic(dichroic); 
     469 
    366470    // link Instrument to the first Image 
    367471    Image image = ome.getImage(0); 
Note: See TracChangeset for help on using the changeset viewer.