| java.lang.Object org.apache.derbyTesting.functionTests.util.TestUtil
TestUtil | public class TestUtil (Code) | | Utility methods for tests, in order to bring some consistency to test
output and handle testing framework differences
|
Method Summary | |
public static String | checkForJDBC40Implementation(String classname) returns the class name for the JDBC40 implementation
if present. | public static void | cleanUpTest(Statement s, String[] testObjects) Drop the test objects passed in as a string identifying the
type of object (e.g. | public static boolean | compareURL(String url) | public static void | dumpSQLExceptions(SQLException sqle) | public static void | dumpSQLExceptions(SQLException sqle, boolean expected) | public static void | endHTMLPage() | public static Connection | getConnection(String databaseName, String connAttrs) Get connection to given database using the connection attributes. | public static javax.sql.ConnectionPoolDataSource | getConnectionPoolDataSource(Properties attrs) | public static javax.sql.DataSource | getDataSource(Properties attrs) | public static Connection | getDataSourceConnection(Properties prop) | public static String | getDataSourcePrefix() | public static String | getGetterName(String attribute) | public static String | getHostName() | public static int | getJDBCMajorVersion(Connection conn) Get the JDBC version, inferring it from the driver. | public static String | getJdbcUrlPrefix() Get URL prefix for current framework. | public static String | getJdbcUrlPrefix(String server, int port) | public static String | getNameFromJdbcType(int jdbcType) | public static String | getSetterName(String attribute) | public static DataSource | getSimpleDataSource(Properties attrs) | public static javax.sql.XADataSource | getXADataSource(Properties attrs) | public static boolean | isDerbyNetClientFramework() | public static boolean | isEmbeddedFramework() | public static boolean | isJCCFramework() | public static boolean | isNetFramework() | public static void | loadDriver() | public static void | printBoolArrayHTMLTable(String rowDescription, String columnDescription, String[] rowLabels, String[] colLabels, boolean[][] array, String tableInfo) Converts 2 dimensional boolean array into an HTML table. | public static void | shutdownUsingDataSource(String dbName) | public static String | sqlNameFromJdbc(int jdbcType) | public static void | startHTMLPage(String title, String author) | public static String | stringToHexLiteral(String s) Just converts a string to a hex literal to assist in converting test
cases that used to insert strings into bit data tables
Converts using UTF-16BE just like the old casts used to. |
DB2JCC_FRAMEWORK | final public static int DB2JCC_FRAMEWORK(Code) | | framework = DB2JCC for testing JCC against DB2 for
debugging jcc problems jdbc:db2://
|
DERBY_NET_CLIENT_FRAMEWORK | final public static int DERBY_NET_CLIENT_FRAMEWORK(Code) | | framework = DerbyNetClient for Derby cient jdbc:derby://
|
DERBY_NET_FRAMEWORK | final public static int DERBY_NET_FRAMEWORK(Code) | | framework = DerbyNet for JCC jdbc:derby:net:
|
EMBEDDED_FRAMEWORK | final public static int EMBEDDED_FRAMEWORK(Code) | | framework = embedded (or null) jdbc:derby:
|
HAVE_DRIVER_CLASS | public static boolean HAVE_DRIVER_CLASS(Code) | | |
OLD_NET_FRAMEWORK | final public static int OLD_NET_FRAMEWORK(Code) | | framework = DB2jNet
OLD_NET_FRAMEWORK is for tests that have not yet been contributed.
it can be removed once all tests are at apache
|
TABLE_START_TAG | public static String TABLE_START_TAG(Code) | | Some routines for printing test information to html *
|
UNKNOWN_FRAMEWORK | final public static int UNKNOWN_FRAMEWORK(Code) | | |
checkForJDBC40Implementation | public static String checkForJDBC40Implementation(String classname)(Code) | | returns the class name for the JDBC40 implementation
if present. otherwise returns the class name of the class
written for the lower jdk versions
Parameters: classname - String String containing the name of the appropriate implementation |
cleanUpTest | public static void cleanUpTest(Statement s, String[] testObjects) throws SQLException(Code) | | Drop the test objects passed in as a string identifying the
type of object (e.g. TABLE, PROCEDURE) and its name.
Thus, for example, a testObject array could be:
{"TABLE MYSCHEMA.MYTABLE", "PROCEDURE THISDUMMY"}
The statement passed in must be a 'live' statement in the test.
|
compareURL | public static boolean compareURL(String url)(Code) | | |
dumpSQLExceptions | public static void dumpSQLExceptions(SQLException sqle, boolean expected)(Code) | | |
endHTMLPage | public static void endHTMLPage()(Code) | | |
getConnection | public static Connection getConnection(String databaseName, String connAttrs) throws SQLException(Code) | | Get connection to given database using the connection attributes. This
method is used by tests to get a secondary connection with
different set of attributes. It does not use what is specified in
app_properties file or system properties. This method uses DataSource
class for CDC/Foundation Profile environments, which are based on
JSR169. Using DataSource will not work with other j9 profiles. So
DriverManager is used for non-JSR169. The method is used as a wrapper to
hide this difference in getting connections in different environments.
Parameters: databaseName - Parameters: connAttrs - Connection to database throws: SQLException - on failure to connect. throws: ClassNotFoundException - on failure to load driver. throws: InstantiationException - on failure to load driver. throws: IllegalAccessException - on failure to load driver. |
getConnectionPoolDataSource | public static javax.sql.ConnectionPoolDataSource getConnectionPoolDataSource(Properties attrs)(Code) | | Get a ConnectionPoolDataSource for the appropriate framework
Parameters: attrs - A set of attribute values to set on the datasource.The appropriate setter method wil bFor example the property databaseName with value wombat,will mean ds.setDatabaseName("wombat") will be called datasource for current framework |
getDataSource | public static javax.sql.DataSource getDataSource(Properties attrs)(Code) | | Get a data source for the appropriate framework
Parameters: attrs - A set of attribute values to set on the datasource.The appropriate setter method wil bFor example the property databaseName with value wombat,will mean ds.setDatabaseName("wombat") will be called datasource for current framework |
getDataSourcePrefix | public static String getDataSourcePrefix()(Code) | | |
getHostName | public static String getHostName()(Code) | | Get hostName as passed in - if not, set it to "localhost"
hostName, as passed into system properties, or "localhost" |
getJDBCMajorVersion | public static int getJDBCMajorVersion(Connection conn)(Code) | | Get the JDBC version, inferring it from the driver.
|
getJdbcUrlPrefix | public static String getJdbcUrlPrefix()(Code) | | Get URL prefix for current framework.
url, assume localhost - unless set differently in System property - and assume port 1527 for Network Tests See Also: getJdbcUrlPrefix(String server, int port) |
getJdbcUrlPrefix | public static String getJdbcUrlPrefix(String server, int port)(Code) | | Get URL prefix for current framework
Parameters: server - host to connect to with client driver ignored for embedded driver Parameters: port - port to connect to with client driverignored with embedded driver URL prefixEMBEDDED_FRAMEWORK returns "jdbc:derby"DERBY_NET_FRAMEWORK = "jdbc:derby:net://:port/"DERBY_NET_CLIENT_FRAMEWORK = "jdbc:derby://:port/"DB2_JCC_FRAMEWORK = "jdbc:db2://:port/" |
getNameFromJdbcType | public static String getNameFromJdbcType(int jdbcType)(Code) | | |
getXADataSource | public static javax.sql.XADataSource getXADataSource(Properties attrs)(Code) | | Get an xa data source for the appropriate framework
Parameters: attrs - A set of attribute values to set on the datasource.The appropriate setter method wil bFor example the property databaseName with value wombat,will mean ds.setDatabaseName("wombat") will be called datasource for current framework |
isDerbyNetClientFramework | public static boolean isDerbyNetClientFramework()(Code) | | |
isEmbeddedFramework | public static boolean isEmbeddedFramework()(Code) | | |
isJCCFramework | public static boolean isJCCFramework()(Code) | | Is the JCC driver being used
true for JCC driver |
isNetFramework | public static boolean isNetFramework()(Code) | | Is this a network testingframework?
return true if the System Property framework is set to Derby Network
client or JCC
true if this is a Network Server test |
loadDriver | public static void loadDriver() throws Exception(Code) | | Load the appropriate driver for the current framework
|
printBoolArrayHTMLTable | public static void printBoolArrayHTMLTable(String rowDescription, String columnDescription, String[] rowLabels, String[] colLabels, boolean[][] array, String tableInfo)(Code) | | Converts 2 dimensional boolean array into an HTML table.
used by casting.java to print out casting doc
Parameters: rowLabels - - Row labels Parameters: colLabels - - Column labels |
sqlNameFromJdbc | public static String sqlNameFromJdbc(int jdbcType)(Code) | | |
stringToHexLiteral | public static String stringToHexLiteral(String s)(Code) | | Just converts a string to a hex literal to assist in converting test
cases that used to insert strings into bit data tables
Converts using UTF-16BE just like the old casts used to.
|
|
|