Search in sources :

Example 1 with FunctionDescriptor

use of com.sun.enterprise.tools.verifier.web.FunctionDescriptor in project Payara by payara.

the class TagLibDescriptor method getFunctionDescriptors.

/**
 * for each functions in tag lib descriptor creates a function descritor and
 * return the array of FunctionDescriptors
 * @return array of function descriptor.
 */
public FunctionDescriptor[] getFunctionDescriptors() {
    NodeList nl = doc.getElementsByTagName(FUNCTION);
    List<FunctionDescriptor> list = new ArrayList<FunctionDescriptor>();
    if (nl != null) {
        int size = nl.getLength();
        for (int i = 0; i < size; i++) {
            list.add(new FunctionDescriptor(nl.item(i)));
        }
    }
    return list.toArray(new FunctionDescriptor[0]);
}
Also used : NodeList(org.w3c.dom.NodeList) ArrayList(java.util.ArrayList) FunctionDescriptor(com.sun.enterprise.tools.verifier.web.FunctionDescriptor)

Example 2 with FunctionDescriptor

use of com.sun.enterprise.tools.verifier.web.FunctionDescriptor in project Payara by payara.

the class TaglibFunctionMethodTest method check.

public Result check(WebBundleDescriptor descriptor) {
    ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
    Result result = getInitializedResult();
    VerifierTestContext context = getVerifierContext();
    TagLibDescriptor[] tlds = context.getTagLibDescriptors();
    FunctionDescriptor[] fnDesc = null;
    if (tlds == null) {
        addGoodDetails(result, compName);
        result.passed(smh.getLocalString(getClass().getName() + ".passed", "No tag lib files are specified"));
        return result;
    }
    for (TagLibDescriptor tld : tlds) {
        if (tld.getSpecVersion().compareTo("2.0") >= 0) {
            fnDesc = tld.getFunctionDescriptors();
            if (fnDesc != null)
                for (FunctionDescriptor fd : fnDesc) checkMethodExistence(result, fd, tld, compName);
        }
    }
    if (result.getStatus() != Result.FAILED) {
        addGoodDetails(result, compName);
        result.passed(smh.getLocalString(getClass().getName() + ".passed", "All methods defined in the function-signature element" + "of the tag lib descriptor are properly defined."));
    }
    return result;
}
Also used : VerifierTestContext(com.sun.enterprise.tools.verifier.VerifierTestContext) TagLibDescriptor(com.sun.enterprise.tools.verifier.TagLibDescriptor) FunctionDescriptor(com.sun.enterprise.tools.verifier.web.FunctionDescriptor) ComponentNameConstructor(com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor) Result(com.sun.enterprise.tools.verifier.Result)

Example 3 with FunctionDescriptor

use of com.sun.enterprise.tools.verifier.web.FunctionDescriptor in project Payara by payara.

the class TaglibFunctionSignatureIsValid method check.

public Result check(WebBundleDescriptor descriptor) {
    ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
    Result result = getInitializedResult();
    VerifierTestContext context = getVerifierContext();
    TagLibDescriptor[] tlds = context.getTagLibDescriptors();
    FunctionDescriptor[] fnDesc = null;
    if (tlds == null) {
        addGoodDetails(result, compName);
        result.passed(smh.getLocalString(getClass().getName() + ".passed", "No tag lib files are specified"));
        return result;
    }
    for (TagLibDescriptor tld : tlds) {
        if (tld.getSpecVersion().compareTo("2.0") >= 0) {
            fnDesc = tld.getFunctionDescriptors();
            if (fnDesc != null)
                for (FunctionDescriptor fd : fnDesc) checkSignature(result, fd, tld, compName);
        }
    }
    if (result.getStatus() != Result.FAILED) {
        addGoodDetails(result, compName);
        result.passed(smh.getLocalString(getClass().getName() + ".passed", "function-signature element of the tag lib " + "descriptor are properly defined."));
    }
    return result;
}
Also used : VerifierTestContext(com.sun.enterprise.tools.verifier.VerifierTestContext) TagLibDescriptor(com.sun.enterprise.tools.verifier.TagLibDescriptor) FunctionDescriptor(com.sun.enterprise.tools.verifier.web.FunctionDescriptor) ComponentNameConstructor(com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor) Result(com.sun.enterprise.tools.verifier.Result)

Aggregations

FunctionDescriptor (com.sun.enterprise.tools.verifier.web.FunctionDescriptor)3 Result (com.sun.enterprise.tools.verifier.Result)2 TagLibDescriptor (com.sun.enterprise.tools.verifier.TagLibDescriptor)2 VerifierTestContext (com.sun.enterprise.tools.verifier.VerifierTestContext)2 ComponentNameConstructor (com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor)2 ArrayList (java.util.ArrayList)1 NodeList (org.w3c.dom.NodeList)1