From: erik Date: Tue, 11 May 2010 21:16:36 +0000 (+0000) Subject: (no commit message) X-Git-Tag: wamblee-utils-0.2.3~4 X-Git-Url: http://wamblee.org/gitweb/?a=commitdiff_plain;h=d73aa30588ab047c8e89bd5aacda575991631083;p=utils --- diff --git a/test/enterprise/src/test/java/org/wamblee/support/persistence/DatabaseUtilsLeakTest.java b/test/enterprise/src/test/java/org/wamblee/support/persistence/DatabaseUtilsLeakTest.java new file mode 100644 index 00000000..75cabee6 --- /dev/null +++ b/test/enterprise/src/test/java/org/wamblee/support/persistence/DatabaseUtilsLeakTest.java @@ -0,0 +1,44 @@ +package org.wamblee.support.persistence; + +import javax.sql.DataSource; + +import org.dbunit.dataset.DataSetException; +import org.dbunit.dataset.filter.ITableFilterSimple; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import static junit.framework.TestCase.*; + +public class DatabaseUtilsLeakTest { + + private Database db; + private DatabaseUtils dbutils; + + @Before + public void setUp() { + db = DatabaseBuilder.getDatabase(); + DataSource ds = db.start(); + + dbutils = new DatabaseUtils(ds, new ITableFilterSimple() { + @Override + public boolean accept(String aTableName) throws DataSetException { + return false; + } + }); + } + + @After + public void tearDown() { + db.stop(); + } + + @Test + public void testLeak() throws Exception { + assertEquals(0, db.getActiveConnections()); + dbutils.dropTables(); + assertEquals(0, db.getActiveConnections()); + } + + +}