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

ManagedConnectionGetMetaData

public class ManagedConnectionGetMetaData extends com.sun.enterprise.tools.verifier.tests.connector.ConnectorTest implements com.sun.enterprise.tools.verifier.tests.connector.ConnectorCheck
Test that the return type of javax.resource.spi.ManagedConnection.getMetaData() implements the ManagedConnectionMetaData interface.
author
Anisha Malhotra
version

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

Test that the return type of javax.resource.spi.ManagedConnection.getMetaData() implements the ManagedConnectionMetaData interface.

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;
    }
	//File jarFile = Verifier.getJarFile(descriptor.getModuleDescriptor().getArchiveUri());
//        File f=Verifier.getArchiveFile(descriptor.getModuleDescriptor().getArchiveUri());
        Class c = findImplementorOf(descriptor, "javax.resource.spi.ManagedConnection");
    if(c == null)
    {
      result.addErrorDetails(smh.getLocalString
          ("tests.componentNameConstructor",
           "For [ {0} ]",
           new Object[] {compName.toString()}));
      result.failed(smh.getLocalString
          ("com.sun.enterprise.tools.verifier.tests.connector.ConnectorTest.findImplementor.failed", 
           "Error: There is no implementation of the [ {0} ] provided",
           new Object[] {"javax.resource.spi.ManagedConnection"}));        
      return result;
    }
    // get return type of getMetaData()
    Method m = null;
    do {
      try {
        m = c.getMethod("getMetaData", (Class[])null);
      } catch(NoSuchMethodException nsme) {
      } catch(SecurityException se) {
      }
      c = c.getSuperclass();
    } while (m != null && c != Object.class);            
    if(m == null)
    {
      result.addErrorDetails(smh.getLocalString
          ("tests.componentNameConstructor",
           "For [ {0} ]",
           new Object[] {compName.toString()}));
      result.failed(smh.getLocalString
          ("com.sun.enterprise.tools.verifier.tests.connector.managed.ManagedConnectionGetMetaData.failed", 
           "Error: There is no implementation of getMetaData() provided"));
      return result;
    }
    Class returnType = m.getReturnType();
    if(VerifierTest.isImplementorOf(returnType, 
          "javax.resource.spi.ManagedConnectionMetaData"))
    {
      result.addGoodDetails(smh.getLocalString
          ("tests.componentNameConstructor",
           "For [ {0} ]",
           new Object[] {compName.toString()}));
      result.passed(smh.getLocalString
          ("com.sun.enterprise.tools.verifier.tests.connector.managed.ManagedConnectionGetMetaData.passed", 
           "ManagedConnection.getMetaData() returns an instance of the" + 
           "javax.resource.spi.ManagedConnectionMetaData interface"));
    }
    else
    {
      result.addErrorDetails(smh.getLocalString
          ("tests.componentNameConstructor",
           "For [ {0} ]",
           new Object[] {compName.toString()}));
      result.failed(smh.getLocalString
          ("com.sun.enterprise.tools.verifier.tests.connector.managed.ManagedConnectionGetMetaData.failed1", 
           "Error: getMetaData() does not return an instance of the" + 
           "javax.resource.spi.ManagedConnectionMetaData interface"));
    }
    return result;