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

TransactionServiceTest

public class TransactionServiceTest extends ServerXmlTest implements ServerCheck
PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms. Copyright 2001-2002 by iPlanet/Sun Microsystems, Inc., 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All rights reserved.

Fields Summary
static Logger
_logger
Constructors Summary
public TransactionServiceTest()

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

        Result result;
        result = super.getInitializedResult();
        // 8.0 XML Verifier
        /*try {
            Server server = (Server)context.getRootConfigBean();
            TransactionService txn = server.getTransactionService();
            String file = txn.getTxLogDir();
            // <addition> srini@sun.com Bug : 4698904
            if(file==null || file.equals("")) 
                result.failed("File Name cannot be Null");
            else {
                File f = new File(file);
                if(f.exists())
                    result.passed("Transaction Log Dir valid");
                else
                    result.failed("Invalid Transaction Log Directory - " + file);
            }
            String heuDecision = txn.getHeuristicDecision();
            if(heuDecision.equals("rollback") || heuDecision.equals("commit"))
                result.passed("Heurisitic Decision Valid");
            else
                result.failed("Invalid Heuristic Decision - " + heuDecision );
            // Bug : 4713369 <addition>
            try {
                String resTime = txn.getTimeoutInSeconds();
                if(Integer.parseInt(resTime) < 0) {
                    result.failed(smh.getLocalString(getClass().getName()+".resTimeoutNegative","Response Timeout cannot be negative number"));
                }
                else
                    result.passed("Passed ***");
            }catch(NumberFormatException e) {
                result.failed(smh.getLocalString(getClass().getName()+".resTimeoutInvalid","Response Timeout : invalid number"));
            }
            try {
                String keyPointInterval = txn.getKeypointInterval();
                if(Integer.parseInt(keyPointInterval) < 0) {
                    result.failed(smh.getLocalString(getClass().getName()+".keyPointNegative","Key Point Interval cannot be negative number"));
                }
                else
                    result.passed("Passed ***");
            }catch(NumberFormatException e) {
                result.failed(smh.getLocalString(getClass().getName()+".keyPointInvalid","Key Point Interval : invalid number"));
            }
            // Bug : 4713369 </addition>
        }
        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;
        result = new Result();
        Object value = ccce.getObject();
        String beanName = ccce.getBeanName();
        if(beanName!=null) {
            String name = ccce.getName();
            return testSave(name,(String)value);
        }
        
        TransactionService txn = (TransactionService)value;
        // <addition> srini@sun.com Bug : 4698904
        String file = txn.getTxLogDir();
        if(file==null || file.equals("")) {
                result.failed("File Name cannot be Null");
                return result;
        }
        // </addition>
        File f = new File(txn.getTxLogDir());
        if(f.exists())
            result.passed("Transaction Log Dir valid");
        else
            result.failed("Invalid Transaction Log Directory");
        String heuDecision = txn.getHeuristicDecision();
        if(heuDecision.equals("rollback") || heuDecision.equals("commit"))
            result.passed("Heurisitic Decision Valid");
        else
            result.failed("Invalid Heuristic Decision");
        return result;
    
public ResulttestSave(java.lang.String name, java.lang.String value)

	    Result result = new Result();
            result.passed("Passed **");
	    if(name.equals(ServerTags.TX_LOG_DIR)){
                // <addition> srini@sun.com Bug : 4698904
                if(value==null || value.equals("")) {
                    result.failed("File Name cannot be Null");
                    return result;
                }
                // </addition>
                File f = new File(value);
                if(f.exists())
                    result.passed("Transaction Log Dir valid");
                else
                    result.failed("Invalid Transaction Log Directory");
            }
            else if(name.equals(ServerTags.HEURISTIC_DECISION)){
                if(value.equals("rollback") || value.equals("commit"))
                    result.passed("Heurisitic Decision Valid");
                else
                    result.failed("Invalid Heuristic Decision");
            }
            // Bug : 4713369 <addition>
            else if(name.equals(ServerTags.TIMEOUT_IN_SECONDS)) {
                try {
                    if(Integer.parseInt(value) < 0)
                        result.failed(smh.getLocalString(getClass().getName()+".resTimeoutNegative","Response Timeout cannot be negative number"));
                    else
                        result.passed("Passed ***");
                } catch(NumberFormatException e) {
                    result.failed(smh.getLocalString(getClass().getName()+".resTimeoutInvalid","Response Timeout : invalid number"));
                }
            }
            else if(name.equals(ServerTags.KEYPOINT_INTERVAL)) {
                try {
                    if(Integer.parseInt(value) < 0)
                        result.failed(smh.getLocalString(getClass().getName()+".keyPointNegative","Key Point Interval cannot be negative number"));
                    else
                        result.passed("Passed ***");
                } catch(NumberFormatException e) {
                    result.failed(smh.getLocalString(getClass().getName()+".keyPointInvalid","Key Point Interval : invalid number"));
                }
            }
           // Bug : 4713369 </addition>
            
            return result;