|
jxUtil 0.6 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--junit.framework.Assert | +--junit.framework.TestCase | +--org.sourceforge.jxutil.dbtest.DatabaseTest
Superclass for all database tests. All public methods beginning with test will be executed. Test methods need not catch and report unexpected exception, they are being dealt with in the runTest method. When extending DatabaseTest keep in mind, that an instance of this class is created for every test method it defines. Every test method call is prepended with a call to setUp and a tearDown afterwards.
Nested Class Summary | |
static class |
DatabaseTest.ColumnDef
|
static class |
DatabaseTest.TableDef
|
Field Summary | |
private static Category |
cat
|
protected Connection |
conn
|
protected DatabaseMetaData |
dbMeta
|
Fields inherited from class junit.framework.TestCase |
|
Constructor Summary | |
protected |
DatabaseTest(String name)
Run a test. |
Method Summary | |
private void |
assertEquals(Class type,
Object arr,
int aidx,
ResultSet set,
int sidx)
|
protected void |
checkDataCols(Object[] data,
ResultSet set)
Check the data in the givent ResultSet against the reference data in the array organized by columns. |
protected void |
checkDataRows(Object data,
ResultSet set)
Check the data in the givent ResultSet against the reference data in the array organized by row. |
protected void |
createTable(DatabaseTest.TableDef table)
|
protected void |
dropTable(DatabaseTest.TableDef table)
|
protected void |
dropTable(String tableName)
|
protected String |
getColumnString(DatabaseTest.ColumnDef cdef)
|
protected SQLUtil.TypeInfoRow |
getType(int jdbcType)
The test is framed by logging info. |
protected boolean |
isDBMS(String dbms)
|
protected boolean |
isDriver(String driver)
|
protected void |
loadData(DatabaseTest.TableDef table,
Object data)
|
void |
setConnection(Connection conn)
Set the connection and database metadata members. |
protected void |
setUp()
The connection is set to autocommit mode. |
protected void |
setUpDB()
|
protected void |
tearDown()
The current transaction (if any) is aborted and the connection set back to autocommit mode. |
protected void |
tearDownDB()
|
Methods inherited from class junit.framework.TestCase |
countTestCases, createResult, getName, name, run, run, runBare, runTest, setName, toString |
Methods inherited from class junit.framework.Assert |
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private static final Category cat
protected Connection conn
protected DatabaseMetaData dbMeta
Constructor Detail |
protected DatabaseTest(String name)
name
- the method name to invokeMethod Detail |
private void assertEquals(Class type, Object arr, int aidx, ResultSet set, int sidx) throws SQLException
SQLException
protected void checkDataCols(Object[] data, ResultSet set) throws SQLException
SQLException
protected void checkDataRows(Object data, ResultSet set) throws SQLException
SQLException
protected void createTable(DatabaseTest.TableDef table) throws SQLException
SQLException
protected void dropTable(DatabaseTest.TableDef table) throws SQLException
SQLException
protected final void dropTable(String tableName) throws SQLException
SQLException
protected final String getColumnString(DatabaseTest.ColumnDef cdef) throws SQLException
SQLException
protected final SQLUtil.TypeInfoRow getType(int jdbcType) throws SQLException
SQLException
protected final boolean isDBMS(String dbms) throws SQLException
SQLException
protected final boolean isDriver(String driver) throws SQLException
SQLException
protected void loadData(DatabaseTest.TableDef table, Object data) throws SQLException
SQLException
public void setConnection(Connection conn)
protected void setUp() throws Exception
setUp
in class TestCase
Exception
protected void setUpDB() throws SQLException
SQLException
protected void tearDown() throws Exception
tearDown
in class TestCase
Exception
protected void tearDownDB() throws SQLException
SQLException
|
jxUtil 0.6 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |