| org.apache.derbyTesting.functionTests.util.DerbyJUnitTest
All known Subclasses: org.apache.derbyTesting.functionTests.tests.junitTests.compatibility.CompatibilitySuite,
DerbyJUnitTest | public class DerbyJUnitTest extends TestCase (Code) | | |
Constructor Summary | |
public | DerbyJUnitTest()
Vacuous constructor for JUnit machinery. |
Method Summary | |
public static void | alarm(String text)
Print a message regardless of whether we are running in debug mode. | public void | assertColumnEquals(ResultSet rs, int columnNumber, Object[] expectedValues)
Assert the values in a ResultSet for a given column across all rows. | public void | assertColumnEquals(String message, ResultSet rs, int columnNumber, Object expectedValue)
Assert a column's value. | public void | assertRow(ResultSet rs, Object[] expectedRow)
Assert the values of a whole row. | public void | assertScalar(Connection conn, String queryText, Object expectedResult)
Assert a scalar result from a query. | protected static void | close(ResultSet rs)
Close a ResultSet. | protected static void | close(Statement statement)
Close a Statement. | protected static void | close(Connection conn)
Close a Connection. | public void | compareBytes(String message, Object left, Object right)
Assert two byte arrays are equal, allowing nulls to be equal. | public void | compareDates(String message, Object left, Object right)
Assert two Dates are equal, allowing nulls to be equal. | public void | compareObjects(String message, Object left, Object right)
Assert two objects are equal, allowing nulls to be equal. | protected void | createDB(String databaseName)
Create an empty database. | protected static void | dropFunction(Connection conn, String name)
Drop a function regardless of whether it exists. | protected static void | dropProcedure(Connection conn, String name)
Drop a procedure regardless of whether it exists. | protected static void | dropSchemaObject(Connection conn, String genus, String objectName)
Drop a schema object regardless of whether it exists. | protected static void | dropTable(Connection conn, String name)
Drop a table regardless of whether it exists. | protected static void | execute(Connection conn, String text)
Execute a SQL statement, given by the text argument. | protected static void | executeDDL(Connection conn, String text)
Execute DDL statement. | public void | exit(int exitStatus)
Return a meaningful exit status so that calling scripts can take
evasive action. | protected static boolean | faultInDriver(String[] clientSettings)
Load a client driver, given its particulars. | public static void | findClientFromProperties()
Determine the client to use based on system properties. | public static String[] | getClientSettings()
Get the client we're using. | protected Object | getColumn(ResultSet rs, String columnName, int jdbcType)
Read a column from a ResultSet given its column name and expected jdbc
type. | protected Object | getColumn(ResultSet rs, int param, Object value)
Read a column from a ResultSet given its column position
and an expected Java type. | protected static Connection | getConnection()
Get a connection to a database, using the default client. | protected static Connection | getConnection(String[] clientSettings, String databaseName, Properties properties)
Get a connection to a database, using the specified client. | protected Object | getOutArg(CallableStatement cs, int arg, int jdbcType)
Read an output argument from a CallableStatement given its 1-based
argument position and expected jdbc type. | public static void | initializeForOldHarness(String[] args)
Initialize a test suite to run under the old test harness. | public static boolean | parseDebug()
Look for the system property which tells us whether to run
chattily. | protected static PreparedStatement | prepare(Connection conn, String text)
Prepare a SQL statement, given by the text argument. | protected static CallableStatement | prepareCall(Connection conn, String text)
Prepare a SQL call statement, given by the text argument. | public static void | printStackTrace(Throwable t)
Print out a stack trace. | public static void | println(String text)
Debug code to print chatty informational messages. | public static void | runUnderOldHarness(String[] args, Test suite)
Run under the old harness. | public static void | setClient(String[] client)
Set the client we're going to use. | public static void | setDatabaseName(String databaseName)
Set the database name. | public static void | setDebug(boolean value)
Force the debugging state. | protected void | setParameter(PreparedStatement ps, int param, int jdbcType, Object value)
Stuff a PreparedStatement parameter given its 1-based parameter position
and expected jdbc type. | protected void | setParameter(PreparedStatement ps, int param, Object value)
Stuff a PreparedStatement parameter given its 1-based parameter position.
The appropriate setXXX() method is determined by the Java type of the
value being stuffed. | protected String | singleQuote(String text)
Single quote a string. | protected static void | truncateTable(Connection conn, String name)
Scour out all the rows from a table. | public boolean | usingDB2Client() | public boolean | usingDerbyClient() | public boolean | usingEmbeddedClient()
Return true if we're using the embedded driver. |
DATABASE_URL | final public static int DATABASE_URL(Code) | | |
DEBUG_FLAG | final public static String DEBUG_FLAG(Code) | | If you set this startup property to true, you will get chatty output.
|
DEFAULT_DATABASE_NAME | final public static String DEFAULT_DATABASE_NAME(Code) | | |
DEFAULT_PASSWORD | final public static String DEFAULT_PASSWORD(Code) | | |
DEFAULT_USER_NAME | final public static String DEFAULT_USER_NAME(Code) | | |
DRIVER_NAME | final public static int DRIVER_NAME(Code) | | |
FAILURE_EXIT | final public static int FAILURE_EXIT(Code) | | |
FRAMEWORK_NAME | final public static int FRAMEWORK_NAME(Code) | | |
JDBC_BOOLEAN | final protected static int JDBC_BOOLEAN(Code) | | |
LEGAL_CLIENTS | final public static String[][] LEGAL_CLIENTS(Code) | | |
SUCCESS_EXIT | final public static int SUCCESS_EXIT(Code) | | |
DerbyJUnitTest | public DerbyJUnitTest()(Code) | |
Vacuous constructor for JUnit machinery.
|
alarm | public static void alarm(String text)(Code) | |
Print a message regardless of whether we are running in debug mode.
|
assertColumnEquals | public void assertColumnEquals(ResultSet rs, int columnNumber, Object[] expectedValues) throws Exception(Code) | |
Assert the values in a ResultSet for a given column across all rows.
|
close | protected static void close(ResultSet rs)(Code) | |
Close a ResultSet. This method factors out the check for whether
the ResultSet was created in the first place. This tidies up the
caller's cleanup logic. If an error occurs, print it. Because this
method swallows the exception after printing it, do not call this
method if you want your test to halt on error.
|
close | protected static void close(Statement statement)(Code) | |
Close a Statement. This method factors out the check for whether
the Statement was created in the first place. This tidies up the
caller's cleanup logic. If an error occurs, print it. Because this
method swallows the exception after printing it, do not call this
method if you want your test to halt on error.
|
close | protected static void close(Connection conn)(Code) | |
Close a Connection. This method factors out the check for whether
the Connection was created in the first place. This tidies up the
caller's cleanup logic. If an error occurs, print it. Because this
method swallows the exception after printing it, do not call this
method if you want your test to halt on error.
|
dropFunction | protected static void dropFunction(Connection conn, String name)(Code) | |
Drop a function regardless of whether it exists. If the function does not
exist, don't log an error unless
running in debug mode. This method is to be used for reinitializing
a schema in case a previous test run failed to clean up after itself.
Do not use this method if you need to verify that the function really exists.
|
dropProcedure | protected static void dropProcedure(Connection conn, String name)(Code) | |
Drop a procedure regardless of whether it exists. If the procedure does
not exist, don't log an error unless
running in debug mode. This method is to be used for reinitializing
a schema in case a previous test run failed to clean up after itself.
Do not use this method if you need to verify that the procedure really exists.
|
dropSchemaObject | protected static void dropSchemaObject(Connection conn, String genus, String objectName)(Code) | |
Drop a schema object regardless of whether it exists. If the object does
not exist, don't log an error unless
running in debug mode. This method is to be used for reinitializing
a schema in case a previous test run failed to clean up after itself.
Do not use this method if you need to verify that the object really exists.
|
dropTable | protected static void dropTable(Connection conn, String name)(Code) | |
Drop a table regardless of whether it exists. If the table does not
exist, don't log an error unless
running in debug mode. This method is to be used for reinitializing
a schema in case a previous test run failed to clean up after itself.
Do not use this method if you need to verify that the table really exists.
|
execute | protected static void execute(Connection conn, String text) throws SQLException(Code) | |
Execute a SQL statement, given by the text argument. This thin
wrapper around the JDBC machinery logs the statement text when
running in debug mode.
|
exit | public void exit(int exitStatus)(Code) | |
Return a meaningful exit status so that calling scripts can take
evasive action.
|
faultInDriver | protected static boolean faultInDriver(String[] clientSettings)(Code) | |
Load a client driver, given its particulars.
|
findClientFromProperties | public static void findClientFromProperties() throws Exception(Code) | |
Determine the client to use based on system properties.
|
getClientSettings | public static String[] getClientSettings()(Code) | |
Get the client we're using.
|
getColumn | protected Object getColumn(ResultSet rs, String columnName, int jdbcType) throws Exception(Code) | |
Read a column from a ResultSet given its column name and expected jdbc
type. This method is useful if you are want to verify the getXXX() logic
most naturally fitting the declared SQL type.
|
getColumn | protected Object getColumn(ResultSet rs, int param, Object value) throws Exception(Code) | |
Read a column from a ResultSet given its column position
and an expected Java type. This method is useful when
comparing ResultSets against expected values.
Parameters: rs - The ResultSet to read. Parameters: param - The column number (1-based) Parameters: value - An object whose type is what we expect the column to be. |
getConnection | protected static Connection getConnection() throws Exception(Code) | |
Get a connection to a database, using the default client.
|
getOutArg | protected Object getOutArg(CallableStatement cs, int arg, int jdbcType) throws Exception(Code) | |
Read an output argument from a CallableStatement given its 1-based
argument position and expected jdbc type. This is useful for
exercising the getXXX() methods most natural to a declared SQL type.
|
initializeForOldHarness | public static void initializeForOldHarness(String[] args) throws Exception(Code) | |
Initialize a test suite to run under the old test harness.
|
parseDebug | public static boolean parseDebug()(Code) | |
Look for the system property which tells us whether to run
chattily.
|
prepareCall | protected static CallableStatement prepareCall(Connection conn, String text) throws SQLException(Code) | |
Prepare a SQL call statement, given by the text argument. This thin
wrapper around the JDBC machinery logs the statement text when
running in debug mode.
|
printStackTrace | public static void printStackTrace(Throwable t)(Code) | |
Print out a stack trace.
|
println | public static void println(String text)(Code) | |
Debug code to print chatty informational messages.
|
runUnderOldHarness | public static void runUnderOldHarness(String[] args, Test suite) throws Exception(Code) | |
Run under the old harness.
|
setClient | public static void setClient(String[] client)(Code) | |
Set the client we're going to use.
|
setDatabaseName | public static void setDatabaseName(String databaseName)(Code) | |
Set the database name.
|
setDebug | public static void setDebug(boolean value)(Code) | |
Force the debugging state. Useful for debugging under the test harness.
|
setParameter | protected void setParameter(PreparedStatement ps, int param, int jdbcType, Object value) throws Exception(Code) | |
Stuff a PreparedStatement parameter given its 1-based parameter position
and expected jdbc type. This method is useful for testing the setXXX()
methods most natural for a declared SQL type.
|
setParameter | protected void setParameter(PreparedStatement ps, int param, Object value) throws Exception(Code) | |
Stuff a PreparedStatement parameter given its 1-based parameter position.
The appropriate setXXX() method is determined by the Java type of the
value being stuffed. This method is useful for testing setXXX() methods
other than the most natural fit for the declared SQL type.
|
singleQuote | protected String singleQuote(String text)(Code) | |
Single quote a string. This is a helper routine for use in generating
SQL text.
|
usingDB2Client | public boolean usingDB2Client()(Code) | |
Return true if we're using the db2 client
|
usingDerbyClient | public boolean usingDerbyClient()(Code) | |
Return true if we're using the derby client
|
usingEmbeddedClient | public boolean usingEmbeddedClient()(Code) | |
Return true if we're using the embedded driver.
|
|
|