Changeset 6213


Ignore:
Timestamp:
05/03/10 10:32:03 (10 years ago)
Author:
callan
Message:

IMetadata getter test cases.

File:
1 edited

Legend:

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

    r6212 r6213  
    5858import static org.testng.AssertJUnit.*; 
    5959 
     60import ome.xml.OMEXMLMetadataImpl; 
    6061import ome.xml.r201004.Annotation; 
    6162import ome.xml.r201004.Arc; 
     
    292293  public OMEModel model; 
    293294 
     295  public OMEXMLMetadataImpl metadata; 
     296 
    294297  @Parameters({"mockClassName"}) 
    295298  @BeforeClass 
     
    322325  } 
    323326 
     327  @Test 
     328  public void testValidMetadataRoot() { 
     329    metadata = new OMEXMLMetadataImpl(); 
     330    metadata.setRoot(ome); 
     331    assertEquals(ome, metadata.getRoot()); 
     332  } 
     333 
    324334  @Test(dependsOnMethods={"testValidOMENode"}) 
    325335  public void testValidImageNode() { 
     
    327337    assertNotNull(image); 
    328338    assertEquals(IMAGE_ID, image.getID()); 
     339  } 
     340 
     341  @Test(dependsOnMethods={"testValidMetadataRoot"}) 
     342  public void testValidImageMetadata() { 
     343    assertEquals(1, metadata.getImageCount()); 
     344    assertEquals(IMAGE_ID, metadata.getImageID(0)); 
    329345  } 
    330346 
     
    338354    assertEquals(b.getNamespace(), GENERAL_ANNOTATION_NAMESPACE); 
    339355    assertEquals(b.getID(), IMAGE_ANNOTATION_ID); 
     356  } 
     357 
     358  @Test(dependsOnMethods={"testValidImageMetadata"}) 
     359  public void testValidImageAnnotationMetadata() { 
     360    assertEquals(1, metadata.getBooleanAnnotationCount()); 
     361    assertEquals(1, metadata.getImageAnnotationRefCount(0)); 
     362    assertEquals(IMAGE_ANNOTATION_VALUE, metadata.getBooleanAnnotationValue(0)); 
     363    assertEquals(GENERAL_ANNOTATION_NAMESPACE, 
     364                 metadata.getBooleanAnnotationNamespace(0)); 
     365    assertEquals(IMAGE_ANNOTATION_ID, metadata.getBooleanAnnotationID(0)); 
    340366  } 
    341367 
     
    353379  } 
    354380 
     381  @Test(dependsOnMethods={"testValidImageNode"}) 
     382  public void testValidPixelsMetadata() { 
     383    assertEquals(SIZE_X, metadata.getPixelsSizeX(0).getValue()); 
     384    assertEquals(SIZE_Y, metadata.getPixelsSizeY(0).getValue()); 
     385    assertEquals(SIZE_Z, metadata.getPixelsSizeZ(0).getValue()); 
     386    assertEquals(SIZE_C, metadata.getPixelsSizeC(0).getValue()); 
     387    assertEquals(SIZE_T, metadata.getPixelsSizeT(0).getValue()); 
     388    assertEquals(DIMENSION_ORDER, metadata.getPixelsDimensionOrder(0)); 
     389    assertEquals(PIXEL_TYPE, metadata.getPixelsType(0)); 
     390  } 
     391 
    355392  @Test(dependsOnMethods={"testValidPixelsNode"}) 
    356393  public void testValidChannelNode() { 
     
    359396    for (Channel channel : pixels.copyChannelList()) { 
    360397      assertNotNull(channel.getID()); 
     398    } 
     399  } 
     400 
     401  @Test(dependsOnMethods={"testValidPixelsMetadata"}) 
     402  public void testValidChannelMetadata() { 
     403    assertEquals(3, metadata.getChannelCount(0)); 
     404    for (int i = 0; i < 3; i++) { 
     405      assertNotNull(metadata.getChannelID(0, i)); 
    361406    } 
    362407  } 
     
    385430  } 
    386431 
     432  @Test(dependsOnMethods={"testValidPixelsMetadata"}) 
     433  public void testValidPixelsAnnotationMetadata() { 
     434    assertEquals(1, metadata.getDoubleAnnotationCount()); 
     435    assertEquals(1, metadata.getPixelsAnnotationRefCount(0)); 
     436    assertEquals(PIXELS_ANNOTATION_VALUE, 
     437                 metadata.getDoubleAnnotationValue(0)); 
     438    assertEquals(GENERAL_ANNOTATION_NAMESPACE, 
     439                 metadata.getDoubleAnnotationNamespace(0)); 
     440    assertEquals(PIXELS_ANNOTATION_ID, metadata.getDoubleAnnotationID(0)); 
     441  } 
     442 
    387443  @Test(dependsOnMethods={"testValidOMENode"}) 
    388444  public void testValidInstrumentNode() { 
     
    390446    assertNotNull(instrument); 
    391447    assertEquals(INSTRUMENT_ID, instrument.getID()); 
     448  } 
     449 
     450  @Test(dependsOnMethods={"testValidMetadataRoot"}) 
     451  public void testValidInstrumentMetadata() { 
     452    assertEquals(1, metadata.getInstrumentCount()); 
     453    assertEquals(INSTRUMENT_ID, metadata.getInstrumentID(0)); 
     454    // FIXME: Missing method 
     455    //assertEquals(5, metadata.getLightSourceCount(0)); 
     456    assertEquals(1, metadata.getDetectorCount(0)); 
     457    assertEquals(2, metadata.getFilterCount(0)); 
    392458  } 
    393459 
     
    398464    assertEquals(DETECTOR_ID, detector.getID()); 
    399465    assertEquals(DETECTOR_MODEL, detector.getModel()); 
     466  } 
     467 
     468  @Test(dependsOnMethods={"testValidInstrumentMetadata"}) 
     469  public void testValidDetectorMetadata() { 
     470    assertEquals(1, metadata.getDetectorCount(0)); 
     471    assertEquals(DETECTOR_ID, metadata.getDetectorID(0, 0)); 
     472    assertEquals(DETECTOR_MODEL, metadata.getDetectorModel(0, 0)); 
    400473  } 
    401474 
     
    408481    assertEquals(LIGHTSOURCE_LASER_POWER, laser.getPower()); 
    409482    assertEquals(LASER_TYPE, laser.getType()); 
     483  } 
     484 
     485  @Test(dependsOnMethods={"testValidInstrumentMetadata"}) 
     486  public void testValidLaserMetadata() { 
     487    assertEquals(LIGHTSOURCE_LASER_ID, metadata.getLaserID(0, 0)); 
     488    assertEquals(LIGHTSOURCE_LASER_MODEL, metadata.getLaserModel(0, 0)); 
     489    assertEquals(LIGHTSOURCE_LASER_POWER, metadata.getLaserPower(0, 0)); 
     490    assertEquals(LASER_TYPE, metadata.getLaserType(0, 0)); 
    410491  } 
    411492 
     
    422503  } 
    423504 
     505  @Test(dependsOnMethods={"testValidLaserMetadata"}) 
     506  public void testValidPumpMetadata() { 
     507    assertEquals(LIGHTSOURCE_PUMP_ID, metadata.getLaserID(0, 1)); 
     508    assertEquals(LIGHTSOURCE_PUMP_MODEL, metadata.getLaserModel(0, 1)); 
     509    assertEquals(LIGHTSOURCE_PUMP_POWER, metadata.getLaserPower(0, 1)); 
     510    assertEquals(LASER_TYPE, metadata.getLaserType(0, 1)); 
     511    assertEquals(LIGHTSOURCE_PUMP_ID, metadata.getLaserPump(0, 0)); 
     512  } 
     513 
    424514  // Create <Arc/> under <Instrument/> 
    425515  @Test(dependsOnMethods={"testValidInstrumentNode"}) 
     
    432522    assertEquals(ARC_TYPE, arc.getType()); 
    433523  } 
    434    
     524 
     525  @Test(dependsOnMethods={"testValidInstrumentMetadata"}) 
     526  public void testValidArcMetadata() { 
     527    assertEquals(LIGHTSOURCE_ARC_ID, metadata.getArcID(0, 2)); 
     528    assertEquals(LIGHTSOURCE_ARC_MODEL, metadata.getArcModel(0, 2)); 
     529    assertEquals(LIGHTSOURCE_ARC_POWER, metadata.getArcPower(0, 2)); 
     530    assertEquals(ARC_TYPE, metadata.getArcType(0, 2)); 
     531  } 
     532 
    435533  // Create <Filament/> under <Instrument/> 
    436534  @Test(dependsOnMethods={"testValidInstrumentNode"}) 
     
    442540    assertEquals(LIGHTSOURCE_FILAMENT_POWER, filament.getPower()); 
    443541    assertEquals(FILAMENT_TYPE, filament.getType()); 
     542  } 
     543 
     544  // Create <Filament/> under <Instrument/> 
     545  @Test(dependsOnMethods={"testValidInstrumentMetadata"}) 
     546  public void testValidFilamentMetadata() { 
     547    assertEquals(LIGHTSOURCE_FILAMENT_ID, metadata.getFilamentID(0, 3)); 
     548    assertEquals(LIGHTSOURCE_FILAMENT_MODEL, metadata.getFilamentModel(0, 3)); 
     549    assertEquals(LIGHTSOURCE_FILAMENT_POWER, metadata.getFilamentPower(0, 3)); 
     550    assertEquals(FILAMENT_TYPE, metadata.getFilamentType(0, 3)); 
    444551  } 
    445552 
Note: See TracChangeset for help on using the changeset viewer.