Changeset 6212


Ignore:
Timestamp:
05/03/10 09:44:31 (10 years ago)
Author:
callan
Message:

Test case updates from Andrew.

Location:
trunk/components/ome-xml/test/ome/xml/utests
Files:
2 edited

Legend:

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

    r6209 r6212  
    5959 
    6060import ome.xml.r201004.Annotation; 
     61import ome.xml.r201004.Arc; 
    6162import ome.xml.r201004.BinaryFile; 
    6263import ome.xml.r201004.BooleanAnnotation; 
    6364import ome.xml.r201004.DoubleAnnotation; 
    6465import ome.xml.r201004.External; 
     66import ome.xml.r201004.Filament; 
     67import ome.xml.r201004.LightEmittingDiode; 
    6568import ome.xml.r201004.LongAnnotation; 
    6669import ome.xml.r201004.OMEModel; 
     
    9396import ome.xml.r201004.Well; 
    9497import ome.xml.r201004.WellSample; 
     98import ome.xml.r201004.enums.ArcType; 
    9599import ome.xml.r201004.enums.DimensionOrder; 
    96100import ome.xml.r201004.enums.EnumerationException; 
     101import ome.xml.r201004.enums.FilamentType; 
    97102import ome.xml.r201004.enums.FilterType; 
    98103import ome.xml.r201004.enums.LaserType; 
     
    119124  public static final String IMAGE_ID = "Image:0"; 
    120125 
     126  public static final String GENERAL_ANNOTATION_NAMESPACE = "test-ome-InOut201004-namespace"; 
     127 
    121128  public static final String IMAGE_ANNOTATION_ID = "Annotation:Boolean0"; 
    122129 
     
    131138  public static final String DETECTOR_ID = "Detector:0"; 
    132139 
    133   public static final String LIGHTSOURCE_ID = "LightSource:0"; 
     140  public static final String LIGHTSOURCE_LASER_ID = "LightSource:0"; 
     141 
     142  public static final String LIGHTSOURCE_PUMP_ID = "LightSource:1"; 
     143 
     144  public static final String LIGHTSOURCE_ARC_ID = "LightSource:2"; 
     145 
     146  public static final String LIGHTSOURCE_FILAMENT_ID = "LightSource:3"; 
     147 
     148  public static final String LIGHTSOURCE_LED_ID = "LightSource:4"; 
    134149 
    135150  public static final String DICHROIC_ID = "Dichroic:0"; 
     
    173188  public static final String DETECTOR_MODEL = "ReallySensitive!"; 
    174189 
    175   public static final String LIGHTSOURCE_MODEL = "ReallyBright!"; 
     190  public static final String LIGHTSOURCE_LASER_MODEL = "ReallyBrightLaser!"; 
     191 
     192  public static final String LIGHTSOURCE_PUMP_MODEL = "ReallyBrightPump!"; 
     193 
     194  public static final String LIGHTSOURCE_ARC_MODEL = "ReallyBrightArc!"; 
     195 
     196  public static final String LIGHTSOURCE_FILAMENT_MODEL = "ReallyBrightFilament!"; 
     197 
     198  public static final String LIGHTSOURCE_LED_MODEL = "ReallyBrightLED!"; 
    176199 
    177200  public static final String OBJECTIVE_MODEL = "ReallyClear!"; 
     
    187210  public static final PixelType OTF_PIXELTYPE = PixelType.FLOAT; 
    188211 
    189   public static final Double LIGHTSOURCE_POWER = 1000.0; 
     212  public static final Double LIGHTSOURCE_LASER_POWER = 1000.0; 
     213 
     214  public static final Double LIGHTSOURCE_PUMP_POWER = 100.0; 
     215 
     216  public static final Double LIGHTSOURCE_ARC_POWER = 500.0; 
     217 
     218  public static final Double LIGHTSOURCE_FILAMENT_POWER = 200.0; 
     219 
     220  public static final Double LIGHTSOURCE_LED_POWER = 10.0; 
    190221 
    191222  public static final LaserType LASER_TYPE = LaserType.DYE; 
     223   
     224  public static final ArcType ARC_TYPE = ArcType.HGXE; 
     225 
     226  public static final FilamentType FILAMENT_TYPE = FilamentType.HALOGEN; 
    192227 
    193228  public static final Integer OTF_SIZE_X = 512; 
     
    301336    BooleanAnnotation b = (BooleanAnnotation) n; 
    302337    assertEquals(b.getValue(), IMAGE_ANNOTATION_VALUE); 
     338    assertEquals(b.getNamespace(), GENERAL_ANNOTATION_NAMESPACE); 
    303339    assertEquals(b.getID(), IMAGE_ANNOTATION_ID); 
    304340  } 
     
    333369    assertTrue(n instanceof XMLAnnotation); 
    334370    assertEquals(CHANNEL_ANNOTATION_ID, n.getID()); 
     371    assertEquals(n.getNamespace(), GENERAL_ANNOTATION_NAMESPACE); 
    335372    XMLAnnotation xml = (XMLAnnotation) n; 
    336373    assertEquals(xml.getValue(), CHANNEL_ANNOTATION_VALUE); 
     
    344381    DoubleAnnotation b = (DoubleAnnotation) n; 
    345382    assertEquals(b.getValue(), PIXELS_ANNOTATION_VALUE); 
     383    assertEquals(b.getNamespace(), GENERAL_ANNOTATION_NAMESPACE); 
    346384    assertEquals(b.getID(), PIXELS_ANNOTATION_ID); 
    347385  } 
     
    366404    Laser laser = (Laser) ome.getInstrument(0).getLightSource(0); 
    367405    assertNotNull(laser); 
    368     assertEquals(LIGHTSOURCE_ID, laser.getID()); 
    369     assertEquals(LIGHTSOURCE_MODEL, laser.getModel()); 
    370     assertEquals(LIGHTSOURCE_POWER, laser.getPower()); 
     406    assertEquals(LIGHTSOURCE_LASER_ID, laser.getID()); 
     407    assertEquals(LIGHTSOURCE_LASER_MODEL, laser.getModel()); 
     408    assertEquals(LIGHTSOURCE_LASER_POWER, laser.getPower()); 
    371409    assertEquals(LASER_TYPE, laser.getType()); 
    372410  } 
    373411 
     412  @Test(dependsOnMethods={"testValidLaserNode"}) 
     413  public void testValidPumpNode() { 
     414    Laser laser = (Laser) ome.getInstrument(0).getLightSource(0); 
     415    Laser laserPump = (Laser) ome.getInstrument(0).getLightSource(1); 
     416    assertNotNull(laserPump); 
     417    assertEquals(LIGHTSOURCE_PUMP_ID, laserPump.getID()); 
     418    assertEquals(LIGHTSOURCE_PUMP_MODEL, laserPump.getModel()); 
     419    assertEquals(LIGHTSOURCE_PUMP_POWER, laserPump.getPower()); 
     420    assertEquals(LASER_TYPE, laserPump.getType()); 
     421    assertEquals(laser.getLinkedPump(),laserPump); 
     422  } 
     423 
     424  // Create <Arc/> under <Instrument/> 
     425  @Test(dependsOnMethods={"testValidInstrumentNode"}) 
     426  public void testValidArcNode() { 
     427    Arc arc = (Arc) ome.getInstrument(0).getLightSource(2); 
     428    assertNotNull(arc); 
     429    assertEquals(LIGHTSOURCE_ARC_ID, arc.getID()); 
     430    assertEquals(LIGHTSOURCE_ARC_MODEL, arc.getModel()); 
     431    assertEquals(LIGHTSOURCE_ARC_POWER, arc.getPower()); 
     432    assertEquals(ARC_TYPE, arc.getType()); 
     433  } 
     434   
     435  // Create <Filament/> under <Instrument/> 
     436  @Test(dependsOnMethods={"testValidInstrumentNode"}) 
     437  public void testValidFilamentNode() { 
     438    Filament filament = (Filament) ome.getInstrument(0).getLightSource(3); 
     439    assertNotNull(filament); 
     440    assertEquals(LIGHTSOURCE_FILAMENT_ID, filament.getID()); 
     441    assertEquals(LIGHTSOURCE_FILAMENT_MODEL, filament.getModel()); 
     442    assertEquals(LIGHTSOURCE_FILAMENT_POWER, filament.getPower()); 
     443    assertEquals(FILAMENT_TYPE, filament.getType()); 
     444  } 
     445 
     446  // Create <LightEmittingDiode/> under <Instrument/> 
     447  @Test(dependsOnMethods={"testValidInstrumentNode"}) 
     448  public void testValidLightEmittingDiodeNode() { 
     449    LightEmittingDiode led = (LightEmittingDiode) ome.getInstrument(0).getLightSource(4); 
     450    assertNotNull(led); 
     451    assertEquals(LIGHTSOURCE_LED_ID, led.getID()); 
     452    assertEquals(LIGHTSOURCE_LED_MODEL, led.getModel()); 
     453    assertEquals(LIGHTSOURCE_LED_POWER, led.getPower()); 
     454  } 
     455 
     456   
    374457  @Test(dependsOnMethods={"testValidInstrumentNode"}) 
    375458  public void testValidDichroicNode() { 
     
    484567    assertNotNull(n); 
    485568    assertEquals(PLATE_ANNOTATION_ID, n.getID()); 
     569    assertEquals(n.getNamespace(), GENERAL_ANNOTATION_NAMESPACE); 
    486570    assertTrue(n instanceof TimestampAnnotation); 
    487571    TimestampAnnotation timestamp = (TimestampAnnotation) n; 
     
    515599    assertNotNull(n); 
    516600    assertEquals(WELL_ANNOTATION_ID, n.getID()); 
     601    assertEquals(n.getNamespace(), GENERAL_ANNOTATION_NAMESPACE); 
    517602    assertTrue(n instanceof LongAnnotation); 
    518603    LongAnnotation longAnnotation = (LongAnnotation) n; 
     
    546631    assertNotNull(n); 
    547632    assertEquals(ROI_ANNOTATION_ID, n.getID()); 
     633    assertEquals(n.getNamespace(), GENERAL_ANNOTATION_NAMESPACE); 
    548634    assertTrue(n instanceof StringAnnotation); 
    549635    StringAnnotation string = (StringAnnotation) n; 
  • trunk/components/ome-xml/test/ome/xml/utests/ObjectBasedOMEModelMock.java

    r6209 r6212  
    3535package ome.xml.utests; 
    3636 
     37import ome.xml.r201004.Arc; 
    3738import ome.xml.r201004.BinaryFile; 
    3839import ome.xml.r201004.BooleanAnnotation; 
     
    4243import ome.xml.r201004.DoubleAnnotation; 
    4344import ome.xml.r201004.External; 
     45import ome.xml.r201004.Filament; 
    4446import ome.xml.r201004.Filter; 
    4547import ome.xml.r201004.FilterSet; 
     
    4749import ome.xml.r201004.Instrument; 
    4850import ome.xml.r201004.Laser; 
     51import ome.xml.r201004.LightEmittingDiode; 
    4952import ome.xml.r201004.LongAnnotation; 
    5053import ome.xml.r201004.MetadataOnly; 
     
    103106    annotation.setID(InOut201004Test.IMAGE_ANNOTATION_ID); 
    104107    annotation.setValue(InOut201004Test.IMAGE_ANNOTATION_VALUE); 
     108    annotation.setNamespace(InOut201004Test.GENERAL_ANNOTATION_NAMESPACE); 
    105109    image.linkAnnotation(annotation); 
    106110    annotations.addBooleanAnnotation(annotation); 
     
    124128        channelAnnotation.setID(InOut201004Test.CHANNEL_ANNOTATION_ID); 
    125129        channelAnnotation.setValue(InOut201004Test.CHANNEL_ANNOTATION_VALUE); 
     130        channelAnnotation.setNamespace(InOut201004Test.GENERAL_ANNOTATION_NAMESPACE); 
    126131        channel.linkAnnotation(channelAnnotation); 
    127132        annotations.addXMLAnnotation(channelAnnotation); 
     
    133138    pixelsAnnotation.setID(InOut201004Test.PIXELS_ANNOTATION_ID); 
    134139    pixelsAnnotation.setValue(InOut201004Test.PIXELS_ANNOTATION_VALUE); 
     140    pixelsAnnotation.setNamespace(InOut201004Test.GENERAL_ANNOTATION_NAMESPACE); 
    135141    pixels.linkAnnotation(pixelsAnnotation); 
    136142    annotations.addDoubleAnnotation(pixelsAnnotation); 
     
    151157    // Create <Laser/> under <Instrument/> 
    152158    Laser laser = new Laser(); 
    153     laser.setID(InOut201004Test.LIGHTSOURCE_ID); 
    154     laser.setModel(InOut201004Test.LIGHTSOURCE_MODEL); 
     159    laser.setID(InOut201004Test.LIGHTSOURCE_LASER_ID); 
     160    laser.setModel(InOut201004Test.LIGHTSOURCE_LASER_MODEL); 
    155161    laser.setType(InOut201004Test.LASER_TYPE); 
    156     laser.setPower(InOut201004Test.LIGHTSOURCE_POWER); 
     162    laser.setPower(InOut201004Test.LIGHTSOURCE_LASER_POWER); 
     163    // with a <Pump/> 
     164    Laser laserPump = new Laser(); 
     165    laserPump.setID(InOut201004Test.LIGHTSOURCE_PUMP_ID); 
     166    laserPump.setModel(InOut201004Test.LIGHTSOURCE_PUMP_MODEL); 
     167    laserPump.setType(InOut201004Test.LASER_TYPE); 
     168    laserPump.setPower(InOut201004Test.LIGHTSOURCE_PUMP_POWER); 
     169     
     170    laser.linkPump(laserPump); 
     171     
    157172    instrument.addLightSource(laser); 
     173    instrument.addLightSource(laserPump); 
     174     
     175    // Create <Arc/> under <Instrument/> 
     176    Arc arc = new Arc(); 
     177    arc.setID(InOut201004Test.LIGHTSOURCE_ARC_ID); 
     178    arc.setModel(InOut201004Test.LIGHTSOURCE_ARC_MODEL); 
     179    arc.setType(InOut201004Test.ARC_TYPE); 
     180    arc.setPower(InOut201004Test.LIGHTSOURCE_ARC_POWER); 
     181    instrument.addLightSource(arc); 
     182     
     183    // Create <Filament/> under <Instrument/> 
     184    Filament filament = new Filament(); 
     185    filament.setID(InOut201004Test.LIGHTSOURCE_FILAMENT_ID); 
     186    filament.setModel(InOut201004Test.LIGHTSOURCE_FILAMENT_MODEL); 
     187    filament.setType(InOut201004Test.FILAMENT_TYPE); 
     188    filament.setPower(InOut201004Test.LIGHTSOURCE_FILAMENT_POWER); 
     189    instrument.addLightSource(filament); 
     190 
     191    // Create <LightEmittingDiode/> under <Instrument/> 
     192    LightEmittingDiode led = new LightEmittingDiode(); 
     193    led.setID(InOut201004Test.LIGHTSOURCE_LED_ID); 
     194    led.setModel(InOut201004Test.LIGHTSOURCE_LED_MODEL); 
     195    led.setPower(InOut201004Test.LIGHTSOURCE_LED_POWER); 
     196    instrument.addLightSource(led); 
    158197 
    159198    // Create <Dichroic/> under <Instrument/> 
     
    228267    plateAnnotation.setID(InOut201004Test.PLATE_ANNOTATION_ID); 
    229268    plateAnnotation.setValue(InOut201004Test.PLATE_ANNOTATION_VALUE); 
     269    plateAnnotation.setNamespace(InOut201004Test.GENERAL_ANNOTATION_NAMESPACE); 
    230270    plate.linkAnnotation(plateAnnotation); 
    231271    annotations.addTimestampAnnotation(plateAnnotation); 
     
    243283          annotation.setID(InOut201004Test.WELL_ANNOTATION_ID); 
    244284          annotation.setValue(InOut201004Test.WELL_ANNOTATION_VALUE); 
     285          annotation.setNamespace(InOut201004Test.GENERAL_ANNOTATION_NAMESPACE); 
    245286          well.linkAnnotation(annotation); 
    246287          annotations.addLongAnnotation(annotation); 
     
    267308    roiAnnotation.setID(InOut201004Test.ROI_ANNOTATION_ID); 
    268309    roiAnnotation.setValue(InOut201004Test.ROI_ANNOTATION_VALUE); 
     310    roiAnnotation.setNamespace(InOut201004Test.GENERAL_ANNOTATION_NAMESPACE); 
    269311    roi.linkAnnotation(roiAnnotation); 
    270312    annotations.addStringAnnotation(roiAnnotation); 
Note: See TracChangeset for help on using the changeset viewer.