|
|||||||||
| Home >> All >> com >> mysql >> jdbc >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.mysql.jdbc.util
Class BaseBugReport

java.lang.Objectcom.mysql.jdbc.util.BaseBugReport
- public abstract class BaseBugReport
- extends java.lang.Object
Base class to help file bug reports for Connector/J.
MySQL AB
- really
To create a testcase, create a class that inherits from this class (com.mysql.jdbc.util.BaseBugReport), and override the methods 'setUp', 'tearDown' and 'runTest'.
In the 'setUp' method, create code that creates your tables, and populates them with any data needed to demonstrate the bug.
In the 'runTest' method, create code that demonstrates the bug using the tables and data you created in the 'setUp' method.
In the 'tearDown' method, drop any tables you created in the 'setUp' method.
In any of the above three methods, you should use one of the variants of the 'getConnection' method to create a JDBC connection to MySQL, which will use the default JDBC URL of 'jdbc:mysql:///test'.
If you need to use a JDBC URL that is different than 'jdbc:mysql:///test', then override the method 'getUrl' as well.
Use the 'assertTrue' methods to create conditions that must be met in your testcase demonstrating the behavior you are expecting (vs. the behavior you are observing, which is why you are most likely filing a bug report).
Finally, create a 'main' method that creates a new instance of your testcase, and calls the 'run' method:
public static void main(String[] args) throws Exception {
new MyBugReport().run();
}
When filing a potential bug with MySQL Connector/J at http://bugs.mysql.com/ or on the bugs mailing list, please include the code that you have just written using this class.
- Version:
- $Id: BaseBugReport.java,v 1.1.2.6 2004/08/09 22:15:13 mmatthew Exp $
| Field Summary | |
private java.sql.Connection |
conn
|
private com.mysql.jdbc.Driver |
driver
|
| Constructor Summary | |
BaseBugReport()
Constructor for this BugReport, sets up JDBC driver used to create connections. |
|
| Method Summary | |
protected void |
assertTrue(boolean condition)
Throws an exception if condition evalutates to 'false'. |
protected void |
assertTrue(java.lang.String message,
boolean condition)
Throws an exception with the given message if condition evalutates to 'false'. |
java.sql.Connection |
getConnection()
Provides a connection to the JDBC URL specified in getUrl(). |
java.sql.Connection |
getConnection(java.lang.String url)
Returns a connection using the given URL. |
java.sql.Connection |
getConnection(java.lang.String url,
java.util.Properties props)
Returns a connection using the given URL and properties. |
java.sql.Connection |
getNewConnection()
Use this if you need to get a new connection for your bug report (i.e. |
java.lang.String |
getUrl()
Provides the JDBC URL to use to demonstrate the bug. |
void |
run()
Runs the testcase by calling the setUp(), runTest() and tearDown() methods. |
abstract void |
runTest()
Override this method with code that demonstrates the bug. |
abstract void |
setUp()
Override this method with code that sets up the testcase for demonstrating your bug (creating tables, populating data, etc). |
abstract void |
tearDown()
Override this method with code that cleans up anything created in the setUp() method. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
conn
private java.sql.Connection conn
driver
private com.mysql.jdbc.Driver driver
| Constructor Detail |
BaseBugReport
public BaseBugReport()
- Constructor for this BugReport, sets up
JDBC driver used to create connections.
| Method Detail |
setUp
public abstract void setUp()
throws java.lang.Exception
- Override this method with code that sets up the
testcase for demonstrating your bug (creating tables,
populating data, etc).
tearDown
public abstract void tearDown()
throws java.lang.Exception
- Override this method with code that cleans up
anything created in the setUp() method.
runTest
public abstract void runTest()
throws java.lang.Exception
- Override this method with code that demonstrates the bug.
This method will be called after setUp(), and before
tearDown().
run
public final void run()
throws java.lang.Exception
- Runs the testcase by calling the setUp(), runTest()
and tearDown() methods. The tearDown() method is run
regardless of any errors occuring in the other methods.
assertTrue
protected final void assertTrue(java.lang.String message, boolean condition) throws java.lang.Exception
- Throws an exception with the given message if condition
evalutates to 'false'.
assertTrue
protected final void assertTrue(boolean condition)
throws java.lang.Exception
- Throws an exception if condition
evalutates to 'false'.
getUrl
public java.lang.String getUrl()
- Provides the JDBC URL to use to demonstrate the bug. The
java.sql.Connection that you use to demonstrate this bug
will be provided by the getConnection() method using this URL.
The default value is 'jdbc:mysql:///test'
getConnection
public final java.sql.Connection getConnection() throws java.sql.SQLException
- Provides a connection to the JDBC URL specified in getUrl().
If a connection already exists, that connection is returned.
Otherwise a new connection is created.
getNewConnection
public final java.sql.Connection getNewConnection() throws java.sql.SQLException
- Use this if you need to get a new connection for your
bug report (i.e. there's more than one connection involved).
getConnection
public final java.sql.Connection getConnection(java.lang.String url) throws java.sql.SQLException
- Returns a connection using the given URL.
getConnection
public final java.sql.Connection getConnection(java.lang.String url, java.util.Properties props) throws java.sql.SQLException
- Returns a connection using the given URL and properties.
|
|||||||||
| Home >> All >> com >> mysql >> jdbc >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
com.mysql.jdbc.util.BaseBugReport