}
}
public void test_driver_wrap() throws Exception {
DruidDriver driver = new DruidDriver();
{
ConnectionProxyImpl conn = (ConnectionProxyImpl) driver.connect("jdbc:wrap-jdbc:filters=:name=driverWrapperTest:jdbc:derby:memory:driverWrapperTestDB;create=true",
new Properties());
Assert.assertEquals(0, conn.getDirectDataSource().getProxyFilters().size());
conn.close();
}
{
ConnectionProxyImpl conn = (ConnectionProxyImpl) driver.connect("jdbc:wrap-jdbc:filters=,:name=driverWrapperTest:jdbc:derby:memory:driverWrapperTestDB;create=true",
new Properties());
Assert.assertEquals(0, conn.getDirectDataSource().getProxyFilters().size());
conn.close();
}
{
ConnectionProxyImpl conn = (ConnectionProxyImpl) driver.connect("jdbc:wrap-jdbc:filters=,:jdbc:derby:memory:driverWrapperTestDB;create=true",
new Properties());
Assert.assertEquals(0, conn.getDirectDataSource().getProxyFilters().size());
conn.close();
}
{
ConnectionProxyImpl conn = (ConnectionProxyImpl) driver.connect("jdbc:wrap-jdbc:filters=,:name=:jdbc:derby:memory:driverWrapperTestDB;create=true",
new Properties());
Assert.assertEquals(0, conn.getDirectDataSource().getProxyFilters().size());
conn.close();
}
{
ConnectionProxyImpl conn = (ConnectionProxyImpl) driver.connect("jdbc:wrap-jdbc:driver=:filters=,:name=driverWrapperTest:jdbc:derby:memory:driverWrapperTestDB;create=true",
new Properties());
Assert.assertEquals(0, conn.getDirectDataSource().getProxyFilters().size());
conn.close();
}
{
ConnectionProxyImpl conn = (ConnectionProxyImpl) driver.connect("jdbc:wrap-jdbc:name=driverWrapperTest:jdbc:derby:memory:driverWrapperTestDB;create=true",
new Properties());
Assert.assertEquals(0, conn.getDirectDataSource().getProxyFilters().size());
conn.close();
}
{
ConnectionProxyImpl conn = (ConnectionProxyImpl) driver.connect("jdbc:wrap-jdbc:filters="
+ PublicJdbcFilterAdapter.class.getName()
+ ":name=driverWrapperTest:jdbc:derby:memory:driverWrapperTestDB;create=true",
new Properties());
Assert.assertEquals(1, conn.getDirectDataSource().getProxyFilters().size());
conn.close();
}
{
Exception error = null;
try {
driver.connect("jdbc:wrap-jdbc:filters=" + PrivateJdbcFilterAdapter.class.getName()
+ ":name=driverWrapperTest:jdbc:derby:memory:driverWrapperTestDB;create=true",
new Properties()).close();
} catch (Exception ex) {
error = ex;
}
Assert.assertNotNull(error);
}
{
Exception error = null;
try {
driver.connect("jdbc:wrap-jdbc:filters=" + InitErrorJdbcFilterAdapter.class.getName()
+ ":name=driverWrapperTest:jdbc:derby:memory:driverWrapperTestDB;create=true",
new Properties()).close();
} catch (Exception ex) {
error = ex;
}