add validationQuery check

This commit is contained in:
wenshao
2012-11-29 16:44:54 +08:00
parent a81c9749fd
commit a5ea83eef1
3 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -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());
}
}