From 2777ac901d29ea169e270870d886675b7d01ed45 Mon Sep 17 00:00:00 2001 From: wenshao Date: Wed, 6 Jul 2011 14:34:11 +0000 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://code.alibabatech.com/svn/druid/trunk@355 b9813039-fb51-4c41-a8b9-e21c2acb5095 --- .../druid/bvt/pool/ManagedDataSourceTest.java | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/test/java/com/alibaba/druid/bvt/pool/ManagedDataSourceTest.java b/src/test/java/com/alibaba/druid/bvt/pool/ManagedDataSourceTest.java index ae179296a8..917fd260c4 100644 --- a/src/test/java/com/alibaba/druid/bvt/pool/ManagedDataSourceTest.java +++ b/src/test/java/com/alibaba/druid/bvt/pool/ManagedDataSourceTest.java @@ -1,6 +1,9 @@ package com.alibaba.druid.bvt.pool; import java.sql.Connection; +import java.sql.SQLException; + +import org.junit.Assert; import junit.framework.TestCase; @@ -20,7 +23,24 @@ public class ManagedDataSourceTest extends TestCase { } public void test_managed() throws Exception { - Connection conn = dataSource.getConnection(); - conn.close(); + { + Connection conn = dataSource.getConnection(); + conn.close(); + } + + dataSource.setEnable(false); + SQLException error = null; + try { + dataSource.getConnection(); + } catch (SQLException ex) { + error = ex; + } + Assert.assertNotNull(error); + + dataSource.setEnable(true); + { + Connection conn = dataSource.getConnection(); + conn.close(); + } } }