dssimple = (DataSource)realdssimple;
assertConnectionOK(
expectedValues, "SimpleDataSource", ds.getConnection());
}
ConnectionPoolDataSource dsp =
J2EEDataSource.getConnectionPoolDataSource();
if (usingEmbedded())
assertToString(dsp);
PooledConnection pc = dsp.getPooledConnection();
// checks currently only implemented for embedded
if (usingEmbedded())
{
SecurityCheck.assertSourceSecurity(
pc, "javax.sql.PooledConnection");
}
AssertEventCatcher aes1 = new AssertEventCatcher(1);
pc.addConnectionEventListener(aes1);
// DERBY-2531
// with Network Server / DerbyNetClient, the assertConnectionOK check
// returns a different connection object...
assertConnectionOK(
expectedValues, "ConnectionPoolDataSource", pc.getConnection());
//Check if got connection closed event but not connection error event
assertTrue(aes1.didConnectionClosedEventHappen());
assertFalse(aes1.didConnectionErrorEventHappen());
aes1.resetState();
assertConnectionOK(
expectedValues, "ConnectionPoolDataSource", pc.getConnection());
//Check if got connection closed event but not connection error event
assertTrue(aes1.didConnectionClosedEventHappen());
assertFalse(aes1.didConnectionErrorEventHappen());
aes1.resetState();
XADataSource dsx = J2EEDataSource.getXADataSource();
if (usingEmbedded())
assertToString(dsx);
// shutdown db and check all's still ok thereafter
TestConfiguration.getCurrent().shutdownDatabase();
dmc = getConnection();
cs = dmc.prepareCall("call checkConn2(?)");
// checks currently only implemented for embedded
if (usingEmbedded())
{
SecurityCheck.assertSourceSecurity(
cs, "java.sql.CallableStatement");
}
cs.setString(1,"Nested");
try {
cs.execute();
} catch (SQLException sqle) {
assertSQLState("40XC0", sqle);
}
cs.setString(1, "Nested2");
cs.execute();
XAConnection xac = dsx.getXAConnection();
// checks currently only implemented for embedded
if (usingEmbedded())
{
SecurityCheck.assertSourceSecurity(xac, "javax.sql.XAConnection");
}
AssertEventCatcher aes3 = new AssertEventCatcher(3);
xac.addConnectionEventListener(aes3);
assertConnectionOK(
expectedValues, "XADataSource", xac.getConnection());
//Check if got connection closed event but not connection error event
assertTrue(aes3.didConnectionClosedEventHappen());
assertFalse(aes3.didConnectionErrorEventHappen());
aes3.resetState();
pc = dsp.getPooledConnection();
AssertEventCatcher aes2 = new AssertEventCatcher(2);
pc.addConnectionEventListener(aes2);
assertConnectionOK(
expectedValues, "ConnectionPoolDataSource", pc.getConnection());
//Check if got connection closed event but not connection error event