FileDocCategorySizeDatePackage
ASEjbBCMaxCacheSize.javaAPI DocGlassfish v2 API6027Fri May 04 22:35:16 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.ias.beancache

ASEjbBCMaxCacheSize

public class ASEjbBCMaxCacheSize extends ASEjbBeanCache
ejb [0,n] bean-cache ? max-cache-size ? [String] is-cache-overflow-allowed ? [String] cache-idle-timout-in-seconds ? [String] removal-timeout-in-seconds ? [String] victim-selection-policy ? [String] The max-cache-size specifies the maximum number of beans in the cache. Valid values are between 1 and MAX_INT
author
Irfan Ahmed

Fields Summary
Constructors Summary
Methods Summary
public Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)


	Result result = getInitializedResult();
	ComponentNameConstructor compName = new ComponentNameConstructor(descriptor);

        SunEjbJar ejbJar = descriptor.getEjbBundleDescriptor().getIasEjbObject();
        String ejbName = null;
        Ejb testCase = null;
        boolean oneFailed = false;
        if(ejbJar!=null)
        {
            getBeanCache(descriptor,ejbJar);
            if(beanCache!=null)
            {
                try
                {
                    String maxCacheSizeStr = beanCache.getMaxCacheSize();
                    if(maxCacheSizeStr!=null)
                    {
                        if(maxCacheSizeStr.length()==0)
                        {
                            result.failed(smh.getLocalString(getClass().getName()+".failed1",
                                "FAILED [AS-EJB bean-cache] : max-cache-size cannot be empty. It should be between 1 and MAX_INT"));
                        }
                        else
                        {
                            int maxCacheSize = Integer.valueOf(beanCache.getMaxCacheSize()).intValue();
                            if(maxCacheSize < 1 || maxCacheSize > Integer.MAX_VALUE)
                            {
                                result.failed(smh.getLocalString(getClass().getName()+".failed2",
                                    "FAILED [AS-EJB bean-cache] : max-cache-size cannot be less than 1 or greater than MAX_INT"));
                            }
                            else
                                result.passed(smh.getLocalString(getClass().getName()+".passed1",
                                    "PASSED [AS-EJB bean-cache] : max-cache-size is {0}",new Object[]{(new Integer(maxCacheSize))}));
                        }
                    }
                    else
                    {
                        result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
                          "NOT APPLICABLE [AS-EJB bean-cache] : max-cache-size is element not defined"));
                    }
                }
                catch(NumberFormatException nfex)
                {
                    Verifier.debug(nfex);
                    result.failed(smh.getLocalString(getClass().getName()+".failed3", 
                        "FAILED [AS-EJB bean-cache] : max-cache-size is invalid. It should be a valid integer"));
                }
            }
            else
            {
                result.notApplicable(smh.getLocalString(getClass().getName()+".notApplicable",
                    "NOT APPLICABLE [AS-EJB] : bean-cache element not defined"));
            }
        }
        else
        {
            result.addErrorDetails(smh.getLocalString
                                   ("tests.componentNameConstructor",
                                    "For [ {0} ]",
                                    new Object[] {compName.toString()}));
            result.addErrorDetails(smh.getLocalString
                 (getClass().getName() + ".notRun",
                  "NOT RUN [AS-EJB] : Could not create an SunEjbJar object"));
        }
        return result;