Search in sources :

Example 61 with DruidDataSource

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

the class ConfigFilterTest3 method setUp.

protected void setUp() throws Exception {
    dataSource = new DruidDataSource();
    dataSource.setFilters("config");
}
Also used : DruidDataSource(com.alibaba.druid.pool.DruidDataSource)

Example 62 with DruidDataSource

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

the class LogFilterTest2 method setUp.

protected void setUp() throws Exception {
    dataSource = new DruidDataSource();
    dataSource.setUrl("jdbc:derby:classpath:petstore-db");
    dataSource.setFilters("log4j");
}
Also used : DruidDataSource(com.alibaba.druid.pool.DruidDataSource)

Example 63 with DruidDataSource

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

the class LogFilterTest5 method setUp.

protected void setUp() throws Exception {
    dataSource = new DruidDataSource();
    dataSource.setUrl("jdbc:derby:classpath:petstore-db");
    dataSource.setFilters("log4j2");
}
Also used : DruidDataSource(com.alibaba.druid.pool.DruidDataSource)

Example 64 with DruidDataSource

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

the class StatFilterResultSetMultiCloseTest method setUp.

protected void setUp() throws Exception {
    dataSource = new DruidDataSource();
    dataSource.setUrl("jdbc:mock:xxx");
    dataSource.setFilters("stat");
    dataSource.setPoolPreparedStatements(true);
    dataSource.setMaxOpenPreparedStatements(100);
    dataSource.init();
}
Also used : DruidDataSource(com.alibaba.druid.pool.DruidDataSource)

Example 65 with DruidDataSource

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

the class ConfigFilterTest method testInitDecrypt.

@Test
public void testInitDecrypt() throws SQLException {
    DruidDataSource dataSource = new DruidDataSource();
    dataSource.setDriver(MockDriver.instance);
    dataSource.setUrl("");
    dataSource.setUsername("test");
    dataSource.setPassword(encryptedString);
    dataSource.setFilters("config");
    dataSource.setConnectionProperties("config.decrypt=true");
    try {
        dataSource.init();
        Assert.assertEquals("The password is " + dataSource.getPassword() + ", is not xiaoyu", "xiaoyu", dataSource.getPassword());
    } finally {
        JdbcUtils.close(dataSource);
    }
}
Also used : DruidDataSource(com.alibaba.druid.pool.DruidDataSource) Test(org.junit.Test)

Aggregations

DruidDataSource (com.alibaba.druid.pool.DruidDataSource)389 SQLException (java.sql.SQLException)56 OracleMockDriver (com.alibaba.druid.test.util.OracleMockDriver)55 OracleExceptionSorter (com.alibaba.druid.pool.vendor.OracleExceptionSorter)50 MockDriver (com.alibaba.druid.mock.MockDriver)48 Connection (java.sql.Connection)36 FilterAdapter (com.alibaba.druid.filter.FilterAdapter)35 Properties (java.util.Properties)34 FilterChain (com.alibaba.druid.filter.FilterChain)33 ResultSet (java.sql.ResultSet)19 ConnectionProxy (com.alibaba.druid.proxy.jdbc.ConnectionProxy)18 MockConnection (com.alibaba.druid.mock.MockConnection)13 ResultSetProxy (com.alibaba.druid.proxy.jdbc.ResultSetProxy)13 Method (java.lang.reflect.Method)11 PreparedStatement (java.sql.PreparedStatement)11 MockPreparedStatement (com.alibaba.druid.mock.MockPreparedStatement)10 Field (java.lang.reflect.Field)8 MockResultSet (com.alibaba.druid.mock.MockResultSet)7 TabularData (javax.management.openmbean.TabularData)7 MockCallableStatement (com.alibaba.druid.mock.MockCallableStatement)6