Skip to content

Instantly share code, notes, and snippets.

@MPriess
Created June 5, 2012 09:23
Show Gist options
  • Save MPriess/2873822 to your computer and use it in GitHub Desktop.
Save MPriess/2873822 to your computer and use it in GitHub Desktop.
ConnectionPool Test
public class JUnitTest
{
private PGPoolingDataSource dataSource;
@Before
public void setup() {
dataSource = new PGPoolingDataSource();
dataSource.setServerName("localhost:5432/foo");
dataSource.setUser("postgres");
dataSource.setPassword("postgres");
dataSource.setDataSourceName("myConnectionPool");
dataSource.setInitialConnections(1);
dataSource.setMaxConnections(100);
}
@Test
public void getConnectionFromPool() throws SQLException {
dataSource.getConnection();
dataSource.close();
dataSource.getConnection();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment