Java Doc for BaseJDBCTestCase.java in  » Database-DBMS » db-derby-10.2 » org » apache » derbyTesting » junit » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derbyTesting.junit 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.derbyTesting.junit.BaseTestCase
   org.apache.derbyTesting.junit.BaseJDBCTestCase

All known Subclasses:   org.apache.derbyTesting.functionTests.tests.derbynet.ShutDownDBWhenNSShutsDownTest,  org.apache.derbyTesting.functionTests.tests.perf.StartupNewDBTest,  org.apache.derbyTesting.functionTests.tests.jdbc4.CallableStatementTest,  org.apache.derbyTesting.functionTests.tests.jdbcapi.DataSourcePropertiesTest,  org.apache.derbyTesting.functionTests.tests.jdbc4.ParameterMetaDataWrapperTest,  org.apache.derbyTesting.functionTests.tests.tools.sysinfo_api,  org.apache.derbyTesting.functionTests.tests.jdbcapi.URCoveringIndexTest,  org.apache.derbyTesting.functionTests.tests.jdbc4.RowIdNotImplementedTest,  org.apache.derbyTesting.functionTests.tests.jdbc4.UnsupportedVetter,  org.apache.derbyTesting.functionTests.tests.store.BootAllTest,  org.apache.derbyTesting.functionTests.tests.jdbcapi.ProcedureTest,  org.apache.derbyTesting.functionTests.tests.jdbc4.AutoloadBooting,  org.apache.derbyTesting.functionTests.tests.jdbc4.ClosedObjectTest,  org.apache.derbyTesting.functionTests.tests.lang.TimeHandlingTest,  org.apache.derbyTesting.functionTests.tests.jdbc4.AutoloadTest,  org.apache.derbyTesting.functionTests.util.CanonTestCase,  org.apache.derbyTesting.functionTests.tests.jdbc4.PreparedStatementTest,  org.apache.derbyTesting.functionTests.tests.tools.IJRunScriptTest,  org.apache.derbyTesting.functionTests.tests.lang.VTITest,  org.apache.derbyTesting.functionTests.tests.jdbc4.VerifySignatures,  org.apache.derbyTesting.functionTests.tests.perf.StartupExistingDBTest,  org.apache.derbyTesting.functionTests.tests.jdbc4.ResultSetTest,  org.apache.derbyTesting.functionTests.tests.jdbcapi.ScrollResultSetTest,  org.apache.derbyTesting.functionTests.tests.jdbcapi.UpdateXXXTest,  org.apache.derbyTesting.functionTests.tests.jdbc4.SetObjectUnsupportedTest,  org.apache.derbyTesting.functionTests.tests.jdbcapi.BLOBTest,  org.apache.derbyTesting.functionTests.tests.jdbcapi.UpdatableResultSetTest,  org.apache.derbyTesting.functionTests.tests.lang.GroupByExpressionTest,  org.apache.derbyTesting.functionTests.tests.derbynet.SuicideOfStreaming,  org.apache.derbyTesting.functionTests.tests.jdbc4.StatementTest,  org.apache.derbyTesting.functionTests.tests.jdbcapi.SURBaseTest,  org.apache.derbyTesting.functionTests.tests.lang.MathTrigFunctionsTest,  org.apache.derbyTesting.functionTests.tests.jdbc4.DataSourceTest,  org.apache.derbyTesting.functionTests.tests.jdbc4.StatementEventsTest,  org.apache.derbyTesting.functionTests.tests.lang.largeCodeGen,  org.apache.derbyTesting.functionTests.tests.lang.PrepareExecuteDDL,  org.apache.derbyTesting.functionTests.tests.jdbc4.XA40Test,  org.apache.derbyTesting.functionTests.tests.lang.SQLAuthorizationPropTest,  org.apache.derbyTesting.functionTests.tests.jdbc4.ResultSetMetaDataTest,  org.apache.derbyTesting.functionTests.tests.jdbc4.ConnectionTest,  org.apache.derbyTesting.functionTests.tests.jdbcapi.ResultSetCloseTest,
BaseJDBCTestCase
abstract public class BaseJDBCTestCase extends BaseTestCase (Code)
Base class for JDBC JUnit tests. A method for getting a default connection is provided, along with methods for telling if a specific JDBC client is used.



Constructor Summary
public  BaseJDBCTestCase(String name)
     Create a test case with the given name.

Method Summary
public  voidassertCompileError(String sqlState, String query)
     Assert that the query does not compile and throws a SQLException with the expected state.
public static  voidassertEquals(Blob b1, Blob b2)
     Assert equality between two Blob objects. If both input references are null, they are considered equal.
public static  voidassertEquals(Clob c1, Clob c2)
     Assert equality between two Clob objects. If both input references are null, they are considered equal.
public static  voidassertSQLState(String message, String expected, SQLException exception)
     Assert that SQLState is as expected.
public static  voidassertSQLState(String expected, SQLException exception)
     Assert that SQLState is as expected.
public  voidcommit()
     Utility method to commit using the connection returned by getConnection.
public  StatementcreateStatement()
     Utility method to create a Statement using the connection returned by getConnection.
public  StatementcreateStatement(int resultSetType, int resultSetConcurrency)
     Utility method to create a Statement using the connection returned by getConnection.
public  ConnectiongetConnection()
     Obtain the connection to the default database. This class maintains a single connection returned by this class, it is opened on the first call to this method.
public  ConnectiongetConnection(String databaseName, String connAttrs)
     Get a connection to a database using the specified connection attributes.
public  ConnectiongetDefaultConnection(String connAttrs)
     Get a connection to the default database using the specified connection attributes.
protected  voidinitializeConnection(Connection conn)
     Allow a sub-class to initialize a connection to provide consistent connection state for its tests.
public  ConnectionopenConnection(String databaseName)
    
public  ConnectionopenDefaultConnection()
     Open a connection to the default database.
public  CallableStatementprepareCall(String sql)
     Utility method to create a CallableStatement using the connection returned by getConnection.
public  PreparedStatementprepareStatement(String sql)
     Utility method to create a PreparedStatement using the connection returned by getConnection.
public  voidrollback()
     Utility method to rollback using the connection returned by getConnection.
public  intrunSQLCommands(String sqlCommands)
     Run a set of SQL commands from a String discarding the output. Commands are separated by a semi-colon.
public  intrunScript(InputStream script, String encoding)
     Run a SQL script through ij discarding the output using this object's default connection.
protected  voidtearDown()
     Tear down this fixture, sub-classes should call super.tearDown().
public static  booleanusingDerbyNet()
     Tell if the client is DerbyNet.
public static  booleanusingDerbyNetClient()
     Tell if the client is DerbyNetClient.
public static  booleanusingEmbedded()
     Tell if the client is embedded.


Constructor Detail
BaseJDBCTestCase
public BaseJDBCTestCase(String name)(Code)
Create a test case with the given name.
Parameters:
  name - of the test case.




Method Detail
assertCompileError
public void assertCompileError(String sqlState, String query)(Code)
Assert that the query does not compile and throws a SQLException with the expected state.
Parameters:
  sqlstate - expected sql state.
Parameters:
  query - the query to compile.



assertEquals
public static void assertEquals(Blob b1, Blob b2) throws IOException, SQLException(Code)
Assert equality between two Blob objects. If both input references are null, they are considered equal. The same is true if both blobs have null-streams.
Parameters:
  b1 - first Blob.
Parameters:
  b2 - second Blob.
throws:
  AssertionFailedError - if blobs are not equal.
throws:
  IOException - if reading or closing a stream fails
throws:
  SQLException - if obtaining a stream fails



assertEquals
public static void assertEquals(Clob c1, Clob c2) throws IOException, SQLException(Code)
Assert equality between two Clob objects. If both input references are null, they are considered equal. The same is true if both clobs have null-streams.
Parameters:
  c1 - first Clob.
Parameters:
  c2 - second Clob.
throws:
  AssertionFailedError - if clobs are not equal.
throws:
  IOException - if reading or closing a stream fails
throws:
  SQLException - if obtaining a stream fails



assertSQLState
public static void assertSQLState(String message, String expected, SQLException exception)(Code)
Assert that SQLState is as expected.
Parameters:
  message - message to print on failure.
Parameters:
  expected - the expected SQLState.
Parameters:
  exception - the exception to check the SQLState of.



assertSQLState
public static void assertSQLState(String expected, SQLException exception)(Code)
Assert that SQLState is as expected.
Parameters:
  expected - the expected SQLState.
Parameters:
  exception - the exception to check the SQLState of.



commit
public void commit() throws SQLException(Code)
Utility method to commit using the connection returned by getConnection.
throws:
  SQLException -



createStatement
public Statement createStatement() throws SQLException(Code)
Utility method to create a Statement using the connection returned by getConnection. Statement object from getConnection.createStatement()
throws:
  SQLException -



createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException(Code)
Utility method to create a Statement using the connection returned by getConnection. Statement object fromgetConnection.createStatement(resultSetType, resultSetConcurrency)
throws:
  SQLException -



getConnection
public Connection getConnection() throws SQLException(Code)
Obtain the connection to the default database. This class maintains a single connection returned by this class, it is opened on the first call to this method. Subsequent calls will return the same connection object unless it has been closed. In that case a new connection object will be returned.

The tearDown method will close the connection if it is open.
See Also:   TestConfiguration.openDefaultConnection




getConnection
public Connection getConnection(String databaseName, String connAttrs) throws SQLException(Code)
Get a connection to a database using the specified connection attributes.
Parameters:
  databaseName - database to connect to
Parameters:
  connAttrs - connection attributes connection to database
throws:
  SQLException -



getDefaultConnection
public Connection getDefaultConnection(String connAttrs) throws SQLException(Code)
Get a connection to the default database using the specified connection attributes.
Parameters:
  connAttrs - connection attributes connection to default database.
throws:
  SQLException -



initializeConnection
protected void initializeConnection(Connection conn) throws SQLException(Code)
Allow a sub-class to initialize a connection to provide consistent connection state for its tests. Called once for each time these method calls open a connection:
  • getConnection()
  • openDefaultConnection()
  • openConnection(database)
  • getDefaultConnection(String connAttrs)
  • getConnection(String databaseName, String connAttrs)
when getConnection() opens a new connection. Default action is to not modify the connection's state from the initialization provided by the data source.
Parameters:
  conn - Connection to be intialized
throws:
  SQLException - Error setting the initial state.



openConnection
public Connection openConnection(String databaseName) throws SQLException(Code)



openDefaultConnection
public Connection openDefaultConnection() throws SQLException(Code)
Open a connection to the default database. If the database does not exist, it will be created. A default username and password will be used for the connection. connection to default database.
See Also:   TestConfiguration.openDefaultConnection



prepareCall
public CallableStatement prepareCall(String sql) throws SQLException(Code)
Utility method to create a CallableStatement using the connection returned by getConnection. Statement object fromgetConnection().prepareCall(sql)
throws:
  SQLException -



prepareStatement
public PreparedStatement prepareStatement(String sql) throws SQLException(Code)
Utility method to create a PreparedStatement using the connection returned by getConnection. Statement object fromgetConnection.prepareStatement(sql)
throws:
  SQLException -



rollback
public void rollback() throws SQLException(Code)
Utility method to rollback using the connection returned by getConnection.
throws:
  SQLException -



runSQLCommands
public int runSQLCommands(String sqlCommands) throws UnsupportedEncodingException, SQLException(Code)
Run a set of SQL commands from a String discarding the output. Commands are separated by a semi-colon. Connection used is this objects default connection.
Parameters:
  sqlCommands - Number of errors executing the script.
throws:
  UnsupportedEncodingException -
throws:
  SQLException -



runScript
public int runScript(InputStream script, String encoding) throws UnsupportedEncodingException, SQLException(Code)
Run a SQL script through ij discarding the output using this object's default connection. Intended for setup scripts.
throws:
  UnsupportedEncodingException -
throws:
  SQLException -



tearDown
protected void tearDown() throws java.lang.Exception(Code)
Tear down this fixture, sub-classes should call super.tearDown(). This cleanups & closes the connection if it is open.



usingDerbyNet
public static boolean usingDerbyNet()(Code)
Tell if the client is DerbyNet. true if using the DerbyNet clientfalse otherwise.



usingDerbyNetClient
public static boolean usingDerbyNetClient()(Code)
Tell if the client is DerbyNetClient. true if using the DerbyNetClient clientfalse otherwise.



usingEmbedded
public static boolean usingEmbedded()(Code)
Tell if the client is embedded. true if using the embedded clientfalse otherwise.



Methods inherited from org.apache.derbyTesting.junit.BaseTestCase
public static void alarm(String text)(Code)(Java Doc)
public static void assertEquals(InputStream is1, InputStream is2) throws IOException(Code)(Java Doc)
public static void assertEquals(Reader r1, Reader r2) throws IOException(Code)(Java Doc)
public static void assertSecurityManager()(Code)(Java Doc)
final public File getFailureFolder()(Code)(Java Doc)
protected static String getSystemProperty(String name)(Code)(Java Doc)
final public TestConfiguration getTestConfiguration()(Code)(Java Doc)
protected static URL getTestResource(String name)(Code)(Java Doc)
protected static InputStream openTestResource(URL url) throws PrivilegedActionException(Code)(Java Doc)
public static void printStackTrace(Throwable t)(Code)(Java Doc)
public static void println(String text)(Code)(Java Doc)
protected static void removeSystemProperty(String name)(Code)(Java Doc)
final public void runBare() throws Throwable(Code)(Java Doc)
protected static void setSystemProperty(String name, String value)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.