Changeset 6144


Ignore:
Timestamp:
04/20/10 09:51:22 (10 years ago)
Author:
callan
Message:

Made whitespace and style conform to LOCI guidelines.

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

Legend:

Unmodified
Added
Removed
  • trunk/components/ome-xml/.settings/org.eclipse.jdt.core.prefs

    r6143 r6144  
    1 #Tue Apr 20 10:34:57 BST 2010 
     1#Tue Apr 20 15:46:50 BST 2010 
    22eclipse.preferences.version=1 
    33org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 
     
    8888org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 
    8989org.eclipse.jdt.core.formatter.blank_lines_after_package=1 
    90 org.eclipse.jdt.core.formatter.blank_lines_before_field=1 
     90org.eclipse.jdt.core.formatter.blank_lines_before_field=0 
    9191org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 
    9292org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 
     
    9797org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 
    9898org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 
    99 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line 
    100 org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line 
    101 org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=next_line 
    102 org.eclipse.jdt.core.formatter.brace_position_for_block=next_line 
    103 org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line 
    104 org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line 
    105 org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line 
    106 org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line 
    107 org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line 
    108 org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line 
    109 org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line 
     99org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line 
     100org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line 
     101org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line 
     102org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line 
     103org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line 
     104org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line 
     105org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line 
     106org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line 
     107org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line 
     108org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line 
     109org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line 
    110110org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false 
    111111org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false 
     
    134134org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true 
    135135org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true 
    136 org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true 
    137 org.eclipse.jdt.core.formatter.indentation.size=4 
     136org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false 
     137org.eclipse.jdt.core.formatter.indentation.size=2 
    138138org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert 
    139139org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert 
     
    320320org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true 
    321321org.eclipse.jdt.core.formatter.tabulation.char=space 
    322 org.eclipse.jdt.core.formatter.tabulation.size=4 
     322org.eclipse.jdt.core.formatter.tabulation.size=2 
    323323org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false 
    324324org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true 
  • trunk/components/ome-xml/test/ome/xml/utests/InOut201004Test.java

    r6143 r6144  
     1// 
     2// InOut201004Test.java 
     3// 
     4 
     5/* 
     6 * ome.xml.utests 
     7 * 
     8 *----------------------------------------------------------------------------- 
     9 * 
     10 *  Copyright (C) 2007-2008 Open Microscopy Environment 
     11 *      Massachusetts Institute of Technology, 
     12 *      National Institutes of Health, 
     13 *      University of Dundee, 
     14 *      University of Wisconsin-Madison 
     15 * 
     16 * 
     17 * 
     18 *    This library is free software; you can redistribute it and/or 
     19 *    modify it under the terms of the GNU Lesser General Public 
     20 *    License as published by the Free Software Foundation; either 
     21 *    version 2.1 of the License, or (at your option) any later version. 
     22 * 
     23 *    This library is distributed in the hope that it will be useful, 
     24 *    but WITHOUT ANY WARRANTY; without even the implied warranty of 
     25 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
     26 *    Lesser General Public License for more details. 
     27 * 
     28 *    You should have received a copy of the GNU Lesser General Public 
     29 *    License along with this library; if not, write to the Free Software 
     30 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
     31 * 
     32 *----------------------------------------------------------------------------- 
     33 */ 
    134 
    235package ome.xml.utests; 
     
    3770import org.xml.sax.SAXException; 
    3871 
    39 public class InOut201004Test 
    40 { 
    41     private static String IMAGE_ID = "Image:0"; 
    42  
    43     private static String PIXELS_ID = "Pixels:0"; 
    44  
    45     private static DimensionOrder dimensionOrder = DimensionOrder.XYZCT; 
    46  
    47     private static PixelType pixelType = PixelType.UINT16; 
    48  
    49     private static final Integer SIZE_X = 512; 
    50  
    51     private static final Integer SIZE_Y = 512; 
    52  
    53     private static final Integer SIZE_Z = 64; 
    54  
    55     private static final Integer SIZE_C = 3; 
    56  
    57     private static final Integer SIZE_T = 50; 
    58  
    59     /** XML namespace. */ 
    60     public static final String XML_NS =  
    61         "http://www.openmicroscopy.org/Schemas/OME/2010-04"; 
    62  
    63     /** XSI namespace. */ 
    64     public static final String XSI_NS = 
    65         "http://www.w3.org/2001/XMLSchema-instance"; 
    66  
    67     /** XML schema location. */ 
    68     public static final String SCHEMA_LOCATION = 
    69         "http://svn.openmicroscopy.org.uk/svn/specification/Xml/Working/ome.xsd"; 
    70  
    71     private Document document; 
    72  
    73     private String asString; 
    74  
    75     private OME ome; 
    76  
    77     @BeforeClass 
    78     public void setUp() 
    79         throws ParserConfigurationException, TransformerException, EnumerationException 
    80     { 
    81         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 
    82         DocumentBuilder parser = factory.newDocumentBuilder(); 
    83         document = parser.newDocument(); 
    84         makeXML(); 
    85         asString = asString(); 
    86         ome = OME.fromXMLElement(document.getDocumentElement()); 
     72/** 
     73 * 
     74 * <dl><dt><b>Source code:</b></dt> 
     75 * <dd><a href="https://skyking.microscopy.wisc.edu/trac/java/browser/trunk/components/ome-xml/test/ome/xml/utests/InOut201004Test.java">Trac</a>, 
     76 * <a href="https://skyking.microscopy.wisc.edu/svn/java/trunk/components/ome-xml/test/ome/xml/utests/InOut201004Test.java">SVN</a></dd></dl> 
     77 */ 
     78public class InOut201004Test { 
     79  private static String IMAGE_ID = "Image:0"; 
     80 
     81  private static String PIXELS_ID = "Pixels:0"; 
     82 
     83  private static DimensionOrder dimensionOrder = DimensionOrder.XYZCT; 
     84 
     85  private static PixelType pixelType = PixelType.UINT16; 
     86 
     87  private static final Integer SIZE_X = 512; 
     88 
     89  private static final Integer SIZE_Y = 512; 
     90 
     91  private static final Integer SIZE_Z = 64; 
     92 
     93  private static final Integer SIZE_C = 3; 
     94 
     95  private static final Integer SIZE_T = 50; 
     96 
     97  /** XML namespace. */ 
     98  public static final String XML_NS =  
     99    "http://www.openmicroscopy.org/Schemas/OME/2010-04"; 
     100 
     101  /** XSI namespace. */ 
     102  public static final String XSI_NS = 
     103    "http://www.w3.org/2001/XMLSchema-instance"; 
     104 
     105  /** XML schema location. */ 
     106  public static final String SCHEMA_LOCATION = 
     107    "http://svn.openmicroscopy.org.uk/svn/specification/Xml/Working/ome.xsd"; 
     108 
     109  private Document document; 
     110 
     111  private String asString; 
     112 
     113  private OME ome; 
     114 
     115  @BeforeClass 
     116  public void setUp() 
     117  throws ParserConfigurationException, TransformerException, EnumerationException { 
     118    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 
     119    DocumentBuilder parser = factory.newDocumentBuilder(); 
     120    document = parser.newDocument(); 
     121    makeXML(); 
     122    asString = asString(); 
     123    ome = OME.fromXMLElement(document.getDocumentElement()); 
     124  } 
     125 
     126  @Test 
     127  public void testValidOMENode() throws EnumerationException { 
     128    assertNotNull(ome); 
     129    assertEquals(1, ome.sizeOfImageList()); 
     130  } 
     131 
     132  @Test(dependsOnMethods={"testValidOMENode"}) 
     133  public void testValidImageNode() { 
     134    Image image = ome.getImage(0); 
     135    assertNotNull(image); 
     136    assertEquals(IMAGE_ID, image.getID()); 
     137  } 
     138 
     139  @Test(dependsOnMethods={"testValidImageNode"}) 
     140  public void testValidPixelsNode() { 
     141    Pixels pixels = ome.getImage(0).getPixels(); 
     142    assertEquals(SIZE_X, pixels.getSizeX()); 
     143    assertEquals(SIZE_Y, pixels.getSizeY()); 
     144    assertEquals(SIZE_Z, pixels.getSizeZ()); 
     145    assertEquals(SIZE_C, pixels.getSizeC()); 
     146    assertEquals(SIZE_T, pixels.getSizeT()); 
     147    assertEquals(dimensionOrder, pixels.getDimensionOrder()); 
     148    assertEquals(pixelType, pixels.getType()); 
     149    assertNotNull(pixels.getMetadataOnly()); 
     150  } 
     151 
     152  @Test(dependsOnMethods={"testValidPixelsNode"}) 
     153  public void testValidChannelNode() { 
     154    Pixels pixels = ome.getImage(0).getPixels(); 
     155    assertEquals(3, pixels.sizeOfChannelList()); 
     156    for (Channel channel : pixels.copyChannelList()) { 
     157      assertNotNull(channel.getID()); 
    87158    } 
    88  
    89     @Test 
    90     public void testValidOMENode() throws EnumerationException 
    91     { 
    92         assertNotNull(ome); 
    93         assertEquals(1, ome.sizeOfImageList()); 
     159  } 
     160 
     161  private void makeXML() { 
     162    // Create <OME/> 
     163    OME ome = new OME(); 
     164    // Create <Image/> 
     165    Image image = new Image(); 
     166    image.setID(IMAGE_ID); 
     167    // Create <Pixels/> 
     168    Pixels pixels = new Pixels(); 
     169    pixels.setID(PIXELS_ID); 
     170    pixels.setSizeX(SIZE_X); 
     171    pixels.setSizeY(SIZE_Y); 
     172    pixels.setSizeZ(SIZE_Z); 
     173    pixels.setSizeC(SIZE_C); 
     174    pixels.setSizeT(SIZE_T); 
     175    pixels.setDimensionOrder(dimensionOrder); 
     176    pixels.setType(pixelType); 
     177    pixels.setMetadataOnly(new MetadataOnly()); 
     178    // Create <Channel/> under <Pixels/> 
     179    for (int i = 0; i < SIZE_C; i++) { 
     180      Channel channel = new Channel(); 
     181      channel.setID("Channel:" + i); 
     182      pixels.addChannel(channel); 
    94183    } 
    95  
    96     @Test(dependsOnMethods={"testValidOMENode"}) 
    97     public void testValidImageNode() 
    98     { 
    99         Image image = ome.getImage(0); 
    100         assertNotNull(image); 
    101         assertEquals(IMAGE_ID, image.getID()); 
    102     } 
    103  
    104     @Test(dependsOnMethods={"testValidImageNode"}) 
    105     public void testValidPixelsNode() 
    106     { 
    107         Pixels pixels = ome.getImage(0).getPixels(); 
    108         assertEquals(SIZE_X, pixels.getSizeX()); 
    109         assertEquals(SIZE_Y, pixels.getSizeY()); 
    110         assertEquals(SIZE_Z, pixels.getSizeZ()); 
    111         assertEquals(SIZE_C, pixels.getSizeC()); 
    112         assertEquals(SIZE_T, pixels.getSizeT()); 
    113         assertEquals(dimensionOrder, pixels.getDimensionOrder()); 
    114         assertEquals(pixelType, pixels.getType()); 
    115         assertNotNull(pixels.getMetadataOnly()); 
    116     } 
    117  
    118     @Test(dependsOnMethods={"testValidPixelsNode"}) 
    119     public void testValidChannelNode() 
    120     { 
    121         Pixels pixels = ome.getImage(0).getPixels(); 
    122         assertEquals(3, pixels.sizeOfChannelList()); 
    123         for (Channel channel : pixels.copyChannelList()) 
    124         { 
    125             assertNotNull(channel.getID()); 
    126         } 
    127     } 
    128  
    129     private void makeXML() 
    130     { 
    131         // Create <OME/> 
    132         OME ome = new OME(); 
    133         // Create <Image/> 
    134         Image image = new Image(); 
    135         image.setID(IMAGE_ID); 
    136         // Create <Pixels/> 
    137         Pixels pixels = new Pixels(); 
    138         pixels.setID(PIXELS_ID); 
    139         pixels.setSizeX(SIZE_X); 
    140         pixels.setSizeY(SIZE_Y); 
    141         pixels.setSizeZ(SIZE_Z); 
    142         pixels.setSizeC(SIZE_C); 
    143         pixels.setSizeT(SIZE_T); 
    144         pixels.setDimensionOrder(dimensionOrder); 
    145         pixels.setType(pixelType); 
    146         pixels.setMetadataOnly(new MetadataOnly()); 
    147         // Create <Channel/> under <Pixels/> 
    148         for (int i = 0; i < SIZE_C; i++) 
    149         { 
    150             Channel channel = new Channel(); 
    151             channel.setID("Channel:" + i); 
    152             pixels.addChannel(channel); 
    153         } 
    154         // Put <Pixels/> under <Image/> 
    155         image.setPixels(pixels); 
    156         // Put <Image/> under <OME/> 
    157         ome.addImage(image); 
    158         Element root = ome.asXMLElement(document); 
    159         root.setAttribute("xmlns", XML_NS); 
    160         root.setAttribute("xmlns:xsi", XSI_NS); 
    161         root.setAttribute("xsi:schemaLocation", 
    162                           XML_NS + " " + SCHEMA_LOCATION); 
    163         document.appendChild(root); 
    164     } 
    165  
    166     private String asString() throws TransformerException  
    167     { 
    168         TransformerFactory transformerFactory = 
    169             TransformerFactory.newInstance(); 
    170         Transformer transformer = transformerFactory.newTransformer(); 
    171         Source source = new DOMSource(document); 
    172         StringWriter stringWriter = new StringWriter(); 
    173         Result result = new StreamResult(stringWriter); 
    174         transformer.transform(source, result); 
    175         return stringWriter.toString(); 
    176     } 
    177  
    178     private Document fromString(String xml) 
    179         throws ParserConfigurationException, IOException, SAXException 
    180     { 
    181         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 
    182         DocumentBuilder builder = factory.newDocumentBuilder(); 
    183         return builder.parse(new InputSource(new StringReader(xml))); 
    184     } 
     184    // Put <Pixels/> under <Image/> 
     185    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); 
     194  } 
     195 
     196  private String asString() throws TransformerException { 
     197    TransformerFactory transformerFactory = 
     198      TransformerFactory.newInstance(); 
     199    Transformer transformer = transformerFactory.newTransformer(); 
     200    Source source = new DOMSource(document); 
     201    StringWriter stringWriter = new StringWriter(); 
     202    Result result = new StreamResult(stringWriter); 
     203    transformer.transform(source, result); 
     204    return stringWriter.toString(); 
     205  } 
     206 
     207  private Document fromString(String xml) 
     208  throws ParserConfigurationException, IOException, SAXException { 
     209    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); 
     210    DocumentBuilder builder = factory.newDocumentBuilder(); 
     211    return builder.parse(new InputSource(new StringReader(xml))); 
     212  } 
    185213} 
Note: See TracChangeset for help on using the changeset viewer.