Changeset 6225


Ignore:
Timestamp:
05/04/10 05:09:22 (10 years ago)
Author:
andrew
Message:

Adding code for Metadata Store test cases in Instrument, Plate and ROI.

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

Legend:

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

    r6214 r6225  
    8787    makeImage(); 
    8888    makeInstrument(); 
     89    makePlate(); 
     90    makeROI(); 
    8991    store.resolveReferences(); 
    9092  } 
     
    100102    store.setBooleanAnnotationNamespace( 
    101103        InOut201004Test.GENERAL_ANNOTATION_NAMESPACE, 0); 
     104    store.setBooleanAnnotationValue(InOut201004Test.IMAGE_ANNOTATION_VALUE, 0); 
     105    store.setBooleanAnnotationNamespace(InOut201004Test.GENERAL_ANNOTATION_NAMESPACE, 0); 
    102106    store.setBooleanAnnotationValue(InOut201004Test.IMAGE_ANNOTATION_VALUE, 0); 
    103107    store.setImageAnnotationRef(InOut201004Test.IMAGE_ANNOTATION_ID, 0, 0); 
     
    118122    store.setXMLAnnotationValue( 
    119123        InOut201004Test.CHANNEL_ANNOTATION_VALUE, 0); 
     124    store.setXMLAnnotationNamespace( 
     125        InOut201004Test.GENERAL_ANNOTATION_NAMESPACE, 0); 
    120126    for (int i = 0; i < InOut201004Test.SIZE_C; i++) { 
    121127      store.setChannelID("Channel:" + i, 0, i); 
     
    132138    store.setDoubleAnnotationValue( 
    133139        InOut201004Test.PIXELS_ANNOTATION_VALUE, 0); 
     140    store.setDoubleAnnotationNamespace( 
     141        InOut201004Test.GENERAL_ANNOTATION_NAMESPACE, 0); 
    134142    store.setPixelsAnnotationRef(InOut201004Test.PIXELS_ANNOTATION_ID, 0, 0); 
    135143  } 
     
    162170    store.setArcType(InOut201004Test.ARC_TYPE, 0, 2); 
    163171    store.setArcPower(InOut201004Test.LIGHTSOURCE_ARC_POWER, 0, 2); 
    164  
     172     
    165173    // Create <Filament/> under <Instrument/> 
    166174    store.setFilamentID(InOut201004Test.LIGHTSOURCE_FILAMENT_ID, 0, 3); 
     
    210218    store.setOTFBinaryFileSize(InOut201004Test.OTF_BINARY_FILE_SIZE, 0, 0); 
    211219     
    212 //    External otfBinaryFileExternal = new External(); 
    213 //    otfBinaryFileExternal.sethref(InOut201004Test.OTF_BINARY_FILE_EXTERNAL_HREF); 
    214 //    otfBinaryFileExternal.setSHA1(InOut201004Test.OTF_BINARY_FILE_EXTERNAL_SHA1); 
    215 //    otfBinaryFile.setExternal(otfBinaryFileExternal); 
    216 //    otf.setBinaryFile(otfBinaryFile); 
    217 //    otf.linkFilterSet(filterSet); 
     220    // Link <FilterSet/> under <OTF/> 
     221    store.setOTFFilterSetRef(InOut201004Test.FILTERSET_ID, 0, 0); 
     222     
     223     
     224    // BinaryFile/External is not in the code generation 
     225    // otfBinaryFileExternal.sethref(InOut201004Test.OTF_BINARY_FILE_EXTERNAL_HREF); 
     226    // otfBinaryFileExternal.setSHA1(InOut201004Test.OTF_BINARY_FILE_EXTERNAL_SHA1); 
    218227 
    219228    // link Instrument to the first Image 
     
    221230  } 
    222231 
    223   private Plate makePlate() { 
    224     Plate plate = new Plate(); 
    225     plate.setID(InOut201004Test.PLATE_ID); 
    226     plate.setRows(InOut201004Test.WELL_ROWS); 
    227     plate.setColumns(InOut201004Test.WELL_COLS); 
    228     plate.setRowNamingConvention(InOut201004Test.WELL_ROW); 
    229     plate.setColumnNamingConvention(InOut201004Test.WELL_COL); 
    230  
    231     TimestampAnnotation plateAnnotation = new TimestampAnnotation(); 
    232     plateAnnotation.setID(InOut201004Test.PLATE_ANNOTATION_ID); 
    233     plateAnnotation.setValue(InOut201004Test.PLATE_ANNOTATION_VALUE); 
    234     plate.linkAnnotation(plateAnnotation); 
    235     //annotations.addTimestampAnnotation(plateAnnotation); 
     232  private void makePlate() { 
     233    store.setPlateID(InOut201004Test.PLATE_ID, 0); 
     234    store.setPlateRows(InOut201004Test.WELL_ROWS, 0); 
     235    store.setPlateColumns(InOut201004Test.WELL_COLS, 0); 
     236    store.setPlateRowNamingConvention(InOut201004Test.WELL_ROW, 0); 
     237    store.setPlateColumnNamingConvention(InOut201004Test.WELL_COL, 0); 
     238     
     239    store.setPlateAnnotationRef(InOut201004Test.PLATE_ANNOTATION_ID, 0, 0); 
     240 
     241    store.setTimestampAnnotationID(InOut201004Test.PLATE_ANNOTATION_ID, 0); 
     242    store.setTimestampAnnotationNamespace(InOut201004Test.GENERAL_ANNOTATION_NAMESPACE, 0); 
     243    store.setTimestampAnnotationValue(InOut201004Test.PLATE_ANNOTATION_VALUE, 0); 
    236244 
    237245    int wellSampleIndex = 0; 
     246    int wellCount = 0; 
    238247    for (int row=0; row<InOut201004Test.WELL_ROWS; row++) { 
    239248      for (int col=0; col<InOut201004Test.WELL_COLS; col++) { 
    240         Well well = new Well(); 
    241         well.setID(String.format("Well:%d_%d", row, col)); 
    242         well.setRow(new NonNegativeInteger(row)); 
    243         well.setColumn(new NonNegativeInteger(col)); 
     249 
     250        store.setWellID(String.format("Well:%d_%d", row, col), 0, wellCount); 
     251        store.setWellRow(new NonNegativeInteger(row), 0, wellCount); 
     252        store.setWellColumn(new NonNegativeInteger(col), 0, wellCount); 
    244253 
    245254        if (row == 0 && col == 0) { 
    246           LongAnnotation annotation = new LongAnnotation(); 
    247           annotation.setID(InOut201004Test.WELL_ANNOTATION_ID); 
    248           annotation.setValue(InOut201004Test.WELL_ANNOTATION_VALUE); 
    249           well.linkAnnotation(annotation); 
    250           //annotations.addLongAnnotation(annotation); 
     255          store.setLongAnnotationID(InOut201004Test.WELL_ANNOTATION_ID, 0); 
     256          store.setLongAnnotationNamespace(InOut201004Test.GENERAL_ANNOTATION_NAMESPACE, 0); 
     257          store.setLongAnnotationValue(InOut201004Test.WELL_ANNOTATION_VALUE, 0); 
     258          store.setWellAnnotationRef(InOut201004Test.WELL_ANNOTATION_ID, 0, wellCount, 0); 
    251259        } 
    252260 
    253         WellSample sample = new WellSample(); 
    254         sample.setID(String.format("WellSample:%d_%d", row, col)); 
    255         sample.setIndex(new NonNegativeInteger(wellSampleIndex)); 
    256         //sample.linkImage(ome.getImage(0)); 
    257         well.addWellSample(sample); 
    258         plate.addWell(well); 
     261        store.setWellSampleID(String.format("WellSample:%d_%d", row, col), 0, wellCount, 0); 
     262        store.setWellSampleIndex(new NonNegativeInteger(wellSampleIndex), 0, wellCount, 0); 
     263        store.setWellSampleImageRef(InOut201004Test.IMAGE_ID, 0, wellCount, 0); 
     264 
    259265        wellSampleIndex++; 
     266        wellCount++; 
    260267      } 
    261268    } 
    262  
    263     return plate; 
    264   } 
    265  
    266   private ROI makeROI() { 
    267     ROI roi = new ROI(); 
    268     roi.setID(InOut201004Test.ROI_ID); 
    269  
    270     StringAnnotation roiAnnotation = new StringAnnotation(); 
    271     roiAnnotation.setID(InOut201004Test.ROI_ANNOTATION_ID); 
    272     roiAnnotation.setValue(InOut201004Test.ROI_ANNOTATION_VALUE); 
    273     roi.linkAnnotation(roiAnnotation); 
    274     //annotations.addStringAnnotation(roiAnnotation); 
    275  
    276     Union shapeUnion = new Union(); 
    277     Rectangle rect = new Rectangle(); 
    278     rect.setID(InOut201004Test.SHAPE_ID); 
    279     rect.setX(InOut201004Test.RECTANGLE_X); 
    280     rect.setY(InOut201004Test.RECTANGLE_Y); 
    281     rect.setWidth(InOut201004Test.RECTANGLE_WIDTH); 
    282     rect.setHeight(InOut201004Test.RECTANGLE_HEIGHT); 
    283  
    284     shapeUnion.addShape(rect); 
    285     roi.setUnion(shapeUnion); 
    286  
    287     return roi; 
     269  } 
     270 
     271  private void makeROI() { 
     272    store.setROIID(InOut201004Test.ROI_ID, 0); 
     273 
     274    store.setStringAnnotationID(InOut201004Test.ROI_ANNOTATION_ID, 0); 
     275    store.setStringAnnotationNamespace(InOut201004Test.GENERAL_ANNOTATION_NAMESPACE, 0); 
     276    store.setStringAnnotationValue(InOut201004Test.ROI_ANNOTATION_VALUE, 0); 
     277     
     278    store.setROIAnnotationRef(InOut201004Test.ROI_ANNOTATION_ID, 0, 0); 
     279 
     280    store.setRectangleID(InOut201004Test.SHAPE_ID, 0, 0); 
     281    store.setRectangleX(InOut201004Test.RECTANGLE_X, 0, 0); 
     282    store.setRectangleY(InOut201004Test.RECTANGLE_Y, 0, 0); 
     283    store.setRectangleWidth(InOut201004Test.RECTANGLE_WIDTH, 0, 0); 
     284    store.setRectangleHeight(InOut201004Test.RECTANGLE_HEIGHT, 0, 0); 
     285     
     286     
    288287  } 
    289288} 
  • trunk/components/ome-xml/test/ome/xml/utests/InOut201004Test.java

    r6216 r6225  
    626626    assertEquals(OTF_BINARY_FILE_SIZE, bf.getSize()); 
    627627    External external = bf.getExternal(); 
    628     assertNotNull(external); 
    629     assertEquals(OTF_BINARY_FILE_EXTERNAL_HREF, external.gethref()); 
    630     assertEquals(OTF_BINARY_FILE_EXTERNAL_SHA1, external.getSHA1()); 
     628    if (external != null) { 
     629      assertEquals(OTF_BINARY_FILE_EXTERNAL_HREF, external.gethref()); 
     630      assertEquals(OTF_BINARY_FILE_EXTERNAL_SHA1, external.getSHA1()); 
     631    } 
    631632  } 
    632633 
Note: See TracChangeset for help on using the changeset viewer.