Package com.sun.enterprise.tools.verifier

Examples of com.sun.enterprise.tools.verifier.Result


   * @return result object containing the result of the individual test
   * performed
   */
  public Result check(ConnectorDescriptor descriptor) {

    Result result = getInitializedResult();
    ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
    if(isCCIImplemented(descriptor, result))
    {
      Class c = testConnectionImpl(descriptor, result);
      // failure are handled in the superclass
      if (c!=null)
      {
        result.addGoodDetails(smh.getLocalString
            ("tests.componentNameConstructor",
             "For [ {0} ]",
             new Object[] {compName.toString()}))
        result.passed(smh.getLocalString
            (getClass().getName() + ".passed",
             "The class define in the connection-impl-class tag [ {0} ] is contained in the archive.",
             new Object[] {c.getName()} ));       
      }
    }
    else
    {
      // test is NA
      result.addNaDetails(smh.getLocalString
          ("tests.componentNameConstructor",
           "For [ {0} ]",
           new Object[] {compName.toString()}));
      result.notApplicable(smh.getLocalString
          ("com.sun.enterprise.tools.verifier.tests.connector.cci.notApp",
           "The CCI interfaces do not seem to be implemented by this resource adapter"));
    }
    return result;       
  }
View Full Code Here


   * @return result object containing the result of the individual test
   * performed
   */   
  public Result check(ConnectorDescriptor descriptor) {

    Result result = getInitializedResult();
    ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
    if(isCCIImplemented(descriptor, result))
    {
      Class cf = testConnectionFactoryImpl(descriptor, result);
      if (cf == null)
        return result;
      String className = cf.getName();

      do {
        Method[] allMethods = cf.getMethods();
        for (int i=0;i<allMethods.length;i++) {
          if (allMethods[i].getName().equals("getConnection")) {
            // found it, check the return type
            String connection = getConnectionInterface(descriptor, result);
            if (isSubclassOf(allMethods[i].getReturnType(), connection)) {
              result.addGoodDetails(smh.getLocalString
                  ("tests.componentNameConstructor",
                   "For [ {0} ]",
                   new Object[] {compName.toString()}));
              result.passed(smh.getLocalString(
                    getClass().getName() + ".passed",
                    "The getConnection method of the [ {0} ] returns the [ {1} ] interface",
                    new Object[] {cf.getName(), connection} ));       
            } else {
              result.addErrorDetails(smh.getLocalString
                  ("tests.componentNameConstructor",
                   "For [ {0} ]",
                   new Object[] {compName.toString()}));
              result.failed(smh.getLocalString(                       
                    getClass().getName() + ".failed",
                    "Error: The getConnection method of the [ {0} ] does not return the [ {1} ] interface",
                    new Object[] {cf.getName(), connection} ));       
            }
            return result;
          }
        }
        cf = cf.getSuperclass();
      } while (cf!=null);
      result.addWarningDetails(smh.getLocalString
          ("tests.componentNameConstructor",
           "For [ {0} ]",
           new Object[] {compName.toString()}));
      result.warning(smh.getLocalString(
            getClass().getName() + ".warning",
            "Warning: The getConnection method is not defined by [ {0} ]",
            new Object[] {className} ));
    }
    else
    {
      result.addNaDetails(smh.getLocalString
          ("tests.componentNameConstructor",
           "For [ {0} ]",
           new Object[] {compName.toString()}));
      result.notApplicable(smh.getLocalString
          ("com.sun.enterprise.tools.verifier.tests.connector.cci.notApp",
           "The CCI interfaces do not seem to be implemented by this resource adapter"));
    }
    return result;
  }
View Full Code Here

public class ASEjbBeanCache extends EjbTest implements EjbCheck {

    public BeanCacheDescriptor beanCache;
    public Result check(EjbDescriptor descriptor)
    {
        Result result = getInitializedResult();
      ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        String beanCache = null;
        try{
            beanCache = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache");
            if(beanCache!=null)
            {
                if(descriptor instanceof EjbEntityDescriptor
                        || (descriptor instanceof EjbSessionDescriptor
                        && ((EjbSessionDescriptor)descriptor).getSessionType().equals(EjbSessionDescriptor.STATEFUL)))
                {
                    addGoodDetails(result, compName);
                    result.passed(smh.getLocalString(getClass().getName()+".passed",
                                "PASSED [AS-EJB ejb] : bean-cache Element parsed"));
                }
                else
                {
                    addWarningDetails(result, compName);
                    result.warning(smh.getLocalString(getClass().getName()+".warning1",
                            "WARNING [AS-EJB ejb] : bean-cache should be defined only for Stateful Session and Entity Beans"));
                }
            }
            else
            {
                addNaDetails(result, compName);
                result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
                        "NOT APPLICABLE [AS-EJB ejb] : bean-cache element not defined"));
            }
        }catch(Exception ex)
        {
            addErrorDetails(result, compName);
            result.addErrorDetails(smh.getLocalString
                    (getClass().getName() + ".notRun",
                            "NOT RUN [AS-EJB] : Could not get a beanCache object"));
        }
        return result;
    }
View Full Code Here

* @author Sanjeeb Sahoo
*/
public class ConnectorArchiveClassesLoadable extends ConnectorTest implements ConnectorCheck {

    public Result check(ConnectorDescriptor descriptor) {
        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        String archiveUri = getAbstractArchiveUri(descriptor);
       
        boolean allPassed = true;
        Enumeration entries= null;
        ClosureCompiler closureCompiler=getVerifierContext().getClosureCompiler();;
        try {
                String uri = getAbstractArchiveUri(descriptor);
                FileArchive arch = new FileArchive();
                arch.open(uri);
                entries = arch.entries();
                arch.close();
        } catch(Exception e) {
            e.printStackTrace();
            result.failed(smh.getLocalString(getClass().getName() + ".exception",
                                             "Error: [ {0} ] exception while loading the archive [ {1} ].",
                                              new Object[] {e, descriptor.getName()}));
            return result;
        }
        Object entry;
        while (entries.hasMoreElements()) {
            String name=null;
            entry  = entries.nextElement();
               name = (String)entry;
            if (name.endsWith(".class")) {
                String classEntryName = name.substring(0, name.length()-".class".length()).replace('/','.');
                boolean status=closureCompiler.buildClosure(classEntryName);
                allPassed=status && allPassed;
            }
        }
        if (allPassed) {
            result.setStatus(Result.PASSED);
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                (getClass().getName() + ".passed",
                "All the classes are loadable within [ {0} ] without any linkage error.",
                new Object[] {archiveUri}));
//            result.addGoodDetails(closureCompiler.toString());
        } else {
            result.setStatus(Result.FAILED);
            addErrorDetails(result, compName);
            result.addErrorDetails(ArchiveClassesLoadableHelper.
                    getFailedResult(closureCompiler));
            result.addErrorDetails(smh.getLocalString
                    ("com.sun.enterprise.tools.verifier.tests.loadableError",
                            "Please either bundle the above mentioned classes in the application " +
                            "or use optional packaging support for them."));
        }
        return result;
View Full Code Here

public class ASEjbBCCacheIdleTimeout extends ASEjbBeanCache
{
   
    public Result check(EjbDescriptor descriptor)
    {
        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        String beanCache = null;
        String idleTimeout = null;
        try{
            beanCache = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache");
            if(beanCache!=null)
            {
                try{
                    idleTimeout = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache/cache-idle-timeout-in-seconds");
                    if(idleTimeout!=null)
                    {
                        idleTimeout = idleTimeout.trim();
                        if (idleTimeout.length()==0)
                        {
                            addErrorDetails(result, compName);
                            result.failed(smh.getLocalString(getClass().getName()+".failed",
                                    "FAILED [AS-EJB bean-cache] : cache-idle-timeout-in-seconds cannot be empty. It should be between 0 and {0}",
                                    new Object[]{new Long(Long.MAX_VALUE)}));
                        }else
                        {
                            long value = new Integer(idleTimeout).longValue();
                            if(value < || value > Long.MAX_VALUE)
                            {
                                addErrorDetails(result, compName);
                                result.failed(smh.getLocalString(getClass().getName()+".failed1",
                                    "FAILED [AS-EJB bean-cache] : cache-idle-timeout-in-seconds cannot be {0}. It should be between 0 and {1}",
                                    new Object[]{new Long(value),new Long(Long.MAX_VALUE)}));
                            }else
                            {
                                addGoodDetails(result, compName);
                                result.passed(smh.getLocalString(getClass().getName()+".passed",   
                                    "PASSED [AS-EJB bean-cache] : cache-idle-timeout-in-seconds is [{0}]",
                                    new Object[]{new Long(value)}));
                            }
                        }
                    }else //idle-timeout-in-seconds not defined
                    {
                        addNaDetails(result, compName);
                        result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
                                "NOT APPLICABLE [AS-EJB bean-cache] : cache-idle-timeout-in-seconds element not defined"));
                    }
                }catch(NumberFormatException nfex)
                {
                     Verifier.debug(nfex);
                    addErrorDetails(result, compName);
                    result.failed(smh.getLocalString(getClass().getName()+".failed2",
                            "FAILED [AS-EJB bean-cache] : [{0}] is not a valid Long number",new Object[]{idleTimeout}));

                }
            }else //bean-cache element not defined
            {
                addNaDetails(result, compName);
                result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable1",
                   "NOT APPLICABLE [AS-EJB] : bean-cache element not defined"));
             }

    }catch(Exception ex){
            addErrorDetails(result, compName);
            result.addErrorDetails(smh.getLocalString
                (getClass().getName() + ".notRun",
                    "NOT RUN [AS-EJB] : Could not create an descriptor object"));
        }
        return result;
    }
View Full Code Here

public class ASEjbMessageDestination extends EjbTest implements EjbCheck {

    public Result check(EjbDescriptor descriptor) {

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

        String messageDestinationName=null;
        String jndiName=null;
        int count = 0;
        try{
            count = getCountNodeSet("sun-ejb-jar/enterprise-beans/message-destination");
            if (count>0){
                for(int i=0;i<count;i++){
                    messageDestinationName = getXPathValue("sun-ejb-jar/enterprise-beans/message-destination/message-destination-name");
                    jndiName = getXPathValue("sun-ejb-jar/enterprise-beans/message-destination/jndi-name");
                   
                    if(messageDestinationName==null || messageDestinationName.length()==0){
                        result.addErrorDetails(smh.getLocalString
                            ("tests.componentNameConstructor",
                            "For [ {0} ]",
                            new Object[] {compName.toString()}));
                        result.failed(smh.getLocalString
                            (getClass().getName() + ".failed1",
                            "FAILED [AS-EJB message-destination] : message-destination-name cannot be an empty string",
                            new Object[] {descriptor.getName()}));
                    }else{
                        result.addGoodDetails(smh.getLocalString
                            ("tests.componentNameConstructor",
                            "For [ {0} ]",
                            new Object[] {compName.toString()}));
                        result.passed(smh.getLocalString(
                                            getClass().getName() + ".passed1",
                              "PASSED [AS-EJB message-destination] : message-destination-name is {1}",
                              new Object[] {descriptor.getName(),messageDestinationName}));
                    }
                   
                    if(jndiName==null || jndiName.length()==0){
                        result.addErrorDetails(smh.getLocalString
                            ("tests.componentNameConstructor",
                            "For [ {0} ]",
                            new Object[] {compName.toString()}));
                        result.failed(smh.getLocalString
                            (getClass().getName() + ".failed2",
                            "FAILED [AS-EJB message-destination] : jndi-name cannot be an empty string",
                            new Object[] {descriptor.getName()}));
                    }else{
                        result.addGoodDetails(smh.getLocalString
                            ("tests.componentNameConstructor",
                            "For [ {0} ]",
                            new Object[] {compName.toString()}));
                        result.passed(smh.getLocalString(
                                            getClass().getName() + ".passed2",
                              "PASSED [AS-EJB message-destination] : jndi-name is {1}",
                              new Object[] {descriptor.getName(),jndiName}));
                    }
                }
            }else{
                result.addNaDetails(smh.getLocalString
        ("tests.componentNameConstructor",
        "For [ {0} ]",
        new Object[] {compName.toString()}));
                result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
                    "NOT APPLICABLE [AS-EJB message-destination] : message-destination Element not defined"));
            }

           
        }catch(Exception ex){
            result.failed(smh.getLocalString
                (getClass().getName() + ".failed",
                    "FAILED [AS-EJB message-destination] could not create the servlet object"));
        }
  return result;
    }
View Full Code Here

public class ASEjbBCVictimPolicy extends ASEjbBeanCache
{
   
    public Result check(EjbDescriptor descriptor)
    {
        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        String beanCache = null;
        String victimPolicy = null;
        try{
            beanCache = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache");
            if(beanCache!=null)
            {
                victimPolicy = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache/victim-selection-policy");
                if(victimPolicy!=null)
                {
                    victimPolicy = victimPolicy.trim();
                    if(victimPolicy.length()==0)
                    {
                        addErrorDetails(result, compName);
                        result.failed(smh.getLocalString(getClass().getName()+".failed",
                            "FAILED [AS-EJB bean-cache] : victim-selection-policy cannot be empty. It has to be either FIFO, NRU or LRU"));
                    }else
                    {
                        if(!victimPolicy.equalsIgnoreCase("FIFO") && !victimPolicy.equalsIgnoreCase("NRU")
                                && !victimPolicy.equalsIgnoreCase("LRU"))
                        {
                            addErrorDetails(result, compName);
                            result.failed(smh.getLocalString(getClass().getName()+".failed1",
                                    "FAILED [AS-EJB bean-cache] : victim-selection-policy cannot be [{0}]. It should be either FIFO, NRU or LRU [case insensitive]",
                                    new Object[]{victimPolicy}));
                        }
                        else
                        {
                            addGoodDetails(result, compName);
                            result.passed(smh.getLocalString(getClass().getName()+".passed",
                                "PASSED [AS-EJB bean-cache] : victim-selection-policy is {0}",
                                 new Object[]{victimPolicy}));
                        }
                    }
                }else //victim-selection-policy not defined
                {
                    addNaDetails(result, compName);
                    result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
                        "NOT APPLICABLE [AS-EJB bean-cache] : victim-selection-policy element not defined"));
               
                }
           
            }else //bean-cache is not defined
            {
                addNaDetails(result, compName);
                result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable1",
                    "NOT APPLICABLE [AS-EJB] : bean-cache element not defined"));          
           
            }
        }catch(Exception ex){
            addErrorDetails(result, compName);
            result.addErrorDetails(smh.getLocalString
                 (getClass().getName() + ".notRun",
                  "NOT RUN [AS-EJB] : Could not create the descriptor object"));       
        }
        return result;
    }
View Full Code Here

     * @return result object containing the result of the individual test
     * performed
     */
    public Result check(ConnectorDescriptor descriptor) {
       
        Result result = getInitializedResult();
  ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        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;
        }
       
        // let's get first the the default implementation of the ConnectionManager
        //File jarFile = Verifier.getJarFile(descriptor.getModuleDescriptor().getArchiveUri());
//        File f=Verifier.getArchiveFile(descriptor.getModuleDescriptor().getArchiveUri());
        Class c = findImplementorOf(descriptor, "javax.resource.spi.ConnectionManager");
       
        if (c!=null) {
            // We found it, let's see if it implements the right interface
            testImplementationOf(c, "java.io.Serializable", result);
            return result;
        }
        // ooppss, no implementation of the default Connection Manager
        result.addErrorDetails(smh.getLocalString
             ("tests.componentNameConstructor",
        "For [ {0} ]",
        new Object[] {compName.toString()}));
  result.failed(smh.getLocalString
          ("com.sun.enterprise.tools.verifier.tests.connector.DefaultConnectionManagerExistence.failed",
           "Error: There is no default implementation of the [ {0} ] provided",
           new Object[] {"javax.resource.spi.ConnectionManager"}));                           
        return result;
    }
View Full Code Here

public class ASEjbBCRemovalTimeout extends ASEjbBeanCache
{
    public Result check(EjbDescriptor descriptor)
    {
        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        String beanCache = null;
        String removeTime = null;
        try{
            beanCache = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache");
            if(beanCache!=null)
            {
                removeTime = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache/removal-timeout-in-seconds");
                if (removeTime!=null)
                {
                    try{
                        removeTime = removeTime.trim();
                        if (removeTime.length()==0)
                        {
                            addErrorDetails(result, compName);
                            result.failed(smh.getLocalString(getClass().getName()+".failed",
                                    "FAILED [AS-EJB bean-cache] : removal-timeout-in-seconds cannot be empty. It should be between 0 and {0}",
                                    new Object[]{new Long(Long.MAX_VALUE)}));
                        }else
                        {
                            long value = new Integer(removeTime).longValue();
                            if(value < || value > Long.MAX_VALUE)
                            {
                                addErrorDetails(result, compName);
                                result.failed(smh.getLocalString(getClass().getName()+".failed1",
                                    "FAILED [AS-EJB bean-cache] : removal-timeout-in-seconds cannot be {0}. It should be between 0 and {1}",
                                    new Object[]{new Long(value),new Long(Long.MAX_VALUE)}));
                            }else
                            {
                                addGoodDetails(result, compName);
                                result.passed(smh.getLocalString(getClass().getName()+".passed",
                                    "PASSED [AS-EJB bean-cache] : removal-timeout-in-seconds is {0}",
                                    new Object[]{new Long(value)}));
                            }
                        }
                    }catch(NumberFormatException nfex){
                        Verifier.debug(nfex);
                        addErrorDetails(result, compName);
                        result.failed(smh.getLocalString(getClass().getName()+".failed2",
                                "FAILED [AS-EJB bean-cache] : [{0}] is not a valid Long number",new Object[]{removeTime}));
                    }
                } else // removal-timeout not defined
                {
                    addNaDetails(result, compName);
                    result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
                                "NOT APPLICABLE [AS-EJB bean-cache] : removal-timeout-in-seconds element not defined"));
                }
            }else // bean-cache not defined
            {
                addNaDetails(result, compName);
                result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable1",
                    "NOT APPLICABLE [AS-EJB] : bean-cache element not defined"));
            }

        }catch(Exception ex)
        {
            addErrorDetails(result, compName);
            result.addErrorDetails(smh.getLocalString
                    (getClass().getName() + ".notRun",
                            "NOT RUN [AS-EJB] : Could not create an descriptor object"));
        }
        return result;
    }
View Full Code Here

     * the connector.
     * @return <code>Result</code> Code execution result
     */
    public Result check(ConnectorDescriptor descriptor) {
       
        Result result = getInitializedResult();
  ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        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;
        }
        String connectorTransactionSupport =
        descriptor.getOutboundResourceAdapter().getTransSupport();
       
        // No transaction support specified, this is an error
        if (connectorTransactionSupport==null) {
      result.addErrorDetails(smh.getLocalString
           ("tests.componentNameConstructor",
            "For [ {0} ]",
            new Object[] {compName.toString()}));
      result.failed(smh.getLocalString
        (getClass().getName() + ".nonexist",
         "Error: No Transaction support specified for ressource adapter",
         new Object[] {connectorTransactionSupport}));       
            return result;
        }
       
        // let's loop over all acceptable values to check the declared one is valid
        for (int i=0;i<acceptableValues.length;i++) {
            if (connectorTransactionSupport.equals(acceptableValues[i])) {
                   
                // Test passed, we found an acceptable value
         result.addGoodDetails(smh.getLocalString
               ("tests.componentNameConstructor",
          "For [ {0} ]",
          new Object[] {compName.toString()}))
    result.passed(smh.getLocalString
              (getClass().getName() + ".passed",
                    "Transaction support [ {0} ] for ressource adapter is supported",
              new Object[] {connectorTransactionSupport}));
               return result;
            }    
        }
       
        // If we end up here, we haven't found an acceptable transaction support
  result.addErrorDetails(smh.getLocalString
               ("tests.componentNameConstructor",
          "For [ {0} ]",
          new Object[] {compName.toString()}));
  result.failed(smh.getLocalString
         (getClass().getName() + ".failed",
                "Error: Deployment descriptor transaction-support [ {0} ] for ressource adapter is not valid",
    new Object[] {connectorTransactionSupport}));       
        return result;
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.tools.verifier.Result

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.