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

ServiceRefCheck

public class ServiceRefCheck extends WSClientTest implements WSClientCheck

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

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


	Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        boolean pass = true;

        if (descriptor.hasGenericServiceInterface()) {
           //result.pass , has generic service interface
           result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor",
                                   "For [ {0} ]", new Object[] {compName.toString()}));
           result.passed(smh.getLocalString (getClass().getName() + ".passed",
           "The JAX-RPC Service interface the client depends on is the Generic Service Interface."));

           
        }
        else if (descriptor.hasGeneratedServiceInterface()) {
           String intf = descriptor.getServiceInterface();
           try {
             Class cl = Class.forName(intf, false, getVerifierContext().getClassLoader());
               // result.pass
             result.addGoodDetails(smh.getLocalString ("tests.componentNameConstructor",
                                   "For [ {0} ]", new Object[] {compName.toString()}));
             result.passed(smh.getLocalString (getClass().getName() + ".passed1",
             "The JAX-RPC Service interface the client depends on is a Generated Service Interface [{0}].",
              new Object[] {intf}));

           }catch (ClassNotFoundException e) {
            //result.fail; Generated service interface class does not exist
            result.addErrorDetails(smh.getLocalString ("tests.componentNameConstructor",
            "For [ {0} ]", new Object[] {compName.toString()}));
            result.failed(smh.getLocalString (getClass().getName() + ".failed",
            "The JAX-RPC Service interface the client depends on [{0}] could not be loaded.",
            new Object[] {intf}));

            pass = false;
          }
        }
        else {
          //result.internal error, its neither type, or error in XML 
          result.addErrorDetails(smh.getLocalString
               ("com.sun.enterprise.tools.verifier.tests.webservices.Error",
                "Error: Unexpected error occurred [ {0} ]",
                new Object[] {"Service Interface Neither Generic nor Generated"}));
        }

        return result;