FileDocCategorySizeDatePackage
CheckConnectionFactoryImplSerializable.javaAPI DocGlassfish v2 API5970Fri May 04 22:33:30 BST 2007com.sun.enterprise.tools.verifier.tests.connector.managed

CheckConnectionFactoryImplSerializable

public class CheckConnectionFactoryImplSerializable extends com.sun.enterprise.tools.verifier.tests.connector.ConnectorTest implements com.sun.enterprise.tools.verifier.tests.connector.ConnectorCheck
Test for each connection-definition, that "connectionfactory-impl-class" implements java.io.Serializable
author
Anisha Malhotra
version

Fields Summary
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.ConnectorDescriptor descriptor)

Test for each connection-definition, that "connectionfactory-impl-class" implements java.io.Serializable

param
descriptor deployment descriptor for the rar file
return
result object containing the result of the individual test performed


    Result result = getInitializedResult();
    ComponentNameConstructor compName = 
      getVerifierContext().getComponentNameConstructor();
    // test NA for inboundRA
    if(!descriptor.getOutBoundDefined())
    {
      result.addNaDetails(smh.getLocalString
          ("tests.componentNameConstructor",
           "For [ {0} ]",
           new Object[] {compName.toString()}));
      result.notApplicable(smh.getLocalString
          ("com.sun.enterprise.tools.verifier.tests.connector.managed.notApplicableForInboundRA",
           "Resource Adapter does not provide outbound communication"));
      return result;
    }
    OutboundResourceAdapter outboundRA =
      descriptor.getOutboundResourceAdapter();
    if(outboundRA == null)
    {
      return null;
    }
    boolean oneFailed = false;
    Set connDefs = outboundRA.getConnectionDefs();
    Iterator iter = connDefs.iterator();
    while(iter.hasNext()) 
    {
      ConnectionDefDescriptor connDefDesc = (ConnectionDefDescriptor)
        iter.next();
      String connectionImpl = connDefDesc.getConnectionFactoryImpl();
      Class implClass = null;
      try
      {
        implClass = Class.forName(connectionImpl, false, getVerifierContext().getClassLoader());
      }
      catch(ClassNotFoundException e)
      {
        result.addErrorDetails(smh.getLocalString
            ("tests.componentNameConstructor",
             "For [ {0} ]",
             new Object[] {compName.toString()}));
        result.failed(smh.getLocalString
            (getClass().getName() + ".nonexist",
             "Error: The class [ {0} ] as defined under connectionfactory-impl-class in the deployment descriptor does not exist",
             new Object[] {connectionImpl}));
        return result;
      }
      if(!isImplementorOf(implClass, "java.io.Serializable"))
      {
        oneFailed = true;
        result.addErrorDetails(smh.getLocalString
            ("tests.componentNameConstructor",
             "For [ {0} ]",
             new Object[] {compName.toString()}));
        result.failed(smh.getLocalString(getClass().getName() + ".failed",
              "Error: connectionfactory-impl-class [ {0} ] does not implement java.io.Serializable",
              new Object[] {implClass.getName()}));
        return result;                
      }
    }
    if(!oneFailed)
    {
      result.addGoodDetails(smh.getLocalString
          ("tests.componentNameConstructor",
           "For [ {0} ]",
           new Object[] {compName.toString()}));	
      result.passed(smh.getLocalString(getClass().getName() + ".passed",
            "Success: all connectionfactory-impl-class implement java.io.Serializable"));                     
    }
    return result;