use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class ConfigFilterTest method testNormalInit.
@Test
public void testNormalInit() throws SQLException {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:oracle:thin:@");
try {
dataSource.init();
} finally {
JdbcUtils.close(dataSource);
}
}
use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class ConfigFilterTest method testInvalidInit.
@Test
public void testInvalidInit() throws SQLException {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setDriver(MockDriver.instance);
dataSource.setFilters("config");
dataSource.setConnectionProperties("config.file=abcdefeg");
Exception error = null;
try {
dataSource.init();
} catch (IllegalArgumentException e) {
error = e;
} finally {
JdbcUtils.close(dataSource);
}
Assert.assertNotNull(error);
}
use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class ConfigFilterTest method testInitInvalidRemoteConfigFile.
@Test
public void testInitInvalidRemoteConfigFile() throws SQLException {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setFilters("config");
dataSource.setConnectionProperties("config.file=abcdef");
Exception error = null;
try {
dataSource.init();
} catch (IllegalArgumentException e) {
error = e;
} finally {
JdbcUtils.close(dataSource);
}
Assert.assertNotNull(error);
}
use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class ConfigFilterTest method testInitRemoteConfigAndDecrypt.
@Test
public void testInitRemoteConfigAndDecrypt() throws SQLException {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setFilters("config");
dataSource.setConnectionProperties("config.decrypt=true;config.file=" + "file://" + this.filePath);
try {
dataSource.init();
Assert.assertEquals("The password is " + dataSource.getPassword(), "xiaoyu", dataSource.getPassword());
} finally {
JdbcUtils.close(dataSource);
}
}
use of com.alibaba.druid.pool.DruidDataSource in project druid by alibaba.
the class ConfigFilterTest1 method setUp.
protected void setUp() throws Exception {
dataSource = new DruidDataSource();
dataSource.setUrl("jdbc:mock:xxx");
dataSource.setFilters("config");
}
Aggregations