public void testDBCPThreads10Connections10Validate() throws Exception {
init();
this.datasource.getPoolProperties().setMaxActive(10);
- this.datasource.getPoolProperties().setValidationQuery("SELECT 1");
this.datasource.getPoolProperties().setTestOnBorrow(true);
this.threadcount = 10;
this.transferProperties();
public void testPoolThreads10Connections10Validate() throws Exception {
init();
this.datasource.getPoolProperties().setMaxActive(10);
- this.datasource.getPoolProperties().setValidationQuery("SELECT 1");
this.datasource.getPoolProperties().setTestOnBorrow(true);
this.datasource.getPoolProperties().setFairQueue(false);
this.threadcount = 10;
public void testPoolThreads10Connections10ValidateFair() throws Exception {
init();
this.datasource.getPoolProperties().setMaxActive(10);
- this.datasource.getPoolProperties().setValidationQuery("SELECT 1");
this.datasource.getPoolProperties().setTestOnBorrow(true);
this.datasource.getPoolProperties().setFairQueue(true);
this.threadcount = 10;
public void testC3P0Threads10Connections10Validate() throws Exception {
init();
this.datasource.getPoolProperties().setMaxActive(10);
- this.datasource.getPoolProperties().setValidationQuery("SELECT 1");
this.datasource.getPoolProperties().setTestOnBorrow(true);
this.threadcount = 10;
this.transferPropertiesToC3P0();
public void testDBCPThreads20Connections10Validate() throws Exception {
init();
this.datasource.getPoolProperties().setMaxActive(10);
- this.datasource.getPoolProperties().setValidationQuery("SELECT 1");
this.datasource.getPoolProperties().setTestOnBorrow(true);
this.threadcount = 20;
this.transferProperties();
public void testPoolThreads10Connections20Validate() throws Exception {
init();
this.datasource.getPoolProperties().setMaxActive(10);
- this.datasource.getPoolProperties().setValidationQuery("SELECT 1");
this.datasource.getPoolProperties().setTestOnBorrow(true);
this.datasource.getPoolProperties().setFairQueue(false);
this.threadcount = 20;
public void testPoolThreads10Connections20ValidateFair() throws Exception {
init();
this.datasource.getPoolProperties().setMaxActive(10);
- this.datasource.getPoolProperties().setValidationQuery("SELECT 1");
this.datasource.getPoolProperties().setTestOnBorrow(true);
this.datasource.getPoolProperties().setFairQueue(true);
this.threadcount = 20;
public void testC3P0Threads10Connections20Validate() throws Exception {
init();
this.datasource.getPoolProperties().setMaxActive(10);
- this.datasource.getPoolProperties().setValidationQuery("SELECT 1");
this.datasource.getPoolProperties().setTestOnBorrow(true);
this.threadcount = 20;
this.transferPropertiesToC3P0();
public class DefaultProperties extends PoolProperties {
public DefaultProperties() {
dbProperties = new Properties();
- url = "jdbc:mysql://localhost:3306/mysql?autoReconnect=true";
- driverClassName = "com.mysql.jdbc.Driver";
- password = "password";
- username = "root";
+
+ url = System.getProperty("url","jdbc:mysql://localhost:3306/mysql?autoReconnect=true");
+ driverClassName = System.getProperty("driverClassName","com.mysql.jdbc.Driver");
+ password = System.getProperty("password","password");
+ username = System.getProperty("username","root");
+
+ validationQuery = System.getProperty("validationQuery","SELECT 1");
defaultAutoCommit = true;
defaultReadOnly = false;
defaultTransactionIsolation = DataSourceFactory.UNKNOWN_TRANSACTIONISOLATION;
maxIdle = initialSize;
minIdle = initialSize;
maxWait = 10000;
- validationQuery = "SELECT 1";
+
testOnBorrow = true;
testOnReturn = false;
testWhileIdle = true;