mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
add validationQuery check
This commit is contained in:
@@ -514,7 +514,7 @@
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-core</artifactId>
|
||||
<version>4.1.8.Final</version>
|
||||
<scope>test</scope>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -32,13 +32,16 @@ public class ValidationQueryLogDB2Test extends TestCase {
|
||||
}
|
||||
|
||||
public void test_oracle() throws Exception {
|
||||
Field field = DruidDataSource.class.getDeclaredField("LOG");
|
||||
field.setAccessible(true);
|
||||
Log log = (Log) field.get(null);
|
||||
log.resetStat();
|
||||
|
||||
Connection conn = dataSource.getConnection();
|
||||
|
||||
conn.close();
|
||||
|
||||
Field field = DruidDataSource.class.getDeclaredField("LOG");
|
||||
field.setAccessible(true);
|
||||
Log log = (Log) field.get(null);
|
||||
|
||||
Assert.assertEquals(1, log.getErrorCount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,13 +32,15 @@ public class ValidationQueryLogTest extends TestCase {
|
||||
}
|
||||
|
||||
public void test_oracle() throws Exception {
|
||||
Field field = DruidDataSource.class.getDeclaredField("LOG");
|
||||
field.setAccessible(true);
|
||||
Log log = (Log) field.get(null);
|
||||
log.resetStat();
|
||||
|
||||
Connection conn = dataSource.getConnection();
|
||||
|
||||
conn.close();
|
||||
|
||||
Field field = DruidDataSource.class.getDeclaredField("LOG");
|
||||
field.setAccessible(true);
|
||||
Log log = (Log) field.get(null);
|
||||
Assert.assertEquals(1, log.getErrorCount());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user