Changeset 6145


Ignore:
Timestamp:
04/20/10 09:57:27 (10 years ago)
Author:
callan
Message:

Make object creation a little more flexible in the test case.

File:
1 edited

Legend:

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

    r6144 r6145  
    119119    DocumentBuilder parser = factory.newDocumentBuilder(); 
    120120    document = parser.newDocument(); 
    121     makeXML(); 
     121    // Put <Image/> under <OME/> 
     122    ome = new OME(); 
     123    ome.addImage(makeImage()); 
     124    // Produce a valid OME DOM element hierarchy 
     125    Element root = ome.asXMLElement(document); 
     126    root.setAttribute("xmlns", XML_NS); 
     127    root.setAttribute("xmlns:xsi", XSI_NS); 
     128    root.setAttribute("xsi:schemaLocation", 
     129        XML_NS + " " + SCHEMA_LOCATION); 
     130    document.appendChild(root); 
     131    // Produce string XML 
    122132    asString = asString(); 
     133    // Read string XML in as a DOM tree and parse into the object hierarchy 
    123134    ome = OME.fromXMLElement(document.getDocumentElement()); 
    124135  } 
     
    159170  } 
    160171 
    161   private void makeXML() { 
    162     // Create <OME/> 
    163     OME ome = new OME(); 
     172  private Image makeImage() { 
    164173    // Create <Image/> 
    165174    Image image = new Image(); 
     
    184193    // Put <Pixels/> under <Image/> 
    185194    image.setPixels(pixels); 
    186     // Put <Image/> under <OME/> 
    187     ome.addImage(image); 
    188     Element root = ome.asXMLElement(document); 
    189     root.setAttribute("xmlns", XML_NS); 
    190     root.setAttribute("xmlns:xsi", XSI_NS); 
    191     root.setAttribute("xsi:schemaLocation", 
    192         XML_NS + " " + SCHEMA_LOCATION); 
    193     document.appendChild(root); 
     195    return image; 
    194196  } 
    195197 
Note: See TracChangeset for help on using the changeset viewer.