ManagedConnectionPool mcp = getOnePool(2);
BaseConnectionManager2 cm = getTxTrackCM(mcp);
try
{
tm.begin();
TestConnection c1 = allocate(cm, cri1);
TestManagedConnection mc1 = c1.getMC();
c1.close();
TestConnection c2 = allocate(cm, cri1);
TestManagedConnection mc2 = c2.getMC();
c2.close();
assertTrue("Connections should be equal in same transaction", mc1.equals(mc2));
Transaction tx1 = tm.suspend();
tm.begin();
c2 = allocate(cm, cri1);
mc2 = c2.getMC();
c2.close();
assertTrue("Connections should not be equal in a different transaction", mc1.equals(mc2) == false);
tm.commit();
c2 = allocate(cm, cri1);
mc2 = c2.getMC();
c2.close();
assertTrue("Connections should not be equal outside a transaction", mc1.equals(mc2) == false);
tm.resume(tx1);
c2 = allocate(cm, cri1);
mc2 = c2.getMC();
c2.close();
assertTrue("Connections should still be equal in same transaction", mc1.equals(mc2));
tm.commit();
assertTrue("All connections should be recycled", mcp.getAvailableConnectionCount() == 2);
}
finally