Search in sources :

Example 1 with DruidDataSourceC3P0Adapter

use of com.alibaba.druid.pool.DruidDataSourceC3P0Adapter in project druid by alibaba.

the class DruidDataSourceC3P0AdapterTest method setUp.

protected void setUp() throws Exception {
    dataSource = new DruidDataSourceC3P0Adapter();
    dataSource.setJdbcUrl("jdbc:mock:xxx");
    dataSource.setInitialPoolSize(1);
}
Also used : DruidDataSourceC3P0Adapter(com.alibaba.druid.pool.DruidDataSourceC3P0Adapter)

Example 2 with DruidDataSourceC3P0Adapter

use of com.alibaba.druid.pool.DruidDataSourceC3P0Adapter in project druid by alibaba.

the class DruidDataSourceC3P0AdapterTest method setUp.

protected void setUp() throws Exception {
    Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
    driver = new MockDriver();
    dataSource = new DruidDataSourceC3P0Adapter();
    dataSource.setJdbcUrl("jdbc:mock:xxx");
    dataSource.setDriver(driver);
    dataSource.setInitialPoolSize(1);
    dataSource.setMaxPoolSize(2);
    dataSource.setMinPoolSize(1);
    // 300 / 10
    dataSource.setMaxIdleTime(300);
    // 180 / 10
    dataSource.setIdleConnectionTestPeriod(180);
    dataSource.setTestConnectionOnCheckout(false);
    dataSource.setPreferredTestQuery("SELECT 1");
    dataSource.setFilters("stat");
}
Also used : MockDriver(com.alibaba.druid.mock.MockDriver) DruidDataSourceC3P0Adapter(com.alibaba.druid.pool.DruidDataSourceC3P0Adapter)

Example 3 with DruidDataSourceC3P0Adapter

use of com.alibaba.druid.pool.DruidDataSourceC3P0Adapter in project druid by alibaba.

the class DruidDataSourceC3P0AdapterTest2 method test_0.

public void test_0() throws Exception {
    Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size());
    DruidDataSourceC3P0Adapter dataSource = new DruidDataSourceC3P0Adapter();
    dataSource.setJdbcUrl("jdbc:mock:xxx");
    dataSource.setLogWriter(dataSource.getLogWriter());
    dataSource.setLoginTimeout(dataSource.getLoginTimeout());
    Assert.assertTrue(dataSource.isWrapperFor(DruidDataSourceC3P0Adapter.class));
    Assert.assertTrue(dataSource.isWrapperFor(DruidDataSource.class));
    Assert.assertTrue(dataSource.isWrapperFor(DataSource.class));
    Assert.assertFalse(dataSource.isWrapperFor(null));
    Assert.assertNotNull(dataSource.unwrap(DruidDataSourceC3P0Adapter.class));
    Assert.assertNotNull(dataSource.unwrap(DruidDataSource.class));
    Assert.assertNotNull(dataSource.unwrap(DataSource.class));
    Assert.assertNull(dataSource.unwrap(null));
    dataSource.setProperties(dataSource.getProperties());
    dataSource.setUser(dataSource.getUser());
    dataSource.setPassword(dataSource.getPassword());
    dataSource.setCheckoutTimeout(dataSource.getCheckoutTimeout());
    dataSource.setAutoCommitOnClose(dataSource.isAutoCommitOnClose());
    dataSource.setIdleConnectionTestPeriod(dataSource.getIdleConnectionTestPeriod());
    dataSource.setInitialPoolSize(dataSource.getInitialPoolSize());
    dataSource.setMaxIdleTime(dataSource.getMaxIdleTime());
    dataSource.setMaxPoolSize(dataSource.getMaxPoolSize());
    dataSource.setMinPoolSize(dataSource.getMinPoolSize());
    dataSource.setTestConnectionOnCheckout(dataSource.isTestConnectionOnCheckout());
    dataSource.setTestConnectionOnCheckin(dataSource.isTestConnectionOnCheckin());
    dataSource.setPreferredTestQuery(dataSource.getPreferredTestQuery());
    dataSource.setProxyFilters(dataSource.getProxyFilters());
    dataSource.getDataSourceName();
    dataSource.getNumConnections();
    dataSource.getNumIdleConnections();
    dataSource.getNumBusyConnections();
    dataSource.getNumUnclosedOrphanedConnections();
    dataSource.getNumConnectionsDefaultUser();
    dataSource.getNumIdleConnectionsDefaultUser();
    dataSource.getNumBusyConnectionsDefaultUser();
    dataSource.getMaxStatementsPerConnection();
    dataSource.getMaxStatements();
    dataSource.setUnreturnedConnectionTimeout(dataSource.getUnreturnedConnectionTimeout());
    dataSource.isDebugUnreturnedConnectionStackTraces();
    dataSource.setAcquireRetryAttempts(dataSource.getAcquireRetryAttempts());
    dataSource.setAcquireRetryDelay(dataSource.getAcquireRetryDelay());
    dataSource.setBreakAfterAcquireFailure(dataSource.isBreakAfterAcquireFailure());
    dataSource.isEnable();
    dataSource.shrink();
    dataSource.getWaitThreadCount();
    dataSource.getLockQueueLength();
    dataSource.close();
}
Also used : DruidDataSourceC3P0Adapter(com.alibaba.druid.pool.DruidDataSourceC3P0Adapter) DruidDataSource(com.alibaba.druid.pool.DruidDataSource) DruidDataSource(com.alibaba.druid.pool.DruidDataSource) DataSource(javax.sql.DataSource)

Aggregations

DruidDataSourceC3P0Adapter (com.alibaba.druid.pool.DruidDataSourceC3P0Adapter)3 MockDriver (com.alibaba.druid.mock.MockDriver)1 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)1 DataSource (javax.sql.DataSource)1