tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From andygumbre...@apache.org
Subject tomee git commit: https://issues.apache.org/jira/browse/TOMEE-1860 - Test for close
Date Mon, 11 Jul 2016 21:55:54 GMT
Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x f7c17bf48 -> 2540c683d


https://issues.apache.org/jira/browse/TOMEE-1860 - Test for close


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/2540c683
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/2540c683
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/2540c683

Branch: refs/heads/tomee-1.7.x
Commit: 2540c683d0bfdeb476e870a05e993d09c85d2598
Parents: f7c17bf
Author: AndyGee <andy.is@gmx.de>
Authored: Mon Jul 11 23:55:39 2016 +0200
Committer: AndyGee <andy.is@gmx.de>
Committed: Mon Jul 11 23:55:39 2016 +0200

----------------------------------------------------------------------
 .../openejb/resource/jdbc/DbcpNPEXAConnectionTest.java       | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/2540c683/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/DbcpNPEXAConnectionTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/DbcpNPEXAConnectionTest.java
b/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/DbcpNPEXAConnectionTest.java
index 8aaaed6..5681058 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/DbcpNPEXAConnectionTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/DbcpNPEXAConnectionTest.java
@@ -85,7 +85,9 @@ public class DbcpNPEXAConnectionTest {
 
     @Test
     public void check() throws SQLException {
-        ejb.newConn().close(); // no NPE
+        final Connection con = ejb.newConn();
+        con.close(); // no NPE
+        Assert.assertTrue("Connection was not closed", con.isClosed());
         final GenericObjectPool pool =  GenericObjectPool.class.cast(Reflections.get(ds,
"connectionPool"));
         assertEquals(0, pool.getNumActive());
     }
@@ -96,7 +98,9 @@ public class DbcpNPEXAConnectionTest {
         private DataSource ds;
 
         public Connection newConn() throws SQLException {
-            ds.getConnection().close(); // first connection is not "shared" so closes correctly
+            final Connection con = ds.getConnection();
+            con.close(); // first connection is not "shared" so closes correctly
+            Assert.assertTrue("Connection was not closed", con.isClosed());
             return use(ds.getConnection()); // this one is shared so delegate will be null
and close outside JTA will fail
         }
     }


Mime
View raw message