FileDocCategorySizeDatePackage
ServiceImplBeanLinkCheck.javaAPI DocGlassfish v2 API6617Fri May 04 22:34:16 BST 2007com.sun.enterprise.tools.verifier.tests.webservices

ServiceImplBeanLinkCheck

public class ServiceImplBeanLinkCheck extends WSTest implements WSCheck

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(WebServiceEndpoint wsdescriptor)

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


	Result result = getInitializedResult();
        boolean pass = resolveComponentLink(wsdescriptor, result);
        return result;
    
public booleanresolveComponentLink(WebServiceEndpoint desc, Result result)

        boolean resolved = false;
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();

        if( desc.implementedByEjbComponent()) {
            EjbBundleDescriptor ejbBundle = (EjbBundleDescriptor)desc.getBundleDescriptor();
            if( ejbBundle.hasEjbByName(desc.getEjbLink())) {
                EjbDescriptor ejb = ejbBundle.getEjbByName(desc.getEjbLink());
                if (ejb != null) {
                    resolved = true;
                    //result.pass , ejb-link resolved
                     result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor",
                                   "For [ {0} ]", new Object[] {compName.toString()}));
                     result.passed(smh.getLocalString (getClass().getName() + ".passed",
                    "[{0}] link of service-impl-bean element resolved successfully.",
                           new Object[] {desc.getEjbLink()}));

                 }
                 else {
                   //result.fail, ejb-link could not be resolved
                    result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
                                   "For [ {0} ]", new Object[] {compName.toString()}));
                    result.failed(smh.getLocalString (getClass().getName() + ".failed",
                    "Could not resolve [{0}] link of service-impl-bean element.",
                  new Object[] {desc.getEjbLink()}));

                 }
            }
        } else if( desc.implementedByWebComponent()) {
            WebBundleDescriptor webBundle = (WebBundleDescriptor)desc.getBundleDescriptor();
            WebComponentDescriptor webComponent =
                (WebComponentDescriptor) webBundle.
                  getWebComponentByCanonicalName(desc.getWebComponentLink());
            if( webComponent != null && webComponent.isServlet()) {
                resolved = true;
                //result.pass servlet-link resolved
                result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor",
                         "For [ {0} ]", new Object[] {compName.toString()}));
                result.passed(smh.getLocalString (getClass().getName() + ".passed",
                 "[{0}] link of service-impl-bean element resolved successfully.",
                new Object[] {desc.getWebComponentLink()}));
            }
            else {
                   //result.fail, servlet-link could not be resolved
                   result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
                          "For [ {0} ]", new Object[] {compName.toString()}));
                   result.failed(smh.getLocalString (getClass().getName() + ".failed",
                   "Could not resolve [{0}] link of service-impl-bean element.",
                   new Object[] {desc.getWebComponentLink()}));
            }
        }
        return resolved;