Examples of IterableElementList


Examples of org.openiaml.model.xpath.IterableElementList

   * @param root
   * @throws XPathExpressionException
   */
  private List<Element> getAllGmfToolsRecursive(Element root, String prefix) throws XPathExpressionException {
    List<Element> result = new ArrayList<Element>();
    IterableElementList tools = xpath(root, "tools");
   
    for (Element e : tools) {
      if (e.getAttribute("xsi:type").equals("gmftool:ToolGroup")) {
        // found a group
        result.addAll(getAllGmfToolsRecursive(e, prefix));
View Full Code Here

Examples of org.openiaml.model.xpath.IterableElementList

  public void testGmfTools() throws Exception {
   
    for (String file : getToolList()) {
      boolean changed = false;
      Document doc = getToolCache().get(file);
      IterableElementList nl = xpath(doc, "//palette/tools");
     
      IterableElementList tools = getAllGmfTools(nl, file + ": ");
      assertNotSame(file + ": There should be at least one subtool entry", tools.getLength(), 0);
     
      for (int i = 0; i < tools.getLength(); i++) {
        String prefix = "[" + file + "#" + i + "] ";
        Element tool = (Element) tools.item(i);
        assertNotNull(prefix, tool);
        Element smallIcon = (Element) xpath(tool, "smallIcon").item(0);
        assertNotNull(prefix, smallIcon);
        Element largeIcon = (Element) xpath(tool, "largeIcon").item(0);
        assertNotNull(prefix, largeIcon);
View Full Code Here

Examples of org.openiaml.model.xpath.IterableElementList

    for (String filename : getToolList()) {
      Document gmftool = getToolCache().get(filename);
      Document gmfmap = loadGmfmap(filename);
     
      IterableElementList roots = xpath(gmftool, "/ToolRegistry/palette/tools");
      IterableElementList tools = getAllGmfTools(roots, filename);
     
      for (Element tool : tools) {
        // EventTrigger
        String toolName = tool.getAttribute("title");
       
        // remove any selectors
        String selector = getSelector(toolName);
        toolName = removeSelectors(toolName);
       
        String nodeXpath, linkXpath;
       
        if (selector == null) {
          // a normal node
          nodeXpath = "/Mapping/nodes/ownedChild/domainMetaElement[contains(@href, '" + toolName + "')]";
          linkXpath = "/Mapping/links/domainMetaElement[contains(@href, '" + toolName + "')]";
        } else {
          nodeXpath = "/Mapping/nodes/ownedChild/domainMetaElement[contains(@href, '" + toolName + "') and contains(../../containmentFeature/@href, '" + selector + "')]";
          linkXpath = "/Mapping/links/domainMetaElement[contains(@href, '" + toolName + "')]";         
        }
       
        // should match either a node..
        IterableElementList matches = xpath(gmfmap, nodeXpath);
        boolean matched = false;

        if (selector == null) {
          // TODO not sure how to test this yet
          continue;
        }
       
        for (Element match : matches) {
          String href = match.getAttribute("href");
          if (href.endsWith(toolName)) {
            if (selector != null) {
              assertFalse(filename + ": More than one mapping for tool '" + toolName + "': " + selector, matched);
              matched = true;
            }
           
            if (selector == null) {
              // TODO not sure how to test this yet
              /*
              assertEquals(filename + ": More than one non-selector mapping for tool '" + toolName + "': " + selector, 0, nullCount);
              nullCount++;
              */
            }
          }
        }

        // or a link
        IterableElementList matches2 = xpath(gmfmap, linkXpath);
        for (Element match : matches2) {
          String href = match.getAttribute("href");
          if (href.endsWith(toolName)) {
            if (selector != null) {
              assertFalse(filename + ": More than one mapping for tool '" + toolName + "': " + selector, matched);
View Full Code Here

Examples of org.openiaml.model.xpath.IterableElementList

  public void testIconsMatch() throws Exception {
   
    for (String filename : getToolList()) {
      Document gmftool = getToolCache().get(filename);
     
      IterableElementList roots = xpath(gmftool, "/ToolRegistry/palette/tools");
      IterableElementList tools = getAllGmfTools(roots, filename);

      for (Element tool : tools) {
        // EventTrigger
        String toolName = tool.getAttribute("title");
        String message = "[" + filename + "] " + toolName + ": ";
View Full Code Here

Examples of org.openiaml.model.xpath.IterableElementList

  public void testOnlyOneStaticGroup() throws Exception {
   
    for (String filename : getToolList()) {
      Document gmftool = getToolCache().get(filename);
     
      IterableElementList roots = xpath(gmftool, "/ToolRegistry/palette/tools");
      assertNotEqual("No roots found for " + filename, roots.size(), 0);
     
      Element previousStatic = null;
      for (Element root : roots) {
       
        if (!root.hasAttribute("collapsible") ||
View Full Code Here

Examples of org.openiaml.model.xpath.IterableElementList

    for (String filename : getToolList()) {
      String f = new File(filename).getName();
      Document gmftool = getToolCache().get(filename);
     
      // get all tools in subgroups
      IterableElementList roots = xpath(gmftool, "/ToolRegistry/palette/tools/tools");
     
      boolean saveDocument = false;
      for (Element tool : roots) {
        // bar [baz]
        String title = tool.getAttribute("title");
View Full Code Here

Examples of org.openiaml.model.xpath.IterableElementList

    for (String filename : getToolList()) {
      String f = new File(filename).getName();
      Document gmftool = getToolCache().get(filename);
     
      // get all tools in subgroups
      IterableElementList roots = xpath(gmftool, "/ToolRegistry/palette/tools/tools");
     
      boolean saveDocument = false;
      for (Element tool : roots) {
        // bar [baz]
        String title = tool.getAttribute("title");
View Full Code Here

Examples of org.openiaml.model.xpath.IterableElementList

   * @throws Exception
   */
  private void doTestAll(String figureName, List<String> classes, String name,
      List<String> ignore) throws Exception {
    Document gmfgraph = getGmfgraph();
    IterableElementList nl = xpath(gmfgraph, "//actualFigure/children[contains(@name, '" + figureName + "')]");
   
    for (Element child : nl) {
      String childName = child.getAttribute("name");
     
      // go up:
View Full Code Here

Examples of org.openiaml.model.xpath.IterableElementList

   */
  public void testMappingReadOnly() throws Exception {
    for (String filename : GmfMapTestCase.getMapList()) {
      Document doc = GmfMapTestCase.getMapCache().get(filename);

      IterableElementList nodes = xpath(doc, "/Mapping/nodes/ownedChild/labelMappings/diagramLabel[contains(@href, 'ParentName')]");
      for (Element node : nodes) {
        Element parent = (Element) node.getParentNode();
        assertEquals(filename + ": ParentName '" + node + "' must be read-only.", parent.getAttribute("readOnly"), "true");
      }
    }
View Full Code Here

Examples of org.openiaml.model.xpath.IterableElementList

   * @param query the XPath query to evaluate
   * @return <code>null</code> if there is no such node
   * @throws RSSReaderException if the query throws a {@link XPathExpressionException}
   */
  protected String getTextContent(Node xml, String query) throws RSSReaderException {
    IterableElementList list;
    try {
      list = this.xpath.xpath(xml, query);
    } catch (XPathExpressionException e) {
      throw new RSSReaderException("Invalid XPath: " + query, e);
    }
    if (list.isEmpty())
      return null;
    assertEquals(1, list.size());
    return list.item(0).getTextContent();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.