@Test public void reserveConnection_dataSourceSpecified_shouldReturnValidConnection() throws SQLException { Connection connection = EasyMock.createMock(Connection.class); connection.setAutoCommit(false); EasyMock.expectLastCall(); DataSource ds = EasyMock.createMock(DataSource.class); ds.getConnection(); EasyMock.expectLastCall().andReturn(connection); EasyMock.replay(connection, ds); J2EEConnectionPool pool = new J2EEConnectionPool(ds); Connection c = pool.reserveConnection(); Assert.assertEquals(connection, c); EasyMock.verify(connection, ds); }
@Override public Connection reserveConnection() throws SQLException { Connection conn = getDataSource().getConnection(); conn.setAutoCommit(false); return conn; }
J2EEConnectionPool implements JDBCConnectionPool { @Override public Connection reserveConnection() throws SQLException { Connection conn = getDataSource().getConnection(); conn.setAutoCommit(false); return conn; } }
J2EEConnectionPool implements JDBCConnectionPool { @Override public Connection reserveConnection() throws SQLException { Connection conn = getDataSource().getConnection(); conn.setAutoCommit(false); return conn; } J2EEConnectionPool(DataSource dataSource);  J2EEConnectionPool(String dataSourceJndiName); }
J2EEConnectionPool implements JDBCConnectionPool { @Override public Connection reserveConnection() throws SQLException { Connection conn = getDataSource().getConnection(); conn.setAutoCommit(false); return conn; } J2EEConnectionPool(DataSource dataSource);  J2EEConnectionPool(String dataSourceJndiName); @Override Connection reserveConnection(); @Override void releaseConnection(Connection conn); @Override void destroy(); }
J2EEConnectionPool implements JDBCConnectionPool { @Override public Connection reserveConnection() throws SQLException { Connection conn = getDataSource().getConnection(); conn.setAutoCommit(false); return conn; } J2EEConnectionPool(DataSource dataSource);  J2EEConnectionPool(String dataSourceJndiName); @Override Connection reserveConnection(); @Override void releaseConnection(Connection conn); @Override void destroy();  }