FileDocCategorySizeDatePackage
OrbTest.javaAPI DocGlassfish v2 API9054Fri May 04 22:34:12 BST 2007com.sun.enterprise.admin.verifier.tests

OrbTest

public class OrbTest extends ServerXmlTest implements ServerCheck
Test Case to check the validity of Orb fields

Fields Summary
static Logger
_logger
public static final String
ERROR_MSG
Constructors Summary
public OrbTest()

    
      
    
Methods Summary
public Resultcheck(com.sun.enterprise.config.ConfigContext context)

        Result result;
        String msgFragmentSize = null;
        
        result = super.getInitializedResult();
        // 8.0 XML Verifier
        /*try {
            Server server = (Server)context.getRootConfigBean();
            IiopService service = server.getIiopService();
            Orb orb = service.getOrb();
            msgFragmentSize = orb.getMessageFragmentSize();
            
            int size = Integer.parseInt(msgFragmentSize);
            
            int kSize = size/1024;
            int remainder = size%1024;
            
            if (remainder != 0) {
                result.failed(ERROR_MSG);
            }
            else if (!((kSize == 1) || (kSize == 2) || (kSize == 4) || (kSize == 8) || (kSize == 16) || (kSize == 32))) {
                result.failed(ERROR_MSG);
            } else result.passed("Valid Message Fragment Size");
            //Bug 4713369 <addition>
            String steadyPool = orb.getSteadyThreadPoolSize();
            try {
                if(Integer.parseInt(steadyPool) < 0)
                    result.failed(smh.getLocalString(getClass().getName()+".steadyThreadNegative","Steady Thread Pool Size cannot be negative number"));
            } catch(NumberFormatException e) {
                    result.failed(smh.getLocalString(getClass().getName()+".steadyThreadInvalid","Steady Thread Pool Size : invalid number"));
            }
            String maxPool = orb.getMaxThreadPoolSize();
            try {
                if(Integer.parseInt(maxPool) < 0)
                    result.failed(smh.getLocalString(getClass().getName()+".maxPoolNegative","Max Thread Pool Size cannot be negative number"));
            } catch(NumberFormatException e) {
                result.failed(smh.getLocalString(getClass().getName()+".maxPoolInvalid","Max Thread Pool Size : invalid number"));
            }
            String idleTimeout = orb.getIdleThreadTimeoutInSeconds();
            try {
                if(Integer.parseInt(idleTimeout) < 0)
                    result.failed(smh.getLocalString(getClass().getName()+".idleTimeoutNegative","Idle Thread Timeout cannot be negative number"));
            } catch(NumberFormatException e) {
                result.failed(smh.getLocalString(getClass().getName()+".idleTimeoutInvalid","Idle Thread Timeout : invalid number"));
            }
            String conn = orb.getMaxConnections();
            try {
                if(Integer.parseInt(conn) < 0)
                    result.failed(smh.getLocalString(getClass().getName()+".maxConnNegative","Max Connections cannot be negative number"));
            } catch(NumberFormatException e) {
                result.failed(smh.getLocalString(getClass().getName()+".maxConnInvalid","Max Connections : invalid number"));
            }
            //Bug 4713369 </addition>
            
        }
        catch (NumberFormatException nfe) {
            result.failed("Message Fragment Size - " + msgFragmentSize + " : Invalid");
        }
        catch(Exception ex) {
            //<addition author="irfan@sun.com" [bug/rfe]-id="logging" >
            /*ex.printStackTrace();
            result.failed("Exception : " + ex.getMessage());*/
            /*_logger.log(Level.FINE, "serverxmlverifier.exception", ex);
            result.failed("Exception : " + ex.getMessage());
            //</addition>
        }*/
        return result;
    
public Resultcheck(com.sun.enterprise.config.ConfigContextEvent ccce)

        Result result = new Result();
        result.passed("Passed **");
        
        Object value  = ccce.getObject();
        String choice = ccce.getChoice();
        ConfigContext context = ccce.getConfigContext();
        String beanName = ccce.getBeanName();
        String msgFragmentSize = null;
        
        if(beanName!=null)
                return validateAttribute(ccce.getName(), ccce.getObject());
        
        return result;
    
public ResultvalidateAttribute(java.lang.String name, java.lang.Object value)

        Result result = new Result();
        result.passed("Passed **");
        String msgFragmentSize = null;
        
        if(name.equals(ServerTags.MESSAGE_FRAGMENT_SIZE)) {
            try {
                msgFragmentSize = (String) value;
                int size = Integer.parseInt(msgFragmentSize);

                int kSize = size/1024;
                int remainder = size%1024;

                if (remainder != 0) {
                    result.failed(ERROR_MSG);
                }
                else if (!((kSize == 1) || (kSize == 2) || (kSize == 4) || (kSize == 8) || (kSize == 16) || (kSize == 32))) {
                    result.failed(ERROR_MSG);
                } else result.passed("Vaild Message Fragment Size");
            } catch (NumberFormatException nfe) {
                result.failed("Message Fragment Size - " + msgFragmentSize + " : Invalid");
            }
        }
        if(name.equals(ServerTags.MAX_CONNECTIONS)) {
            try {
                if(value != null) {
                    String conn = (String) value;
                    if(Integer.parseInt(conn) < 0) {
                        result.failed(smh.getLocalString(getClass().getName()+".maxConnNegative","Max Connections cannot be negative number"));
                    }
                    else
                        result.passed("Passed ***");

                }
            } catch(NumberFormatException e) {
                result.failed(smh.getLocalString(getClass().getName()+".maxConnInvalid","Max Connections : invalid number"));
            }
        }
        // Bug 4713369 <addition>
        return result;