Package org.openiaml.model.xpath

Examples of org.openiaml.model.xpath.IterableElementList


   * Make sure all 'nodes' are unique.
   * @throws Exception
   */
  public void testUniqueNodes() throws Exception {
    Document gmfgraph = getGmfgraph();
    IterableElementList nl = xpath(gmfgraph, "/Canvas/nodes");
   
    assertNotSame("We should have at least one node node", nl.getLength(), 0);
    Set<String> found = new HashSet<String>();
    for (Element child : nl) {
      String childName = child.getAttribute("name");
     
      assertFalse("More than one node found for '" + childName + "'", found.contains(childName));
View Full Code Here


   * Make sure all 'connections' are unique.
   * @throws Exception
   */
  public void testUniqueConnections() throws Exception {
    Document gmfgraph = getGmfgraph();
    IterableElementList nl = xpath(gmfgraph, "/Canvas/connections");
   
    assertNotSame("We should have at least one connection node", nl.getLength(), 0);
    Set<String> found = new HashSet<String>();
    for (Element child : nl) {
      String childName = child.getAttribute("name");

      assertFalse("More than one connection found for '" + childName + "'", found.contains(childName));
View Full Code Here

   * Make sure all 'labels' are unique.
   * @throws Exception
   */
  public void testUniqueLabels() throws Exception {
    Document gmfgraph = getGmfgraph();
    IterableElementList nl = xpath(gmfgraph, "/Canvas/labels");
    assertNotSame("We should have at least one label node", nl.getLength(), 0);
   
    Set<String> found = new HashSet<String>();
    for (Element child : nl) {
      String childName = child.getAttribute("name");
     
View Full Code Here

   * an element icon.
   *
   */
  public void testDuplicateIcons() throws Exception {
    Document gmfgraph = getGmfgraph();
    IterableElementList nl = xpath(gmfgraph, "/Canvas/labels");
    assertNotSame("We should have at least one label node", nl.getLength(), 0);
   
    // store a map of [/accessor]->[element icon count]
    Map<String,Integer> elementIconMap = new HashMap<String,Integer>();
    // a map back to the original label element [for debug]
    Map<String,String> labelMap = new HashMap<String,String>();
View Full Code Here

   *
   * @throws Exception
   */
  public void testNodeBorders() throws Exception {
    Document gmfgraph = getGmfgraph();
    IterableElementList nl = xpath(gmfgraph, "/Canvas/figures/descriptors/actualFigure[@type = 'gmfgraph:Rectangle' or @type = 'gmfgraph:Ellipse' or @type = 'gmfgraph:RoundedRectangle']");
   
    assertNotSame("We should have at least one figure node", nl.getLength(), 0);
   
    boolean changed = false;
    for (Element child : nl) {
      // there should be a border here
      IterableElementList e = xpath(child, "border[@type='gmfgraph:MarginBorder']");
      String figure = child.getAttribute("name");
     
      // how thick is the border of this figure?
      int lineWidth = 1;
      if (child.hasAttribute("lineWidth"))
        lineWidth = Integer.valueOf(child.getAttribute("lineWidth"));
     
      if (e.getLength() == 0) {
        // add one
        System.out.println("Adding border inset for figure " + figure);
       
        Element border = gmfgraph.createElement("border");
        border.setAttribute("xsi:type", "gmfgraph:MarginBorder");
        child.appendChild(border);
       
        Element inset = gmfgraph.createElement("insets");
        inset.setAttribute("top", Integer.toString(2 + lineWidth));
        inset.setAttribute("left", Integer.toString(2 + lineWidth));
        inset.setAttribute("bottom", Integer.toString(2 + lineWidth));
        inset.setAttribute("right", Integer.toString(2 + lineWidth));
        border.appendChild(inset);
       
        changed = true;
       
      } else if (e.getLength() == 1) {
        // there should be one inset in here
        Element inset = hasXpathFirst(e.item(0), "insets");
        assertNotNull("No inset found for figure " + figure, inset);
       
        // should be equal to the expected
        assertEquals(figure + " inset.top", Integer.toString(2 + lineWidth), inset.getAttribute("top"));
        assertEquals(figure + " inset.left", Integer.toString(2 + lineWidth), inset.getAttribute("left"));
View Full Code Here

   *
   * @throws Exception
   */
  public void testAllForegroundColoursBlack() throws Exception {
    Document gmfgraph = getGmfgraph();
    IterableElementList nl = xpath(gmfgraph, "/Canvas/figures/descriptors/actualFigure");
   
    assertNotSame("We should have at least one figure node", nl.getLength(), 0);
   
    boolean changed = false;
    for (Element child : nl) {
      if (hasXpathFirst(child, "foregroundColor") == null) {
        // add it
View Full Code Here

TOP

Related Classes of org.openiaml.model.xpath.IterableElementList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.