FileDocCategorySizeDatePackage
PortCompRefSEIClassCheck.javaAPI DocGlassfish v2 API5243Fri May 04 22:34:18 BST 2007com.sun.enterprise.tools.verifier.tests.wsclients

PortCompRefSEIClassCheck

public class PortCompRefSEIClassCheck extends WSClientTest implements WSClientCheck

Fields Summary
ComponentNameConstructor
compName
Constructors Summary
Methods Summary
public Resultcheck(ServiceReferenceDescriptor descriptor)

param
descriptor the WebServices descriptor
return
Result the results for this assertion


	Result result = getInitializedResult();
        compName = getVerifierContext().getComponentNameConstructor();

        boolean pass = true;

        Collection ports = descriptor.getPortsInfo();

        for (Iterator it=ports.iterator(); it.hasNext();) {
            ServiceRefPortInfo ref = (ServiceRefPortInfo)it.next();
            if (!loadSEIClass(ref,result)) {
               //result.fail ref.getName(), ref.getServiceEndpointInterface
               result.addErrorDetails(smh.getLocalString
                                  ("tests.componentNameConstructor",
                                   "For [ {0} ]", new Object[] {compName.toString()}));
               result.failed(smh.getLocalString
                   (getClass().getName() + ".failed",
                    "Error: Service Endpoint Interface class [ {0} ]  not found.",
                    new Object[] {ref.getServiceEndpointInterface()}));
               
               pass = false;
            }
            else {
              //result.pass
              result.addGoodDetails(smh.getLocalString
                                  ("tests.componentNameConstructor",
                                   "For [ {0} ]", new Object[] {compName.toString()}));
              result.passed(smh.getLocalString (getClass().getName() + ".passed",
              "Service Endpoint Interface class [ {0} ]  found.", 
              new Object[] {ref.getServiceEndpointInterface()}));

            }
        }

        return result;
    
private booleanloadSEIClass(ServiceRefPortInfo ref, Result result)


     boolean pass = true;

     if (ref.hasServiceEndpointInterface()) {
        try {
              Class.forName(ref.getServiceEndpointInterface(), false, getVerifierContext().getClassLoader());
           } catch (ClassNotFoundException e) {
               Verifier.debug(e);
               pass = false;
           }
     }
     else {
       //result.not applicable (SEI not specified)
       result.addNaDetails(smh.getLocalString
                     ("tests.componentNameConstructor", "For [ {0} ]",
                      new Object[] {compName.toString()}));
       result.notApplicable(smh.getLocalString
                 ( getClass().getName() + ".notapp",
                 "Not applicable since Service reference does not specify an SEI."));

     }
    return pass;