(no commit message)
authorerik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Tue, 11 May 2010 21:16:36 +0000 (21:16 +0000)
committererik <erik@77661180-640e-0410-b3a8-9f9b13e6d0e0>
Tue, 11 May 2010 21:16:36 +0000 (21:16 +0000)
test/enterprise/src/test/java/org/wamblee/support/persistence/DatabaseUtilsLeakTest.java [new file with mode: 0644]

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 (file)
index 0000000..75cabee
--- /dev/null
@@ -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());
+    }
+    
+    
+}