FileDocCategorySizeDatePackage
CheckActivationSpecClass.javaAPI DocGlassfish v2 API5787Fri May 04 22:33:30 BST 2007com.sun.enterprise.tools.verifier.tests.connector.messageinflow

CheckActivationSpecClass

public class CheckActivationSpecClass extends com.sun.enterprise.tools.verifier.tests.connector.ConnectorTest implements com.sun.enterprise.tools.verifier.tests.connector.ConnectorCheck
Test for each message-listener , that "activationspec-class" implements "javax.resource.spi.ActivationSpec".
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 message-listener , that "activationspec-class" implements "javax.resource.spi.ActivationSpec".

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();
    if(!descriptor.getInBoundDefined())
    {
      result.addNaDetails(smh.getLocalString
          ("tests.componentNameConstructor",
           "For [ {0} ]",
           new Object[] {compName.toString()}));
      result.notApplicable(smh.getLocalString
          ("com.sun.enterprise.tools.verifier.tests.connector.messageinflow.notApp",
           "Resource Adapter does not provide inbound communication"));
      return result;
    }
    InboundResourceAdapter ra = descriptor.getInboundResourceAdapter();
    Set msgListeners = ra.getMessageListeners();
    boolean oneFailed = false;
    Iterator iter = msgListeners.iterator();
    while(iter.hasNext()) 
    {
      MessageListener msgListener = (MessageListener) iter.next();
      String impl = msgListener.getActivationSpecClass();
      Class implClass = null;
      try
      {
        implClass = Class.forName(impl, false, getVerifierContext().getClassLoader());
      }
      catch(ClassNotFoundException e)
      {
        result.addErrorDetails(smh.getLocalString
            ("tests.componentNameConstructor",
             "For [ {0} ]",
             new Object[] {compName.toString()}));
        result.failed(smh.getLocalString
            ("com.sun.enterprise.tools.verifier.tests.connector.messageinflow.nonexist",
             "Error: The class [ {0} ] as defined under activationspec-class in the deployment descriptor does not exist",
             new Object[] {impl}));
        return result;
      }
      if(!isImplementorOf(implClass, "javax.resource.spi.ActivationSpec"))
      {
        oneFailed = true;
        result.addErrorDetails(smh.getLocalString
            ("tests.componentNameConstructor",
             "For [ {0} ]",
             new Object[] {compName.toString()}));
        result.failed(smh.getLocalString(getClass().getName() + ".failed",
              "Error: activationspec-class [ {0} ] does not implement javax.resource.spi.ActivationSpec.",
              new Object[] {impl}));
        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 activationspec-class implement javax.resource.spi.ActivationSpec"));
    }
    return result;