public void testPoolAndSessionsWithAcknowledgeMode() throws Exception
{
JmsConnectionPool jmsConnectionPool = JmsConnectionPoolContainer.getPool(environment,"ConnectionFactory");
assertEquals(0, jmsConnectionPool.getSessionsInPool());
JmsSession autoAckSession1 = jmsConnectionPool.getSession(Session.AUTO_ACKNOWLEDGE);
assertEquals(Session.AUTO_ACKNOWLEDGE, autoAckSession1.getAcknowledgeMode());
assertEquals(1, jmsConnectionPool.getSessionsInPool());
assertEquals(1, jmsConnectionPool.getSessionsInPool(Session.AUTO_ACKNOWLEDGE));
JmsSession autoAckSession2 = jmsConnectionPool.getSession(Session.AUTO_ACKNOWLEDGE);
assertEquals(Session.AUTO_ACKNOWLEDGE, autoAckSession2.getAcknowledgeMode());
assertEquals(2, jmsConnectionPool.getSessionsInPool());
assertEquals(2, jmsConnectionPool.getSessionsInPool(Session.AUTO_ACKNOWLEDGE));
JmsSession clientAckSession1 = jmsConnectionPool.getSession(Session.CLIENT_ACKNOWLEDGE);
assertEquals(Session.CLIENT_ACKNOWLEDGE, clientAckSession1.getAcknowledgeMode());
assertEquals(3, jmsConnectionPool.getSessionsInPool());
assertEquals(1, jmsConnectionPool.getSessionsInPool(Session.CLIENT_ACKNOWLEDGE));
JmsSession clientAckSession2 = jmsConnectionPool.getSession(Session.CLIENT_ACKNOWLEDGE);
assertEquals(Session.CLIENT_ACKNOWLEDGE, clientAckSession2.getAcknowledgeMode());
assertEquals(4, jmsConnectionPool.getSessionsInPool());
assertEquals(2, jmsConnectionPool.getSessionsInPool(Session.CLIENT_ACKNOWLEDGE));
JmsSession dupsOkAcSession1 = jmsConnectionPool.getSession(Session.DUPS_OK_ACKNOWLEDGE);
assertEquals(Session.DUPS_OK_ACKNOWLEDGE, dupsOkAcSession1.getAcknowledgeMode());
assertEquals(5, jmsConnectionPool.getSessionsInPool());
assertEquals(1, jmsConnectionPool.getSessionsInPool(Session.DUPS_OK_ACKNOWLEDGE));
JmsSession dupsOkAcSession2 = jmsConnectionPool.getSession(Session.DUPS_OK_ACKNOWLEDGE);
assertEquals(Session.DUPS_OK_ACKNOWLEDGE, dupsOkAcSession2.getAcknowledgeMode());
assertEquals(6, jmsConnectionPool.getSessionsInPool());
assertEquals(2, jmsConnectionPool.getSessionsInPool(Session.DUPS_OK_ACKNOWLEDGE));
//Close them
jmsConnectionPool.closeSession(autoAckSession1);