summaryrefslogtreecommitdiff
path: root/src/interfaces/jdbc/org/postgresql/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/jdbc/org/postgresql/test')
-rw-r--r--src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java66
1 files changed, 65 insertions, 1 deletions
diff --git a/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java b/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
index 06f455ea3c7..da467bc22f5 100644
--- a/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
+++ b/src/interfaces/jdbc/org/postgresql/test/jdbc2/optional/ConnectionPoolTest.java
@@ -11,7 +11,7 @@ import java.sql.*;
* interface to the PooledConnection is through the CPDS.
*
* @author Aaron Mulder (ammulder@chariotsolutions.com)
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class ConnectionPoolTest extends BaseDataSourceTest
{
@@ -360,6 +360,70 @@ public class ConnectionPoolTest extends BaseDataSourceTest
}
/**
+ * Ensures that the Statement proxy generated by the Connection handle
+ * throws the correct kind of exception.
+ */
+ public void testStatementProxy() {
+ Statement s = null;
+ try
+ {
+ PooledConnection pc = getPooledConnection();
+ Connection con = pc.getConnection();
+ s = con.createStatement();
+ }
+ catch (SQLException e)
+ {
+ fail(e.getMessage());
+ }
+ try
+ {
+ s.executeQuery("SELECT * FROM THIS_TABLE_SHOULD_NOT_EXIST");
+ fail("An SQL exception was not thrown that should have been");
+ }
+ catch (SQLException e)
+ {
+ ; // This is the expected and correct path
+ }
+ catch (Exception e)
+ {
+ fail("bad exception; was expecting SQLException, not" +
+ e.getClass().getName());
+ }
+ }
+
+ /**
+ * Ensures that the Statement proxy generated by the Connection handle
+ * throws the correct kind of exception.
+ */
+ public void testStatementProxy() {
+ Statement s = null;
+ try
+ {
+ PooledConnection pc = getPooledConnection();
+ Connection con = pc.getConnection();
+ s = con.createStatement();
+ }
+ catch (SQLException e)
+ {
+ fail(e.getMessage());
+ }
+ try
+ {
+ s.executeQuery("SELECT * FROM THIS_TABLE_SHOULD_NOT_EXIST");
+ fail("An SQL exception was not thrown that should have been");
+ }
+ catch (SQLException e)
+ {
+ ; // This is the expected and correct path
+ }
+ catch (Exception e)
+ {
+ fail("bad exception; was expecting SQLException, not" +
+ e.getClass().getName());
+ }
+ }
+
+ /**
* Ensures that a prepared statement generated by a proxied connection
* returns the proxied connection from getConnection() [not the physical
* connection].