mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
添加测试
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@362 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.alibaba.druid.bvt.pool;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.junit.Assert;
|
||||
@@ -23,19 +24,22 @@ public class ManagedDataSourceTest extends TestCase {
|
||||
}
|
||||
|
||||
public void test_managed() throws Exception {
|
||||
DriverManager.getConnection("jdbc:mock:aaa");
|
||||
{
|
||||
Connection conn = dataSource.getConnection();
|
||||
conn.close();
|
||||
}
|
||||
|
||||
dataSource.setEnable(false);
|
||||
SQLException error = null;
|
||||
try {
|
||||
dataSource.getConnection();
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
{
|
||||
dataSource.setEnable(false);
|
||||
SQLException error = null;
|
||||
try {
|
||||
dataSource.getConnection();
|
||||
} catch (SQLException ex) {
|
||||
error = ex;
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
}
|
||||
Assert.assertNotNull(error);
|
||||
|
||||
dataSource.setEnable(true);
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user