Source:
<code>public void testFIFO() throws Throwable { assertNotNull(noTxCf); assertNotNull(dr); assertEquals(2, dr.getDeployments().size()); org.ironjacamar.core.api.deploymentrepository.Deployment d = dr .findByJndi("java:/eis/CapacityNoTxConnectionFactory"); assertNotNull(d); org.ironjacamar.core.api.deploymentrepository.ConnectionFactory dcf = d.getConnectionFactories().iterator() .next(); assertNotNull(dcf); org.ironjacamar.core.api.deploymentrepository.Pool p = dcf.getPool(); assertNotNull(p); DefaultPool defaultPool = (DefaultPool) p.getPool(); ConcurrentHashMap<Credential, ManagedConnectionPool> mcps = (ConcurrentHashMap<Credential, ManagedConnectionPool>) TestUtils.extract(defaultPool, "pools"); assertNotNull(mcps); assertEquals(1, mcps.size()); ManagedConnectionPool mcp = mcps.values().iterator().next(); assertNotNull(mcp); ConcurrentLinkedDeque<ConnectionListener> listeners = (ConcurrentLinkedDeque<ConnectionListener>) TestUtils .extract(mcp, "listeners"); assertNotNull(listeners); assertTrue(TestUtils.isCorrectCollectionSizeTenSecTimeout(listeners, 1)); UnifiedSecurityConnection c = noTxCf.getConnection(); assertNotNull(c); assertNull(c.getUserName()); assertNull(c.getPassword()); UnifiedSecurityConnection c1 = noTxCf.getConnection(); assertNotNull(c1); assertNull(c1.getUserName()); assertNull(c1.getPassword()); assertEquals(1, mcps.size()); assertEquals(20, TestUtils.collectionSizeTenSecTimeout(listeners, 20)); c.close(); c1.close(); <START> assertEquals(noTxCf.getConnection().getListeners().get(0), listeners.getFirst()); <END> ((DefaultManagedConnectionPool) mcp).setLastIdleCheck(Long.MIN_VALUE); mcp.removeIdleConnections(); assertEquals(1, TestUtils.collectionSizeTenSecTimeout(listeners, 1)); assertEquals(1, mcps.size()); defaultPool.shutdown(); }</code><technical_language>I is get identity of ConnectionEventListener UnifiedSecurityConnection interface, check "listeners". E.g. expose ConnectionEventListener - category ManagedConnection</technical_language>

Target:
public void testFIFO() throws Throwable { assertNotNull(noTxCf); assertNotNull(dr); assertEquals(2, dr.getDeployments().size()); org.ironjacamar.core.api.deploymentrepository.Deployment d = dr .findByJndi("java:/eis/CapacityNoTxConnectionFactory"); assertNotNull(d); org.ironjacamar.core.api.deploymentrepository.ConnectionFactory dcf = d.getConnectionFactories().iterator() .next(); assertNotNull(dcf); org.ironjacamar.core.api.deploymentrepository.Pool p = dcf.getPool(); assertNotNull(p); DefaultPool defaultPool = (DefaultPool) p.getPool(); ConcurrentHashMap<Credential, ManagedConnectionPool> mcps = (ConcurrentHashMap<Credential, ManagedConnectionPool>) TestUtils.extract(defaultPool, "pools"); assertNotNull(mcps); assertEquals(1, mcps.size()); ManagedConnectionPool mcp = mcps.values().iterator().next(); assertNotNull(mcp); ConcurrentLinkedDeque<ConnectionListener> listeners = (ConcurrentLinkedDeque<ConnectionListener>) TestUtils .extract(mcp, "listeners"); assertNotNull(listeners); assertTrue(TestUtils.isCorrectCollectionSizeTenSecTimeout(listeners, 1)); UnifiedSecurityConnection c = noTxCf.getConnection(); assertNotNull(c); assertNull(c.getUserName()); assertNull(c.getPassword()); UnifiedSecurityConnection c1 = noTxCf.getConnection(); assertNotNull(c1); assertNull(c1.getUserName()); assertNull(c1.getPassword()); assertEquals(1, mcps.size()); assertEquals(20, TestUtils.collectionSizeTenSecTimeout(listeners, 20)); c.close(); c1.close(); assertEquals(noTxCf.getConnection().getListenerIdentity(), System.identityHashCode(listeners.getFirst())); Injection injection = new Injection(); injection.inject(mcp, "lastIdleCheck", Long.MIN_VALUE, long.class.getName(), true); mcp.removeIdleConnections(); assertEquals(1, TestUtils.collectionSizeTenSecTimeout(listeners, 1)); assertEquals(1, mcps.size()); defaultPool.shutdown(); }