Created
June 5, 2012 09:23
-
-
Save MPriess/2873822 to your computer and use it in GitHub Desktop.
ConnectionPool Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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