Package org.jboss.jsfunit.analysis.util

Examples of org.jboss.jsfunit.analysis.util.ParserUtils


    String methodName = unwrapped.substring(indexOfDot + 1, unwrapped.length());
    String query = "//managed-bean-name[text()='" + beanName + "']";
    final String subQuery = "./managed-bean-class";
   
    for( String configPath : configByPath.keySet() ) {
      NodeList list = new ParserUtils().query(configByPath.get(configPath), query, path);
     
      if (list.getLength() > 1) {
        fail(path + " has two managed beans named '" + beanName + "'");
      } else if ( list.getLength() == 1 ) {
     
        Node managedBeanName = list.item(0);
        NodeList managedBeanClasses = new ParserUtils().query(managedBeanName.getParentNode(), subQuery, path);
       
        if( managedBeanClasses.getLength() == 0 )
          fail(path + " has a managed-bean element w/out a managed-bean-class element");
        else if(managedBeanClasses.getLength() > 1)
          fail(path + " has a managed-bean element w/out > 1 managed-bean-class elements");
View Full Code Here


    list.add(el);
  }
 
  public void parse(Node node, String path) {
   
    NodeList bindings = new ParserUtils().query(node, "//actionListener/@binding", path);
    for(int i = 0; i < bindings.getLength(); i++)
      addActionListener(path, bindings.item(i).getNodeValue());
   
    NodeList actionListeners = new ParserUtils().query(node, "*//@actionListener", path);
    for(int i = 0; i < actionListeners.getLength(); i++)
      addActionListener(path, actionListeners.item(i).getNodeValue());

    NodeList actions = new ParserUtils().query(node, "*//@action", path);
    for(int i = 0; i < actions.getLength(); i++)
      addAction(path, actions.item(i).getNodeValue());
  }
View Full Code Here

   
    final Map<String, String> managedBeanNames = new HashMap<String, String>();
    String xpath = "//managed-bean";
   
    for( String facesConfigPath : documentsByPath.keySet() ) {
      NodeList managedBeans = new ParserUtils().query(documentsByPath.get(facesConfigPath), xpath, facesConfigPath);
      for(int i = 0; i < managedBeans.getLength(); i++) {
        Node managedBean = managedBeans.item(i);
        doManagedBean(managedBean, facesConfigPath, managedBeanNames);
      }
    }
View Full Code Here

  }
   
  private void doManagedBean(Node parent, String facesConfigPath, final Map<String, String> managedBeanNames) {
   
    // should've used jaxb or digestor
    String name = new ParserUtils().querySingle(parent, "./managed-bean-name/text()", facesConfigPath);
    if(name == null || "".equals(name))
      throw new RuntimeException("could not determine name of " + parent.getNodeName() +
          " in " + facesConfigPath);
   
    String clazz = new ParserUtils().querySingle(parent, "./managed-bean-class/text()", facesConfigPath);
    if(clazz == null || "".equals(clazz))
      throw new RuntimeException("could not determine class of " + parent.getNodeName() + " '"
          + name + "' in " + facesConfigPath);
   
    String scope = new ParserUtils().querySingle(parent, "./managed-bean-scope/text()", facesConfigPath);
    if(scope == null || "".equals(scope))
      throw new RuntimeException("could not determine scope '" + scope + "' of " + parent.getNodeName() + " '"
          + name + "' in " + facesConfigPath);
   
    failIfMapHasDuplicateKeys(parent, facesConfigPath, name);
View Full Code Here

  }

  private void failIfMapHasDuplicateKeys(Node managedBean, String facesConfigPath, String name) {
    String query = "./managed-property/map-entries";
    String subQuery = "./map-entry/key";
    NodeList nodeList = new ParserUtils().query(managedBean, query, facesConfigPath);
   
    for(int i = 0; i < nodeList.getLength(); i++) {
      NodeList keys = new ParserUtils().query(nodeList.item(i), subQuery, facesConfigPath);
      Set<String> keyNames = new HashSet<String>();
      for(int j = 0; j < keys.getLength(); j++) {
        Node firstChild = keys.item(j).getFirstChild();
        if(firstChild != null){
          String textContent = firstChild.getTextContent();
View Full Code Here

TOP

Related Classes of org.jboss.jsfunit.analysis.util.ParserUtils

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.