//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
assertTrue(aes2.didConnectionClosedEventHappen());
assertFalse(aes2.didConnectionErrorEventHappen());
aes2.resetState();
// test "local" XAConnections
xac = dsx.getXAConnection();
AssertEventCatcher aes4 = new AssertEventCatcher(4);
xac.addConnectionEventListener(aes4);
assertConnectionOK(
expectedValues, "XADataSource", xac.getConnection());
//Check if got connection closed event but not connection error event
assertTrue(aes4.didConnectionClosedEventHappen());
assertFalse(aes4.didConnectionErrorEventHappen());
aes4.resetState();
assertConnectionOK(
expectedValues, "XADataSource", xac.getConnection());
//Check if got connection closed event but not connection error event
assertTrue(aes4.didConnectionClosedEventHappen());
assertFalse(aes4.didConnectionErrorEventHappen());
aes4.resetState();
xac.close();
// test "global" XAConnections
xac = dsx.getXAConnection();
AssertEventCatcher aes5 = new AssertEventCatcher(5);
xac.addConnectionEventListener(aes5);
XAResource xar = xac.getXAResource();
// checks currently only implemented for embedded
if (usingEmbedded())