mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
完善mock和测试
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@835 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package com.alibaba.druid.bvt.pool.basic;
|
||||
|
||||
import java.util.Hashtable;
|
||||
|
||||
import javax.naming.RefAddr;
|
||||
import javax.naming.Reference;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.junit.Assert;
|
||||
|
||||
import com.alibaba.druid.pool.DruidDataSourceFactory;
|
||||
|
||||
|
||||
public class DruidDataSourceFactoryTest extends TestCase {
|
||||
@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>());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user