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(!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, "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: activationspec-class [ {0} ] does not implement java.io.Serializable",
              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 java.io.Serializable"));
    }
    return result;
  }
View Full Code Here


     * @param descriptor the Enterprise Java Bean deployment descriptor
     * @return <code>Result</code> the results for this assertion
     */
    public Result check(EjbDescriptor descriptor) {

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

  if ((descriptor instanceof EjbSessionDescriptor||
      (descriptor instanceof EjbEntityDescriptor)) {
      boolean oneFailed = false;
      int foundAtLeastOne = 0;
      try {
    if(descriptor.getHomeClassName() == null || "".equals(descriptor.getHomeClassName())) {
        addNaDetails(result, compName);
        result.notApplicable(smh.getLocalString
           (getClass().getName() + ".notApplicable1",
            " [ {0} ] does not have a remote home interface. ",
            new Object[] {descriptor.getEjbClassName()}));
        return result;
    }
    ClassLoader jcl = getVerifierContext().getClassLoader();
    Class rc = Class.forName(descriptor.getHomeClassName(), false, jcl);

    Class methodReturnType;
    boolean homeMethodFound = false;
    boolean isLegalRMIIIOPReturn = false;
    for (Method remoteMethod : rc.getMethods()) {

                    // we don't test the EJB methods
                    if (remoteMethod.getDeclaringClass().getName().equals("javax.ejb.EJBHome"))
                        continue;
        if (remoteMethod.getName().startsWith("create") ||
      remoteMethod.getName().startsWith("find") ||
      remoteMethod.getName().startsWith("remove"))
      continue;
                                       
        // reset flags from last time thru loop
        Class c = Class.forName(descriptor.getEjbClassName(), false, jcl);
        // start do while loop here....
        do {
     
      for (Method method : c.getDeclaredMethods()) {

          // reset flags from last time thru loop
          homeMethodFound = false;
          isLegalRMIIIOPReturn = false;
          String methodName = "ejbHome" + Character.toUpperCase(remoteMethod.getName().charAt(0)) + remoteMethod.getName().substring(1);
          if (method.getName().equals(methodName)) {
        foundAtLeastOne++;
        homeMethodFound = true;
        // The methods arguments types must be legal types for
        // RMI-IIOP.  This means that their return values must
        // be of valid types for RMI-IIOP,
        methodReturnType = method.getReturnType();
        if (RmiIIOPUtils.isValidRmiIIOPReturnType(methodReturnType)) {
            // this is the right return type for method
            isLegalRMIIIOPReturn = true;
        } // return valid
     
        // now display the appropriate results for this particular business
        // method
        if (homeMethodFound && isLegalRMIIIOPReturn ) {
            addGoodDetails(result, compName);
            result.addGoodDetails(smh.getLocalString
                (getClass().getName() + ".passed",
                 "[ {0} ] properly declares ejbHome<METHOD> method [ {1} ] with valid RMI-IIOP return type.",
                 new Object[] {descriptor.getEjbClassName(),method.getName()}));
        } else if (homeMethodFound && !isLegalRMIIIOPReturn) {
            oneFailed = true;
            addErrorDetails(result, compName);
            result.addErrorDetails(smh.getLocalString
                 (getClass().getName() + ".failed",
                  "Error: ejbHome<METHOD> method [ {0} ] was found, but ejbHome<METHOD> method has illegal return value.   ejbHome<METHOD> methods return type must be legal types for RMI-IIOP.",
                  new Object[] {method.getName()}));
        }
          }
      }
      if (oneFailed == true)
          break;
        } while (((c = c.getSuperclass()) != null) && (!homeMethodFound));
    }
    if (foundAtLeastOne == 0) {
        addNaDetails(result, compName);
        result.notApplicable(smh.getLocalString
           (getClass().getName() + ".notApplicable1",
            " [ {0} ] does not declare any ejbHome<METHOD> methods. ",
            new Object[] {descriptor.getEjbClassName()}));
    }
      } catch (ClassNotFoundException e) {
    Verifier.debug(e);
    oneFailed = true;
    addErrorDetails(result, compName);
    result.failed(smh.getLocalString
            (getClass().getName() + ".failedException",
             "Error: Remote interface [ {0} ] or bean class [ {1} ] does not exist or is not loadable within bean [ {2} ].",
             new Object[] {descriptor.getRemoteClassName(),descriptor.getEjbClassName(),descriptor.getName()}));
     

      if (oneFailed) {
    result.setStatus(Result.FAILED);
            } else if (foundAtLeastOne == 0) {
                result.setStatus(Result.NOT_APPLICABLE);
      } else {
    result.setStatus(Result.PASSED);
      }

      return result;
  } else {
      addNaDetails(result, compName);
      result.notApplicable(smh.getLocalString
         (getClass().getName() + ".notApplicable",
          "{0} expected {1} bean or {2} bean, but called with {3}.",
          new Object[] {getClass(),"Session","Entity",descriptor.getName()}));
      return result;
  }
View Full Code Here

     * @param descriptor the Enterprise Java Bean deployment descriptor
     * @return <code>Result</code> the results for this assertion
     */
    public Result check(EjbDescriptor descriptor) {

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

  if ((descriptor instanceof EjbSessionDescriptor||
      (descriptor instanceof EjbEntityDescriptor)) {
      boolean oneFailed = false;
      int foundAtLeastOne = 0;
      try {
    if(descriptor.getHomeClassName() == null || "".equals(descriptor.getHomeClassName())) {
        result.addNaDetails(smh.getLocalString
          ("tests.componentNameConstructor",
           "For [ {0} ]",
           new Object[] {compName.toString()}));
        result.notApplicable(smh.getLocalString
           (getClass().getName() + ".notApplicable1",
            " [ {0} ] does not have a remote home interface. ",
            new Object[] {descriptor.getEjbClassName()}));
        return result;
    }

    ClassLoader jcl = getVerifierContext().getClassLoader();
    Class rc = Class.forName(descriptor.getHomeClassName(), false, jcl);

    Class [] homeMethodParameterTypes;
    boolean homeMethodFound = false;
    boolean isLegalRMIIIOP = false;
 
    for (Method remoteMethod : rc.getMethods()) {

                    // we don't test the EJB methods
                    if (remoteMethod.getDeclaringClass().getName().equals("javax.ejb.EJBHome"))
                        continue;
        if (remoteMethod.getName().startsWith("create") ||
      remoteMethod.getName().startsWith("find") ||
      remoteMethod.getName().startsWith("remove"))
      continue;
                                       
        // reset flags from last time thru loop
        Class c = Class.forName(descriptor.getEjbClassName(), false, jcl);
        // start do while loop here....
        do {
     
      for (Method method : c.getDeclaredMethods()) {
          isLegalRMIIIOP = false;
          homeMethodFound = false;
             
          String methodName = "ejbHome" + Character.toUpperCase(remoteMethod.getName().charAt(0)) + remoteMethod.getName().substring(1);
         
          if (method.getName().equals(methodName)) {   
        foundAtLeastOne++;
        homeMethodFound = true;
     
        // The methods arguments types must be legal types for RMI-IIOP.
        homeMethodParameterTypes = method.getParameterTypes();
        if (RmiIIOPUtils.isValidRmiIIOPParameters(homeMethodParameterTypes)) {
            // these method parameters are valid, continue
            isLegalRMIIIOP = true;
        }
       
        // now display the appropriate results for this particular ejbHome<Method>
        // method
        if (homeMethodFound && isLegalRMIIIOP ) {
            addGoodDetails(result, compName);
            result.addGoodDetails(smh.getLocalString
                (getClass().getName() + ".passed",
                 "[ {0} ] properly declares ejbHome<Method> method " +
                                "[ {1} ] with valid RMI-IIOP parameter types.",
                 new Object[] {descriptor.getEjbClassName(),method.getName()}));
        } else if (homeMethodFound && !isLegalRMIIIOP) {
            oneFailed = true;
            addErrorDetails(result, compName);
            result.addErrorDetails(smh.getLocalString
                 (getClass().getName() + ".failed",
                  "Error: ejbHome<Method> method [ {0} ] was found, " +
                                "but ejbHome<Method> method has illegal parameter " +
                                "values.   ejbHome<Method> methods arguments types " +
                                "must be legal types for RMI-IIOP.",
                  new Object[] {method.getName()}));
            break;
        }
          }
      }
      if (oneFailed == true)
          break;
        } while (((c = c.getSuperclass()) != null) && (!homeMethodFound));
    }
    if (foundAtLeastOne == 0) {
        addNaDetails(result, compName);
        result.notApplicable(smh.getLocalString
           (getClass().getName() + ".notApplicable1",
            " [ {0} ] does not declare any ejbHome<Method> methods. ",
            new Object[] {descriptor.getEjbClassName()}));
    }
      } catch (ClassNotFoundException e) {
    Verifier.debug(e);
    oneFailed = true;
    addErrorDetails(result, compName);
    result.failed(smh.getLocalString
            (getClass().getName() + ".failedException",
             "Error: Remote interface [ {0} ] or bean class [ {1} ] does not " +
                   "exist or is not loadable within bean [ {2} ].",
             new Object[] {descriptor.getRemoteClassName(),descriptor.getEjbClassName(),descriptor.getName()}));
     

      if (oneFailed) {
    result.setStatus(Result.FAILED);
            } else if (foundAtLeastOne == 0) {
                result.setStatus(Result.NOT_APPLICABLE);
      } else {
    result.setStatus(Result.PASSED);
      }

      return result;
  } else {
      addNaDetails(result, compName);
      result.notApplicable(smh.getLocalString
         (getClass().getName() + ".notApplicable",
          "{0} expected {1} bean or {2} bean, but called with {3}.",
          new Object[] {getClass(),"Session","Entity",descriptor.getName()}));
      return result;
  }
View Full Code Here

     * @param descriptor the Enterprise Java Bean deployment descriptor
     * @return <code>Result</code> the results for this assertion
     */
    public Result check(EjbDescriptor descriptor) {
       
        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
       
        if(descriptor.getHomeClassName() == null || "".equals(descriptor.getHomeClassName())){
            addNaDetails(result, compName);
            result.notApplicable(smh.getLocalString
                    ("com.sun.enterprise.tools.verifier.tests.ejb.localinterfaceonly.notapp",
                    "Not Applicable because, EJB [ {0} ] has Local Interfaces only.",
                    new Object[] {descriptor.getEjbClassName()}));
            return result;
        }
       
        if ((descriptor instanceof EjbSessionDescriptor) ||
                (descriptor instanceof EjbEntityDescriptor)) {
           
            boolean oneFailed = false;
            boolean ok = false;
            try {
                ClassLoader jcl = getVerifierContext().getClassLoader();
                Class c = Class.forName(descriptor.getHomeClassName(), false, jcl);
                Class remote = c;
                boolean validHomeInterface = false;
                // walk up the class tree
                do {
                    Class[] interfaces = c.getInterfaces();
                    if ( interfaces.length == 0 ) {
                        ok = true;
                    }
                    for (Class intf: interfaces) {
                        logger.log(Level.FINE, getClass().getName() + ".debug1",
                                new Object[] {intf.getName()});
                       
                        // check to see that interface is a valid RMI-IIOP interface
                        // requirement is met if one superinterface complies.
                        if (!ok) {
                            ok = RmiIIOPUtils.isValidRmiIIOPInterface(intf);
                        }
                       
                        if (RmiIIOPUtils.isValidRmiIIOPInterfaceMethods(intf)) {
                            // this interface is valid, continue
                            if (intf.getName().equals("javax.ejb.EJBHome")) {
                                validHomeInterface = true;
                                break;
                            }
                        } else {
                            // before you determine if this is EJBHome interface, and break
                            // out of loop, report status of SuperInterface
                            oneFailed = true;
                            addErrorDetails(result, compName);
                            result.addErrorDetails(smh.getLocalString
                                    (getClass().getName() + ".failed",
                                    "Error: [ {0} ] does not properly conform to " +
                                    "rules of RMI-IIOP for superinterfaces.  All " +
                                    "enterprise beans home interfaces are allowed " +
                                    "to have superinterfaces that conform to the " +
                                    "rules of RMI-IIOP for superinterfaces .  [ {1} ] " +
                                    "is not a valid home interface.",
                                    new Object[] {intf.getName(),descriptor.getHomeClassName()}));
                        }
                    }
                } while ((((c=c.getSuperclass()) != null) && (!validHomeInterface)));
                // check that superinterface check was a success
                if ( !ok ) {
                    oneFailed = true;
                    addErrorDetails(result, compName);
                    result.addErrorDetails(smh.getLocalString
                            (getClass().getName() + ".failed",
                            "Error: [ {0} ] does not properly conform to rules of " +
                            "RMI-IIOP for superinterfaces.  All enterprise beans " +
                            "home interfaces are allowed to have superinterfaces " +
                            "that conform to the rules of RMI-IIOP for superinterfaces . " +
                            " [{1} ] is not a valid home interface.",
                            new Object[] {remote.getName(),descriptor.getHomeClassName()}));
                }
               
               
                //
                if (validHomeInterface) {
                    addGoodDetails(result, compName);
                    result.addGoodDetails(smh.getLocalString
                            (getClass().getName() + ".passed",
                            "[ {0} ] properly conforms to rules of RMI-IIOP for superinterfaces.",
                            new Object[] {descriptor.getHomeClassName()}));
                }
               
            } catch (ClassNotFoundException e) {
                Verifier.debug(e);
                addErrorDetails(result, compName);
                result.failed(smh.getLocalString
                        (getClass().getName() + ".failedException",
                        "Error: Home interface [ {0} ] does not exist or is not " +
                        "loadable within bean [ {1} ]",
                        new Object[] {descriptor.getHomeClassName(), descriptor.getName()}));
                oneFailed = true;
            }
            if (oneFailed) {
                result.setStatus(Result.FAILED);
            } else {
                result.setStatus(Result.PASSED);
            }
            return result;
           
        } else {
            addNaDetails(result, compName);
            result.notApplicable(smh.getLocalString
                    (getClass().getName() + ".notApplicable",
                    "{0} expected {1} bean or {2} bean, but called with {3}.",
                    new Object[] {getClass(),"Session","Entity",descriptor.getName()}));
            return result;
        }
View Full Code Here

     */

 
    public Result check(EjbDescriptor descriptor) {

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

  if(getHomeInterfaceName(descriptor) == null || "".equals(getHomeInterfaceName(descriptor))){
            result.addNaDetails(smh.getLocalString
                        ("tests.componentNameConstructor", "For [ {0} ]",
                         new Object[] {compName.toString()}));
            result.notApplicable(smh.getLocalString
                       ("com.sun.enterprise.tools.verifier.tests.ejb.localinterfaceonly.notapp",
                        "Not Applicable because, EJB [ {0} ] has Local Interfaces only.",
                                          new Object[] {descriptor.getEjbClassName()}));

      return result;
  }

  if ((descriptor instanceof EjbSessionDescriptor) ||
      (descriptor instanceof EjbEntityDescriptor)) {
      try {
    Context context = getVerifierContext();
    ClassLoader jcl = context.getClassLoader();
    Class c = Class.forName(getClassName(descriptor), false, jcl);
    str = getSuperInterface();
                if (isImplementorOf(c, str)) {
        // it extends the proper EJBHome
        result.addGoodDetails(smh.getLocalString
            ("tests.componentNameConstructor",
             "For [ {0} ]",
             new Object[] {compName.toString()}))
        result.passed(smh.getLocalString
          (getClass().getName() + ".passed",
           "[ {0} ] properly extends the " + str + "interface.",
           new Object[] {getClassName(descriptor)}));
                } else {
        result.addErrorDetails(smh.getLocalString
             ("tests.componentNameConstructor",
              "For [ {0} ]",
              new Object[] {compName.toString()}));
        result.failed(smh.getLocalString
          (getClass().getName() + ".failed",
           "Error: [ {0} ] does not properly extend the  " + str +
           " interface.  All enterprise beans home interfaces must extend the  " + str +
           " interface.  [ {1} ] is not a valid home interface.",
           new Object[] {getClassName(descriptor),getClassName(descriptor)}));
    }
      } catch (ClassNotFoundException e) {
    Verifier.debug(e);
    result.addErrorDetails(smh.getLocalString
               ("tests.componentNameConstructor",
          "For [ {0} ]",
          new Object[] {compName.toString()}));
    result.failed(smh.getLocalString
            (getClass().getName() + ".failedException",
             "Error: [ {0} ] class not found.",
             new Object[] {getClassName(descriptor)}));
     
      return result;
  } else {
      result.addNaDetails(smh.getLocalString
        ("tests.componentNameConstructor",
         "For [ {0} ]",
         new Object[] {compName.toString()}));
      result.notApplicable(smh.getLocalString
         (getClass().getName() + ".notApplicable",
          "[ {0} ] expected {1} bean or {2} bean, but called with {3}.",
          new Object[] {getClass(),"Session","Entity",descriptor.getName()}));
      return result;
  }
View Full Code Here

     *  
     * @return <code>Result</code> the results for this assertion
     */
    public Result check(EjbDescriptor descriptor) {

  Result result = getInitializedResult();
  ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
 
  if(descriptor.getHomeClassName() == null || "".equals(descriptor.getHomeClassName())) {
            addNaDetails(result, compName);
            result.notApplicable(smh.getLocalString
                       ("com.sun.enterprise.tools.verifier.tests.ejb.localinterfaceonly.notapp",
                        "Not Applicable because, EJB [ {0} ] has Local Interfaces only.",
                                          new Object[] {descriptor.getEjbClassName()}));

      return result;
  }
 
  if ((descriptor instanceof EjbSessionDescriptor) ||
      (descriptor instanceof EjbEntityDescriptor)) {
      try {
    ClassLoader jcl = getVerifierContext().getClassLoader();
    Class c = Class.forName(descriptor.getHomeClassName(), false, jcl);

    // remote interface must be defined as valid Rmi-IIOP remote interface
    boolean isValidRmiIIOPInterface = false;
    if (RmiIIOPUtils.isValidRmiIIOPInterface(c) && RmiIIOPUtils.isValidRmiIIOPInterfaceMethods(c)) {
        isValidRmiIIOPInterface = true;
    }
    // remote interface must be defined as valid Rmi-IIOP remote interface
    if (!isValidRmiIIOPInterface){
        addErrorDetails(result, compName);
        result.failed(smh.getLocalString
          (getClass().getName() + ".failed",
           "Error: [ {0} ] is not defined as valid RMI-IIOP remote interface.  All enterprise beans home interfaces must be defined as valid RMI-IIOP remote interface.  [ {1} ] is not a valid remote home interface.",
           new Object[] {descriptor.getHomeClassName(),descriptor.getHomeClassName()}));
    } else {
        addGoodDetails(result, compName);
        result.passed(smh.getLocalString
          (getClass().getName() + ".passed",
           "[ {0} ] properly declares the home interface as valid RMI-IIOP remote interface.",
           new Object[] {descriptor.getHomeClassName()}));
    }
      } catch (ClassNotFoundException e) {
    Verifier.debug(e);
    addErrorDetails(result, compName);
    result.failed(smh.getLocalString
            (getClass().getName() + ".failedException",
             "Error: [ {0} ] class not found.",
             new Object[] {descriptor.getHomeClassName()}));
     
      return result;
  } else {
      addNaDetails(result, compName);
      result.notApplicable(smh.getLocalString
         (getClass().getName() + ".notApplicable",
          "[ {0} ] expected {1} bean or {2} bean, but called with {3}.",
          new Object[] {getClass(),"Session","Entity",descriptor.getName()}));
      return result;
  }
View Full Code Here

{
   
    public Result check(EjbDescriptor descriptor)
    {

  Result result = getInitializedResult();
  ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();     
        String beanCache = null;
        String maxCacheSize = null;       
        try
        {
            beanCache = getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache");
            if(beanCache!=null)
            {
                maxCacheSize=getXPathValue("/sun-ejb-jar/enterprise-beans/ejb[ejb-name=\""+descriptor.getName()+"\"]/bean-cache/max-cache-size");
                if(maxCacheSize!=null)
                {
                    maxCacheSize=maxCacheSize.trim();
                    if(maxCacheSize.length()==0)
                    {
                        addErrorDetails(result, compName);
                        result.failed(smh.getLocalString(getClass().getName()+".failed1",
                            "FAILED [AS-EJB bean-pool] : max-cache-size cannot be empty"));                   
                    }else
                    {
                        try{
                            int cacheValue=new Integer(maxCacheSize).intValue();
                            if(cacheValue <= 1 || cacheValue > Integer.MAX_VALUE)
                            {
                                addErrorDetails(result, compName);
                                result.failed(smh.getLocalString(getClass().getName()+".failed",
                                    "FAILED [AS-EJB bean-cache] : max-cache-size should be greater than 1 and less than MAX_INT"));
                            }
                            else
                            {
                                addGoodDetails(result, compName);
                                result.passed(smh.getLocalString(getClass().getName()+".passed",
                                    "PASSED [AS-EJB bean-cache] : max-cache-size is {0}",new Object[]{(new Integer(maxCacheSize))}));
                            }
                        }catch(NumberFormatException nfex)
                        {
                            Verifier.debug(nfex);
                            addErrorDetails(result, compName);
                            result.failed(smh.getLocalString(getClass().getName()+".failed2",
                                "FAILED [AS-EJB bean-pool] : The value {0} for max-pool-size is not a valid Integer number",new Object[]{maxCacheSize}));

                        }
                    }
                }else //max-cache-size not defined
                {
                    addNaDetails(result, compName);
                    result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
                          "NOT APPLICABLE [AS-EJB bean-cache] : max-cache-size is element not defined"));
               
                }
               
            }else //bean-cache element is not present
            {
                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

public class TagClassExtendsValidInterface extends WebTest implements WebCheck {
    public Result check(WebBundleDescriptor descriptor) {

        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        Context context = getVerifierContext();
        Result result = loadWarFile(descriptor);
        TagLibDescriptor tlds[] = context.getTagLibDescriptors();
        boolean failed=false;
        boolean oneFailed = false;

        if (tlds == null) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                    (getClass().getName() + ".passed",
                            "No tag lib files are specified"));
            return result;

        }
        for(TagLibDescriptor tld : tlds) {
            TagDescriptor[] tagDesc = tld.getTagDescriptors();
            for(TagDescriptor td : tagDesc) {
                String tagclass = td.getTagClass();
                Class c = loadClass(result, tagclass);
                if (c!=null) {
                    if (tld.getSpecVersion().trim().equalsIgnoreCase("2.0")) {
                        failed = !javax.servlet.jsp.tagext.JspTag.class.isAssignableFrom(c);
                    } else {
                        failed = !javax.servlet.jsp.tagext.Tag.class.isAssignableFrom(c);
                    }
                    if(failed) {
                        oneFailed = true;
                        addErrorDetails(result, compName);
                        result.addErrorDetails(smh.getLocalString(getClass().getName() + ".failed",
                                "Error: tag class [ {0} ] in [ {1} ] does not implements valid interface",
                                new Object[] {c.getName(), tld.getUri()}));
                    } else {
                        addGoodDetails(result, compName);
                        result.addGoodDetails(smh.getLocalString
                                (getClass().getName() + ".passed1",
                                        "tag class [ {0} ] in [ {1} ] implements valid interface",
                                        new Object[] {c.getName(), tld.getUri()}));
                    }
                }
            }//for
        }
        if(oneFailed)
            result.setStatus(Result.FAILED);
        else
            result.setStatus(Result.PASSED);

        return result;
    }
View Full Code Here

* @author Vikas Awasthi
*/
public class AroundInvokeNotBusinessMethod extends EjbTest {

    public Result check(EjbDescriptor descriptor) {
        Result result = getInitializedResult();
        ComponentNameConstructor compName = getVerifierContext().getComponentNameConstructor();
        ClassLoader cl = getVerifierContext().getClassLoader();

        if(descriptor.hasAroundInvokeMethod()) {
            Set<MethodDescriptor> businessMethods = descriptor.getMethodDescriptors();
            Set<LifecycleCallbackDescriptor> aiDescriptors =
                                        descriptor.getAroundInvokeDescriptors();
           
            for (LifecycleCallbackDescriptor aiDesc : aiDescriptors) {
                try {
                    Method interceptorMethod = aiDesc.getLifecycleCallbackMethodObject(cl);
                    MethodDescriptor interceptorMD = new MethodDescriptor(interceptorMethod);
                    if(businessMethods.contains(interceptorMD)) {
                        addErrorDetails(result, compName);
                        result.failed(smh.getLocalString
                                (getClass().getName() + ".failed",
                                "AroundInvoke method [ {0} ] is a business method.",
                                new Object[] {interceptorMethod}));
                    }
                } catch (Exception e) {}// will be caught in other tests
            }
        }

        if(result.getStatus()!=Result.FAILED) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                    (getClass().getName() + ".passed",
                            "Valid Interceptor methods."));
        }
        return result;
    }
View Full Code Here

     * @param descriptor the Enterprise Java Bean deployment descriptor
     *
     * @return <code>Result</code> the results for this assertion
     */
    public Result check(EjbDescriptor descriptor) {
        Result result = getInitializedResult();
        ComponentNameConstructor compName =
                getVerifierContext().getComponentNameConstructor();
        boolean isEjb30 = descriptor.getEjbBundleDescriptor().getSpecVersion().equalsIgnoreCase("3.0");
        if(descriptor.isTimedObject()) {
            //Timers can be created for stateless session beans, message-driven beans,
            //and 2.1 entity beans.Timers cannot be created for stateful session beans or EJB 3.0 entities.
            if(((descriptor instanceof EjbEntityDescriptor) && isEjb30)
                    || ( (descriptor instanceof EjbSessionDescriptor) &&
                    ((((EjbSessionDescriptor)descriptor).getSessionType()).equals
                    (EjbSessionDescriptor.STATEFUL)) )) {
                addErrorDetails(result, compName);
                result.failed(smh.getLocalString(getClass().getName()+
                        ".failed1", "[ {0} ] must not implement the TimedObject interface." +
                        "Only 2.1 entity beans or stateless session beans may " +
                        "implement the TimedObject interface" ,
                        new Object[] {descriptor.getEjbClassName()}));
            }
        }
        if(result.getStatus() != Result.FAILED) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString (getClass().getName()+".passed",
                    "[ {0} ] properly implements the TimedObject interface",
                    new Object[] {descriptor.getEjbClassName()}));

        }
        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.