InternalManagedConnectionPool.PoolParams pp = new InternalManagedConnectionPool.PoolParams();
pp.minSize = 1;
pp.maxSize = 2;
pp.blockingTimeout = 10000;
ManagedConnectionPool mcp = new JBossManagedConnectionPool.OnePool(mcf, pp, false, log);
NoTxConnectionManager noTxn = new NoTxConnectionManager(null, mcp);
mcp.setConnectionListenerFactory(noTxn);
Connection conn = (Connection)noTxn.allocateConnection(mcf, null);
Object proxy = ((WrappedConnection)conn).getUnderlyingConnection();
TestConnection uc = (TestConnection) Proxy.getInvocationHandler(proxy);
uc.setFail(true);
try
{
conn.createStatement().execute("blah");
}catch(SQLException e)
{
//Normal
assertFalse("Should not be StaleConnectionException", e instanceof StaleConnectionException);
assertTrue("Connection error should be fatal", mcp.getConnectionDestroyedCount() > 0);
}
assertTrue("Exception should be falal", mcp.getConnectionDestroyedCount() > 0);
}