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

EndTimeAccessObjectImplTest

public class EndTimeAccessObjectImplTest extends TestCase
author
Harpreet Singh

Fields Summary
Connection
con
TableAccessObject
ce
PreparedStatement
pstmt
EndTimeTO[]
endTime
Constructors Summary
public EndTimeAccessObjectImplTest(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
            ce = EndTimeAccessObjectImpl.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.EndTimeAccessObjectImpl.

        System.out.println("End Time: testCreateTable");
        boolean result = false;
        try{
            result = ce.createTable(con);
            System.out.println("End Time 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.EndTimeAccessObjectImpl.

        System.out.println("EndTime testDropTable");
        boolean result = ce.dropTable(con);
        System.out.println("End Time Drop Table returned = "+result);
        assertTrue (result);              
    
public voidtestInsert()

        System.out.println(" testStoreendTime");
        try{
            String insertSQL = ce.getInsertSQL();
            System.out.println (" Insert SQL :"+ insertSQL);            
            pstmt = con.prepareStatement(insertSQL);            
            
            for (int i = 0; i < endTime.length; i++) {
                endTime[i] = new EndTimeTO();
                endTime[i].requestId = "RequestID_"+i;
                endTime[i].timeStamp = System.nanoTime();
                endTime[i].containerTypeOrApplicationType = "ORB";
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        boolean result = ce.insert (pstmt, endTime);
        System.out.println("testStoreendTime returned = "+result);
        assertTrue (result);