FileDocCategorySizeDatePackage
MethodEndAccessObjectImplTest.javaAPI DocGlassfish v2 API5278Fri May 04 22:24:28 BST 2007com.sun.enterprise.admin.monitor.callflow

MethodEndAccessObjectImplTest

public class MethodEndAccessObjectImplTest extends TestCase
author
Harpreet Singh

Fields Summary
Connection
con
TableAccessObject
me
PreparedStatement
pstmt
MethodEndTO[]
methodEnd
Constructors Summary
public MethodEndAccessObjectImplTest(String testName)

    
    
       
        super(testName);
    
Methods Summary
public static voidmain(java.lang.String[] argList)


        
    
protected voidsetUp()

      try{
            // TODO code application logic here
            String url="jdbc:derby://localhost:1527/sun-callflow;retrieveMessagesFromServerOnGetMessage=true;create=true;";            
            Class.forName("org.apache.derby.jdbc.ClientDriver").newInstance();
            con = DriverManager.getConnection(url, "APP", "APP");         
            // drop request start table
            me = MethodEndAccessObjectImpl.getInstance();            
        } catch (Exception e){
            e.printStackTrace();
        }        
        
    
protected voidtearDown()

        try{
            con.close();
        } finally{
            con = null;
        }
    
public voidtestCreateTable()
Test of createTable method, of class com.sun.enterprise.admin.monitor.callflow.MethodEndAccessObjectImpl.

        System.out.println("Method End : testCreateTable");
        boolean result = false;
        try{
            result = me.createTable(con);
            System.out.println("Method End Create Table returned = "+ result);
        }catch (Exception e){
            e.printStackTrace();
        }
        assertTrue(result);        
    
public voidtestDropTable()
Test of dropTable method, of class com.sun.enterprise.admin.monitor.callflow.MethodEndAccessObjectImpl.

        System.out.println("MethodEnd testDropTable");
        boolean result = me.dropTable(con);
        System.out.println("Method End Drop Table returned = "+result);
        assertTrue (result);              
    
public voidtestInsert()

        System.out.println(" testStoremethodEnd");
        try{
            String insertSQL = me.getInsertSQL();
            System.out.println (" Insert SQL :"+ insertSQL);            
            pstmt = con.prepareStatement(insertSQL);            
            
            for (int i = 0; i < methodEnd.length; i++) {
                methodEnd[i] = new MethodEndTO();
                methodEnd[i].requestId = "RequestID_"+i;
                methodEnd[i].timeStamp = System.nanoTime();
                methodEnd[i].exception = null;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        boolean result = me.insert (pstmt, methodEnd);
        System.out.println("testStoremethodEnd returned = "+result);
        assertTrue (result);