Java Doc for PooledConnectionRegressionTest.java in  » Database-JDBC-Connection-Pool » mysql » testsuite » regression » 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 JDBC Connection Pool » mysql » testsuite.regression 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


testsuite.BaseTestCase
   testsuite.regression.PooledConnectionRegressionTest

PooledConnectionRegressionTest
final public class PooledConnectionRegressionTest extends BaseTestCase (Code)
Tests a PooledConnection implementation provided by a JDBC driver. Test case provided by Johnny Macchione from bug database record BUG#884. According to the JDBC 2.0 specification:

"Each call to PooledConnection.getConnection() must return a newly constructed Connection object that exhibits the default Connection behavior. Only the most recent Connection object produced from a particular PooledConnection is open. An existing Connection object is automatically closed, if the getConnection() method of its associated Pooled-Connection is called again, before it has been explicitly closed by the application. This gives the application server a way to �take away� a Connection from the application if it wishes, and give it out to someone else. This capability will not likely be used frequently in practice."

"When the application calls Connection.close(), an event is triggered that tells the connection pool it can recycle the physical database connection. In other words, the event signals the connection pool that the PooledConnection object which originally produced the Connection object generating the event can be put back in the connection pool."

"A Connection-EventListener will also be notified when a fatal error occurs, so that it can make a note not to put a bad PooledConnection object back in the cache when the application finishes using it. When an error occurs, the ConnectionEventListener is notified by the JDBC driver, just before the driver throws an SQLException to the application to notify it of the same error. Note that automatic closing of a Connection object as discussed in the previous section does not generate a connection close event."

The JDBC 3.0 specification states the same in other words:

"The Connection.close method closes the logical handle, but the physical connection is maintained. The connection pool manager is notified that the underlying PooledConnection object is now available for reuse. If the application attempts to reuse the logical handle, the Connection implementation throws an SQLException."

"For a given PooledConnection object, only the most recently produced logical Connection object will be valid. Any previously existing Connection object is automatically closed when the associated PooledConnection.getConnection method is called. Listeners (connection pool managers) are not notified in this case. This gives the application server a way to take a connection away from a client. This is an unlikely scenario but may be useful if the application server is trying to force an orderly shutdown."

"A connection pool manager shuts down a physical connection by calling the method PooledConnection.close. This method is typically called only in certain circumstances: when the application server is undergoing an orderly shutdown, when the connection cache is being reinitialized, or when the application server receives an event indicating that an unrecoverable error has occurred on the connection."

Even though the specification isn't clear about it, I think it is no use generating a close event when calling the method PooledConnection.close(), even if a logical Connection is open for this PooledConnection, bc the PooledConnection will obviously not be returned to the pool.
author:
   fcr



Constructor Summary
public  PooledConnectionRegressionTest(String testname)
    

Method Summary
public static  voidmain(String[] args)
    
public  voidsetUp()
     Set up test case before a test is run.
public static  Testsuite()
    
public  voidtearDown()
     After the test is run.
public  voidtestBug7136()
     Tests fix for BUG#7136 ...
public  voidtestCloseEvent()
     Test the nb of closeEvents generated by a PooledConnection.
public  voidtestConnectionReclaim()
     Test the nb of closeEvents generated when a Connection is reclaimed.
public  voidtestPacketTooLargeException()
     Tests that PacketTooLargeException doesn't clober the connection.


Constructor Detail
PooledConnectionRegressionTest
public PooledConnectionRegressionTest(String testname)(Code)
Creates a new instance of ProgressPooledConnectionTest
Parameters:
  testname - DOCUMENT ME!




Method Detail
main
public static void main(String[] args)(Code)
Runs all test cases in this test suite
Parameters:
  args -



setUp
public void setUp() throws Exception(Code)
Set up test case before a test is run.
throws:
  Exception - DOCUMENT ME!



suite
public static Test suite()(Code)
DOCUMENT ME! a test suite composed of this test case.



tearDown
public void tearDown()(Code)
After the test is run.



testBug7136
public void testBug7136()(Code)
Tests fix for BUG#7136 ... Statement.getConnection() returning physical connection instead of logical connection.



testCloseEvent
public void testCloseEvent()(Code)
Test the nb of closeEvents generated by a PooledConnection. A JDBC-compliant driver should only generate 1 closeEvent each time connection.close() is called.



testConnectionReclaim
public void testConnectionReclaim()(Code)
Test the nb of closeEvents generated when a Connection is reclaimed. No event should be generated in that case.



testPacketTooLargeException
public void testPacketTooLargeException() throws Exception(Code)
Tests that PacketTooLargeException doesn't clober the connection.
throws:
  Exception - if the test fails.



Fields inherited from testsuite.BaseTestCase
protected Connection conn(Code)(Java Doc)
protected String dbClass(Code)(Java Doc)
protected static String dbUrl(Code)(Java Doc)
protected PreparedStatement pstmt(Code)(Java Doc)
protected ResultSet rs(Code)(Java Doc)
protected Statement stmt(Code)(Java Doc)

Methods inherited from testsuite.BaseTestCase
protected void cleanupTempFiles(File exampleTempFile, String tempfilePrefix)(Code)(Java Doc)
protected void closeMemberJDBCResources()(Code)(Java Doc)
protected void createFunction(String functionName, String functionDefn) throws SQLException(Code)(Java Doc)
protected void createProcedure(String procedureName, String procedureDefn) throws SQLException(Code)(Java Doc)
protected void createSchemaObject(String objectType, String objectName, String columnsAndOtherStuff) throws SQLException(Code)(Java Doc)
protected void createTable(String tableName, String columnsAndOtherStuff) throws SQLException(Code)(Java Doc)
protected void dropFunction(String functionName) throws SQLException(Code)(Java Doc)
protected void dropProcedure(String procedureName) throws SQLException(Code)(Java Doc)
protected void dropSchemaObject(String objectType, String objectName) throws SQLException(Code)(Java Doc)
protected void dropTable(String tableName) throws SQLException(Code)(Java Doc)
protected Connection getAdminConnection() throws SQLException(Code)(Java Doc)
protected Connection getAdminConnectionWithProps(Properties props) throws SQLException(Code)(Java Doc)
protected Connection getConnectionWithProps(String propsList) throws SQLException(Code)(Java Doc)
protected Connection getConnectionWithProps(String url, String propsList) throws SQLException(Code)(Java Doc)
protected Connection getConnectionWithProps(Properties props) throws SQLException(Code)(Java Doc)
protected Connection getConnectionWithProps(String url, Properties props) throws SQLException(Code)(Java Doc)
protected int getInstanceNumber()(Code)(Java Doc)
protected String getMysqlVariable(Connection c, String variableName) throws SQLException(Code)(Java Doc)
protected String getMysqlVariable(String variableName) throws SQLException(Code)(Java Doc)
protected Properties getPropertiesFromTestsuiteUrl() throws SQLException(Code)(Java Doc)
protected int getRowCount(String tableName) throws SQLException(Code)(Java Doc)
protected Object getSingleIndexedValueWithQuery(Connection c, int columnIndex, String query) throws SQLException(Code)(Java Doc)
protected Object getSingleIndexedValueWithQuery(int columnIndex, String query) throws SQLException(Code)(Java Doc)
protected Object getSingleValue(String tableName, String columnName, String whereClause) throws SQLException(Code)(Java Doc)
protected Object getSingleValueWithQuery(String query) throws SQLException(Code)(Java Doc)
protected boolean isAdminConnectionConfigured()(Code)(Java Doc)
protected boolean isClassAvailable(String classname)(Code)(Java Doc)
protected boolean isRunningOnJRockit()(Code)(Java Doc)
protected boolean isRunningOnJdk131()(Code)(Java Doc)
protected boolean isServerRunningOnWindows() throws SQLException(Code)(Java Doc)
public void logDebug(String message)(Code)(Java Doc)
protected File newTempBinaryFile(String name, long size) throws IOException(Code)(Java Doc)
protected String randomString()(Code)(Java Doc)
final protected boolean runLongTests()(Code)(Java Doc)
protected boolean runMultiHostTests()(Code)(Java Doc)
protected boolean runTestIfSysPropDefined(String propName)(Code)(Java Doc)
public void setUp() throws Exception(Code)(Java Doc)
public void tearDown() throws Exception(Code)(Java Doc)
protected boolean versionMeetsMinimum(int major, int minor) throws SQLException(Code)(Java Doc)
protected boolean versionMeetsMinimum(int major, int minor, int subminor) throws SQLException(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.