org.apache.derbyTesting.functionTests.tests.store
Class BaseTest

java.lang.Object
  extended by org.apache.derbyTesting.functionTests.tests.store.BaseTest
Direct Known Subclasses:
col_rec1, col_rec2, dropcrash, OnlineCompressTest, st_derby715, st_reclaim_longcol

public abstract class BaseTest
extends java.lang.Object

Common utility functions that can be shared across store .java tests.

If more than one store tests wants a function, put it here rather than copy it. Hopefully going forward, with enough utility functions adding new store tests will be easier. New store tests should extend this test to pick up access to utility routines - see OnlineCompressTest.java as an example.


Field Summary
private static boolean debug_system_procedures_created
           
protected static int SPACE_INFO_ESTIMSPACESAVING
           
protected static int SPACE_INFO_IS_INDEX
          call the space table vti.
protected static int SPACE_INFO_NUM_ALLOC
           
protected static int SPACE_INFO_NUM_FREE
           
protected static int SPACE_INFO_NUM_UNFILLED
           
protected static int SPACE_INFO_NUMCOLS
           
protected static int SPACE_INFO_PAGE_SIZE
           
protected static boolean verbose
           
 
Constructor Summary
BaseTest()
           
 
Method Summary
protected  void beginTest(java.sql.Connection conn, java.lang.String str)
           
protected  boolean checkAllConsistency(java.sql.Connection conn)
          Call consistency checker on all the tables.
protected  boolean checkConsistency(java.sql.Connection conn, java.lang.String schemaName, java.lang.String tableName)
          Call consistency checker on the table.
protected  void createDebugSystemProcedures(java.sql.Connection conn)
          Create a system procedures to access SANE debug table routines.
 void createTable(java.sql.Connection conn, java.lang.String tbl_name, java.lang.String create_str)
          create given table on the input connection.
(package private)  java.lang.String dump_table(java.sql.Connection conn, java.lang.String schemaName, java.lang.String tableName, boolean commit_transaction)
          Return string with table information.
protected  void endTest(java.sql.Connection conn, java.lang.String str)
           
 void executeQuery(java.sql.Connection conn, java.lang.String stmt_str, boolean commit_query)
          Simple wrapper to execute a sql string.
protected  java.lang.String get_lock_info(java.sql.Connection conn, boolean include_system_locks)
          Get lock table.
protected  int[] getSpaceInfo(java.sql.Connection conn, java.lang.String schemaName, java.lang.String tableName, boolean commit_xact)
           
protected  void log(java.lang.String str)
           
protected  void logError(java.lang.String str)
           
(package private)  void runTests(java.lang.String[] argv)
           
abstract  void testList(java.sql.Connection conn)
           
protected  void testProgress(java.lang.String str)
           
protected  int total_pages(int[] space_info)
          Given output from getSpaceInfo(), return total pages in file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug_system_procedures_created

private static boolean debug_system_procedures_created

verbose

protected static boolean verbose

SPACE_INFO_IS_INDEX

protected static final int SPACE_INFO_IS_INDEX
call the space table vti.

Utility test function to call the space table vti to get information about allocated and free pages. Information is passed back in an int array as follows: is_index = ret_info[0]; num_alloc = ret_info[1]; num_free = ret_info[2]; page_size = ret_info[3]; estimate_space_savings = ret_info[4];

See Also:
Constant Field Values

SPACE_INFO_NUM_ALLOC

protected static final int SPACE_INFO_NUM_ALLOC
See Also:
Constant Field Values

SPACE_INFO_NUM_FREE

protected static final int SPACE_INFO_NUM_FREE
See Also:
Constant Field Values

SPACE_INFO_NUM_UNFILLED

protected static final int SPACE_INFO_NUM_UNFILLED
See Also:
Constant Field Values

SPACE_INFO_PAGE_SIZE

protected static final int SPACE_INFO_PAGE_SIZE
See Also:
Constant Field Values

SPACE_INFO_ESTIMSPACESAVING

protected static final int SPACE_INFO_ESTIMSPACESAVING
See Also:
Constant Field Values

SPACE_INFO_NUMCOLS

protected static final int SPACE_INFO_NUMCOLS
See Also:
Constant Field Values
Constructor Detail

BaseTest

public BaseTest()
Method Detail

testList

public abstract void testList(java.sql.Connection conn)
                       throws java.sql.SQLException
Throws:
java.sql.SQLException

runTests

void runTests(java.lang.String[] argv)
        throws java.lang.Throwable
Throws:
java.lang.Throwable

beginTest

protected void beginTest(java.sql.Connection conn,
                         java.lang.String str)
                  throws java.sql.SQLException
Throws:
java.sql.SQLException

testProgress

protected void testProgress(java.lang.String str)
                     throws java.sql.SQLException
Throws:
java.sql.SQLException

endTest

protected void endTest(java.sql.Connection conn,
                       java.lang.String str)
                throws java.sql.SQLException
Throws:
java.sql.SQLException

log

protected void log(java.lang.String str)

logError

protected void logError(java.lang.String str)

executeQuery

public void executeQuery(java.sql.Connection conn,
                         java.lang.String stmt_str,
                         boolean commit_query)
                  throws java.sql.SQLException
Simple wrapper to execute a sql string.

Throws:
java.sql.SQLException

checkConsistency

protected boolean checkConsistency(java.sql.Connection conn,
                                   java.lang.String schemaName,
                                   java.lang.String tableName)
                            throws java.sql.SQLException
Call consistency checker on the table.

Throws:
java.sql.SQLException

checkAllConsistency

protected boolean checkAllConsistency(java.sql.Connection conn)
                               throws java.sql.SQLException
Call consistency checker on all the tables.

Throws:
java.sql.SQLException

createDebugSystemProcedures

protected void createDebugSystemProcedures(java.sql.Connection conn)
                                    throws java.sql.SQLException
Create a system procedures to access SANE debug table routines.

Throws:
java.sql.SQLException

dump_table

java.lang.String dump_table(java.sql.Connection conn,
                            java.lang.String schemaName,
                            java.lang.String tableName,
                            boolean commit_transaction)
                      throws java.sql.SQLException
Return string with table information.

Dumps summary store information about the table, also dumps extra information about individual pages into the error log file.

Throws:
java.sql.SQLException

get_lock_info

protected java.lang.String get_lock_info(java.sql.Connection conn,
                                         boolean include_system_locks)
                                  throws java.sql.SQLException
Get lock table.

Returns a single string with a dump of the entire lock table.

Parameters:
conn - The connection to use.
include_system_locks - If true include non-user locks like those requested by background internal threads.
Returns:
The lock table.
Throws:
java.sql.SQLException

createTable

public void createTable(java.sql.Connection conn,
                        java.lang.String tbl_name,
                        java.lang.String create_str)
                 throws java.sql.SQLException
create given table on the input connection.

Takes care of dropping the table if it exists already.

Throws:
StandardException - Standard exception policy.
java.sql.SQLException

getSpaceInfo

protected int[] getSpaceInfo(java.sql.Connection conn,
                             java.lang.String schemaName,
                             java.lang.String tableName,
                             boolean commit_xact)
                      throws java.sql.SQLException
Throws:
java.sql.SQLException

total_pages

protected int total_pages(int[] space_info)
Given output from getSpaceInfo(), return total pages in file.

simply the sum of allocated and free pages.


Built on Sat 2009-11-28 18:44:18-0800, from revision 885187

Apache Derby V10.6 Internals - Copyright © 2004,2008 The Apache Software Foundation. All Rights Reserved.