You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-commits@jackrabbit.apache.org by th...@apache.org on 2012/04/12 16:08:56 UTC

svn commit: r1325270 - /jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java

Author: thomasm
Date: Thu Apr 12 14:08:56 2012
New Revision: 1325270

URL: http://svn.apache.org/viewvc?rev=1325270&view=rev
Log:
OAK-58 connection leak in test case
OAK-60 occasional test case failure DbBlobStoreTest#testGarbageCollection

Modified:
    jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java

Modified: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java?rev=1325270&r1=1325269&r2=1325270&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java (original)
+++ jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java Thu Apr 12 14:08:56 2012
@@ -44,10 +44,11 @@ public class DbBlobStoreTest extends Tes
 
     protected AbstractBlobStore store;
     private Connection sentinel;
+    private JdbcConnectionPool cp;
 
     public void setUp() throws Exception {
         Class.forName("org.h2.Driver");
-        JdbcConnectionPool cp = JdbcConnectionPool.create("jdbc:h2:mem:", "", "");
+        cp = JdbcConnectionPool.create("jdbc:h2:mem:", "", "");
         sentinel = cp.getConnection();
         DbBlobStore blobStore = new DbBlobStore();
         blobStore.setConnectionPool(cp);
@@ -61,6 +62,7 @@ public class DbBlobStoreTest extends Tes
             sentinel.close();
         }
         store.close();
+        cp.dispose();
     }
 
     public void testAddFile() throws Exception {
@@ -213,10 +215,11 @@ public class DbBlobStoreTest extends Tes
         store.clearCache();
 
         // https://issues.apache.org/jira/browse/OAK-60
+        // endure there is at least one old entry (with age 1 ms)
         try {
             Thread.sleep(1);
         } catch (InterruptedException e) {
-
+            // ignore
         }
 
         store.startMark();



Re: svn commit: r1325270 - /jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java

Posted by Julian Reschke <ju...@gmx.de>.
On 2012-04-12 17:04, Jukka Zitting wrote:
> Hi,
>
> On Thu, Apr 12, 2012 at 4:30 PM, Julian Reschke<ju...@gmx.de>  wrote:
>> Nope, it's because the derived test classes do not set "cp" in the setup
>> method, but then do not override tearDown().
>
> I notice you fixed that in revision 1325296.
>
> I cleaned things up a bit more in revision 1325399 by moving the
> generic tests away from DbBlobStoreTest to an abstract base class
> that's shared by the Db, File, Memory and Mongo tests without having
> all of them inherit and/or override the Db set up and tear down code.
> ...

Yes, that's a better approach.

Thanks!

Re: svn commit: r1325270 - /jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java

Posted by Thomas Mueller <mu...@adobe.com>.
Hi,

>I cleaned things up a bit more in revision 1325399 by moving the
>generic tests away from DbBlobStoreTest to an abstract base class
>that's shared by the Db, File, Memory and Mongo tests without having
>all of them inherit and/or override the Db set up and tear down code.

Yes, I should have done that at the very beginning. Sorry about the
confusing code...

Regards,
Thomas


Re: svn commit: r1325270 - /jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java

Posted by Jukka Zitting <ju...@gmail.com>.
Hi,

On Thu, Apr 12, 2012 at 4:30 PM, Julian Reschke <ju...@gmx.de> wrote:
> Nope, it's because the derived test classes do not set "cp" in the setup
> method, but then do not override tearDown().

I notice you fixed that in revision 1325296.

I cleaned things up a bit more in revision 1325399 by moving the
generic tests away from DbBlobStoreTest to an abstract base class
that's shared by the Db, File, Memory and Mongo tests without having
all of them inherit and/or override the Db set up and tear down code.

BR,

Jukka Zitting

Re: svn commit: r1325270 - /jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java

Posted by Julian Reschke <ju...@gmx.de>.
On 2012-04-12 16:19, Julian Reschke wrote:
> On 2012-04-12 16:08, thomasm@apache.org wrote:
>> Author: thomasm
>> Date: Thu Apr 12 14:08:56 2012
>> New Revision: 1325270
>>
>> URL: http://svn.apache.org/viewvc?rev=1325270&view=rev
>> Log:
>> OAK-58 connection leak in test case
>> OAK-60 occasional test case failure DbBlobStoreTest#testGarbageCollection
>>
>> Modified:
>> jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java
>>
>> ...
>
>
> What? :-)
>
> 1) How is this supposed to fix OAK-58?
>
> 2) That being said, I now get all kinds of NPEs?
>
> Is this again a Win-only problem???
> ...

Nope, it's because the derived test classes do not set "cp" in the setup 
method, but then do not override tearDown().

Best regards, Julian

Re: svn commit: r1325270 - /jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java

Posted by Julian Reschke <ju...@gmx.de>.
On 2012-04-12 16:08, thomasm@apache.org wrote:
> Author: thomasm
> Date: Thu Apr 12 14:08:56 2012
> New Revision: 1325270
>
> URL: http://svn.apache.org/viewvc?rev=1325270&view=rev
> Log:
> OAK-58 connection leak in test case
> OAK-60 occasional test case failure DbBlobStoreTest#testGarbageCollection
>
> Modified:
>      jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/blobs/DbBlobStoreTest.java
> ...


What? :-)

1) How is this supposed to fix OAK-58?

2) That being said, I now get all kinds of NPEs?

Is this again a Win-only problem???

Best regards, Julian