Changeset 6176


Ignore:
Timestamp:
04/22/10 11:53:27 (10 years ago)
Author:
melissa
Message:

Added a few more Annotation test.

File:
1 edited

Legend:

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

    r6175 r6176  
    142142  private static String PLATE_ID = "Plate:0"; 
    143143 
     144  private static String PLATE_ANNOTATION_ID = "TimestampAnnotation:0"; 
     145 
     146  private static String WELL_ANNOTATION_ID = "LongAnnotation:0"; 
     147 
    144148  private static String ROI_ID = "ROI:5"; 
     149 
     150  private static String ROI_ANNOTATION_ID = "StringAnnotation:0"; 
    145151 
    146152  private static String SHAPE_ID = "Shape:0"; 
     
    189195  private static final Boolean OTF_OPTICAL_AXIS_AVERAGED = Boolean.FALSE; 
    190196 
     197  private static final String PLATE_ANNOTATION_VALUE = "1970-01-01T00:00:00"; 
     198 
     199  private static final String WELL_ANNOTATION_VALUE = "262144"; 
     200 
    191201  private static final Integer WELL_ROWS = 3; 
    192202 
     
    196206 
    197207  private static final NamingConvention WELL_COL = NamingConvention.NUMBER; 
     208 
     209  private static final String ROI_ANNOTATION_VALUE = "Some extra ROI data"; 
    198210 
    199211  private static final Double RECTANGLE_X = 10.0; 
     
    456468 
    457469  @Test(dependsOnMethods={"testValidPlateNode"}) 
     470  public void testValidPlateAnnotation() { 
     471    Annotation n = ome.getPlate(0).getLinkedAnnotation(0); 
     472    assertNotNull(n); 
     473    assertEquals(PLATE_ANNOTATION_ID, n.getID()); 
     474    assertTrue(n instanceof TimestampAnnotation); 
     475    TimestampAnnotation timestamp = (TimestampAnnotation) n; 
     476    assertEquals(timestamp.getValue(), PLATE_ANNOTATION_VALUE); 
     477  } 
     478 
     479  @Test(dependsOnMethods={"testValidPlateNode"}) 
    458480  public void testValidWellSamples() { 
    459481    Plate plate = ome.getPlate(0); 
     
    466488        assertNotNull(sample); 
    467489        assertEquals(String.format("WellSample:%d_%d", row, col), 
    468                      sample.getID()); 
     490          sample.getID()); 
    469491        assertEquals(wellSampleIndex, sample.getIndex()); 
    470492        Image image = sample.getLinkedImage(); 
     
    476498  } 
    477499 
     500  @Test(dependsOnMethods={"testValidWellSamples"}) 
     501  public void testValidWellAnnotation() { 
     502    Annotation n = ome.getPlate(0).getWell().getLinkedANnotation(0); 
     503    assertNotNull(n); 
     504    assertEquals(WELL_ANNOTATION_ID, n.getID()); 
     505    assertTrue(n instanceof LongAnnotation); 
     506    LongAnnotation longAnnotation = (LongAnnotation) n; 
     507    assertEquals(longAnnotation.getValue(), WELL_ANNOTATION_VALUE); 
     508  } 
     509 
    478510  @Test(dependsOnMethods={"testValidOMENode"}) 
    479511  public void testValidROINode() { 
     
    495527    assertEquals(RECTANGLE_WIDTH, rect.getWidth()); 
    496528    assertEquals(RECTANGLE_HEIGHT, rect.getHeight()); 
     529  } 
     530 
     531  @Test(dependsOnMethods={"testValidROINode"}) 
     532  public void testValidROIAnnotation() { 
     533    Annotation n = ome.getROI(0).getLinkedAnnotation(0); 
     534    assertNotNull(n); 
     535    assertEquals(ROI_ANNOTATION_ID, n.getID()); 
     536    assertTrue(n instanceof StringAnnotation); 
     537    StringAnnotation string = (StringAnnotation) n; 
     538    assertEquals(ROI_ANNOTATION_VALUE, string.getValue()); 
    497539  } 
    498540 
     
    623665    plate.setColumnNamingConvention(WELL_COL); 
    624666 
     667    TimestampAnnotation plateAnnotation = new TimestampAnnotation(); 
     668    plateAnnotation.setID(PLATE_ANNOTATION_ID); 
     669    plateAnnotation.setValue(PLATE_ANNOTATION_VALUE); 
     670    plate.linkAnnotation(plateAnnotation); 
     671 
    625672    int wellSampleIndex = 0; 
    626673    for (int row=0; row<WELL_ROWS; row++) { 
     
    630677        well.setRow(row); 
    631678        well.setColumn(col); 
     679 
     680        if (row == 0 && col == 0) { 
     681          LongAnnotation annotation = new LongAnnotation(); 
     682          annotation.setID(WELL_ANNOTATION_ID); 
     683          annotation.setValue(WELL_ANNOTATION_VALUE); 
     684          well.linkAnnotation(annotation); 
     685        } 
    632686 
    633687        WellSample sample = new WellSample(); 
     
    647701    ROI roi = new ROI(); 
    648702    roi.setID(ROI_ID); 
     703 
     704    StringAnnotation roiAnnotation = new StringAnnotation(); 
     705    roiAnnotation.setID(ROI_ANNOTATION_ID); 
     706    roiAnnotation.setValue(ROI_ANNOTATION_VALUE); 
     707    roi.linkAnnotation(roiAnnotation); 
     708 
    649709    Union shapeUnion = new Union(); 
    650710    Rectangle rect = new Rectangle(); 
Note: See TracChangeset for help on using the changeset viewer.