From a5ea83eef1536d1fc0b22b6092c8634ea3846757 Mon Sep 17 00:00:00 2001 From: wenshao Date: Thu, 29 Nov 2012 16:44:54 +0800 Subject: [PATCH] add validationQuery check --- pom.xml | 2 +- .../druid/bvt/pool/ValidationQueryLogDB2Test.java | 9 ++++++--- .../alibaba/druid/bvt/pool/ValidationQueryLogTest.java | 8 +++++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/pom.xml b/pom.xml index 071ab11dd3..d91a256d8d 100644 --- a/pom.xml +++ b/pom.xml @@ -514,7 +514,7 @@ org.hibernate hibernate-core 4.1.8.Final - test + provided diff --git a/src/test/java/com/alibaba/druid/bvt/pool/ValidationQueryLogDB2Test.java b/src/test/java/com/alibaba/druid/bvt/pool/ValidationQueryLogDB2Test.java index 7f4b1cc0b9..ef425fc53c 100644 --- a/src/test/java/com/alibaba/druid/bvt/pool/ValidationQueryLogDB2Test.java +++ b/src/test/java/com/alibaba/druid/bvt/pool/ValidationQueryLogDB2Test.java @@ -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()); } } diff --git a/src/test/java/com/alibaba/druid/bvt/pool/ValidationQueryLogTest.java b/src/test/java/com/alibaba/druid/bvt/pool/ValidationQueryLogTest.java index 4e9c348835..f54c89bc69 100644 --- a/src/test/java/com/alibaba/druid/bvt/pool/ValidationQueryLogTest.java +++ b/src/test/java/com/alibaba/druid/bvt/pool/ValidationQueryLogTest.java @@ -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()); } }