// track-by-tx = true
cm.setTrackConnectionByTx(true);
tm.setTransactionTimeout(2);
TestConnection c = null;
try
{
tm.begin();
assertEquals("1", 0, cm.getPoolingStrategy().getInUseConnectionCount());
c = (TestConnection)cm.allocateConnection(mcf, cri);
assertEquals("2", 1, cm.getPoolingStrategy().getInUseConnectionCount());
Thread.sleep(2500L);
Transaction tx = tm.getTransaction();
if (tx != null && TxUtils.isActive(tx))
fail("TX is still active");
c.close();
c = null;
assertEquals("3", 0, cm.getPoolingStrategy().getInUseConnectionCount());
}
finally
{
if (c != null)
{
c.close();
fail("Connection wasnt closed");
}
assertNotNull(tm);