details:   https://code.openbravo.com/erp/devel/pi/rev/ed2612a8ff29
changeset: 33613:ed2612a8ff29
user:      Asier Lostalé <asier.lostale <at> openbravo.com>
date:      Wed Feb 28 13:04:42 2018 +0100
summary:   fixed bug 38014: DB connection leak using old pool in test cases

  Reuse DalConnectionProvider instead of creating a new ConnectionProviderImpl
  (new pool) each time OBBaseTest.getConnectionProvider is invoked.

diffstat:

 src-test/src/org/openbravo/test/base/OBBaseTest.java |  13 +++----------
 1 files changed, 3 insertions(+), 10 deletions(-)

diffs (39 lines):

diff -r 149e5d9ac93d -r ed2612a8ff29 
src-test/src/org/openbravo/test/base/OBBaseTest.java
--- a/src-test/src/org/openbravo/test/base/OBBaseTest.java      Tue Feb 27 
12:59:41 2018 +0100
+++ b/src-test/src/org/openbravo/test/base/OBBaseTest.java      Wed Feb 28 
13:04:42 2018 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2014-2017 Openbravo SLU 
+ * All portions are Copyright (C) 2014-2018 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -55,10 +55,9 @@
 import org.openbravo.dal.service.OBCriteria;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.database.ConnectionProvider;
-import org.openbravo.database.ConnectionProviderImpl;
 import org.openbravo.database.ExternalConnectionPool;
-import org.openbravo.exception.PoolNotFoundException;
 import org.openbravo.model.ad.access.User;
+import org.openbravo.service.db.DalConnectionProvider;
 
 /**
  * OBBaseTest class which can/should be extended by most other test classes 
which want to make use
@@ -373,13 +372,7 @@
   }
 
   protected ConnectionProvider getConnectionProvider() {
-    try {
-      final String propFile = 
OBConfigFileProvider.getInstance().getFileLocation();
-      final ConnectionProvider conn = new ConnectionProviderImpl(propFile + 
"/Openbravo.properties");
-      return conn;
-    } catch (PoolNotFoundException e) {
-      throw new IllegalStateException(e);
-    }
+    return new DalConnectionProvider(false);
   }
 
   /**

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to