use of com.alibaba.druid.pool.DruidDataSourceFactory in project druid by alibaba.
the class DruidDataSourceFactoryTest0 method test_factory_null.
public void test_factory_null() throws Exception {
DruidDataSourceFactory factory = new DruidDataSourceFactory();
Assert.assertNull(factory.getObjectInstance(null, null, null, null));
}
use of com.alibaba.druid.pool.DruidDataSourceFactory in project druid by alibaba.
the class DruidDataSourceFactoryTest0 method test_factory_null_1.
public void test_factory_null_1() throws Exception {
DruidDataSourceFactory factory = new DruidDataSourceFactory();
Assert.assertNull(factory.getObjectInstance(new Object(), null, null, null));
}
use of com.alibaba.druid.pool.DruidDataSourceFactory in project druid by alibaba.
the class DruidDataSourceFactoryTest method test_factory.
public void test_factory() throws Exception {
DruidDataSourceFactory factory = new DruidDataSourceFactory();
Reference ref = new Reference(DataSource.class.getName());
ref.add(new StringRefAddr(DruidDataSourceFactory.PROP_REMOVEABANDONED, "true"));
ref.add(new StringRefAddr(DruidDataSourceFactory.PROP_MAXACTIVE, "20"));
Hashtable<String, String> env = new Hashtable<String, String>();
dataSource = (DruidDataSource) factory.getObjectInstance(ref, null, null, env);
Assert.assertTrue(dataSource.isRemoveAbandoned());
Assert.assertEquals(20, dataSource.getMaxActive());
}
use of com.alibaba.druid.pool.DruidDataSourceFactory in project druid by alibaba.
the class DruidDataSourceFactoryTest method test_factory.
@SuppressWarnings("serial")
public void test_factory() throws Exception {
DruidDataSourceFactory factory = new DruidDataSourceFactory();
Assert.assertNull(factory.getObjectInstance(null, null, null, null));
Assert.assertNull(factory.getObjectInstance(new Reference("javax.sql.Date"), null, null, null));
Reference ref = new Reference("javax.sql.DataSource");
ref.add(new RefAddr("user") {
@Override
public Object getContent() {
return null;
}
});
ref.add(new RefAddr("defaultReadOnly") {
@Override
public Object getContent() {
return Boolean.TRUE;
}
});
factory.getObjectInstance(ref, null, null, new Hashtable<Object, Object>());
}
Aggregations